@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 S,x as t}from"./iframe-
|
|
1
|
+
import{g as S,x as t}from"./iframe-DlBK9Drk.js";import{o as f}from"./style-map-DE4G47KD.js";import"./DropdownMenu-B-LvOIGj.js";import"./preload-helper-PPVm8Dsz.js";import"./property-Bmq4RTSP.js";import"./aria-D5THOgos.js";import"./ReadyMixin-CvX_eidU.js";import"./TooltipMixin-CVKslCDt.js";import"./Icon-CWyJRQf7.js";import"./Badge-bWrvpEgX.js";import"./RovingTabindexMixin-9z8lwaM9.js";const{events:O,args:A,argTypes:n}=S("btu-dropdown"),F={title:"Components/Dropdown",component:"btu-dropdown",tags:["autodocs"],parameters:{docs:{subtitle:"btu-dropdown",description:{component:`
|
|
2
2
|
A dropdown menu component that renders a trigger button and manages a floating panel
|
|
3
3
|
containing a \`btu-dropdown-menu\` with \`btu-dropdown-item\` children.
|
|
4
4
|
|
|
@@ -721,4 +721,4 @@ Follows the WAI-ARIA Menu Button Pattern for keyboard navigation and accessibili
|
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
723
|
}
|
|
724
|
-
}`,...v.parameters?.docs?.source}}};const
|
|
724
|
+
}`,...v.parameters?.docs?.source}}};const R=["Default","Variants","Sizes","WithIcons","Placements","Selection","Checkboxes","FavoritesAndShortcuts","DividersAndSubheads","Disabled","WithError","StayOpenOnSelect","Tooltip","EmptyState","ProgrammaticOpen","CustomStyling"];export{b as Checkboxes,v as CustomStyling,d as Default,m as Disabled,u as DividersAndSubheads,g as EmptyState,s as FavoritesAndShortcuts,l as Placements,h as ProgrammaticOpen,p as Selection,i as Sizes,c as StayOpenOnSelect,y as Tooltip,r as Variants,w as WithError,a as WithIcons,R as __namedExportsOrder,F as default};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import{E as r,x as n,i as y}from"./iframe-DlBK9Drk.js";import{n as s}from"./property-Bmq4RTSP.js";import{o as w}from"./style-map-DE4G47KD.js";import{a as v}from"./aria-D5THOgos.js";import{E as f,R as _}from"./ReadyMixin-CvX_eidU.js";import{T as k}from"./TooltipMixin-CVKslCDt.js";import"./Icon-CWyJRQf7.js";import"./Badge-bWrvpEgX.js";import{R as $}from"./RovingTabindexMixin-9z8lwaM9.js";var x=Object.defineProperty,d=(l,t,e,o)=>{for(var i=void 0,h=l.length-1,b;h>=0;h--)(b=l[h])&&(i=b(t,e,i)||i);return i&&x(t,e,i),i};const g={"bottom-start":"block-end span-inline-end","bottom-end":"block-end span-inline-start","top-start":"block-start span-inline-end","top-end":"block-start span-inline-start"};class a extends k(f(_(y))){constructor(){super(...arguments),this.label="",this.open=!1,this.placement="bottom-start",this.size="md",this.disabled=!1,this.variant="secondary",this.symbol="",this.iconPosition="leading",this.iconOnly=!1,this.stayOpenOnSelect=!1,this.noChevron=!1,this._triggerAnchorName=`--dropdown-anchor-${crypto.randomUUID().slice(0,8)}`,this._panelId=`dropdown-panel-${crypto.randomUUID().slice(0,8)}`,this._panel=null,this._menu=null,this._triggerEl=null,this._panelVisible=!1,this._boundToggle=this._handlePanelToggle.bind(this),this._boundItemSelect=this._handleItemSelect.bind(this),this._boundKeydown=this._handleTriggerKeydown.bind(this),this._boundPanelKeydown=this._handlePanelKeydown.bind(this),this._boundFocusin=t=>t.stopPropagation()}createRenderRoot(){return this}connectedCallback(){this._menu||(this._menu=this.querySelector("btu-dropdown-menu"),this._menu&&this._menu.remove()),super.connectedCallback(),this._panel&&(this._panel.addEventListener("toggle",this._boundToggle),this._panel.addEventListener("keydown",this._boundPanelKeydown),this._panel.addEventListener("focusin",this._boundFocusin),this.addEventListener("btu-dropdown-item-select",this._boundItemSelect))}firstUpdated(){this._triggerEl=this.querySelector("button"),this._panel=document.createElement("div"),this._panel.id=this._panelId,this._panel.setAttribute("popover","auto"),this._panel.className="btu-dropdown-panel";const t=this._panel.style;t.setProperty("position","fixed"),t.setProperty("inset","unset"),t.setProperty("margin","0"),t.setProperty("position-anchor",this._triggerAnchorName),t.setProperty("position-area",g[this.placement]),t.setProperty("position-try-fallbacks","flip-block"),t.setProperty("position-visibility","anchors-visible"),t.setProperty("min-width","var(--dropdown-panel-min-width, max(12rem, anchor-size(width)))"),this._menu&&this._panel.appendChild(this._menu),this.appendChild(this._panel),this._panel.addEventListener("toggle",this._boundToggle),this._panel.addEventListener("keydown",this._boundPanelKeydown),this._panel.addEventListener("focusin",this._boundFocusin),this.addEventListener("btu-dropdown-item-select",this._boundItemSelect),this.emit("btu-dropdown-ready")}disconnectedCallback(){super.disconnectedCallback(),this._panel&&(this._panel.removeEventListener("toggle",this._boundToggle),this._panel.removeEventListener("keydown",this._boundPanelKeydown),this._panel.removeEventListener("focusin",this._boundFocusin)),this.removeEventListener("btu-dropdown-item-select",this._boundItemSelect)}updated(t){if(super.updated(t),t.has("placement")&&this._panel&&this._panel.style.setProperty("position-area",g[this.placement]),t.has("open")&&this._panel){if(this.open&&!this._panelVisible)try{this._panel.showPopover()}catch(e){if(!(e instanceof DOMException&&e.name==="InvalidStateError"))throw e}else if(!this.open&&this._panelVisible)try{this._panel.hidePopover()}catch(e){if(!(e instanceof DOMException&&e.name==="InvalidStateError"))throw e}}}_getButtonClasses(){const t=this.size,e=["btu-button"];switch(this.variant){case"primary":e.push("btu-button-primary",`btu-button-${t}`);break;case"secondary":e.push("btu-button-gray",`btu-button-${t}`,"btu-button-outline");break;case"tertiary":e.push("btu-button-gray",`btu-button-${t}`,"btu-button-fill-none");break;case"primary-clear":e.push("btu-button-primary",`btu-button-${t}`,"btu-button-container-none");break;case"secondary-clear":e.push("btu-button-gray",`btu-button-${t}`,"btu-button-container-none");break;case"tertiary-clear":e.push("btu-button-gray",`btu-button-${t}`,"btu-button-container-none","btu-button-fill-none");break}return this.iconOnly&&e.push("btu-button-text-hidden"),e.join(" ")}_handlePanelToggle(t){const e=t;if(this._panelVisible=e.newState==="open",this.open=this._panelVisible,this._panelVisible){this.emit("btu-dropdown-show"),v(`${this.label||"Dropdown"} menu expanded`);const o=this.querySelector("[data-tooltip-internal]");if(o)try{o.hidePopover()}catch{}requestAnimationFrame(()=>{this._menu?.focusFirst()})}else this.emit("btu-dropdown-hide"),v(`${this.label||"Dropdown"} menu collapsed`),this._triggerEl?.focus({preventScroll:!0})}_handleItemSelect(){const t=this._menu?.checkbox??!1;!this.stayOpenOnSelect&&!t&&this._hidePanel()}_handleTriggerKeydown(t){if(!this.disabled)switch(t.key){case"ArrowDown":{t.preventDefault(),this._showPanel(),requestAnimationFrame(()=>{this._menu?.focusFirst()});break}case"ArrowUp":{t.preventDefault(),this._showPanel(),requestAnimationFrame(()=>{this._menu?.focusLast()});break}}}_handlePanelKeydown(t){t.key==="Escape"&&(t.preventDefault(),t.stopPropagation(),this._hidePanel(),this._triggerEl?.focus({preventScroll:!0})),t.key==="Tab"&&(this._hidePanel(),this._triggerEl?.focus({preventScroll:!0}))}_showPanel(){this._panel&&!this._panelVisible&&this._panel.showPopover()}_hidePanel(){this._panel&&this._panelVisible&&this._panel.hidePopover()}render(){const t=this._getButtonClasses();return n`<button
|
|
2
|
+
type="button"
|
|
3
|
+
class="${t}"
|
|
4
|
+
style=${w({"anchor-name":this._triggerAnchorName})}
|
|
5
|
+
?disabled="${this.disabled}"
|
|
6
|
+
aria-haspopup="menu"
|
|
7
|
+
aria-expanded="${this.open}"
|
|
8
|
+
aria-controls="${this._panelId}"
|
|
9
|
+
aria-label="${this.iconOnly?this.label:r}"
|
|
10
|
+
popovertarget="${this._panelId}"
|
|
11
|
+
@keydown="${this._boundKeydown}"
|
|
12
|
+
>
|
|
13
|
+
${this.symbol&&this.iconPosition==="leading"?n`<btu-icon symbol="${this.symbol}" size="sm"></btu-icon>`:r}
|
|
14
|
+
${this.iconOnly?r:this.label}
|
|
15
|
+
${this.symbol&&this.iconPosition==="trailing"?n`<btu-icon symbol="${this.symbol}" size="sm"></btu-icon>`:r}
|
|
16
|
+
${this.noChevron?r:n`<btu-icon class="btu-dropdown-chevron" symbol="chevron-down" size="sm"></btu-icon>`}
|
|
17
|
+
</button>`}}d([s({type:String})],a.prototype,"label");d([s({type:Boolean,reflect:!0})],a.prototype,"open");d([s({type:String})],a.prototype,"placement");d([s({type:String})],a.prototype,"size");d([s({type:Boolean,reflect:!0})],a.prototype,"disabled");d([s({type:String})],a.prototype,"variant");d([s({type:String})],a.prototype,"symbol");d([s({type:String,attribute:"icon-position"})],a.prototype,"iconPosition");d([s({type:Boolean,attribute:"icon-only"})],a.prototype,"iconOnly");d([s({type:Boolean,attribute:"stay-open-on-select"})],a.prototype,"stayOpenOnSelect");d([s({type:Boolean,attribute:"no-chevron",reflect:!0})],a.prototype,"noChevron");customElements.get("btu-dropdown")||customElements.define("btu-dropdown",a);var E=Object.defineProperty,p=(l,t,e,o)=>{for(var i=void 0,h=l.length-1,b;h>=0;h--)(b=l[h])&&(i=b(t,e,i)||i);return i&&E(t,e,i),i};class c extends f(_(y)){constructor(){super(...arguments),this.label="",this.type="default",this.symbol="",this.shortcut="",this.value="",this.disabled=!1,this.selected=!1,this.favorited=!1,this.error=!1,this._generatedId=`btu-dropdown-subhead-${crypto.randomUUID().slice(0,8)}`,this._checkboxMode=!1,this._showIcon=!1,this._showFavorites=!1,this._showShortcuts=!1,this._parentMenuSymbol=""}createRenderRoot(){return this}_configure(t){this._checkboxMode=t.checkbox,this._showIcon=t.icon||!!this.symbol,this._parentMenuSymbol=t.symbol,this._showFavorites=t.favorites,this._showShortcuts=t.shortcuts,this.requestUpdate()}get focusable(){return this.type==="default"}firstUpdated(){this.emit("btu-dropdown-item-ready")}activate(){this.disabled||(this._checkboxMode&&(this.selected=!this.selected),this.emit("btu-dropdown-item-select",{label:this.label,value:this.value,selected:this.selected}))}_toggleFavorite(t){t.stopPropagation(),this.favorited=!this.favorited,this.emit("btu-dropdown-item-favorite",{label:this.label,favorited:this.favorited})}render(){if(this.type==="divider")return n`<hr class="btu-dropdown-divider" role="separator" />`;if(this.type==="subhead")return n`<div class="btu-dropdown-subhead" role="presentation" id="${this._generatedId}">${this.label}</div>`;const t=this._checkboxMode?"menuitemcheckbox":"menuitem",e=["btu-dropdown-item",this.selected?"btu-dropdown-item-selected":"",this.disabled?"btu-dropdown-item-disabled":""].filter(Boolean).join(" "),o=this.symbol||this._parentMenuSymbol;return n`<div
|
|
18
|
+
class="${e}"
|
|
19
|
+
role="${t}"
|
|
20
|
+
tabindex="-1"
|
|
21
|
+
aria-disabled="${this.disabled}"
|
|
22
|
+
.ariaChecked="${this._checkboxMode?String(this.selected):null}"
|
|
23
|
+
@click="${this._handleClick}"
|
|
24
|
+
>
|
|
25
|
+
${this._checkboxMode?n`<span class="${this.selected?"btu-dropdown-checkbox-checked":""} btu-dropdown-checkbox">
|
|
26
|
+
${this.selected?n`<btu-icon symbol="check" size="xs"></btu-icon>`:r}
|
|
27
|
+
</span>`:r}
|
|
28
|
+
${!this._checkboxMode&&this.selected?n`<span class="btu-dropdown-check"><btu-icon symbol="check" size="sm"></btu-icon></span>`:r}
|
|
29
|
+
${this._showIcon&&o?n`<span class="btu-dropdown-item-icon"><btu-icon symbol="${o}" size="sm"></btu-icon></span>`:r}
|
|
30
|
+
<span class="btu-dropdown-item-label">${this.label}</span>
|
|
31
|
+
${this.error?n`<btu-badge size="sm" variant="error">!</btu-badge>`:r}
|
|
32
|
+
${this._showShortcuts&&this.shortcut?n`<span class="btu-dropdown-shortcut">${this.shortcut}</span>`:r}
|
|
33
|
+
${this._showFavorites?n`<button
|
|
34
|
+
type="button"
|
|
35
|
+
class="${this.favorited?"btu-dropdown-favorite-active":""} btu-button btu-button-text-hidden btu-button-gray btu-button-sm btu-dropdown-favorite btu-button-container-none"
|
|
36
|
+
@click="${this._toggleFavorite}"
|
|
37
|
+
aria-label="${this.favorited?"Remove from favorites":"Add to favorites"}"
|
|
38
|
+
aria-pressed="${this.favorited}"
|
|
39
|
+
>
|
|
40
|
+
<btu-icon symbol="star" size="sm"></btu-icon>
|
|
41
|
+
</button>`:r}
|
|
42
|
+
</div>`}_handleClick(){this.activate()}}p([s({type:String})],c.prototype,"label");p([s({type:String})],c.prototype,"type");p([s({type:String})],c.prototype,"symbol");p([s({type:String})],c.prototype,"shortcut");p([s({type:String})],c.prototype,"value");p([s({type:Boolean})],c.prototype,"disabled");p([s({type:Boolean,reflect:!0})],c.prototype,"selected");p([s({type:Boolean})],c.prototype,"favorited");p([s({type:Boolean})],c.prototype,"error");customElements.get("btu-dropdown-item")||customElements.define("btu-dropdown-item",c);var I=Object.defineProperty,m=(l,t,e,o)=>{for(var i=void 0,h=l.length-1,b;h>=0;h--)(b=l[h])&&(i=b(t,e,i)||i);return i&&I(t,e,i),i};class u extends $(f(_(y))){constructor(){super(...arguments),this.name="",this.header=!1,this.checkbox=!1,this.icon=!1,this.symbol="",this.favorites=!1,this.shortcuts=!1,this.emptyMessage="No items available",this._typeaheadBuffer="",this._typeaheadTimeout=null,this._handleKeydown=t=>{const e=this._getFocusableItems();if(e.length!==0)switch(t.key){case"ArrowDown":{t.preventDefault(),this._rovingNext();break}case"ArrowUp":{t.preventDefault(),this._rovingPrev();break}case"Home":{t.preventDefault(),this._rovingFirst();break}case"End":{t.preventDefault(),this._rovingLast();break}case"Enter":{t.preventDefault();const o=this._rovingCurrentIndex();o>=0&&e[o].activate();break}case" ":{t.preventDefault();const o=this._rovingCurrentIndex();o>=0&&e[o].activate();break}case"Escape":break;case"Tab":break;default:{t.key.length===1&&!t.ctrlKey&&!t.metaKey&&!t.altKey&&this._handleTypeahead(t.key,e);break}}}}createRenderRoot(){return this.renderOptions.renderBefore??=this.firstChild,this}_getRovingTargets(){return this._getFocusableItems().map(t=>t.querySelector('[role="menuitem"], [role="menuitemcheckbox"]')).filter(Boolean)}connectedCallback(){super.connectedCallback(),this.setAttribute("role","menu"),this.name&&this.setAttribute("aria-label",this.name),this.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown),this._typeaheadTimeout&&clearTimeout(this._typeaheadTimeout)}firstUpdated(){this._configureItems(),this.emit("btu-dropdown-menu-ready")}updated(){this._configureItems(),this.name?this.setAttribute("aria-label",this.name):this.removeAttribute("aria-label")}_configureItems(){this._getAllItems().forEach(e=>{e._configure({checkbox:this.checkbox,icon:this.icon,symbol:this.symbol,favorites:this.favorites,shortcuts:this.shortcuts})})}_getAllItems(){return Array.from(this.querySelectorAll("btu-dropdown-item"))}_getFocusableItems(){return this._getAllItems().filter(t=>t.focusable)}focusItem(t){const e=this._getFocusableItems().indexOf(t);e>=0&&this._rovingFocus(e)}focusFirst(){const t=this._getFocusableItems();if(this.checkbox){const o=t.find(i=>i.selected&&!i.disabled);if(o){this.focusItem(o);return}}const e=t.find(o=>!o.disabled)||t[0];e&&this.focusItem(e)}focusLast(){const t=this._getFocusableItems(),e=[...t].reverse().find(o=>!o.disabled)||t[t.length-1];e&&this.focusItem(e)}_handleTypeahead(t,e){this._typeaheadBuffer+=t.toLowerCase(),this._typeaheadTimeout&&clearTimeout(this._typeaheadTimeout),this._typeaheadTimeout=setTimeout(()=>{this._typeaheadBuffer=""},500);const o=e.find(i=>i.label.toLowerCase().startsWith(this._typeaheadBuffer));o&&this.focusItem(o)}get _isEmpty(){return this._getFocusableItems().length===0}render(){return n`${this.header&&this.name?n`<div class="btu-dropdown-header">${this.name}</div>`:r}${this._isEmpty?n`<div class="btu-dropdown-empty" role="status">${this.emptyMessage}</div>`:r}`}}m([s({type:String})],u.prototype,"name");m([s({type:Boolean})],u.prototype,"header");m([s({type:Boolean})],u.prototype,"checkbox");m([s({type:Boolean})],u.prototype,"icon");m([s({type:String})],u.prototype,"symbol");m([s({type:Boolean})],u.prototype,"favorites");m([s({type:Boolean})],u.prototype,"shortcuts");m([s({type:String,attribute:"empty-message"})],u.prototype,"emptyMessage");customElements.get("btu-dropdown-menu")||customElements.define("btu-dropdown-menu",u);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
btu-empty-state:not(:defined)>[slot]{display:none}
|
package/dist/storybook/assets/{EmptyState.stories-Bjb8hzYj.js → EmptyState.stories-CJ1w8Tp2.js}
RENAMED
|
@@ -1,4 +1,16 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{i as x,x as s,g as w}from"./iframe-DlBK9Drk.js";import{o as S}from"./if-defined-DerKRcyC.js";import{o as $}from"./style-map-DE4G47KD.js";import{n as g}from"./property-Bmq4RTSP.js";import{E as k,R as E}from"./ReadyMixin-CvX_eidU.js";import{O as G}from"./OnFindMixin-oL1bvTFj.js";import"./ButtonGroup-CoLI5nGO.js";import"./Icon-CWyJRQf7.js";import"./preload-helper-PPVm8Dsz.js";import"./onFind-Ci35eu2y.js";import"./ComponentStatesMixin-hUqOL2aW.js";import"./RovingTabindexMixin-9z8lwaM9.js";var T=Object.defineProperty,y=(t,e,i,o)=>{for(var a=void 0,v=t.length-1,f;v>=0;v--)(f=t[v])&&(a=f(e,i,a)||a);return a&&T(e,i,a),a};const C={sm:5,md:4,lg:3},N={sm:"md",md:"lg",lg:"xl"},U=new Set(["btu-empty-state","btu-empty-state-sm","btu-empty-state-md","btu-empty-state-lg"]),z=t=>typeof t=="number"&&Number.isInteger(t)&&t>=1&&t<=6;class r extends k(G(E(x))){constructor(){super(...arguments),this.heading="",this.size="md",this.initialClasses=[]}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.className&&(this.initialClasses=this.className.split(" ").filter(e=>e.trim()&&!U.has(e)))}willUpdate(e){super.willUpdate(e);const i=[...this.initialClasses,"btu-empty-state",`btu-empty-state-${this.size}`];this.className=i.filter(Boolean).join(" "),e.has("headingLevel")&&this.headingLevel!=null&&!z(this.headingLevel)&&console.warn(`EmptyState: Invalid heading-level="${this.headingLevel}". Valid values are 1-6. Falling back to size-based default.`)}firstUpdated(e){super.firstUpdated(e),this.emit("btu-empty-state-ready")}onFindRegistration(){const e=this.querySelector(".btu-empty-state-graphic"),i=this.querySelector(".btu-empty-state-actions");return!e||!i?null:{selectors:":scope > :not([data-empty-state-internal])",callback:o=>{const a=o.getAttribute("slot");a==="graphic"?(e.appendChild(o),o.tagName==="BTU-ICON"&&this.syncGraphicIconSize()):a==="actions"?i.appendChild(o):console.warn(a?`EmptyState: Unrecognized slot="${a}". Valid slots are "graphic" and "actions".`:'EmptyState: Child element has no slot attribute. Use slot="graphic" or slot="actions".',o)}}}updated(e){super.updated(e),e.has("size")&&this.syncGraphicIconSize()}syncGraphicIconSize(){const e=this.querySelector(".btu-empty-state-graphic btu-icon");e&&e.setAttribute("size",N[this.size])}resolveHeadingLevel(){return z(this.headingLevel)?this.headingLevel:C[this.size]}renderHeading(e,i){if(!this.heading)return"";switch(e){case 1:return s`<h1 class="${i}" data-empty-state-internal>${this.heading}</h1>`;case 2:return s`<h2 class="${i}" data-empty-state-internal>${this.heading}</h2>`;case 3:return s`<h3 class="${i}" data-empty-state-internal>${this.heading}</h3>`;case 4:return s`<h4 class="${i}" data-empty-state-internal>${this.heading}</h4>`;case 5:return s`<h5 class="${i}" data-empty-state-internal>${this.heading}</h5>`;case 6:return s`<h6 class="${i}" data-empty-state-internal>${this.heading}</h6>`}}render(){const e=this.resolveHeadingLevel(),i=`btu-empty-state-title btu-heading-${e}`;return s`
|
|
2
|
+
<div class="btu-empty-state-graphic" data-empty-state-internal></div>
|
|
3
|
+
<div class="btu-empty-state-content" data-empty-state-internal>
|
|
4
|
+
${this.renderHeading(e,i)}
|
|
5
|
+
${this.description?s`<p class="btu-empty-state-description" data-empty-state-internal>${this.description}</p>`:""}
|
|
6
|
+
</div>
|
|
7
|
+
<btu-button-group
|
|
8
|
+
class="btu-empty-state-actions"
|
|
9
|
+
variant="spaced"
|
|
10
|
+
size="${this.size}"
|
|
11
|
+
data-empty-state-internal
|
|
12
|
+
></btu-button-group>
|
|
13
|
+
`}}y([g({type:String})],r.prototype,"heading");y([g({type:String})],r.prototype,"description");y([g({type:String})],r.prototype,"size");y([g({type:Number,attribute:"heading-level"})],r.prototype,"headingLevel");customElements.get("btu-empty-state")||customElements.define("btu-empty-state",r);const{events:L,args:I,argTypes:n}=w("btu-empty-state"),W=["sm","md","lg"],_=[1,2,3,4,5,6],j={title:"Components/Empty State",component:"btu-empty-state",tags:["autodocs"],parameters:{docs:{subtitle:"A standardized component for communicating the absence of content.",description:{component:`
|
|
2
14
|
<h3>When to use:</h3>
|
|
3
15
|
<ul>
|
|
4
16
|
<li>To communicate the absence of content in tables, lists, or search results</li>
|
|
@@ -19,13 +31,13 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
19
31
|
<li><strong>Description</strong> — via the <code>description</code> attribute</li>
|
|
20
32
|
<li><strong>Actions</strong> — <code>slot="actions"</code>: accepts buttons or links</li>
|
|
21
33
|
</ul>
|
|
22
|
-
`}},actions:{handles:
|
|
34
|
+
`}},actions:{handles:L},controls:{expanded:!0}},args:{...I,heading:"No results found",description:"Try adjusting your search or filter criteria to find what you are looking for.",size:"md"},argTypes:{...n,"--empty-state-max-width":{table:{disable:!0}},"--empty-state-color-heading":{table:{disable:!0}},"--empty-state-color-description":{table:{disable:!0}},heading:{...n.heading,control:{type:"text"},description:"Heading text displayed in the empty state."},description:{...n.description,control:{type:"text"},description:"Description text displayed below the heading."},size:{...n.size,control:{type:"select"},options:W,description:"Size variant affecting heading size, gaps, and description text."},"heading-level":{...n["heading-level"],control:{type:"select"},options:_,description:"Heading level (1-6). When set, overrides the size-based default (sm→5, md→4, lg→3) and drives both the semantic h1-h6 tag and the visual heading size."},maxWidth:{name:"--empty-state-max-width",control:{type:"text"},description:"Maximum width of the content block (default: min(75cqw, 360px))",table:{category:"css properties"}},colorHeading:{name:"--empty-state-color-heading",control:{type:"color"},description:"Heading text color (default: gray-900)",table:{category:"css properties"}},colorDescription:{name:"--empty-state-color-description",control:{type:"color"},description:"Description text color (default: gray-500)",table:{category:"css properties"}}},render:t=>{const e={};return t.maxWidth&&(e["--empty-state-max-width"]=t.maxWidth),t.colorHeading&&(e["--empty-state-color-heading"]=t.colorHeading),t.colorDescription&&(e["--empty-state-color-description"]=t.colorDescription),s`
|
|
23
35
|
<btu-empty-state
|
|
24
36
|
heading="${t.heading}"
|
|
25
37
|
description="${t.description||""}"
|
|
26
38
|
size="${t.size}"
|
|
27
|
-
heading-level="${
|
|
28
|
-
style=${
|
|
39
|
+
heading-level="${S(t["heading-level"])}"
|
|
40
|
+
style=${$(e)}
|
|
29
41
|
>
|
|
30
42
|
<btu-icon
|
|
31
43
|
slot="graphic"
|
|
@@ -38,7 +50,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
38
50
|
<btu-icon symbol="plus"></btu-icon>Create new
|
|
39
51
|
</button>
|
|
40
52
|
</btu-empty-state>
|
|
41
|
-
`}},
|
|
53
|
+
`}},c={args:{"heading-level":void 0}},l={args:{size:"sm",heading:"No items",description:"There are no items to display."},render:t=>s`
|
|
42
54
|
<btu-empty-state heading="${t.heading}" description="${t.description||""}" size="${t.size}">
|
|
43
55
|
<btu-icon
|
|
44
56
|
slot="graphic"
|
|
@@ -48,7 +60,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
48
60
|
></btu-icon>
|
|
49
61
|
<btu-icon-button tooltip="click to reload" symbol="refresh-ccw" slot="actions" size="sm"></btu-icon-button>
|
|
50
62
|
</btu-empty-state>
|
|
51
|
-
`,parameters:{docs:{description:{story:"Small variant with compact spacing. Best for panels, sidebars, and constrained spaces where a full-size empty state would be excessive."}}}},
|
|
63
|
+
`,parameters:{docs:{description:{story:"Small variant with compact spacing. Best for panels, sidebars, and constrained spaces where a full-size empty state would be excessive."}}}},d={args:{size:"lg",heading:"Welcome to your dashboard",description:"Get started by creating your first piece of content. You can always come back here to manage it."},render:t=>s`
|
|
52
64
|
<btu-empty-state heading="${t.heading}" description="${t.description||""}" size="${t.size}">
|
|
53
65
|
<btu-icon
|
|
54
66
|
slot="graphic"
|
|
@@ -58,12 +70,12 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
58
70
|
></btu-icon>
|
|
59
71
|
<button slot="actions" class="btu-button btu-button-primary">Get started</button>
|
|
60
72
|
</btu-empty-state>
|
|
61
|
-
`,parameters:{docs:{description:{story:"Large variant for full-page empty states. Ideal for dashboards, landing pages, and first-run experiences where the empty state is the primary content."}}}},
|
|
73
|
+
`,parameters:{docs:{description:{story:"Large variant for full-page empty states. Ideal for dashboards, landing pages, and first-run experiences where the empty state is the primary content."}}}},p={render:()=>s`
|
|
62
74
|
<btu-empty-state heading="No images uploaded" description="Upload images to see them displayed here." size="md">
|
|
63
75
|
<img slot="graphic" src="cloud-illustration.svg" alt="Cloud graphic" />
|
|
64
76
|
<button slot="actions" class="btu-button btu-button-primary">Upload image</button>
|
|
65
77
|
</btu-empty-state>
|
|
66
|
-
`,parameters:{docs:{description:{story:"Uses a custom SVG in the graphic slot instead of a `btu-icon`. The graphic container automatically sizes `img`, `picture`, and `svg` elements larger than icons."}}}},
|
|
78
|
+
`,parameters:{docs:{description:{story:"Uses a custom SVG in the graphic slot instead of a `btu-icon`. The graphic container automatically sizes `img`, `picture`, and `svg` elements larger than icons."}}}},u={render:()=>{const t=s`
|
|
67
79
|
<picture slot="graphic">
|
|
68
80
|
<img
|
|
69
81
|
srcset="
|
|
@@ -80,7 +92,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
80
92
|
loading="lazy"
|
|
81
93
|
/>
|
|
82
94
|
</picture>
|
|
83
|
-
`;return
|
|
95
|
+
`;return s`
|
|
84
96
|
<div style="display: flex; align-items: flex-start; gap: 1rem;">
|
|
85
97
|
<div style="width: 240px; border: 1px dashed oklch(var(--btu-theme-gray-300));">
|
|
86
98
|
<btu-empty-state heading="No results" description="Try a different query." size="sm">
|
|
@@ -109,13 +121,13 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
109
121
|
</btu-empty-state>
|
|
110
122
|
</div>
|
|
111
123
|
</div>
|
|
112
|
-
`},parameters:{docs:{description:{story:'Three empty-states rendered side-by-side in progressively wider containers (240 / 360 / 520px) at sizes `sm` / `md` / `lg`. Every instance uses the **same** `<picture>` markup — one `srcset` listing three SVGs (`box-illustration`, `cloud-illustration`, `docs-illustration`), each at `1x` and `2x` width descriptors, plus `sizes="auto"`. Because the graphic container sizes the `<img>` from the empty-state `size` prop (118 / 128 / 160 px), the browser selects a different SVG for each instance at both `devicePixelRatio: 1` and `2` — so all three SVGs are visible in the story regardless of display density. This demonstrates how a single `<picture>` + `srcset` can serve different sources per-instance without swapping markup.'}}}},
|
|
124
|
+
`},parameters:{docs:{description:{story:'Three empty-states rendered side-by-side in progressively wider containers (240 / 360 / 520px) at sizes `sm` / `md` / `lg`. Every instance uses the **same** `<picture>` markup — one `srcset` listing three SVGs (`box-illustration`, `cloud-illustration`, `docs-illustration`), each at `1x` and `2x` width descriptors, plus `sizes="auto"`. Because the graphic container sizes the `<img>` from the empty-state `size` prop (118 / 128 / 160 px), the browser selects a different SVG for each instance at both `devicePixelRatio: 1` and `2` — so all three SVGs are visible in the story regardless of display density. This demonstrates how a single `<picture>` + `srcset` can serve different sources per-instance without swapping markup.'}}}},m={render:()=>s`
|
|
113
125
|
<btu-empty-state
|
|
114
126
|
heading="No data available"
|
|
115
127
|
description="Check back later for updates."
|
|
116
128
|
size="sm"
|
|
117
129
|
></btu-empty-state>
|
|
118
|
-
`,parameters:{docs:{description:{story:"Text-only empty state with no graphic or actions. The graphic and actions containers collapse automatically via `:empty { display: none }`. Useful in tight spaces."}}}},
|
|
130
|
+
`,parameters:{docs:{description:{story:"Text-only empty state with no graphic or actions. The graphic and actions containers collapse automatically via `:empty { display: none }`. Useful in tight spaces."}}}},h={render:()=>s`
|
|
119
131
|
<btu-empty-state heading="No notifications" description="You are all caught up." size="md">
|
|
120
132
|
<btu-icon
|
|
121
133
|
slot="graphic"
|
|
@@ -124,7 +136,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
124
136
|
style="color: oklch(var(--btu-theme-gray-500))"
|
|
125
137
|
></btu-icon>
|
|
126
138
|
</btu-empty-state>
|
|
127
|
-
`,parameters:{docs:{description:{story:"Empty state without action buttons. The actions container collapses when empty. Useful for informational states where no user action is needed."}}}},
|
|
139
|
+
`,parameters:{docs:{description:{story:"Empty state without action buttons. The actions container collapses when empty. Useful for informational states where no user action is needed."}}}},b={render:()=>s`
|
|
128
140
|
<btu-empty-state heading="Empty" size="sm">
|
|
129
141
|
<btu-icon
|
|
130
142
|
slot="graphic"
|
|
@@ -134,11 +146,11 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
134
146
|
></btu-icon>
|
|
135
147
|
<button slot="actions" class="btu-button btu-button-success btu-button-sm">Add item</button>
|
|
136
148
|
</btu-empty-state>
|
|
137
|
-
`,parameters:{docs:{description:{story:"Empty state with heading and actions but no description. The description is omitted by not setting the `description` attribute."}}}};
|
|
149
|
+
`,parameters:{docs:{description:{story:"Empty state with heading and actions but no description. The description is omitted by not setting the `description` attribute."}}}};c.parameters={...c.parameters,docs:{...c.parameters?.docs,source:{originalSource:`{
|
|
138
150
|
args: {
|
|
139
151
|
'heading-level': undefined
|
|
140
152
|
}
|
|
141
|
-
}`,...
|
|
153
|
+
}`,...c.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
|
|
142
154
|
args: {
|
|
143
155
|
size: 'sm',
|
|
144
156
|
heading: 'No items',
|
|
@@ -162,7 +174,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
162
174
|
}
|
|
163
175
|
}
|
|
164
176
|
}
|
|
165
|
-
}`,...
|
|
177
|
+
}`,...l.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
166
178
|
args: {
|
|
167
179
|
size: 'lg',
|
|
168
180
|
heading: 'Welcome to your dashboard',
|
|
@@ -186,7 +198,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
186
198
|
}
|
|
187
199
|
}
|
|
188
200
|
}
|
|
189
|
-
}`,...
|
|
201
|
+
}`,...d.parameters?.docs?.source}}};p.parameters={...p.parameters,docs:{...p.parameters?.docs,source:{originalSource:`{
|
|
190
202
|
render: () => html\`
|
|
191
203
|
<btu-empty-state heading="No images uploaded" description="Upload images to see them displayed here." size="md">
|
|
192
204
|
<img slot="graphic" src="cloud-illustration.svg" alt="Cloud graphic" />
|
|
@@ -200,7 +212,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
200
212
|
}
|
|
201
213
|
}
|
|
202
214
|
}
|
|
203
|
-
}`,...
|
|
215
|
+
}`,...p.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
204
216
|
render: () => {
|
|
205
217
|
// Identical <picture> markup in each instance: one srcset listing 3 SVGs, each
|
|
206
218
|
// at two width descriptors (1x and 2x) so the selection holds at both DPR=1 and
|
|
@@ -263,7 +275,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
263
275
|
}
|
|
264
276
|
}
|
|
265
277
|
}
|
|
266
|
-
}`,...
|
|
278
|
+
}`,...u.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
267
279
|
render: () => html\`
|
|
268
280
|
<btu-empty-state
|
|
269
281
|
heading="No data available"
|
|
@@ -278,7 +290,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
278
290
|
}
|
|
279
291
|
}
|
|
280
292
|
}
|
|
281
|
-
}`,...
|
|
293
|
+
}`,...m.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
282
294
|
render: () => html\`
|
|
283
295
|
<btu-empty-state heading="No notifications" description="You are all caught up." size="md">
|
|
284
296
|
<btu-icon
|
|
@@ -296,7 +308,7 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
296
308
|
}
|
|
297
309
|
}
|
|
298
310
|
}
|
|
299
|
-
}`,...
|
|
311
|
+
}`,...h.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
|
|
300
312
|
render: () => html\`
|
|
301
313
|
<btu-empty-state heading="Empty" size="sm">
|
|
302
314
|
<btu-icon
|
|
@@ -315,4 +327,4 @@ import{g as u,x as e}from"./iframe-B9buZjP7.js";import{o as m}from"./if-defined-
|
|
|
315
327
|
}
|
|
316
328
|
}
|
|
317
329
|
}
|
|
318
|
-
}`,...
|
|
330
|
+
}`,...b.parameters?.docs?.source}}};const Z=["Default","Small","Large","WithImage","WithPicture","TextOnly","NoActions","NoDescription"];export{c as Default,d as Large,h as NoActions,b as NoDescription,l as Small,m as TextOnly,p as WithImage,u as WithPicture,Z as __namedExportsOrder,j as default};
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./lottie_svg-C3v6xdng.js","./iframe-DlBK9Drk.js","./preload-helper-PPVm8Dsz.js","./iframe-BzrT7trF.css"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as A,x as l,g as O}from"./iframe-DlBK9Drk.js";import{o as L}from"./style-map-DE4G47KD.js";import{_ as c}from"./preload-helper-PPVm8Dsz.js";import{n as w}from"./property-Bmq4RTSP.js";import{e as R,n as k}from"./ref-BhKk4SDh.js";import{E as M,R as C}from"./ReadyMixin-CvX_eidU.js";var $=Object.defineProperty,z=(e,t,a,o)=>{for(var s=void 0,r=e.length-1,n;r>=0;r--)(n=e[r])&&(s=n(t,a,s)||s);return s&&$(t,a,s),s};const f={idle:{play:!0,loop:!0,hold:"first",comp:619/664,art:{x:.0656,y:.1011,width:.8653,height:.7967}},wave:{play:!0,loop:!1,hold:"last",comp:1500/1400,art:{x:.1411,y:.1202,width:.7144,height:.7571}},search:{play:!0,loop:!0,hold:"first",comp:1500/1400,art:{x:.1411,y:.1214,width:.7144,height:.756}},complete:{play:!0,loop:!1,hold:"last",comp:1500/1400,art:{x:.1322,y:.1262,width:.7233,height:.7512}},glow:{play:!0,loop:!1,hold:"last",comp:1100/1026,art:{x:.2078,y:.1144,width:.7144,height:.7628},frames:[94,146]}},P={idle:()=>c(()=>import("./esca-idle-B-fumiIb.js"),[],import.meta.url).then(e=>e.default),wave:()=>c(()=>import("./esca-wave-Bjs4CUR7.js"),[],import.meta.url).then(e=>e.default),search:()=>c(()=>import("./esca-search-rwNfo19I.js"),[],import.meta.url).then(e=>e.default),complete:()=>c(()=>import("./esca-task-complete-BAJP2dY2.js"),[],import.meta.url).then(e=>e.default),glow:()=>c(()=>import("./esca-glow-BwdhBvIX.js"),[],import.meta.url).then(e=>e.default)};let D;const I=()=>D??=c(()=>import("./lottie_svg-C3v6xdng.js").then(e=>e.l),__vite__mapDeps([0,1,2,3]),import.meta.url),x={xs:"1.5rem",sm:"2.25rem",md:"2.5rem",lg:"3rem",xl:"3.5rem"},N=24;function V({comp:e,art:t}){const a=r=>`${(r*100).toFixed(4)}%`,o=1/t.width,s=o/e;return{position:"absolute",width:a(o),height:a(s),left:a(-t.x*o),top:a((1-t.height*s)/2-t.y*s)}}function g(e){return e!==null&&e!=="idle"&&e in f?e:"idle"}class _ extends M(C(A)){constructor(){super(...arguments),this.state="idle",this.size="md",this._containerRef=R(),this._animation=null,this._rendered=null,this._reduceMotion=!1,this._loadToken=0,this._onMotionChange=t=>{this._reduceMotion=t.matches,this._rendered=null,this._play()}}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.hasAttribute("role")||this.setAttribute("role","img"),this.hasAttribute("aria-label")||this.setAttribute("aria-label","Esca"),this.style.display||(this.style.display="inline-block"),getComputedStyle(this).position==="static"&&(this.style.position="relative"),this._applySize(),this._motionQuery=window.matchMedia?.("(prefers-reduced-motion: reduce)"),this._reduceMotion=this._motionQuery?.matches??!1,this._motionQuery?.addEventListener("change",this._onMotionChange),this.hasUpdated&&(this._observe(),this._rendered=null,this._play())}disconnectedCallback(){super.disconnectedCallback(),this._resizeObserver?.disconnect(),this._resizeObserver=void 0,this._intersectionObserver?.disconnect(),this._intersectionObserver=void 0,this._motionQuery?.removeEventListener("change",this._onMotionChange),this._destroy()}firstUpdated(t){super.firstUpdated(t),this._observe(),this.emit("btu-esca-avatar-ready")}_observe(){this._resizeObserver=new ResizeObserver(()=>this._animation?.resize()),this._containerRef.value&&this._resizeObserver.observe(this._containerRef.value),this._intersectionObserver=new IntersectionObserver(([t])=>{const a=this._animation;a&&(t.isIntersecting?(a.resize(),!this._reduceMotion&&f[g(this.state)].loop&&a.play()):f[g(this.state)].loop&&a.pause())}),this._intersectionObserver.observe(this)}updated(t){super.updated(t),t.has("state")&&this._play(),t.has("size")&&this._applySize()}render(){return l`<div ${k(this._containerRef)}></div>`}_applySize(){const t=x[this.size]??x.md;this.style.width=`var(--esca-avatar-size, ${t})`,this.style.height=`var(--esca-avatar-size, ${t})`}async _play(){if(!this._containerRef.value)return;const t=g(this.state);if(t===this._rendered&&this._animation)return;const a=++this._loadToken,[{default:o},s]=await Promise.all([I(),P[t]()]),r=this._containerRef.value;if(a!==this._loadToken||!r)return;this._rendered=t,this._destroy();const n=f[t],d=n.play&&!this._reduceMotion;Object.assign(r.style,V(n));const i=o.loadAnimation({container:r,renderer:"svg",loop:n.loop&&!this._reduceMotion,autoplay:d,animationData:structuredClone(s),...n.frames?{initialSegment:n.frames}:{}}),h=s.fr;h&&i.setSpeed(N/h);const p=()=>this.emit("btu-esca-avatar-complete",{state:t});d?n.loop||i.addEventListener("complete",p):i.addEventListener("DOMLoaded",()=>{const S=Math.max(0,i.getDuration(!0)-1);i.goToAndStop(n.hold==="last"?S:0,!0),n.play&&!n.loop&&p()}),this._animation=i,i.addEventListener("DOMLoaded",()=>i.resize())}_destroy(){this._animation?.destroy(),this._animation=null}}z([w({type:String,reflect:!0})],_.prototype,"state");z([w({type:String,reflect:!0})],_.prototype,"size");customElements.get("btu-esca-avatar")||customElements.define("btu-esca-avatar",_);const{events:F,args:U,argTypes:b}=O("btu-esca-avatar"),E=["idle","wave","search","complete","glow"],T=["xs","sm","md","lg","xl"],K={title:"Components/Esca/Avatar",component:"btu-esca-avatar",tags:["autodocs"],parameters:{docs:{subtitle:"The animated avatar for the Esca AI assistant",description:{component:`
|
|
3
|
+
<h3>When to use:</h3>
|
|
4
|
+
<ul>
|
|
5
|
+
<li>Alongside the Esca assistant's messages, in any chat surface</li>
|
|
6
|
+
<li>To signal what the assistant is doing: greeting, thinking, or done</li>
|
|
7
|
+
</ul>
|
|
8
|
+
|
|
9
|
+
<h3>States:</h3>
|
|
10
|
+
<ul>
|
|
11
|
+
<li><strong>idle:</strong> loops a subtle resting animation — the default state</li>
|
|
12
|
+
<li><strong>wave:</strong> plays once on open, then holds the last frame</li>
|
|
13
|
+
<li><strong>search:</strong> loops while the assistant generates a response</li>
|
|
14
|
+
<li><strong>complete:</strong> plays once when the response finishes, then holds</li>
|
|
15
|
+
<li><strong>glow:</strong> plays once, lighting Esca's lure — an alternative finish to <code>complete</code></li>
|
|
16
|
+
</ul>
|
|
17
|
+
|
|
18
|
+
<p>Drive it through the single <code>state</code> attribute. Reduced-motion users get a static frame instead of playback.</p>
|
|
19
|
+
|
|
20
|
+
<h3>Accessibility:</h3>
|
|
21
|
+
<ul>
|
|
22
|
+
<li>The avatar is a visual indicator, not a status channel. By default it exposes a static name (<code>role="img"</code>, <code>aria-label="Esca"</code>), set only when absent so you can override them.</li>
|
|
23
|
+
<li>When the assistant is already named in the surrounding UI (the common case in a chat), treat the avatar as decorative — set <code>aria-hidden="true"</code> to avoid a redundant announcement.</li>
|
|
24
|
+
<li>Don't convey activity (thinking / done) by changing this element's ARIA per <code>state</code> — a looping <code>search</code> would announce repeatedly. Surface status as text in a polite <code>aria-live</code> region owned by the chat UI. The component intentionally does not announce its own state.</li>
|
|
25
|
+
</ul>
|
|
26
|
+
`}},actions:{handles:F},controls:{expanded:!0}},args:{...U,state:"wave",size:"md"},argTypes:{...b,"--esca-avatar-size":{table:{disable:!0}},state:{...b.state,control:{type:"select"},options:E,description:"Animation to play. Changing this swaps the animation.",table:{category:"Attributes",defaultValue:{summary:"idle"}}},size:{...b.size,control:{type:"select"},options:T,description:"Avatar size scale (mirrors btu-avatar). Overridden by `--esca-avatar-size`.",table:{category:"Attributes",defaultValue:{summary:"md"}}},customSize:{name:"--esca-avatar-size",control:{type:"text"},description:'Width/height override (e.g. "3rem"). Beats the `size` attribute; default box is 2.5rem (md).',table:{category:"css properties"}}},render:e=>{const t={};return e.customSize&&(t["--esca-avatar-size"]=e.customSize),l`<btu-esca-avatar state="${e.state}" size="${e.size}" style=${L(t)}></btu-esca-avatar>`}},u={args:{},parameters:{docs:{description:{story:"Use the controls to switch between states and resize the avatar."}}}},m={render:()=>l`<div class="flex flex-row items-start gap-8">
|
|
27
|
+
${E.map(e=>l`
|
|
28
|
+
<div class="flex flex-col items-center gap-2">
|
|
29
|
+
<btu-esca-avatar state="${e}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
30
|
+
<span class="text-xs font-medium text-gray-700">${e}</span>
|
|
31
|
+
</div>
|
|
32
|
+
`)}
|
|
33
|
+
</div>`,parameters:{docs:{description:{story:"Every state side by side. All play on load; `idle` and `search` loop, the rest hold their last frame."}}}},v={render:()=>l`<div class="flex flex-row items-center gap-6">
|
|
34
|
+
${T.map(e=>l`
|
|
35
|
+
<div class="flex flex-col items-center gap-2">
|
|
36
|
+
<btu-esca-avatar state="search" size="${e}"></btu-esca-avatar>
|
|
37
|
+
<span class="text-xs text-gray-600">${e}</span>
|
|
38
|
+
</div>
|
|
39
|
+
`)}
|
|
40
|
+
</div>`,parameters:{docs:{description:{story:"The `size` scale (`xs`–`xl`), mirroring `<btu-avatar>`. For an arbitrary size, override with the `--esca-avatar-size` custom property."}}}},y={render:()=>{const e=document.createElement("div");e.className="flex flex-col items-start gap-4";const t=document.createElement("btu-esca-avatar");t.style.setProperty("--esca-avatar-size","4rem");const a=document.createElement("span");a.className="text-xs text-gray-600";const o=document.createElement("button");o.textContent="Replay",o.className="btu-button btu-button-gray rounded px-3 py-1 text-sm";let s;const r=i=>{a.textContent=i},n=()=>{clearTimeout(s),t.state="wave",r("state: wave — greeting on open")};t.addEventListener("btu-esca-avatar-complete",()=>{t.state==="wave"&&(t.state="search",r("state: search — generating a response"),s=setTimeout(()=>{t.state="complete",r("state: complete — response finished")},2500))}),o.addEventListener("click",n),e.append(t,a,o),queueMicrotask(n);const d=new MutationObserver(i=>{i.forEach(h=>h.removedNodes.forEach(p=>{(p===e||p.contains(e))&&(clearTimeout(s),d.disconnect())}))});return queueMicrotask(()=>{e.parentNode&&d.observe(e.parentNode,{childList:!0})}),e},parameters:{docs:{description:{story:"The full assistant flow driven by the `state` attribute: `wave` on open, then `search` while responding (advanced by the `btu-esca-avatar-complete` event), then `complete`. Click Replay to run it again."}}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
41
|
+
args: {},
|
|
42
|
+
parameters: {
|
|
43
|
+
docs: {
|
|
44
|
+
description: {
|
|
45
|
+
story: 'Use the controls to switch between states and resize the avatar.'
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}`,...u.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
50
|
+
render: () => html\`<div class="flex flex-row items-start gap-8">
|
|
51
|
+
\${stateOptions.map(state => html\`
|
|
52
|
+
<div class="flex flex-col items-center gap-2">
|
|
53
|
+
<btu-esca-avatar state="\${state}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
54
|
+
<span class="text-xs font-medium text-gray-700">\${state}</span>
|
|
55
|
+
</div>
|
|
56
|
+
\`)}
|
|
57
|
+
</div>\`,
|
|
58
|
+
parameters: {
|
|
59
|
+
docs: {
|
|
60
|
+
description: {
|
|
61
|
+
story: 'Every state side by side. All play on load; \`idle\` and \`search\` loop, the rest hold their last frame.'
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}`,...m.parameters?.docs?.source}}};v.parameters={...v.parameters,docs:{...v.parameters?.docs,source:{originalSource:`{
|
|
66
|
+
render: () => html\`<div class="flex flex-row items-center gap-6">
|
|
67
|
+
\${sizeOptions.map(size => html\`
|
|
68
|
+
<div class="flex flex-col items-center gap-2">
|
|
69
|
+
<btu-esca-avatar state="search" size="\${size}"></btu-esca-avatar>
|
|
70
|
+
<span class="text-xs text-gray-600">\${size}</span>
|
|
71
|
+
</div>
|
|
72
|
+
\`)}
|
|
73
|
+
</div>\`,
|
|
74
|
+
parameters: {
|
|
75
|
+
docs: {
|
|
76
|
+
description: {
|
|
77
|
+
story: 'The \`size\` scale (\`xs\`–\`xl\`), mirroring \`<btu-avatar>\`. For an arbitrary size, override with the \`--esca-avatar-size\` custom property.'
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}`,...v.parameters?.docs?.source}}};y.parameters={...y.parameters,docs:{...y.parameters?.docs,source:{originalSource:`{
|
|
82
|
+
render: () => {
|
|
83
|
+
const container = document.createElement('div');
|
|
84
|
+
container.className = 'flex flex-col items-start gap-4';
|
|
85
|
+
const avatar = document.createElement('btu-esca-avatar') as EscaAvatar;
|
|
86
|
+
avatar.style.setProperty('--esca-avatar-size', '4rem');
|
|
87
|
+
const status = document.createElement('span');
|
|
88
|
+
status.className = 'text-xs text-gray-600';
|
|
89
|
+
const replay = document.createElement('button');
|
|
90
|
+
replay.textContent = 'Replay';
|
|
91
|
+
replay.className = 'btu-button btu-button-gray rounded px-3 py-1 text-sm';
|
|
92
|
+
let searchTimer: ReturnType<typeof setTimeout> | undefined;
|
|
93
|
+
const setStatus = (text: string) => {
|
|
94
|
+
status.textContent = text;
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
// Mirrors a real exchange: greet on open, think while responding, then settle on completion.
|
|
98
|
+
const run = () => {
|
|
99
|
+
clearTimeout(searchTimer);
|
|
100
|
+
avatar.state = 'wave';
|
|
101
|
+
setStatus('state: wave — greeting on open');
|
|
102
|
+
};
|
|
103
|
+
avatar.addEventListener('btu-esca-avatar-complete', () => {
|
|
104
|
+
if (avatar.state === 'wave') {
|
|
105
|
+
avatar.state = 'search';
|
|
106
|
+
setStatus('state: search — generating a response');
|
|
107
|
+
searchTimer = setTimeout(() => {
|
|
108
|
+
avatar.state = 'complete';
|
|
109
|
+
setStatus('state: complete — response finished');
|
|
110
|
+
}, 2500);
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
replay.addEventListener('click', run);
|
|
114
|
+
container.append(avatar, status, replay);
|
|
115
|
+
queueMicrotask(run);
|
|
116
|
+
|
|
117
|
+
// Clear the pending timer when the story unmounts.
|
|
118
|
+
const observer = new MutationObserver(mutations => {
|
|
119
|
+
mutations.forEach(mutation => mutation.removedNodes.forEach(node => {
|
|
120
|
+
if (node === container || node.contains(container)) {
|
|
121
|
+
clearTimeout(searchTimer);
|
|
122
|
+
observer.disconnect();
|
|
123
|
+
}
|
|
124
|
+
}));
|
|
125
|
+
});
|
|
126
|
+
queueMicrotask(() => {
|
|
127
|
+
if (container.parentNode) observer.observe(container.parentNode, {
|
|
128
|
+
childList: true
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
return container;
|
|
132
|
+
},
|
|
133
|
+
parameters: {
|
|
134
|
+
docs: {
|
|
135
|
+
description: {
|
|
136
|
+
story: 'The full assistant flow driven by the \`state\` attribute: \`wave\` on open, then \`search\` while responding (advanced by the \`btu-esca-avatar-complete\` event), then \`complete\`. Click Replay to run it again.'
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}`,...y.parameters?.docs?.source}}};const Y=["Default","States","Sizes","Lifecycle"];export{u as Default,y as Lifecycle,v as Sizes,m as States,Y as __namedExportsOrder,K as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as d}from"./iframe-
|
|
1
|
+
import{x as d}from"./iframe-DlBK9Drk.js";import"./Badge-bWrvpEgX.js";import"./preload-helper-PPVm8Dsz.js";import"./property-Bmq4RTSP.js";import"./ReadyMixin-CvX_eidU.js";var n=Object.freeze,r=Object.defineProperty,s=(t,i)=>n(r(t,"raw",{value:n(t.slice())})),o;const b={title:"Mixins/Events",tags:["autodocs"],parameters:{docs:{subtitle:"Events inherited from EventEmitterMixin",description:{component:`
|
|
2
2
|
<h3>EventEmitterMixin Events</h3>
|
|
3
3
|
|
|
4
4
|
<p>All Brightspot UI components that extend EventEmitterMixin emit the following lifecycle events in addition to those inherited from LitElement. These events use CustomEvent and bubble through the DOM with <code>composed: true</code>, meaning they cross shadow DOM boundaries.</p>
|
|
@@ -105,4 +105,4 @@ import{x as d}from"./iframe-B9buZjP7.js";import"./preload-helper-PPVm8Dsz.js";va
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
}`,...e.parameters?.docs?.source}}};const
|
|
108
|
+
}`,...e.parameters?.docs?.source}}};const v=["EventEmitterMixin"];export{e as EventEmitterMixin,v as __namedExportsOrder,b as default};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{x as s}from"./iframe-
|
|
1
|
+
import{x as s}from"./iframe-DlBK9Drk.js";import"./preload-helper-PPVm8Dsz.js";const r=({size:t})=>s` <div class=${[`btu-heading-${t}`].join(" ")}>Heading</div> `,o={title:"CSS Plugins/Heading",component:"btu-heading",tags:["autodocs"],parameters:{docs:{subtitle:"This Tailwind CSS plugin provides the `.btu-heading` utility class for styling headings. It supports five different sizes, from 1 (largest) to 5 (smallest). Apply the class to `<h1>` through `<h5>` elements to style them accordingly."},controls:{expanded:!0}},render:t=>r(t),argTypes:{size:{control:{type:"range",min:1,max:5,step:1},description:"Heading size from 1 to 5, where 1 is the largest and 5 is the smallest."}},args:{size:1}},e={args:{}};e.parameters={...e.parameters,docs:{...e.parameters?.docs,source:{originalSource:`{
|
|
2
2
|
args: {}
|
|
3
3
|
}`,...e.parameters?.docs?.source}}};const n=["Default"];export{e as Default,n as __namedExportsOrder,o as default};
|
package/dist/storybook/assets/{HueRipple.stories-CwvtcOM_.js → HueRipple.stories-BPx5aSYd.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as i}from"./iframe-
|
|
1
|
+
import{x as i}from"./iframe-DlBK9Drk.js";import"./Avatar-C6Li1sPI.js";import"./Badge-bWrvpEgX.js";import"./Icon-CWyJRQf7.js";import{b as l}from"./ripple-CedcTXtA.js";import{B as e}from"./Button-DE0s-gat.js";import"./preload-helper-PPVm8Dsz.js";import"./property-Bmq4RTSP.js";import"./state-DVIUS0Gf.js";import"./ReadyMixin-CvX_eidU.js";import"./TooltipMixin-CVKslCDt.js";import"./position-CFNQy3J6.js";const x={title:"Effects/Hue Ripple",tags:["autodocs"],parameters:{docs:{subtitle:"Click anywhere to send a hue-shifting ripple across the viewport",description:{component:`
|
|
2
2
|
Uses the **View Transition API** to create an expanding ring that reveals OKLCH-shifted colors as it sweeps past each element, then they return to normal.
|
|
3
3
|
|
|
4
4
|
### Usage
|
|
@@ -307,4 +307,4 @@ btuRipple.setDefaults({ duration: 800, contrast: 2 })
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
}`,...t.parameters?.docs?.source}}};const
|
|
310
|
+
}`,...t.parameters?.docs?.source}}};const y=["Default"];export{t as Default,y as __namedExportsOrder,x as default};
|