@brightspot/ui 5.0.4-pre.20260624 → 5.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/button-group/ButtonGroup.d.ts +7 -2
- package/dist/components/button-group/ButtonGroup.d.ts.map +1 -1
- package/dist/components/button-group/ButtonGroup.js +23 -16
- package/dist/components/button-group/ButtonGroup.js.map +1 -1
- package/dist/components/card/Card.css +7 -0
- package/dist/components/card/Card.d.ts +244 -0
- package/dist/components/card/Card.d.ts.map +1 -0
- package/dist/components/card/Card.js +512 -0
- package/dist/components/card/Card.js.map +1 -0
- package/dist/components/empty-state/EmptyState.d.ts +11 -2
- package/dist/components/empty-state/EmptyState.d.ts.map +1 -1
- package/dist/components/empty-state/EmptyState.js +19 -8
- package/dist/components/empty-state/EmptyState.js.map +1 -1
- package/dist/components/esca-avatar/EscaAvatar.d.ts +70 -0
- package/dist/components/esca-avatar/EscaAvatar.d.ts.map +1 -0
- package/dist/components/esca-avatar/EscaAvatar.js +218 -0
- package/dist/components/esca-avatar/EscaAvatar.js.map +1 -0
- package/dist/components/esca-avatar/animations/esca-search.json +1 -0
- package/dist/components/esca-avatar/animations/esca-task-complete.json +1 -0
- package/dist/components/esca-avatar/animations/esca-wave.json +1 -0
- package/dist/components/widget/Widget.d.ts +11 -2
- package/dist/components/widget/Widget.d.ts.map +1 -1
- package/dist/components/widget/Widget.js +21 -10
- package/dist/components/widget/Widget.js.map +1 -1
- package/dist/custom-elements.json +1081 -365
- package/dist/storybook/assets/{ActionBar.stories-cyX9vc6C.js → ActionBar.stories-CBN_ShP5.js} +1 -1
- package/dist/storybook/assets/{ActionItem.stories-Bs-Kxp5J.js → ActionItem.stories-DysfIj7U.js} +1 -1
- package/dist/storybook/assets/{Avatar.stories-B1Uee53f.js → Avatar.stories-BdgqH7I_.js} +1 -1
- package/dist/storybook/assets/{AvatarGroup.stories-W2EtKQBu.js → AvatarGroup.stories-DFCG_0Py.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-BotNIO18.js → Badge.stories-BWPIJ2jm.js} +1 -1
- package/dist/storybook/assets/{Button-YTBnP55L.js → Button-B1_SwzVL.js} +1 -1
- package/dist/storybook/assets/{Button.stories-B-X7_d_i.js → Button.stories-C-H-KIcV.js} +1 -1
- package/dist/storybook/assets/{ButtonGroup.stories-BM-pxfK2.js → ButtonGroup.stories-BBdtnaP_.js} +1 -1
- package/dist/storybook/assets/Card.stories-FLC-WKC_.js +556 -0
- package/dist/storybook/assets/{Celebrate.stories-D9EJwzxo.js → Celebrate.stories-CZ7SfTOh.js} +1 -1
- package/dist/storybook/assets/{Checkbox.stories-f5VLVSw5.js → Checkbox.stories-C42Z-jkF.js} +1 -1
- package/dist/storybook/assets/{CircularProgress.stories-BI9e372u.js → CircularProgress.stories-DoC0japf.js} +1 -1
- package/dist/storybook/assets/{ClipboardMixin.stories-CsyJDNxc.js → ClipboardMixin.stories-Ci-drbJq.js} +1 -1
- package/dist/storybook/assets/{Color-6BZIO3FS-ClVOLIJG.js → Color-6BZIO3FS-rxeQBzj6.js} +1 -1
- package/dist/storybook/assets/{Colors.stories-hUYBvymM.js → Colors.stories-Bw1Kp3B7.js} +1 -1
- package/dist/storybook/assets/{CombinedEffects.stories-DkokyKCS.js → CombinedEffects.stories-DArqLKI1.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin-C4I_rtgt.js → ComponentStatesMixin-kUcZl-YW.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-BeLCYevK.js → ComponentStatesMixin.stories-PrGY6akN.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-DN9oagz-.js → CopyToClipboard.stories-CUzNoCic.js} +1 -1
- package/dist/storybook/assets/{Debounce.stories-CtNQAJxO.js → Debounce.stories-CrnUlkHs.js} +1 -1
- package/dist/storybook/assets/{DocsRenderer-LL677BLK-Bx1Fds2q.js → DocsRenderer-LL677BLK-BM3eNhez.js} +3 -3
- package/dist/storybook/assets/{Dropdown.stories-B862-mco.js → Dropdown.stories-DyIY6e6W.js} +1 -1
- package/dist/storybook/assets/{EmptyState.stories-Im3Vr4ZL.js → EmptyState.stories-BXFcxFcG.js} +1 -1
- package/dist/storybook/assets/EscaAvatar.stories-DnriDX7_.js +138 -0
- package/dist/storybook/assets/{Events.stories-B0tluV0t.js → Events.stories-YjZ1Qtl4.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-6CzGqAAc.js → Heading.stories-CfQHk5pf.js} +1 -1
- package/dist/storybook/assets/{HueRipple.stories-DaQiDn9K.js → HueRipple.stories-CR75dLBM.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-CFkYO_7w.js → Icon.stories-BCSRhY2s.js} +1 -1
- package/dist/storybook/assets/{IconButton.stories-DwBTqvTi.js → IconButton.stories-0O4LM1u6.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-Coxmgjmo.js → LinearProgress.stories-B7GYC8WE.js} +1 -1
- package/dist/storybook/assets/OnFindMixin.stories-UOK_ZP2n.js +300 -0
- package/dist/storybook/assets/{Pagination.stories-CYrKX5iI.js → Pagination.stories-Co3mbyct.js} +1 -1
- package/dist/storybook/assets/{Popover.stories-BkGiUOfu.js → Popover.stories-D5gsWcB0.js} +1 -1
- package/dist/storybook/assets/{ReadyMixin-CP6tQ4FB.js → ReadyMixin-DkhLzoe0.js} +1 -1
- package/dist/storybook/assets/{RovingTabindexMixin.stories-CzkPw8Nl.js → RovingTabindexMixin.stories-DPhOWmKd.js} +1 -1
- package/dist/storybook/assets/{Rtc.stories-CVch488H.js → Rtc.stories-D5Vpw1oP.js} +1 -1
- package/dist/storybook/assets/{ScrollShadow.stories-BGh-Irt7.js → ScrollShadow.stories-Cmbqjk5X.js} +1 -1
- package/dist/storybook/assets/{Switch.stories-DPfP0QVK.js → Switch.stories-Bfmr9Ugg.js} +1 -1
- package/dist/storybook/assets/{Tab.stories-CBcuRcDB.js → Tab.stories-DbucUczE.js} +1 -1
- package/dist/storybook/assets/{Tabs.stories-CDOBjYbs.js → Tabs.stories-DnPRsSsj.js} +1 -1
- package/dist/storybook/assets/{Throttle.stories-Bqyul0aW.js → Throttle.stories-DNwTsNRC.js} +1 -1
- package/dist/storybook/assets/{Tooltip.stories-B9dohX1h.js → Tooltip.stories-Fsp2BRAr.js} +1 -1
- package/dist/storybook/assets/{Upload.stories-C7dq2Wdk.js → Upload.stories-C-WggEd6.js} +1 -1
- package/dist/storybook/assets/{UploadItem.stories-35zsIKTv.js → UploadItem.stories-DwQzECXv.js} +1 -1
- package/dist/storybook/assets/{Welcome.stories-BuD3fpke.js → Welcome.stories-DFluhbVr.js} +1 -1
- package/dist/storybook/assets/{Widget.stories-D2UYzfyE.js → Widget.stories-7pJNHWTu.js} +1 -1
- package/dist/storybook/assets/{WithTooltip-65CFNBJE-DGiY8cz9.js → WithTooltip-65CFNBJE-BcgHQTz7.js} +1 -1
- package/dist/storybook/assets/{blocks-YjKl5E55.js → blocks-U4F5yAu3.js} +5 -5
- package/dist/storybook/assets/{formatter-EIJCOSYU-XYAiuXAN.js → formatter-EIJCOSYU-BjQsmbLH.js} +1 -1
- package/dist/storybook/assets/if-defined-CM2lJk-0.js +1 -0
- package/dist/storybook/assets/iframe-1F7Ef_8q.css +1 -0
- package/dist/storybook/assets/{iframe-CufEXQ5F.js → iframe-DNJdsh5L.js} +225 -225
- package/dist/storybook/assets/{index-DbEDIsEB.js → index-1U9xrCIK.js} +1 -1
- package/dist/storybook/assets/onFind-AbVF4rYD.js +1 -0
- package/dist/storybook/assets/{onFind.stories-UpwJxFqR.js → onFind.stories-j334ViWp.js} +15 -15
- package/dist/storybook/assets/{onRemove.stories-BMwQGBCl.js → onRemove.stories-fKMxne2_.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-axSo0Zv3.js → onVisible.stories-BCRoHlJz.js} +1 -1
- package/dist/storybook/assets/{style-map-BkaK9546.js → style-map-BZ07XihX.js} +1 -1
- package/dist/storybook/assets/{syntaxhighlighter-ED5Y7EFY-CDDZTVRn.js → syntaxhighlighter-ED5Y7EFY-C2D-CgsB.js} +1 -1
- package/dist/storybook/iframe.html +48 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/tailwind-plugin-button.js +5 -5
- package/dist/tailwind-plugin-button.js.map +1 -1
- package/dist/tailwind-plugin-button.ts +5 -5
- package/dist/tailwind-plugin-card.d.ts +2 -0
- package/dist/tailwind-plugin-card.d.ts.map +1 -0
- package/dist/tailwind-plugin-card.js +438 -0
- package/dist/tailwind-plugin-card.js.map +1 -0
- package/dist/tailwind-plugin-card.ts +515 -0
- package/dist/tailwind.config.d.ts.map +1 -1
- package/dist/tailwind.config.js +3 -1
- package/dist/tailwind.config.js.map +1 -1
- package/dist/tailwind.config.ts +3 -2
- package/dist/util/EventEmitterMixin.d.ts +5 -0
- package/dist/util/EventEmitterMixin.d.ts.map +1 -1
- package/dist/util/EventEmitterMixin.js.map +1 -1
- package/dist/util/OnFindMixin.d.ts +55 -0
- package/dist/util/OnFindMixin.d.ts.map +1 -0
- package/dist/util/OnFindMixin.js +70 -0
- package/dist/util/OnFindMixin.js.map +1 -0
- package/dist/util/onFind.d.ts +4 -2
- package/dist/util/onFind.d.ts.map +1 -1
- package/dist/util/onFind.js +12 -0
- package/dist/util/onFind.js.map +1 -1
- package/docs/components/ButtonGroup.md +7 -3
- package/docs/components/Card.md +83 -0
- package/docs/components/EmptyState.md +10 -6
- package/docs/components/EscaAvatar.md +70 -0
- package/docs/components/README.md +2 -0
- package/docs/components/Widget.md +18 -14
- package/package.json +2 -2
- package/src/legacy/tool-ui/src/AIInline.css +1 -1
- package/src/legacy/tool-ui/src/ContentForm.css +1 -1
- package/src/legacy/tool-ui/src/Guide.css +1 -1
- package/src/legacy/tool-ui/src/Notification.css +1 -1
- package/src/legacy/tool-ui/src/Popup.css +4 -1
- package/src/legacy/tool-ui/src/RepeatableContentInputGroup.css +3 -3
- package/src/legacy/tool-ui/src/SearchWidget.ts +10 -1
- package/src/legacy/tool-ui/src/dropdown/index.ts +2 -2
- package/src/legacy/tool-ui/src/main/webapp/dist/RTEProseMirror.c6f3142a97caa5cd3c21.js +500 -0
- package/src/legacy/tool-ui/src/main/webapp/dist/v4.c1c3bde6e394b2a2b75c.css +3 -0
- package/src/legacy/tool-ui/src/main/webapp/dist/{v4.c5bcef50efdfa2d2e35f.js → v4.da15ce3ce45e85b4880a.js} +5 -5
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.4edf99db4a5f4969d041.css +5 -0
- package/src/legacy/tool-ui/src/main/webapp/dist/{v5.86effb9bf858ae7b0640.js → v5.8491d982a282935a3058.js} +5 -5
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentForm.less +1 -1
- package/src/legacy/tool-ui/src/main/webapp/v4/ContentSelector.less +3 -3
- package/src/legacy/tool-ui/src/v5.ts +4 -2
- package/dist/storybook/assets/if-defined-f_e-RnGa.js +0 -1
- package/dist/storybook/assets/iframe-PeGbyIdX.css +0 -1
- package/dist/storybook/assets/onFind-C7Wi8jr6.js +0 -1
- package/src/legacy/tool-ui/src/main/webapp/dist/RTEProseMirror.945bd28778b1a3e937c7.js +0 -500
- package/src/legacy/tool-ui/src/main/webapp/dist/v4.a6f53058dbb04a69aa5c.css +0 -3
- package/src/legacy/tool-ui/src/main/webapp/dist/v5.f60c05ef0c9b89aae888.css +0 -5
- /package/src/legacy/tool-ui/src/main/webapp/dist/{RTEProseMirror.945bd28778b1a3e937c7.js.LICENSE.txt → RTEProseMirror.c6f3142a97caa5cd3c21.js.LICENSE.txt} +0 -0
- /package/src/legacy/tool-ui/src/main/webapp/dist/{v4.c5bcef50efdfa2d2e35f.js.LICENSE.txt → v4.da15ce3ce45e85b4880a.js.LICENSE.txt} +0 -0
- /package/src/legacy/tool-ui/src/main/webapp/dist/{v5.86effb9bf858ae7b0640.js.LICENSE.txt → v5.8491d982a282935a3058.js.LICENSE.txt} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as S,x as t}from"./iframe-
|
|
1
|
+
import{g as S,x as t}from"./iframe-DNJdsh5L.js";import{o as f}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:O,args:A,argTypes:n}=S("btu-dropdown"),B={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
|
|
package/dist/storybook/assets/{EmptyState.stories-Im3Vr4ZL.js → EmptyState.stories-BXFcxFcG.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as u,x as e}from"./iframe-
|
|
1
|
+
import{g as u,x as e}from"./iframe-DNJdsh5L.js";import{o as m}from"./if-defined-CM2lJk-0.js";import{o as h}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:b,args:g,argTypes:s}=u("btu-empty-state"),y=["sm","md","lg"],v=[1,2,3,4,5,6],k={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
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>To communicate the absence of content in tables, lists, or search results</li>
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import{g as f,x as a}from"./iframe-DNJdsh5L.js";import{o as x}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:w,args:z,argTypes:m}=f("btu-esca-avatar"),y=["idle","wave","search","complete"],g=["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> a still frame of the wave — the resting 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
|
+
</ul>
|
|
15
|
+
|
|
16
|
+
<p>Drive it through the single <code>state</code> attribute. Reduced-motion users get a static frame instead of playback.</p>
|
|
17
|
+
|
|
18
|
+
<h3>Accessibility:</h3>
|
|
19
|
+
<ul>
|
|
20
|
+
<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>
|
|
21
|
+
<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>
|
|
22
|
+
<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>
|
|
23
|
+
</ul>
|
|
24
|
+
`}},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:y,description:"Animation to play. Changing this swaps the animation.",table:{category:"Attributes",defaultValue:{summary:"idle"}}},size:{...m.size,control:{type:"select"},options:g,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">
|
|
25
|
+
${y.map(e=>a`
|
|
26
|
+
<div class="flex flex-col items-center gap-2">
|
|
27
|
+
<btu-esca-avatar state="${e}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
28
|
+
<span class="text-xs font-medium text-gray-700">${e}</span>
|
|
29
|
+
</div>
|
|
30
|
+
`)}
|
|
31
|
+
</div>`,parameters:{docs:{description:{story:"Every state side by side. `wave`, `search`, and `complete` play on load (`search` loops); `idle` holds a still frame."}}}},o={render:()=>a`<div class="flex flex-row items-center gap-6">
|
|
32
|
+
${g.map(e=>a`
|
|
33
|
+
<div class="flex flex-col items-center gap-2">
|
|
34
|
+
<btu-esca-avatar state="search" size="${e}"></btu-esca-avatar>
|
|
35
|
+
<span class="text-xs text-gray-600">${e}</span>
|
|
36
|
+
</div>
|
|
37
|
+
`)}
|
|
38
|
+
</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:`{
|
|
39
|
+
args: {},
|
|
40
|
+
parameters: {
|
|
41
|
+
docs: {
|
|
42
|
+
description: {
|
|
43
|
+
story: 'Use the controls to switch between states and resize the avatar.'
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}`,...n.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
48
|
+
render: () => html\`<div class="flex flex-row items-start gap-8">
|
|
49
|
+
\${stateOptions.map(state => html\`
|
|
50
|
+
<div class="flex flex-col items-center gap-2">
|
|
51
|
+
<btu-esca-avatar state="\${state}" style="--esca-avatar-size: 4rem"></btu-esca-avatar>
|
|
52
|
+
<span class="text-xs font-medium text-gray-700">\${state}</span>
|
|
53
|
+
</div>
|
|
54
|
+
\`)}
|
|
55
|
+
</div>\`,
|
|
56
|
+
parameters: {
|
|
57
|
+
docs: {
|
|
58
|
+
description: {
|
|
59
|
+
story: 'Every state side by side. \`wave\`, \`search\`, and \`complete\` play on load (\`search\` loops); \`idle\` holds a still frame.'
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}`,...r.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
64
|
+
render: () => html\`<div class="flex flex-row items-center gap-6">
|
|
65
|
+
\${sizeOptions.map(size => html\`
|
|
66
|
+
<div class="flex flex-col items-center gap-2">
|
|
67
|
+
<btu-esca-avatar state="search" size="\${size}"></btu-esca-avatar>
|
|
68
|
+
<span class="text-xs text-gray-600">\${size}</span>
|
|
69
|
+
</div>
|
|
70
|
+
\`)}
|
|
71
|
+
</div>\`,
|
|
72
|
+
parameters: {
|
|
73
|
+
docs: {
|
|
74
|
+
description: {
|
|
75
|
+
story: 'The \`size\` scale (\`xs\`–\`xl\`), mirroring \`<btu-avatar>\`. For an arbitrary size, override with the \`--esca-avatar-size\` custom property.'
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}`,...o.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
80
|
+
render: () => {
|
|
81
|
+
const container = document.createElement('div');
|
|
82
|
+
container.className = 'flex flex-col items-start gap-4';
|
|
83
|
+
const avatar = document.createElement('btu-esca-avatar') as EscaAvatar;
|
|
84
|
+
avatar.style.setProperty('--esca-avatar-size', '4rem');
|
|
85
|
+
const status = document.createElement('span');
|
|
86
|
+
status.className = 'text-xs text-gray-600';
|
|
87
|
+
const replay = document.createElement('button');
|
|
88
|
+
replay.textContent = 'Replay';
|
|
89
|
+
replay.className = 'btu-button btu-button-gray rounded px-3 py-1 text-sm';
|
|
90
|
+
let searchTimer: ReturnType<typeof setTimeout> | undefined;
|
|
91
|
+
const setStatus = (text: string) => {
|
|
92
|
+
status.textContent = text;
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
// Mirrors a real exchange: greet on open, think while responding, then settle on completion.
|
|
96
|
+
const run = () => {
|
|
97
|
+
clearTimeout(searchTimer);
|
|
98
|
+
avatar.state = 'wave';
|
|
99
|
+
setStatus('state: wave — greeting on open');
|
|
100
|
+
};
|
|
101
|
+
avatar.addEventListener('btu-esca-avatar-complete', () => {
|
|
102
|
+
if (avatar.state === 'wave') {
|
|
103
|
+
avatar.state = 'search';
|
|
104
|
+
setStatus('state: search — generating a response');
|
|
105
|
+
searchTimer = setTimeout(() => {
|
|
106
|
+
avatar.state = 'complete';
|
|
107
|
+
setStatus('state: complete — response finished');
|
|
108
|
+
}, 2500);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
replay.addEventListener('click', run);
|
|
112
|
+
container.append(avatar, status, replay);
|
|
113
|
+
queueMicrotask(run);
|
|
114
|
+
|
|
115
|
+
// Clear the pending timer when the story unmounts.
|
|
116
|
+
const observer = new MutationObserver(mutations => {
|
|
117
|
+
mutations.forEach(mutation => mutation.removedNodes.forEach(node => {
|
|
118
|
+
if (node === container || node.contains(container)) {
|
|
119
|
+
clearTimeout(searchTimer);
|
|
120
|
+
observer.disconnect();
|
|
121
|
+
}
|
|
122
|
+
}));
|
|
123
|
+
});
|
|
124
|
+
queueMicrotask(() => {
|
|
125
|
+
if (container.parentNode) observer.observe(container.parentNode, {
|
|
126
|
+
childList: true
|
|
127
|
+
});
|
|
128
|
+
});
|
|
129
|
+
return container;
|
|
130
|
+
},
|
|
131
|
+
parameters: {
|
|
132
|
+
docs: {
|
|
133
|
+
description: {
|
|
134
|
+
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.'
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}`,...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,4 +1,4 @@
|
|
|
1
|
-
import{x as d}from"./iframe-
|
|
1
|
+
import{x as d}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";var n=Object.freeze,r=Object.defineProperty,s=(t,i)=>n(r(t,"raw",{value:n(t.slice())})),o;const l={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>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{x as s}from"./iframe-
|
|
1
|
+
import{x as s}from"./iframe-DNJdsh5L.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-DaQiDn9K.js → HueRipple.stories-CR75dLBM.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as i}from"./iframe-
|
|
1
|
+
import{x as i}from"./iframe-DNJdsh5L.js";import{b as l}from"./ripple-DQbyyRUw.js";import{B as e}from"./Button-B1_SwzVL.js";import"./preload-helper-PPVm8Dsz.js";import"./position-CFNQy3J6.js";const m={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
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g,x as s}from"./iframe-
|
|
1
|
+
import{g,x as s}from"./iframe-DNJdsh5L.js";import{o as h}from"./style-map-BZ07XihX.js";import{L as u}from"./LucideDynamicLoader-jmdq8YDM.js";import"./preload-helper-PPVm8Dsz.js";const{events:x,args:v,argTypes:i}=g("btu-icon"),b=["xs","sm","md","lg","xl"],f=["ai","error","gray","primary","purple","rose","success","teal","warning"],C={title:"Components/Icon",component:"btu-icon",tags:["autodocs"],parameters:{docs:{subtitle:"An icon component using Lucide icons with built-in support for custom colors and sizes.",description:{component:`
|
|
2
2
|
<strong>When to use:</strong>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>To visually reinforce actions, states, or categories</li>
|
package/dist/storybook/assets/{IconButton.stories-DwBTqvTi.js → IconButton.stories-0O4LM1u6.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as p,x as e}from"./iframe-
|
|
1
|
+
import{g as p,x as e}from"./iframe-DNJdsh5L.js";import{o as b}from"./if-defined-CM2lJk-0.js";import{L as d}from"./LucideDynamicLoader-jmdq8YDM.js";import"./preload-helper-PPVm8Dsz.js";const{events:u,args:y,argTypes:o}=p("btu-icon-button"),x={title:"Components/Icon Button",component:"btu-icon-button",tags:["autodocs"],parameters:{docs:{subtitle:"Combines button styles with the icon component along with an opinionated API",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>For actions in compact or space-constrained interfaces (toolbars, tables, cards)</li>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as D,E as h,x as T}from"./iframe-
|
|
1
|
+
import{g as D,E as h,x as T}from"./iframe-DNJdsh5L.js";import{o as A}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:V,args:k,argTypes:g}=D("btu-linear-progress"),W={title:"Components/Linear Progress",component:"btu-linear-progress",tags:["autodocs"],parameters:{docs:{subtitle:"A horizontal progress bar for showing task completion",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>To show progress of a specific task with known completion percentage</li>
|
|
@@ -0,0 +1,300 @@
|
|
|
1
|
+
import{x as h,i as v}from"./iframe-DNJdsh5L.js";import{o as k}from"./onFind-AbVF4rYD.js";import"./preload-helper-PPVm8Dsz.js";const x=e=>{class n extends e{#t=[];onFindRegistration(){return null}#e(){if(this.#t.length)return;const i=this.onFindRegistration();if(!i)return;const d=Array.isArray(i)?i:[i];this.#t=d.map(c=>k(this,c.selectors,c.callback))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.#e()}firstUpdated(i){super.firstUpdated(i),this.#e()}disconnectedCallback(){super.disconnectedCallback(),this.#t.forEach(i=>i()),this.#t=[]}}return n},{expect:a,userEvent:l,waitFor:r,within:w}=__STORYBOOK_MODULE_TEST__,b="ofm-demo";if(!customElements.get(b)){class e extends x(v){onFindRegistration(){return{selectors:":scope > .ofm-item",callback:t=>t.classList.add("ring-2","ring-success-500")}}render(){return h`<slot></slot>`}}customElements.define(b,e)}const p="ofm-multi";if(!customElements.get(p)){class e extends x(v){onFindRegistration(){return[{selectors:":scope > .ofm-a",callback:t=>t.classList.add("ring-2","ring-success-500")},{selectors:":scope > .ofm-b",callback:t=>t.classList.add("ring-2","ring-primary-500")}]}render(){return h`<slot></slot>`}}customElements.define(p,e)}function g(){return globalThis[Symbol.for("brightspot.onFind")]?.callbacks?.length??0}const M={title:"Mixins/OnFind Mixin",tags:["autodocs"],parameters:{docs:{description:{component:`
|
|
2
|
+
\`OnFindMixin\` registers an \`onFind\` child-redistribution callback and
|
|
3
|
+
**tears it down on disconnect**, so a detached component is garbage-collectable
|
|
4
|
+
and stops being visited on every document mutation.
|
|
5
|
+
|
|
6
|
+
\`onFind\` is backed by a single global \`MutationObserver\` and a global list of
|
|
7
|
+
callbacks. A component that registers a callback but never removes it keeps
|
|
8
|
+
itself reachable forever and adds permanent per-mutation work. This mixin owns
|
|
9
|
+
that lifecycle so individual components don't have to hand-wire it.
|
|
10
|
+
|
|
11
|
+
<h3>What OnFindMixin Does</h3>
|
|
12
|
+
<ul>
|
|
13
|
+
<li>Registers the component's \`onFind\` callback after first render (in \`firstUpdated\`).</li>
|
|
14
|
+
<li>Disposes the registration in \`disconnectedCallback\` so a removed component can be GC'd.</li>
|
|
15
|
+
<li>Re-arms the registration on reattach — \`firstUpdated\` only fires once, so \`connectedCallback\` re-registers when \`hasUpdated\` is true.</li>
|
|
16
|
+
<li>Stays idempotent: arming while already registered is a no-op.</li>
|
|
17
|
+
</ul>
|
|
18
|
+
|
|
19
|
+
<h3>The Contract</h3>
|
|
20
|
+
<p>A component declares <b>what</b> to register by implementing
|
|
21
|
+
\`onFindRegistration()\`, which returns <code>{ selectors, callback }</code>,
|
|
22
|
+
\`null\` to skip (e.g. when required containers aren't present yet), or an
|
|
23
|
+
<b>array</b> of registrations for several independent sweeps (all disposed
|
|
24
|
+
together on disconnect). It is re-invoked on every registration, so query
|
|
25
|
+
containers <b>inside</b> it rather than capturing them once — a reattach then
|
|
26
|
+
re-binds against the current DOM.</p>
|
|
27
|
+
|
|
28
|
+
<p>The <code>callback</code> must be <b>idempotent</b>: on reattach the mixin
|
|
29
|
+
re-runs \`onFind\`'s initial sweep, so it may be called again for a child that is
|
|
30
|
+
already placed.</p>
|
|
31
|
+
|
|
32
|
+
<p>Subclasses that override \`firstUpdated\` <b>must</b> call
|
|
33
|
+
\`super.firstUpdated()\`, or the initial registration never runs.</p>
|
|
34
|
+
|
|
35
|
+
<h3>Mixin Composition</h3>
|
|
36
|
+
|
|
37
|
+
<p>Place OnFindMixin near the base, just outside ReadyMixin, so it inherits the
|
|
38
|
+
DOM-ready guarantee:</p>
|
|
39
|
+
|
|
40
|
+
<p> ✅ Correct
|
|
41
|
+
EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
42
|
+
|
|
43
|
+
<h3>Usage</h3>
|
|
44
|
+
\`\`\`typescript
|
|
45
|
+
import { OnFindMixin } from './OnFindMixin'
|
|
46
|
+
|
|
47
|
+
class Card extends OnFindMixin(ReadyMixin(LitElement)) {
|
|
48
|
+
firstUpdated(changed) {
|
|
49
|
+
super.firstUpdated(changed) // arms onFind
|
|
50
|
+
this.emit('btu-card-ready')
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
onFindRegistration() {
|
|
54
|
+
return {
|
|
55
|
+
selectors: ':scope > [slot], :scope > img, :scope > btu-badge, :scope > btu-icon',
|
|
56
|
+
callback: el => this.redistributeChild(el),
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
\`\`\`
|
|
61
|
+
`}}}},u={render:()=>{const e=`ofm-${Math.random().toString(36).slice(2,8)}`,n=g();let t=null,i=0;const d=()=>requestAnimationFrame(()=>{const s=document.getElementById(`${e}-count`);s&&(s.textContent=String(g()-n))}),c=()=>{i++;const s=document.createElement("div");return s.className="ofm-item rounded border bg-white p-3 text-sm",s.textContent=`Child ${i}`,s};return h`
|
|
62
|
+
<div class="space-y-4">
|
|
63
|
+
<p class="text-base">
|
|
64
|
+
The element below uses <code>OnFindMixin</code>. <strong>Mount</strong> registers its onFind callback;
|
|
65
|
+
<strong>Unmount</strong> disposes it (no leak); mounting again re-arms it. Watch the global callback count
|
|
66
|
+
rise to 1 on mount and fall back to 0 on unmount. <strong>Add child</strong> shows onFind still detecting and
|
|
67
|
+
highlighting children added at runtime.
|
|
68
|
+
</p>
|
|
69
|
+
|
|
70
|
+
<div class="flex gap-2">
|
|
71
|
+
<button data-testid="mount" @click=${()=>{const s=document.getElementById(`${e}-stage`);s&&(t||(t=document.createElement(b),t.append(c(),c())),t.isConnected||s.appendChild(t),d())}} class="btu-button btu-button-primary btu-button-sm">Mount</button>
|
|
72
|
+
<button data-testid="unmount" @click=${()=>{t?.remove(),d()}} class="btu-button btu-button-gray btu-button-sm">
|
|
73
|
+
Unmount
|
|
74
|
+
</button>
|
|
75
|
+
<button data-testid="add-child" @click=${()=>{t?.isConnected&&t.appendChild(c())}} class="btu-button btu-button-gray btu-button-sm">
|
|
76
|
+
Add child
|
|
77
|
+
</button>
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
<div id="${e}-stage" class="min-h-32 space-y-2 rounded border-2 border-gray-300 bg-gray-50 p-4">
|
|
81
|
+
<div class="text-sm text-gray-500">Mount the component to see its children detected and highlighted…</div>
|
|
82
|
+
</div>
|
|
83
|
+
|
|
84
|
+
<div>
|
|
85
|
+
<div class="text-xs text-gray-500">onFind callbacks registered by this demo</div>
|
|
86
|
+
<div data-testid="count" id="${e}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
`},parameters:{docs:{description:{story:'Live demo of the OnFindMixin lifecycle. Mounting registers an onFind callback (count → 1), unmounting disposes it (count → 0, so the detached element is collectable), and mounting again re-arms it. "Add child" shows onFind continuing to detect and highlight children added at runtime.'}}},play:async({canvasElement:e,step:n})=>{const t=w(e);await n("Mount registers a callback",async()=>{await l.click(t.getByTestId("mount")),await r(()=>a(t.getByTestId("count")).toHaveTextContent("1"))}),await n("Unmount disposes it (no leak)",async()=>{await l.click(t.getByTestId("unmount")),await r(()=>a(t.getByTestId("count")).toHaveTextContent("0"))}),await n("Re-mount re-arms it",async()=>{await l.click(t.getByTestId("mount")),await r(()=>a(t.getByTestId("count")).toHaveTextContent("1"))})}},m={render:()=>{const e=`ofm-multi-${Math.random().toString(36).slice(2,8)}`,n=g();let t=null;const i=()=>requestAnimationFrame(()=>{const o=document.getElementById(`${e}-count`);o&&(o.textContent=String(g()-n))}),d=(o,y)=>{const s=document.createElement("div");return s.className=`${o} rounded border bg-white p-3 text-sm`,s.textContent=y,s};return h`
|
|
90
|
+
<div class="space-y-4">
|
|
91
|
+
<p class="text-base">
|
|
92
|
+
This element registers <strong>two</strong> independent onFind sweeps via an array (<code
|
|
93
|
+
>onFindRegistration</code
|
|
94
|
+
>
|
|
95
|
+
returns <code>[A, B]</code>). Mounting registers both (count → 2), unmounting disposes both together (count →
|
|
96
|
+
0), and each sweep highlights only its own child type.
|
|
97
|
+
</p>
|
|
98
|
+
|
|
99
|
+
<div class="flex gap-2">
|
|
100
|
+
<button data-testid="multi-mount" @click=${()=>{const o=document.getElementById(`${e}-stage`);o&&(t||(t=document.createElement(p),t.append(d("ofm-a","Sweep A child"),d("ofm-b","Sweep B child"))),t.isConnected||o.appendChild(t),i())}} class="btu-button btu-button-primary btu-button-sm">
|
|
101
|
+
Mount
|
|
102
|
+
</button>
|
|
103
|
+
<button data-testid="multi-unmount" @click=${()=>{t?.remove(),i()}} class="btu-button btu-button-gray btu-button-sm">
|
|
104
|
+
Unmount
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div id="${e}-stage" class="min-h-32 space-y-2 rounded border-2 border-gray-300 bg-gray-50 p-4">
|
|
109
|
+
<div class="text-sm text-gray-500">Mount to see both sweeps register and highlight their children…</div>
|
|
110
|
+
</div>
|
|
111
|
+
|
|
112
|
+
<div>
|
|
113
|
+
<div class="text-xs text-gray-500">onFind callbacks registered by this demo</div>
|
|
114
|
+
<div data-testid="multi-count" id="${e}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
115
|
+
</div>
|
|
116
|
+
</div>
|
|
117
|
+
`},parameters:{docs:{description:{story:"Exercises the array form of onFindRegistration: one element registers two independent sweeps. Mounting registers both callbacks (count → 2), each sweep highlights only its own child type, and unmounting disposes both together (count → 0)."}}},play:async({canvasElement:e,step:n})=>{const t=w(e);await n("Mount registers both sweeps",async()=>{await l.click(t.getByTestId("multi-mount")),await r(()=>a(t.getByTestId("multi-count")).toHaveTextContent("2"))}),await n("Each sweep detects its own children",async()=>{await r(()=>{a(e.querySelector(".ofm-a.ring-2")).toBeTruthy(),a(e.querySelector(".ofm-b.ring-2")).toBeTruthy()})}),await n("Unmount disposes both",async()=>{await l.click(t.getByTestId("multi-unmount")),await r(()=>a(t.getByTestId("multi-count")).toHaveTextContent("0"))}),await n("Re-mount re-arms both",async()=>{await l.click(t.getByTestId("multi-mount")),await r(()=>a(t.getByTestId("multi-count")).toHaveTextContent("2"))})}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
118
|
+
render: () => {
|
|
119
|
+
const id = \`ofm-\${Math.random().toString(36).slice(2, 8)}\`;
|
|
120
|
+
const baseline = onFindCallbackCount();
|
|
121
|
+
let demoEl: HTMLElement | null = null;
|
|
122
|
+
let childN = 0;
|
|
123
|
+
const refresh = () => requestAnimationFrame(() => {
|
|
124
|
+
const el = document.getElementById(\`\${id}-count\`);
|
|
125
|
+
if (el) el.textContent = String(onFindCallbackCount() - baseline);
|
|
126
|
+
});
|
|
127
|
+
const makeChild = () => {
|
|
128
|
+
childN++;
|
|
129
|
+
const c = document.createElement('div');
|
|
130
|
+
c.className = 'ofm-item rounded border bg-white p-3 text-sm';
|
|
131
|
+
c.textContent = \`Child \${childN}\`;
|
|
132
|
+
return c;
|
|
133
|
+
};
|
|
134
|
+
|
|
135
|
+
// Mount creates the element on first use, or re-attaches the same detached
|
|
136
|
+
// instance afterwards — that re-attach is what exercises the mixin's reattach
|
|
137
|
+
// re-arm path.
|
|
138
|
+
const mount = () => {
|
|
139
|
+
const stage = document.getElementById(\`\${id}-stage\`);
|
|
140
|
+
if (!stage) return;
|
|
141
|
+
if (!demoEl) {
|
|
142
|
+
demoEl = document.createElement(DEMO_TAG);
|
|
143
|
+
demoEl.append(makeChild(), makeChild());
|
|
144
|
+
}
|
|
145
|
+
if (!demoEl.isConnected) stage.appendChild(demoEl);
|
|
146
|
+
refresh();
|
|
147
|
+
};
|
|
148
|
+
const unmount = () => {
|
|
149
|
+
demoEl?.remove();
|
|
150
|
+
refresh();
|
|
151
|
+
};
|
|
152
|
+
const addChild = () => {
|
|
153
|
+
if (demoEl?.isConnected) demoEl.appendChild(makeChild());
|
|
154
|
+
};
|
|
155
|
+
return html\`
|
|
156
|
+
<div class="space-y-4">
|
|
157
|
+
<p class="text-base">
|
|
158
|
+
The element below uses <code>OnFindMixin</code>. <strong>Mount</strong> registers its onFind callback;
|
|
159
|
+
<strong>Unmount</strong> disposes it (no leak); mounting again re-arms it. Watch the global callback count
|
|
160
|
+
rise to 1 on mount and fall back to 0 on unmount. <strong>Add child</strong> shows onFind still detecting and
|
|
161
|
+
highlighting children added at runtime.
|
|
162
|
+
</p>
|
|
163
|
+
|
|
164
|
+
<div class="flex gap-2">
|
|
165
|
+
<button data-testid="mount" @click=\${mount} class="btu-button btu-button-primary btu-button-sm">Mount</button>
|
|
166
|
+
<button data-testid="unmount" @click=\${unmount} class="btu-button btu-button-gray btu-button-sm">
|
|
167
|
+
Unmount
|
|
168
|
+
</button>
|
|
169
|
+
<button data-testid="add-child" @click=\${addChild} class="btu-button btu-button-gray btu-button-sm">
|
|
170
|
+
Add child
|
|
171
|
+
</button>
|
|
172
|
+
</div>
|
|
173
|
+
|
|
174
|
+
<div id="\${id}-stage" class="min-h-32 space-y-2 rounded border-2 border-gray-300 bg-gray-50 p-4">
|
|
175
|
+
<div class="text-sm text-gray-500">Mount the component to see its children detected and highlighted…</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
<div>
|
|
179
|
+
<div class="text-xs text-gray-500">onFind callbacks registered by this demo</div>
|
|
180
|
+
<div data-testid="count" id="\${id}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
181
|
+
</div>
|
|
182
|
+
</div>
|
|
183
|
+
\`;
|
|
184
|
+
},
|
|
185
|
+
parameters: {
|
|
186
|
+
docs: {
|
|
187
|
+
description: {
|
|
188
|
+
story: 'Live demo of the OnFindMixin lifecycle. Mounting registers an onFind callback (count → 1), unmounting disposes it (count → 0, so the detached element is collectable), and mounting again re-arms it. "Add child" shows onFind continuing to detect and highlight children added at runtime.'
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
play: async ({
|
|
193
|
+
canvasElement,
|
|
194
|
+
step
|
|
195
|
+
}) => {
|
|
196
|
+
const canvas = within(canvasElement);
|
|
197
|
+
await step('Mount registers a callback', async () => {
|
|
198
|
+
await userEvent.click(canvas.getByTestId('mount'));
|
|
199
|
+
await waitFor(() => expect(canvas.getByTestId('count')).toHaveTextContent('1'));
|
|
200
|
+
});
|
|
201
|
+
await step('Unmount disposes it (no leak)', async () => {
|
|
202
|
+
await userEvent.click(canvas.getByTestId('unmount'));
|
|
203
|
+
await waitFor(() => expect(canvas.getByTestId('count')).toHaveTextContent('0'));
|
|
204
|
+
});
|
|
205
|
+
await step('Re-mount re-arms it', async () => {
|
|
206
|
+
await userEvent.click(canvas.getByTestId('mount'));
|
|
207
|
+
await waitFor(() => expect(canvas.getByTestId('count')).toHaveTextContent('1'));
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
}`,...u.parameters?.docs?.source}}};m.parameters={...m.parameters,docs:{...m.parameters?.docs,source:{originalSource:`{
|
|
211
|
+
render: () => {
|
|
212
|
+
const id = \`ofm-multi-\${Math.random().toString(36).slice(2, 8)}\`;
|
|
213
|
+
const baseline = onFindCallbackCount();
|
|
214
|
+
let demoEl: HTMLElement | null = null;
|
|
215
|
+
const refresh = () => requestAnimationFrame(() => {
|
|
216
|
+
const el = document.getElementById(\`\${id}-count\`);
|
|
217
|
+
if (el) el.textContent = String(onFindCallbackCount() - baseline);
|
|
218
|
+
});
|
|
219
|
+
const makeChild = (cls: string, label: string) => {
|
|
220
|
+
const c = document.createElement('div');
|
|
221
|
+
c.className = \`\${cls} rounded border bg-white p-3 text-sm\`;
|
|
222
|
+
c.textContent = label;
|
|
223
|
+
return c;
|
|
224
|
+
};
|
|
225
|
+
const mount = () => {
|
|
226
|
+
const stage = document.getElementById(\`\${id}-stage\`);
|
|
227
|
+
if (!stage) return;
|
|
228
|
+
if (!demoEl) {
|
|
229
|
+
demoEl = document.createElement(MULTI_TAG);
|
|
230
|
+
demoEl.append(makeChild('ofm-a', 'Sweep A child'), makeChild('ofm-b', 'Sweep B child'));
|
|
231
|
+
}
|
|
232
|
+
if (!demoEl.isConnected) stage.appendChild(demoEl);
|
|
233
|
+
refresh();
|
|
234
|
+
};
|
|
235
|
+
const unmount = () => {
|
|
236
|
+
demoEl?.remove();
|
|
237
|
+
refresh();
|
|
238
|
+
};
|
|
239
|
+
return html\`
|
|
240
|
+
<div class="space-y-4">
|
|
241
|
+
<p class="text-base">
|
|
242
|
+
This element registers <strong>two</strong> independent onFind sweeps via an array (<code
|
|
243
|
+
>onFindRegistration</code
|
|
244
|
+
>
|
|
245
|
+
returns <code>[A, B]</code>). Mounting registers both (count → 2), unmounting disposes both together (count →
|
|
246
|
+
0), and each sweep highlights only its own child type.
|
|
247
|
+
</p>
|
|
248
|
+
|
|
249
|
+
<div class="flex gap-2">
|
|
250
|
+
<button data-testid="multi-mount" @click=\${mount} class="btu-button btu-button-primary btu-button-sm">
|
|
251
|
+
Mount
|
|
252
|
+
</button>
|
|
253
|
+
<button data-testid="multi-unmount" @click=\${unmount} class="btu-button btu-button-gray btu-button-sm">
|
|
254
|
+
Unmount
|
|
255
|
+
</button>
|
|
256
|
+
</div>
|
|
257
|
+
|
|
258
|
+
<div id="\${id}-stage" class="min-h-32 space-y-2 rounded border-2 border-gray-300 bg-gray-50 p-4">
|
|
259
|
+
<div class="text-sm text-gray-500">Mount to see both sweeps register and highlight their children…</div>
|
|
260
|
+
</div>
|
|
261
|
+
|
|
262
|
+
<div>
|
|
263
|
+
<div class="text-xs text-gray-500">onFind callbacks registered by this demo</div>
|
|
264
|
+
<div data-testid="multi-count" id="\${id}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
\`;
|
|
268
|
+
},
|
|
269
|
+
parameters: {
|
|
270
|
+
docs: {
|
|
271
|
+
description: {
|
|
272
|
+
story: 'Exercises the array form of onFindRegistration: one element registers two independent sweeps. Mounting registers both callbacks (count → 2), each sweep highlights only its own child type, and unmounting disposes both together (count → 0).'
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
play: async ({
|
|
277
|
+
canvasElement,
|
|
278
|
+
step
|
|
279
|
+
}) => {
|
|
280
|
+
const canvas = within(canvasElement);
|
|
281
|
+
await step('Mount registers both sweeps', async () => {
|
|
282
|
+
await userEvent.click(canvas.getByTestId('multi-mount'));
|
|
283
|
+
await waitFor(() => expect(canvas.getByTestId('multi-count')).toHaveTextContent('2'));
|
|
284
|
+
});
|
|
285
|
+
await step('Each sweep detects its own children', async () => {
|
|
286
|
+
await waitFor(() => {
|
|
287
|
+
expect(canvasElement.querySelector('.ofm-a.ring-2')).toBeTruthy();
|
|
288
|
+
expect(canvasElement.querySelector('.ofm-b.ring-2')).toBeTruthy();
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
await step('Unmount disposes both', async () => {
|
|
292
|
+
await userEvent.click(canvas.getByTestId('multi-unmount'));
|
|
293
|
+
await waitFor(() => expect(canvas.getByTestId('multi-count')).toHaveTextContent('0'));
|
|
294
|
+
});
|
|
295
|
+
await step('Re-mount re-arms both', async () => {
|
|
296
|
+
await userEvent.click(canvas.getByTestId('multi-mount'));
|
|
297
|
+
await waitFor(() => expect(canvas.getByTestId('multi-count')).toHaveTextContent('2'));
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}`,...m.parameters?.docs?.source}}};const T=["Demo","MultipleSweeps"];export{u as Demo,m as MultipleSweeps,T as __namedExportsOrder,M as default};
|
package/dist/storybook/assets/{Pagination.stories-CYrKX5iI.js → Pagination.stories-Co3mbyct.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as m,x as u}from"./iframe-
|
|
1
|
+
import{g as m,x as u}from"./iframe-DNJdsh5L.js";import{o as g}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:b,args:h,argTypes:y}=m("btu-pagination"),c=e=>{const t={};return e.customBackgroundColor&&(t["--pagination-color-background"]=e.customBackgroundColor),e.customForegroundColor&&(t["--pagination-color-foreground"]=e.customForegroundColor),t},$={title:"Components/Pagination",component:"btu-pagination",tags:["autodocs"],parameters:{docs:{subtitle:"A component for navigating through paged content",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>To navigate through large sets of data</li>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as p,x as l}from"./iframe-
|
|
1
|
+
import{g as p,x as l}from"./iframe-DNJdsh5L.js";import{o as a}from"./if-defined-CM2lJk-0.js";import{o as c}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:d,args:u,argTypes:t}=p("btu-popover"),h={title:"Components/Popover",component:"btu-popover",tags:["autodocs"],parameters:{docs:{subtitle:"Rich interactive content anchored to a trigger element",description:{component:`
|
|
2
2
|
\`btu-popover\` displays rich interactive content anchored to a trigger element using CSS anchor positioning and the native Popover API.
|
|
3
3
|
|
|
4
4
|
<h3>When to use:</h3>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./iframe-
|
|
1
|
+
import"./iframe-DNJdsh5L.js";const l=t=>{class n extends t{connectedCallback(){super.connectedCallback(),Promise.resolve().then(()=>this.emit("btu-element-connected",{}),e=>this.emit("btu-element-error",{error:e}))}disconnectedCallback(){super.disconnectedCallback(),this.emit("btu-element-disconnected")}emit(e,c){const a=new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:c});return this.dispatchEvent(a)}}return n},d=t=>{class n extends t{connectedCallback(){const e=()=>{super.connectedCallback()};document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",()=>e())}}return n};export{l as E,d as R};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as l,i as v}from"./iframe-
|
|
1
|
+
import{x as l,i as v}from"./iframe-DNJdsh5L.js";import{t as m}from"./custom-element-UsVr97OX.js";import"./preload-helper-PPVm8Dsz.js";const h=n=>{class i extends n{constructor(){super(...arguments),this._rovingIndex=0}_getRovingTargets(){return[]}_rovingFocus(t,e=!0){const o=this._getRovingTargets();if(o.length===0)return;const r=Math.max(0,Math.min(t,o.length-1));o.forEach((u,b)=>u.setAttribute("tabindex",b===r?"0":"-1")),e&&o[r]?.focus(),this._rovingIndex=r}_rovingNext(){const t=this._getRovingTargets();if(t.length===0)return;const e=this._rovingCurrentIndex(),o=e<t.length-1?e+1:0;this._rovingFocus(o)}_rovingPrev(){const t=this._getRovingTargets();if(t.length===0)return;const e=this._rovingCurrentIndex(),o=e>0?e-1:t.length-1;this._rovingFocus(o)}_rovingFirst(){this._rovingFocus(0)}_rovingLast(){const t=this._getRovingTargets();t.length>0&&this._rovingFocus(t.length-1)}_rovingCurrentIndex(){const t=document.activeElement;return this._getRovingTargets().findIndex(e=>e===t||e.contains(t))}}return i};var a=Object.freeze,x=Object.defineProperty,p=Object.getOwnPropertyDescriptor,f=(n,i,d,t)=>{for(var e=t>1?void 0:t?p(i,d):i,o=n.length-1,r;o>=0;o--)(r=n[o])&&(e=r(e)||e);return e},y=(n,i)=>a(x(n,"raw",{value:a(n.slice())})),c;const T={title:"Mixins/Roving Tabindex",tags:["autodocs"],parameters:{docs:{description:{component:`
|
|
2
2
|
\`RovingTabindexMixin\` provides **roving tabindex** navigation primitives for toolbar and menu components following the <a href="https://www.w3.org/WAI/ARIA/apd/practices/keyboard-interface/#kbd_roving_tabindex" target="_blank">WAI-ARIA Keyboard Interface Pattern</a>.
|
|
3
3
|
|
|
4
4
|
In a roving tabindex, only one element in the group has \`tabindex="0"\` (reachable via Tab), while all others have \`tabindex="-1"\`. Arrow keys move focus between items, wrapping at both ends.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as o}from"./iframe-
|
|
1
|
+
import{x as o}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";const r={title:"Utilities/RTC",tags:["autodocs"],parameters:{docs:{subtitle:"The `rtc` module provides real-time communication between browser tabs and the Brightspot CMS server. Uses BroadcastChannel for cross-tab coordination with leader election, and Server-Sent Events for server communication."},controls:{expanded:!0}}},e={render:()=>o`
|
|
2
2
|
<div class="space-y-6 text-sm">
|
|
3
3
|
<div>
|
|
4
4
|
<h3 class="mb-2 font-bold">Overview</h3>
|
package/dist/storybook/assets/{ScrollShadow.stories-BGh-Irt7.js → ScrollShadow.stories-Cmbqjk5X.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as a}from"./iframe-
|
|
1
|
+
import{x as a}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";const l=({theme:e="btu-scrollshadow-25"})=>{const r=new Array(100).fill(0).map((s,t)=>`Item ${t+1}`);return a`
|
|
2
2
|
<style>
|
|
3
3
|
:root {
|
|
4
4
|
--can-scroll: ;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as k,x as c}from"./iframe-
|
|
1
|
+
import{g as k,x as c}from"./iframe-DNJdsh5L.js";import{o as s}from"./if-defined-CM2lJk-0.js";import{o as f}from"./style-map-BZ07XihX.js";import{L as w}from"./LucideDynamicLoader-jmdq8YDM.js";import"./preload-helper-PPVm8Dsz.js";const{events:v,args:y,argTypes:g}=k("btu-switch"),x={customColorOn:"--switch-color-track-on",customColorOff:"--switch-color-track-off",customKnobColor:"--switch-color-knob",customLabelSpacing:"--switch-label-spacing",customIconSize:"--switch-track-icon-size"},S=e=>Object.entries(x).reduce((o,[t,n])=>(e[t]&&(o[n]=e[t]),o),{}),L={title:"Components/Switch",component:"btu-switch",tags:["autodocs"],parameters:{docs:{subtitle:"A toggle switch for binary on/off states",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>For toggling a setting or preference on/off</li>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as u,x as e}from"./iframe-
|
|
1
|
+
import{g as u,x as e}from"./iframe-DNJdsh5L.js";import{o as d}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:c,args:m,argTypes:t}=u("btu-tab"),y={title:"Components/Tabs/Tab",component:"btu-tab",tags:["autodocs"],parameters:{docs:{subtitle:"btu-tab",description:{component:`
|
|
2
2
|
An individual tab within a \`btu-tabs\` group.
|
|
3
3
|
|
|
4
4
|
Renders a button with \`role="tab"\` that participates in keyboard navigation and selection state managed by the parent \`btu-tabs\` container.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as b,E as i,x as s}from"./iframe-
|
|
1
|
+
import{g as b,E as i,x as s}from"./iframe-DNJdsh5L.js";import{o as c}from"./style-map-BZ07XihX.js";import"./preload-helper-PPVm8Dsz.js";const{events:d,args:u,argTypes:a}=b("btu-tabs"),h={title:"Components/Tabs",component:"btu-tabs",tags:["autodocs"],parameters:{docs:{subtitle:"btu-tabs",description:{component:`
|
|
2
2
|
A tab group component that manages selection state across a set of \`btu-tab\` children.
|
|
3
3
|
|
|
4
4
|
<h3>When to use:</h3>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as u}from"./iframe-
|
|
1
|
+
import{x as u}from"./iframe-DNJdsh5L.js";import"./preload-helper-PPVm8Dsz.js";function v(e,t){if(e<=0)return t;let n,o=0;return function(){if(n)return;const r=Date.now(),s=e-r+o;s<=0?(o=r,t.apply(this,[...arguments])):n=setTimeout(()=>{o=r,n=void 0,t.apply(this,[...arguments])},s)}}const x={title:"Utilities/Throttle",tags:["autodocs"],parameters:{docs:{subtitle:"The `throttle` utility function limits how often a function can execute, ensuring it runs at most once per specified interval. Useful for high-frequency events like scroll, resize, or mousemove."},controls:{expanded:!0}},argTypes:{interval:{control:{type:"number",min:0,max:2e3,step:50},description:"Throttle interval in milliseconds"}},args:{interval:200}},d={render:e=>{const t=`throttle-${Math.random().toString(36).substring(2,9)}`;let n=0,o=0;const r=()=>{const m=document.getElementById(`${t}-normal-count`),h=document.getElementById(`${t}-throttled-count`);m&&(m.textContent=String(n)),h&&(h.textContent=String(o))},s=v(e.interval,()=>{o++,r()}),a=()=>{n++,r()},l=()=>{a(),s()};return u`
|
|
2
2
|
<div class="space-y-4">
|
|
3
3
|
<div class="text-base">
|
|
4
4
|
<p class="mb-2">
|