@brightspot/ui 6.8.0 → 6.8.1
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/dist/storybook/assets/{ActionBar.stories-CJBn-mku.js → ActionBar.stories-BOXYJYXy.js} +31 -28
- package/dist/storybook/assets/ActionItem-WoDvowFu.js +16 -0
- package/dist/storybook/assets/{ActionItem.stories-DXzC9C1u.js → ActionItem.stories-CVFoWP54.js} +2 -2
- package/dist/storybook/assets/AiSparkle.stories-Psv9jNpy.js +73 -0
- package/dist/storybook/assets/Avatar-CIQcHS8b.js +4 -0
- package/dist/storybook/assets/Avatar.stories-BE2Xn8fx.js +213 -0
- package/dist/storybook/assets/AvatarGroup-Chs0VKPg.js +1 -0
- package/dist/storybook/assets/AvatarGroup.stories-2ar6gCeX.js +225 -0
- package/dist/storybook/assets/Badge-AV20mCMJ.js +1 -0
- package/dist/storybook/assets/{Badge.stories-DEpoJpUZ.js → Badge.stories-w9LqNw0A.js} +4 -4
- package/dist/storybook/assets/Banner-FSFX1AIb.css +1 -0
- package/dist/storybook/assets/{Banner.stories--jeU6fKq.js → Banner.stories-Clhh1bBs.js} +14 -14
- package/dist/storybook/assets/Button-B7fn_wd5.js +10 -0
- package/dist/storybook/assets/Button.stories-5h4M8nd2.js +54 -0
- package/dist/storybook/assets/ButtonGroup-BmndBsBy.js +1 -0
- package/dist/storybook/assets/{ButtonGroup.stories-CerE_0AC.js → ButtonGroup.stories-CR1H4H7u.js} +7 -7
- package/dist/storybook/assets/Card-DyntwdY-.css +1 -0
- package/dist/storybook/assets/{Card.stories-5SxHtU3Y.js → Card.stories-Bz5vXq5y.js} +60 -29
- package/dist/storybook/assets/{Celebrate.stories-COS789GX.js → Celebrate.stories-Bu3CNw0k.js} +5 -5
- package/dist/storybook/assets/Checkbox-BALsanB1.js +30 -0
- package/dist/storybook/assets/{Checkbox.stories-DuQu38Gv.js → Checkbox.stories-BdvCht5c.js} +10 -10
- package/dist/storybook/assets/CircularProgress-BeE2fWON.js +42 -0
- package/dist/storybook/assets/{CircularProgress.stories-Lf2Ws46Y.js → CircularProgress.stories-CL8Lc6eU.js} +2 -2
- package/dist/storybook/assets/ClipboardMixin-C6wcbXIO.js +1 -0
- package/dist/storybook/assets/{ClipboardMixin.stories-BT5KfLZ_.js → ClipboardMixin.stories-BsjzC7wd.js} +6 -6
- package/dist/storybook/assets/{Color-6BZIO3FS-BNBxjqrS.js → Color-6BZIO3FS-Dsd6EVV9.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-Ck6bXbd0.js → Colors.stories-CkCdNN9Y.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-DLELdAMr.js → CombinedEffects.stories-QG78pIiG.js} +2 -2
- package/dist/storybook/assets/{ComponentStatesMixin-B6uJL_2c.js → ComponentStatesMixin-CG-Dx_Vk.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-fiyrALkY.js → ComponentStatesMixin.stories-B1yuAqua.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-2OfBH19_.js → CopyToClipboard.stories-CyKcumJ9.js} +18 -10
- package/dist/storybook/assets/{Debounce.stories-C9qo3lIN.js → Debounce.stories-BuNskQ33.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-CBVYZYjR.js → DocsRenderer-LL677BLK-BrPyc8XX.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-15ZDMkRz.js → Dropdown.stories-DHXeP07z.js} +2 -2
- package/dist/storybook/assets/DropdownMenu-WoWnJiQk.js +42 -0
- package/dist/storybook/assets/EmptyState-h0A4Qpiu.css +1 -0
- package/dist/storybook/assets/{EmptyState.stories-Bjb8hzYj.js → EmptyState.stories-BRoVusey.js} +33 -21
- package/dist/storybook/assets/EscaAvatar.stories-CWAE-4Uz.js +140 -0
- package/dist/storybook/assets/{Events.stories-BV0vMF2I.js → Events.stories-D-npDwlx.js} +2 -2
- package/dist/storybook/assets/{Heading.stories-CEUJqUbQ.js → Heading.stories-D7hmvFEN.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-CwvtcOM_.js → HueRipple.stories-Dx3ozdHi.js} +2 -2
- package/dist/storybook/assets/Icon-DPQKiWDz.js +34409 -0
- package/dist/storybook/assets/{Icon.stories-AB_v-61c.js → Icon.stories-CVsQvcwd.js} +10 -10
- package/dist/storybook/assets/IconButton-Dp4Z06bL.js +12 -0
- package/dist/storybook/assets/{IconButton.stories-BHuHsM3k.js → IconButton.stories-DTbfHfcQ.js} +2 -2
- package/dist/storybook/assets/LinearProgress-DG3tPlGH.js +25 -0
- package/dist/storybook/assets/{LinearProgress.stories-BNN5SXe3.js → LinearProgress.stories-VIU6OqYd.js} +2 -2
- package/dist/storybook/assets/Message-BzkpGg8z.js +28 -0
- package/dist/storybook/assets/Message-CM3eexdu.css +1 -0
- package/dist/storybook/assets/{Message.stories-DdLhMXnb.js → Message.stories-C9bzoQes.js} +2 -2
- package/dist/storybook/assets/OnFindMixin-CeeYfx9k.js +1 -0
- package/dist/storybook/assets/{OnFindMixin.stories-B-5TeBOF.js → OnFindMixin.stories-Dq06nuVf.js} +9 -9
- package/dist/storybook/assets/Pagination-CnWa6AX5.js +88 -0
- package/dist/storybook/assets/{Pagination.stories-C9zsOdb2.js → Pagination.stories-BsH2eN2W.js} +33 -33
- package/dist/storybook/assets/{Popover.stories-BiqIwebU.js → Popover.stories-CLnzpgEE.js} +16 -16
- package/dist/storybook/assets/ProgressMixin-D1atDw3n.js +1 -0
- package/dist/storybook/assets/Radio-B6Aq6K0V.js +25 -0
- package/dist/storybook/assets/{Radio.stories-BmrEdPkm.js → Radio.stories-BCVbISmb.js} +6 -6
- package/dist/storybook/assets/{RadioGroup.stories-ChARVXs3.js → RadioGroup.stories-B-TGP_-v.js} +22 -22
- package/dist/storybook/assets/{ReadyMixin-BbuzH3uO.js → ReadyMixin-C8HW2nGE.js} +1 -1
- package/dist/storybook/assets/RovingTabindexMixin-DI5rmyR7.js +1 -0
- package/dist/storybook/assets/{RovingTabindexMixin.stories-xm4b394_.js → RovingTabindexMixin.stories-DVKCC_R7.js} +5 -5
- package/dist/storybook/assets/{Rtc.stories-DdcMaELA.js → Rtc.stories-bBYHOszW.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-CI67Ougx.js → ScrollShadow.stories-BIK8YINt.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-DOqrRkxc.js → Switch.stories-COEk74kM.js} +60 -27
- package/dist/storybook/assets/{Tab.stories-DN8o4cf_.js → Tab.stories-Dbt9JvSx.js} +7 -7
- package/dist/storybook/assets/Tabs-BIScOPS0.js +17 -0
- package/dist/storybook/assets/{Tabs.stories-BEowfCcl.js → Tabs.stories-CodKgVf2.js} +6 -6
- package/dist/storybook/assets/{Throttle.stories-BZ_nsuw1.js → Throttle.stories-BhIqWWrQ.js} +1 -1
- package/dist/storybook/assets/Tooltip.stories-DKD8nBM1.js +143 -0
- package/dist/storybook/assets/TooltipMixin-CRNNusJ7.js +1 -0
- package/dist/storybook/assets/{Upload.stories-sAEiabwq.js → Upload.stories-WTO15ST1.js} +102 -52
- package/dist/storybook/assets/UploadItem-DejgZ5A0.js +54 -0
- package/dist/storybook/assets/{UploadItem.stories-C19JMfmB.js → UploadItem.stories-Pk3ghOcI.js} +4 -4
- package/dist/storybook/assets/{Welcome.stories-C30jg0r1.js → Welcome.stories-DrNnxvt9.js} +9 -9
- package/dist/storybook/assets/Widget-elBzGg8w.css +1 -0
- package/dist/storybook/assets/Widget.stories-CYC5Qdac.js +279 -0
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-PFRy5maL.js → WithTooltip-65CFNBJE-DK6PZNaa.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-Dzcxb014.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-PioIuXjk.js} +1 -1
- package/dist/storybook/assets/i18n-BQ-Uj-0B.js +1 -0
- package/dist/storybook/assets/if-defined-DL7cQU7O.js +1 -0
- package/dist/storybook/assets/{iframe-B9buZjP7.js → iframe-Byo_x5o2.js} +24 -24
- package/dist/storybook/assets/{index-BdEHup-4.js → index-gox-Wle0.js} +1 -1
- package/dist/storybook/assets/lottie_svg-3t2UJxjZ.js +2 -0
- package/dist/storybook/assets/{onFind-CGzSFqNN.js → onFind-BWiaccUj.js} +1 -1
- package/dist/storybook/assets/{onFind.stories-Dq71qO14.js → onFind.stories-CC_XTN2G.js} +1 -1
- package/dist/storybook/assets/{onRemove.stories-B1GqLH_U.js → onRemove.stories-CXxpL4ud.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-BNKxOfLw.js → onVisible.stories-DKA9cexx.js} +1 -1
- package/dist/storybook/assets/property-_few0Xe5.js +1 -0
- package/dist/storybook/assets/ref-BaIdO8Sk.js +1 -0
- package/dist/storybook/assets/state-BBcPmYaV.js +1 -0
- package/dist/storybook/assets/{style-map-qCiIYcp5.js → style-map-DxZm5Cj7.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-CUM-CaRF.js → syntaxhighlighter-ED5Y7EFY-B0_bSGZz.js} +1 -1
- package/dist/storybook/iframe.html +1 -1
- package/dist/storybook/project.json +1 -1
- package/package.json +2 -1
- 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,54 +0,0 @@
|
|
|
1
|
-
import{B as a}from"./Button-2ucj5lUP.js";import"./iframe-B9buZjP7.js";import"./preload-helper-PPVm8Dsz.js";const i=["ai","black","white","primary","teal","gray","purple","rose","error","warning","success"],u={title:"CSS Plugins/Button",component:"btu-button",tags:["autodocs"],parameters:{docs:{subtitle:"This Tailwind CSS plugin provides the `.btu-button` utility class for styling buttons. Use it on `<button>` elements preferably, but it can also be used on `<a>` or other clickable elements. The plugin includes variants for different colors, sizes, and styles such as filled, outlined, and contained buttons."},controls:{expanded:!0}},render:r=>a(r),argTypes:{color:{control:{type:"select"},options:i},contained:{control:{type:"boolean"},description:"Does the button have a container?"},disabled:{control:{type:"boolean"},description:"Is the button disabled?"},fill:{control:{type:"boolean"},description:"Is the button filled?"},hideText:{control:{type:"boolean"},description:"Icon only mode (hides label)"},icon:{control:{type:"text"},description:'Lucide icon name (e.g., "search", "smile", "check")'},label:{control:{type:"text"},description:"Button label text"},outlined:{control:{type:"boolean"},description:"Is the button outlined?"},pressed:{control:{type:"boolean"},description:"Is the button pressed?"},size:{control:{type:"select"},options:["sm","md","lg","xl","2xl"]}},args:{color:"primary",contained:!0,disabled:!1,fill:!0,hideText:!1,icon:"",label:"Button",outlined:!1,pressed:!1,size:"md"}},e={args:{}},t={args:{label:"Search",icon:"search"},parameters:{docs:{description:{story:"Button with an icon alongside text. Uses the `<btu-icon>` component."}}}},s={args:{icon:"smile",hideText:!0},parameters:{docs:{description:{story:"Icon-only button. Uses `btu-button-text-hidden` to hide the label and `<btu-icon>` for the icon."}}}},o={args:{label:"Disabled Button",disabled:!0},parameters:{docs:{description:{story:"Disabled button state. Uses the `[disabled]` attribute to trigger disabled styling with reduced opacity and pointer events disabled."}}}},n={args:{label:"Active Button",pressed:!0,fill:!1,icon:"check",hideText:!0},parameters:{docs:{description:{story:'Active/pressed button state. Uses `[aria-pressed="true"]` attribute to trigger the pressed styling, typically used for toggle buttons or to show an active state.'}}}};e.parameters={...e.parameters,docs:{...e.parameters?.docs,source:{originalSource:`{
|
|
2
|
-
args: {}
|
|
3
|
-
}`,...e.parameters?.docs?.source}}};t.parameters={...t.parameters,docs:{...t.parameters?.docs,source:{originalSource:`{
|
|
4
|
-
args: {
|
|
5
|
-
label: 'Search',
|
|
6
|
-
icon: 'search'
|
|
7
|
-
},
|
|
8
|
-
parameters: {
|
|
9
|
-
docs: {
|
|
10
|
-
description: {
|
|
11
|
-
story: \`Button with an icon alongside text. Uses the \\\`<btu-icon>\\\` component.\`
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}`,...t.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
16
|
-
args: {
|
|
17
|
-
icon: 'smile',
|
|
18
|
-
hideText: true
|
|
19
|
-
},
|
|
20
|
-
parameters: {
|
|
21
|
-
docs: {
|
|
22
|
-
description: {
|
|
23
|
-
story: \`Icon-only button. Uses \\\`btu-button-text-hidden\\\` to hide the label and \\\`<btu-icon>\\\` for the icon.\`
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
}`,...s.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
28
|
-
args: {
|
|
29
|
-
label: 'Disabled Button',
|
|
30
|
-
disabled: true
|
|
31
|
-
},
|
|
32
|
-
parameters: {
|
|
33
|
-
docs: {
|
|
34
|
-
description: {
|
|
35
|
-
story: \`Disabled button state. Uses the \\\`[disabled]\\\` attribute to trigger disabled styling with reduced opacity and pointer events disabled.\`
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}`,...o.parameters?.docs?.source}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
40
|
-
args: {
|
|
41
|
-
label: 'Active Button',
|
|
42
|
-
pressed: true,
|
|
43
|
-
fill: false,
|
|
44
|
-
icon: 'check',
|
|
45
|
-
hideText: true
|
|
46
|
-
},
|
|
47
|
-
parameters: {
|
|
48
|
-
docs: {
|
|
49
|
-
description: {
|
|
50
|
-
story: \`Active/pressed button state. Uses \\\`[aria-pressed="true"]\\\` attribute to trigger the pressed styling, typically used for toggle buttons or to show an active state.\`
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}`,...n.parameters?.docs?.source}}};const p=["Default","WithIcon","IconOnly","Disabled","ActivePressed"];export{n as ActivePressed,e as Default,o as Disabled,s as IconOnly,t as WithIcon,p as __namedExportsOrder,u as default};
|
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
import{g as f,x as a}from"./iframe-B9buZjP7.js";import{o as x}from"./style-map-qCiIYcp5.js";import"./preload-helper-PPVm8Dsz.js";const{events:w,args:z,argTypes:m}=f("btu-esca-avatar"),g=["idle","wave","search","complete","glow"],y=["xs","sm","md","lg","xl"],$={title:"Components/Esca/Avatar",component:"btu-esca-avatar",tags:["autodocs"],parameters:{docs:{subtitle:"The animated avatar for the Esca AI assistant",description:{component:`
|
|
2
|
-
<h3>When to use:</h3>
|
|
3
|
-
<ul>
|
|
4
|
-
<li>Alongside the Esca assistant's messages, in any chat surface</li>
|
|
5
|
-
<li>To signal what the assistant is doing: greeting, thinking, or done</li>
|
|
6
|
-
</ul>
|
|
7
|
-
|
|
8
|
-
<h3>States:</h3>
|
|
9
|
-
<ul>
|
|
10
|
-
<li><strong>idle:</strong> loops a subtle resting animation — the default state</li>
|
|
11
|
-
<li><strong>wave:</strong> plays once on open, then holds the last frame</li>
|
|
12
|
-
<li><strong>search:</strong> loops while the assistant generates a response</li>
|
|
13
|
-
<li><strong>complete:</strong> plays once when the response finishes, then holds</li>
|
|
14
|
-
<li><strong>glow:</strong> plays once, lighting Esca's lure — an alternative finish to <code>complete</code></li>
|
|
15
|
-
</ul>
|
|
16
|
-
|
|
17
|
-
<p>Drive it through the single <code>state</code> attribute. Reduced-motion users get a static frame instead of playback.</p>
|
|
18
|
-
|
|
19
|
-
<h3>Accessibility:</h3>
|
|
20
|
-
<ul>
|
|
21
|
-
<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>
|
|
22
|
-
<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>
|
|
23
|
-
<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>
|
|
24
|
-
</ul>
|
|
25
|
-
`}},actions:{handles:w},controls:{expanded:!0}},args:{...z,state:"wave",size:"md"},argTypes:{...m,"--esca-avatar-size":{table:{disable:!0}},state:{...m.state,control:{type:"select"},options:g,description:"Animation to play. Changing this swaps the animation.",table:{category:"Attributes",defaultValue:{summary:"idle"}}},size:{...m.size,control:{type:"select"},options:y,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),a`<btu-esca-avatar state="${e.state}" size="${e.size}" style=${x(t)}></btu-esca-avatar>`}},n={args:{},parameters:{docs:{description:{story:"Use the controls to switch between states and resize the avatar."}}}},r={render:()=>a`<div class="flex flex-row items-start gap-8">
|
|
26
|
-
${g.map(e=>a`
|
|
27
|
-
<div class="flex flex-col items-center gap-2">
|
|
28
|
-
<btu-esca-avatar state="${e}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
29
|
-
<span class="text-xs font-medium text-gray-700">${e}</span>
|
|
30
|
-
</div>
|
|
31
|
-
`)}
|
|
32
|
-
</div>`,parameters:{docs:{description:{story:"Every state side by side. All play on load; `idle` and `search` loop, the rest hold their last frame."}}}},o={render:()=>a`<div class="flex flex-row items-center gap-6">
|
|
33
|
-
${y.map(e=>a`
|
|
34
|
-
<div class="flex flex-col items-center gap-2">
|
|
35
|
-
<btu-esca-avatar state="search" size="${e}"></btu-esca-avatar>
|
|
36
|
-
<span class="text-xs text-gray-600">${e}</span>
|
|
37
|
-
</div>
|
|
38
|
-
`)}
|
|
39
|
-
</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."}}}},i={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 c=document.createElement("span");c.className="text-xs text-gray-600";const s=document.createElement("button");s.textContent="Replay",s.className="btu-button btu-button-gray rounded px-3 py-1 text-sm";let l;const d=p=>{c.textContent=p},u=()=>{clearTimeout(l),t.state="wave",d("state: wave — greeting on open")};t.addEventListener("btu-esca-avatar-complete",()=>{t.state==="wave"&&(t.state="search",d("state: search — generating a response"),l=setTimeout(()=>{t.state="complete",d("state: complete — response finished")},2500))}),s.addEventListener("click",u),e.append(t,c,s),queueMicrotask(u);const h=new MutationObserver(p=>{p.forEach(b=>b.removedNodes.forEach(v=>{(v===e||v.contains(e))&&(clearTimeout(l),h.disconnect())}))});return queueMicrotask(()=>{e.parentNode&&h.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."}}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
40
|
-
args: {},
|
|
41
|
-
parameters: {
|
|
42
|
-
docs: {
|
|
43
|
-
description: {
|
|
44
|
-
story: 'Use the controls to switch between states and resize the avatar.'
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
48
|
-
}`,...n.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
49
|
-
render: () => html\`<div class="flex flex-row items-start gap-8">
|
|
50
|
-
\${stateOptions.map(state => html\`
|
|
51
|
-
<div class="flex flex-col items-center gap-2">
|
|
52
|
-
<btu-esca-avatar state="\${state}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
53
|
-
<span class="text-xs font-medium text-gray-700">\${state}</span>
|
|
54
|
-
</div>
|
|
55
|
-
\`)}
|
|
56
|
-
</div>\`,
|
|
57
|
-
parameters: {
|
|
58
|
-
docs: {
|
|
59
|
-
description: {
|
|
60
|
-
story: 'Every state side by side. All play on load; \`idle\` and \`search\` loop, the rest hold their last frame.'
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}`,...r.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
65
|
-
render: () => html\`<div class="flex flex-row items-center gap-6">
|
|
66
|
-
\${sizeOptions.map(size => html\`
|
|
67
|
-
<div class="flex flex-col items-center gap-2">
|
|
68
|
-
<btu-esca-avatar state="search" size="\${size}"></btu-esca-avatar>
|
|
69
|
-
<span class="text-xs text-gray-600">\${size}</span>
|
|
70
|
-
</div>
|
|
71
|
-
\`)}
|
|
72
|
-
</div>\`,
|
|
73
|
-
parameters: {
|
|
74
|
-
docs: {
|
|
75
|
-
description: {
|
|
76
|
-
story: 'The \`size\` scale (\`xs\`–\`xl\`), mirroring \`<btu-avatar>\`. For an arbitrary size, override with the \`--esca-avatar-size\` custom property.'
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
}`,...o.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
81
|
-
render: () => {
|
|
82
|
-
const container = document.createElement('div');
|
|
83
|
-
container.className = 'flex flex-col items-start gap-4';
|
|
84
|
-
const avatar = document.createElement('btu-esca-avatar') as EscaAvatar;
|
|
85
|
-
avatar.style.setProperty('--esca-avatar-size', '4rem');
|
|
86
|
-
const status = document.createElement('span');
|
|
87
|
-
status.className = 'text-xs text-gray-600';
|
|
88
|
-
const replay = document.createElement('button');
|
|
89
|
-
replay.textContent = 'Replay';
|
|
90
|
-
replay.className = 'btu-button btu-button-gray rounded px-3 py-1 text-sm';
|
|
91
|
-
let searchTimer: ReturnType<typeof setTimeout> | undefined;
|
|
92
|
-
const setStatus = (text: string) => {
|
|
93
|
-
status.textContent = text;
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
// Mirrors a real exchange: greet on open, think while responding, then settle on completion.
|
|
97
|
-
const run = () => {
|
|
98
|
-
clearTimeout(searchTimer);
|
|
99
|
-
avatar.state = 'wave';
|
|
100
|
-
setStatus('state: wave — greeting on open');
|
|
101
|
-
};
|
|
102
|
-
avatar.addEventListener('btu-esca-avatar-complete', () => {
|
|
103
|
-
if (avatar.state === 'wave') {
|
|
104
|
-
avatar.state = 'search';
|
|
105
|
-
setStatus('state: search — generating a response');
|
|
106
|
-
searchTimer = setTimeout(() => {
|
|
107
|
-
avatar.state = 'complete';
|
|
108
|
-
setStatus('state: complete — response finished');
|
|
109
|
-
}, 2500);
|
|
110
|
-
}
|
|
111
|
-
});
|
|
112
|
-
replay.addEventListener('click', run);
|
|
113
|
-
container.append(avatar, status, replay);
|
|
114
|
-
queueMicrotask(run);
|
|
115
|
-
|
|
116
|
-
// Clear the pending timer when the story unmounts.
|
|
117
|
-
const observer = new MutationObserver(mutations => {
|
|
118
|
-
mutations.forEach(mutation => mutation.removedNodes.forEach(node => {
|
|
119
|
-
if (node === container || node.contains(container)) {
|
|
120
|
-
clearTimeout(searchTimer);
|
|
121
|
-
observer.disconnect();
|
|
122
|
-
}
|
|
123
|
-
}));
|
|
124
|
-
});
|
|
125
|
-
queueMicrotask(() => {
|
|
126
|
-
if (container.parentNode) observer.observe(container.parentNode, {
|
|
127
|
-
childList: true
|
|
128
|
-
});
|
|
129
|
-
});
|
|
130
|
-
return container;
|
|
131
|
-
},
|
|
132
|
-
parameters: {
|
|
133
|
-
docs: {
|
|
134
|
-
description: {
|
|
135
|
-
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.'
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
}`,...i.parameters?.docs?.source}}};const k=["Default","States","Sizes","Lifecycle"];export{n as Default,i as Lifecycle,o as Sizes,r as States,k as __namedExportsOrder,$ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const o="1.60.0",s={version:o},c=s.version;export{c as L};
|
|
@@ -1,143 +0,0 @@
|
|
|
1
|
-
import{ah as v,ai as x,x as c,i as w}from"./iframe-B9buZjP7.js";import{t as E}from"./custom-element-UsVr97OX.js";import{o as T}from"./if-defined-BwWBCoAU.js";import{o as k}from"./style-map-qCiIYcp5.js";import{E as C,R as L}from"./ReadyMixin-BbuzH3uO.js";import"./preload-helper-PPVm8Dsz.js";const D={attribute:!0,type:String,converter:x,reflect:!1,hasChanged:v},S=(o=D,i,l)=>{const{kind:t,metadata:e}=l;let s=globalThis.litPropertyMetadata.get(e);if(s===void 0&&globalThis.litPropertyMetadata.set(e,s=new Map),t==="setter"&&((o=Object.create(o)).wrapped=!0),s.set(l.name,o),t==="accessor"){const{name:r}=l;return{set(n){const g=i.get.call(this);i.set.call(this,n),this.requestUpdate(r,g,o)},init(n){return n!==void 0&&this.C(r,void 0,o,n),n}}}if(t==="setter"){const{name:r}=l;return function(n){const g=this[r];i.call(this,n),this.requestUpdate(r,g,o)}}throw Error("Unsupported decorator location: "+t)};function p(o){return(i,l)=>typeof l=="object"?S(o,i,l):((t,e,s)=>{const r=e.hasOwnProperty(s);return e.constructor.createProperty(s,t),r?Object.getOwnPropertyDescriptor(e,s):void 0})(o,i,l)}var A=Object.defineProperty,a=(o,i,l,t)=>{for(var e=void 0,s=o.length-1,r;s>=0;s--)(r=o[s])&&(e=r(i,l,e)||e);return e&&A(i,l,e),e};const M={top:"btu-tooltip-top",bottom:"btu-tooltip-bottom",left:"btu-tooltip-left",right:"btu-tooltip-right"},_={sm:"btu-tooltip-offset-sm",md:"btu-tooltip-offset-md",lg:"btu-tooltip-offset-lg",xl:"btu-tooltip-offset-xl"},O=o=>{class i extends o{constructor(){super(...arguments),this.tooltip="",this.tooltipPosition="top",this.tooltipDelay=300,this.tooltipOffset=null,this.tooltipNoArrow=!1,this.tooltipTrigger="hover focus",this._tooltipEl=null,this._tooltipId=`btu-tooltip-${crypto.randomUUID()}`,this._anchorName=`--btu-trigger-${crypto.randomUUID()}`,this._showTimer=null,this._isVisible=!1,this._activeTriggers=new Set,this._onMouseEnter=this._handleMouseEnter.bind(this),this._onMouseLeave=this._handleMouseLeave.bind(this),this._onFocusIn=this._handleFocusIn.bind(this),this._onFocusOut=this._handleFocusOut.bind(this),this._onClick=this._handleClick.bind(this),this._onNativeToggle=this._handleNativeToggle.bind(this),this._onKeyDown=this._handleKeyDown.bind(this),this._onDocumentClick=null}connectedCallback(){super.connectedCallback(),this._bindTriggerListeners()}disconnectedCallback(){if(this._clearShowTimer(),this._removeDocumentClickListener(),this._unbindTriggerListeners(),this._tooltipEl){try{this._tooltipEl.hidePopover()}catch(t){t instanceof DOMException&&t.name==="InvalidStateError"||console.warn("[btu-tooltip] Failed to hide tooltip during disconnect:",t)}this._tooltipEl.removeEventListener("toggle",this._onNativeToggle),this._tooltipEl.remove(),this._tooltipEl=null}this._removeAriaDescribedBy(),this.style.removeProperty("anchor-name"),this._isVisible=!1,super.disconnectedCallback()}updated(t){super.updated(t),t.has("tooltipTrigger")&&(this._unbindTriggerListeners(),this._bindTriggerListeners(),this._tooltipEl&&(this._isVisible&&this._hide(),this._tooltipEl.setAttribute("popover",this._getPopoverMode()))),(t.has("tooltip")||t.has("tooltipPosition")||t.has("tooltipDelay")||t.has("tooltipOffset")||t.has("tooltipNoArrow"))&&this._syncTooltipElement()}_getPopoverMode(){return"manual"}_syncTooltipElement(){if(!this.tooltip){this._tooltipEl&&(this._hide(),this._tooltipEl.removeEventListener("toggle",this._onNativeToggle),this._tooltipEl.remove(),this._tooltipEl=null,this._removeAriaDescribedBy(),this.style.removeProperty("anchor-name"),document.removeEventListener("keydown",this._onKeyDown));return}this.style.setProperty("anchor-name",this._anchorName),this._tooltipEl||(this._tooltipEl=this._createTooltipElement(),this.appendChild(this._tooltipEl),this._appendAriaDescribedBy(),document.addEventListener("keydown",this._onKeyDown)),this._tooltipEl.textContent=this.tooltip,this._tooltipEl.className=this._buildTooltipClasses()}_createTooltipElement(){const t=document.createElement("div");return t.id=this._tooltipId,t.className=this._buildTooltipClasses(),t.setAttribute("role","tooltip"),t.setAttribute("data-tooltip-internal",""),t.setAttribute("popover",this._getPopoverMode()),t.style.setProperty("position-anchor",this._anchorName),t.textContent=this.tooltip,t.addEventListener("toggle",this._onNativeToggle),t}_buildTooltipClasses(){const t=["btu-tooltip",M[this.tooltipPosition]];return this.tooltipOffset&&_[this.tooltipOffset]&&t.push(_[this.tooltipOffset]),this.tooltipNoArrow&&t.push("btu-tooltip-no-arrow"),t.join(" ")}_hasTrigger(t){return this._activeTriggers.has(t)}_bindTriggerListeners(){const t=new Set(["hover","focus","click"]);this._activeTriggers=new Set(this.tooltipTrigger.trim().split(/\s+/));for(const e of this._activeTriggers)t.has(e)||console.warn(`[btu-tooltip] Unrecognized tooltip-trigger value: "${e}". Valid values: hover, focus, click.`);this._hasTrigger("hover")&&(this.addEventListener("mouseenter",this._onMouseEnter),this.addEventListener("mouseleave",this._onMouseLeave)),this._hasTrigger("focus")&&(this.addEventListener("focusin",this._onFocusIn),this.addEventListener("focusout",this._onFocusOut)),this._hasTrigger("click")&&this.addEventListener("click",this._onClick)}_unbindTriggerListeners(){this.removeEventListener("mouseenter",this._onMouseEnter),this.removeEventListener("mouseleave",this._onMouseLeave),this.removeEventListener("focusin",this._onFocusIn),this.removeEventListener("focusout",this._onFocusOut),this.removeEventListener("click",this._onClick),document.removeEventListener("keydown",this._onKeyDown)}_show(){if(!(this._isVisible||!this._tooltipEl)){try{this._tooltipEl.showPopover()}catch(t){t instanceof DOMException&&t.name==="InvalidStateError"||console.warn("[btu-tooltip] Failed to show tooltip:",t)}this._hasTrigger("click")&&setTimeout(()=>{this._removeDocumentClickListener(),this._onDocumentClick=t=>{const e=t.composedPath();!e.includes(this)&&(!this._tooltipEl||!e.includes(this._tooltipEl))&&this._hide()},document.addEventListener("click",this._onDocumentClick)},0)}}_hide(){if(this._clearShowTimer(),this._removeDocumentClickListener(),!(!this._isVisible||!this._tooltipEl))try{this._tooltipEl.hidePopover()}catch(t){t instanceof DOMException&&t.name==="InvalidStateError"||console.warn("[btu-tooltip] Failed to hide tooltip:",t)}}_removeDocumentClickListener(){this._onDocumentClick&&(document.removeEventListener("click",this._onDocumentClick),this._onDocumentClick=null)}_handleNativeToggle(t){const{newState:e}=t;this._isVisible=e==="open";const s=this._isVisible?"btu-tooltip-show":"btu-tooltip-hide",r=new CustomEvent(s,{bubbles:!0,composed:!0});this.dispatchEvent(r)}_handleKeyDown(t){t.key==="Escape"&&(this._clearShowTimer(),this._hide())}_clearShowTimer(){this._showTimer!==null&&(clearTimeout(this._showTimer),this._showTimer=null)}_handleMouseEnter(){this._clearShowTimer(),this._showTimer=setTimeout(()=>{this._show()},this.tooltipDelay)}_handleMouseLeave(){this._clearShowTimer(),this._hide()}_handleFocusIn(){this._clearShowTimer(),this._show()}_handleFocusOut(){this._clearShowTimer(),this._hide()}_handleClick(){this._clearShowTimer(),this._isVisible?this._hide():this._show()}_appendAriaDescribedBy(){const t=this.getAttribute("aria-describedby");t?t.includes(this._tooltipId)||this.setAttribute("aria-describedby",`${t} ${this._tooltipId}`):this.setAttribute("aria-describedby",this._tooltipId)}_removeAriaDescribedBy(){const t=this.getAttribute("aria-describedby");if(!t)return;const e=t.split(/\s+/).filter(s=>s!==this._tooltipId).join(" ").trim();e?this.setAttribute("aria-describedby",e):this.removeAttribute("aria-describedby")}}return a([p({attribute:"tooltip"})],i.prototype,"tooltip"),a([p({attribute:"tooltip-position"})],i.prototype,"tooltipPosition"),a([p({attribute:"tooltip-delay",type:Number})],i.prototype,"tooltipDelay"),a([p({attribute:"tooltip-offset"})],i.prototype,"tooltipOffset"),a([p({attribute:"tooltip-no-arrow",type:Boolean})],i.prototype,"tooltipNoArrow"),a([p({attribute:"tooltip-trigger"})],i.prototype,"tooltipTrigger"),i};var P=Object.defineProperty,$=Object.getOwnPropertyDescriptor,y=(o,i,l,t)=>{for(var e=t>1?void 0:t?$(i,l):i,s=o.length-1,r;s>=0;s--)(r=o[s])&&(e=(t?r(i,l,e):r(e))||e);return t&&e&&P(i,l,e),e};let b=class extends O(C(L(w))){constructor(){super(...arguments),this.label="Hover me",this.initialClasses=[]}connectedCallback(){super.connectedCallback(),this.className&&(this.initialClasses=this.className.split(" ").filter(o=>o.trim()))}createRenderRoot(){return this}willUpdate(){const o=[...this.initialClasses,"tooltip-demo"];this.className=o.filter(Boolean).join(" ")}render(){return c`${this.label}`}};y([p({type:String})],b.prototype,"label",2);b=y([E("tooltip-demo")],b);const f=`
|
|
2
|
-
.tooltip-demo {
|
|
3
|
-
display: inline-flex;
|
|
4
|
-
align-items: center;
|
|
5
|
-
justify-content: center;
|
|
6
|
-
padding: 0.5rem 1rem;
|
|
7
|
-
border-radius: 0.375rem;
|
|
8
|
-
background-color: oklch(var(--btu-theme-gray-100));
|
|
9
|
-
color: oklch(var(--btu-theme-gray-700));
|
|
10
|
-
font-weight: 500;
|
|
11
|
-
font-size: 0.875rem;
|
|
12
|
-
cursor: default;
|
|
13
|
-
user-select: none;
|
|
14
|
-
}
|
|
15
|
-
`,V={title:"Mixins/Tooltip",tags:["autodocs"],parameters:{docs:{subtitle:"Declarative tooltip support for any LitElement component",description:{component:`
|
|
16
|
-
\`TooltipMixin\` adds declarative tooltip support to any LitElement component using CSS anchor positioning and the Popover API.
|
|
17
|
-
|
|
18
|
-
<h3>Opt-in Pattern</h3>
|
|
19
|
-
|
|
20
|
-
\`\`\`typescript
|
|
21
|
-
class MyComponent extends TooltipMixin(EventEmitterMixin(ReadyMixin(LitElement))) {
|
|
22
|
-
// Component now supports tooltip attributes
|
|
23
|
-
}
|
|
24
|
-
\`\`\`
|
|
25
|
-
|
|
26
|
-
\`\`\`html
|
|
27
|
-
<my-component tooltip="Hello!" tooltip-position="bottom"></my-component>
|
|
28
|
-
\`\`\`
|
|
29
|
-
|
|
30
|
-
<h3>Appearance</h3>
|
|
31
|
-
|
|
32
|
-
The tooltip surface is inverted by default — a dark chip on light pages and a light chip on dark pages — using the mode-flipping black/white tokens. Recolor a specific tooltip via <code>--tooltip-color-background</code> / <code>--tooltip-color-text</code>.
|
|
33
|
-
|
|
34
|
-
<h3>Accessibility</h3>
|
|
35
|
-
<ul>
|
|
36
|
-
<li><code>role="tooltip"</code> on tooltip element</li>
|
|
37
|
-
<li><code>aria-describedby</code> on host links to tooltip (appends to existing value)</li>
|
|
38
|
-
<li>Shows on <code>focusin</code>, hides on <code>focusout</code> and <code>Escape</code></li>
|
|
39
|
-
<li><code>prefers-reduced-motion: reduce</code> disables slide animation</li>
|
|
40
|
-
</ul>
|
|
41
|
-
`}},controls:{expanded:!0}},args:{tooltip:"This is a tooltip","tooltip-position":"top","tooltip-delay":300,"tooltip-no-arrow":!1,"tooltip-trigger":"hover focus",label:"Hover me"},argTypes:{tooltip:{control:{type:"text"},description:"Tooltip text. No tooltip rendered when empty.",table:{category:"Attributes"}},"tooltip-position":{control:{type:"select"},options:["top","bottom","left","right"],description:"Preferred placement (auto-flips if viewport constrained)",table:{category:"Attributes"}},"tooltip-delay":{control:{type:"number"},description:"Delay before showing tooltip on hover (ms)",table:{category:"Attributes"}},"tooltip-offset":{control:{type:"select"},options:["sm","md","lg","xl"],description:"Gap between trigger and tooltip (sm=4px, md=8px, lg=12px, xl=16px)",table:{category:"Attributes"}},"tooltip-no-arrow":{control:{type:"boolean"},description:"Hide the arrow pseudo-element",table:{category:"Attributes"}},"tooltip-trigger":{control:{type:"select"},options:["hover focus","hover","focus","click","hover click"],description:"How the tooltip is activated (combinable triggers)",table:{category:"Attributes"}},label:{control:{type:"text"},description:"Demo button label text",table:{category:"Demo"}},customBg:{name:"--tooltip-color-background",control:{type:"color"},description:"Background color (default: inverted surface)",table:{category:"css properties",defaultValue:{summary:"var(--btu-theme-black)"}}},customTextColor:{name:"--tooltip-color-text",control:{type:"color"},description:"Text color (default: inverted surface)",table:{category:"css properties",defaultValue:{summary:"var(--btu-theme-white)"}}},customRadius:{name:"--tooltip-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)"},description:"Border radius",table:{category:"css properties",defaultValue:{summary:"0.5rem (lg)"}}}},render:o=>{const i={};return o.customBg&&(i["--tooltip-color-background"]=o.customBg),o.customTextColor&&(i["--tooltip-color-text"]=o.customTextColor),o.customRadius&&(i["--tooltip-border-radius"]=o.customRadius),c`
|
|
42
|
-
<style>
|
|
43
|
-
${f}
|
|
44
|
-
</style>
|
|
45
|
-
<div style="display: flex; justify-content: center; padding: 6rem 2rem;">
|
|
46
|
-
<div style=${k(i)}>
|
|
47
|
-
<tooltip-demo
|
|
48
|
-
tooltip="${o.tooltip}"
|
|
49
|
-
tooltip-position="${o["tooltip-position"]}"
|
|
50
|
-
tooltip-delay="${o["tooltip-delay"]}"
|
|
51
|
-
tooltip-offset="${T(o["tooltip-offset"])}"
|
|
52
|
-
?tooltip-no-arrow="${o["tooltip-no-arrow"]}"
|
|
53
|
-
tooltip-trigger="${o["tooltip-trigger"]}"
|
|
54
|
-
label="${o.label}"
|
|
55
|
-
></tooltip-demo>
|
|
56
|
-
</div>
|
|
57
|
-
</div>
|
|
58
|
-
`}},d={args:{}},h={render:()=>c`
|
|
59
|
-
<style>
|
|
60
|
-
${f}
|
|
61
|
-
</style>
|
|
62
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
63
|
-
<tooltip-demo tooltip="Top tooltip" tooltip-position="top" label="Top"></tooltip-demo>
|
|
64
|
-
<tooltip-demo tooltip="Bottom tooltip" tooltip-position="bottom" label="Bottom"></tooltip-demo>
|
|
65
|
-
<tooltip-demo tooltip="Left tooltip" tooltip-position="left" label="Left"></tooltip-demo>
|
|
66
|
-
<tooltip-demo tooltip="Right tooltip" tooltip-position="right" label="Right"></tooltip-demo>
|
|
67
|
-
</div>
|
|
68
|
-
`,parameters:{docs:{description:{story:"Tooltips support four positions: `top`, `bottom`, `left`, and `right`. Each position auto-flips to the opposite side if constrained by the viewport."}}}},m={render:()=>c`
|
|
69
|
-
<style>
|
|
70
|
-
${f}
|
|
71
|
-
</style>
|
|
72
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 4rem 2rem; flex-wrap: wrap;">
|
|
73
|
-
<tooltip-demo tooltip="Small offset (4px)" tooltip-offset="sm" label="sm"></tooltip-demo>
|
|
74
|
-
<tooltip-demo tooltip="Medium offset (8px)" tooltip-offset="md" label="md"></tooltip-demo>
|
|
75
|
-
<tooltip-demo tooltip="Large offset (12px)" tooltip-offset="lg" label="lg"></tooltip-demo>
|
|
76
|
-
<tooltip-demo tooltip="Extra large offset (16px)" tooltip-offset="xl" label="xl"></tooltip-demo>
|
|
77
|
-
</div>
|
|
78
|
-
`,parameters:{docs:{description:{story:"The `tooltip-offset` attribute controls the gap between trigger and tooltip using named sizes: `sm` (4px), `md` (8px), `lg` (12px), `xl` (16px)."}}}},u={render:()=>c`
|
|
79
|
-
<style>
|
|
80
|
-
${f}
|
|
81
|
-
</style>
|
|
82
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 4rem 2rem; flex-wrap: wrap;">
|
|
83
|
-
<tooltip-demo tooltip="Click-triggered tooltip" tooltip-trigger="click" label="Click me"></tooltip-demo>
|
|
84
|
-
<tooltip-demo tooltip="Hover or click" tooltip-trigger="hover click" label="Hover or click"></tooltip-demo>
|
|
85
|
-
</div>
|
|
86
|
-
`,parameters:{docs:{description:{story:"The `tooltip-trigger` attribute controls how the tooltip is activated. `click` toggles on click and dismisses on Escape. Triggers can be combined with spaces."}}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
87
|
-
args: {}
|
|
88
|
-
}`,...d.parameters?.docs?.source}}};h.parameters={...h.parameters,docs:{...h.parameters?.docs,source:{originalSource:`{
|
|
89
|
-
render: () => html\`
|
|
90
|
-
<style>
|
|
91
|
-
\${demoStyle}
|
|
92
|
-
</style>
|
|
93
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 6rem 2rem; flex-wrap: wrap;">
|
|
94
|
-
<tooltip-demo tooltip="Top tooltip" tooltip-position="top" label="Top"></tooltip-demo>
|
|
95
|
-
<tooltip-demo tooltip="Bottom tooltip" tooltip-position="bottom" label="Bottom"></tooltip-demo>
|
|
96
|
-
<tooltip-demo tooltip="Left tooltip" tooltip-position="left" label="Left"></tooltip-demo>
|
|
97
|
-
<tooltip-demo tooltip="Right tooltip" tooltip-position="right" label="Right"></tooltip-demo>
|
|
98
|
-
</div>
|
|
99
|
-
\`,
|
|
100
|
-
parameters: {
|
|
101
|
-
docs: {
|
|
102
|
-
description: {
|
|
103
|
-
story: 'Tooltips support four positions: \`top\`, \`bottom\`, \`left\`, and \`right\`. Each position auto-flips to the opposite side if constrained by the viewport.'
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
}`,...h.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
108
|
-
render: () => html\`
|
|
109
|
-
<style>
|
|
110
|
-
\${demoStyle}
|
|
111
|
-
</style>
|
|
112
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 4rem 2rem; flex-wrap: wrap;">
|
|
113
|
-
<tooltip-demo tooltip="Small offset (4px)" tooltip-offset="sm" label="sm"></tooltip-demo>
|
|
114
|
-
<tooltip-demo tooltip="Medium offset (8px)" tooltip-offset="md" label="md"></tooltip-demo>
|
|
115
|
-
<tooltip-demo tooltip="Large offset (12px)" tooltip-offset="lg" label="lg"></tooltip-demo>
|
|
116
|
-
<tooltip-demo tooltip="Extra large offset (16px)" tooltip-offset="xl" label="xl"></tooltip-demo>
|
|
117
|
-
</div>
|
|
118
|
-
\`,
|
|
119
|
-
parameters: {
|
|
120
|
-
docs: {
|
|
121
|
-
description: {
|
|
122
|
-
story: 'The \`tooltip-offset\` attribute controls the gap between trigger and tooltip using named sizes: \`sm\` (4px), \`md\` (8px), \`lg\` (12px), \`xl\` (16px).'
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}`,...m.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
127
|
-
render: () => html\`
|
|
128
|
-
<style>
|
|
129
|
-
\${demoStyle}
|
|
130
|
-
</style>
|
|
131
|
-
<div style="display: flex; gap: 2rem; justify-content: center; padding: 4rem 2rem; flex-wrap: wrap;">
|
|
132
|
-
<tooltip-demo tooltip="Click-triggered tooltip" tooltip-trigger="click" label="Click me"></tooltip-demo>
|
|
133
|
-
<tooltip-demo tooltip="Hover or click" tooltip-trigger="hover click" label="Hover or click"></tooltip-demo>
|
|
134
|
-
</div>
|
|
135
|
-
\`,
|
|
136
|
-
parameters: {
|
|
137
|
-
docs: {
|
|
138
|
-
description: {
|
|
139
|
-
story: 'The \`tooltip-trigger\` attribute controls how the tooltip is activated. \`click\` toggles on click and dismisses on Escape. Triggers can be combined with spaces.'
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}`,...u.parameters?.docs?.source}}};const U=["Default","Positions","Offset","ClickTrigger"];export{u as ClickTrigger,d as Default,m as Offset,h as Positions,U as __namedExportsOrder,V as default};
|
|
@@ -1,233 +0,0 @@
|
|
|
1
|
-
import{g as h,x as l}from"./iframe-B9buZjP7.js";import{o as m}from"./style-map-qCiIYcp5.js";import"./preload-helper-PPVm8Dsz.js";const{events:y,args:w,argTypes:a}=h("btu-widget"),$={title:"Components/Widget",component:"btu-widget",tags:["autodocs"],parameters:{docs:{subtitle:"btu-widget",description:{component:`
|
|
2
|
-
<h3>When to use:</h3>
|
|
3
|
-
<ul>
|
|
4
|
-
<li>To display content in a structured widget layout</li>
|
|
5
|
-
<li>When you need separate header, body, and footer regions</li>
|
|
6
|
-
<li>For component composition that requires semantic HTML authoring</li>
|
|
7
|
-
</ul>
|
|
8
|
-
<h3>Use Cases in the CMS:</h3>
|
|
9
|
-
<ul>
|
|
10
|
-
<li>Dashboard Widgets</li>
|
|
11
|
-
<li>Dashboard Quick Start</li>
|
|
12
|
-
<li>Content Edit History Panel</li>
|
|
13
|
-
<li>Global search filters</li>
|
|
14
|
-
</ul>
|
|
15
|
-
`}},actions:{handles:y},controls:{expanded:!0}},args:{...w,heading:"Widget Title",collapsible:!0},argTypes:{...a,"--header-background":{table:{disable:!0}},"--widget-background":{table:{disable:!0}},"--widget-border":{table:{disable:!0}},isFullscreen:{table:{disable:!0}},heading:{...a.heading,control:{type:"text"},description:"Heading text displayed in the header."},collapsible:{...a.collapsible,control:{type:"boolean"},description:"Whether the widget can be collapsed/expanded. Adds chevron toggle button."},collapsed:{...a.collapsed,control:{type:"boolean"},description:"Whether the widget is currently collapsed (body and footer hidden)."},fullscreenable:{...a.fullscreenable,control:{type:"boolean"},description:"Whether the widget can enter fullscreen mode. Adds fullscreen toggle button."},customWidgetBackground:{name:"--widget-background",control:{type:"color"},description:"Widget background color (default: #ffffff)",table:{category:"css properties"}},customWidgetBorder:{name:"--widget-border",control:{type:"text"},description:'Widget border (e.g., "2px solid #ccc", default: "1px solid #e0e0e0")',table:{category:"css properties"}},customHeaderBackground:{name:"--header-background",control:{type:"color"},description:"Header background color (default: transparent)",table:{category:"css properties"}}},render:e=>{const t={};return e.customWidgetBackground&&(t["--widget-background"]=e.customWidgetBackground),e.customWidgetBorder&&(t["--widget-border"]=e.customWidgetBorder),e.customHeaderBackground&&(t["--header-background"]=e.customHeaderBackground),l`
|
|
16
|
-
<btu-widget
|
|
17
|
-
.heading=${e.heading??""}
|
|
18
|
-
?collapsible=${e.collapsible}
|
|
19
|
-
?collapsed=${e.collapsed}
|
|
20
|
-
?fullscreenable=${e.fullscreenable}
|
|
21
|
-
style=${m(t)}
|
|
22
|
-
>
|
|
23
|
-
<button
|
|
24
|
-
class="btu-button btu-button-text-hidden btu-button-fill-none btu-button-gray btu-button-xs"
|
|
25
|
-
slot="controls"
|
|
26
|
-
>
|
|
27
|
-
<btu-icon symbol="ellipsis"></btu-icon>
|
|
28
|
-
</button>
|
|
29
|
-
<div>This is the main body content of the widget.</div>
|
|
30
|
-
</btu-widget>
|
|
31
|
-
`}},i={args:{fullscreenable:!0}},d={render:e=>l`
|
|
32
|
-
<btu-widget
|
|
33
|
-
.heading=${e.heading??"Widget with Controls"}
|
|
34
|
-
?collapsible=${e.collapsible??!0}
|
|
35
|
-
?collapsed=${e.collapsed}
|
|
36
|
-
?fullscreenable=${e.fullscreenable}
|
|
37
|
-
>
|
|
38
|
-
<div class="action-bar flex justify-between" slot="footer">
|
|
39
|
-
<button class="btu-button btu-button-error">Delete</button>
|
|
40
|
-
<button class="btu-button btu-button-success">Save</button>
|
|
41
|
-
</div>
|
|
42
|
-
<div>Body content with heading and an action bar in the footer.</div>
|
|
43
|
-
</btu-widget>
|
|
44
|
-
`,parameters:{docs:{description:{story:"Widget demonstrating how easy it is to add an action bar component to the footer of a widget."}}}},c={render:e=>l`
|
|
45
|
-
<btu-widget
|
|
46
|
-
.heading=${e.heading??"Fully Themed Widget"}
|
|
47
|
-
?collapsible=${e.collapsible}
|
|
48
|
-
?collapsed=${e.collapsed}
|
|
49
|
-
?fullscreenable=${e.fullscreenable}
|
|
50
|
-
style="--widget-background: oklch(var(--btu-theme-purple-100)); --widget-border: 1px solid oklch(var(--btu-theme-purple-800)); --header-background: oklch(var(--btu-theme-purple-300));"
|
|
51
|
-
>
|
|
52
|
-
<button class="btu-button btu-button-purple" slot="controls">Action</button>
|
|
53
|
-
<div>
|
|
54
|
-
<p>Customized!</p>
|
|
55
|
-
</div>
|
|
56
|
-
<div slot="footer">
|
|
57
|
-
<small>Footer content (hidden when collapsed)</small>
|
|
58
|
-
</div>
|
|
59
|
-
</btu-widget>
|
|
60
|
-
`,parameters:{docs:{description:{story:"Widget with complete theming using all available CSS variables. Demonstrates full control over widget and header appearance."}}}},u={args:{collapsible:!0,collapsed:!0},render:e=>l`
|
|
61
|
-
<btu-widget
|
|
62
|
-
.heading=${e.heading??"Initially Collapsed"}
|
|
63
|
-
?collapsible=${e.collapsible??!0}
|
|
64
|
-
?collapsed=${e.collapsed??!0}
|
|
65
|
-
?fullscreenable=${e.fullscreenable}
|
|
66
|
-
>
|
|
67
|
-
<div style="padding: 1rem;">
|
|
68
|
-
<p>This widget starts in a collapsed state.</p>
|
|
69
|
-
<p>Click the chevron to expand and see this content.</p>
|
|
70
|
-
</div>
|
|
71
|
-
</btu-widget>
|
|
72
|
-
`,parameters:{docs:{description:{story:"Widget that starts in a collapsed state."}}}},b={render:e=>{const t=["pencil","gear","trash","star","heart","bell"];let p=0;const g=n=>{const o=document.createElement("btu-icon");o.setAttribute("symbol",t[p%t.length]),o.setAttribute("slot","controls"),p++,n.appendChild(o);const r=document.createElement("p");r.textContent="This paragraph was added dynamically and automatically redistributed to the body!",r.style.color="#16a34a",r.style.fontWeight="600",n.appendChild(r);const s=document.createElement("button");s.className="btu-button btu-button-purple",s.textContent="Button",s.setAttribute("slot","footer"),n.appendChild(s)};return l`
|
|
73
|
-
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
74
|
-
<button
|
|
75
|
-
class="btu-button btu-button-primary"
|
|
76
|
-
@click="${n=>{const o=n.target.parentElement?.querySelector("btu-widget");o&&g(o)}}"
|
|
77
|
-
>
|
|
78
|
-
Add Dynamic Content
|
|
79
|
-
</button>
|
|
80
|
-
<btu-widget
|
|
81
|
-
.heading=${e.heading??"Dynamic Content Demo"}
|
|
82
|
-
?collapsible=${e.collapsible??!0}
|
|
83
|
-
?collapsed=${e.collapsed}
|
|
84
|
-
?fullscreenable=${e.fullscreenable}
|
|
85
|
-
>
|
|
86
|
-
<button class="btu-button btu-button-primary" slot="controls">Initial Button</button>
|
|
87
|
-
<div style="padding: 1rem;">
|
|
88
|
-
<p>Click the "Add Dynamic Content" button above to demonstrate:</p>
|
|
89
|
-
<ul>
|
|
90
|
-
<li>MutationObserver detects new child elements</li>
|
|
91
|
-
<li>New <code>slot="controls"</code> icon is redistributed to header actions</li>
|
|
92
|
-
<li>New paragraph (no slot) is redistributed to body</li>
|
|
93
|
-
<li>New <code>slot="footer"</code> button is redistributed to footer</li>
|
|
94
|
-
</ul>
|
|
95
|
-
</div>
|
|
96
|
-
</btu-widget>
|
|
97
|
-
</div>
|
|
98
|
-
`},parameters:{docs:{description:{story:"Demonstrates the Manager Pattern's MutationObserver: Content added dynamically is automatically redistributed to the correct containers based on slot attributes."}}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
99
|
-
args: {
|
|
100
|
-
fullscreenable: true
|
|
101
|
-
}
|
|
102
|
-
}`,...i.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
103
|
-
render: args => html\`
|
|
104
|
-
<btu-widget
|
|
105
|
-
.heading=\${args.heading ?? 'Widget with Controls'}
|
|
106
|
-
?collapsible=\${args.collapsible ?? true}
|
|
107
|
-
?collapsed=\${args.collapsed}
|
|
108
|
-
?fullscreenable=\${args.fullscreenable}
|
|
109
|
-
>
|
|
110
|
-
<div class="action-bar flex justify-between" slot="footer">
|
|
111
|
-
<button class="btu-button btu-button-error">Delete</button>
|
|
112
|
-
<button class="btu-button btu-button-success">Save</button>
|
|
113
|
-
</div>
|
|
114
|
-
<div>Body content with heading and an action bar in the footer.</div>
|
|
115
|
-
</btu-widget>
|
|
116
|
-
\`,
|
|
117
|
-
parameters: {
|
|
118
|
-
docs: {
|
|
119
|
-
description: {
|
|
120
|
-
story: 'Widget demonstrating how easy it is to add an action bar component to the footer of a widget.'
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
}`,...d.parameters?.docs?.source}}};c.parameters={...c.parameters,docs:{...c.parameters?.docs,source:{originalSource:`{
|
|
125
|
-
render: args => html\`
|
|
126
|
-
<btu-widget
|
|
127
|
-
.heading=\${args.heading ?? 'Fully Themed Widget'}
|
|
128
|
-
?collapsible=\${args.collapsible}
|
|
129
|
-
?collapsed=\${args.collapsed}
|
|
130
|
-
?fullscreenable=\${args.fullscreenable}
|
|
131
|
-
style="--widget-background: oklch(var(--btu-theme-purple-100)); --widget-border: 1px solid oklch(var(--btu-theme-purple-800)); --header-background: oklch(var(--btu-theme-purple-300));"
|
|
132
|
-
>
|
|
133
|
-
<button class="btu-button btu-button-purple" slot="controls">Action</button>
|
|
134
|
-
<div>
|
|
135
|
-
<p>Customized!</p>
|
|
136
|
-
</div>
|
|
137
|
-
<div slot="footer">
|
|
138
|
-
<small>Footer content (hidden when collapsed)</small>
|
|
139
|
-
</div>
|
|
140
|
-
</btu-widget>
|
|
141
|
-
\`,
|
|
142
|
-
parameters: {
|
|
143
|
-
docs: {
|
|
144
|
-
description: {
|
|
145
|
-
story: 'Widget with complete theming using all available CSS variables. Demonstrates full control over widget and header appearance.'
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
}`,...c.parameters?.docs?.source}}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
150
|
-
args: {
|
|
151
|
-
collapsible: true,
|
|
152
|
-
collapsed: true
|
|
153
|
-
},
|
|
154
|
-
render: args => html\`
|
|
155
|
-
<btu-widget
|
|
156
|
-
.heading=\${args.heading ?? 'Initially Collapsed'}
|
|
157
|
-
?collapsible=\${args.collapsible ?? true}
|
|
158
|
-
?collapsed=\${args.collapsed ?? true}
|
|
159
|
-
?fullscreenable=\${args.fullscreenable}
|
|
160
|
-
>
|
|
161
|
-
<div style="padding: 1rem;">
|
|
162
|
-
<p>This widget starts in a collapsed state.</p>
|
|
163
|
-
<p>Click the chevron to expand and see this content.</p>
|
|
164
|
-
</div>
|
|
165
|
-
</btu-widget>
|
|
166
|
-
\`,
|
|
167
|
-
parameters: {
|
|
168
|
-
docs: {
|
|
169
|
-
description: {
|
|
170
|
-
story: 'Widget that starts in a collapsed state.'
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
}`,...u.parameters?.docs?.source}}};b.parameters={...b.parameters,docs:{...b.parameters?.docs,source:{originalSource:`{
|
|
175
|
-
render: args => {
|
|
176
|
-
const icons = ['pencil', 'gear', 'trash', 'star', 'heart', 'bell'];
|
|
177
|
-
let iconIndex = 0;
|
|
178
|
-
const addContent = (widgetEl: HTMLElement) => {
|
|
179
|
-
const icon = document.createElement('btu-icon');
|
|
180
|
-
icon.setAttribute('symbol', icons[iconIndex % icons.length]);
|
|
181
|
-
icon.setAttribute('slot', 'controls');
|
|
182
|
-
iconIndex++;
|
|
183
|
-
widgetEl.appendChild(icon);
|
|
184
|
-
const newParagraph = document.createElement('p');
|
|
185
|
-
newParagraph.textContent = 'This paragraph was added dynamically and automatically redistributed to the body!';
|
|
186
|
-
newParagraph.style.color = '#16a34a';
|
|
187
|
-
newParagraph.style.fontWeight = '600';
|
|
188
|
-
widgetEl.appendChild(newParagraph);
|
|
189
|
-
const newButton = document.createElement('button');
|
|
190
|
-
newButton.className = 'btu-button btu-button-purple';
|
|
191
|
-
newButton.textContent = 'Button';
|
|
192
|
-
newButton.setAttribute('slot', 'footer');
|
|
193
|
-
widgetEl.appendChild(newButton);
|
|
194
|
-
};
|
|
195
|
-
return html\`
|
|
196
|
-
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
197
|
-
<button
|
|
198
|
-
class="btu-button btu-button-primary"
|
|
199
|
-
@click="\${(e: Event) => {
|
|
200
|
-
const widget = (e.target as HTMLElement).parentElement?.querySelector('btu-widget');
|
|
201
|
-
if (widget) addContent(widget);
|
|
202
|
-
}}"
|
|
203
|
-
>
|
|
204
|
-
Add Dynamic Content
|
|
205
|
-
</button>
|
|
206
|
-
<btu-widget
|
|
207
|
-
.heading=\${args.heading ?? 'Dynamic Content Demo'}
|
|
208
|
-
?collapsible=\${args.collapsible ?? true}
|
|
209
|
-
?collapsed=\${args.collapsed}
|
|
210
|
-
?fullscreenable=\${args.fullscreenable}
|
|
211
|
-
>
|
|
212
|
-
<button class="btu-button btu-button-primary" slot="controls">Initial Button</button>
|
|
213
|
-
<div style="padding: 1rem;">
|
|
214
|
-
<p>Click the "Add Dynamic Content" button above to demonstrate:</p>
|
|
215
|
-
<ul>
|
|
216
|
-
<li>MutationObserver detects new child elements</li>
|
|
217
|
-
<li>New <code>slot="controls"</code> icon is redistributed to header actions</li>
|
|
218
|
-
<li>New paragraph (no slot) is redistributed to body</li>
|
|
219
|
-
<li>New <code>slot="footer"</code> button is redistributed to footer</li>
|
|
220
|
-
</ul>
|
|
221
|
-
</div>
|
|
222
|
-
</btu-widget>
|
|
223
|
-
</div>
|
|
224
|
-
\`;
|
|
225
|
-
},
|
|
226
|
-
parameters: {
|
|
227
|
-
docs: {
|
|
228
|
-
description: {
|
|
229
|
-
story: "Demonstrates the Manager Pattern's MutationObserver: Content added dynamically is automatically redistributed to the correct containers based on slot attributes."
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
}
|
|
233
|
-
}`,...b.parameters?.docs?.source}}};const k=["Default","WithFooter","CustomizedWithCSSVariables","CollapsedByDefault","DynamicContentRedistribution"];export{u as CollapsedByDefault,c as CustomizedWithCSSVariables,i as Default,b as DynamicContentRedistribution,d as WithFooter,k as __namedExportsOrder,$ as default};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{E as r}from"./iframe-B9buZjP7.js";const m=o=>o??r;export{m as o};
|