@getflip/swirl-components 0.185.1 → 0.188.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 +17 -17
- package/dist/cjs/file-manager.cjs.entry.js +1 -1
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/swirl-accordion-item.cjs.entry.js +1 -1
- package/dist/cjs/swirl-app-layout_6.cjs.entry.js +2 -2
- package/dist/cjs/swirl-color-input.cjs.entry.js +2 -2
- package/dist/cjs/swirl-components.cjs.js +1 -1
- package/dist/cjs/swirl-date-input.cjs.entry.js +1 -1
- package/dist/cjs/swirl-icon-check-small_3.cjs.entry.js +1 -1
- package/dist/cjs/swirl-lightbox.cjs.entry.js +1 -1
- package/dist/cjs/swirl-pdf-reader.cjs.entry.js +1 -1
- package/dist/cjs/swirl-popover_2.cjs.entry.js +8 -6
- package/dist/cjs/swirl-select.cjs.entry.js +1 -1
- package/dist/cjs/swirl-shell-layout.cjs.entry.js +1 -1
- package/dist/cjs/v4-c23234d2.js +68 -0
- package/dist/cjs/wc-datepicker.cjs.entry.js +1 -1
- package/dist/collection/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/collection/components/swirl-color-input/swirl-color-input.js +2 -2
- package/dist/collection/components/swirl-color-input/swirl-color-input.spec.js +1 -1
- package/dist/collection/components/swirl-date-input/swirl-date-input.js +1 -1
- package/dist/collection/components/swirl-date-input/swirl-date-input.spec.js +2 -2
- package/dist/collection/components/swirl-lightbox/swirl-lightbox.js +1 -1
- package/dist/collection/components/swirl-menu/swirl-menu.spec.js +2 -2
- package/dist/collection/components/swirl-menu/swirl-menu.stories.js +1 -1
- package/dist/collection/components/swirl-pdf-reader/swirl-pdf-reader.js +1 -1
- package/dist/collection/components/swirl-popover/swirl-popover.spec.js +2 -2
- package/dist/collection/components/swirl-popover/swirl-popover.stories.js +1 -1
- package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.js +28 -26
- package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.spec.js +2 -2
- package/dist/collection/components/swirl-popover-trigger/swirl-popover-trigger.stories.js +2 -2
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.js +5 -5
- package/dist/collection/components/swirl-resource-list-item/swirl-resource-list-item.stories.js +1 -1
- package/dist/collection/components/swirl-select/swirl-select.js +2 -2
- package/dist/collection/components/swirl-shell-layout/swirl-shell-layout.css +1 -2
- package/dist/collection/prototypes/file-manager/file-manager.js +1 -1
- package/dist/components/assets/pdfjs/pdf.worker.min.js +1 -1
- package/dist/components/file-manager.js +1 -1
- package/dist/components/swirl-color-input.js +1 -1
- package/dist/components/swirl-date-input.js +1 -1
- package/dist/components/swirl-lightbox.js +1 -1
- package/dist/components/swirl-pdf-reader.js +1 -1
- package/dist/components/swirl-popover-trigger2.js +10 -8
- package/dist/components/swirl-resource-list-item2.js +1 -1
- package/dist/components/swirl-select.js +1 -1
- package/dist/components/swirl-shell-layout.js +1 -1
- package/dist/components/v4.js +21 -30
- package/dist/components/wc-datepicker2.js +1 -1
- package/dist/esm/file-manager.entry.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/swirl-accordion-item.entry.js +1 -1
- package/dist/esm/swirl-app-layout_6.entry.js +2 -2
- package/dist/esm/swirl-color-input.entry.js +2 -2
- package/dist/esm/swirl-components.js +1 -1
- package/dist/esm/swirl-date-input.entry.js +1 -1
- package/dist/esm/swirl-icon-check-small_3.entry.js +1 -1
- package/dist/esm/swirl-lightbox.entry.js +1 -1
- package/dist/esm/swirl-pdf-reader.entry.js +1 -1
- package/dist/esm/swirl-popover_2.entry.js +8 -6
- package/dist/esm/swirl-select.entry.js +1 -1
- package/dist/esm/swirl-shell-layout.entry.js +1 -1
- package/dist/esm/v4-23648a96.js +66 -0
- package/dist/esm/wc-datepicker.entry.js +1 -1
- package/dist/swirl-components/{p-11886515.entry.js → p-04969f21.entry.js} +1 -1
- package/dist/swirl-components/{p-703f1075.entry.js → p-0faff2bc.entry.js} +1 -1
- package/dist/swirl-components/p-14616bce.js +1 -0
- package/dist/swirl-components/p-2e35b2b1.entry.js +1 -0
- package/dist/swirl-components/{p-d0be5bf2.entry.js → p-346653d4.entry.js} +1 -1
- package/dist/swirl-components/{p-0fb68fa4.entry.js → p-679fd8e4.entry.js} +1 -1
- package/dist/swirl-components/{p-ae0b305d.entry.js → p-829dc2e3.entry.js} +1 -1
- package/dist/swirl-components/{p-3485cf5d.entry.js → p-8c6e6625.entry.js} +1 -1
- package/dist/swirl-components/p-9c5878f6.entry.js +1 -0
- package/dist/swirl-components/{p-178aa1bb.entry.js → p-ac721109.entry.js} +1 -1
- package/dist/swirl-components/{p-ff15c52e.entry.js → p-cac3cd93.entry.js} +1 -1
- package/dist/swirl-components/{p-bbdbc3ed.entry.js → p-df8f0b77.entry.js} +1 -1
- package/dist/swirl-components/{p-9a1c32ff.entry.js → p-eed0048b.entry.js} +1 -1
- package/dist/swirl-components/swirl-components.esm.js +1 -1
- package/dist/types/components/swirl-popover-trigger/swirl-popover-trigger.d.ts +1 -1
- package/dist/types/components/swirl-popover-trigger/swirl-popover-trigger.stories.d.ts +1 -1
- package/dist/types/components/swirl-resource-list-item/swirl-resource-list-item.d.ts +1 -1
- package/dist/types/components/swirl-select/swirl-select.d.ts +1 -1
- package/dist/types/components.d.ts +2 -2
- package/package.json +1 -1
- package/vscode-data.json +2 -2
- package/dist/cjs/v4-8e8d6fbc.js +0 -77
- package/dist/esm/v4-fa4bb814.js +0 -75
- package/dist/swirl-components/p-19b890a3.js +0 -1
- package/dist/swirl-components/p-34e94b6a.entry.js +0 -1
- package/dist/swirl-components/p-f934f4be.entry.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,h as t,F as s,c as o,H as e,g as l}from"./p-e5528e8a.js";import{c as r}from"./p-b7898321.js";import{g as n}from"./p-ae2bed6f.js";import{v as a}from"./p-19b890a3.js";const h=class{constructor(t){i(this,t),this.color=void 0,this.size=24}render(){const i=20===this.size?24:this.size,o={color:Boolean(this.color)?`var(--s-icon-${this.color})`:void 0},e=r("swirl-icon",`swirl-icon--size-${this.size}`);return t("svg",{"aria-hidden":"true",class:e,fill:"none",height:this.size,part:"icon",style:o,viewBox:`0 0 ${i} ${i}`,width:this.size,xmlns:"http://www.w3.org/2000/svg"},16===this.size&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.4142 4.91924C12.8047 5.30976 12.8047 5.94293 12.4142 6.33345L7.08086 11.6667C6.69033 12.0572 6.05717 12.0572 5.66664 11.6667L3.70711 9.70707C3.31658 9.31655 3.31658 8.68338 3.70711 8.29286C4.09763 7.90233 4.7308 7.90233 5.12132 8.29286L6.37375 9.54539L11 4.91924C11.3905 4.52871 12.0237 4.52871 12.4142 4.91924Z",fill:"currentColor"})),(20===this.size||24===this.size)&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.6213 7.37879C19.2071 7.96458 19.2071 8.91433 18.6213 9.50011L10.6213 17.5C10.0355 18.0858 9.08577 18.0858 8.49998 17.5L5.56068 14.5605C4.97489 13.9748 4.97489 13.025 5.56068 12.4392C6.14646 11.8534 7.09621 11.8534 7.682 12.4392L9.56064 14.318L16.5 7.37879C17.0858 6.79301 18.0355 6.79301 18.6213 7.37879Z",fill:"currentColor"})),28===this.size&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.7248 8.60863C22.4083 9.29205 22.4083 10.4001 21.7248 11.0835L12.3915 20.4167C11.7081 21.1001 10.6001 21.1001 9.91663 20.4167L6.48744 16.9873C5.80403 16.3039 5.80403 15.1959 6.48744 14.5125C7.17086 13.8291 8.2789 13.8291 8.96232 14.5125L11.1541 16.7044L19.25 8.60863C19.9334 7.92521 21.0414 7.92521 21.7248 8.60863Z",fill:"currentColor"})))}};h.style=":host{display:inline-flex;max-width:100%;max-height:100%}.swirl-icon{max-width:100%;max-height:100%}";const c=class{constructor(t){i(this,t),this.color=void 0,this.size=24}render(){const i=20===this.size?24:this.size,o={color:Boolean(this.color)?`var(--s-icon-${this.color})`:void 0},e=r("swirl-icon",`swirl-icon--size-${this.size}`);return t("svg",{"aria-hidden":"true",class:e,fill:"none",height:this.size,part:"icon",style:o,viewBox:`0 0 ${i} ${i}`,width:this.size,xmlns:"http://www.w3.org/2000/svg"},16===this.size&&t(s,null,t("rect",{x:"9",y:"3",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"9",y:"7",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"9",y:"11",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"3",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"7",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"11",width:"2",height:"2",rx:"1",fill:"currentColor"})),(20===this.size||24===this.size)&&t(s,null,t("rect",{x:"13.5",y:"4.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"13.5",y:"10.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"13.5",y:"16.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"4.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"10.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"16.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"})),28===this.size&&t(s,null,t("rect",{x:"15.75",y:"5.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"15.75",y:"12.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"15.75",y:"19.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"5.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"12.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"19.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"})))}};c.style=":host{display:inline-flex;max-width:100%;max-height:100%}.swirl-icon{max-width:100%;max-height:100%}";const d=class{constructor(t){i(this,t),this.toggleDrag=o(this,"toggleDrag",7),this.desktopMediaQuery=n(),this.id=a(),this.desktopMediaQueryHandler=i=>{this.forceIconProps(i.matches),this.updateIconSize(i.matches)},this.onDragHandleKeyDown=i=>{"Space"!==i.code&&"Enter"!==i.code||(i.preventDefault(),this.toggleDrag.emit(this.el))},this.onBlur=()=>{this.focused=!1},this.onFocus=()=>{this.focused=!0},this.allowDrag=void 0,this.context="single-select",this.description=void 0,this.disabled=void 0,this.dragging=void 0,this.dragHandleDescription="Press spacebar to toggle grab",this.dragHandleLabel="Move option",this.icon=void 0,this.label=void 0,this.selected=!1,this.swirlAriaRole="option",this.value=void 0,this.iconSize=24,this.focused=void 0}componentDidLoad(){this.forceIconProps(this.desktopMediaQuery.matches),this.updateIconSize(this.desktopMediaQuery.matches),this.desktopMediaQuery.onchange=this.desktopMediaQueryHandler}disconnectedCallback(){this.desktopMediaQuery.removeEventListener?.("change",this.desktopMediaQueryHandler)}forceIconProps(i){const t=this.iconEl?.children[0];t?.setAttribute("size",i?"20":"24")}updateIconSize(i){this.iconSize=i?20:24}render(){const i=this.disabled?"true":void 0,s=String(this.selected),o="multi-select"===this.context,l=Boolean(this.icon)&&"single-select"===this.context,n=this.selected&&"single-select"===this.context,a=r("option-list-item",`option-list-item--context-${this.context}`,{"option-list-item--disabled":this.disabled,"option-list-item--draggable":this.allowDrag,"option-list-item--dragging":this.dragging,"option-list-item--selected":this.selected});return t(e,null,t("div",{"aria-checked":"menuitemradio"===this.swirlAriaRole?s:void 0,"aria-describedby":Boolean(this.description)?`option-list-item-${this.id}-description`:void 0,"aria-disabled":i,"aria-labelledby":`option-list-item-${this.id}-label`,"aria-selected":"option"===this.swirlAriaRole?s:void 0,class:a,id:`option-list-item-${this.id}`,onBlur:this.onBlur,onFocus:this.onFocus,part:"option-list-item",role:this.swirlAriaRole},l&&t("span",{class:"option-list-item__icon",innerHTML:this.icon,ref:i=>this.iconEl=i}),o&&t("span",{class:"option-list-item__checkbox"},t("span",{class:"option-list-item__checkbox-box"},this.selected&&t("swirl-icon-check-strong",{class:"option-list-item__checkbox-icon",size:16}))),t("span",{class:"option-list-item__label-container"},t("span",{class:"option-list-item__label",id:`option-list-item-${this.id}-label`,part:"option-list-item__label"},this.label),this.description&&t("span",{class:"option-list-item__description",id:`option-list-item-${this.id}-description`},this.description)),n&&t("span",{class:"option-list-item__selection-icon"},t("swirl-icon-check-small",{size:this.iconSize}))),this.allowDrag&&t("button",{"aria-describedby":this.dragHandleDescription,"aria-label":`${this.dragHandleLabel} "${this.label}"`,class:"option-list-item__drag-handle",onKeyDown:this.onDragHandleKeyDown,tabIndex:this.focused?0:-1,type:"button"},t("swirl-icon-drag-handle",{size:this.iconSize})))}get el(){return l(this)}};d.style=".sc-swirl-option-list-item-h{position:relative;display:inline-flex;width:100%}.sc-swirl-option-list-item-h *.sc-swirl-option-list-item{box-sizing:border-box}.option-list-item.sc-swirl-option-list-item{display:inline-flex;width:100%;min-width:15rem;min-height:3rem;padding:var(--s-space-12) var(--s-space-16);align-items:center;background-color:var(--s-surface-overlay-default);cursor:pointer;gap:var(--s-space-12)}.option-list-item.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-hovered)}.option-list-item.sc-swirl-option-list-item:active:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item.sc-swirl-option-list-item:focus{outline:none}.option-list-item.sc-swirl-option-list-item:focus-visible{background-color:var(--s-surface-overlay-hovered)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item.sc-swirl-option-list-item{min-height:0;padding:var(--s-space-8) var(--s-space-12);gap:var(--s-space-8)}}.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label-container.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1.5rem)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label-container.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1rem)}}.option-list-item--dragging.sc-swirl-option-list-item{z-index:1;border-radius:var(--s-border-radius-s);background-color:var(--s-surface-overlay-pressed);box-shadow:0 0.0625rem 0.125rem rgba(25, 26, 28, 0.08),\n 0 0.25rem 2rem rgba(25, 26, 28, 0.16)}.option-list-item--dragging.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item{color:var(--s-icon-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-highlight);color:var(--s-text-on-status);background-color:var(--s-icon-highlight)}.option-list-item--disabled.sc-swirl-option-list-item{cursor:default}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{background-color:var(--s-icon-disabled)}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-text-on-status)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__description.sc-swirl-option-list-item{color:var(--s-text-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__selection-icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-icon-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-disabled);background-color:var(--s-surface-overlay-default)}.option-list-item__label-container.sc-swirl-option-list-item{display:flex;flex-grow:1;flex-direction:column}.option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-default);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__label.sc-swirl-option-list-item{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.option-list-item__description.sc-swirl-option-list-item{color:var(--s-text-subdued);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__description.sc-swirl-option-list-item{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.option-list-item__icon.sc-swirl-option-list-item{display:inline-flex;width:1.5rem;height:1.5rem;flex-shrink:0;color:var(--s-icon-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__icon.sc-swirl-option-list-item{width:1.25rem;height:1.25rem}}.option-list-item__selection-icon.sc-swirl-option-list-item{display:inline-flex;flex-shrink:0;color:var(--s-icon-highlight)}.option-list-item__checkbox.sc-swirl-option-list-item{display:inline-flex;width:1.5rem;height:1.5rem;padding:var(--s-space-2)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__checkbox.sc-swirl-option-list-item{width:1.375rem;height:1.375rem}}.option-list-item__checkbox-box.sc-swirl-option-list-item{display:inline-flex;width:100%;height:100%;justify-content:center;align-items:center;border:0.125rem solid var(--s-icon-default);border-radius:var(--s-border-radius-s)}.option-list-item__checkbox-icon.sc-swirl-option-list-item{display:inline-flex}.option-list-item__drag-handle.sc-swirl-option-list-item{position:absolute;z-index:1;top:50%;right:var(--s-space-4);display:inline-flex;margin:0;padding:0;padding:var(--s-space-8);flex-shrink:0;border:none;color:var(--s-icon-default);background-color:transparent;cursor:grab;transform:translateY(-50%)}.option-list-item__drag-handle.sc-swirl-option-list-item:active{cursor:grabbing}.option-list-item__drag-handle.sc-swirl-option-list-item:focus:not(:focus-visible){outline:none}.option-list-item__drag-handle.sc-swirl-option-list-item:focus-visible{outline-color:var(--s-focus-default)}";export{h as swirl_icon_check_small,c as swirl_icon_drag_handle,d as swirl_option_list_item}
|
|
1
|
+
import{r as i,h as t,F as s,c as o,H as e,g as l}from"./p-e5528e8a.js";import{c as r}from"./p-b7898321.js";import{g as n}from"./p-ae2bed6f.js";import{v as a}from"./p-14616bce.js";const c=class{constructor(t){i(this,t),this.color=void 0,this.size=24}render(){const i=20===this.size?24:this.size,o={color:Boolean(this.color)?`var(--s-icon-${this.color})`:void 0},e=r("swirl-icon",`swirl-icon--size-${this.size}`);return t("svg",{"aria-hidden":"true",class:e,fill:"none",height:this.size,part:"icon",style:o,viewBox:`0 0 ${i} ${i}`,width:this.size,xmlns:"http://www.w3.org/2000/svg"},16===this.size&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M12.4142 4.91924C12.8047 5.30976 12.8047 5.94293 12.4142 6.33345L7.08086 11.6667C6.69033 12.0572 6.05717 12.0572 5.66664 11.6667L3.70711 9.70707C3.31658 9.31655 3.31658 8.68338 3.70711 8.29286C4.09763 7.90233 4.7308 7.90233 5.12132 8.29286L6.37375 9.54539L11 4.91924C11.3905 4.52871 12.0237 4.52871 12.4142 4.91924Z",fill:"currentColor"})),(20===this.size||24===this.size)&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M18.6213 7.37879C19.2071 7.96458 19.2071 8.91433 18.6213 9.50011L10.6213 17.5C10.0355 18.0858 9.08577 18.0858 8.49998 17.5L5.56068 14.5605C4.97489 13.9748 4.97489 13.025 5.56068 12.4392C6.14646 11.8534 7.09621 11.8534 7.682 12.4392L9.56064 14.318L16.5 7.37879C17.0858 6.79301 18.0355 6.79301 18.6213 7.37879Z",fill:"currentColor"})),28===this.size&&t(s,null,t("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M21.7248 8.60863C22.4083 9.29205 22.4083 10.4001 21.7248 11.0835L12.3915 20.4167C11.7081 21.1001 10.6001 21.1001 9.91663 20.4167L6.48744 16.9873C5.80403 16.3039 5.80403 15.1959 6.48744 14.5125C7.17086 13.8291 8.2789 13.8291 8.96232 14.5125L11.1541 16.7044L19.25 8.60863C19.9334 7.92521 21.0414 7.92521 21.7248 8.60863Z",fill:"currentColor"})))}};c.style=":host{display:inline-flex;max-width:100%;max-height:100%}.swirl-icon{max-width:100%;max-height:100%}";const h=class{constructor(t){i(this,t),this.color=void 0,this.size=24}render(){const i=20===this.size?24:this.size,o={color:Boolean(this.color)?`var(--s-icon-${this.color})`:void 0},e=r("swirl-icon",`swirl-icon--size-${this.size}`);return t("svg",{"aria-hidden":"true",class:e,fill:"none",height:this.size,part:"icon",style:o,viewBox:`0 0 ${i} ${i}`,width:this.size,xmlns:"http://www.w3.org/2000/svg"},16===this.size&&t(s,null,t("rect",{x:"9",y:"3",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"9",y:"7",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"9",y:"11",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"3",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"7",width:"2",height:"2",rx:"1",fill:"currentColor"}),t("rect",{x:"5",y:"11",width:"2",height:"2",rx:"1",fill:"currentColor"})),(20===this.size||24===this.size)&&t(s,null,t("rect",{x:"13.5",y:"4.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"13.5",y:"10.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"13.5",y:"16.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"4.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"10.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"}),t("rect",{x:"7.5",y:"16.5",width:"3",height:"3",rx:"1.5",fill:"currentColor"})),28===this.size&&t(s,null,t("rect",{x:"15.75",y:"5.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"15.75",y:"12.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"15.75",y:"19.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"5.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"12.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"}),t("rect",{x:"8.75",y:"19.25",width:"3.5",height:"3.5",rx:"1.75",fill:"currentColor"})))}};h.style=":host{display:inline-flex;max-width:100%;max-height:100%}.swirl-icon{max-width:100%;max-height:100%}";const d=class{constructor(t){i(this,t),this.toggleDrag=o(this,"toggleDrag",7),this.desktopMediaQuery=n(),this.id=a(),this.desktopMediaQueryHandler=i=>{this.forceIconProps(i.matches),this.updateIconSize(i.matches)},this.onDragHandleKeyDown=i=>{"Space"!==i.code&&"Enter"!==i.code||(i.preventDefault(),this.toggleDrag.emit(this.el))},this.onBlur=()=>{this.focused=!1},this.onFocus=()=>{this.focused=!0},this.allowDrag=void 0,this.context="single-select",this.description=void 0,this.disabled=void 0,this.dragging=void 0,this.dragHandleDescription="Press spacebar to toggle grab",this.dragHandleLabel="Move option",this.icon=void 0,this.label=void 0,this.selected=!1,this.swirlAriaRole="option",this.value=void 0,this.iconSize=24,this.focused=void 0}componentDidLoad(){this.forceIconProps(this.desktopMediaQuery.matches),this.updateIconSize(this.desktopMediaQuery.matches),this.desktopMediaQuery.onchange=this.desktopMediaQueryHandler}disconnectedCallback(){this.desktopMediaQuery.removeEventListener?.("change",this.desktopMediaQueryHandler)}forceIconProps(i){const t=this.iconEl?.children[0];t?.setAttribute("size",i?"20":"24")}updateIconSize(i){this.iconSize=i?20:24}render(){const i=this.disabled?"true":void 0,s=String(this.selected),o="multi-select"===this.context,l=Boolean(this.icon)&&"single-select"===this.context,n=this.selected&&"single-select"===this.context,a=r("option-list-item",`option-list-item--context-${this.context}`,{"option-list-item--disabled":this.disabled,"option-list-item--draggable":this.allowDrag,"option-list-item--dragging":this.dragging,"option-list-item--selected":this.selected});return t(e,null,t("div",{"aria-checked":"menuitemradio"===this.swirlAriaRole?s:void 0,"aria-describedby":Boolean(this.description)?`option-list-item-${this.id}-description`:void 0,"aria-disabled":i,"aria-labelledby":`option-list-item-${this.id}-label`,"aria-selected":"option"===this.swirlAriaRole?s:void 0,class:a,id:`option-list-item-${this.id}`,onBlur:this.onBlur,onFocus:this.onFocus,part:"option-list-item",role:this.swirlAriaRole},l&&t("span",{class:"option-list-item__icon",innerHTML:this.icon,ref:i=>this.iconEl=i}),o&&t("span",{class:"option-list-item__checkbox"},t("span",{class:"option-list-item__checkbox-box"},this.selected&&t("swirl-icon-check-strong",{class:"option-list-item__checkbox-icon",size:16}))),t("span",{class:"option-list-item__label-container"},t("span",{class:"option-list-item__label",id:`option-list-item-${this.id}-label`,part:"option-list-item__label"},this.label),this.description&&t("span",{class:"option-list-item__description",id:`option-list-item-${this.id}-description`},this.description)),n&&t("span",{class:"option-list-item__selection-icon"},t("swirl-icon-check-small",{size:this.iconSize}))),this.allowDrag&&t("button",{"aria-describedby":this.dragHandleDescription,"aria-label":`${this.dragHandleLabel} "${this.label}"`,class:"option-list-item__drag-handle",onKeyDown:this.onDragHandleKeyDown,tabIndex:this.focused?0:-1,type:"button"},t("swirl-icon-drag-handle",{size:this.iconSize})))}get el(){return l(this)}};d.style=".sc-swirl-option-list-item-h{position:relative;display:inline-flex;width:100%}.sc-swirl-option-list-item-h *.sc-swirl-option-list-item{box-sizing:border-box}.option-list-item.sc-swirl-option-list-item{display:inline-flex;width:100%;min-width:15rem;min-height:3rem;padding:var(--s-space-12) var(--s-space-16);align-items:center;background-color:var(--s-surface-overlay-default);cursor:pointer;gap:var(--s-space-12)}.option-list-item.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-hovered)}.option-list-item.sc-swirl-option-list-item:active:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item.sc-swirl-option-list-item:focus{outline:none}.option-list-item.sc-swirl-option-list-item:focus-visible{background-color:var(--s-surface-overlay-hovered)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item.sc-swirl-option-list-item{min-height:0;padding:var(--s-space-8) var(--s-space-12);gap:var(--s-space-8)}}.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label-container.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1.5rem)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item--draggable.sc-swirl-option-list-item .option-list-item__label-container.sc-swirl-option-list-item{padding-right:calc(var(--s-space-16) + 1rem)}}.option-list-item--dragging.sc-swirl-option-list-item{z-index:1;border-radius:var(--s-border-radius-s);background-color:var(--s-surface-overlay-pressed);box-shadow:0 0.0625rem 0.125rem rgba(25, 26, 28, 0.08),\n 0 0.25rem 2rem rgba(25, 26, 28, 0.16)}.option-list-item--dragging.sc-swirl-option-list-item:hover:not(.option-list-item--disabled){background-color:var(--s-surface-overlay-pressed)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item{color:var(--s-icon-highlight)}.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-highlight);color:var(--s-text-on-status);background-color:var(--s-icon-highlight)}.option-list-item--disabled.sc-swirl-option-list-item{cursor:default}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{background-color:var(--s-icon-disabled)}.option-list-item--disabled.option-list-item--selected.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-text-on-status)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__label.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__description.sc-swirl-option-list-item{color:var(--s-text-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__selection-icon.sc-swirl-option-list-item,.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-icon.sc-swirl-option-list-item{color:var(--s-icon-disabled)}.option-list-item--disabled.sc-swirl-option-list-item .option-list-item__checkbox-box.sc-swirl-option-list-item{border-color:var(--s-icon-disabled);background-color:var(--s-surface-overlay-default)}.option-list-item__label-container.sc-swirl-option-list-item{display:flex;flex-grow:1;flex-direction:column}.option-list-item__label.sc-swirl-option-list-item{color:var(--s-text-default);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__label.sc-swirl-option-list-item{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.option-list-item__description.sc-swirl-option-list-item{color:var(--s-text-subdued);font-size:var(--s-font-size-base);font-weight:var(--s-font-weight-medium);line-height:var(--s-line-height-base);text-align:left}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__description.sc-swirl-option-list-item{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.option-list-item__icon.sc-swirl-option-list-item{display:inline-flex;width:1.5rem;height:1.5rem;flex-shrink:0;color:var(--s-icon-default)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__icon.sc-swirl-option-list-item{width:1.25rem;height:1.25rem}}.option-list-item__selection-icon.sc-swirl-option-list-item{display:inline-flex;flex-shrink:0;color:var(--s-icon-highlight)}.option-list-item__checkbox.sc-swirl-option-list-item{display:inline-flex;width:1.5rem;height:1.5rem;padding:var(--s-space-2)}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.option-list-item__checkbox.sc-swirl-option-list-item{width:1.375rem;height:1.375rem}}.option-list-item__checkbox-box.sc-swirl-option-list-item{display:inline-flex;width:100%;height:100%;justify-content:center;align-items:center;border:0.125rem solid var(--s-icon-default);border-radius:var(--s-border-radius-s)}.option-list-item__checkbox-icon.sc-swirl-option-list-item{display:inline-flex}.option-list-item__drag-handle.sc-swirl-option-list-item{position:absolute;z-index:1;top:50%;right:var(--s-space-4);display:inline-flex;margin:0;padding:0;padding:var(--s-space-8);flex-shrink:0;border:none;color:var(--s-icon-default);background-color:transparent;cursor:grab;transform:translateY(-50%)}.option-list-item__drag-handle.sc-swirl-option-list-item:active{cursor:grabbing}.option-list-item__drag-handle.sc-swirl-option-list-item:focus:not(:focus-visible){outline:none}.option-list-item__drag-handle.sc-swirl-option-list-item:focus-visible{outline-color:var(--s-focus-default)}";export{c as swirl_icon_check_small,h as swirl_icon_drag_handle,d as swirl_option_list_item}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as i,h as e,H as t}from"./p-e5528e8a.js";const s={directories:[{name:"Development",description:"Updated 2 days ago.",children:[{description:"1.02 MB, updated 2 days ago.",name:"sample.pdf",type:"application/pdf",url:"/sample.pdf"},{description:"124 KB, updated a month ago.",name:"sample.jpg",type:"image/jpeg",url:"/sample.jpg"}]},{name:"People",description:"Updated just now.",children:[]}]},o=class{constructor(e){i(this,e),this.selectItem=i=>{"type"in i?(this.selectedFile=i,this.layout.changeMobileView("body")):this.selectedDirectory=i},this.resetSelectedDirectory=()=>{this.selectedDirectory=void 0},this.toggleSidebar=()=>{this.layout?.toggleSidebar()},this.selectedDirectory=void 0,this.selectedFile=void 0,this.sortMenu=void 0}renderNavigation(){const i=Boolean(this.selectedDirectory)?this.selectedDirectory.children:s.directories;return i.length>0?i.map((i=>e("swirl-resource-list-item",{description:i.description,key:i.name,label:i.name,onClick:()=>this.selectItem(i)},e("type"in i?"swirl-icon-file":"swirl-icon-folder-shared",{slot:"media"})))):e("swirl-box",{padding:"16"},e("swirl-text",{color:"subdued",weight:"medium"},"This directory is empty."))}render(){return e(t,null,e("swirl-app-layout",{appName:"Documents",backToNavigationViewButtonLabel:"Back to documents list",ctaIcon:"<swirl-icon-add></swirl-icon-add>",ctaLabel:"Upload file",navigationLabel:"Documents",onNavigationBackButtonClick:this.resetSelectedDirectory,ref:i=>this.layout=i,sidebarCloseButtonLabel:"Close file info",sidebarHeading:"File info",showNavigationBackButton:Boolean(this.selectedDirectory),transitionStyle:"dialog"},e("swirl-resource-list",{label:"Documents",slot:"navigation"},this.renderNavigation()),e("swirl-popover-trigger",{
|
|
1
|
+
import{r as i,h as e,H as t}from"./p-e5528e8a.js";const s={directories:[{name:"Development",description:"Updated 2 days ago.",children:[{description:"1.02 MB, updated 2 days ago.",name:"sample.pdf",type:"application/pdf",url:"/sample.pdf"},{description:"124 KB, updated a month ago.",name:"sample.jpg",type:"image/jpeg",url:"/sample.jpg"}]},{name:"People",description:"Updated just now.",children:[]}]},o=class{constructor(e){i(this,e),this.selectItem=i=>{"type"in i?(this.selectedFile=i,this.layout.changeMobileView("body")):this.selectedDirectory=i},this.resetSelectedDirectory=()=>{this.selectedDirectory=void 0},this.toggleSidebar=()=>{this.layout?.toggleSidebar()},this.selectedDirectory=void 0,this.selectedFile=void 0,this.sortMenu=void 0}renderNavigation(){const i=Boolean(this.selectedDirectory)?this.selectedDirectory.children:s.directories;return i.length>0?i.map((i=>e("swirl-resource-list-item",{description:i.description,key:i.name,label:i.name,onClick:()=>this.selectItem(i)},e("type"in i?"swirl-icon-file":"swirl-icon-folder-shared",{slot:"media"})))):e("swirl-box",{padding:"16"},e("swirl-text",{color:"subdued",weight:"medium"},"This directory is empty."))}render(){return e(t,null,e("swirl-app-layout",{appName:"Documents",backToNavigationViewButtonLabel:"Back to documents list",ctaIcon:"<swirl-icon-add></swirl-icon-add>",ctaLabel:"Upload file",navigationLabel:"Documents",onNavigationBackButtonClick:this.resetSelectedDirectory,ref:i=>this.layout=i,sidebarCloseButtonLabel:"Close file info",sidebarHeading:"File info",showNavigationBackButton:Boolean(this.selectedDirectory),transitionStyle:"dialog"},e("swirl-resource-list",{label:"Documents",slot:"navigation"},this.renderNavigation()),e("swirl-popover-trigger",{swirlPopover:this.sortMenu,slot:"navigation-controls"},e("swirl-button",{label:"Sort items"})),e("swirl-stack",{orientation:"horizontal",slot:"app-bar"},e("swirl-stack",null,e("swirl-heading",{as:"h2",level:4,text:this.selectedFile?.name}),e("swirl-text",{color:"subdued",truncate:!0},this.selectedFile?.description))),Boolean(this.selectedFile)?e("swirl-file-viewer",{file:this.selectedFile.url,slot:"content",type:this.selectedFile.type}):e("swirl-box",{cover:!0,centerBlock:!0,centerInline:!0,padding:"16",slot:"content"},e("swirl-empty-state",{heading:"Nothing to see here.",illustration:"/images/empty-state-1.svg"},"Please select a file from the list.")),e("div",{slot:"app-bar-controls"},this.selectedFile&&e("swirl-button",{"hide-label":!0,class:"info-button",icon:"<swirl-icon-info></swirl-icon-info>",label:"Open file info",onClick:this.toggleSidebar})),e("swirl-box",{padding:"16",slot:"sidebar"},e("swirl-text",{color:"subdued",weight:"medium"},"File info goes here …"))),e("swirl-popover",{label:"Sort items",ref:i=>this.sortMenu=i},e("swirl-option-list",{value:["ascending"]},e("swirl-option-list-item",{icon:"<swirl-icon-expand-less></swirl-icon-expand-less>",label:"Ascending",value:"ascending"}),e("swirl-option-list-item",{icon:"<swirl-icon-expand-more></swirl-icon-expand-more>",label:"Descending",value:"descending"}),e("swirl-option-list-item",{icon:"<swirl-icon-time-outlined></swirl-icon-time-outlined>",label:"By date",value:"date"}))))}};export{o as file_manager}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
let t;const r=new Uint8Array(16);function o(){if(!t&&(t="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!t))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return t(r)}const n=[];for(let t=0;t<256;++t)n.push((t+256).toString(16).slice(1));const e={randomUUID:"undefined"!=typeof crypto&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function u(t,r,u){if(e.randomUUID&&!r&&!t)return e.randomUUID();const c=(t=t||{}).random||(t.rng||o)();if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,r){u=u||0;for(let t=0;t<16;++t)r[u+t]=c[t];return r}return function(t,r=0){return n[t[r+0]]+n[t[r+1]]+n[t[r+2]]+n[t[r+3]]+"-"+n[t[r+4]]+n[t[r+5]]+"-"+n[t[r+6]]+n[t[r+7]]+"-"+n[t[r+8]]+n[t[r+9]]+"-"+n[t[r+10]]+n[t[r+11]]+n[t[r+12]]+n[t[r+13]]+n[t[r+14]]+n[t[r+15]]}(c)}export{u as v}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e,c as i,h as t,H as s,g as a}from"./p-e5528e8a.js";import{A as r}from"./p-fe0b5250.js";import{d as o,e as d}from"./p-33c168b3.js";import{c as l}from"./p-b7898321.js";import{q as n,i as h}from"./p-ae2bed6f.js";const c=class{constructor(t){e(this,t),this.modalClose=i(this,"modalClose",7),this.modalOpen=i(this,"modalOpen",7),this.desktopZoomSteps=[.5,.75,1,1.25,1.5,2,3,4],this.mobileZoomSteps=[.5,.75,1,1.25,1.5],this.toggleViewMode=()=>{this.viewMode="single"===this.viewMode?"side-by-side":"single"},this.toggleThumbnals=()=>{this.showThumbnails=!this.showThumbnails},this.onKeyDown=e=>{"Escape"===e.code&&(e.stopImmediatePropagation(),this.close())},this.onActivate=async e=>{this.pdfViewer=e.detail,this.lockBodyScroll()},this.onVisiblePagesChange=async e=>{this.visiblePages=e.detail},this.onCloseButtonClick=()=>{this.close()},this.onPrintButtonClick=()=>{this.pdfViewer.print(),this.menu.close()},this.onDownloadButtonClick=async()=>{this.downloading=!0,await this.viewer.download(),this.downloading=!1,this.menu.close()},this.onZoomInButtonClick=()=>{const e=this.zoomSteps.indexOf(+this.zoom);this.zoom=-1===e?1:this.zoomSteps[Math.min(this.zoomSteps.length-1,e+1)]},this.onZoomOutButtonClick=()=>{const e=this.zoomSteps.indexOf(+this.zoom);this.zoom=-1===e?1:this.zoomSteps[Math.max(0,e-1)]},this.onZoomAutoButtonClick=()=>{this.zoom="auto"===this.zoom?1:"auto"},this.onZoomChange=e=>{const i=e.target.value;this.zoom="auto"===i?i:+i},this.onThumbnailClick=e=>()=>{const i=n(this.el,`[data-page-number="${e+1}"]`)?.[0];i?.scrollIntoView()},this.autoZoomLabel="Full width",this.closeButtonLabel="Close PDF viewer",this.downloadButtonEnabled=!0,this.downloadButtonLabel="Download PDF",this.file=void 0,this.fileName=void 0,this.fileTypeLabel="PDF Document",this.label=void 0,this.menuLabel="File menu",this.menuTriggerLabel="Open file menu",this.pdfWorkerSrc=void 0,this.printButtonEnabled=!0,this.printButtonLabel="Print PDF",this.sideBySideButtonLabel="Toggle side by side view",this.thumbnailButtonLabel="Scroll to page",this.thumbnailsButtonLabel="Toggle thumbnails",this.thumbnailsLabel="Page thumbnails",this.zoomInButtonLabel="Zoom in",this.zoomOutButtonLabel="Zoom out",this.zoomSelectLabel="Select zoom",this.active=!1,this.closing=!1,this.downloading=!1,this.loadingThumbnails=!1,this.thumbnails=[],this.showThumbnails=void 0,this.viewMode="single",this.visiblePages=[],this.zoom=void 0,this.zoomSteps=void 0}componentWillLoad(){this.updateZoomSteps(),this.zoom=h()?"auto":1}componentDidLoad(){this.modal=new r(this.modalEl)}disconnectedCallback(){this.unlockBodyScroll(),this.modal?.destroy()}onWindowResize(){Boolean(this.pdfViewer)&&(this.updateZoomSteps(),this.zoom=h()?"auto":1)}watchShowThumbnails(){this.showThumbnails&&(this.loadingThumbnails=!0,queueMicrotask((async()=>{await this.generateThumbnails(),this.loadingThumbnails=!1})))}async open(){this.modal.show(),this.active=!0,this.modalOpen.emit()}async close(){this.closing||(this.closing=!0,this.unlockBodyScroll(),setTimeout((()=>{this.modal.hide(),this.closing=!1,this.active=!1,this.modalClose.emit()}),150))}lockBodyScroll(){const e=this.pdfViewer.shadowRoot.querySelector(".file-viewer-pdf__pages");Boolean(e)&&o(e)}unlockBodyScroll(){const e=this.pdfViewer.shadowRoot.querySelector(".file-viewer-pdf__pages");Boolean(e)&&d(e)}async generateThumbnails(){this.thumbnails=await this.pdfViewer.getThumbnails()}updateZoomSteps(){this.zoomSteps=h()?this.mobileZoomSteps:this.desktopZoomSteps}render(){const e=Boolean(this.el.querySelector("[slot='menu-items']"))||this.printButtonEnabled||this.downloadButtonEnabled,i=l("pdf-reader",{"pdf-reader--closing":this.closing,"pdf-reader--hide-menu":!e,"pdf-reader--show-thumbnails":this.showThumbnails});return t(s,null,t("section",{"aria-hidden":"true","aria-label":this.label,class:i,id:"pdf-reader",onKeyDown:this.onKeyDown,ref:e=>this.modalEl=e},t("div",{class:"pdf-reader__body",role:"document"},t("header",{class:"pdf-reader__header"},t("span",{class:"pdf-reader__header-left"},t("swirl-button",{class:"pdf-reader__close-button",hideLabel:!0,icon:"<swirl-icon-close></swirl-icon-close>",label:this.closeButtonLabel,onClick:this.onCloseButtonClick}),t("span",{class:"pdf-reader__label"},this.label)),t("span",{class:"pdf-reader__header-center"},t("span",{class:"pdf-reader__zoom-button-container"},t("swirl-button",{class:"pdf-reader__zoom-button",disabled:this.zoom===this.zoomSteps[0],hideLabel:!0,icon:"<swirl-icon-remove></swirl-icon-remove>",label:this.zoomOutButtonLabel,onClick:this.onZoomOutButtonClick}),t("swirl-button",{class:"pdf-reader__zoom-button",disabled:this.zoom===this.zoomSteps[this.zoomSteps.length-1],hideLabel:!0,icon:"<swirl-icon-add></swirl-icon-add>",label:this.zoomInButtonLabel,onClick:this.onZoomInButtonClick})),t("span",{class:"pdf-reader__zoom-select-container"},t("select",{"aria-label":this.zoomSelectLabel,class:"pdf-reader__zoom-select",name:"zoom-select",id:"zoom-select",onChange:this.onZoomChange},t("option",{selected:"auto"===this.zoom,value:"auto"},this.autoZoomLabel),this.zoomSteps.map((e=>t("option",{key:e,selected:this.zoom===e,value:e},100*e,"%")))),t("swirl-icon-expand-more",{class:"pdf-reader__zoom-select-icon"}))),t("span",{class:"pdf-reader__header-right"},t("swirl-popover-trigger",{swirlPopover:this.menu},t("swirl-button",{class:"pdf-reader__menu-button",hideLabel:!0,icon:"<swirl-icon-more-vertikal></swirl-icon-more-vertikal>",label:this.menuTriggerLabel}))),t("span",{class:"pdf-reader__floating-tools"},t("button",{"aria-label":this.sideBySideButtonLabel,class:"pdf-reader__floating-tool-button",onClick:this.toggleViewMode,type:"button"},t("swirl-icon-menu-book",null)),t("button",{"aria-controls":"thumbnails","aria-expanded":String(Boolean(this.showThumbnails)),"aria-label":this.thumbnailsButtonLabel,class:"pdf-reader__floating-tool-button",onClick:this.toggleThumbnals,type:"button"},t("swirl-icon-file-copy",null)))),t("div",{class:"pdf-reader__content"},t("nav",{"aria-label":this.thumbnailsLabel,class:"pdf-reader__thumbnails",id:"thumbnails"},this.loadingThumbnails&&t("swirl-spinner",null),!this.loadingThumbnails&&this.thumbnails.map(((e,i)=>{const s=l("pdf-reader__thumbnail",{"pdf-reader__thumbnail--active":this.visiblePages[0]===i+1});return t("button",{"aria-label":`${this.thumbnailButtonLabel} ${i+1}`,class:s,onClick:this.onThumbnailClick(i),type:"button"},t("img",{src:e.toDataURL("image/png"),alt:""}))}))),t("swirl-file-viewer",{active:this.active,class:"pdf-reader__viewer",file:this.file,fileName:this.fileName,onActivate:this.onActivate,onVisiblePagesChange:this.onVisiblePagesChange,pdfWorkerSrc:this.pdfWorkerSrc,ref:e=>this.viewer=e,type:"application/pdf",viewMode:this.viewMode,zoom:this.zoom}),t("div",{class:"pdf-reader__mobile-zoom-controls"},t("button",{"aria-label":this.autoZoomLabel,class:"pdf-reader__mobile-zoom-button",onClick:this.onZoomAutoButtonClick,type:"button"},t("auto"===this.zoom?"swirl-icon-fullscreen-exit":"swirl-icon-fullscreen",null)),t("button",{"aria-label":this.zoomInButtonLabel,class:"pdf-reader__mobile-zoom-button",disabled:this.zoom===this.zoomSteps[this.zoomSteps.length-1],onClick:this.onZoomInButtonClick,type:"button"},t("swirl-icon-add",null)),t("button",{"aria-label":this.zoomOutButtonLabel,class:"pdf-reader__mobile-zoom-button",disabled:this.zoom===this.zoomSteps[0],onClick:this.onZoomOutButtonClick,type:"button"},t("swirl-icon-remove",null))))),t("swirl-popover",{animation:"scale-in-y",disableScrollLock:!0,id:"menu",label:this.menuLabel,placement:"bottom-end",ref:e=>this.menu=e},t("swirl-stack",null,t("div",{class:"pdf-reader__meta"},t("div",{class:"pdf-reader__file-icon"},t("svg",{fill:"none",height:"36",viewBox:"0 0 24 36",width:"24"},t("path",{d:"M7.01755 21.6V15.192H8.39455C8.64655 15.192 8.86855 15.225 9.06055 15.291C9.25255 15.357 9.42655 15.474 9.58255 15.642C9.73855 15.81 9.84655 16.008 9.90655 16.236C9.96655 16.458 9.99655 16.761 9.99655 17.145C9.99655 17.433 9.97855 17.676 9.94255 17.874C9.91255 18.072 9.84355 18.258 9.73555 18.432C9.60955 18.642 9.44155 18.807 9.23155 18.927C9.02155 19.041 8.74555 19.098 8.40355 19.098H7.93555V21.6H7.01755ZM7.93555 16.056V18.234H8.37655C8.56255 18.234 8.70655 18.207 8.80855 18.153C8.91055 18.099 8.98555 18.024 9.03355 17.928C9.08155 17.838 9.10855 17.727 9.11455 17.595C9.12655 17.463 9.13255 17.316 9.13255 17.154C9.13255 17.004 9.12955 16.863 9.12355 16.731C9.11755 16.593 9.09055 16.473 9.04255 16.371C8.99455 16.269 8.92255 16.191 8.82655 16.137C8.73055 16.083 8.59255 16.056 8.41255 16.056H7.93555Z",fill:"white"}),t("path",{d:"M10.6826 21.6V15.192H12.0416C12.5696 15.192 12.9686 15.336 13.2386 15.624C13.5146 15.912 13.6526 16.32 13.6526 16.848V19.845C13.6526 20.445 13.5056 20.889 13.2116 21.177C12.9236 21.459 12.5066 21.6 11.9606 21.6H10.6826ZM11.6006 16.056V20.736H12.0236C12.2816 20.736 12.4646 20.673 12.5726 20.547C12.6806 20.415 12.7346 20.211 12.7346 19.935V16.848C12.7346 16.596 12.6836 16.401 12.5816 16.263C12.4796 16.125 12.2936 16.056 12.0236 16.056H11.6006Z",fill:"white"}),t("path",{d:"M14.5146 21.6V15.192H17.2506V16.056H15.4326V18H17.0166V18.864H15.4326V21.6H14.5146Z",fill:"white"}),t("path",{d:"M3.59961 9.00001C3.59961 8.0059 4.4055 7.20001 5.39961 7.20001H14.854C15.3314 7.20001 15.7893 7.38965 16.1268 7.72722L19.8724 11.4728C20.21 11.8104 20.3996 12.2682 20.3996 12.7456V27C20.3996 27.9941 19.5937 28.8 18.5996 28.8H5.39961C4.4055 28.8 3.59961 27.9941 3.59961 27V9.00001Z",fill:"#FF574D"}),t("path",{d:"M15.5996 7.36166V10.2C15.5996 11.1941 16.4055 12 17.3996 12H20.2379C20.3237 12.1884 20.3768 12.3913 20.3937 12.6H17.3996C16.0785 12.6 15.0067 11.5325 14.9996 10.213L14.9996 7.20587C15.2083 7.2228 15.4112 7.27593 15.5996 7.36166Z",fill:"white"}),t("path",{d:"M7.01755 21.6V15.192H8.39455C8.64655 15.192 8.86855 15.225 9.06055 15.291C9.25255 15.357 9.42655 15.474 9.58255 15.642C9.73855 15.81 9.84655 16.008 9.90655 16.236C9.96655 16.458 9.99655 16.761 9.99655 17.145C9.99655 17.433 9.97855 17.676 9.94255 17.874C9.91255 18.072 9.84355 18.258 9.73555 18.432C9.60955 18.642 9.44155 18.807 9.23155 18.927C9.02155 19.041 8.74555 19.098 8.40355 19.098H7.93555V21.6H7.01755ZM7.93555 16.056V18.234H8.37655C8.56255 18.234 8.70655 18.207 8.80855 18.153C8.91055 18.099 8.98555 18.024 9.03355 17.928C9.08155 17.838 9.10855 17.727 9.11455 17.595C9.12655 17.463 9.13255 17.316 9.13255 17.154C9.13255 17.004 9.12955 16.863 9.12355 16.731C9.11755 16.593 9.09055 16.473 9.04255 16.371C8.99455 16.269 8.92255 16.191 8.82655 16.137C8.73055 16.083 8.59255 16.056 8.41255 16.056H7.93555Z",fill:"white"}),t("path",{d:"M10.6826 21.6V15.192H12.0416C12.5696 15.192 12.9686 15.336 13.2386 15.624C13.5146 15.912 13.6526 16.32 13.6526 16.848V19.845C13.6526 20.445 13.5056 20.889 13.2116 21.177C12.9236 21.459 12.5066 21.6 11.9606 21.6H10.6826ZM11.6006 16.056V20.736H12.0236C12.2816 20.736 12.4646 20.673 12.5726 20.547C12.6806 20.415 12.7346 20.211 12.7346 19.935V16.848C12.7346 16.596 12.6836 16.401 12.5816 16.263C12.4796 16.125 12.2936 16.056 12.0236 16.056H11.6006Z",fill:"white"}),t("path",{d:"M14.5146 21.6V15.192H17.2506V16.056H15.4326V18H17.0166V18.864H15.4326V21.6H14.5146Z",fill:"white"}))),t("div",{class:"pdf-reader__file-info"},t("swirl-text",{truncate:!0,weight:"semibold"},this.label),t("swirl-text",{color:"subdued",size:"sm",truncate:!0},this.fileTypeLabel))),e&&t("swirl-separator",null),t("swirl-action-list",{class:"pdf-reader__menu"},this.printButtonEnabled&&t("swirl-action-list-item",{class:"pdf-reader__print-button",icon:"<swirl-icon-print></swirl-icon-print>",label:this.printButtonLabel,onClick:this.onPrintButtonClick}),this.downloadButtonEnabled&&t("swirl-action-list-item",{class:"pdf-reader__download-button",disabled:this.downloading,icon:this.downloading?'<swirl-spinner size="xs"></swirl-spinner>':"<swirl-icon-download></swirl-icon-download>",label:this.downloadButtonLabel,onClick:this.onDownloadButtonClick}),t("slot",{name:"menu-items"}))))))}get el(){return a(this)}static get watchers(){return{showThumbnails:["watchShowThumbnails"]}}};c.style=':host{--thumbnails-width:7rem;display:block}:host *{box-sizing:border-box}.pdf-reader{position:fixed;z-index:var(--s-z-40);background-color:var(--s-surface-raised-default);inset:0;touch-action:pan-x pan-y}.pdf-reader[aria-hidden="true"]{display:none}.pdf-reader:not(.pdf-reader--closing) .pdf-reader__body{animation:0.15s pdf-reader-fade-in}@media (prefers-reduced-motion){.pdf-reader:not(.pdf-reader--closing) .pdf-reader__body{animation:none}}.pdf-reader--closing{animation:0.15s pdf-reader-fade-out;animation-fill-mode:forwards}@media (prefers-reduced-motion){.pdf-reader--closing{animation:none}}.pdf-reader--show-thumbnails .pdf-reader__thumbnails{max-width:var(--thumbnails-width)}.pdf-reader--show-thumbnails .pdf-reader__floating-tools{left:calc(var(--s-space-16) + var(--thumbnails-width))}.pdf-reader--hide-menu .pdf-reader__menu{display:none}.pdf-reader__body{position:relative;width:100%;height:100%}.pdf-reader__header{display:flex;height:4rem;padding-right:var(--s-space-16);padding-left:var(--s-space-16);align-items:center;border-bottom:var(--s-border-width-default) solid var(--s-border-default);background-color:var(--s-background-default);gap:var(--s-space-8)}.pdf-reader__header-left,.pdf-reader__header-right{display:flex;flex-grow:1;align-items:center;gap:var(--s-space-8)}@media (min-width: 768px){.pdf-reader__header-left,.pdf-reader__header-right{flex-basis:calc(100 / 3 * 1%);flex-grow:0}}.pdf-reader__header-right{justify-content:flex-end}.pdf-reader__header-center{display:none;flex-grow:1;justify-content:center;align-items:center;gap:var(--s-space-16)}@media (min-width: 768px){.pdf-reader__header-center{display:flex}}.pdf-reader__label{overflow:hidden;flex-grow:1;font-weight:var(--s-font-weight-semibold);white-space:nowrap;text-overflow:ellipsis}.pdf-reader__zoom-button-container{display:flex;align-items:center;gap:var(--s-space-8)}.pdf-reader__zoom-button-container>*:not(:last-child){position:relative}.pdf-reader__zoom-button-container>*:not(:last-child):after{position:absolute;top:50%;right:calc(-1 * var(--s-space-4));width:var(--s-border-width-default);height:1.5rem;background-color:var(--s-border-default);content:"";transform:translate3d(50%, -50%, 0)}.pdf-reader__zoom-select-container{position:relative}.pdf-reader__zoom-select{display:inline-flex;height:2.5rem;padding-right:var(--s-space-12);padding-right:calc(var(--s-space-8) + 1.5rem + var(--s-space-12));padding-left:var(--s-space-12);justify-content:flex-start;align-items:center;border:var(--s-border-width-default) solid var(--s-border-default);border-radius:var(--s-border-radius-sm);color:var(--s-interactive-neutral-default);background-color:transparent;font:inherit;font-weight:var(--s-font-weight-medium);cursor:pointer;-webkit-appearance:none;-moz-appearance:none;appearance:none}.pdf-reader__zoom-select:focus:not(:focus-visible){outline:none}.pdf-reader__zoom-select:focus-visible{outline-color:var(--s-focus-default)}.pdf-reader__zoom-select-icon{position:absolute;top:50%;right:var(--s-space-8);display:inline-flex;transform:translateY(-50%);pointer-events:none}.pdf-reader__content{display:flex;width:100%;height:calc(100% - 4rem)}.pdf-reader__thumbnails{display:flex;overflow-x:hidden;overflow-y:auto;max-width:0;height:100%;padding-top:var(--s-space-16);padding-bottom:var(--s-space-16);flex-basis:var(--thumbnails-width);flex-grow:0;flex-shrink:0;align-items:center;background-color:var(--s-background-default);flex-direction:column;transition:max-width 0.2s linear;box-shadow:inset calc(-1 * var(--s-border-width-default)) 0 0 0\n var(--s-border-default);gap:var(--s-space-4)}.pdf-reader__thumbnail{width:5rem;margin:0;padding:0;border:var(--s-border-width-default) solid var(--s-border-default);background-color:transparent;cursor:pointer}.pdf-reader__thumbnail>img{display:inline-flex;width:100%}.pdf-reader__thumbnail--active{border-width:0.125rem;border-color:var(--s-border-highlight)}.pdf-reader__viewer{flex-grow:1}.pdf-reader__mobile-zoom-controls{position:absolute;z-index:1;right:var(--s-space-16);bottom:var(--s-space-32);display:flex;padding-bottom:var(--s-space-4);flex-direction:column;gap:var(--s-space-8)}@media (min-width: 768px){.pdf-reader__mobile-zoom-controls{display:none}}.pdf-reader__mobile-zoom-button{display:inline-flex;width:2.5rem;height:2.5rem;justify-content:center;align-items:center;border:none;border-radius:50%;color:var(--s-icon-on-image);background-color:rgba(0, 0, 0, 0.6);cursor:pointer;transition:opacity 0.15s;pointer-events:auto}.pdf-reader__mobile-zoom-button:disabled{cursor:default}.pdf-reader__floating-tools{position:fixed;z-index:1;bottom:var(--s-space-16);left:var(--s-space-16);display:none;flex-direction:column;transition:left 0.2s linear;gap:var(--s-space-12)}@media (min-width: 768px){.pdf-reader__floating-tools{display:flex}}.pdf-reader__floating-tool-button{display:inline-flex;width:2.5rem;height:2.5rem;justify-content:center;align-items:center;border:none;border-radius:50%;color:var(--s-icon-on-image);background-color:rgba(0, 0, 0, 0.6);cursor:pointer}.pdf-reader__meta{display:flex;padding-top:var(--s-space-4);padding-right:var(--s-space-16);padding-bottom:var(--s-space-4);padding-left:var(--s-space-8);align-items:center;gap:var(--s-space-12)}@media (min-width: 768px){.pdf-reader__meta{max-width:18rem}}.pdf-reader__file-icon{display:inline-flex;padding-left:var(--s-space-4);flex-shrink:0}.pdf-reader__file-info{display:flex;min-width:0;flex-grow:1;flex-direction:column}@keyframes pdf-reader-fade-in{from{opacity:0}to{opacity:1}}@keyframes pdf-reader-fade-out{from{opacity:1}to{opacity:0}}';export{c as swirl_pdf_reader}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as n}from"./p-e5528e8a.js";function h(t,i){const s=new Date(t);return s.setDate(s.getDate()+i),s}function o(t){return b(new Date(`${String(g(t)).padStart(4,"0")}-${String(l(t)).padStart(2,"0")}-01`))}function a(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function r(t){const i=o(t);return i.setMonth(i.getMonth()+1),i.setDate(i.getDate()-1),i}function l(t){return t.getMonth()+1}function c(t){return h(t,1)}function d(t){const i=new Date(t);return i.setDate(1),i.setMonth(i.getMonth()+1),i}function u(t){const i=new Date(t);return i.setFullYear(i.getFullYear()+1),i}function v(t){return f(t,1)}function w(t){const i=new Date(t);return i.setDate(1),i.setMonth(i.getMonth()-1),i}function p(t){const i=new Date(t);return i.setFullYear(i.getFullYear()-1),i}function g(t){return t.getFullYear()}function y(t,i){return!(!t||!i)&&t.getFullYear()===i.getFullYear()&&t.getMonth()===i.getMonth()&&t.getDate()===i.getDate()}function b(t){const i=new Date(t);return i.setMinutes(i.getMinutes()+i.getTimezoneOffset()),i}function f(t,i){const s=new Date(t);return s.setDate(s.getDate()-i),s}const k={clearButton:"Clear value",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year"},D=class{constructor(s){t(this,s),this.selectDate=i(this,"selectDate",7),this.changeMonth=i(this,"changeMonth",7),this.disabled=!1,this.disableDate=()=>!1,this.elementClassName="wc-datepicker",this.firstDayOfWeek=0,this.labels=k,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.showClearButton=!1,this.showMonthStepper=!0,this.showTodayButton=!1,this.showYearStepper=!1,this.startDate=a(new Date),this.init=()=>{this.currentDate=this.startDate?b(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(d(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(u(this.currentDate))},this.previousMonth=()=>{this.updateCurrentDate(w(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(p(this.currentDate))},this.showToday=()=>{this.updateCurrentDate(new Date)},this.clear=()=>{this.value=void 0,this.selectDate.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const i=t.target.closest("[data-date]");if(!Boolean(i))return;const s=b(new Date(i.dataset.date));this.updateCurrentDate(s),this.onSelectDate(s)},this.onMonthSelect=t=>{const i=+t.target.value-1,s=new Date(this.currentDate);s.setMonth(i),this.updateCurrentDate(s)},this.onYearSelect=t=>{let i=+t.target.value;const s=t.target;isNaN(i)?(i=(new Date).getFullYear(),s.value=String(i)):i<0?(i=0,s.value=String(i)):i>9999&&(i=9999,s.value=String(i));const e=new Date(this.currentDate);e.setFullYear(i),this.updateCurrentDate(e)},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(v(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(c(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?p(this.currentDate):w(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?u(this.currentDate):d(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(r(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{if(this.disabled)return;const i=b(new Date(t.target.closest("td").dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0}}componentWillLoad(){this.init()}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){this.value=void 0,this.selectDate.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?b(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1)}updateWeekdays(){var t,i;this.weekdays=(t=0===this.firstDayOfWeek?7:this.firstDayOfWeek,i=this.locale,new Array(7).fill(void 0).map(((i,s)=>(t+s)%7+1)).map((t=>{const s=b(new Date(`2006-01-0${t}`));return[Intl.DateTimeFormat(i,{weekday:"short"}).format(s),Intl.DateTimeFormat(i,{weekday:"long"}).format(s)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,i,s){const e=[],n=o(t),h=0===n.getDay()?7:n.getDay(),a=r(t),l=0===a.getDay()?7:a.getDay(),d=1===s?7:s-1,u=[],w=[];{let t=(7-s+h)%7,i=v(n);for(;t>0;)u.push(i),i=v(i),t-=1;u.reverse();let e=(7-l+d)%7,o=c(a);for(;e>0;)w.push(o),o=c(o),e-=1}let p=n;for(;p.getMonth()===t.getMonth();)e.push(p),p=c(p);return[...u,...e,...w]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),i=[];for(let s=0;s<t.length;s+=7){const e=t.slice(s,s+7);i.push(e)}return i}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var i;null===(i=this.el.querySelector(`[data-date="${a(t)}"]`))||void 0===i||i.focus()}updateCurrentDate(t,i){const s=t.getMonth(),e=t.getFullYear();e>9999||e<0||((s!==this.currentDate.getMonth()||e!==this.currentDate.getFullYear())&&(this.changeMonth.emit({month:l(t),year:g(t)}),i&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,i&&this.focusDate(this.currentDate))}onSelectDate(t){var i,s;if(!this.disableDate(t))if(this.isRangeValue(this.value)){const s=void 0===(null===(i=this.value)||void 0===i?void 0:i[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const e=void 0===s[1]?[a(s[0])]:[a(s[0]),a(s[1])];this.value=s,this.selectDate.emit(e)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,this.selectDate.emit(a(t))}}isRangeValue(t){return this.range}render(){const t=this.showTodayButton||this.showClearButton;return s(e,null,s("div",{"aria-disabled":String(this.disabled),"aria-label":this.labels.picker,class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled},role:"group"},s("div",{class:this.getClassName("header")},s("span",{"aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{"aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),disabled:this.disabled,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"11 17 6 12 11 7"}),s("polyline",{points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{"aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),disabled:this.disabled,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"15 18 9 12 15 6"}))),s("span",{class:this.getClassName("current-month")},s("select",{"aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),disabled:this.disabled,name:"month",onChange:this.onMonthSelect},(i=this.locale,new Array(12).fill(void 0).map(((t,s)=>{const e=b(new Date(`2006-${String(s+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(i,{month:"long"}).format(e)}))).map(((t,i)=>s("option",{key:t,selected:this.currentDate.getMonth()===i,value:i+1},t)))),s("input",{"aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),disabled:this.disabled,max:9999,maxLength:4,min:1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&s("button",{"aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),disabled:this.disabled,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{"aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),disabled:this.disabled,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"13 17 18 12 13 7"}),s("polyline",{points:"6 17 11 12 6 7"})))),s("div",{class:this.getClassName("body")},s("table",{class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid"},s("thead",{class:this.getClassName("calendar-header")},s("tr",{class:this.getClassName("weekday-row")},this.weekdays.map((t=>s("th",{abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},s("span",null,t[0])))))),s("tbody",null,this.getCalendarRows().map((t=>{const i=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:i},t.map((t=>{var i,e,n,h,o;const r=y(t,this.currentDate),l=t.getMonth()!==this.currentDate.getMonth(),c=Array.isArray(this.value)?y(t,this.value[0])||y(t,this.value[1]):y(t,this.value),d=!!this.isRangeValue&&(v={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(e=this.value)||void 0===e?void 0:e[1])||this.hoveredDate||this.currentDate},!!((u=t)&&v&&v.from&&v.to)&&u>=(v.from<v.to?v.from:v.to)&&u<=(v.from<v.to?v.to:v.from));var u,v;const w=Boolean(null===(n=this.value)||void 0===n?void 0:n[0])?[null===(h=this.value)||void 0===h?void 0:h[0],(null===(o=this.value)||void 0===o?void 0:o[1])||this.hoveredDate].sort(((t,i)=>t-i)):[],p=this.range&&y(w[0],t),g=this.range&&y(w[1],t),b=y(t,new Date),f=this.disableDate(t),k=`cell-${t.getMonth()}-${t.getDate()}`,D={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:r,[this.getClassName("date--disabled")]:f,[this.getClassName("date--overflowing")]:l,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:c,[this.getClassName("date--in-range")]:d,[this.getClassName("date--start")]:p,[this.getClassName("date--end")]:g},m=c?"strong":b?"em":"span";return s("td",{"aria-disabled":String(f),"aria-selected":c?"true":void 0,class:D,"data-date":a(t),key:k,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:y(t,this.currentDate)&&!this.disabled?0:-1},s(m,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long"}).format(t)))})))}))))),t&&s("div",{class:this.getClassName("footer")},this.showTodayButton&&s("button",{class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&s("button",{class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton))));var i}get el(){return n(this)}static get watchers(){return{firstDayOfWeek:["watchFirstDayOfWeek"],locale:["watchLocale"],range:["watchRange"],startDate:["watchStartDate"],value:["watchValue"]}}};D.style=".visually-hidden.sc-wc-datepicker{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}";export{D as wc_datepicker}
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as n}from"./p-e5528e8a.js";function h(t,i){const s=new Date(t);return s.setDate(s.getDate()+i),s}function o(t){return b(new Date(`${String(g(t)).padStart(4,"0")}-${String(l(t)).padStart(2,"0")}-01`))}function a(t){if(t instanceof Date)return`${t.getFullYear()}-${String(t.getMonth()+1).padStart(2,"0")}-${String(t.getDate()).padStart(2,"0")}`}function r(t){const i=o(t);return i.setMonth(i.getMonth()+1),i.setDate(i.getDate()-1),i}function l(t){return t.getMonth()+1}function d(t){return h(t,1)}function c(t){const i=new Date(t);return i.setDate(1),i.setMonth(i.getMonth()+1),i}function u(t){const i=new Date(t);return i.setFullYear(i.getFullYear()+1),i}function v(t){return f(t,1)}function w(t){const i=new Date(t);return i.setDate(1),i.setMonth(i.getMonth()-1),i}function p(t){const i=new Date(t);return i.setFullYear(i.getFullYear()-1),i}function g(t){return t.getFullYear()}function y(t,i){return!(!t||!i)&&t.getFullYear()===i.getFullYear()&&t.getMonth()===i.getMonth()&&t.getDate()===i.getDate()}function b(t){const i=new Date(t);return i.setMinutes(i.getMinutes()+i.getTimezoneOffset()),i}function f(t,i){const s=new Date(t);return s.setDate(s.getDate()-i),s}const k={clearButton:"Clear value",monthSelect:"Select month",nextMonthButton:"Next month",nextYearButton:"Next year",picker:"Choose date",previousMonthButton:"Previous month",previousYearButton:"Previous year",todayButton:"Show today",yearSelect:"Select year"},D=class{constructor(s){t(this,s),this.selectDate=i(this,"selectDate",7),this.changeMonth=i(this,"changeMonth",7),this.disabled=!1,this.disableDate=()=>!1,this.elementClassName="wc-datepicker",this.firstDayOfWeek=0,this.labels=k,this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US",this.showClearButton=!1,this.showMonthStepper=!0,this.showTodayButton=!1,this.showYearStepper=!1,this.startDate=a(new Date),this.init=()=>{this.currentDate=this.startDate?b(new Date(this.startDate)):new Date,this.updateWeekdays()},this.nextMonth=()=>{this.updateCurrentDate(c(this.currentDate))},this.nextYear=()=>{this.updateCurrentDate(u(this.currentDate))},this.previousMonth=()=>{this.updateCurrentDate(w(this.currentDate))},this.previousYear=()=>{this.updateCurrentDate(p(this.currentDate))},this.showToday=()=>{this.updateCurrentDate(new Date)},this.clear=()=>{this.value=void 0,this.selectDate.emit(void 0)},this.onClick=t=>{if(this.disabled)return;const i=t.target.closest("[data-date]");if(!Boolean(i))return;const s=b(new Date(i.dataset.date));this.updateCurrentDate(s),this.onSelectDate(s)},this.onMonthSelect=t=>{const i=+t.target.value-1,s=new Date(this.currentDate);s.setMonth(i),this.updateCurrentDate(s)},this.onYearSelect=t=>{let i=+t.target.value;const s=t.target;isNaN(i)?(i=(new Date).getFullYear(),s.value=String(i)):i<0?(i=0,s.value=String(i)):i>9999&&(i=9999,s.value=String(i));const e=new Date(this.currentDate);e.setFullYear(i),this.updateCurrentDate(e)},this.onKeyDown=t=>{this.disabled||("ArrowLeft"===t.code?(t.preventDefault(),this.updateCurrentDate(v(this.currentDate),!0)):"ArrowRight"===t.code?(t.preventDefault(),this.updateCurrentDate(d(this.currentDate),!0)):"ArrowUp"===t.code?(t.preventDefault(),this.updateCurrentDate(f(this.currentDate,7),!0)):"ArrowDown"===t.code?(t.preventDefault(),this.updateCurrentDate(h(this.currentDate,7),!0)):"PageUp"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?p(this.currentDate):w(this.currentDate),!0)):"PageDown"===t.code?(t.preventDefault(),this.updateCurrentDate(t.shiftKey?u(this.currentDate):c(this.currentDate),!0)):"Home"===t.code?(t.preventDefault(),this.updateCurrentDate(o(this.currentDate),!0)):"End"===t.code?(t.preventDefault(),this.updateCurrentDate(r(this.currentDate),!0)):"Space"!==t.code&&"Enter"!==t.code||(t.preventDefault(),this.onSelectDate(this.currentDate)))},this.onMouseEnter=t=>{if(this.disabled)return;const i=b(new Date(t.target.closest("td").dataset.date));this.hoveredDate=i},this.onMouseLeave=()=>{this.hoveredDate=void 0}}componentWillLoad(){this.init()}watchFirstDayOfWeek(){this.updateWeekdays()}watchLocale(){Boolean(this.locale)||(this.locale=(null===navigator||void 0===navigator?void 0:navigator.language)||"en-US"),this.updateWeekdays()}watchRange(){this.value=void 0,this.selectDate.emit(void 0)}watchStartDate(){this.currentDate=this.startDate?b(new Date(this.startDate)):new Date}watchValue(){Boolean(this.value)&&(Array.isArray(this.value)&&this.value.length>=1?this.currentDate=this.value[0]:this.value instanceof Date&&(this.currentDate=this.value))}componentDidRender(){this.moveFocusAfterMonthChanged&&(this.focusDate(this.currentDate),this.moveFocusAfterMonthChanged=!1)}updateWeekdays(){var t,i;this.weekdays=(t=0===this.firstDayOfWeek?7:this.firstDayOfWeek,i=this.locale,new Array(7).fill(void 0).map(((i,s)=>(t+s)%7+1)).map((t=>{const s=b(new Date(`2006-01-0${t}`));return[Intl.DateTimeFormat(i,{weekday:"short"}).format(s),Intl.DateTimeFormat(i,{weekday:"long"}).format(s)]})))}getClassName(t){return Boolean(t)?`${this.elementClassName}__${t}`:this.elementClassName}getCalendarRows(){const t=function(t,i,s){const e=[],n=o(t),h=0===n.getDay()?7:n.getDay(),a=r(t),l=0===a.getDay()?7:a.getDay(),c=1===s?7:s-1,u=[],w=[];{let t=(7-s+h)%7,i=v(n);for(;t>0;)u.push(i),i=v(i),t-=1;u.reverse();let e=(7-l+c)%7,o=d(a);for(;e>0;)w.push(o),o=d(o),e-=1}let p=n;for(;p.getMonth()===t.getMonth();)e.push(p),p=d(p);return[...u,...e,...w]}(this.currentDate,0,0===this.firstDayOfWeek?7:this.firstDayOfWeek),i=[];for(let s=0;s<t.length;s+=7){const e=t.slice(s,s+7);i.push(e)}return i}getTitle(){if(Boolean(this.currentDate))return Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long",year:"numeric"}).format(this.currentDate)}focusDate(t){var i;null===(i=this.el.querySelector(`[data-date="${a(t)}"]`))||void 0===i||i.focus()}updateCurrentDate(t,i){const s=t.getMonth(),e=t.getFullYear();e>9999||e<0||((s!==this.currentDate.getMonth()||e!==this.currentDate.getFullYear())&&(this.changeMonth.emit({month:l(t),year:g(t)}),i&&(this.moveFocusAfterMonthChanged=!0)),this.currentDate=t,i&&this.focusDate(this.currentDate))}onSelectDate(t){var i,s;if(!this.disableDate(t))if(this.isRangeValue(this.value)){const s=void 0===(null===(i=this.value)||void 0===i?void 0:i[0])||2===this.value.length?[t]:[this.value[0],t];2===s.length&&s[0]>s[1]&&s.reverse();const e=void 0===s[1]?[a(s[0])]:[a(s[0]),a(s[1])];this.value=s,this.selectDate.emit(e)}else{if((null===(s=this.value)||void 0===s?void 0:s.getTime())===t.getTime())return;this.value=t,this.selectDate.emit(a(t))}}isRangeValue(t){return this.range}render(){const t=this.showTodayButton||this.showClearButton;return s(e,null,s("div",{"aria-disabled":String(this.disabled),"aria-label":this.labels.picker,class:{[this.getClassName()]:!0,[`${this.getClassName()}--disabled`]:this.disabled},role:"group"},s("div",{class:this.getClassName("header")},s("span",{"aria-atomic":"true","aria-live":"polite",class:"visually-hidden"},this.getTitle()),this.showYearStepper&&s("button",{"aria-label":this.labels.previousYearButton,class:this.getClassName("previous-year-button"),disabled:this.disabled,innerHTML:this.previousYearButtonContent||void 0,onClick:this.previousYear,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"11 17 6 12 11 7"}),s("polyline",{points:"18 17 13 12 18 7"}))),this.showMonthStepper&&s("button",{"aria-label":this.labels.previousMonthButton,class:this.getClassName("previous-month-button"),disabled:this.disabled,innerHTML:this.previousMonthButtonContent||void 0,onClick:this.previousMonth,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"15 18 9 12 15 6"}))),s("span",{class:this.getClassName("current-month")},s("select",{"aria-label":this.labels.monthSelect,class:this.getClassName("month-select"),disabled:this.disabled,name:"month",onChange:this.onMonthSelect},(i=this.locale,new Array(12).fill(void 0).map(((t,s)=>{const e=b(new Date(`2006-${String(s+1).padStart(2,"0")}-01`));return Intl.DateTimeFormat(i,{month:"long"}).format(e)}))).map(((t,i)=>s("option",{key:t,selected:this.currentDate.getMonth()===i,value:i+1},t)))),s("input",{"aria-label":this.labels.yearSelect,class:this.getClassName("year-select"),disabled:this.disabled,max:9999,maxLength:4,min:1,name:"year",onChange:this.onYearSelect,type:"number",value:this.currentDate.getFullYear()})),this.showMonthStepper&&s("button",{"aria-label":this.labels.nextMonthButton,class:this.getClassName("next-month-button"),disabled:this.disabled,innerHTML:this.nextMonthButtonContent||void 0,onClick:this.nextMonth,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"9 18 15 12 9 6"}))),this.showYearStepper&&s("button",{"aria-label":this.labels.nextYearButton,class:this.getClassName("next-year-button"),disabled:this.disabled,innerHTML:this.nextYearButtonContent||void 0,onClick:this.nextYear,type:"button"},s("svg",{fill:"none",height:"24","stroke-linecap":"round","stroke-linejoin":"round","stroke-width":"2",stroke:"currentColor",viewBox:"0 0 24 24",width:"24"},s("polyline",{points:"13 17 18 12 13 7"}),s("polyline",{points:"6 17 11 12 6 7"})))),s("div",{class:this.getClassName("body")},s("table",{class:this.getClassName("calendar"),onKeyDown:this.onKeyDown,role:"grid"},s("thead",{class:this.getClassName("calendar-header")},s("tr",{class:this.getClassName("weekday-row")},this.weekdays.map((t=>s("th",{abbr:t[1],class:this.getClassName("weekday"),key:t[0],scope:"col"},s("span",null,t[0])))))),s("tbody",null,this.getCalendarRows().map((t=>{const i=`row-${t[0].getMonth()}-${t[0].getDate()}`;return s("tr",{class:this.getClassName("calendar-row"),key:i},t.map((t=>{var i,e,n,h,o;const r=y(t,this.currentDate),l=t.getMonth()!==this.currentDate.getMonth(),d=Array.isArray(this.value)?y(t,this.value[0])||y(t,this.value[1]):y(t,this.value),c=!!this.isRangeValue&&(v={from:null===(i=this.value)||void 0===i?void 0:i[0],to:(null===(e=this.value)||void 0===e?void 0:e[1])||this.hoveredDate||this.currentDate},!!((u=t)&&v&&v.from&&v.to)&&u>=(v.from<v.to?v.from:v.to)&&u<=(v.from<v.to?v.to:v.from));var u,v;const w=Boolean(null===(n=this.value)||void 0===n?void 0:n[0])?[null===(h=this.value)||void 0===h?void 0:h[0],(null===(o=this.value)||void 0===o?void 0:o[1])||this.hoveredDate].sort(((t,i)=>t-i)):[],p=this.range&&y(w[0],t),g=this.range&&y(w[1],t),b=y(t,new Date),f=this.disableDate(t),k=`cell-${t.getMonth()}-${t.getDate()}`,D={[this.getClassName("date")]:!0,[this.getClassName("date--current")]:r,[this.getClassName("date--disabled")]:f,[this.getClassName("date--overflowing")]:l,[this.getClassName("date--today")]:b,[this.getClassName("date--selected")]:d,[this.getClassName("date--in-range")]:c,[this.getClassName("date--start")]:p,[this.getClassName("date--end")]:g},m=d?"strong":b?"em":"span";return s("td",{"aria-disabled":String(f),"aria-selected":d?"true":void 0,class:D,"data-date":a(t),key:k,onClick:this.onClick,onMouseEnter:this.onMouseEnter,onMouseLeave:this.onMouseLeave,role:"gridcell",tabIndex:y(t,this.currentDate)&&!this.disabled?0:-1},s(m,{"aria-hidden":"true"},t.getDate()),s("span",{class:"visually-hidden"},Intl.DateTimeFormat(this.locale,{day:"numeric",month:"long"}).format(t)))})))}))))),t&&s("div",{class:this.getClassName("footer")},this.showTodayButton&&s("button",{class:this.getClassName("today-button"),disabled:this.disabled,innerHTML:this.todayButtonContent||void 0,onClick:this.showToday,type:"button"},this.labels.todayButton),this.showClearButton&&s("button",{class:this.getClassName("clear-button"),disabled:this.disabled,innerHTML:this.clearButtonContent||void 0,onClick:this.clear,type:"button"},this.labels.clearButton))));var i}get el(){return n(this)}static get watchers(){return{firstDayOfWeek:["watchFirstDayOfWeek"],locale:["watchLocale"],range:["watchRange"],startDate:["watchStartDate"],value:["watchValue"]}}};D.style=".visually-hidden.sc-wc-datepicker{position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);clip-path:inset(50%)}";export{D as wc_datepicker}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as o,c as t,h as e,H as i,g as s}from"./p-e5528e8a.js";import{o as r,s as n,f as p,c as a,a as h}from"./p-6ac4b552.js";import{d,e as c}from"./p-33c168b3.js";import{c as l}from"./p-b7898321.js";import{i as v,q as m,b as f}from"./p-ae2bed6f.js";const u=class{constructor(e){o(this,e),this.popoverClose=t(this,"popoverClose",7),this.popoverOpen=t(this,"popoverOpen",7),this.toggle=o=>{o.stopPropagation(),this.active?this.close():this.open()},this.onKeydown=o=>{"Escape"===o.code&&this.active&&(o.stopImmediatePropagation(),o.stopPropagation(),this.close())},this.reposition=async()=>{const o=v();if(!Boolean(this.triggerEl)||!Boolean(this.contentContainer))return;if(o)return void(this.position=void 0);const t="number"==typeof this.offset?{mainAxis:this.offset,crossAxis:0}:{mainAxis:this.offset[0],crossAxis:this.offset[1]},e=this.enableFlip?[r(t),n(),p()]:[r(t),n()];this.position=await a(this.triggerEl,this.contentContainer,{middleware:e,placement:this.placement,strategy:"fixed"})},this.onCloseButtonClick=()=>{this.close()},this.animation="scale-in-xy",this.disableScrollLock=void 0,this.enableFlip=!0,this.fullscreenBottomSheet=void 0,this.label=void 0,this.maxHeight="22rem",this.offset=8,this.popoverId=void 0,this.placement="bottom-start",this.returnFocusToTrigger=!0,this.transparent=void 0,this.trigger=void 0,this.triggerContainer=void 0,this.useContainerWidth=void 0,this.active=!1,this.closing=!1,this.position=void 0}componentDidLoad(){this.connectTrigger(),this.updateTriggerAttributes(),Boolean(this.trigger)&&console.warn('[Swirl] The "trigger" prop of swirl-popover is deprecated and will be removed with the next major release. Please use the swirl-popover-trigger component instead. https://swirl-storybook.flip-app.dev/?path=/docs/components-swirlpopovertrigger--docs')}disconnectedCallback(){this.unlockBodyScroll()}onWindowFocusIn(o){if(!this.active)return;const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),e="webkit"in window,i=t||e,s=o.target,r=o.relatedTarget,n=f(),p=!this.el.contains(s)&&!this.el.contains(n),a=s!==this.triggerEl&&!this.triggerEl?.contains(s),h=i&&!this.el.contains(r||s)&&r!==this.el;["SWIRL-TAB"].includes(s.tagName)||!p||!a||i&&!h||this.close()}onWindowClick(o){if(!this.active||this.closing)return;const t=o.target,e=this.el.contains(t),i=o.composedPath().some((o=>!!(Boolean(o)&&o instanceof Node)&&this.el.contains(o))),s=t===this.triggerEl||this.triggerEl.contains(t)||o.composedPath().includes(this.triggerEl);e||i||s||this.close()}async close(){!this.closing&&this.active&&(this.popoverClose.emit(),this.disableAutoUpdate&&this.disableAutoUpdate(),this.closing=!0,setTimeout((()=>{this.active=!1,this.closing=!1,this.updateTriggerAttributes()}),150),this.unlockBodyScroll(),this.returnFocusToTrigger&&this.getNativeTriggerElement()?.focus())}async open(o){if(this.triggerEl=o||this.triggerEl,this.active||!Boolean(this.triggerEl))return;this.adjustWidth(),this.active=!0,this.updateTriggerAttributes();const t=this.getFocusableChildren();requestAnimationFrame((async()=>{await this.reposition(),this.popoverOpen.emit({position:this.position}),t.length>0?t[0].focus():this.contentContainer.focus(),this.disableAutoUpdate&&this.disableAutoUpdate(),this.disableAutoUpdate=h(this.triggerEl,this.contentContainer,(()=>this.reposition())),this.scrollContainer.scrollTop=0,this.lockBodyScroll()}))}connectTrigger(){Boolean(this.trigger)?(this.triggerEl="string"==typeof this.trigger?m(this.triggerContainer||document.body,`#${this.trigger}`)[0]:this.trigger,Boolean(this.triggerEl)&&this.triggerEl.addEventListener("click",(o=>{this.toggle(o)}))):this.triggerEl=void 0}getNativeTriggerElement(){return this.triggerEl?.tagName.startsWith("SWIRL-")&&(this.triggerEl?.children[0]||this.triggerEl?.shadowRoot?.children[0])||this.triggerEl}updateTriggerAttributes(){if(!Boolean(this.triggerEl))return;const o=this.getNativeTriggerElement();o.setAttribute("aria-controls",this.el.id),o.setAttribute("aria-expanded",String(this.active)),o.setAttribute("aria-haspopup","dialog")}getFocusableChildren(){return m(this.el,'[role="menuitem"], [role="listbox"]')}adjustWidth(){let o=this.useContainerWidth;[!0,"true"].includes(this.useContainerWidth)?o=!0:[!1,"false"].includes(this.useContainerWidth)&&(o=!1);const t=!window.matchMedia("(min-width: 768px)").matches;if(Boolean(o)&&!t){const t="string"==typeof o&&this.el.closest(o)||this.el.parentElement;this.contentContainer.style.maxWidth="none",this.contentContainer.style.width=t.getBoundingClientRect().width+"px"}else this.contentContainer.style.maxWidth="",this.contentContainer.style.width=""}lockBodyScroll(){v()&&!this.disableScrollLock&&Boolean(this.scrollContainer)&&d(this.scrollContainer)}unlockBodyScroll(){v()&&!this.disableScrollLock&&Boolean(this.scrollContainer)&&c(this.scrollContainer)}render(){const o=!window.matchMedia("(min-width: 768px)").matches,t=l("popover",`popover--animation-${this.animation}`,`popover--placement-${this.position?.placement}`,{"popover--active":this.active,"popover--closing":this.closing,"popover--fullscreen-bottom-sheet":this.fullscreenBottomSheet,"popover--inactive":!this.active,"popover--transparent":this.transparent});return e(i,null,e("div",{class:t,onKeyDown:this.onKeydown},e("div",{"aria-hidden":this.active?"false":"true","aria-label":this.label,class:"popover__content",id:this.popoverId,part:"popover__content",role:"dialog",ref:o=>this.contentContainer=o,style:{top:Boolean(this.position)?`${this.position?.y}px`:"",left:Boolean(this.position)?`${this.position?.x}px`:""},tabindex:"-1"},e("span",{class:"popover__handle"}),e("div",{class:"popover__scroll-container",part:"popover__scroll-container",ref:o=>this.scrollContainer=o,style:{maxHeight:!o&&Boolean(this.maxHeight)?this.maxHeight:void 0}},e("slot",null))),this.active&&e("div",{class:"popover__backdrop",onClick:this.onCloseButtonClick})))}get el(){return s(this)}};u.style=":host{position:relative;z-index:var(--s-z-40);display:inline-flex}:host *{box-sizing:border-box}.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{transform-origin:top left;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;animation-fill-mode:forwards}@media (prefers-reduced-motion){.popover--closing .popover__backdrop{animation:none}}.popover--closing .popover__content{animation:0.15s popover-slide-out;animation-fill-mode:forwards}@media (min-width: 768px){.popover--closing .popover__content{animation:0.15s popover-fade-out}}@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;animation-fill-mode: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--transparent .popover__content{background-color:transparent;box-shadow:none}}@media (min-width: 768px){.popover--transparent .popover__scroll-container{padding:0}}.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;max-width:22.5rem;border-radius:var(--s-border-radius-sm);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:var(--s-space-8);padding-bottom:var(--s-space-8)}}.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}}";const g=class{constructor(t){o(this,t),this.onClick=()=>{const o=this.getPopoverEl();if(!Boolean(o))return;if(this.isPopoverOpen())return void o.close();const t=this.getTriggerEl();Boolean(t)&&(o.open(t),o.addEventListener("popoverOpen",(()=>{this.updateTriggerElAriaAttributes(!0)}),{once:!0}),o.addEventListener("popoverClose",(()=>{this.updateTriggerElAriaAttributes(!1)}),{once:!0}))},this.updateTriggerElAriaAttributes=o=>{if(!this.setAriaAttributes)return;const t=this.getTriggerEl();if(!Boolean(t))return;const e="string"==typeof this.popover?this.popover:this.popover?.id;t.tagName.startsWith("SWIRL-")?(t.setAttribute("swirl-aria-controls",e),t.setAttribute("swirl-aria-expanded",String(o||"false")),t.setAttribute("swirl-aria-haspopup","dialog")):(t.setAttribute("aria-controls",e),t.setAttribute("aria-expanded",String(o||"false")),t.setAttribute("aria-haspopup","dialog"))},this.hidePopoverWhenInvisible=!0,this.parentScrollContainer=void 0,this.popover=void 0,this.setAriaAttributes=!0}componentDidLoad(){if(this.updateTriggerElAriaAttributes(),this.hidePopoverWhenInvisible){this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange.bind(this),{root:this.parentScrollContainer,threshold:1});const o=this.el.querySelector("*");if(!Boolean(o))return;this.intersectionObserver.observe(o)}}disconnectedCallback(){this.intersectionObserver?.disconnect()}watchPopover(){this.updateTriggerElAriaAttributes()}getPopoverEl(){return"string"==typeof this.popover?document.querySelector(`#${this.popover}`):this.popover}getTriggerEl(){return 1!==this.el.children.length&&console.warn('[Swirl] The "swirl-popover-trigger" component expects exactly one child element.'),this.el.children[0]}onVisibilityChange(o){!o[0].isIntersecting&&this.isPopoverOpen()&&this.getPopoverEl()?.close()}isPopoverOpen(){const o=this.getPopoverEl(),t=o?.shadowRoot.firstChild?.classList.contains("popover--active");return t}render(){return e(i,{onClick:this.onClick},e("slot",null))}get el(){return s(this)}static get watchers(){return{popover:["watchPopover"]}}};g.style=".sc-swirl-popover-trigger-h{display:contents}";export{u as swirl_popover,g as swirl_popover_trigger}
|
|
1
|
+
import{r as o,c as t,h as e,H as i,g as s}from"./p-e5528e8a.js";import{o as r,s as n,f as a,c as p,a as h}from"./p-6ac4b552.js";import{d,e as c}from"./p-33c168b3.js";import{c as l}from"./p-b7898321.js";import{i as v,q as m,b as f}from"./p-ae2bed6f.js";const u=class{constructor(e){o(this,e),this.popoverClose=t(this,"popoverClose",7),this.popoverOpen=t(this,"popoverOpen",7),this.toggle=o=>{o.stopPropagation(),this.active?this.close():this.open()},this.onKeydown=o=>{"Escape"===o.code&&this.active&&(o.stopImmediatePropagation(),o.stopPropagation(),this.close())},this.reposition=async()=>{const o=v();if(!Boolean(this.triggerEl)||!Boolean(this.contentContainer))return;if(o)return void(this.position=void 0);const t="number"==typeof this.offset?{mainAxis:this.offset,crossAxis:0}:{mainAxis:this.offset[0],crossAxis:this.offset[1]},e=this.enableFlip?[r(t),n(),a()]:[r(t),n()];this.position=await p(this.triggerEl,this.contentContainer,{middleware:e,placement:this.placement,strategy:"fixed"})},this.onCloseButtonClick=()=>{this.close()},this.animation="scale-in-xy",this.disableScrollLock=void 0,this.enableFlip=!0,this.fullscreenBottomSheet=void 0,this.label=void 0,this.maxHeight="22rem",this.offset=8,this.popoverId=void 0,this.placement="bottom-start",this.returnFocusToTrigger=!0,this.transparent=void 0,this.trigger=void 0,this.triggerContainer=void 0,this.useContainerWidth=void 0,this.active=!1,this.closing=!1,this.position=void 0}componentDidLoad(){this.connectTrigger(),this.updateTriggerAttributes(),Boolean(this.trigger)&&console.warn('[Swirl] The "trigger" prop of swirl-popover is deprecated and will be removed with the next major release. Please use the swirl-popover-trigger component instead. https://swirl-storybook.flip-app.dev/?path=/docs/components-swirlpopovertrigger--docs')}disconnectedCallback(){this.unlockBodyScroll()}onWindowFocusIn(o){if(!this.active)return;const t=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),e="webkit"in window,i=t||e,s=o.target,r=o.relatedTarget,n=f(),a=!this.el.contains(s)&&!this.el.contains(n),p=s!==this.triggerEl&&!this.triggerEl?.contains(s),h=i&&!this.el.contains(r||s)&&r!==this.el;["SWIRL-TAB"].includes(s.tagName)||!a||!p||i&&!h||this.close()}onWindowClick(o){if(!this.active||this.closing)return;const t=o.target,e=this.el.contains(t),i=o.composedPath().some((o=>!!(Boolean(o)&&o instanceof Node)&&this.el.contains(o))),s=t===this.triggerEl||this.triggerEl.contains(t)||o.composedPath().includes(this.triggerEl);e||i||s||this.close()}async close(){!this.closing&&this.active&&(this.popoverClose.emit(),this.disableAutoUpdate&&this.disableAutoUpdate(),this.closing=!0,setTimeout((()=>{this.active=!1,this.closing=!1,this.updateTriggerAttributes()}),150),this.unlockBodyScroll(),this.returnFocusToTrigger&&this.getNativeTriggerElement()?.focus())}async open(o){if(this.triggerEl=o||this.triggerEl,this.active||!Boolean(this.triggerEl))return;this.adjustWidth(),this.active=!0,this.updateTriggerAttributes();const t=this.getFocusableChildren();requestAnimationFrame((async()=>{await this.reposition(),this.popoverOpen.emit({position:this.position}),t.length>0?t[0].focus():this.contentContainer.focus(),this.disableAutoUpdate&&this.disableAutoUpdate(),this.disableAutoUpdate=h(this.triggerEl,this.contentContainer,(()=>this.reposition())),this.scrollContainer.scrollTop=0,this.lockBodyScroll()}))}connectTrigger(){Boolean(this.trigger)?(this.triggerEl="string"==typeof this.trigger?m(this.triggerContainer||document.body,`#${this.trigger}`)[0]:this.trigger,Boolean(this.triggerEl)&&this.triggerEl.addEventListener("click",(o=>{this.toggle(o)}))):this.triggerEl=void 0}getNativeTriggerElement(){return this.triggerEl?.tagName.startsWith("SWIRL-")&&(this.triggerEl?.children[0]||this.triggerEl?.shadowRoot?.children[0])||this.triggerEl}updateTriggerAttributes(){if(!Boolean(this.triggerEl))return;const o=this.getNativeTriggerElement();o.setAttribute("aria-controls",this.el.id),o.setAttribute("aria-expanded",String(this.active)),o.setAttribute("aria-haspopup","dialog")}getFocusableChildren(){return m(this.el,'[role="menuitem"], [role="listbox"]')}adjustWidth(){let o=this.useContainerWidth;[!0,"true"].includes(this.useContainerWidth)?o=!0:[!1,"false"].includes(this.useContainerWidth)&&(o=!1);const t=!window.matchMedia("(min-width: 768px)").matches;if(Boolean(o)&&!t){const t="string"==typeof o&&this.el.closest(o)||this.el.parentElement;this.contentContainer.style.maxWidth="none",this.contentContainer.style.width=t.getBoundingClientRect().width+"px"}else this.contentContainer.style.maxWidth="",this.contentContainer.style.width=""}lockBodyScroll(){v()&&!this.disableScrollLock&&Boolean(this.scrollContainer)&&d(this.scrollContainer)}unlockBodyScroll(){v()&&!this.disableScrollLock&&Boolean(this.scrollContainer)&&c(this.scrollContainer)}render(){const o=!window.matchMedia("(min-width: 768px)").matches,t=l("popover",`popover--animation-${this.animation}`,`popover--placement-${this.position?.placement}`,{"popover--active":this.active,"popover--closing":this.closing,"popover--fullscreen-bottom-sheet":this.fullscreenBottomSheet,"popover--inactive":!this.active,"popover--transparent":this.transparent});return e(i,null,e("div",{class:t,onKeyDown:this.onKeydown},e("div",{"aria-hidden":this.active?"false":"true","aria-label":this.label,class:"popover__content",id:this.popoverId,part:"popover__content",role:"dialog",ref:o=>this.contentContainer=o,style:{top:Boolean(this.position)?`${this.position?.y}px`:"",left:Boolean(this.position)?`${this.position?.x}px`:""},tabindex:"-1"},e("span",{class:"popover__handle"}),e("div",{class:"popover__scroll-container",part:"popover__scroll-container",ref:o=>this.scrollContainer=o,style:{maxHeight:!o&&Boolean(this.maxHeight)?this.maxHeight:void 0}},e("slot",null))),this.active&&e("div",{class:"popover__backdrop",onClick:this.onCloseButtonClick})))}get el(){return s(this)}};u.style=":host{position:relative;z-index:var(--s-z-40);display:inline-flex}:host *{box-sizing:border-box}.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{transform-origin:top left;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;animation-fill-mode:forwards}@media (prefers-reduced-motion){.popover--closing .popover__backdrop{animation:none}}.popover--closing .popover__content{animation:0.15s popover-slide-out;animation-fill-mode:forwards}@media (min-width: 768px){.popover--closing .popover__content{animation:0.15s popover-fade-out}}@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;animation-fill-mode: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--transparent .popover__content{background-color:transparent;box-shadow:none}}@media (min-width: 768px){.popover--transparent .popover__scroll-container{padding:0}}.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;max-width:22.5rem;border-radius:var(--s-border-radius-sm);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:var(--s-space-8);padding-bottom:var(--s-space-8)}}.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}}";const g=class{constructor(t){o(this,t),this.onClick=()=>{const o=this.getPopoverEl();if(!Boolean(o))return;if(this.isPopoverOpen())return void o.close();const t=this.getTriggerEl();Boolean(t)&&(o.open(t),o.addEventListener("popoverOpen",(()=>{this.updateTriggerElAriaAttributes(!0)}),{once:!0}),o.addEventListener("popoverClose",(()=>{this.updateTriggerElAriaAttributes(!1)}),{once:!0}))},this.updateTriggerElAriaAttributes=o=>{if(!this.setAriaAttributes)return;const t=this.getTriggerEl();if(!Boolean(t))return;const e="string"==typeof this.swirlPopover?this.swirlPopover:this.swirlPopover?.id;t.tagName.startsWith("SWIRL-")?(t.setAttribute("swirl-aria-controls",e),t.setAttribute("swirl-aria-expanded",String(o||"false")),t.setAttribute("swirl-aria-haspopup","dialog")):(t.setAttribute("aria-controls",e),t.setAttribute("aria-expanded",String(o||"false")),t.setAttribute("aria-haspopup","dialog"))},this.hidePopoverWhenInvisible=!0,this.parentScrollContainer=void 0,this.setAriaAttributes=!0,this.swirlPopover=void 0}componentDidLoad(){if(this.updateTriggerElAriaAttributes(),this.hidePopoverWhenInvisible){this.intersectionObserver=new IntersectionObserver(this.onVisibilityChange.bind(this),{root:this.parentScrollContainer,threshold:1});const o=this.el.querySelector("*");if(!Boolean(o))return;this.intersectionObserver.observe(o)}}disconnectedCallback(){this.intersectionObserver?.disconnect()}watchPopover(){this.updateTriggerElAriaAttributes()}getPopoverEl(){return"string"==typeof this.swirlPopover?document.querySelector(`#${this.swirlPopover}`):this.swirlPopover}getTriggerEl(){return 1!==this.el.children.length&&console.warn('[Swirl] The "swirl-popover-trigger" component expects exactly one child element.'),this.el.children[0]}onVisibilityChange(o){!o[0].isIntersecting&&this.isPopoverOpen()&&this.getPopoverEl()?.close()}isPopoverOpen(){const o=this.getPopoverEl(),t=o?.shadowRoot.firstChild?.classList.contains("popover--active");return t}render(){return e(i,{onClick:this.onClick},e("slot",null))}get el(){return s(this)}static get watchers(){return{swirlPopover:["watchPopover"]}}};g.style=".sc-swirl-popover-trigger-h{display:contents}";export{u as swirl_popover,g as swirl_popover_trigger}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,c as s,h as a,H as e}from"./p-e5528e8a.js";import{c as o}from"./p-b7898321.js";import{c as t}from"./p-878dc806.js";const i="SWIRL_SHELL_NAVIGATION_COLLAPSE_STATE",r="SWIRL_SHELL_SIDEBAR_STATE",h=class{constructor(a){l(this,a),this.sidebarToggleClick=s(this,"sidebarToggleClick",7),this.skipLinkClick=s(this,"skipLinkClick",7),this.onBrowserBackClick=()=>{history.back()},this.onBrowserForwardClick=()=>{history.forward()},this.onNavigationToggleClick=()=>{this.navigationCollapsed=!this.navigationCollapsed},this.onNavigationClick=()=>{this.hideMobileNavigation()},this.brandedHeader=void 0,this.browserBackButtonLabel="Navigate back",this.browserForwardButtonLabel="Navigate forward",this.hideMobileNavigationButtonLabel="Close navigation",this.navigationLabel="Main",this.navigationToggleLabel="Toggle navigation",this.sidebarActive=void 0,this.sidebarToggleBadge=void 0,this.sidebarToggleBadgeAriaLabel=void 0,this.sidebarToggleIcon="notifications",this.sidebarToggleLabel="Toggle sidebar",this.skipLinkLabel="Skip to main content",this.mobileNavigationActive=void 0,this.navigationCollapsed=void 0}componentWillLoad(){const l="true"===localStorage.getItem(r);this.sidebarActive=void 0===this.sidebarActive?l:this.sidebarActive;const s="true"===localStorage.getItem(i);this.navigationCollapsed=s}componentDidLoad(){this.focusTrap=t(this.navElement,{allowOutsideClick:!0,tabbableOptions:{getShadowRoot:l=>l.shadowRoot}})}componentDidRender(){this.focusTrap?.updateContainerElements(this.navElement)}disconnectedCallback(){this.focusTrap?.deactivate()}onWindowKeyDown(l){"Escape"===l.key&&this.mobileNavigationActive&&this.hideMobileNavigation()}watchMobileNavigationState(){this.mobileNavigationActive?setTimeout((()=>{this.focusTrap.activate()}),200):this.focusTrap.deactivate()}watchNavigationCollapsed(){localStorage.setItem(i,String(this.navigationCollapsed))}watchSidebarActive(){localStorage.setItem(r,String(this.sidebarActive))}async showMobileNavigation(){this.mobileNavigationActive=!0}async hideMobileNavigation(){this.mobileNavigationActive=!1}render(){const l=!0!==this.sidebarToggleBadge&&"true"!==this.sidebarToggleBadge,s=o("shell-layout",{"shell-layout--branded-header":this.brandedHeader,"shell-layout--mobile-navigation-active":this.mobileNavigationActive,"shell-layout--navigation-collapsed":this.navigationCollapsed,"shell-layout--sidebar-active":this.sidebarActive});return a(e,null,a("div",{class:s},a("header",{class:"shell-layout__header","data-tauri-drag-region":"true"},a("button",{class:"shell-layout__skip-link",onClick:this.skipLinkClick.emit,type:"button"},this.skipLinkLabel),a("div",{class:"shell-layout__header-left"},a("button",{class:"shell-layout__header-tool",onClick:this.onNavigationToggleClick,type:"button"},a("swirl-icon-dock-left",{size:20}),a("swirl-visually-hidden",null,this.navigationToggleLabel)),a("button",{class:"shell-layout__header-tool",onClick:this.onBrowserBackClick,type:"button"},a("swirl-icon-arrow-back",{size:20}),a("swirl-visually-hidden",null,this.browserBackButtonLabel)),a("button",{class:"shell-layout__header-tool",onClick:this.onBrowserForwardClick,type:"button"},a("swirl-icon-arrow-forward",{size:20}),a("swirl-visually-hidden",null,this.browserForwardButtonLabel)),a("slot",{name:"left-header-tools"})),a("div",{class:"shell-layout__logo"},a("slot",{name:"logo"})),a("div",{class:"shell-layout__header-right"},a("slot",{name:"right-header-tools"}),a("button",{class:"shell-layout__header-tool shell-layout__sidebar-toggle",onClick:this.sidebarToggleClick.emit,type:"button"},a("swirl-icon",{glyph:this.sidebarToggleIcon,size:20}),a("swirl-visually-hidden",null,this.sidebarToggleLabel),this.sidebarToggleBadge&&a("swirl-badge",{"aria-label":this.sidebarToggleBadgeAriaLabel,label:l?String(this.sidebarToggleBadge):this.sidebarToggleBadgeAriaLabel,size:"xs",variant:l?"default":"dot"})),a("slot",{name:"avatar"}))),a("div",{class:"shell-layout__mobile-nav-backdrop",onClick:this.onNavigationClick}),a("nav",{"aria-labelledby":"main-navigation-label",class:"shell-layout__nav",onClick:this.onNavigationClick,ref:l=>this.navElement=l},a("div",{class:"shell-layout__mobile-header"},a("slot",{name:"mobile-logo"}),a("div",{class:"shell-layout__mobile-header-tools"},a("slot",{name:"mobile-header-tools"}),a("button",{class:"shell-layout__header-tool",type:"button"},a("swirl-icon-double-arrow-left",{size:20}),a("swirl-visually-hidden",null,this.hideMobileNavigationButtonLabel)))),a("div",{class:"shell-layout__nav-body"},a("swirl-visually-hidden",null,a("span",{id:"main-navigation-label"},this.navigationLabel)),a("slot",{name:"nav"}))),a("main",{class:"shell-layout__main",id:"main-content"},a("slot",null)),a("aside",{class:"shell-layout__sidebar",inert:!this.sidebarActive||void 0},a("div",{class:"shell-layout__sidebar-body"},a("div",{class:"shell-layout__sidebar-app-bar"},a("slot",{name:"sidebar-app-bar"})),a("div",{class:"shell-layout__sidebar-content"},a("slot",{name:"sidebar"}))))))}static get watchers(){return{mobileNavigationActive:["watchMobileNavigationState"],navigationCollapsed:["watchNavigationCollapsed"],sidebarActive:["watchSidebarActive"]}}};h.style='.sc-swirl-shell-layout-h{--swirl-shell-background:var(--s-surface-sunken-default);--swirl-shell-text-color:var(--s-text-default);--swirl-shell-header-height:3.25rem;--swirl-shell-collapsed-nav-width:4rem;--swirl-shell-extended-nav-width:14rem;--swirl-shell-sidebar-width:21rem;display:flex;width:100%;height:100%}.sc-swirl-shell-layout-h *.sc-swirl-shell-layout{box-sizing:border-box}.shell-layout.sc-swirl-shell-layout{display:grid;overflow:hidden;width:100%;min-height:100%;background-color:var(--swirl-shell-background);transition:grid-template-columns 0.2s;grid-template-columns:0 1fr 0;grid-template-rows:1fr;grid-template-areas:"nav main"}@media (min-width: 992px){.shell-layout.sc-swirl-shell-layout{padding-right:var(--s-space-8);padding-bottom:var(--s-space-8);gap:var(--s-space-8);grid-template-columns:var(--swirl-shell-extended-nav-width) 1fr 0;grid-template-rows:var(--swirl-shell-header-height) 1fr;grid-template-areas:"header header header"\n "nav main sidebar"}}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout{border-bottom:none;color:var(--s-text-on-action-primary);background-color:var(--s-action-primary-default)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout{color:var(--s-text-on-action-primary);background-color:var(--s-action-primary-default)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-action-primary-hovered)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-action-primary-pressed)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout swirl-badge.sc-swirl-shell-layout{--swirl-badge-border-color:var(--s-action-primary-default)}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:hover{width:var(--swirl-shell-extended-nav-width);padding-right:var(--s-space-12)}}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:not(:hover){scrollbar-width:none}.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:not(:hover)::-webkit-scrollbar{width:0;background:transparent;-webkit-appearance:none}}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-collapsed-nav-width) 1fr 0}}@media (min-width: 1440px){.shell-layout--sidebar-active.shell-layout--navigation-collapsed.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-collapsed-nav-width) 1fr var(\n --swirl-shell-sidebar-width\n )}}@media (min-width: 1440px){.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__main.sc-swirl-shell-layout{width:100%}}.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__sidebar.sc-swirl-shell-layout{overflow:initial}@media (min-width: 992px){.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__sidebar-body.sc-swirl-shell-layout{border:0.0625rem solid var(--s-border-default);transform:translate3d(0, 0, 0)}}@media (min-width: 1440px){.shell-layout--sidebar-active.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-extended-nav-width) 1fr var(\n --swirl-shell-sidebar-width\n )}}.sc-swirl-shell-layout:not(.shell-layout--sidebar-active) .shell-layout__sidebar.sc-swirl-shell-layout{animation:shell-layout-no-overflow-after-transition 0.2s;animation-fill-mode:forwards}.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout{transform:translate3d(0, 0, 0);box-shadow:var(--s-shadow-level-3)}@media (min-width: 992px){.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout{transform:none;box-shadow:none}}.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{display:block}@media (min-width: 992px){.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{display:none}}.shell-layout__header.sc-swirl-shell-layout{position:relative;display:none;width:calc(100% + var(--s-space-8));padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);justify-content:space-between;align-items:center;border-bottom:0.0625rem solid var(--s-border-default);color:var(--swirl-shell-text-color);grid-area:header}@media (min-width: 992px){.shell-layout__header.sc-swirl-shell-layout{display:flex}}.shell-layout__skip-link.sc-swirl-shell-layout{position:absolute;z-index:9;top:0;left:0;padding:var(--s-space-4);border:none;color:var(--swirl-shell-text-color);background-color:var(--swirl-shell-background);font:inherit;cursor:pointer}.shell-layout__skip-link.sc-swirl-shell-layout:not(:focus):not(:active){position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);-webkit-clip-path:inset(50%);clip-path:inset(50%)}.shell-layout__header-left.sc-swirl-shell-layout{display:flex;padding-left:var(--s-space-2);flex-basis:8rem;flex-shrink:0;align-items:center;gap:var(--s-space-8)}.shell-layout__header-right.sc-swirl-shell-layout{--swirl-ghost-button-background-default:var(--s-surface-sunken-default);--swirl-ghost-button-background-hovered:var(--s-surface-sunken-hovered);--swirl-ghost-button-background-pressed:var(--s-surface-sunken-pressed);display:flex;flex-basis:8rem;flex-shrink:0;justify-content:flex-end;align-items:center;gap:var(--s-space-8)}.shell-layout__logo.sc-swirl-shell-layout{display:flex;flex-grow:1;justify-content:center;align-items:center}.shell-layout__logo.sc-swirl-shell-layout-s>a{display:flex}.shell-layout__logo.sc-swirl-shell-layout-s>a img,.shell-layout__logo.sc-swirl-shell-layout-s>img{max-height:1.75rem}.shell-layout__header-tool.sc-swirl-shell-layout{position:relative;width:2.25rem;height:2.25rem;padding:var(--s-space-8);flex-shrink:0;border:none;border-radius:var(--s-border-radius-sm);color:var(--swirl-shell-text-color);background-color:var(--s-surface-sunken-default);font:inherit;cursor:pointer}.shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-surface-sunken-hovered)}.shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-surface-sunken-pressed)}.shell-layout__header-tool.sc-swirl-shell-layout:focus{outline:none}.shell-layout__header-tool.sc-swirl-shell-layout:focus-visible{box-shadow:0 0 0 0.125rem var(--s-focus-default)}.shell-layout__header-tool.sc-swirl-shell-layout swirl-badge.sc-swirl-shell-layout{--swirl-badge-border-color:var(--s-surface-sunken-default);position:absolute;top:var(--s-space-4);right:var(--s-space-4);padding-right:var(--s-space-2);transform:translate3d(0.1875rem, 0, 0)}.shell-layout__sidebar-toggle.sc-swirl-shell-layout{display:none}@media (min-width: 992px){.shell-layout__sidebar-toggle.sc-swirl-shell-layout{display:block}}.shell-layout__nav.sc-swirl-shell-layout{position:fixed;z-index:9;top:0;bottom:0;left:0;overflow:auto;width:100%;max-width:18.75rem;color:var(--swirl-shell-text-color);background-color:var(--s-surface-overlay-default);transition:transform 0.2s, box-shadow 0.2s, width 0.2s;transform:translate3d(-100%, 0, 0);grid-area:nav}@media (min-width: 992px){.shell-layout__nav.sc-swirl-shell-layout{position:static;max-width:none;padding-top:0;padding-right:var(--s-space-4);padding-bottom:var(--s-space-8);padding-left:var(--s-space-12);background-color:var(--swirl-shell-background);transform:none;box-shadow:none;inset:auto}}.shell-layout__mobile-header.sc-swirl-shell-layout{display:flex;min-height:3.5rem;margin-bottom:var(--s-space-8);padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);justify-content:space-between;align-items:center;border-bottom:0.0625rem solid var(--s-border-default)}.shell-layout__mobile-header.sc-swirl-shell-layout-s>img{max-height:1.75rem}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout{background-color:var(--s-surface-overlay-default)}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-surface-overlay-hovered)}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-surface-overlay-pressed)}@media (min-width: 992px){.shell-layout__mobile-header.sc-swirl-shell-layout{display:none}}.shell-layout__mobile-header-tools.sc-swirl-shell-layout{display:flex;justify-content:flex-end;align-items:center;gap:var(--s-space-8)}.shell-layout__nav-body.sc-swirl-shell-layout{padding:var(--s-space-8)}.shell-layout__nav-body.sc-swirl-shell-layout-s ul{margin:0;padding:0;list-style:none}.shell-layout__nav-body.sc-swirl-shell-layout-s li{display:flex}@media (min-width: 992px){.shell-layout__nav-body.sc-swirl-shell-layout{padding:0}}.shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{position:fixed;z-index:8;display:none;background-color:rgba(0, 0, 0, 0.25);animation:shell-layout-backdrop-fade-in 0.2s;inset:0}.shell-layout__main.sc-swirl-shell-layout{overflow:hidden;background-color:var(--s-background-default);grid-area:main}@media (min-width: 992px){.shell-layout__main.sc-swirl-shell-layout{width:calc(100% + var(--s-space-8));border:0.0625rem solid var(--s-border-default);border-radius:var(--s-border-radius-sm)}}.shell-layout__sidebar.sc-swirl-shell-layout{position:relative;display:none;min-height:0;grid-area:sidebar}@media (min-width: 992px){.shell-layout__sidebar.sc-swirl-shell-layout{display:block}}.shell-layout__sidebar-body.sc-swirl-shell-layout{z-index:1;display:flex;width:var(--swirl-shell-sidebar-width);height:100%;border-radius:var(--s-border-radius-sm);background-color:var(--s-background-default);flex-direction:column}@media (min-width: 992px){.shell-layout__sidebar-body.sc-swirl-shell-layout{position:absolute;top:0;right:0;bottom:0;transition:transform 0.2s;transform:translate3d(calc(100% + var(--s-space-24)), 0, 0);box-shadow:var(--s-shadow-level-3)}}@media (min-width: 1440px){.shell-layout__sidebar-body.sc-swirl-shell-layout{position:relative;transform:none;box-shadow:none;inset:auto}}.shell-layout__sidebar-app-bar.sc-swirl-shell-layout{flex-grow:0;flex-shrink:0;border-bottom:var(--s-border-width-default) solid var(--s-border-default)}.shell-layout__sidebar-content.sc-swirl-shell-layout{overflow:auto;flex-grow:1}@keyframes shell-layout-backdrop-fade-in{from{opacity:0}to{opacity:1}}@keyframes shell-layout-no-overflow-after-transition{0%{overflow:initial}99%{overflow:initial}100%{overflow:hidden}}';export{h as swirl_shell_layout}
|
|
1
|
+
import{r as l,c as s,h as a,H as e}from"./p-e5528e8a.js";import{c as o}from"./p-b7898321.js";import{c as t}from"./p-878dc806.js";const i="SWIRL_SHELL_NAVIGATION_COLLAPSE_STATE",r="SWIRL_SHELL_SIDEBAR_STATE",h=class{constructor(a){l(this,a),this.sidebarToggleClick=s(this,"sidebarToggleClick",7),this.skipLinkClick=s(this,"skipLinkClick",7),this.onBrowserBackClick=()=>{history.back()},this.onBrowserForwardClick=()=>{history.forward()},this.onNavigationToggleClick=()=>{this.navigationCollapsed=!this.navigationCollapsed},this.onNavigationClick=()=>{this.hideMobileNavigation()},this.brandedHeader=void 0,this.browserBackButtonLabel="Navigate back",this.browserForwardButtonLabel="Navigate forward",this.hideMobileNavigationButtonLabel="Close navigation",this.navigationLabel="Main",this.navigationToggleLabel="Toggle navigation",this.sidebarActive=void 0,this.sidebarToggleBadge=void 0,this.sidebarToggleBadgeAriaLabel=void 0,this.sidebarToggleIcon="notifications",this.sidebarToggleLabel="Toggle sidebar",this.skipLinkLabel="Skip to main content",this.mobileNavigationActive=void 0,this.navigationCollapsed=void 0}componentWillLoad(){const l="true"===localStorage.getItem(r);this.sidebarActive=void 0===this.sidebarActive?l:this.sidebarActive;const s="true"===localStorage.getItem(i);this.navigationCollapsed=s}componentDidLoad(){this.focusTrap=t(this.navElement,{allowOutsideClick:!0,tabbableOptions:{getShadowRoot:l=>l.shadowRoot}})}componentDidRender(){this.focusTrap?.updateContainerElements(this.navElement)}disconnectedCallback(){this.focusTrap?.deactivate()}onWindowKeyDown(l){"Escape"===l.key&&this.mobileNavigationActive&&this.hideMobileNavigation()}watchMobileNavigationState(){this.mobileNavigationActive?setTimeout((()=>{this.focusTrap.activate()}),200):this.focusTrap.deactivate()}watchNavigationCollapsed(){localStorage.setItem(i,String(this.navigationCollapsed))}watchSidebarActive(){localStorage.setItem(r,String(this.sidebarActive))}async showMobileNavigation(){this.mobileNavigationActive=!0}async hideMobileNavigation(){this.mobileNavigationActive=!1}render(){const l=!0!==this.sidebarToggleBadge&&"true"!==this.sidebarToggleBadge,s=o("shell-layout",{"shell-layout--branded-header":this.brandedHeader,"shell-layout--mobile-navigation-active":this.mobileNavigationActive,"shell-layout--navigation-collapsed":this.navigationCollapsed,"shell-layout--sidebar-active":this.sidebarActive});return a(e,null,a("div",{class:s},a("header",{class:"shell-layout__header","data-tauri-drag-region":"true"},a("button",{class:"shell-layout__skip-link",onClick:this.skipLinkClick.emit,type:"button"},this.skipLinkLabel),a("div",{class:"shell-layout__header-left"},a("button",{class:"shell-layout__header-tool",onClick:this.onNavigationToggleClick,type:"button"},a("swirl-icon-dock-left",{size:20}),a("swirl-visually-hidden",null,this.navigationToggleLabel)),a("button",{class:"shell-layout__header-tool",onClick:this.onBrowserBackClick,type:"button"},a("swirl-icon-arrow-back",{size:20}),a("swirl-visually-hidden",null,this.browserBackButtonLabel)),a("button",{class:"shell-layout__header-tool",onClick:this.onBrowserForwardClick,type:"button"},a("swirl-icon-arrow-forward",{size:20}),a("swirl-visually-hidden",null,this.browserForwardButtonLabel)),a("slot",{name:"left-header-tools"})),a("div",{class:"shell-layout__logo"},a("slot",{name:"logo"})),a("div",{class:"shell-layout__header-right"},a("slot",{name:"right-header-tools"}),a("button",{class:"shell-layout__header-tool shell-layout__sidebar-toggle",onClick:this.sidebarToggleClick.emit,type:"button"},a("swirl-icon",{glyph:this.sidebarToggleIcon,size:20}),a("swirl-visually-hidden",null,this.sidebarToggleLabel),this.sidebarToggleBadge&&a("swirl-badge",{"aria-label":this.sidebarToggleBadgeAriaLabel,label:l?String(this.sidebarToggleBadge):this.sidebarToggleBadgeAriaLabel,size:"xs",variant:l?"default":"dot"})),a("slot",{name:"avatar"}))),a("div",{class:"shell-layout__mobile-nav-backdrop",onClick:this.onNavigationClick}),a("nav",{"aria-labelledby":"main-navigation-label",class:"shell-layout__nav",onClick:this.onNavigationClick,ref:l=>this.navElement=l},a("div",{class:"shell-layout__mobile-header"},a("slot",{name:"mobile-logo"}),a("div",{class:"shell-layout__mobile-header-tools"},a("slot",{name:"mobile-header-tools"}),a("button",{class:"shell-layout__header-tool",type:"button"},a("swirl-icon-double-arrow-left",{size:20}),a("swirl-visually-hidden",null,this.hideMobileNavigationButtonLabel)))),a("div",{class:"shell-layout__nav-body"},a("swirl-visually-hidden",null,a("span",{id:"main-navigation-label"},this.navigationLabel)),a("slot",{name:"nav"}))),a("main",{class:"shell-layout__main",id:"main-content"},a("slot",null)),a("aside",{class:"shell-layout__sidebar",inert:!this.sidebarActive||void 0},a("div",{class:"shell-layout__sidebar-body"},a("div",{class:"shell-layout__sidebar-app-bar"},a("slot",{name:"sidebar-app-bar"})),a("div",{class:"shell-layout__sidebar-content"},a("slot",{name:"sidebar"}))))))}static get watchers(){return{mobileNavigationActive:["watchMobileNavigationState"],navigationCollapsed:["watchNavigationCollapsed"],sidebarActive:["watchSidebarActive"]}}};h.style='.sc-swirl-shell-layout-h{--swirl-shell-background:var(--s-surface-sunken-default);--swirl-shell-text-color:var(--s-text-default);--swirl-shell-header-height:3.25rem;--swirl-shell-collapsed-nav-width:4rem;--swirl-shell-extended-nav-width:14rem;--swirl-shell-sidebar-width:21rem;display:flex;width:100%;height:100%}.sc-swirl-shell-layout-h *.sc-swirl-shell-layout{box-sizing:border-box}.shell-layout.sc-swirl-shell-layout{display:grid;overflow:hidden;width:100%;min-height:100%;background-color:var(--swirl-shell-background);transition:grid-template-columns 0.2s;grid-template-columns:0 1fr 0;grid-template-rows:1fr;grid-template-areas:"nav main"}@media (min-width: 992px){.shell-layout.sc-swirl-shell-layout{padding-right:var(--s-space-8);padding-bottom:var(--s-space-8);gap:var(--s-space-8);grid-template-columns:var(--swirl-shell-extended-nav-width) 1fr 0;grid-template-rows:var(--swirl-shell-header-height) 1fr;grid-template-areas:"header header header"\n "nav main sidebar"}}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout{border-bottom:none;color:var(--s-text-on-action-primary);background-color:var(--s-action-primary-default)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout{color:var(--s-text-on-action-primary);background-color:var(--s-action-primary-default)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-action-primary-hovered)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-action-primary-pressed)}.shell-layout--branded-header.sc-swirl-shell-layout .shell-layout__header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout swirl-badge.sc-swirl-shell-layout{--swirl-badge-border-color:var(--s-action-primary-default)}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:hover{width:var(--swirl-shell-extended-nav-width);padding-right:var(--s-space-12)}}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:not(:hover){scrollbar-width:none}.shell-layout--navigation-collapsed.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout:not(:hover)::-webkit-scrollbar{width:0;background:transparent;-webkit-appearance:none}}@media (min-width: 992px){.shell-layout--navigation-collapsed.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-collapsed-nav-width) 1fr 0}}@media (min-width: 1440px){.shell-layout--sidebar-active.shell-layout--navigation-collapsed.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-collapsed-nav-width) 1fr var(\n --swirl-shell-sidebar-width\n )}}@media (min-width: 1440px){.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__main.sc-swirl-shell-layout{width:100%}}.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__sidebar.sc-swirl-shell-layout{overflow:initial}@media (min-width: 992px){.shell-layout--sidebar-active.sc-swirl-shell-layout .shell-layout__sidebar-body.sc-swirl-shell-layout{border:0.0625rem solid var(--s-border-default);transform:translate3d(0, 0, 0)}}@media (min-width: 1440px){.shell-layout--sidebar-active.sc-swirl-shell-layout{grid-template-columns:var(--swirl-shell-extended-nav-width) 1fr var(\n --swirl-shell-sidebar-width\n )}}.sc-swirl-shell-layout:not(.shell-layout--sidebar-active) .shell-layout__sidebar.sc-swirl-shell-layout{animation:shell-layout-no-overflow-after-transition 0.2s;animation-fill-mode:forwards}.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout{transform:translate3d(0, 0, 0);box-shadow:var(--s-shadow-level-3)}@media (min-width: 992px){.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__nav.sc-swirl-shell-layout{transform:none;box-shadow:none}}.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{display:block}@media (min-width: 992px){.shell-layout--mobile-navigation-active.sc-swirl-shell-layout .shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{display:none}}.shell-layout__header.sc-swirl-shell-layout{position:relative;display:none;width:calc(100% + var(--s-space-8));padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);justify-content:space-between;align-items:center;border-bottom:0.0625rem solid var(--s-border-default);color:var(--swirl-shell-text-color);grid-area:header}@media (min-width: 992px){.shell-layout__header.sc-swirl-shell-layout{display:flex}}.shell-layout__skip-link.sc-swirl-shell-layout{position:absolute;z-index:9;top:0;left:0;padding:var(--s-space-4);border:none;color:var(--swirl-shell-text-color);background-color:var(--swirl-shell-background);font:inherit;cursor:pointer}.shell-layout__skip-link.sc-swirl-shell-layout:not(:focus):not(:active){position:absolute;overflow:hidden;width:1px;height:1px;white-space:nowrap;clip:rect(0 0 0 0);clip-path:inset(50%)}.shell-layout__header-left.sc-swirl-shell-layout{display:flex;padding-left:var(--s-space-2);flex-basis:8rem;flex-shrink:0;align-items:center;gap:var(--s-space-8)}.shell-layout__header-right.sc-swirl-shell-layout{--swirl-ghost-button-background-default:var(--s-surface-sunken-default);--swirl-ghost-button-background-hovered:var(--s-surface-sunken-hovered);--swirl-ghost-button-background-pressed:var(--s-surface-sunken-pressed);display:flex;flex-basis:8rem;flex-shrink:0;justify-content:flex-end;align-items:center;gap:var(--s-space-8)}.shell-layout__logo.sc-swirl-shell-layout{display:flex;flex-grow:1;justify-content:center;align-items:center}.shell-layout__logo.sc-swirl-shell-layout-s>a{display:flex}.shell-layout__logo.sc-swirl-shell-layout-s>a img,.shell-layout__logo.sc-swirl-shell-layout-s>img{max-height:1.75rem}.shell-layout__header-tool.sc-swirl-shell-layout{position:relative;width:2.25rem;height:2.25rem;padding:var(--s-space-8);flex-shrink:0;border:none;border-radius:var(--s-border-radius-sm);color:var(--swirl-shell-text-color);background-color:var(--s-surface-sunken-default);font:inherit;cursor:pointer}.shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-surface-sunken-hovered)}.shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-surface-sunken-pressed)}.shell-layout__header-tool.sc-swirl-shell-layout:focus{outline:none}.shell-layout__header-tool.sc-swirl-shell-layout:focus-visible{box-shadow:0 0 0 0.125rem var(--s-focus-default)}.shell-layout__header-tool.sc-swirl-shell-layout swirl-badge.sc-swirl-shell-layout{--swirl-badge-border-color:var(--s-surface-sunken-default);position:absolute;top:var(--s-space-4);right:var(--s-space-4);padding-right:var(--s-space-2);transform:translate3d(0.1875rem, 0, 0)}.shell-layout__sidebar-toggle.sc-swirl-shell-layout{display:none}@media (min-width: 992px){.shell-layout__sidebar-toggle.sc-swirl-shell-layout{display:block}}.shell-layout__nav.sc-swirl-shell-layout{position:fixed;z-index:9;top:0;bottom:0;left:0;overflow:auto;width:100%;max-width:18.75rem;color:var(--swirl-shell-text-color);background-color:var(--s-surface-overlay-default);transition:transform 0.2s, box-shadow 0.2s, width 0.2s;transform:translate3d(-100%, 0, 0);grid-area:nav}@media (min-width: 992px){.shell-layout__nav.sc-swirl-shell-layout{position:static;max-width:none;padding-top:0;padding-right:var(--s-space-4);padding-bottom:var(--s-space-8);padding-left:var(--s-space-12);background-color:var(--swirl-shell-background);transform:none;box-shadow:none;inset:auto}}.shell-layout__mobile-header.sc-swirl-shell-layout{display:flex;min-height:3.5rem;margin-bottom:var(--s-space-8);padding-top:var(--s-space-8);padding-right:var(--s-space-16);padding-bottom:var(--s-space-8);padding-left:var(--s-space-16);justify-content:space-between;align-items:center;border-bottom:0.0625rem solid var(--s-border-default)}.shell-layout__mobile-header.sc-swirl-shell-layout-s>img{max-height:1.75rem}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout{background-color:var(--s-surface-overlay-default)}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:hover{background-color:var(--s-surface-overlay-hovered)}.shell-layout__mobile-header.sc-swirl-shell-layout .shell-layout__header-tool.sc-swirl-shell-layout:active{background-color:var(--s-surface-overlay-pressed)}@media (min-width: 992px){.shell-layout__mobile-header.sc-swirl-shell-layout{display:none}}.shell-layout__mobile-header-tools.sc-swirl-shell-layout{display:flex;justify-content:flex-end;align-items:center;gap:var(--s-space-8)}.shell-layout__nav-body.sc-swirl-shell-layout{padding:var(--s-space-8)}.shell-layout__nav-body.sc-swirl-shell-layout-s ul{margin:0;padding:0;list-style:none}.shell-layout__nav-body.sc-swirl-shell-layout-s li{display:flex}@media (min-width: 992px){.shell-layout__nav-body.sc-swirl-shell-layout{padding:0}}.shell-layout__mobile-nav-backdrop.sc-swirl-shell-layout{position:fixed;z-index:8;display:none;background-color:rgba(0, 0, 0, 0.25);animation:shell-layout-backdrop-fade-in 0.2s;inset:0}.shell-layout__main.sc-swirl-shell-layout{overflow:hidden;background-color:var(--s-background-default);grid-area:main}@media (min-width: 992px){.shell-layout__main.sc-swirl-shell-layout{width:calc(100% + var(--s-space-8));border:0.0625rem solid var(--s-border-default);border-radius:var(--s-border-radius-sm)}}.shell-layout__sidebar.sc-swirl-shell-layout{position:relative;display:none;min-height:0;grid-area:sidebar}@media (min-width: 992px){.shell-layout__sidebar.sc-swirl-shell-layout{display:block}}.shell-layout__sidebar-body.sc-swirl-shell-layout{z-index:1;display:flex;width:var(--swirl-shell-sidebar-width);height:100%;border-radius:var(--s-border-radius-sm);background-color:var(--s-background-default);flex-direction:column}@media (min-width: 992px){.shell-layout__sidebar-body.sc-swirl-shell-layout{position:absolute;top:0;right:0;bottom:0;transition:transform 0.2s;transform:translate3d(calc(100% + var(--s-space-24)), 0, 0);box-shadow:var(--s-shadow-level-3)}}@media (min-width: 1440px){.shell-layout__sidebar-body.sc-swirl-shell-layout{position:relative;transform:none;box-shadow:none;inset:auto}}.shell-layout__sidebar-app-bar.sc-swirl-shell-layout{flex-grow:0;flex-shrink:0;border-bottom:var(--s-border-width-default) solid var(--s-border-default)}.shell-layout__sidebar-content.sc-swirl-shell-layout{overflow:auto;flex-grow:1}@keyframes shell-layout-backdrop-fade-in{from{opacity:0}to{opacity:1}}@keyframes shell-layout-no-overflow-after-transition{0%{overflow:initial}99%{overflow:initial}100%{overflow:hidden}}';export{h as swirl_shell_layout}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as t,c as i,h as s,H as e,g as a}from"./p-e5528e8a.js";import{c as n}from"./p-b7898321.js";import{p as o,i as h,f as d,m as r}from"./p-6339561b.js";import{g as p,i as l}from"./p-ae2bed6f.js";const u="yyyy-MM-dd",c=class{constructor(s){t(this,s),this.invalidInput=i(this,"invalidInput",7),this.valueChange=i(this,"valueChange",7),this.desktopMediaQuery=p(),this.desktopMediaQueryHandler=t=>{this.updateIconSize(t.matches)},this.onChange=t=>{const i=t.target.value;""===i&&(this.value=void 0,this.valueChange.emit(void 0));const s=o(i,this.format,new Date),e=this.format.replace(/\\/g,"\\\\"),a=new RegExp(`^${e.replace(/[ydM]/g,"\\d")}$`);if(!Boolean(i.match(a)))return;if(!h(s))return void this.invalidInput.emit(i);const n=d(s,u);this.value=n,this.valueChange.emit(n)},this.onInput=t=>{this.onChange(t)},this.onClick=t=>{t.preventDefault(),"pick"===this.preferredInputMode&&(this.pickerPopover.open(this.el),l()||this.focus())},this.onMouseDown=()=>{"pick"===this.preferredInputMode&&this.pickerPopover.close()},this.onFocus=t=>{this.handleAutoSelect(t)},this.onBlur=t=>{const i=this.pickerPopover.contains(t.relatedTarget);this.setReadOnly(!i)},this.onPickDate=t=>{const i=d(t.detail,u);this.value=i,this.valueChange.emit(i),this.setReadOnly(!0),this.pickerPopover.close()},this.autoFocus=void 0,this.autoSelect=void 0,this.datePickerDisableDate=()=>!1,this.datePickerLabel="Date picker",this.datePickerTriggerLabel="Open date picker",this.disabled=void 0,this.firstDayOfWeek=0,this.format="yyyy-MM-dd",this.inline=void 0,this.invalid=void 0,this.labels=void 0,this.locale="en-US",this.placeholder="yyyy-mm-dd",this.preferredInputMode="input",this.required=void 0,this.swirlAriaDescribedby=void 0,this.value=void 0,this.iconSize=24,this.readonly=!1}componentWillLoad(){const t=Array.from(document.querySelectorAll("swirl-date-input")).indexOf(this.el);this.id=`swirl-date-input-${t}`,this.setReadOnly(!0)}componentDidLoad(){this.setupMask(),this.updateIconSize(this.desktopMediaQuery.matches),this.desktopMediaQuery.onchange=this.desktopMediaQueryHandler,this.autoFocus&&this.focus()}disconnectedCallback(){this.mask?.destroy(),this.desktopMediaQuery.removeEventListener?.("change",this.desktopMediaQueryHandler)}watchFormat(){this.setupMask()}focus(){setTimeout((()=>{this.inputEl.focus()}))}updateIconSize(t){this.iconSize=t?20:24}handleAutoSelect(t){this.autoSelect&&t.target.select()}setReadOnly(t){this.readonly=!("pick"!==this.preferredInputMode||!l())&&t}setupMask(){this.mask?.destroy(),this.mask=r.create(`#${this.id}`,{mask:this.format.replace(/[ydM]/g,"#")})}render(){const t=!0===this.invalid||!1===this.invalid?String(this.invalid):void 0,i=Boolean(this.value)?o(this.value,u,new Date):void 0,a=h(i)?d(i,this.format):void 0,r=n("date-input",{"date-input--inline":this.inline});return s(e,null,s("div",{class:r},s("input",{"aria-describedby":this.swirlAriaDescribedby,"aria-disabled":this.disabled?"true":void 0,"aria-invalid":t,autoFocus:this.autoFocus,class:"date-input__input",disabled:this.disabled,readonly:this.readonly,id:this.id,inputmode:"numeric",onClick:this.onClick,onMouseDown:this.onMouseDown,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,placeholder:this.placeholder,ref:t=>this.inputEl=t,required:this.required,type:"text",value:a}),s("swirl-popover-trigger",{
|
|
1
|
+
import{r as t,c as i,h as s,H as e,g as a}from"./p-e5528e8a.js";import{c as n}from"./p-b7898321.js";import{p as o,i as h,f as d,m as r}from"./p-6339561b.js";import{g as p,i as l}from"./p-ae2bed6f.js";const u="yyyy-MM-dd",c=class{constructor(s){t(this,s),this.invalidInput=i(this,"invalidInput",7),this.valueChange=i(this,"valueChange",7),this.desktopMediaQuery=p(),this.desktopMediaQueryHandler=t=>{this.updateIconSize(t.matches)},this.onChange=t=>{const i=t.target.value;""===i&&(this.value=void 0,this.valueChange.emit(void 0));const s=o(i,this.format,new Date),e=this.format.replace(/\\/g,"\\\\"),a=new RegExp(`^${e.replace(/[ydM]/g,"\\d")}$`);if(!Boolean(i.match(a)))return;if(!h(s))return void this.invalidInput.emit(i);const n=d(s,u);this.value=n,this.valueChange.emit(n)},this.onInput=t=>{this.onChange(t)},this.onClick=t=>{t.preventDefault(),"pick"===this.preferredInputMode&&(this.pickerPopover.open(this.el),l()||this.focus())},this.onMouseDown=()=>{"pick"===this.preferredInputMode&&this.pickerPopover.close()},this.onFocus=t=>{this.handleAutoSelect(t)},this.onBlur=t=>{const i=this.pickerPopover.contains(t.relatedTarget);this.setReadOnly(!i)},this.onPickDate=t=>{const i=d(t.detail,u);this.value=i,this.valueChange.emit(i),this.setReadOnly(!0),this.pickerPopover.close()},this.autoFocus=void 0,this.autoSelect=void 0,this.datePickerDisableDate=()=>!1,this.datePickerLabel="Date picker",this.datePickerTriggerLabel="Open date picker",this.disabled=void 0,this.firstDayOfWeek=0,this.format="yyyy-MM-dd",this.inline=void 0,this.invalid=void 0,this.labels=void 0,this.locale="en-US",this.placeholder="yyyy-mm-dd",this.preferredInputMode="input",this.required=void 0,this.swirlAriaDescribedby=void 0,this.value=void 0,this.iconSize=24,this.readonly=!1}componentWillLoad(){const t=Array.from(document.querySelectorAll("swirl-date-input")).indexOf(this.el);this.id=`swirl-date-input-${t}`,this.setReadOnly(!0)}componentDidLoad(){this.setupMask(),this.updateIconSize(this.desktopMediaQuery.matches),this.desktopMediaQuery.onchange=this.desktopMediaQueryHandler,this.autoFocus&&this.focus()}disconnectedCallback(){this.mask?.destroy(),this.desktopMediaQuery.removeEventListener?.("change",this.desktopMediaQueryHandler)}watchFormat(){this.setupMask()}focus(){setTimeout((()=>{this.inputEl.focus()}))}updateIconSize(t){this.iconSize=t?20:24}handleAutoSelect(t){this.autoSelect&&t.target.select()}setReadOnly(t){this.readonly=!("pick"!==this.preferredInputMode||!l())&&t}setupMask(){this.mask?.destroy(),this.mask=r.create(`#${this.id}`,{mask:this.format.replace(/[ydM]/g,"#")})}render(){const t=!0===this.invalid||!1===this.invalid?String(this.invalid):void 0,i=Boolean(this.value)?o(this.value,u,new Date):void 0,a=h(i)?d(i,this.format):void 0,r=n("date-input",{"date-input--inline":this.inline});return s(e,null,s("div",{class:r},s("input",{"aria-describedby":this.swirlAriaDescribedby,"aria-disabled":this.disabled?"true":void 0,"aria-invalid":t,autoFocus:this.autoFocus,class:"date-input__input",disabled:this.disabled,readonly:this.readonly,id:this.id,inputmode:"numeric",onClick:this.onClick,onMouseDown:this.onMouseDown,onFocus:this.onFocus,onBlur:this.onBlur,onInput:this.onInput,placeholder:this.placeholder,ref:t=>this.inputEl=t,required:this.required,type:"text",value:a}),s("swirl-popover-trigger",{swirlPopover:`popover-${this.id}`},s("button",{"aria-label":this.datePickerTriggerLabel,class:"date-input__date-picker-button",disabled:this.disabled,type:"button"},s("swirl-icon-today",{size:this.iconSize})))),!this.disabled&&s("swirl-popover",{animation:"scale-in-y",id:`popover-${this.id}`,label:this.datePickerLabel,placement:"bottom-end",ref:t=>this.pickerPopover=t},s("swirl-date-picker",{disableDate:this.datePickerDisableDate,firstDayOfWeek:this.firstDayOfWeek,labels:this.labels,locale:this.locale,onValueChange:this.onPickDate,value:i})))}get el(){return a(this)}static get watchers(){return{format:["watchFormat"]}}};c.style=".sc-swirl-date-input-h{display:flex;width:100%}.sc-swirl-date-input-h *.sc-swirl-date-input{box-sizing:border-box}.date-input.sc-swirl-date-input{position:relative;display:flex;width:100%;align-items:center;color:var(--s-text-default);line-height:var(--s-line-height-sm)}.date-input--inline.sc-swirl-date-input .date-input__date-picker-button.sc-swirl-date-input{top:-0.0625rem}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.date-input--inline.sc-swirl-date-input .date-input__date-picker-button.sc-swirl-date-input{top:0}}.date-input__input.sc-swirl-date-input{display:inline-flex;width:calc(100% - 1.25rem - var(--s-space-8));margin:0;padding:0;border:none;color:var(--s-text-default);background-color:transparent;font:inherit;font-size:var(--s-font-size-base);line-height:var(--s-line-height-base);caret-color:var(--s-border-highlight)}.date-input__input.sc-swirl-date-input:focus{outline:none}.date-input__input.sc-swirl-date-input:disabled{color:var(--s-text-disabled);background-color:transparent}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.date-input__input.sc-swirl-date-input{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.date-input__date-picker-button.sc-swirl-date-input{position:absolute;top:calc(-1 * var(--s-space-12));right:0;display:inline-flex;margin:0;padding:0;border:none;color:var(--s-icon-default);background-color:transparent;cursor:pointer}.date-input__date-picker-button.sc-swirl-date-input:focus:not(:focus-visible){outline:none}.date-input__date-picker-button.sc-swirl-date-input:focus-visible{outline-color:var(--s-focus-default);outline-offset:var(--s-space-2)}.date-input__date-picker-button.sc-swirl-date-input:disabled{color:var(--s-icon-disabled);cursor:default}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.date-input__date-picker-button.sc-swirl-date-input{top:-0.625rem}}";export{c as swirl_date_input}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as s,c as e,h as t,H as i,g as l}from"./p-e5528e8a.js";import{c}from"./p-b7898321.js";import{q as r}from"./p-ae2bed6f.js";const a=class{constructor(t){s(this,t),this.searchChange=e(this,"searchChange",7),this.valueChange=e(this,"valueChange",7),this.select=s=>{this.value=s.detail,this.valueChange.emit(this.value),this.multiSelect||this.popover.close()},this.unselectOption=s=>{this.allowDeselect&&(this.value=this.value.filter((e=>e!==s)),this.valueChange.emit(this.value))},this.onSlotChange=()=>{this.updateOptions()},this.onOpen=s=>{this.placement=s.detail.position?.placement,this.open=!0,this.withSearch&&Boolean(this.searchInput)?this.searchInput.focus():this.optionList.querySelector('[tabIndex="0"]')?.focus()},this.onClose=()=>{Boolean(this.searchInput)&&(this.searchInput.value="",this.searchChange.emit("")),this.open=!1,this.input.focus()},this.onKeyDown=s=>{if("Space"===s.code||"Enter"===s.code){if(s.target===this.searchInput)return;s.preventDefault(),this.popover.open(this.el)}else"ArrowDown"===s.code&&s.target===this.searchInput&&this.optionList.querySelector('[tabIndex="0"]')?.focus()},this.onSearchInput=s=>{this.searchChange.emit(s.target.value)},this.allowDeselect=!0,this.disabled=void 0,this.emptyListLabel="No results found.",this.inline=void 0,this.invalid=void 0,this.label=void 0,this.multiSelect=void 0,this.required=void 0,this.searchInputLabel="Search options",this.searchLoading=void 0,this.searchPlaceholder=void 0,this.selectId=Math.round(1e6*Math.random()).toString(),this.swirlAriaDescribedby=void 0,this.value=void 0,this.withSearch=void 0,this.options=[],this.open=void 0,this.placement=void 0}componentWillLoad(){queueMicrotask((()=>{this.updateOptions(),this.observeSlotChanges()}))}disconnectedCallback(){this.observer?.disconnect()}onWindowFocusIn(s){s.target===this.el.querySelector("input")&&s.stopImmediatePropagation()}observeSlotChanges(){this.observer=new MutationObserver((()=>{this.updateOptions()})),this.observer.observe(this.el,{childList:!0,subtree:!0})}updateOptions(){this.options=r(this.el,"swirl-option-list-item")}render(){const s=Boolean(this.value)?this.value?.map((s=>this.options.find((e=>e.value===s))?.label)).join(", "):"",e=!0===this.invalid||!1===this.invalid?String(this.invalid):void 0,l=this.el.closest("swirl-form-control"),r=l?.inline||"outside"===l?.labelPosition?-12:-16,a=c("select",`select--placement-${this.placement}`,{"select--disabled":this.disabled,"select--inline":this.inline,"select--multi":this.multiSelect,"select--search-loading":this.searchLoading});return t(i,{onKeyDown:this.onKeyDown},t("div",{class:a},t("swirl-popover-trigger",{swirlPopover:this.popover,setAriaAttributes:!1},t("input",{"aria-describedby":this.swirlAriaDescribedby,"aria-disabled":this.disabled?"true":void 0,"aria-invalid":e,class:"select__input",disabled:this.disabled,readOnly:!0,ref:s=>this.input=s,type:"text",value:s})),t("span",{class:"select__multi-select-values"},this.value?.map((s=>this.options.find((e=>e.value===s))))?.map((s=>t("swirl-tag",{"aria-hidden":"true",label:s?.label,onRemove:()=>this.unselectOption(s?.value),removable:!this.disabled&&this.allowDeselect})))),t("span",{class:"select__indicator"},t(this.open?"swirl-icon-expand-less":"swirl-icon-expand-more",null)),t("swirl-popover",{animation:"scale-in-y",class:"select__popover",id:`select-options-${this.selectId}`,label:this.label,offset:[0,r],onPopoverClose:this.onClose,onPopoverOpen:this.onOpen,ref:s=>this.popover=s,useContainerWidth:"swirl-form-control"},this.withSearch&&t("div",{class:"select__search"},t("swirl-icon-search",{class:"select__search-icon",size:20}),t("input",{"aria-label":this.searchInputLabel,class:"select__search-input",onInput:this.onSearchInput,placeholder:this.searchPlaceholder,ref:s=>this.searchInput=s,type:"search"}),this.searchLoading&&t("swirl-spinner",{class:"select__search-spinner",size:"s"})),t("swirl-option-list",{allowDeselect:this.allowDeselect,onValueChange:this.select,multiSelect:this.multiSelect,ref:s=>this.optionList=s,value:this.value},!this.searchLoading&&t("div",{"aria-disabled":"true",class:"select__empty-list-label",role:"option"},t("swirl-text",{color:"subdued",weight:"medium"},this.emptyListLabel)),t("slot",{onSlotchange:this.onSlotChange})))))}get el(){return l(this)}};a.style=".sc-swirl-select-h{display:block;width:100%}.sc-swirl-select-h *.sc-swirl-select{box-sizing:border-box}.select.sc-swirl-select{position:relative;display:flex;width:100%}.select.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:var(--s-space-16)}@media (min-width: 768px){.select.sc-swirl-select .sc-swirl-select::part(popover__scroll-container){padding-top:0}}.select--placement-top-start.sc-swirl-select .sc-swirl-select::part(popover__content){margin-top:-2.25rem}.select--multi.sc-swirl-select .select__input.sc-swirl-select{position:absolute;width:100%;height:100%;pointer-events:none;opacity:0}.select--multi.sc-swirl-select .select__multi-select-values.sc-swirl-select{display:flex}.select--disabled.sc-swirl-select .select__input.sc-swirl-select{color:var(--s-text-disabled)}.select--disabled.sc-swirl-select .select__indicator.sc-swirl-select{color:var(--s-icon-disabled)}.select--inline.sc-swirl-select .select__indicator.sc-swirl-select{transform:translateY(-50%)}.select--search-loading.sc-swirl-select .select__search-input.sc-swirl-select{padding-right:calc(var(--s-space-12) + 1.5rem + var(--s-space-8))}.select__input.sc-swirl-select{display:block;overflow:hidden;width:100%;height:1.25rem;margin:0;padding:0;padding-right:calc(1.5rem + var(--s-space-8));border:none;background-color:transparent;font:inherit;line-height:var(--s-line-height-base);text-align:left;white-space:nowrap;text-overflow:ellipsis;cursor:default}.select__input.sc-swirl-select:focus{outline:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__multi-select-values.sc-swirl-select{display:none;overflow:hidden;width:100%;min-height:1.25rem;padding-right:calc(1.5rem + var(--s-space-8));flex-wrap:wrap;gap:var(--s-space-8)}.select__multi-select-values.sc-swirl-select .sc-swirl-select::part(tag){height:1.25rem;padding:0 var(--s-space-4)}.select__indicator.sc-swirl-select{position:absolute;top:50%;right:0;display:inline-flex;color:var(--s-icon-default);transform:translateY(calc(-50% - var(--s-space-8)))}.select__search.sc-swirl-select{position:relative;display:flex;width:100%;padding:0.0625rem var(--s-space-8);border-bottom:0.0625rem solid var(--s-border-default);background-color:var(--s-surface-overlay-default)}@media (min-width: 768px){.select__search.sc-swirl-select{position:sticky;z-index:1;top:0;padding-top:var(--s-space-8);padding-right:0.0625rem;padding-left:0.0625rem}}.select__search-icon.sc-swirl-select{position:absolute;top:50%;left:calc(var(--s-space-8) * 2);display:inline-flex;color:var(--s-icon-default);transform:translateY(-50%)}@media (min-width: 768px){.select__search-icon.sc-swirl-select{left:var(--s-space-12);margin-top:var(--s-space-4);padding:0.0625rem}}.select__search-input.sc-swirl-select{width:100%;height:2.5rem;padding-right:var(--s-space-12);padding-left:calc(var(--s-space-12) + 1.25rem + var(--s-space-8));align-items:center;border:none;color:var(--s-text-default);background-color:var(--s-surface-overlay-default);font:inherit;line-height:var(--s-line-height-base);caret-color:var(--s-border-highlight)}.select__search-input.sc-swirl-select:focus:not(:focus-visible){outline:none}.select__search-input.sc-swirl-select:focus-visible{outline-color:var(--s-focus-default)}.select__search-input.sc-swirl-select::-moz-placeholder{color:var(--s-text-subdued)}.select__search-input.sc-swirl-select::placeholder{color:var(--s-text-subdued)}.select__search-input.sc-swirl-select::-webkit-search-decoration,.select__search-input.sc-swirl-select::-webkit-search-cancel-button,.select__search-input.sc-swirl-select::-webkit-search-results-button,.select__search-input.sc-swirl-select::-webkit-search-results-decoration{-webkit-appearance:none;appearance:none}@media (min-width: 992px) and (max-width: 1439px) and (hover: hover),(min-width: 1440px){.select__search-input.sc-swirl-select{font-size:var(--s-font-size-sm);line-height:var(--s-line-height-sm)}}.select__search-spinner.sc-swirl-select{position:absolute;top:50%;right:var(--s-space-12);display:inline-flex;transform:translateY(-50%)}@media (min-width: 768px){.select__search-spinner.sc-swirl-select{margin-top:var(--s-space-4)}}.select__empty-list-label.sc-swirl-select{padding:var(--s-space-12) var(--s-space-12) 0}.select__empty-list-label.sc-swirl-select:not(:only-child){display:none}@media (min-width: 768px){.select__empty-list-label.sc-swirl-select{padding:var(--s-space-12) var(--s-space-12) var(--s-space-8)}}";export{a as swirl_select}
|