@brightspot/ui 6.8.0 → 6.8.2
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/CHANGELOG.md +661 -0
- package/README.md +18 -2
- package/dist/storybook/CHANGELOG.md +661 -0
- package/dist/storybook/README.md +195 -0
- package/dist/storybook/assets/{ActionBar.stories-CJBn-mku.js → ActionBar.stories-TlhuCumU.js} +31 -28
- package/dist/storybook/assets/ActionItem-CjtyGLd5.js +16 -0
- package/dist/storybook/assets/{ActionItem.stories-DXzC9C1u.js → ActionItem.stories-BVlNQvfP.js} +2 -2
- package/dist/storybook/assets/AiSparkle.stories-DMzc8JUe.js +73 -0
- package/dist/storybook/assets/Avatar-C6Li1sPI.js +4 -0
- package/dist/storybook/assets/Avatar.stories-COj6XrPn.js +213 -0
- package/dist/storybook/assets/AvatarGroup-DgxRTZBe.js +1 -0
- package/dist/storybook/assets/AvatarGroup.stories-Dh3e7iN2.js +225 -0
- package/dist/storybook/assets/Badge-bWrvpEgX.js +1 -0
- package/dist/storybook/assets/{Badge.stories-DEpoJpUZ.js → Badge.stories-KXpmEXpt.js} +4 -4
- package/dist/storybook/assets/Banner-FSFX1AIb.css +1 -0
- package/dist/storybook/assets/{Banner.stories--jeU6fKq.js → Banner.stories-Cnhm3dXK.js} +14 -14
- package/dist/storybook/assets/Button-DE0s-gat.js +10 -0
- package/dist/storybook/assets/Button.stories-Cwg1YZEb.js +54 -0
- package/dist/storybook/assets/ButtonGroup-CoLI5nGO.js +1 -0
- package/dist/storybook/assets/{ButtonGroup.stories-CerE_0AC.js → ButtonGroup.stories-VhnKPP1n.js} +7 -7
- package/dist/storybook/assets/Card-DyntwdY-.css +1 -0
- package/dist/storybook/assets/{Card.stories-5SxHtU3Y.js → Card.stories-BgpL90zB.js} +60 -29
- package/dist/storybook/assets/{Celebrate.stories-COS789GX.js → Celebrate.stories-D3NJgYcX.js} +5 -5
- package/dist/storybook/assets/Checkbox-BC1T_KxW.js +30 -0
- package/dist/storybook/assets/{Checkbox.stories-DuQu38Gv.js → Checkbox.stories-AFQNz7dQ.js} +10 -10
- package/dist/storybook/assets/CircularProgress-eqVb2jUD.js +42 -0
- package/dist/storybook/assets/{CircularProgress.stories-Lf2Ws46Y.js → CircularProgress.stories-B6t8VhmJ.js} +2 -2
- package/dist/storybook/assets/ClipboardMixin-DcxrOy5B.js +1 -0
- package/dist/storybook/assets/{ClipboardMixin.stories-BT5KfLZ_.js → ClipboardMixin.stories-BqtQMjmS.js} +6 -6
- package/dist/storybook/assets/{Color-6BZIO3FS-BNBxjqrS.js → Color-6BZIO3FS-CDluohEc.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-Ck6bXbd0.js → Colors.stories-CqTniDIa.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-DLELdAMr.js → CombinedEffects.stories-FwW0chy5.js} +2 -2
- package/dist/storybook/assets/{ComponentStatesMixin-B6uJL_2c.js → ComponentStatesMixin-hUqOL2aW.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-fiyrALkY.js → ComponentStatesMixin.stories-CwGoq685.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-2OfBH19_.js → CopyToClipboard.stories-DUGjgtQx.js} +18 -10
- package/dist/storybook/assets/{Debounce.stories-C9qo3lIN.js → Debounce.stories-CrWfXhKS.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-CBVYZYjR.js → DocsRenderer-LL677BLK-9e51z9Xc.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-15ZDMkRz.js → Dropdown.stories-BsBxV0wp.js} +2 -2
- package/dist/storybook/assets/DropdownMenu-B-LvOIGj.js +42 -0
- package/dist/storybook/assets/EmptyState-h0A4Qpiu.css +1 -0
- package/dist/storybook/assets/{EmptyState.stories-Bjb8hzYj.js → EmptyState.stories-CJ1w8Tp2.js} +33 -21
- package/dist/storybook/assets/EscaAvatar.stories-BoLLSj9q.js +140 -0
- package/dist/storybook/assets/{Events.stories-BV0vMF2I.js → Events.stories-C3sTBwPJ.js} +2 -2
- package/dist/storybook/assets/{Heading.stories-CEUJqUbQ.js → Heading.stories-jmXDRBmM.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-CwvtcOM_.js → HueRipple.stories-BPx5aSYd.js} +2 -2
- package/dist/storybook/assets/Icon-CWyJRQf7.js +34409 -0
- package/dist/storybook/assets/{Icon.stories-AB_v-61c.js → Icon.stories-iYBxmv2x.js} +10 -10
- package/dist/storybook/assets/IconButton-Di5Rgs7F.js +12 -0
- package/dist/storybook/assets/{IconButton.stories-BHuHsM3k.js → IconButton.stories-DENLoxVk.js} +2 -2
- package/dist/storybook/assets/LinearProgress-D9ngIVlv.js +25 -0
- package/dist/storybook/assets/{LinearProgress.stories-BNN5SXe3.js → LinearProgress.stories-u90B_VJR.js} +2 -2
- package/dist/storybook/assets/Message-CM3eexdu.css +1 -0
- package/dist/storybook/assets/Message-nFAa55c_.js +28 -0
- package/dist/storybook/assets/{Message.stories-DdLhMXnb.js → Message.stories-B4rpz5rI.js} +2 -2
- package/dist/storybook/assets/OnFindMixin-oL1bvTFj.js +1 -0
- package/dist/storybook/assets/{OnFindMixin.stories-B-5TeBOF.js → OnFindMixin.stories-CdeS5sFA.js} +9 -9
- package/dist/storybook/assets/Pagination-CSWcjuDU.js +88 -0
- package/dist/storybook/assets/{Pagination.stories-C9zsOdb2.js → Pagination.stories-Da2WzJkv.js} +33 -33
- package/dist/storybook/assets/{Popover.stories-BiqIwebU.js → Popover.stories-CVljlVHc.js} +16 -16
- package/dist/storybook/assets/ProgressMixin-CeSrn0_P.js +1 -0
- package/dist/storybook/assets/Radio-rvfGhZwK.js +25 -0
- package/dist/storybook/assets/{Radio.stories-BmrEdPkm.js → Radio.stories-B0wHdJuc.js} +6 -6
- package/dist/storybook/assets/{RadioGroup.stories-ChARVXs3.js → RadioGroup.stories-D8krOSlP.js} +22 -22
- package/dist/storybook/assets/{ReadyMixin-BbuzH3uO.js → ReadyMixin-CvX_eidU.js} +1 -1
- package/dist/storybook/assets/RovingTabindexMixin-9z8lwaM9.js +1 -0
- package/dist/storybook/assets/{RovingTabindexMixin.stories-xm4b394_.js → RovingTabindexMixin.stories-Y8vBWjJp.js} +5 -5
- package/dist/storybook/assets/{Rtc.stories-DdcMaELA.js → Rtc.stories-D3Y-z8y_.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-CI67Ougx.js → ScrollShadow.stories-1KD0lWHX.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-DOqrRkxc.js → Switch.stories-Bsqvm_HE.js} +60 -27
- package/dist/storybook/assets/{Tab.stories-DN8o4cf_.js → Tab.stories-CzcTisNs.js} +7 -7
- package/dist/storybook/assets/Tabs-DdpYNZSW.js +17 -0
- package/dist/storybook/assets/{Tabs.stories-BEowfCcl.js → Tabs.stories-UOS3V0J4.js} +6 -6
- package/dist/storybook/assets/{Throttle.stories-BZ_nsuw1.js → Throttle.stories-C8jgzh6e.js} +1 -1
- package/dist/storybook/assets/Tooltip.stories-B5BoI0cH.js +143 -0
- package/dist/storybook/assets/TooltipMixin-CVKslCDt.js +1 -0
- package/dist/storybook/assets/{Upload.stories-sAEiabwq.js → Upload.stories-BsQDCDqo.js} +102 -52
- package/dist/storybook/assets/UploadItem-CYQqNwUF.js +54 -0
- package/dist/storybook/assets/{UploadItem.stories-C19JMfmB.js → UploadItem.stories-_le7XBTV.js} +4 -4
- package/dist/storybook/assets/{Welcome.stories-C30jg0r1.js → Welcome.stories-rramKkhd.js} +38 -8
- package/dist/storybook/assets/Widget-elBzGg8w.css +1 -0
- package/dist/storybook/assets/Widget.stories-DtbAaklk.js +279 -0
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-PFRy5maL.js → WithTooltip-65CFNBJE-DK6GcBuR.js} +1 -1
- package/dist/storybook/assets/ai-sparkle-BZMJJAxY.js +1 -0
- package/dist/storybook/assets/aria-D5THOgos.js +1 -0
- package/dist/storybook/assets/{blocks-DLjjvsFT.js → blocks-DHnzPh43.js} +5 -5
- package/dist/storybook/assets/esca-glow-BwdhBvIX.js +2 -0
- package/dist/storybook/assets/esca-idle-B-fumiIb.js +1 -0
- package/dist/storybook/assets/esca-search-rwNfo19I.js +1 -0
- package/dist/storybook/assets/esca-task-complete-BAJP2dY2.js +1 -0
- package/dist/storybook/assets/esca-wave-Bjs4CUR7.js +1 -0
- package/dist/storybook/assets/{formatter-EIJCOSYU-D39uscG_.js → formatter-EIJCOSYU-qig-qWlG.js} +1 -1
- package/dist/storybook/assets/i18n-BQ-Uj-0B.js +1 -0
- package/dist/storybook/assets/if-defined-DerKRcyC.js +1 -0
- package/dist/storybook/assets/{iframe-B9buZjP7.js → iframe-DlBK9Drk.js} +24 -24
- package/dist/storybook/assets/{index-BdEHup-4.js → index-CItQyB37.js} +1 -1
- package/dist/storybook/assets/lottie_svg-C3v6xdng.js +2 -0
- package/dist/storybook/assets/{onFind-CGzSFqNN.js → onFind-Ci35eu2y.js} +1 -1
- package/dist/storybook/assets/{onFind.stories-Dq71qO14.js → onFind.stories-BmbwWWo1.js} +1 -1
- package/dist/storybook/assets/{onRemove.stories-B1GqLH_U.js → onRemove.stories-DFWCIgE4.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-BNKxOfLw.js → onVisible.stories-B-onpgE-.js} +1 -1
- package/dist/storybook/assets/property-Bmq4RTSP.js +1 -0
- package/dist/storybook/assets/ref-BhKk4SDh.js +1 -0
- package/dist/storybook/assets/state-DVIUS0Gf.js +1 -0
- package/dist/storybook/assets/{style-map-qCiIYcp5.js → style-map-DE4G47KD.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-CUM-CaRF.js → syntaxhighlighter-ED5Y7EFY-Dfgnal1d.js} +1 -1
- package/dist/storybook/custom-elements.json +11835 -0
- package/dist/storybook/docs/components/ActionBar.md +55 -0
- package/dist/storybook/docs/components/ActionItem.md +50 -0
- package/dist/storybook/docs/components/AiSparkle.md +33 -0
- package/dist/storybook/docs/components/Avatar.md +45 -0
- package/dist/storybook/docs/components/AvatarGroup.md +34 -0
- package/dist/storybook/docs/components/Badge.md +47 -0
- package/dist/storybook/docs/components/Banner.md +35 -0
- package/dist/storybook/docs/components/ButtonGroup.md +65 -0
- package/dist/storybook/docs/components/Card.md +67 -0
- package/dist/storybook/docs/components/Checkbox.md +49 -0
- package/dist/storybook/docs/components/CircularProgress.md +40 -0
- package/dist/storybook/docs/components/CopyToClipboard.md +51 -0
- package/dist/storybook/docs/components/Dropdown.md +74 -0
- package/dist/storybook/docs/components/DropdownItem.md +45 -0
- package/dist/storybook/docs/components/DropdownMenu.md +41 -0
- package/dist/storybook/docs/components/EmptyState.md +62 -0
- package/dist/storybook/docs/components/EscaAvatar.md +40 -0
- package/dist/storybook/docs/components/Icon.md +40 -0
- package/dist/storybook/docs/components/IconButton.md +36 -0
- package/dist/storybook/docs/components/LinearProgress.md +37 -0
- package/dist/storybook/docs/components/Message.md +50 -0
- package/dist/storybook/docs/components/Pagination.md +70 -0
- package/dist/storybook/docs/components/Popover.md +59 -0
- package/dist/storybook/docs/components/README.md +48 -0
- package/dist/storybook/docs/components/Radio.md +55 -0
- package/dist/storybook/docs/components/RadioGroup.md +34 -0
- package/dist/storybook/docs/components/Switch.md +48 -0
- package/dist/storybook/docs/components/Tab.md +40 -0
- package/dist/storybook/docs/components/Tabs.md +49 -0
- package/dist/storybook/docs/components/Upload.md +63 -0
- package/dist/storybook/docs/components/UploadItem.md +30 -0
- package/dist/storybook/docs/components/Widget.md +88 -0
- package/dist/storybook/docs/dari-elements.md +55 -0
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/index.html +29 -2
- package/dist/storybook/llms-full.txt +1721 -0
- package/dist/storybook/llms.txt +65 -0
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/robots.txt +7 -0
- package/dist/storybook/sb-addons/storybook-3/manager-bundle.js +1 -1
- package/dist/storybook/sitemap.xml +90 -0
- package/docs/components/ActionBar.md +41 -64
- package/docs/components/ActionItem.md +50 -96
- package/docs/components/AiSparkle.md +23 -60
- package/docs/components/Avatar.md +45 -88
- package/docs/components/AvatarGroup.md +24 -44
- package/docs/components/Badge.md +34 -62
- package/docs/components/Banner.md +25 -39
- package/docs/components/ButtonGroup.md +65 -99
- package/docs/components/Card.md +67 -83
- package/docs/components/Checkbox.md +49 -91
- package/docs/components/CircularProgress.md +40 -84
- package/docs/components/CopyToClipboard.md +35 -40
- package/docs/components/Dropdown.md +74 -120
- package/docs/components/DropdownItem.md +45 -81
- package/docs/components/DropdownMenu.md +30 -70
- package/docs/components/EmptyState.md +45 -62
- package/docs/components/EscaAvatar.md +30 -61
- package/docs/components/Icon.md +29 -62
- package/docs/components/IconButton.md +36 -83
- package/docs/components/LinearProgress.md +28 -70
- package/docs/components/Message.md +38 -63
- package/docs/components/Pagination.md +70 -100
- package/docs/components/Popover.md +46 -79
- package/docs/components/README.md +34 -40
- package/docs/components/Radio.md +55 -105
- package/docs/components/RadioGroup.md +26 -55
- package/docs/components/Switch.md +48 -84
- package/docs/components/Tab.md +30 -70
- package/docs/components/Tabs.md +49 -86
- package/docs/components/Upload.md +63 -112
- package/docs/components/UploadItem.md +22 -53
- package/docs/components/Widget.md +66 -67
- package/llms.txt +63 -0
- package/package.json +9 -6
- package/dist/storybook/assets/AiSparkle.stories-BfjT5jrJ.js +0 -72
- package/dist/storybook/assets/Avatar.stories-D8lnIZaY.js +0 -213
- package/dist/storybook/assets/AvatarGroup.stories-Cz9oVah0.js +0 -225
- package/dist/storybook/assets/Button-2ucj5lUP.js +0 -10
- package/dist/storybook/assets/Button.stories-ndl1RJd7.js +0 -54
- package/dist/storybook/assets/EscaAvatar.stories-Rc2MSzCX.js +0 -139
- package/dist/storybook/assets/LucideDynamicLoader-BuoNL33C.js +0 -1
- package/dist/storybook/assets/Tooltip.stories-3bar43ZN.js +0 -143
- package/dist/storybook/assets/Widget.stories-9-1XpZNl.js +0 -233
- package/dist/storybook/assets/if-defined-BwWBCoAU.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as
|
|
1
|
+
import{i as x,g as E,x as h}from"./iframe-DlBK9Drk.js";import{o as T}from"./if-defined-DerKRcyC.js";import{o as k}from"./style-map-DE4G47KD.js";import{n as p}from"./property-Bmq4RTSP.js";import{E as C,R as L}from"./ReadyMixin-CvX_eidU.js";import"./preload-helper-PPVm8Dsz.js";var S=Object.defineProperty,d=(t,e,i,n)=>{for(var o=void 0,r=t.length-1,s;r>=0;r--)(s=t[r])&&(o=s(e,i,o)||o);return o&&S(e,i,o),o};const A={top:"btu-popover-top",bottom:"btu-popover-bottom",left:"btu-popover-left",right:"btu-popover-right"},P={up:"btu-popover-tail-up",down:"btu-popover-tail-down",left:"btu-popover-tail-left",right:"btu-popover-tail-right"},D={top:"down",bottom:"up",left:"right",right:"left"},_={sm:"btu-popover-offset-sm",md:"btu-popover-offset-md",lg:"btu-popover-offset-lg",xl:"btu-popover-offset-xl"};class l extends C(L(x)){constructor(){super(...arguments),this.position="bottom",this.trigger="click",this.delay=300,this.offset=null,this.noArrow=!1,this.inverted=!1,this.open=!1,this.panelLabel="",this._panelEl=null,this._panelId=`btu-popover-${crypto.randomUUID()}`,this._anchorName=`--btu-popover-trigger-${crypto.randomUUID()}`,this._tailDirection=null,this._tailSyncQueued=!1,this._showTimer=null,this._hideTimer=null,this._isVisible=!1,this.initialClasses=[],this._initialClassesCaptured=!1,this._onTriggerMouseEnter=this._handleTriggerMouseEnter.bind(this),this._onTriggerMouseLeave=this._handleTriggerMouseLeave.bind(this),this._onTriggerFocusIn=this._handleTriggerFocusIn.bind(this),this._onTriggerFocusOut=this._handleTriggerFocusOut.bind(this),this._onPanelMouseEnter=this._handlePanelMouseEnter.bind(this),this._onPanelMouseLeave=this._handlePanelMouseLeave.bind(this),this._onNativeToggle=this._handleNativeToggle.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),this._onViewportChange=this._handleViewportChange.bind(this)}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this._initialClassesCaptured||(this.className&&(this.initialClasses=this.className.split(" ").filter(e=>e.trim())),this._initialClassesCaptured=!0)}disconnectedCallback(){if(this._clearTimers(),this._unbindTriggerListeners(),this._unbindPanelListeners(),this._unbindViewportListeners(),document.removeEventListener("keydown",this._onKeyDown),this._panelEl){try{this._panelEl.hidePopover()}catch(e){e instanceof DOMException&&e.name==="InvalidStateError"||console.warn("[btu-popover] Failed to hide popover during disconnect:",e)}this._panelEl.removeEventListener("toggle",this._onNativeToggle),this._panelEl.remove(),this._panelEl=null}this._isVisible=!1,super.disconnectedCallback()}willUpdate(){const e=[...this.initialClasses];this.className=e.filter(Boolean).join(" ")}firstUpdated(){this._setupPanel(),this._bindTriggerListeners(),this.open&&this._show()}updated(e){super.updated(e),e.has("trigger")&&e.get("trigger")!==void 0&&(this._unbindTriggerListeners(),this._bindTriggerListeners(),this._panelEl&&(this._isVisible&&this._hide(),this._panelEl.setAttribute("popover",this.trigger==="click"?"auto":"manual"))),(e.has("position")||e.has("noArrow")||e.has("offset")||e.has("inverted"))&&(e.has("position")&&(this._tailDirection=null),this._panelEl&&(this._panelEl.className=this._buildPanelClasses(),e.has("position")&&requestAnimationFrame(()=>this._syncTailDirection()))),e.has("panelLabel")&&this._panelEl&&(this.panelLabel?this._panelEl.setAttribute("aria-label",this.panelLabel):this._panelEl.removeAttribute("aria-label")),e.has("open")&&e.get("open")!==void 0&&(this.open&&!this._isVisible?this._show():!this.open&&this._isVisible&&this._hide())}_setupPanel(){const e=this.querySelector('[slot="trigger"]'),i=this.querySelector('[slot="content"]');if(!e){console.warn('[btu-popover] Missing required slot="trigger" element.');return}e.style.setProperty("anchor-name",this._anchorName),this._panelEl=document.createElement("div"),this._panelEl.id=this._panelId,this._panelEl.className=this._buildPanelClasses(),this._panelEl.setAttribute("role","dialog"),this.panelLabel&&this._panelEl.setAttribute("aria-label",this.panelLabel),this._panelEl.setAttribute("data-popover-internal",""),this._panelEl.style.setProperty("position-anchor",this._anchorName),this._panelEl.setAttribute("popover",this.trigger==="click"?"auto":"manual"),this._panelEl.addEventListener("toggle",this._onNativeToggle),i&&(i.removeAttribute("slot"),i.style.display="",this._panelEl.appendChild(i)),this.appendChild(this._panelEl),e.setAttribute("aria-expanded","false"),e.setAttribute("aria-controls",this._panelId),this._bindPanelListeners()}_buildPanelClasses(){const e=["btu-popover",A[this.position]];return this.offset&&_[this.offset]&&e.push(_[this.offset]),this.noArrow&&e.push("btu-popover-no-arrow"),this.inverted&&e.push("btu-popover-inverted"),this._tailDirection&&e.push(P[this._tailDirection]),e.join(" ")}_syncTailDirection(){const e=this._panelEl,i=this._getTriggerEl();if(!e||!i||!this._isVisible)return;const n=e.getBoundingClientRect(),o=i.getBoundingClientRect();if(n.width===0||o.width===0)return;const s=this.position==="top"||this.position==="bottom"?n.top+n.height/2>=o.top+o.height/2?"up":"down":n.left+n.width/2>=o.left+o.width/2?"left":"right",a=s===D[this.position]?null:s;a!==this._tailDirection&&(this._tailDirection=a,e.className=this._buildPanelClasses())}_handleViewportChange(){this._tailSyncQueued||(this._tailSyncQueued=!0,requestAnimationFrame(()=>{this._tailSyncQueued=!1,this._syncTailDirection()}))}_bindViewportListeners(){window.addEventListener("scroll",this._onViewportChange,!0),window.addEventListener("resize",this._onViewportChange)}_unbindViewportListeners(){window.removeEventListener("scroll",this._onViewportChange,!0),window.removeEventListener("resize",this._onViewportChange)}_getTriggerEl(){return this.querySelector('[slot="trigger"]')}_bindTriggerListeners(){const e=this._getTriggerEl();e&&(this.trigger==="click"&&e.setAttribute("popovertarget",this._panelId),this.trigger==="hover"&&(e.addEventListener("mouseenter",this._onTriggerMouseEnter),e.addEventListener("mouseleave",this._onTriggerMouseLeave)),this.trigger==="focus"&&(e.addEventListener("focusin",this._onTriggerFocusIn),e.addEventListener("focusout",this._onTriggerFocusOut)),this.trigger!=="click"&&document.addEventListener("keydown",this._onKeyDown))}_unbindTriggerListeners(){const e=this._getTriggerEl();e&&(e.removeAttribute("popovertarget"),e.removeEventListener("mouseenter",this._onTriggerMouseEnter),e.removeEventListener("mouseleave",this._onTriggerMouseLeave),e.removeEventListener("focusin",this._onTriggerFocusIn),e.removeEventListener("focusout",this._onTriggerFocusOut),document.removeEventListener("keydown",this._onKeyDown))}_bindPanelListeners(){this._panelEl&&(this._panelEl.addEventListener("mouseenter",this._onPanelMouseEnter),this._panelEl.addEventListener("mouseleave",this._onPanelMouseLeave))}_unbindPanelListeners(){this._panelEl&&(this._panelEl.removeEventListener("mouseenter",this._onPanelMouseEnter),this._panelEl.removeEventListener("mouseleave",this._onPanelMouseLeave))}_show(){if(this._clearHideTimer(),!(this._isVisible||!this._panelEl))try{this._panelEl.showPopover()}catch(e){e instanceof DOMException&&e.name==="InvalidStateError"||console.warn("[btu-popover] Failed to show popover:",e)}}_hide(){if(this._clearTimers(),!(!this._isVisible||!this._panelEl))try{this._panelEl.hidePopover()}catch(e){e instanceof DOMException&&e.name==="InvalidStateError"||console.warn("[btu-popover] Failed to hide popover:",e)}}_handleNativeToggle(e){const{newState:i}=e;if(i==="open"){this._isVisible=!0,this.open=!0;const n=this._getTriggerEl();n&&n.setAttribute("aria-expanded","true"),requestAnimationFrame(()=>this._syncTailDirection()),this._bindViewportListeners(),this.emit("btu-popover-show")}else{this._isVisible=!1,this.open=!1,this._unbindViewportListeners();const n=this._getTriggerEl();n&&(n.setAttribute("aria-expanded","false"),document.activeElement===document.body&&n.focus()),this.emit("btu-popover-hide")}}_handleKeyDown(e){e.key==="Escape"&&(this._clearTimers(),this._hide())}_clearShowTimer(){this._showTimer!==null&&(clearTimeout(this._showTimer),this._showTimer=null)}_clearHideTimer(){this._hideTimer!==null&&(clearTimeout(this._hideTimer),this._hideTimer=null)}_clearTimers(){this._clearShowTimer(),this._clearHideTimer()}_handleTriggerMouseEnter(){this._clearTimers(),this._showTimer=setTimeout(()=>this._show(),this.delay)}_handleTriggerMouseLeave(){this._clearTimers(),this._hideTimer=setTimeout(()=>this._hide(),100)}_handleTriggerFocusIn(){this._clearTimers(),this._show()}_handleTriggerFocusOut(){this._clearTimers(),this._hide()}_handlePanelMouseEnter(){this.trigger==="hover"&&this._clearTimers()}_handlePanelMouseLeave(){this.trigger==="hover"&&(this._clearTimers(),this._hideTimer=setTimeout(()=>this._hide(),100))}}d([p({attribute:"position"})],l.prototype,"position");d([p({attribute:"trigger"})],l.prototype,"trigger");d([p({attribute:"delay",type:Number})],l.prototype,"delay");d([p({attribute:"offset"})],l.prototype,"offset");d([p({attribute:"no-arrow",type:Boolean})],l.prototype,"noArrow");d([p({attribute:"inverted",type:Boolean})],l.prototype,"inverted");d([p({attribute:"open",type:Boolean,reflect:!0})],l.prototype,"open");d([p({attribute:"panel-label"})],l.prototype,"panelLabel");customElements.get("btu-popover")||customElements.define("btu-popover",l);const{expect:u,waitFor:w}=__STORYBOOK_MODULE_TEST__,{events:F,args:B,argTypes:c}=E("btu-popover"),z={title:"Components/Popover",component:"btu-popover",tags:["autodocs"],parameters:{docs:{subtitle:"Rich interactive content anchored to a trigger element",description:{component:`
|
|
2
2
|
\`btu-popover\` displays rich interactive content anchored to a trigger element using CSS anchor positioning and the native Popover API.
|
|
3
3
|
|
|
4
4
|
<h3>When to use:</h3>
|
|
@@ -24,14 +24,14 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
24
24
|
<li>Focus restored to trigger on close</li>
|
|
25
25
|
<li>Add <code>autofocus</code> to an element inside <code>slot="content"</code> for auto-focus on open</li>
|
|
26
26
|
</ul>
|
|
27
|
-
`}},actions:{handles:
|
|
27
|
+
`}},actions:{handles:F},controls:{expanded:!0}},args:{...B,position:"bottom",trigger:"click",delay:300,open:!1,inverted:!1},argTypes:{...c,position:{...c.position,control:{type:"select"},options:["top","bottom","left","right"]},trigger:{...c.trigger,control:{type:"select"},options:["click","hover","focus"]},delay:{...c.delay,control:{type:"number"},description:"Show delay in ms (hover trigger only)"},offset:{...c.offset,control:{type:"select"},options:["sm","md","lg","xl"],description:"Gap between trigger and popover (sm=4px, md=8px, lg=12px, xl=16px)"},open:{...c.open,control:{type:"boolean"},description:"Programmatic open/close (reflected)"},inverted:{...c.inverted,control:{type:"boolean"},description:"Invert the panel surface (dark on light pages, light on dark pages)"},customBg:{name:"--popover-color-background",description:"Background color",control:{type:"color"},table:{category:"css properties",defaultValue:{summary:"white"}}},customTitleColor:{name:"--popover-color-title",description:"Title text color",control:{type:"color"},table:{category:"css properties",defaultValue:{summary:"oklch(var(--btu-theme-gray-900))"}}},customContentColor:{name:"--popover-color-content",description:"Content text color",control:{type:"color"},table:{category:"css properties",defaultValue:{summary:"oklch(var(--btu-theme-gray-900))"}}},customRadius:{name:"--popover-border-radius",description:"Border radius",control:{type:"select"},options:["0px","0.125rem","0.25rem","0.375rem","0.5rem","0.75rem","1rem","1.5rem","9999px"],labels:{"0px":"none (0px)","0.125rem":"sm (0.125rem)","0.25rem":"DEFAULT (0.25rem)","0.375rem":"md (0.375rem)","0.5rem":"lg (0.5rem)","0.75rem":"xl (0.75rem)","1rem":"2xl (1rem)","1.5rem":"3xl (1.5rem)","9999px":"full (9999px)"},table:{category:"css properties",defaultValue:{summary:"0.5rem (lg)"}}}},render:t=>{const e={};return t.customBg&&(e["--popover-color-background"]=t.customBg),t.customTitleColor&&(e["--popover-color-title"]=t.customTitleColor),t.customContentColor&&(e["--popover-color-content"]=t.customContentColor),t.customRadius&&(e["--popover-border-radius"]=t.customRadius),h`
|
|
28
28
|
<div style="display: flex; justify-content: center; padding: 6rem 2rem;">
|
|
29
|
-
<div style=${
|
|
29
|
+
<div style=${k(e)}>
|
|
30
30
|
<btu-popover
|
|
31
31
|
position="${t.position}"
|
|
32
32
|
trigger="${t.trigger}"
|
|
33
33
|
delay="${t.delay}"
|
|
34
|
-
offset="${
|
|
34
|
+
offset="${T(t.offset)}"
|
|
35
35
|
?no-arrow="${t["no-arrow"]}"
|
|
36
36
|
?open="${t.open}"
|
|
37
37
|
?inverted="${t.inverted}"
|
|
@@ -49,7 +49,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
49
49
|
</btu-popover>
|
|
50
50
|
</div>
|
|
51
51
|
</div>
|
|
52
|
-
`}},
|
|
52
|
+
`}},b={args:{"no-arrow":!1,offset:void 0}},m={render:()=>h`
|
|
53
53
|
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
54
54
|
<btu-popover position="top">
|
|
55
55
|
<button class="btu-button btu-button-primary btu-button-sm" slot="trigger">Top</button>
|
|
@@ -68,7 +68,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
68
68
|
<div slot="content">Popover positioned right of the trigger</div>
|
|
69
69
|
</btu-popover>
|
|
70
70
|
</div>
|
|
71
|
-
`,parameters:{docs:{description:{story:"Popovers support four positions: `top`, `bottom`, `left`, and `right`. Each auto-flips if constrained by the viewport."}}}},
|
|
71
|
+
`,parameters:{docs:{description:{story:"Popovers support four positions: `top`, `bottom`, `left`, and `right`. Each auto-flips if constrained by the viewport."}}}},v={render:()=>h`
|
|
72
72
|
<style>
|
|
73
73
|
.popover-custom-content {
|
|
74
74
|
display: flex;
|
|
@@ -160,7 +160,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
160
160
|
</div>
|
|
161
161
|
</btu-popover>
|
|
162
162
|
</div>
|
|
163
|
-
`,parameters:{docs:{description:{story:"Two examples of rich popover content: a confirmation dialog with action buttons (click trigger), and a chart legend with colored series data (hover trigger)."}}}},
|
|
163
|
+
`,parameters:{docs:{description:{story:"Two examples of rich popover content: a confirmation dialog with action buttons (click trigger), and a chart legend with colored series data (hover trigger)."}}}},f={render:()=>h`
|
|
164
164
|
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
165
165
|
<btu-popover position="bottom">
|
|
166
166
|
<button class="btu-button btu-button-gray btu-button-sm" slot="trigger">Default surface</button>
|
|
@@ -177,7 +177,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
177
177
|
</div>
|
|
178
178
|
</btu-popover>
|
|
179
179
|
</div>
|
|
180
|
-
`,parameters:{docs:{description:{story:"The `inverted` attribute flips the panel surface to the inverse of the page — a dark panel on light pages and a light panel on dark pages — using the mode-flipping black/white tokens. It's opt-in because the panel holds arbitrary rich content that may assume a light surface."}}}},
|
|
180
|
+
`,parameters:{docs:{description:{story:"The `inverted` attribute flips the panel surface to the inverse of the page — a dark panel on light pages and a light panel on dark pages — using the mode-flipping black/white tokens. It's opt-in because the panel holds arbitrary rich content that may assume a light surface."}}}},y={render:()=>h`
|
|
181
181
|
<style>
|
|
182
182
|
.custom-popover-trigger {
|
|
183
183
|
display: inline-flex;
|
|
@@ -219,7 +219,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
219
219
|
</btu-popover>
|
|
220
220
|
</div>
|
|
221
221
|
</div>
|
|
222
|
-
`,parameters:{docs:{description:{story:"Demonstrates full customization of all CSS custom properties. Set these on a parent element or directly on the component:\n\n- `--popover-color-background` — Background color\n- `--popover-color-title` — Title text color\n- `--popover-color-content` — Content text color\n- `--popover-border-radius` — Border radius"}}}},
|
|
222
|
+
`,parameters:{docs:{description:{story:"Demonstrates full customization of all CSS custom properties. Set these on a parent element or directly on the component:\n\n- `--popover-color-background` — Background color\n- `--popover-color-title` — Title text color\n- `--popover-color-content` — Content text color\n- `--popover-border-radius` — Border radius"}}}},g={tags:["!autodocs","!dev"],render:()=>h`
|
|
223
223
|
<div style="height: 100vh;">
|
|
224
224
|
<btu-popover id="tail-anchored" position="bottom" trigger="focus" style="position: fixed; top: 24px; left: 24px;">
|
|
225
225
|
<button class="btu-button btu-button-primary btu-button-sm" slot="trigger">Anchored</button>
|
|
@@ -235,12 +235,12 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
235
235
|
<div slot="content">No room below</div>
|
|
236
236
|
</btu-popover>
|
|
237
237
|
</div>
|
|
238
|
-
`,play:async()=>{const t=async
|
|
238
|
+
`,play:async()=>{const t=async o=>{const r=document.getElementById(o);r.open=!0;const s=await w(()=>{const a=r.querySelector(".btu-popover");if(!a?.matches(":popover-open"))throw new Error(`${o} did not open`);return a});return{host:r,panel:s}},e=(o,r)=>{const s=o.getBoundingClientRect(),a=r.querySelector('[slot="trigger"]').getBoundingClientRect();return s.top+s.height/2>=a.top+a.height/2?"below":"above"},i=await t("tail-anchored"),n=await t("tail-flipped");u(e(i.panel,i.host)).toBe("below"),u(e(n.panel,n.host)).toBe("above"),await w(()=>u(n.panel.className).toContain("btu-popover-tail-down")),u(i.panel.className).not.toContain("btu-popover-tail-");for(const{panel:o}of[i,n]){u(getComputedStyle(o,"::after").content).toBe("none");const r=parseFloat(getComputedStyle(o).getPropertyValue("--popover-offset")),s=parseFloat(getComputedStyle(o).borderTopWidth);u(parseFloat(getComputedStyle(o,"::before").height)).toBeCloseTo(r+s,1)}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
|
|
239
239
|
args: {
|
|
240
240
|
'no-arrow': false,
|
|
241
241
|
offset: undefined
|
|
242
242
|
}
|
|
243
|
-
}`,...
|
|
243
|
+
}`,...b.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
244
244
|
render: () => html\`
|
|
245
245
|
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
246
246
|
<btu-popover position="top">
|
|
@@ -268,7 +268,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
}
|
|
271
|
-
}`,...
|
|
271
|
+
}`,...m.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
|
|
272
272
|
render: () => html\`
|
|
273
273
|
<style>
|
|
274
274
|
.popover-custom-content {
|
|
@@ -369,7 +369,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
369
369
|
}
|
|
370
370
|
}
|
|
371
371
|
}
|
|
372
|
-
}`,...
|
|
372
|
+
}`,...v.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
|
|
373
373
|
render: () => html\`
|
|
374
374
|
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
375
375
|
<btu-popover position="bottom">
|
|
@@ -395,7 +395,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
397
|
}
|
|
398
|
-
}`,...
|
|
398
|
+
}`,...f.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
399
399
|
render: () => html\`
|
|
400
400
|
<style>
|
|
401
401
|
.custom-popover-trigger {
|
|
@@ -451,7 +451,7 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
451
451
|
}
|
|
452
452
|
}
|
|
453
453
|
}
|
|
454
|
-
}`,...
|
|
454
|
+
}`,...y.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
|
|
455
455
|
tags: ['!autodocs', '!dev'],
|
|
456
456
|
render: () => html\`
|
|
457
457
|
<div style="height: 100vh;">
|
|
@@ -518,4 +518,4 @@ import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as y}from"./if-defined-
|
|
|
518
518
|
expect(parseFloat(getComputedStyle(panel, '::before').height)).toBeCloseTo(offset + border, 1);
|
|
519
519
|
}
|
|
520
520
|
}
|
|
521
|
-
}`,...
|
|
521
|
+
}`,...g.parameters?.docs?.source},description:{story:"Regression coverage for the tail. Hidden from the sidebar and the docs page;\nit exists to be run by `vitest --project=storybook`.",...g.parameters?.docs?.description}}};const j=["Default","Positions","RichContent","Inverted","AdvancedUsage","TailRegression"];export{y as AdvancedUsage,b as Default,f as Inverted,m as Positions,v as RichContent,g as TailRegression,j as __namedExportsOrder,z as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as r}from"./property-Bmq4RTSP.js";import{a as p}from"./aria-D5THOgos.js";var h=Object.defineProperty,m=Object.getOwnPropertyDescriptor,s=(n,t,o,e)=>{for(var i=e>1?void 0:e?m(t,o):t,a=n.length-1,l;a>=0;a--)(l=n[a])&&(i=(e?l(t,o,i):l(i))||i);return e&&i&&h(t,o,i),i};const _=n=>{class t extends n{constructor(){super(...arguments),this.color="primary",this._progress=0,this.initialAnimation=!0,this.ariaLabel=null,this.ariaLabelledBy=null,this.ariaValueText=null,this._isAnimationInitialized=!1,this._hasCompletedAt100=!1}get progress(){return this._progress}set progress(e){const i=isNaN(e)?0:e;this._progress=Math.min(Math.max(i,0),100)}_getProgressColorValue(){return this.color==="white"||this.color==="black"?`var(--progress-color, var(--btu-theme-${this.color}))`:`var(--progress-color, oklch(var(--btu-theme-${this.color}-600)))`}_getAnimatedProgress(){return this.initialAnimation&&!this._isAnimationInitialized?0:this._progress}_setupInitialAnimation(){if(!this.initialAnimation||this._isAnimationInitialized){this._isAnimationInitialized=!0;return}this._cleanupInitialAnimation(),this._intersectionObserver=new IntersectionObserver(e=>{e.forEach(i=>{i.isIntersecting&&!this._isAnimationInitialized&&(requestAnimationFrame(()=>{this._isAnimationInitialized=!0,this.requestUpdate()}),this._intersectionObserver?.disconnect())})},{threshold:.1}),this._intersectionObserver.observe(this)}_cleanupInitialAnimation(){this._intersectionObserver?.disconnect()}get _hostTag(){return this.tagName.toLowerCase()}firstUpdated(e){super.firstUpdated(e),this.emit(`${this._hostTag}-ready`)}_trackCompletion(){this._progress===100&&!this._hasCompletedAt100?(this._hasCompletedAt100=!0,this.emit(`${this._hostTag}-complete`),this.completionAnnouncement&&p(this.completionAnnouncement)):this._progress<100&&this._hasCompletedAt100&&(this._hasCompletedAt100=!1)}}return s([r({type:String})],t.prototype,"color",2),s([r({type:Number})],t.prototype,"thickness",2),s([r({type:Number})],t.prototype,"progress",1),s([r({type:String})],t.prototype,"label",2),s([r({type:Boolean,attribute:"initial-animation"})],t.prototype,"initialAnimation",2),s([r({type:String,attribute:"aria-label"})],t.prototype,"ariaLabel",2),s([r({type:String,attribute:"aria-labelledby"})],t.prototype,"ariaLabelledBy",2),s([r({type:String,attribute:"aria-valuetext"})],t.prototype,"ariaValueText",2),s([r({type:String,attribute:"completion-announcement"})],t.prototype,"completionAnnouncement",2),t};export{_ as P};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{e as f,ae as _,af as d,al as m,ag as u,E as c,am as y,i as v,x as l}from"./iframe-DlBK9Drk.js";import{n as r}from"./property-Bmq4RTSP.js";import{o as h}from"./if-defined-DerKRcyC.js";import{E as g,R as k}from"./ReadyMixin-CvX_eidU.js";import{T as C}from"./TooltipMixin-CVKslCDt.js";const I=f(class extends _{constructor(t){if(super(t),t.type!==d.PROPERTY&&t.type!==d.ATTRIBUTE&&t.type!==d.BOOLEAN_ATTRIBUTE)throw Error("The `live` directive is not allowed on child or event bindings");if(!m(t))throw Error("`live` bindings can only contain a single expression")}render(t){return t}update(t,[e]){if(e===u||e===c)return e;const i=t.element,o=t.name;if(t.type===d.PROPERTY){if(e===i[o])return u}else if(t.type===d.BOOLEAN_ATTRIBUTE){if(!!e===i.hasAttribute(o))return u}else if(t.type===d.ATTRIBUTE&&i.getAttribute(o)===e+"")return u;return y(t),e}});var E=Object.defineProperty,a=(t,e,i,o)=>{for(var n=void 0,p=t.length-1,b;p>=0;p--)(b=t[p])&&(n=b(e,i,n)||n);return n&&E(e,i,n),n};class s extends C(g(k(v))){constructor(){super(...arguments),this.size="sm",this.checked=!1,this.disabled=!1,this.invalid=!1,this._tabindex=0,this._groupDisabled=!1,this._groupRequired=!1,this._userInitiated=!1,this._initialClasses=[],this._initialClassesCaptured=!1,this._descId=`radio-desc-${crypto.randomUUID()}`,this._errorId=`radio-error-${crypto.randomUUID()}`,this._handleClick=e=>{if(this._isDisabled||e.target.closest(".btu-radio-input"))return;const i=this.renderRoot.querySelector(".btu-radio-input");i?.focus({focusVisible:!1}),i?.click()}}connectedCallback(){super.connectedCallback(),this._initialClassesCaptured||(this.className&&(this._initialClasses=this.className.split(" ").filter(e=>e.trim())),this._initialClassesCaptured=!0),this.addEventListener("click",this._handleClick)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("click",this._handleClick)}createRenderRoot(){return this}willUpdate(e){super.willUpdate(e);const i=[...this._initialClasses,"btu-radio",this.size==="md"&&"btu-radio-md",(this.invalid||this.error)&&"btu-radio-invalid"];this.className=i.filter(Boolean).join(" ")}firstUpdated(e){super.firstUpdated(e),this.emit("btu-radio-ready")}updated(e){super.updated(e),this._relayAriaDescribedBy(),this._userInitiated&&(this._userInitiated=!1,e.has("checked")&&(this.value==null&&console.warn("btu-radio: selected without a `value`; the parent btu-radio-group cannot track this option.",this),this.emit("btu-radio-change",{checked:this.checked,value:this.value??""})))}_onInputChange(e){const i=e.target;this._userInitiated=!0,this.checked=i.checked}get _isDisabled(){return this.disabled||this._groupDisabled}get _describedBy(){const e=[];return this.description&&e.push(this._descId),this.error&&e.push(this._errorId),e.length?e.join(" "):void 0}_relayAriaDescribedBy(){const e=this.renderRoot.querySelector(".btu-radio-input");if(!e)return;this.removeAttribute("aria-describedby");const i=this.renderRoot.querySelector("[data-tooltip-internal]")?.id,o=[this._describedBy,i].filter(Boolean).join(" ");o?e.setAttribute("aria-describedby",o):e.removeAttribute("aria-describedby")}render(){return l`
|
|
2
|
+
<input
|
|
3
|
+
type="radio"
|
|
4
|
+
class="btu-radio-input"
|
|
5
|
+
.checked=${I(this.checked)}
|
|
6
|
+
?disabled=${this._isDisabled}
|
|
7
|
+
?required=${this._groupRequired}
|
|
8
|
+
name=${h(this.name)}
|
|
9
|
+
value=${h(this.value)}
|
|
10
|
+
tabindex=${this._tabindex}
|
|
11
|
+
aria-label=${h(this.label)}
|
|
12
|
+
aria-invalid=${h(this.invalid||this.error?"true":void 0)}
|
|
13
|
+
@change=${this._onInputChange}
|
|
14
|
+
/>
|
|
15
|
+
<span class="btu-radio-box">
|
|
16
|
+
<span class="btu-radio-dot"></span>
|
|
17
|
+
</span>
|
|
18
|
+
${this.label||this.description||this.error?l`
|
|
19
|
+
<span class="btu-radio-text">
|
|
20
|
+
${this.label?l`<span class="btu-radio-label">${this.label}</span>`:c}
|
|
21
|
+
${this.description?l`<span id=${this._descId} class="btu-radio-description">${this.description}</span>`:c}
|
|
22
|
+
${this.error?l`<span id=${this._errorId} class="btu-radio-error">${this.error}</span>`:c}
|
|
23
|
+
</span>
|
|
24
|
+
`:c}
|
|
25
|
+
`}}a([r()],s.prototype,"label");a([r()],s.prototype,"description");a([r({reflect:!0})],s.prototype,"size");a([r({type:Boolean,reflect:!0})],s.prototype,"checked");a([r({type:Boolean,reflect:!0})],s.prototype,"disabled");a([r({type:Boolean,reflect:!0})],s.prototype,"invalid");a([r()],s.prototype,"error");a([r()],s.prototype,"value");a([r()],s.prototype,"name");customElements.get("btu-radio")||customElements.define("btu-radio",s);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as h,x as m}from"./iframe-
|
|
1
|
+
import{g as h,x as m}from"./iframe-DlBK9Drk.js";import{o}from"./if-defined-DerKRcyC.js";import{o as g}from"./style-map-DE4G47KD.js";import"./Radio-rvfGhZwK.js";import"./preload-helper-PPVm8Dsz.js";import"./property-Bmq4RTSP.js";import"./ReadyMixin-CvX_eidU.js";import"./TooltipMixin-CVKslCDt.js";const{events:y,args:S,argTypes:u}=h("btu-radio"),f={customColorPrimary:"--radio-color-primary",customColorBorder:"--radio-color-border",customColorError:"--radio-color-error",customLabelSpacing:"--radio-label-spacing"},v=e=>Object.entries(f).reduce((d,[p,b])=>(e[p]&&(d[b]=e[p]),d),{}),T={title:"Components/Radio",component:"btu-radio",tags:["autodocs"],parameters:{docs:{subtitle:"A single option within a radio group",description:{component:"\nA single radio option. Place several inside a `btu-radio-group`, which owns the shared\n`name`, selection state, and keyboard navigation. See the <strong>Radio Group</strong> stories\nfor the full pattern — the stories here show a single option's visual states.\n "}},actions:{handles:y},controls:{expanded:!0}},args:{...S,label:"Pro",checked:!1},argTypes:{...u,"--radio-color-primary":{table:{disable:!0}},"--radio-color-border":{table:{disable:!0}},"--radio-color-error":{table:{disable:!0}},"--radio-label-spacing":{table:{disable:!0}},"--radio-box-size":{table:{disable:!0}},"--radio-dot-size":{table:{disable:!0}},size:{...u.size,control:{type:"select"},options:["sm","md"]},customColorPrimary:{name:"--radio-color-primary",control:{type:"color"},description:"Fill and border color when selected",table:{category:"CSS Properties"}},customColorBorder:{name:"--radio-color-border",control:{type:"color"},description:"Border color in the unselected state",table:{category:"CSS Properties"}},customColorError:{name:"--radio-color-error",control:{type:"color"},description:"Border and text color in the error state",table:{category:"CSS Properties"}},customLabelSpacing:{name:"--radio-label-spacing",control:{type:"text"},description:"Distance between the radio and the label (default: 0.75rem)",table:{category:"CSS Properties"}}},render:e=>m`
|
|
2
2
|
<btu-radio
|
|
3
3
|
size=${o(e.size)}
|
|
4
4
|
label=${o(e.label)}
|
|
@@ -13,7 +13,7 @@ import{g as h,x as m}from"./iframe-B9buZjP7.js";import{o}from"./if-defined-BwWBC
|
|
|
13
13
|
?invalid=${e.invalid}
|
|
14
14
|
style=${g(v(e))}
|
|
15
15
|
></btu-radio>
|
|
16
|
-
`},r={args:{}},t={args:{checked:!0,label:"Pro"}},a={args:{label:"Pro",description:"For professionals who need more power.",checked:!0}},
|
|
16
|
+
`},r={args:{}},t={args:{checked:!0,label:"Pro"}},a={args:{label:"Pro",description:"For professionals who need more power.",checked:!0}},i={args:{label:"Team (coming soon)",disabled:!0}},s={args:{label:"Current plan",disabled:!0,checked:!0}},n={args:{label:"Accept the terms",invalid:!0,error:"You must choose an option to continue."}},l={args:{label:"Pro",tooltip:"Includes priority support and higher limits.",tooltipPosition:"right"},parameters:{docs:{description:{story:"Hover or focus the option to reveal a tooltip. Provided by `TooltipMixin` (`tooltip`, `tooltip-position`, …)."}}}},c={render:()=>m`
|
|
17
17
|
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
18
18
|
<btu-radio size="sm" label="Small (default)" checked></btu-radio>
|
|
19
19
|
<btu-radio size="md" label="Medium" checked></btu-radio>
|
|
@@ -31,18 +31,18 @@ import{g as h,x as m}from"./iframe-B9buZjP7.js";import{o}from"./if-defined-BwWBC
|
|
|
31
31
|
description: 'For professionals who need more power.',
|
|
32
32
|
checked: true
|
|
33
33
|
}
|
|
34
|
-
}`,...a.parameters?.docs?.source}}};
|
|
34
|
+
}`,...a.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
35
35
|
args: {
|
|
36
36
|
label: 'Team (coming soon)',
|
|
37
37
|
disabled: true
|
|
38
38
|
}
|
|
39
|
-
}`,...
|
|
39
|
+
}`,...i.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
40
40
|
args: {
|
|
41
41
|
label: 'Current plan',
|
|
42
42
|
disabled: true,
|
|
43
43
|
checked: true
|
|
44
44
|
}
|
|
45
|
-
}`,...
|
|
45
|
+
}`,...s.parameters?.docs?.source}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
46
46
|
args: {
|
|
47
47
|
label: 'Accept the terms',
|
|
48
48
|
invalid: true,
|
|
@@ -68,4 +68,4 @@ import{g as h,x as m}from"./iframe-B9buZjP7.js";import{o}from"./if-defined-BwWBC
|
|
|
68
68
|
<btu-radio size="md" label="Medium" checked></btu-radio>
|
|
69
69
|
</div>
|
|
70
70
|
\`
|
|
71
|
-
}`,...c.parameters?.docs?.source}}};const
|
|
71
|
+
}`,...c.parameters?.docs?.source}}};const W=["Default","Checked","WithDescription","Disabled","DisabledChecked","InvalidWithError","WithTooltip","Sizes"];export{t as Checked,r as Default,i as Disabled,s as DisabledChecked,n as InvalidWithError,c as Sizes,a as WithDescription,l as WithTooltip,W as __namedExportsOrder,T as default};
|
package/dist/storybook/assets/{RadioGroup.stories-ChARVXs3.js → RadioGroup.stories-D8krOSlP.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as q,x as u,g as S}from"./iframe-DlBK9Drk.js";import{o as p}from"./if-defined-DerKRcyC.js";import{o as A}from"./style-map-DE4G47KD.js";import"./Radio-rvfGhZwK.js";import{n as d}from"./property-Bmq4RTSP.js";import{E as R,R as D}from"./ReadyMixin-CvX_eidU.js";import{R as F}from"./RovingTabindexMixin-9z8lwaM9.js";import"./preload-helper-PPVm8Dsz.js";import"./TooltipMixin-CVKslCDt.js";var B=Object.defineProperty,c=(o,e,r,t)=>{for(var a=void 0,s=o.length-1,k;s>=0;s--)(k=o[s])&&(a=k(e,r,a)||a);return a&&B(e,r,a),a};class n extends F(R(D(q))){constructor(){super(...arguments),this.orientation="vertical",this.size="sm",this.required=!1,this.disabled=!1,this._initialClasses=[],this._initialClassesCaptured=!1,this._boundHandleRadioChange=this._handleRadioChange.bind(this),this._boundHandleKeyDown=this._handleKeyDown.bind(this)}connectedCallback(){super.connectedCallback(),this._initialClassesCaptured||(this.className&&(this._initialClasses=this.className.split(" ").filter(e=>e.trim())),this._initialClassesCaptured=!0),this.setAttribute("role","radiogroup"),this.addEventListener("btu-radio-change",this._boundHandleRadioChange),this.addEventListener("keydown",this._boundHandleKeyDown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("btu-radio-change",this._boundHandleRadioChange),this.removeEventListener("keydown",this._boundHandleKeyDown)}createRenderRoot(){return this}willUpdate(e){super.willUpdate(e),this.className=[...this._initialClasses,"btu-radio-group",this.orientation==="horizontal"&&"btu-radio-group-horizontal"].filter(Boolean).join(" "),this.setAttribute("aria-orientation",this.orientation),this.required?this.setAttribute("aria-required","true"):this.removeAttribute("aria-required")}firstUpdated(e){super.firstUpdated(e),this.value==null&&(this.value=this._getRadios().find(t=>t.checked)?.value),this._syncRadios();const r=this._getRovingTargets();if(r.length>0){const t=r.findIndex(a=>a.checked);this._rovingFocus(t>=0?t:0,!1)}this.emit("btu-radio-group-ready")}updated(e){super.updated(e),(e.has("value")||e.has("name")||e.has("size")||e.has("disabled")||e.has("required"))&&this._syncRadios()}_getRovingTargets(){if(this.disabled)return[];const e=[];for(const r of this._getRadios()){if(r.disabled)continue;const t=r.querySelector(".btu-radio-input");t&&e.push(t)}return e}_getRadios(){return Array.from(this.querySelectorAll("btu-radio"))}_syncRadios(){const e=this.value!=null&&this.value!=="";let r=e;this._getRadios().forEach(t=>{t.name=this.name,t.size=this.size,t._groupDisabled=this.disabled,t._groupRequired=this.required,t.checked=e&&t.value===this.value,e?t._tabindex=t.value===this.value?0:-1:!r&&!t.disabled?(t._tabindex=0,r=!0):t._tabindex=-1,t.requestUpdate()})}_selectValue(e){const r=this._getRadios().find(t=>t.value===e);!r||r.disabled||this.disabled||e===this.value||(this.value=e,this._syncRadios(),this.emit("btu-radio-group-change",{value:e}))}_handleRadioChange(e){this._selectValue(e.detail.value)}_selectFocusedRadio(){const e=document.activeElement,r=this._getRadios().find(t=>t.querySelector(".btu-radio-input")===e);r?.value==null||r.value===this.value||(this._selectValue(r.value),r.emit("btu-radio-change",{checked:!0,value:r.value}))}_handleKeyDown(e){if(this.disabled)return;const r=this.orientation==="horizontal"?"ArrowRight":"ArrowDown",t=this.orientation==="horizontal"?"ArrowLeft":"ArrowUp";switch(e.key){case r:e.preventDefault(),this._rovingNext(),this._selectFocusedRadio();break;case t:e.preventDefault(),this._rovingPrev(),this._selectFocusedRadio();break;case"Home":e.preventDefault(),this._rovingFirst(),this._selectFocusedRadio();break;case"End":e.preventDefault(),this._rovingLast(),this._selectFocusedRadio();break}}render(){return u``}}c([d()],n.prototype,"name");c([d()],n.prototype,"value");c([d({reflect:!0})],n.prototype,"orientation");c([d({reflect:!0})],n.prototype,"size");c([d({type:Boolean,reflect:!0})],n.prototype,"required");c([d({type:Boolean,reflect:!0})],n.prototype,"disabled");customElements.get("btu-radio-group")||customElements.define("btu-radio-group",n);const{expect:i,userEvent:x,waitFor:l}=__STORYBOOK_MODULE_TEST__,{events:E,args:C,argTypes:_}=S("btu-radio-group"),z={customColorPrimary:"--radio-color-primary",customColorBorder:"--radio-color-border",customLabelSpacing:"--radio-label-spacing"},T=o=>Object.entries(z).reduce((e,[r,t])=>(o[r]&&(e[t]=o[r]),e),{}),V={title:"Components/Radio Group",component:"btu-radio-group",tags:["autodocs"],parameters:{docs:{subtitle:"A set of mutually exclusive options",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>For selecting exactly one option from a small, visible set</li>
|
|
@@ -11,35 +11,35 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
11
11
|
<li><strong>Home / End</strong> — jump to the first / last option</li>
|
|
12
12
|
<li><strong>Tab</strong> — enter and exit the group (a single roving tabstop)</li>
|
|
13
13
|
</ul>
|
|
14
|
-
`}},actions:{handles:
|
|
14
|
+
`}},actions:{handles:E},controls:{expanded:!0}},args:{...C,name:"plan",value:"pro",orientation:"vertical",size:"sm"},argTypes:{..._,"--radio-color-primary":{table:{disable:!0}},"--radio-color-border":{table:{disable:!0}},"--radio-label-spacing":{table:{disable:!0}},orientation:{..._.orientation,control:{type:"select"},options:["vertical","horizontal"]},size:{..._.size,control:{type:"select"},options:["sm","md"]},customColorPrimary:{name:"--radio-color-primary",control:{type:"color"},description:"Fill and border color when an option is selected",table:{category:"CSS Properties"}},customColorBorder:{name:"--radio-color-border",control:{type:"color"},description:"Border color in the unselected state",table:{category:"CSS Properties"}},customLabelSpacing:{name:"--radio-label-spacing",control:{type:"text"},description:"Distance between an option control and its label (default: 0.75rem)",table:{category:"CSS Properties"}}},render:o=>u`
|
|
15
15
|
<form>
|
|
16
16
|
<btu-radio-group
|
|
17
|
-
name=${
|
|
18
|
-
value=${
|
|
19
|
-
orientation=${
|
|
20
|
-
size=${
|
|
21
|
-
?required=${
|
|
22
|
-
?disabled=${
|
|
23
|
-
style=${
|
|
17
|
+
name=${p(o.name)}
|
|
18
|
+
value=${p(o.value)}
|
|
19
|
+
orientation=${p(o.orientation)}
|
|
20
|
+
size=${p(o.size)}
|
|
21
|
+
?required=${o.required}
|
|
22
|
+
?disabled=${o.disabled}
|
|
23
|
+
style=${A(T(o))}
|
|
24
24
|
>
|
|
25
25
|
<btu-radio value="free" label="Free"></btu-radio>
|
|
26
26
|
<btu-radio value="pro" label="Pro"></btu-radio>
|
|
27
27
|
<btu-radio value="team" label="Team"></btu-radio>
|
|
28
28
|
</btu-radio-group>
|
|
29
29
|
</form>
|
|
30
|
-
`},
|
|
30
|
+
`},b={},m={render:()=>u`
|
|
31
31
|
<btu-radio-group name="plan-desc" value="pro">
|
|
32
32
|
<btu-radio value="free" label="Free" description="For personal projects and evaluation."></btu-radio>
|
|
33
33
|
<btu-radio value="pro" label="Pro" description="For professionals who need more power."></btu-radio>
|
|
34
34
|
<btu-radio value="team" label="Team" description="Best for growing teams and collaboration."></btu-radio>
|
|
35
35
|
</btu-radio-group>
|
|
36
|
-
`},
|
|
36
|
+
`},h={args:{orientation:"horizontal"}},v={render:()=>u`
|
|
37
37
|
<btu-radio-group name="plan-disabled-option" value="free">
|
|
38
38
|
<btu-radio value="free" label="Free"></btu-radio>
|
|
39
39
|
<btu-radio value="pro" label="Pro"></btu-radio>
|
|
40
40
|
<btu-radio value="team" label="Team (coming soon)" disabled></btu-radio>
|
|
41
41
|
</btu-radio-group>
|
|
42
|
-
`,play:async({canvasElement:
|
|
42
|
+
`,play:async({canvasElement:o,step:e})=>{const r=o.querySelector("btu-radio-group"),t=Array.from(o.querySelectorAll(".btu-radio-input"));await e("the selected option is the sole tabstop",async()=>{await l(()=>i(t[0].getAttribute("tabindex")).toBe("0")),i(t[1].getAttribute("tabindex")).toBe("-1")}),await e("ArrowDown moves focus to the next option and selects it",async()=>{t[0].focus(),await x.keyboard("{ArrowDown}"),await l(()=>i(r.value).toBe("pro")),i(t[1].checked).toBe(!0)}),await e("the disabled option is skipped — ArrowDown wraps back to the first",async()=>{await x.keyboard("{ArrowDown}"),await l(()=>i(r.value).toBe("free")),i(t[2].checked).toBe(!1)})},parameters:{docs:{description:{story:"A single option can be disabled; it is skipped during keyboard navigation."}}}},g={args:{disabled:!0},parameters:{docs:{description:{story:"Setting `disabled` on the group disables every option."}}}},f={render:()=>u`
|
|
43
43
|
<div style="display: flex; gap: 3rem;">
|
|
44
44
|
<btu-radio-group name="plan-sm" value="pro" size="sm">
|
|
45
45
|
<btu-radio value="free" label="Free"></btu-radio>
|
|
@@ -50,12 +50,12 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
50
50
|
<btu-radio value="pro" label="Pro"></btu-radio>
|
|
51
51
|
</btu-radio-group>
|
|
52
52
|
</div>
|
|
53
|
-
`},
|
|
53
|
+
`},y={args:{name:"plan-required",value:"",required:!0},play:async({canvasElement:o,step:e})=>{const r=o.querySelector("form"),t=o.querySelector("btu-radio-group"),a=Array.from(o.querySelectorAll(".btu-radio-input"));await e("with nothing selected, the form is invalid and submits no value",async()=>{await l(()=>i(a.every(s=>s.required)).toBe(!0)),i(r.checkValidity()).toBe(!1),i(new FormData(r).get("plan-required")).toBeNull()}),await e("once an option is selected, the form validates and submits its value",async()=>{a[1].focus(),await x.click(a[1]),await l(()=>i(t.value).toBe("pro")),i(r.checkValidity()).toBe(!0),i(new FormData(r).get("plan-required")).toBe("pro")}),await e("reset to the unselected state",async()=>{t.value="",await l(()=>i(a.every(s=>!s.checked)).toBe(!0))})},parameters:{docs:{description:{story:"`required` blocks form submission until an option is selected, mirroring a native required radio set."}}}},w={render:()=>u`
|
|
54
54
|
<div style="display: flex; flex-direction: column; gap: 0.75rem;">
|
|
55
55
|
<btu-radio-group
|
|
56
56
|
name="plan-events"
|
|
57
57
|
value="free"
|
|
58
|
-
@btu-radio-group-change=${
|
|
58
|
+
@btu-radio-group-change=${o=>{const e=o.target.parentElement?.querySelector("#radio-group-event-output");e&&(e.textContent=`value: ${o.detail.value}`)}}
|
|
59
59
|
>
|
|
60
60
|
<btu-radio value="free" label="Free"></btu-radio>
|
|
61
61
|
<btu-radio value="pro" label="Pro"></btu-radio>
|
|
@@ -67,7 +67,7 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
67
67
|
>—</span
|
|
68
68
|
>
|
|
69
69
|
</div>
|
|
70
|
-
`,parameters:{docs:{description:{story:"Demonstrates the `btu-radio-group-change` event, which provides `{ value: string }` in its detail."}}}};
|
|
70
|
+
`,parameters:{docs:{description:{story:"Demonstrates the `btu-radio-group-change` event, which provides `{ value: string }` in its detail."}}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:"{}",...b.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
71
71
|
render: () => html\`
|
|
72
72
|
<btu-radio-group name="plan-desc" value="pro">
|
|
73
73
|
<btu-radio value="free" label="Free" description="For personal projects and evaluation."></btu-radio>
|
|
@@ -75,11 +75,11 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
75
75
|
<btu-radio value="team" label="Team" description="Best for growing teams and collaboration."></btu-radio>
|
|
76
76
|
</btu-radio-group>
|
|
77
77
|
\`
|
|
78
|
-
}`,...
|
|
78
|
+
}`,...m.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
79
79
|
args: {
|
|
80
80
|
orientation: 'horizontal'
|
|
81
81
|
}
|
|
82
|
-
}`,...
|
|
82
|
+
}`,...h.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
|
|
83
83
|
render: () => html\`
|
|
84
84
|
<btu-radio-group name="plan-disabled-option" value="free">
|
|
85
85
|
<btu-radio value="free" label="Free"></btu-radio>
|
|
@@ -118,7 +118,7 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
}`,...
|
|
121
|
+
}`,...v.parameters?.docs?.source}}};g.parameters={...g.parameters,docs:{...g.parameters?.docs,source:{originalSource:`{
|
|
122
122
|
args: {
|
|
123
123
|
disabled: true
|
|
124
124
|
},
|
|
@@ -129,7 +129,7 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
}
|
|
132
|
-
}`,...
|
|
132
|
+
}`,...g.parameters?.docs?.source}}};f.parameters={...f.parameters,docs:{...f.parameters?.docs,source:{originalSource:`{
|
|
133
133
|
render: () => html\`
|
|
134
134
|
<div style="display: flex; gap: 3rem;">
|
|
135
135
|
<btu-radio-group name="plan-sm" value="pro" size="sm">
|
|
@@ -142,7 +142,7 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
142
142
|
</btu-radio-group>
|
|
143
143
|
</div>
|
|
144
144
|
\`
|
|
145
|
-
}`,...
|
|
145
|
+
}`,...f.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
146
146
|
// Inherit the meta render so the Controls (value, required, …) drive this story.
|
|
147
147
|
// Start with an empty value (not undefined — Storybook ignores undefined overrides
|
|
148
148
|
// and would fall back to the meta default) so nothing is selected out of the box.
|
|
@@ -187,7 +187,7 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
}`,...
|
|
190
|
+
}`,...y.parameters?.docs?.source}}};w.parameters={...w.parameters,docs:{...w.parameters?.docs,source:{originalSource:`{
|
|
191
191
|
render: () => html\`
|
|
192
192
|
<div style="display: flex; flex-direction: column; gap: 0.75rem;">
|
|
193
193
|
<btu-radio-group
|
|
@@ -218,4 +218,4 @@ import{g as w,x as n}from"./iframe-B9buZjP7.js";import{o as l}from"./if-defined-
|
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
220
|
}
|
|
221
|
-
}`,...
|
|
221
|
+
}`,...w.parameters?.docs?.source}}};const j=["Default","WithDescriptions","Horizontal","DisabledOption","DisabledGroup","Sizes","Required","Events"];export{b as Default,g as DisabledGroup,v as DisabledOption,w as Events,h as Horizontal,y as Required,f as Sizes,m as WithDescriptions,j as __namedExportsOrder,V as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./iframe-
|
|
1
|
+
import"./iframe-DlBK9Drk.js";const l=t=>{class n extends t{connectedCallback(){super.connectedCallback(),Promise.resolve().then(()=>this.emit("btu-element-connected",{}),e=>this.emit("btu-element-error",{error:e}))}disconnectedCallback(){super.disconnectedCallback(),this.emit("btu-element-disconnected")}emit(e,c){const a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:c});return this.dispatchEvent(a)}}return n},d=t=>{class n extends t{connectedCallback(){const e=()=>{super.connectedCallback()};document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",()=>e())}}return n};export{l as E,d as R};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./iframe-DlBK9Drk.js";const v=i=>{class s extends i{constructor(){super(...arguments),this._rovingIndex=0}_getRovingTargets(){return[]}_rovingFocus(t,n=!0){const e=this._getRovingTargets();if(e.length===0)return;const r=Math.max(0,Math.min(t,e.length-1));e.forEach((g,o)=>g.setAttribute("tabindex",o===r?"0":"-1")),n&&e[r]?.focus(),this._rovingIndex=r}_rovingNext(){const t=this._getRovingTargets();if(t.length===0)return;const n=this._rovingCurrentIndex(),e=n<t.length-1?n+1:0;this._rovingFocus(e)}_rovingPrev(){const t=this._getRovingTargets();if(t.length===0)return;const n=this._rovingCurrentIndex(),e=n>0?n-1:t.length-1;this._rovingFocus(e)}_rovingFirst(){this._rovingFocus(0)}_rovingLast(){const t=this._getRovingTargets();t.length>0&&this._rovingFocus(t.length-1)}_rovingCurrentIndex(){const t=document.activeElement;return this._getRovingTargets().findIndex(n=>n===t||n.contains(t))}}return s};export{v as R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as l,i as
|
|
1
|
+
import{x as l,i as u}from"./iframe-DlBK9Drk.js";import{t as g}from"./custom-element-UsVr97OX.js";import{R as m}from"./RovingTabindexMixin-9z8lwaM9.js";import"./preload-helper-PPVm8Dsz.js";var s=Object.freeze,v=Object.defineProperty,h=Object.getOwnPropertyDescriptor,p=(t,n,b,i)=>{for(var e=i>1?void 0:i?h(n,b):n,r=t.length-1,d;r>=0;r--)(d=t[r])&&(e=d(e)||e);return e},x=(t,n)=>s(v(t,"raw",{value:s(t.slice())})),a;const A={title:"Mixins/Roving Tabindex",tags:["autodocs"],parameters:{docs:{description:{component:`
|
|
2
2
|
\`RovingTabindexMixin\` provides **roving tabindex** navigation primitives for toolbar and menu components following the <a href="https://www.w3.org/WAI/ARIA/apd/practices/keyboard-interface/#kbd_roving_tabindex" target="_blank">WAI-ARIA Keyboard Interface Pattern</a>.
|
|
3
3
|
|
|
4
4
|
In a roving tabindex, only one element in the group has \`tabindex="0"\` (reachable via Tab), while all others have \`tabindex="-1"\`. Arrow keys move focus between items, wrapping at both ends.
|
|
@@ -107,7 +107,7 @@ class MyToolbar extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitElem
|
|
|
107
107
|
\`\`\`typescript
|
|
108
108
|
class MyComponent extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitElement))) {}
|
|
109
109
|
\`\`\`
|
|
110
|
-
`}}}};let
|
|
110
|
+
`}}}};let c=class extends m(u){constructor(){super(...arguments),this._handleKeydown=t=>{switch(t.key){case"ArrowRight":t.preventDefault(),this._rovingNext();break;case"ArrowLeft":t.preventDefault(),this._rovingPrev();break;case"Home":t.preventDefault(),this._rovingFirst();break;case"End":t.preventDefault(),this._rovingLast();break}}}createRenderRoot(){return this}_getRovingTargets(){return Array.from(this.querySelectorAll(".roving-demo-btn"))}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown)}render(){return l`
|
|
111
111
|
<div role="toolbar" aria-label="Demo toolbar" style="display: flex; gap: 0.5rem;">
|
|
112
112
|
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="0">Item 1</button>
|
|
113
113
|
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 2</button>
|
|
@@ -115,7 +115,7 @@ class MyComponent extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitEl
|
|
|
115
115
|
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 4</button>
|
|
116
116
|
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 5</button>
|
|
117
117
|
</div>
|
|
118
|
-
`}};
|
|
118
|
+
`}};c=p([g("roving-demo")],c);const o={render:()=>l(a||(a=x([`<div class="flex flex-col gap-4">
|
|
119
119
|
<div>
|
|
120
120
|
<h4 class="mb-2 font-bold">Interactive Roving Tabindex Demo</h4>
|
|
121
121
|
<p class="mb-2 text-sm text-gray-600">
|
|
@@ -151,7 +151,7 @@ class MyComponent extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitEl
|
|
|
151
151
|
})
|
|
152
152
|
})()
|
|
153
153
|
<\/script>
|
|
154
|
-
</div>`])))};
|
|
154
|
+
</div>`])))};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
155
155
|
render: () => html\`<div class="flex flex-col gap-4">
|
|
156
156
|
<div>
|
|
157
157
|
<h4 class="mb-2 font-bold">Interactive Roving Tabindex Demo</h4>
|
|
@@ -189,4 +189,4 @@ class MyComponent extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitEl
|
|
|
189
189
|
})()
|
|
190
190
|
<\/script>
|
|
191
191
|
</div>\`
|
|
192
|
-
}`,...
|
|
192
|
+
}`,...o.parameters?.docs?.source}}};const E=["RovingTabindex"];export{o as RovingTabindex,E as __namedExportsOrder,A as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as o}from"./iframe-
|
|
1
|
+
import{x as o}from"./iframe-DlBK9Drk.js";import"./preload-helper-PPVm8Dsz.js";const r={title:"Utilities/RTC",tags:["autodocs"],parameters:{docs:{subtitle:"The `rtc` module provides real-time communication between browser tabs and the Brightspot CMS server. Uses BroadcastChannel for cross-tab coordination with leader election, and Server-Sent Events for server communication."},controls:{expanded:!0}}},e={render:()=>o`
|
|
2
2
|
<div class="space-y-6 text-sm">
|
|
3
3
|
<div>
|
|
4
4
|
<h3 class="mb-2 font-bold">Overview</h3>
|
package/dist/storybook/assets/{ScrollShadow.stories-CI67Ougx.js → ScrollShadow.stories-1KD0lWHX.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as a}from"./iframe-
|
|
1
|
+
import{x as a}from"./iframe-DlBK9Drk.js";import"./preload-helper-PPVm8Dsz.js";const l=({theme:e="btu-scrollshadow-25"})=>{const r=new Array(100).fill(0).map((s,t)=>`Item ${t+1}`);return a`
|
|
2
2
|
<style>
|
|
3
3
|
:root {
|
|
4
4
|
--can-scroll: ;
|