@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,4 +1,4 @@
|
|
|
1
|
-
import{g as v,x as s}from"./iframe-
|
|
1
|
+
import{g as v,x as s}from"./iframe-Byo_x5o2.js";import{o as f}from"./if-defined-DL7cQU7O.js";import{o as x}from"./style-map-DxZm5Cj7.js";import{L as g,B as h}from"./Icon-DPQKiWDz.js";import"./preload-helper-PPVm8Dsz.js";import"./property-_few0Xe5.js";import"./ReadyMixin-C8HW2nGE.js";const{events:y,args:z,argTypes:n}=v("btu-icon"),u=["xs","sm","md","lg","xl"],w=["ai","error","gray","primary","purple","rose","success","teal","warning"],B={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>
|
|
@@ -20,11 +20,11 @@ vendored and rendered via the <code>brand</code> attribute instead of <code>symb
|
|
|
20
20
|
See the <strong>Brands</strong> story below.</p>
|
|
21
21
|
`}},actions:{handles:y},controls:{expanded:!0}},args:{...z,symbol:"heart",size:"md"},argTypes:{...n,"--icon-size":{table:{disable:!0}},"--icon-fill":{table:{disable:!0}},"--icon-stroke-width":{table:{disable:!0}},"--icon-svg":{table:{disable:!0}},symbol:{...n.symbol,control:{type:"text"},description:'<a href="https://lucide.dev/icons/" target="_blank">Lucide</a> icon name. Note that only icons available in Lucide v'+g+" are supported.",table:{...n.symbol?.table,type:{summary:"string"}}},brand:{...n.brand,control:{type:"select"},options:["none",...Object.keys(h)],mapping:{none:void 0},description:"Vendored brand mark to display instead of a Lucide icon (see the Brands story). Takes precedence over `symbol`.",table:{...n.brand?.table,type:{summary:"string"}}},size:{...n.size,control:{type:"select"},options:u,description:"Icon size preset"},gradient:{...n.gradient,control:{type:"select"},options:w,description:"Gradient theme icon fill. When not set, icon inherits parent text color. **Cannot be combined with `emphasize`** — gradient takes precedence."},emphasize:{...n.emphasize,control:{type:"select"},options:["none","static","pulse"],mapping:{none:void 0,static:!0,pulse:"pulse"},description:'Emphasize mode. "static" renders a tonal circle with ring; "pulse" adds a one-shot ring animation. Color derives from currentColor (defaults to primary). **Cannot be combined with `gradient`** — gradient takes precedence and emphasize is ignored.'},customSize:{name:"--icon-size",control:{type:"text"},description:'Custom icon size - overrides the size preset (e.g., "3rem", "48px")',table:{category:"css properties"}},customFill:{name:"--icon-fill",control:{type:"text"},description:'An advanced option for creating filled-in icons via built-in CSS SVG styling. Works best with simple icons like "heart" or "star".',table:{category:"css properties"}},customStrokeWidth:{name:"--icon-stroke-width",control:{type:"range",min:.5,max:4,step:.25},description:"SVG stroke width as a unitless number in viewBox units; scales visually with icon size (default: 2).",table:{category:"css properties"}}},render:e=>{const t={};return e.customSize&&(t["--icon-size"]=e.customSize),e.customFill&&(t["--icon-fill"]=e.customFill),e.customStrokeWidth&&(t["--icon-stroke-width"]=e.customStrokeWidth),s`<btu-icon
|
|
22
22
|
symbol="${e.symbol}"
|
|
23
|
-
brand="${
|
|
23
|
+
brand="${f(e.brand||void 0)}"
|
|
24
24
|
size="${e.size}"
|
|
25
25
|
gradient="${e.gradient||""}"
|
|
26
26
|
.emphasize=${e.emphasize||void 0}
|
|
27
|
-
style=${
|
|
27
|
+
style=${x(t)}
|
|
28
28
|
></btu-icon>`}},o={args:{}},i={render:()=>s`<div class="flex items-center gap-4">
|
|
29
29
|
<btu-icon symbol="heart" size="xs"></btu-icon>
|
|
30
30
|
<btu-icon symbol="heart" size="sm"></btu-icon>
|
|
@@ -133,10 +133,10 @@ See the <strong>Brands</strong> story below.</p>
|
|
|
133
133
|
<div>
|
|
134
134
|
<div class="mb-2 text-sm font-semibold">Colors (via Tailwind text-* classes)</div>
|
|
135
135
|
<div class="flex items-center gap-6">
|
|
136
|
-
${[{symbol:"search",colorClass:"text-primary-600",label:"primary"},{symbol:"alert-circle",colorClass:"text-error-600",label:"error"},{symbol:"check-circle",colorClass:"text-success-600",label:"success"},{symbol:"settings",colorClass:"text-gray-500",label:"gray"},{symbol:"globe",colorClass:"text-teal-600",label:"teal"},{symbol:"alert-triangle",colorClass:"text-warning-600",label:"warning"}].map(({symbol:t,colorClass:
|
|
136
|
+
${[{symbol:"search",colorClass:"text-primary-600",label:"primary"},{symbol:"alert-circle",colorClass:"text-error-600",label:"error"},{symbol:"check-circle",colorClass:"text-success-600",label:"success"},{symbol:"settings",colorClass:"text-gray-500",label:"gray"},{symbol:"globe",colorClass:"text-teal-600",label:"teal"},{symbol:"alert-triangle",colorClass:"text-warning-600",label:"warning"}].map(({symbol:t,colorClass:b,label:p})=>s`
|
|
137
137
|
<div class="flex flex-col items-center gap-2">
|
|
138
|
-
<btu-icon symbol="${t}" size="lg" emphasize class="${
|
|
139
|
-
<span class="text-xs font-bold">${
|
|
138
|
+
<btu-icon symbol="${t}" size="lg" emphasize class="${b}"></btu-icon>
|
|
139
|
+
<span class="text-xs font-bold">${p}</span>
|
|
140
140
|
</div>
|
|
141
141
|
`)}
|
|
142
142
|
</div>
|
|
@@ -164,10 +164,10 @@ See the <strong>Brands</strong> story below.</p>
|
|
|
164
164
|
<div>
|
|
165
165
|
<div class="mb-2 text-sm font-semibold">Pulse animation (one-shot ring spring)</div>
|
|
166
166
|
<div class="flex items-center gap-6">
|
|
167
|
-
${[{symbol:"bell",colorClass:"text-primary-600",label:"notification"},{symbol:"alert-circle",colorClass:"text-error-600",label:"alert"},{symbol:"check-circle",colorClass:"text-success-600",label:"confirmed"}].map(({symbol:t,colorClass:
|
|
167
|
+
${[{symbol:"bell",colorClass:"text-primary-600",label:"notification"},{symbol:"alert-circle",colorClass:"text-error-600",label:"alert"},{symbol:"check-circle",colorClass:"text-success-600",label:"confirmed"}].map(({symbol:t,colorClass:b,label:p})=>s`
|
|
168
168
|
<div class="flex flex-col items-center gap-2">
|
|
169
|
-
<btu-icon symbol="${t}" size="lg" emphasize="pulse" class="${
|
|
170
|
-
<span class="text-xs font-bold">${
|
|
169
|
+
<btu-icon symbol="${t}" size="lg" emphasize="pulse" class="${b}"></btu-icon>
|
|
170
|
+
<span class="text-xs font-bold">${p}</span>
|
|
171
171
|
</div>
|
|
172
172
|
`)}
|
|
173
173
|
</div>
|
|
@@ -449,4 +449,4 @@ See the <strong>Brands</strong> story below.</p>
|
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
}
|
|
452
|
-
}`,...m.parameters?.docs?.source}}};const
|
|
452
|
+
}`,...m.parameters?.docs?.source}}};const N=["Default","Sizes","StrokeWidths","GradientIcons","Brands","AdvancedUsage","Emphasize","EmphasizePulse"];export{c as AdvancedUsage,l as Brands,o as Default,d as Emphasize,m as EmphasizePulse,r as GradientIcons,i as Sizes,a as StrokeWidths,N as __namedExportsOrder,B as default};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import{i as c,x as d}from"./iframe-Byo_x5o2.js";import{n as r}from"./property-_few0Xe5.js";import{o as l}from"./if-defined-DL7cQU7O.js";import{E as y,R as m}from"./ReadyMixin-C8HW2nGE.js";import{T as h}from"./TooltipMixin-CRNNusJ7.js";import"./Icon-DPQKiWDz.js";var f=Object.defineProperty,n=(a,t,e,s)=>{for(var o=void 0,u=a.length-1,p;u>=0;u--)(p=a[u])&&(o=p(t,e,o)||o);return o&&f(t,e,o),o};const b={primary:["btu-button-primary"],"primary-clear":["btu-button-primary","btu-button-fill-none"],"primary-stroke":["btu-button-primary","btu-button-fill-none","btu-button-outline"],secondary:["btu-button-gray"],"secondary-clear":["btu-button-gray","btu-button-fill-none"],"secondary-stroke":["btu-button-gray","btu-button-fill-none","btu-button-outline"],tertiary:["btu-button-teal"],"tertiary-clear":["btu-button-teal","btu-button-fill-none"],"tertiary-stroke":["btu-button-teal","btu-button-fill-none","btu-button-outline"]},v=new Set(["sm","md","lg"]);class i extends h(y(m(c))){constructor(){super(...arguments),this.type="primary",this.size="md",this.destructive=!1,this.disabled=!1}createRenderRoot(){return this}willUpdate(t){super.willUpdate(t),t.has("type")&&!(this.type in b)&&(console.warn(`[btu-icon-button] Unrecognized type: "${this.type}". Falling back to "primary".`),this.type="primary"),t.has("size")&&!v.has(this.size)&&(console.warn(`[btu-icon-button] Unrecognized size: "${this.size}". Falling back to "md".`),this.size="md")}updated(t){super.updated(t),this._relayTooltipAttrs()}_relayTooltipAttrs(){const t=this.querySelector("button");if(!t)return;const e=this.style.getPropertyValue("anchor-name");e&&(this.style.removeProperty("anchor-name"),t.style.setProperty("anchor-name",e));const s=this.querySelector("[data-tooltip-internal]");s?(this.removeAttribute("aria-describedby"),t.setAttribute("aria-describedby",s.id)):t.removeAttribute("aria-describedby")}firstUpdated(t){super.firstUpdated(t),!this.getAttribute("aria-label")?.trim()&&!this.tooltip?.trim()&&console.warn('[btu-icon-button] No accessible name provided. Set "aria-label" or "tooltip" for screen readers.',this),this.emit("btu-icon-button-ready")}_handleClick(){this.emit("btu-icon-button-click",{name:this.name})}_buildButtonClasses(){const t=b[this.type]??b.primary,e=this.destructive?"btu-button-error":t[0],s=t.slice(1);return["btu-button","btu-button-text-hidden",e,...s,`btu-button-${this.size}`].filter(Boolean).join(" ")}render(){const t=this.getAttribute("aria-label")?.trim()||this.tooltip?.trim()||void 0;return d`
|
|
2
|
+
<button
|
|
3
|
+
type="button"
|
|
4
|
+
class="${this._buildButtonClasses()}"
|
|
5
|
+
aria-label=${l(t)}
|
|
6
|
+
name=${l(this.name)}
|
|
7
|
+
?disabled=${this.disabled}
|
|
8
|
+
@click="${this._handleClick}"
|
|
9
|
+
>
|
|
10
|
+
<btu-icon symbol="${l(this.symbol)}" size="${this.size}"></btu-icon>
|
|
11
|
+
</button>
|
|
12
|
+
`}}n([r()],i.prototype,"name");n([r()],i.prototype,"type");n([r({type:String})],i.prototype,"symbol");n([r()],i.prototype,"size");n([r({type:Boolean})],i.prototype,"destructive");n([r({type:Boolean})],i.prototype,"disabled");customElements.get("btu-icon-button")||customElements.define("btu-icon-button",i);
|
package/dist/storybook/assets/{IconButton.stories-BHuHsM3k.js → IconButton.stories-DTbfHfcQ.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-Byo_x5o2.js";import{o as b}from"./if-defined-DL7cQU7O.js";import"./IconButton-Dp4Z06bL.js";import{L as d}from"./Icon-DPQKiWDz.js";import"./preload-helper-PPVm8Dsz.js";import"./property-_few0Xe5.js";import"./ReadyMixin-C8HW2nGE.js";import"./TooltipMixin-CRNNusJ7.js";const{events:u,args:y,argTypes:o}=p("btu-icon-button"),w={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>
|
|
@@ -725,4 +725,4 @@ import{g as p,x as e}from"./iframe-B9buZjP7.js";import{o as b}from"./if-defined-
|
|
|
725
725
|
}
|
|
726
726
|
}
|
|
727
727
|
}
|
|
728
|
-
}`,...c.parameters?.docs?.source}}};const
|
|
728
|
+
}`,...c.parameters?.docs?.source}}};const C=["Default","Types","Sizes","Destructive","WithTooltip","CommonActions","AdvancedUsage"];export{c as AdvancedUsage,l as CommonActions,n as Default,r as Destructive,a as Sizes,i as Types,s as WithTooltip,C as __namedExportsOrder,w as default};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import{i as l,E as i,x as a}from"./iframe-Byo_x5o2.js";import{E as r,R as n}from"./ReadyMixin-C8HW2nGE.js";import{P as o}from"./ProgressMixin-D1atDw3n.js";class c extends o(r(n(l))){constructor(){super(...arguments),this._initialClasses=[],this._initialClassesCaptured=!1}connectedCallback(){super.connectedCallback(),this._initialClassesCaptured||(this.className&&(this._initialClasses=this.className.split(" ").filter(e=>e.trim())),this._initialClassesCaptured=!0)}createRenderRoot(){return this}willUpdate(){const e=[...this._initialClasses,"inline-flex","items-center","w-full"];this.className=e.join(" ")}firstUpdated(e){super.firstUpdated(e),this._setupInitialAnimation()}disconnectedCallback(){super.disconnectedCallback(),this._cleanupInitialAnimation()}updated(e){super.updated(e),this._trackCompletion()}render(){const e=this.thickness??8,t=this._getProgressColorValue(),s=this._getAnimatedProgress();return a`
|
|
2
|
+
<div class="flex w-full items-center gap-3">
|
|
3
|
+
<span
|
|
4
|
+
class="flex-1 blokk"
|
|
5
|
+
role="progressbar"
|
|
6
|
+
aria-label="${this.ariaLabel||i}"
|
|
7
|
+
aria-labelledby="${this.ariaLabelledBy||i}"
|
|
8
|
+
aria-valuenow="${s}"
|
|
9
|
+
aria-valuemin="0"
|
|
10
|
+
aria-valuemax="100"
|
|
11
|
+
aria-valuetext="${this.ariaValueText||this.label||`${s} percent`}"
|
|
12
|
+
>
|
|
13
|
+
<div
|
|
14
|
+
class="relative overflow-hidden rounded-full bg-[var(--track-color,_oklch(var(--btu-theme-gray-100)))]"
|
|
15
|
+
style="height: ${e}px;"
|
|
16
|
+
>
|
|
17
|
+
<div
|
|
18
|
+
class="h-full rounded-full [transition:_width_0.3s_ease]"
|
|
19
|
+
style="width: ${s}%; background-color: ${t};"
|
|
20
|
+
></div>
|
|
21
|
+
</div>
|
|
22
|
+
</span>
|
|
23
|
+
${this.label?a`<span class="flex-shrink-0 whitespace-nowrap text-sm font-medium text-gray-700">${this.label}</span>`:""}
|
|
24
|
+
</div>
|
|
25
|
+
`}}customElements.get("btu-linear-progress")||customElements.define("btu-linear-progress",c);
|
|
@@ -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-Byo_x5o2.js";import{o as A}from"./style-map-DxZm5Cj7.js";import"./LinearProgress-DG3tPlGH.js";import"./preload-helper-PPVm8Dsz.js";import"./ReadyMixin-C8HW2nGE.js";import"./ProgressMixin-D1atDw3n.js";import"./property-_few0Xe5.js";import"./aria-D5THOgos.js";const{events:V,args:k,argTypes:g}=D("btu-linear-progress"),R={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>
|
|
@@ -394,4 +394,4 @@ Demonstrates accessibility best practices for screen reader users:
|
|
|
394
394
|
}
|
|
395
395
|
}
|
|
396
396
|
}
|
|
397
|
-
}`,...E.parameters?.docs?.source}}};const
|
|
397
|
+
}`,...E.parameters?.docs?.source}}};const z=["Default","DeterminateProgress","AnimatedProgress","InitialAnimation","CompletionEvent","Accessibility"];export{E as Accessibility,x as AnimatedProgress,C as CompletionEvent,v as Default,f as DeterminateProgress,y as InitialAnimation,z as __namedExportsOrder,R as default};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import{i as u,E as b,x as d}from"./iframe-Byo_x5o2.js";import{n as o}from"./property-_few0Xe5.js";import{E as p,R as h}from"./ReadyMixin-C8HW2nGE.js";import{l as g}from"./i18n-BQ-Uj-0B.js";import{o as f}from"./onFind-BWiaccUj.js";import"./IconButton-Dp4Z06bL.js";import"./Icon-DPQKiWDz.js";var v=Object.defineProperty,l=(c,e,i,r)=>{for(var s=void 0,t=c.length-1,a;t>=0;t--)(a=c[t])&&(s=a(e,i,s)||s);return s&&v(e,i,s),s};const y={primary:"info",info:"info",warning:"triangle-alert",error:"circle-alert",success:"circle-check"},m={primary:"btu-message-primary",info:"btu-message-info",warning:"btu-message-warning",error:"btu-message-error",success:"btu-message-success"};class n extends p(h(u)){constructor(){super(...arguments),this.variant="info",this.dismissible=!1,this._safeVariant="info"}createRenderRoot(){return this}connectedCallback(){super.connectedCallback(),this.classList.add("btu-message"),this.setAttribute("aria-atomic","true")}willUpdate(e){if(super.willUpdate(e),e.has("variant")){this._safeVariant=this.variant in m?this.variant:"info",this._safeVariant!==this.variant&&console.warn(`[btu-message] Unrecognized variant: "${this.variant}". Falling back to "info".`,this);const i=this._safeVariant==="error"||this._safeVariant==="primary";this.setAttribute("role",i?"alert":"status"),this.setAttribute("aria-live",i?"assertive":"polite");const r=m[this._safeVariant];for(const s of Object.values(m))s!==r&&this.classList.remove(s);this.classList.add(r)}}firstUpdated(){const e=!!this.querySelector(':scope > [slot="description"]');!this.label?.trim()&&!e&&console.warn("[btu-message] No label or description provided.",this);const i=this.querySelector(".btu-message-badge"),r=this.querySelector(".btu-message-description"),s=this.querySelector(".btu-message-actions");i&&r&&s&&f(this,":scope > :not([data-message-internal])",t=>{const a=t.getAttribute("slot");a==="badge"?i.appendChild(t):a==="description"?(r.appendChild(t),this.classList.add("btu-message-has-description")):a==="actions"?s.appendChild(t):console.warn(a?`[btu-message] Unrecognized slot="${a}". Valid slots are "badge", "description", and "actions".`:'[btu-message] Child element has no slot attribute. Use slot="badge", "description", or "actions".',t)}),this.emit("btu-message-ready")}_handleDismiss(){const e=new CustomEvent("btu-message-dismiss",{bubbles:!0,cancelable:!0,composed:!0});this.dispatchEvent(e)&&(this.hidden=!0)}render(){const e=this.symbol??y[this._safeVariant];return d`
|
|
2
|
+
<btu-icon
|
|
3
|
+
class="btu-message-icon"
|
|
4
|
+
symbol="${e}"
|
|
5
|
+
size="md"
|
|
6
|
+
aria-hidden="true"
|
|
7
|
+
data-message-internal
|
|
8
|
+
></btu-icon>
|
|
9
|
+
<div class="btu-message-body" data-message-internal>
|
|
10
|
+
<div class="btu-message-text">
|
|
11
|
+
<div class="btu-message-header">
|
|
12
|
+
<div class="btu-message-badge"></div>
|
|
13
|
+
${this.label?d`<span class="btu-message-label">${this.label}</span>`:b}
|
|
14
|
+
</div>
|
|
15
|
+
<div class="btu-message-description"></div>
|
|
16
|
+
</div>
|
|
17
|
+
<div class="btu-message-actions"></div>
|
|
18
|
+
</div>
|
|
19
|
+
${this.dismissible?d`<btu-icon-button
|
|
20
|
+
class="btu-message-dismiss"
|
|
21
|
+
symbol="x"
|
|
22
|
+
type="tertiary-clear"
|
|
23
|
+
size="sm"
|
|
24
|
+
aria-label="${g("message","dismiss","Dismiss")}"
|
|
25
|
+
@click=${this._handleDismiss}
|
|
26
|
+
data-message-internal
|
|
27
|
+
></btu-icon-button>`:b}
|
|
28
|
+
`}}l([o({type:String,reflect:!0})],n.prototype,"variant");l([o({type:String})],n.prototype,"label");l([o({type:String})],n.prototype,"symbol");l([o({type:Boolean,reflect:!0})],n.prototype,"dismissible");customElements.get("btu-message")||customElements.define("btu-message",n);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
btu-message:not(:defined)>[slot]{display:none}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as S,E as v,x as s}from"./iframe-
|
|
1
|
+
import{g as S,E as v,x as s}from"./iframe-Byo_x5o2.js";import{o as f}from"./if-defined-DL7cQU7O.js";import{o as w}from"./style-map-DxZm5Cj7.js";import"./Badge-AV20mCMJ.js";import"./Message-BzkpGg8z.js";import"./Pagination-CnWa6AX5.js";import{L as k}from"./Icon-DPQKiWDz.js";import"./preload-helper-PPVm8Dsz.js";import"./property-_few0Xe5.js";import"./ReadyMixin-C8HW2nGE.js";import"./i18n-BQ-Uj-0B.js";import"./aria-D5THOgos.js";import"./onFind-BWiaccUj.js";import"./IconButton-Dp4Z06bL.js";import"./TooltipMixin-CRNNusJ7.js";import"./CircularProgress-BeE2fWON.js";import"./ProgressMixin-D1atDw3n.js";import"./DropdownMenu-WoWnJiQk.js";import"./RovingTabindexMixin-DI5rmyR7.js";const{events:x,args:L,argTypes:o}=S("btu-message"),T=["primary","info","warning","error","success"],C=[{variant:"primary",label:"Scheduled maintenance on Saturday",description:"Expect up to 30 minutes of downtime starting at 02:00 UTC."},{variant:"info",label:"New feature released",description:"The redesigned editor is now available for all workspaces."},{variant:"warning",label:"API rate limits were updated",description:"Review your usage dashboard to make sure your integrations are still within limits."},{variant:"success",label:"Billing anomaly resolved",description:"All affected invoices have been corrected — no action needed."}],$=(e,t)=>{e.setAttribute("variant",t.variant),e.setAttribute("label",t.label);const n=e.querySelector(".btu-message-description");n&&(n.textContent=t.description??"")},j={title:"Components/Message",component:"btu-message",tags:["autodocs"],parameters:{docs:{subtitle:"High-visibility messages and persistent status anchored to a page or container",description:{component:`
|
|
2
2
|
<h3>When to use:</h3>
|
|
3
3
|
<ul>
|
|
4
4
|
<li>Communicate messages or provide feedback that is not tied to the user's current action or task</li>
|
|
@@ -429,4 +429,4 @@ import{g as S,E as v,x as s}from"./iframe-B9buZjP7.js";import{o as f}from"./if-d
|
|
|
429
429
|
}
|
|
430
430
|
}
|
|
431
431
|
}
|
|
432
|
-
}`,...g.parameters?.docs?.source}}};const
|
|
432
|
+
}`,...g.parameters?.docs?.source}}};const J=["Default","Variants","Dismissible","Paginated","BadgeSlot","DescriptionSlot","CustomIcon","WithActions","CustomStyling"];export{d as BadgeSlot,m as CustomIcon,g as CustomStyling,i as Default,b as DescriptionSlot,u as Dismissible,c as Paginated,l as Variants,p as WithActions,J as __namedExportsOrder,j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./iframe-Byo_x5o2.js";import{o as r}from"./onFind-BWiaccUj.js";const d=n=>{class i extends n{#t=[];onFindRegistration(){return null}#s(){if(this.#t.length)return;const t=this.onFindRegistration();if(!t)return;const e=Array.isArray(t)?t:[t];this.#t=e.map(s=>r(this,s.selectors,s.callback))}connectedCallback(){super.connectedCallback(),this.hasUpdated&&this.#s()}firstUpdated(t){super.firstUpdated(t),this.#s()}disconnectedCallback(){super.disconnectedCallback(),this.#t.forEach(t=>t()),this.#t=[]}}return i};export{d as O};
|
package/dist/storybook/assets/{OnFindMixin.stories-B-5TeBOF.js → OnFindMixin.stories-Dq06nuVf.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as h,i as v}from"./iframe-
|
|
1
|
+
import{x as h,i as v}from"./iframe-Byo_x5o2.js";import{O as x}from"./OnFindMixin-CeeYfx9k.js";import"./preload-helper-PPVm8Dsz.js";import"./onFind-BWiaccUj.js";const{expect:o,userEvent:d,waitFor:a,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
2
|
\`OnFindMixin\` registers an \`onFind\` child-redistribution callback and
|
|
3
3
|
**tears it down on disconnect**, so a detached component is garbage-collectable
|
|
4
4
|
and stops being visited on every document mutation.
|
|
@@ -58,7 +58,7 @@ EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
60
|
\`\`\`
|
|
61
|
-
`}}}},u={render:()=>{const e=`ofm-${Math.random().toString(36).slice(2,8)}`,n=g();let t=null,
|
|
61
|
+
`}}}},u={render:()=>{const e=`ofm-${Math.random().toString(36).slice(2,8)}`,n=g();let t=null,c=0;const r=()=>requestAnimationFrame(()=>{const i=document.getElementById(`${e}-count`);i&&(i.textContent=String(g()-n))}),l=()=>{c++;const i=document.createElement("div");return i.className="ofm-item rounded border bg-white p-3 text-sm",i.textContent=`Child ${c}`,i};return h`
|
|
62
62
|
<div class="space-y-4">
|
|
63
63
|
<p class="text-base">
|
|
64
64
|
The element below uses <code>OnFindMixin</code>. <strong>Mount</strong> registers its onFind callback;
|
|
@@ -68,11 +68,11 @@ EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
|
68
68
|
</p>
|
|
69
69
|
|
|
70
70
|
<div class="flex gap-2">
|
|
71
|
-
<button data-testid="mount" @click=${()=>{const
|
|
72
|
-
<button data-testid="unmount" @click=${()=>{t?.remove(),
|
|
71
|
+
<button data-testid="mount" @click=${()=>{const i=document.getElementById(`${e}-stage`);i&&(t||(t=document.createElement(b),t.append(l(),l())),t.isConnected||i.appendChild(t),r())}} class="btu-button btu-button-primary btu-button-sm">Mount</button>
|
|
72
|
+
<button data-testid="unmount" @click=${()=>{t?.remove(),r()}} class="btu-button btu-button-gray btu-button-sm">
|
|
73
73
|
Unmount
|
|
74
74
|
</button>
|
|
75
|
-
<button data-testid="add-child" @click=${()=>{t?.isConnected&&t.appendChild(
|
|
75
|
+
<button data-testid="add-child" @click=${()=>{t?.isConnected&&t.appendChild(l())}} class="btu-button btu-button-gray btu-button-sm">
|
|
76
76
|
Add child
|
|
77
77
|
</button>
|
|
78
78
|
</div>
|
|
@@ -86,7 +86,7 @@ EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
|
86
86
|
<div data-testid="count" id="${e}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
87
87
|
</div>
|
|
88
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
|
|
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 d.click(t.getByTestId("mount")),await a(()=>o(t.getByTestId("count")).toHaveTextContent("1"))}),await n("Unmount disposes it (no leak)",async()=>{await d.click(t.getByTestId("unmount")),await a(()=>o(t.getByTestId("count")).toHaveTextContent("0"))}),await n("Re-mount re-arms it",async()=>{await d.click(t.getByTestId("mount")),await a(()=>o(t.getByTestId("count")).toHaveTextContent("1"))})}},m={render:()=>{const e=`ofm-multi-${Math.random().toString(36).slice(2,8)}`,n=g();let t=null;const c=()=>requestAnimationFrame(()=>{const s=document.getElementById(`${e}-count`);s&&(s.textContent=String(g()-n))}),r=(s,y)=>{const i=document.createElement("div");return i.className=`${s} rounded border bg-white p-3 text-sm`,i.textContent=y,i};return h`
|
|
90
90
|
<div class="space-y-4">
|
|
91
91
|
<p class="text-base">
|
|
92
92
|
This element registers <strong>two</strong> independent onFind sweeps via an array (<code
|
|
@@ -97,10 +97,10 @@ EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
|
97
97
|
</p>
|
|
98
98
|
|
|
99
99
|
<div class="flex gap-2">
|
|
100
|
-
<button data-testid="multi-mount" @click=${()=>{const
|
|
100
|
+
<button data-testid="multi-mount" @click=${()=>{const s=document.getElementById(`${e}-stage`);s&&(t||(t=document.createElement(p),t.append(r("ofm-a","Sweep A child"),r("ofm-b","Sweep B child"))),t.isConnected||s.appendChild(t),c())}} class="btu-button btu-button-primary btu-button-sm">
|
|
101
101
|
Mount
|
|
102
102
|
</button>
|
|
103
|
-
<button data-testid="multi-unmount" @click=${()=>{t?.remove(),
|
|
103
|
+
<button data-testid="multi-unmount" @click=${()=>{t?.remove(),c()}} class="btu-button btu-button-gray btu-button-sm">
|
|
104
104
|
Unmount
|
|
105
105
|
</button>
|
|
106
106
|
</div>
|
|
@@ -114,7 +114,7 @@ EventEmitterMixin(OnFindMixin(ReadyMixin(LitElement)))</p>
|
|
|
114
114
|
<div data-testid="multi-count" id="${e}-count" class="text-2xl font-bold text-primary-600">0</div>
|
|
115
115
|
</div>
|
|
116
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
|
|
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 d.click(t.getByTestId("multi-mount")),await a(()=>o(t.getByTestId("multi-count")).toHaveTextContent("2"))}),await n("Each sweep detects its own children",async()=>{await a(()=>{o(e.querySelector(".ofm-a.ring-2")).toBeTruthy(),o(e.querySelector(".ofm-b.ring-2")).toBeTruthy()})}),await n("Unmount disposes both",async()=>{await d.click(t.getByTestId("multi-unmount")),await a(()=>o(t.getByTestId("multi-count")).toHaveTextContent("0"))}),await n("Re-mount re-arms both",async()=>{await d.click(t.getByTestId("multi-mount")),await a(()=>o(t.getByTestId("multi-count")).toHaveTextContent("2"))})}};u.parameters={...u.parameters,docs:{...u.parameters?.docs,source:{originalSource:`{
|
|
118
118
|
render: () => {
|
|
119
119
|
const id = \`ofm-\${Math.random().toString(36).slice(2, 8)}\`;
|
|
120
120
|
const baseline = onFindCallbackCount();
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
import{i as d,E as p,x as o}from"./iframe-Byo_x5o2.js";import{n}from"./property-_few0Xe5.js";import{E as b,R as c}from"./ReadyMixin-C8HW2nGE.js";import{l}from"./i18n-BQ-Uj-0B.js";import"./CircularProgress-BeE2fWON.js";import"./DropdownMenu-WoWnJiQk.js";import"./IconButton-Dp4Z06bL.js";var m=Object.defineProperty,r=(u,t,e,i)=>{for(var a=void 0,g=u.length-1,h;g>=0;g--)(h=u[g])&&(a=h(t,e,a)||a);return a&&m(t,e,a),a};class s extends b(c(d)){constructor(){super(...arguments),this.page=1,this.pageSize=0,this.disabled=!1,this.loading=!1,this.hideOnSinglePage=!0,this.pageSizeChanger=!0,this.pageSizeOptions="10, 20, 50",this.totalItems=0,this.boundaryButtons=!0,this.hideTotalCount=!1,this.pageJumper=!1,this._userInitiated=!1,this.initialClasses=[],this._initialClassesCaptured=!1,this._hideControls=!1}get _parsedPageSizeOptions(){const t=this.pageSizeOptions.split(",").map(e=>parseInt(e.trim(),10)).filter(e=>!isNaN(e)&&e>0);return t.length>0?t:[10]}get _totalPages(){return this.pageSize<=0?1:Math.max(1,Math.ceil(this.totalItems/this.pageSize))}get _startItem(){return this.totalItems===0?0:(this.page-1)*this.pageSize+1}get _endItem(){return this.totalItems===0?0:Math.min(this.page*this.pageSize,this.totalItems)}connectedCallback(){super.connectedCallback(),this._initialClassesCaptured||(this.className&&(this.initialClasses=this.className.split(" ").filter(t=>t.trim())),this._initialClassesCaptured=!0)}createRenderRoot(){return this}willUpdate(){(isNaN(this.totalItems)||this.totalItems<0)&&(this.totalItems=0),this.pageSize<=0&&(this.pageSize=this._parsedPageSizeOptions[0]);const t=this._parsedPageSizeOptions;t.includes(this.pageSize)||(this.pageSize=t[0]);const e=this._totalPages;this.page<1&&(this.page=1),this.page>e&&(this.page=e),this._hideControls=this.hideOnSinglePage&&this._totalPages<=1;const i=this._hideControls&&this.hideTotalCount,a=[...this.initialClasses,"btu-pagination",i?"btu-pagination-hidden":"",this.disabled?"btu-pagination-disabled":"",this.loading?"btu-pagination-loading":""];this.className=a.filter(Boolean).join(" ")}firstUpdated(){this.emit("btu-pagination-ready")}updated(t){super.updated(t),this._setupSlots(),this._userInitiated&&(this._userInitiated=!1,t.has("pageSize")&&this.emit("btu-pagination-page-size-change",{page:this.page,pageSize:this.pageSize}),t.has("page")&&this.emit("btu-pagination-change",{page:this.page,pageSize:this.pageSize}))}_setupSlots(){const t=this.querySelector(':scope > [slot="page-size"]');if(t){const i=this.querySelector(".btu-pagination-size-changer");i&&t.parentElement!==i&&i.appendChild(t)}const e=this.querySelector(':scope > [slot="jumper"]');if(e){const i=this.querySelector(".btu-pagination-jumper");i&&e.parentElement!==i&&i.appendChild(e)}}_goToFirstPage(t){this._userInitiated=!0,this.page=1,this._manageBoundaryFocus(t.currentTarget)}_goToPreviousPage(t){this._userInitiated=!0,this.page=Math.max(1,this.page-1),this._manageBoundaryFocus(t.currentTarget)}_goToNextPage(t){this._userInitiated=!0,this.page=Math.min(this._totalPages,this.page+1),this._manageBoundaryFocus(t.currentTarget)}_goToLastPage(t){this._userInitiated=!0,this.page=this._totalPages,this._manageBoundaryFocus(t.currentTarget)}_manageBoundaryFocus(t){this.updateComplete.then(()=>{if(t.disabled){const e=this.querySelectorAll(".btu-pagination-controls > btu-icon-button:not([disabled]) .btu-button");e.length>0&&e[0].focus()}})}_onBuiltinPageSizeSelect(t){const e=t.detail,i=parseInt(e.value,10);if(isNaN(i)||i<=0)return;this._userInitiated=!0,this.pageSize=i;const a=Math.max(1,Math.ceil(this.totalItems/i));this.page>a&&(this.page=a)}_onBuiltinJumperSelect(t){const e=parseInt(t.detail.value,10);!isNaN(e)&&e>=1&&e<=this._totalPages&&(this._userInitiated=!0,this.page=e)}render(){const t=this.page<=1,e=this.page>=this._totalPages,i=this._parsedPageSizeOptions;return o`
|
|
2
|
+
<nav class="btu-pagination-nav" aria-label="${this.label??l("pagination","navLabel","Pagination")}">
|
|
3
|
+
${this._hideControls?p:o`<div class="btu-pagination-size-changer">
|
|
4
|
+
${this.pageSizeChanger&&!this.querySelector('[slot="page-size"]')?o`
|
|
5
|
+
<btu-dropdown
|
|
6
|
+
label="${this.pageSize}"
|
|
7
|
+
variant="secondary"
|
|
8
|
+
size="sm"
|
|
9
|
+
aria-label="${l("pagination","itemsPerPage","Items per page")}"
|
|
10
|
+
?disabled=${this.disabled||this.loading}
|
|
11
|
+
@btu-dropdown-item-select=${this._onBuiltinPageSizeSelect}
|
|
12
|
+
>
|
|
13
|
+
<btu-dropdown-menu>
|
|
14
|
+
${i.map(a=>o`<btu-dropdown-item
|
|
15
|
+
label="${a}"
|
|
16
|
+
value="${a}"
|
|
17
|
+
?selected=${a===this.pageSize}
|
|
18
|
+
></btu-dropdown-item>`)}
|
|
19
|
+
</btu-dropdown-menu>
|
|
20
|
+
</btu-dropdown>
|
|
21
|
+
`:p}
|
|
22
|
+
</div>`}
|
|
23
|
+
${this.hideTotalCount?p:o`<div class="btu-pagination-total" aria-live="polite" aria-atomic="true" aria-busy="${this.loading}">
|
|
24
|
+
${this.totalItems>0?l("pagination","status","___-___ of ___",[this._startItem,this._endItem,this.totalItems]):p}
|
|
25
|
+
</div>`}
|
|
26
|
+
${this._hideControls?p:o`<div
|
|
27
|
+
class="btu-pagination-controls"
|
|
28
|
+
role="group"
|
|
29
|
+
aria-label="${l("pagination","pageNavigation","Page navigation")}"
|
|
30
|
+
>
|
|
31
|
+
${this.boundaryButtons?o`<btu-icon-button
|
|
32
|
+
symbol="chevrons-left"
|
|
33
|
+
size="sm"
|
|
34
|
+
type="secondary-clear"
|
|
35
|
+
aria-label="${l("pagination","goToFirstPage","Go to first page")}"
|
|
36
|
+
?disabled=${t||this.disabled||this.loading}
|
|
37
|
+
@click=${this._goToFirstPage}
|
|
38
|
+
></btu-icon-button>`:p}
|
|
39
|
+
|
|
40
|
+
<btu-icon-button
|
|
41
|
+
symbol="chevron-left"
|
|
42
|
+
size="sm"
|
|
43
|
+
type="secondary-clear"
|
|
44
|
+
aria-label="${l("pagination","goToPreviousPage","Go to previous page")}"
|
|
45
|
+
?disabled=${t||this.disabled||this.loading}
|
|
46
|
+
@click=${this._goToPreviousPage}
|
|
47
|
+
></btu-icon-button>
|
|
48
|
+
|
|
49
|
+
${this.pageJumper&&!this.querySelector('[slot="jumper"]')?o`<div class="btu-pagination-jumper">
|
|
50
|
+
<btu-dropdown
|
|
51
|
+
label="${l("pagination","pageLabel","Page ___",[this.page])}"
|
|
52
|
+
variant="secondary"
|
|
53
|
+
size="sm"
|
|
54
|
+
aria-label="${l("pagination","goToPage","Go to page")}"
|
|
55
|
+
?disabled=${this.disabled||this.loading}
|
|
56
|
+
@btu-dropdown-item-select=${this._onBuiltinJumperSelect}
|
|
57
|
+
>
|
|
58
|
+
<btu-dropdown-menu>
|
|
59
|
+
${Array.from({length:this._totalPages},(a,g)=>o`<btu-dropdown-item
|
|
60
|
+
label="${l("pagination","pageLabel","Page ___",[g+1])}"
|
|
61
|
+
value="${g+1}"
|
|
62
|
+
?selected=${g+1===this.page}
|
|
63
|
+
></btu-dropdown-item>`)}
|
|
64
|
+
</btu-dropdown-menu>
|
|
65
|
+
</btu-dropdown>
|
|
66
|
+
</div>`:o`<div class="btu-pagination-jumper"></div>`}
|
|
67
|
+
|
|
68
|
+
<btu-icon-button
|
|
69
|
+
symbol="chevron-right"
|
|
70
|
+
size="sm"
|
|
71
|
+
type="secondary-clear"
|
|
72
|
+
aria-label="${l("pagination","goToNextPage","Go to next page")}"
|
|
73
|
+
?disabled=${e||this.disabled||this.loading}
|
|
74
|
+
@click=${this._goToNextPage}
|
|
75
|
+
></btu-icon-button>
|
|
76
|
+
|
|
77
|
+
${this.boundaryButtons?o`<btu-icon-button
|
|
78
|
+
symbol="chevrons-right"
|
|
79
|
+
size="sm"
|
|
80
|
+
type="secondary-clear"
|
|
81
|
+
aria-label="${l("pagination","goToLastPage","Go to last page")}"
|
|
82
|
+
?disabled=${e||this.disabled||this.loading}
|
|
83
|
+
@click=${this._goToLastPage}
|
|
84
|
+
></btu-icon-button>`:p}
|
|
85
|
+
${this.loading?o`<btu-circular-progress size="sm"></btu-circular-progress>`:p}
|
|
86
|
+
</div>`}
|
|
87
|
+
</nav>
|
|
88
|
+
`}}r([n({type:Number})],s.prototype,"page");r([n({type:Number,attribute:"page-size"})],s.prototype,"pageSize");r([n({type:Boolean})],s.prototype,"disabled");r([n({type:Boolean})],s.prototype,"loading");r([n({type:Boolean,attribute:"hide-on-single-page"})],s.prototype,"hideOnSinglePage");r([n({type:Boolean,attribute:"page-size-changer"})],s.prototype,"pageSizeChanger");r([n({type:String,attribute:"page-size-options"})],s.prototype,"pageSizeOptions");r([n({type:Number,attribute:"total-items"})],s.prototype,"totalItems");r([n({type:Boolean,attribute:"boundary-buttons"})],s.prototype,"boundaryButtons");r([n({type:Boolean,attribute:"hide-total-count"})],s.prototype,"hideTotalCount");r([n({type:Boolean,attribute:"page-jumper"})],s.prototype,"pageJumper");r([n({type:String})],s.prototype,"label");customElements.get("btu-pagination")||customElements.define("btu-pagination",s);
|
package/dist/storybook/assets/{Pagination.stories-C9zsOdb2.js → Pagination.stories-BsH2eN2W.js}
RENAMED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as m,x as
|
|
1
|
+
import{g as m,x as p}from"./iframe-Byo_x5o2.js";import{o as g}from"./style-map-DxZm5Cj7.js";import"./Icon-DPQKiWDz.js";import"./Pagination-CnWa6AX5.js";import"./preload-helper-PPVm8Dsz.js";import"./property-_few0Xe5.js";import"./ReadyMixin-C8HW2nGE.js";import"./i18n-BQ-Uj-0B.js";import"./aria-D5THOgos.js";import"./CircularProgress-BeE2fWON.js";import"./ProgressMixin-D1atDw3n.js";import"./DropdownMenu-WoWnJiQk.js";import"./TooltipMixin-CRNNusJ7.js";import"./Badge-AV20mCMJ.js";import"./RovingTabindexMixin-DI5rmyR7.js";import"./IconButton-Dp4Z06bL.js";import"./if-defined-DL7cQU7O.js";const{events:b,args:h,argTypes:y}=m("btu-pagination"),c=t=>{const e={};return t.customBackgroundColor&&(e["--pagination-color-background"]=t.customBackgroundColor),t.customForegroundColor&&(e["--pagination-color-foreground"]=t.customForegroundColor),e},M={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>
|
|
@@ -19,33 +19,33 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
19
19
|
<li><strong>Built-in</strong>: No <code>slot="page-size"</code> — Pagination renders its own <code>btu-dropdown</code> from <code>page-size-options</code> and manages everything automatically.</li>
|
|
20
20
|
<li><strong>Custom</strong>: Provide <code>slot="page-size"</code> — built-in dropdown is suppressed. Consumer owns all behavior (events, label sync, etc.).</li>
|
|
21
21
|
</ul>
|
|
22
|
-
`}},actions:{handles:b},controls:{expanded:!0}},args:{...h,"total-items":200,"boundary-buttons":!0,"hide-on-single-page":!0,"page-size-changer":!0},argTypes:{...y,"--pagination-color-background":{table:{disable:!0}},"--pagination-color-foreground":{table:{disable:!0}},customBackgroundColor:{name:"--pagination-color-background",control:{type:"color"},description:"Custom background color for buttons and dropdowns",table:{category:"css properties"}},customForegroundColor:{name:"--pagination-color-foreground",control:{type:"color"},description:"Custom foreground (text/icon) color",table:{category:"css properties"}}},render:
|
|
22
|
+
`}},actions:{handles:b},controls:{expanded:!0}},args:{...h,"total-items":200,"boundary-buttons":!0,"hide-on-single-page":!0,"page-size-changer":!0},argTypes:{...y,"--pagination-color-background":{table:{disable:!0}},"--pagination-color-foreground":{table:{disable:!0}},customBackgroundColor:{name:"--pagination-color-background",control:{type:"color"},description:"Custom background color for buttons and dropdowns",table:{category:"css properties"}},customForegroundColor:{name:"--pagination-color-foreground",control:{type:"color"},description:"Custom foreground (text/icon) color",table:{category:"css properties"}}},render:t=>p`
|
|
23
23
|
<btu-pagination
|
|
24
|
-
total-items="${
|
|
25
|
-
page="${
|
|
26
|
-
page-size="${
|
|
27
|
-
page-size-options="${
|
|
28
|
-
?disabled="${
|
|
29
|
-
?loading="${
|
|
30
|
-
.hideOnSinglePage=${
|
|
31
|
-
.pageSizeChanger=${
|
|
32
|
-
.boundaryButtons=${
|
|
33
|
-
.pageJumper=${
|
|
34
|
-
?hide-total-count=${
|
|
35
|
-
style=${g(c(
|
|
24
|
+
total-items="${t["total-items"]??200}"
|
|
25
|
+
page="${t.page??1}"
|
|
26
|
+
page-size="${t["page-size"]??0}"
|
|
27
|
+
page-size-options="${t["page-size-options"]??"10, 20, 50"}"
|
|
28
|
+
?disabled="${t.disabled}"
|
|
29
|
+
?loading="${t.loading}"
|
|
30
|
+
.hideOnSinglePage=${t["hide-on-single-page"]??!0}
|
|
31
|
+
.pageSizeChanger=${t["page-size-changer"]??!0}
|
|
32
|
+
.boundaryButtons=${t["boundary-buttons"]??!0}
|
|
33
|
+
.pageJumper=${t["page-jumper"]??!1}
|
|
34
|
+
?hide-total-count=${t["hide-total-count"]}
|
|
35
|
+
style=${g(c(t))}
|
|
36
36
|
></btu-pagination>
|
|
37
|
-
`},a={args:{},parameters:{docs:{description:{story:"Default Widget variant with page size selector, total display, and full navigation controls."}}}},o={args:{"total-items":500,"page-size-options":"10, 25, 50, 100","page-jumper":!0},parameters:{docs:{description:{story:'Search variant with `page-jumper` enabled. The built-in dropdown renders "Page 1" through "Page N" and updates automatically when page size or total items change.'}}}},
|
|
37
|
+
`},a={args:{},parameters:{docs:{description:{story:"Default Widget variant with page size selector, total display, and full navigation controls."}}}},o={args:{"total-items":500,"page-size-options":"10, 25, 50, 100","page-jumper":!0},parameters:{docs:{description:{story:'Search variant with `page-jumper` enabled. The built-in dropdown renders "Page 1" through "Page N" and updates automatically when page size or total items change.'}}}},i={args:{"total-items":100,"boundary-buttons":!1},parameters:{docs:{description:{story:"Compact widget variant without first/last page buttons. Suitable for tight spaces."}}}},s={args:{"total-items":52},render:t=>p`
|
|
38
38
|
<btu-pagination
|
|
39
|
-
total-items="${
|
|
40
|
-
page="${
|
|
39
|
+
total-items="${t["total-items"]??52}"
|
|
40
|
+
page="${t.page??1}"
|
|
41
41
|
page-size="1"
|
|
42
|
-
?disabled="${
|
|
43
|
-
?loading="${
|
|
44
|
-
.hideOnSinglePage=${
|
|
42
|
+
?disabled="${t.disabled}"
|
|
43
|
+
?loading="${t.loading}"
|
|
44
|
+
.hideOnSinglePage=${t["hide-on-single-page"]??!0}
|
|
45
45
|
.pageSizeChanger=${!1}
|
|
46
|
-
.boundaryButtons=${
|
|
47
|
-
?hide-total-count=${
|
|
48
|
-
style=${g(c(
|
|
46
|
+
.boundaryButtons=${t["boundary-buttons"]??!0}
|
|
47
|
+
?hide-total-count=${t["hide-total-count"]}
|
|
48
|
+
style=${g(c(t))}
|
|
49
49
|
>
|
|
50
50
|
<btu-dropdown
|
|
51
51
|
slot="page-size"
|
|
@@ -53,7 +53,7 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
53
53
|
variant="secondary"
|
|
54
54
|
size="sm"
|
|
55
55
|
aria-label="View type"
|
|
56
|
-
@btu-dropdown-item-select=${
|
|
56
|
+
@btu-dropdown-item-select=${e=>{e.currentTarget.label=e.detail.label}}
|
|
57
57
|
>
|
|
58
58
|
<btu-dropdown-menu>
|
|
59
59
|
<btu-dropdown-item label="Week" value="week" selected></btu-dropdown-item>
|
|
@@ -63,12 +63,12 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
63
63
|
<button
|
|
64
64
|
slot="jumper"
|
|
65
65
|
class="btu-button btu-button-sm"
|
|
66
|
-
@click=${
|
|
66
|
+
@click=${e=>{const n=e.target.closest("btu-pagination");n&&(n.page=1)}}
|
|
67
67
|
>
|
|
68
68
|
Today
|
|
69
69
|
</button>
|
|
70
70
|
</btu-pagination>
|
|
71
|
-
`,parameters:{docs:{description:{story:'Calendar variant using `slot="page-size"` with a consumer-managed `btu-dropdown` for week/month selection and `slot="jumper"` for a Today button. The page-size dropdown is fully consumer-owned — Pagination does not manage its events or label.'}}}},r={args:{"total-items":200,loading:!0},parameters:{docs:{description:{story:"Loading state shows a spinner and dims the navigation controls. The `aria-busy` attribute is set on the live region."}}}},l={args:{"total-items":200,disabled:!0,page:3},parameters:{docs:{description:{story:"Disabled state prevents all interaction. All buttons and dropdowns receive the native `disabled` attribute."}}}},d={render:()=>{const e
|
|
71
|
+
`,parameters:{docs:{description:{story:'Calendar variant using `slot="page-size"` with a consumer-managed `btu-dropdown` for week/month selection and `slot="jumper"` for a Today button. The page-size dropdown is fully consumer-owned — Pagination does not manage its events or label.'}}}},r={args:{"total-items":200,loading:!0},parameters:{docs:{description:{story:"Loading state shows a spinner and dims the navigation controls. The `aria-busy` attribute is set on the live region."}}}},l={args:{"total-items":200,disabled:!0,page:3},parameters:{docs:{description:{story:"Disabled state prevents all interaction. All buttons and dropdowns receive the native `disabled` attribute."}}}},d={render:()=>{const t=e=>{const n=e.target;n.loading=!0,setTimeout(()=>{n.loading=!1},1e3)};return p`
|
|
72
72
|
<div class="flex flex-col gap-4">
|
|
73
73
|
<div class="flex items-center gap-2">
|
|
74
74
|
<label for="total-input" class="text-sm font-medium">Total Items:</label>
|
|
@@ -78,13 +78,13 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
78
78
|
value="200"
|
|
79
79
|
min="0"
|
|
80
80
|
class="w-24 rounded border px-2 py-1 text-sm"
|
|
81
|
-
@input=${
|
|
81
|
+
@input=${e=>{const n=e.target,u=n.closest(".flex.flex-col")?.querySelector("btu-pagination");u&&(u.totalItems=parseInt(n.value,10)||0)}}
|
|
82
82
|
/>
|
|
83
83
|
</div>
|
|
84
84
|
<btu-pagination
|
|
85
85
|
total-items="200"
|
|
86
|
-
@btu-pagination-change=${
|
|
87
|
-
@btu-pagination-page-size-change=${
|
|
86
|
+
@btu-pagination-change=${t}
|
|
87
|
+
@btu-pagination-page-size-change=${t}
|
|
88
88
|
></btu-pagination>
|
|
89
89
|
</div>
|
|
90
90
|
`},parameters:{docs:{description:{story:"Interactive example demonstrating dynamic `totalItems` changes at runtime. Navigation triggers a simulated 1s loading state."}}}};a.parameters={...a.parameters,docs:{...a.parameters?.docs,source:{originalSource:`{
|
|
@@ -109,7 +109,7 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
109
109
|
}
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
}`,...o.parameters?.docs?.source}}};
|
|
112
|
+
}`,...o.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
113
113
|
args: {
|
|
114
114
|
'total-items': 100,
|
|
115
115
|
'boundary-buttons': false
|
|
@@ -121,7 +121,7 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
123
|
}
|
|
124
|
-
}`,...
|
|
124
|
+
}`,...i.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
125
125
|
args: {
|
|
126
126
|
'total-items': 52
|
|
127
127
|
},
|
|
@@ -179,7 +179,7 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
179
179
|
}
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
}`,...
|
|
182
|
+
}`,...s.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
183
183
|
args: {
|
|
184
184
|
'total-items': 200,
|
|
185
185
|
loading: true
|
|
@@ -249,4 +249,4 @@ import{g as m,x as u}from"./iframe-B9buZjP7.js";import{o as g}from"./style-map-q
|
|
|
249
249
|
}
|
|
250
250
|
}
|
|
251
251
|
}
|
|
252
|
-
}`,...d.parameters?.docs?.source}}};const
|
|
252
|
+
}`,...d.parameters?.docs?.source}}};const B=["Default","Search","WidgetSmall","Calendar","Loading","Disabled","DynamicTotal"];export{s as Calendar,a as Default,l as Disabled,d as DynamicTotal,r as Loading,o as Search,i as WidgetSmall,B as __namedExportsOrder,M as default};
|