@brightspot/ui 1.9.0 → 1.11.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/action-bar/ActionBar.d.ts +163 -0
- package/dist/components/action-bar/ActionBar.d.ts.map +1 -0
- package/dist/components/action-bar/ActionBar.js +479 -0
- package/dist/components/action-bar/ActionBar.js.map +1 -0
- package/dist/components/action-bar/ActionItem.d.ts +103 -0
- package/dist/components/action-bar/ActionItem.d.ts.map +1 -0
- package/dist/components/action-bar/ActionItem.js +237 -0
- package/dist/components/action-bar/ActionItem.js.map +1 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.d.ts.map +1 -1
- package/dist/components/copy-to-clipboard/CopyToClipboard.js +4 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.js.map +1 -1
- package/dist/components/dropdown/Dropdown.d.ts +3 -1
- package/dist/components/dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/dropdown/Dropdown.js +22 -6
- package/dist/components/dropdown/Dropdown.js.map +1 -1
- package/dist/components/dropdown/DropdownItem.d.ts +14 -1
- package/dist/components/dropdown/DropdownItem.d.ts.map +1 -1
- package/dist/components/dropdown/DropdownItem.js +20 -1
- package/dist/components/dropdown/DropdownItem.js.map +1 -1
- package/dist/components/dropdown/DropdownMenu.d.ts +3 -5
- package/dist/components/dropdown/DropdownMenu.d.ts.map +1 -1
- package/dist/components/dropdown/DropdownMenu.js +17 -32
- package/dist/components/dropdown/DropdownMenu.js.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +33 -4
- package/dist/components/pagination/Pagination.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.js +80 -16
- package/dist/components/pagination/Pagination.js.map +1 -1
- package/dist/components/switch/Switch.d.ts +92 -0
- package/dist/components/switch/Switch.d.ts.map +1 -0
- package/dist/components/switch/Switch.js +189 -0
- package/dist/components/switch/Switch.js.map +1 -0
- package/dist/components/tabs/Tab.d.ts +108 -0
- package/dist/components/tabs/Tab.d.ts.map +1 -0
- package/dist/components/tabs/Tab.js +152 -0
- package/dist/components/tabs/Tab.js.map +1 -0
- package/dist/components/tabs/Tabs.d.ts +126 -0
- package/dist/components/tabs/Tabs.d.ts.map +1 -0
- package/dist/components/tabs/Tabs.js +390 -0
- package/dist/components/tabs/Tabs.js.map +1 -0
- package/dist/custom-elements.json +2736 -1390
- package/dist/effects/celebrate.d.ts +18 -0
- package/dist/effects/celebrate.d.ts.map +1 -0
- package/dist/effects/celebrate.js +81 -0
- package/dist/effects/celebrate.js.map +1 -0
- package/dist/effects/ripple.d.ts +31 -0
- package/dist/effects/ripple.d.ts.map +1 -0
- package/dist/effects/ripple.js +131 -0
- package/dist/effects/ripple.js.map +1 -0
- package/dist/effects/sparkle-worklet.d.ts +7 -0
- package/dist/effects/sparkle-worklet.d.ts.map +1 -0
- package/dist/effects/sparkle-worklet.js +211 -0
- package/dist/effects/sparkle-worklet.js.map +1 -0
- package/dist/effects/sparkle.d.ts +6 -0
- package/dist/effects/sparkle.d.ts.map +1 -0
- package/dist/effects/sparkle.js +91 -0
- package/dist/effects/sparkle.js.map +1 -0
- package/dist/storybook/BSPLogoMark.svg +3 -0
- package/dist/storybook/WelcomeBG.svg +292 -0
- package/dist/storybook/assets/ActionBar.stories--nAeDC-G.js +408 -0
- package/dist/storybook/assets/ActionItem.stories-BHrGjk-P.js +203 -0
- package/dist/storybook/assets/{Avatar.stories-Du1qM73U.js → Avatar.stories-Da-mRj6_.js} +1 -1
- package/dist/storybook/assets/{AvatarGroup.stories-DxwZQE-q.js → AvatarGroup.stories-BQlaC_yl.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-CfvkMIx2.js → Badge.stories-DnVnOrnF.js} +1 -1
- package/dist/storybook/assets/Button-CFLAI1H9.js +10 -0
- package/dist/storybook/assets/Button.stories-DxaBOjwv.js +54 -0
- package/dist/storybook/assets/Celebrate.stories-CuMm15Nr.js +184 -0
- package/dist/storybook/assets/{CircularProgress.stories-rPzKwQYD.js → CircularProgress.stories-DRN8Mtvj.js} +1 -1
- package/dist/storybook/assets/{ClipboardMixin.stories-BlUeYDSi.js → ClipboardMixin.stories-DR7Ou2Av.js} +1 -1
- package/dist/storybook/assets/Color-6BZIO3FS-Die62Y0Z.js +1 -0
- package/dist/storybook/assets/{Colors.stories-BspfjZ5q.js → Colors.stories-bIq_ssbI.js} +1 -1
- package/dist/storybook/assets/CombinedEffects.stories-CtKzOUZn.js +355 -0
- package/dist/storybook/assets/{ComponentStatesMixin-eTV7XXqB.js → ComponentStatesMixin-DMLCk9fE.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories-BbLSY3df.js → ComponentStatesMixin.stories-D8UI9o-d.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-B2ailiFF.js → CopyToClipboard.stories-ti6CpJNp.js} +1 -1
- package/dist/storybook/assets/{Debounce.stories-DJmp4eNo.js → Debounce.stories-DzZUSvbk.js} +1 -1
- package/dist/storybook/assets/DocsRenderer-LL677BLK-CIRGv5IX.js +10 -0
- package/dist/storybook/assets/{Dropdown.stories-Dd6vKiDd.js → Dropdown.stories-Lt4cY0Re.js} +41 -14
- package/dist/storybook/assets/{Events.stories-Byj-VOM9.js → Events.stories-B1ddcgpT.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-Dqw-wzpx.js → Heading.stories-DI4w61cf.js} +1 -1
- package/dist/storybook/assets/HueRipple.stories-DjhoxxEw.js +310 -0
- package/dist/storybook/assets/{Icon.stories-Bp1nvWER.js → Icon.stories-CpziAhae.js} +1 -1
- package/dist/storybook/assets/{IconButton.stories-o9g9mGdh.js → IconButton.stories-KjN28hfc.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-DnXQVpzX.js → LinearProgress.stories-DcIpdz6R.js} +1 -1
- package/dist/storybook/assets/Pagination.stories-BBkLEwoP.js +252 -0
- package/dist/storybook/assets/{Popover.stories-BvavsRfq.js → Popover.stories-DLv48c2h.js} +3 -11
- package/dist/storybook/assets/{ReadyMixin-6On1MFFr.js → ReadyMixin-Cw2Dfbu2.js} +1 -1
- package/dist/storybook/assets/RovingTabindexMixin.stories-BWaFx9mu.js +192 -0
- package/dist/storybook/assets/{Rtc.stories-Bb5Y-908.js → Rtc.stories-Ve7Bwo_l.js} +1 -1
- package/dist/storybook/assets/ScrollShadow.stories-C6XmrRLm.js +17 -0
- package/dist/storybook/assets/Switch.stories-Cf8WM1LG.js +312 -0
- package/dist/storybook/assets/Tab.stories-CEtdEtOx.js +218 -0
- package/dist/storybook/assets/Tabs.stories-CIAO1bPO.js +211 -0
- package/dist/storybook/assets/{Throttle.stories-DmP-yKke.js → Throttle.stories-BqxVIb-r.js} +1 -1
- package/dist/storybook/assets/{Tooltip.stories-Dl6xHBaM.js → Tooltip.stories-B6fw6875.js} +3 -7
- package/dist/storybook/assets/Welcome.stories-CfJtSM19.js +215 -0
- package/dist/storybook/assets/{Widget.stories-BjXfgNjZ.js → Widget.stories-CiOho7lO.js} +1 -1
- package/dist/storybook/assets/WithTooltip-65CFNBJE-PGcopp73.js +9 -0
- package/dist/storybook/assets/blocks-dP2DwISI.js +707 -0
- package/dist/storybook/assets/celebrate-KwPoF1K3.js +21 -0
- package/dist/storybook/assets/formatter-EIJCOSYU-CZSAC3tg.js +1 -0
- package/dist/storybook/assets/if-defined-B1RdczOE.js +1 -0
- package/dist/storybook/assets/iframe-DloIUNZz.js +1104 -0
- package/dist/storybook/assets/{iframe-CNxIA3cQ.css → iframe-bJgLXZKK.css} +1 -1
- package/dist/storybook/assets/index-DKF0ypu5.js +1 -0
- package/dist/storybook/assets/onFind-C0l4Gew0.js +1 -0
- package/dist/storybook/assets/{onFind.stories-B2GYLrjV.js → onFind.stories-DOTt9puO.js} +2 -2
- package/dist/storybook/assets/{onRemove.stories-CoLJFkWa.js → onRemove.stories-CQ9ZC5dm.js} +1 -1
- package/dist/storybook/assets/{onVisible.stories-DOeZx7wi.js → onVisible.stories-Cbj5_Vz0.js} +2 -2
- package/dist/storybook/assets/position-CFNQy3J6.js +1 -0
- package/dist/storybook/assets/ripple-DQbyyRUw.js +251 -0
- package/dist/storybook/assets/style-map-DLXysq3r.js +1 -0
- package/dist/storybook/assets/syntaxhighlighter-ED5Y7EFY-Bjjbl9ca.js +6 -0
- package/dist/storybook/brightspot-logo.svg +19 -0
- package/dist/storybook/iframe.html +23 -3
- package/dist/storybook/index.html +42 -1
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/storybook-3/manager-bundle.js +3 -0
- package/dist/tailwind-plugin-action-bar.d.ts +2 -0
- package/dist/tailwind-plugin-action-bar.d.ts.map +1 -0
- package/dist/tailwind-plugin-action-bar.js +120 -0
- package/dist/tailwind-plugin-action-bar.js.map +1 -0
- package/dist/tailwind-plugin-action-bar.ts +134 -0
- package/dist/tailwind-plugin-badge.js +4 -5
- package/dist/tailwind-plugin-badge.js.map +1 -1
- package/dist/tailwind-plugin-badge.ts +4 -5
- package/dist/tailwind-plugin-button.js +1 -0
- package/dist/tailwind-plugin-button.js.map +1 -1
- package/dist/tailwind-plugin-button.ts +1 -0
- package/dist/tailwind-plugin-pagination.js +13 -23
- package/dist/tailwind-plugin-pagination.js.map +1 -1
- package/dist/tailwind-plugin-pagination.ts +15 -25
- package/dist/tailwind-plugin-switch.d.ts +2 -0
- package/dist/tailwind-plugin-switch.d.ts.map +1 -0
- package/dist/tailwind-plugin-switch.js +223 -0
- package/dist/tailwind-plugin-switch.js.map +1 -0
- package/dist/tailwind-plugin-switch.ts +252 -0
- package/dist/tailwind-plugin-tabs.d.ts +2 -0
- package/dist/tailwind-plugin-tabs.d.ts.map +1 -0
- package/dist/tailwind-plugin-tabs.js +151 -0
- package/dist/tailwind-plugin-tabs.js.map +1 -0
- package/dist/tailwind-plugin-tabs.ts +162 -0
- package/dist/util/EventEmitterMixin.d.ts +21 -0
- package/dist/util/EventEmitterMixin.d.ts.map +1 -1
- package/dist/util/EventEmitterMixin.js.map +1 -1
- package/dist/util/RovingTabindexMixin.d.ts +38 -0
- package/dist/util/RovingTabindexMixin.d.ts.map +1 -0
- package/dist/util/RovingTabindexMixin.js +83 -0
- package/dist/util/RovingTabindexMixin.js.map +1 -0
- package/dist/util/position.d.ts +9 -0
- package/dist/util/position.d.ts.map +1 -0
- package/dist/util/position.js +11 -0
- package/dist/util/position.js.map +1 -0
- package/docs/components/ActionBar.md +71 -0
- package/docs/components/ActionItem.md +76 -0
- package/docs/components/Dropdown.md +7 -7
- package/docs/components/DropdownItem.md +9 -5
- package/docs/components/DropdownMenu.md +12 -12
- package/docs/components/Pagination.md +37 -34
- package/docs/components/README.md +5 -0
- package/docs/components/Switch.md +79 -0
- package/docs/components/Tab.md +73 -0
- package/docs/components/Tabs.md +77 -0
- package/package.json +2 -1
- package/dist/storybook/assets/Button.stories-hDMDDh81.js +0 -63
- package/dist/storybook/assets/Color-6BZIO3FS-C_nQSB2u.js +0 -1
- package/dist/storybook/assets/DocsRenderer-LL677BLK-56Pige1J.js +0 -758
- package/dist/storybook/assets/Pagination.stories-DQD8uvDc.js +0 -272
- package/dist/storybook/assets/ScrollShadow.stories-ZovRXpte.js +0 -17
- package/dist/storybook/assets/WithTooltip-65CFNBJE-CGB5q-AN.js +0 -9
- package/dist/storybook/assets/_commonjsHelpers-CqkleIqs.js +0 -1
- package/dist/storybook/assets/formatter-EIJCOSYU-BhNtSFM9.js +0 -1
- package/dist/storybook/assets/if-defined-BFyUeSVF.js +0 -1
- package/dist/storybook/assets/iframe-BeKreX-l.js +0 -1061
- package/dist/storybook/assets/index-Uz2kGy8J.js +0 -1
- package/dist/storybook/assets/onFind-DqriYjEB.js +0 -1
- package/dist/storybook/assets/style-map-CmHqpCu1.js +0 -1
- package/dist/storybook/assets/syntaxhighlighter-ED5Y7EFY-BqFfcc7x.js +0 -6
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import{g as m,x as u}from"./iframe-DloIUNZz.js";import{o as g}from"./style-map-DLXysq3r.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
|
+
<h3>When to use:</h3>
|
|
3
|
+
<ul>
|
|
4
|
+
<li>To navigate through large sets of data</li>
|
|
5
|
+
<li>For search results, tables, and lists</li>
|
|
6
|
+
<li>In widgets and calendar views</li>
|
|
7
|
+
</ul>
|
|
8
|
+
|
|
9
|
+
<h3>Variants:</h3>
|
|
10
|
+
<ul>
|
|
11
|
+
<li><strong>Widget</strong> (default): Built-in page size dropdown + total display + navigation</li>
|
|
12
|
+
<li><strong>Search</strong>: With page jumper dropdown (auto-managed by Pagination)</li>
|
|
13
|
+
<li><strong>Widget Small</strong>: Without first/last page buttons</li>
|
|
14
|
+
<li><strong>Calendar</strong>: Custom page-size slot (consumer-managed) + jumper slot</li>
|
|
15
|
+
</ul>
|
|
16
|
+
|
|
17
|
+
<h3>Page size modes:</h3>
|
|
18
|
+
<ul>
|
|
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
|
+
<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
|
+
</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:e=>u`
|
|
23
|
+
<btu-pagination
|
|
24
|
+
total-items="${e["total-items"]??200}"
|
|
25
|
+
page="${e.page??1}"
|
|
26
|
+
page-size="${e["page-size"]??0}"
|
|
27
|
+
page-size-options="${e["page-size-options"]??"10, 20, 50"}"
|
|
28
|
+
?disabled="${e.disabled}"
|
|
29
|
+
?loading="${e.loading}"
|
|
30
|
+
.hideOnSinglePage=${e["hide-on-single-page"]??!0}
|
|
31
|
+
.pageSizeChanger=${e["page-size-changer"]??!0}
|
|
32
|
+
.boundaryButtons=${e["boundary-buttons"]??!0}
|
|
33
|
+
.pageJumper=${e["page-jumper"]??!1}
|
|
34
|
+
?hide-total-count=${e["hide-total-count"]}
|
|
35
|
+
style=${g(c(e))}
|
|
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.'}}}},s={args:{"total-items":100,"boundary-buttons":!1},parameters:{docs:{description:{story:"Compact widget variant without first/last page buttons. Suitable for tight spaces."}}}},i={args:{"total-items":52},render:e=>u`
|
|
38
|
+
<btu-pagination
|
|
39
|
+
total-items="${e["total-items"]??52}"
|
|
40
|
+
page="${e.page??1}"
|
|
41
|
+
page-size="1"
|
|
42
|
+
?disabled="${e.disabled}"
|
|
43
|
+
?loading="${e.loading}"
|
|
44
|
+
.hideOnSinglePage=${e["hide-on-single-page"]??!0}
|
|
45
|
+
.pageSizeChanger=${!1}
|
|
46
|
+
.boundaryButtons=${e["boundary-buttons"]??!0}
|
|
47
|
+
?hide-total-count=${e["hide-total-count"]}
|
|
48
|
+
style=${g(c(e))}
|
|
49
|
+
>
|
|
50
|
+
<btu-dropdown
|
|
51
|
+
slot="page-size"
|
|
52
|
+
label="Week"
|
|
53
|
+
variant="secondary"
|
|
54
|
+
size="small"
|
|
55
|
+
aria-label="View type"
|
|
56
|
+
@btu-dropdown-item-select=${t=>{t.currentTarget.label=t.detail.label}}
|
|
57
|
+
>
|
|
58
|
+
<btu-dropdown-menu>
|
|
59
|
+
<btu-dropdown-item label="Week" value="week" selected></btu-dropdown-item>
|
|
60
|
+
<btu-dropdown-item label="Month" value="month"></btu-dropdown-item>
|
|
61
|
+
</btu-dropdown-menu>
|
|
62
|
+
</btu-dropdown>
|
|
63
|
+
<button
|
|
64
|
+
slot="jumper"
|
|
65
|
+
class="btu-button btu-button-sm"
|
|
66
|
+
@click=${t=>{const n=t.target.closest("btu-pagination");n&&(n.page=1)}}
|
|
67
|
+
>
|
|
68
|
+
Today
|
|
69
|
+
</button>
|
|
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=t=>{const n=t.target;n.loading=!0,setTimeout(()=>{n.loading=!1},1e3)};return u`
|
|
72
|
+
<div class="flex flex-col gap-4">
|
|
73
|
+
<div class="flex items-center gap-2">
|
|
74
|
+
<label for="total-input" class="text-sm font-medium">Total Items:</label>
|
|
75
|
+
<input
|
|
76
|
+
id="total-input"
|
|
77
|
+
type="number"
|
|
78
|
+
value="200"
|
|
79
|
+
min="0"
|
|
80
|
+
class="w-24 rounded border px-2 py-1 text-sm"
|
|
81
|
+
@input=${t=>{const n=t.target,p=n.closest(".flex.flex-col")?.querySelector("btu-pagination");p&&(p.totalItems=parseInt(n.value,10)||0)}}
|
|
82
|
+
/>
|
|
83
|
+
</div>
|
|
84
|
+
<btu-pagination
|
|
85
|
+
total-items="200"
|
|
86
|
+
@btu-pagination-change=${e}
|
|
87
|
+
@btu-pagination-page-size-change=${e}
|
|
88
|
+
></btu-pagination>
|
|
89
|
+
</div>
|
|
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:`{
|
|
91
|
+
args: {},
|
|
92
|
+
parameters: {
|
|
93
|
+
docs: {
|
|
94
|
+
description: {
|
|
95
|
+
story: 'Default Widget variant with page size selector, total display, and full navigation controls.'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}`,...a.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
100
|
+
args: {
|
|
101
|
+
'total-items': 500,
|
|
102
|
+
'page-size-options': '10, 25, 50, 100',
|
|
103
|
+
'page-jumper': true
|
|
104
|
+
},
|
|
105
|
+
parameters: {
|
|
106
|
+
docs: {
|
|
107
|
+
description: {
|
|
108
|
+
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.'
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}`,...o.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
113
|
+
args: {
|
|
114
|
+
'total-items': 100,
|
|
115
|
+
'boundary-buttons': false
|
|
116
|
+
},
|
|
117
|
+
parameters: {
|
|
118
|
+
docs: {
|
|
119
|
+
description: {
|
|
120
|
+
story: 'Compact widget variant without first/last page buttons. Suitable for tight spaces.'
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}`,...s.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
125
|
+
args: {
|
|
126
|
+
'total-items': 52
|
|
127
|
+
},
|
|
128
|
+
render: args => html\`
|
|
129
|
+
<btu-pagination
|
|
130
|
+
total-items="\${args['total-items'] ?? 52}"
|
|
131
|
+
page="\${args.page ?? 1}"
|
|
132
|
+
page-size="1"
|
|
133
|
+
?disabled="\${args.disabled}"
|
|
134
|
+
?loading="\${args.loading}"
|
|
135
|
+
.hideOnSinglePage=\${args['hide-on-single-page'] ?? true}
|
|
136
|
+
.pageSizeChanger=\${false}
|
|
137
|
+
.boundaryButtons=\${args['boundary-buttons'] ?? true}
|
|
138
|
+
?hide-total-count=\${args['hide-total-count']}
|
|
139
|
+
style=\${styleMap(paginationStyles(args))}
|
|
140
|
+
>
|
|
141
|
+
<btu-dropdown
|
|
142
|
+
slot="page-size"
|
|
143
|
+
label="Week"
|
|
144
|
+
variant="secondary"
|
|
145
|
+
size="small"
|
|
146
|
+
aria-label="View type"
|
|
147
|
+
@btu-dropdown-item-select=\${(e: CustomEvent<{
|
|
148
|
+
label: string;
|
|
149
|
+
value: string;
|
|
150
|
+
selected: boolean;
|
|
151
|
+
}>) => {
|
|
152
|
+
;
|
|
153
|
+
(e.currentTarget as HTMLElement & {
|
|
154
|
+
label: string;
|
|
155
|
+
}).label = e.detail.label;
|
|
156
|
+
}}
|
|
157
|
+
>
|
|
158
|
+
<btu-dropdown-menu>
|
|
159
|
+
<btu-dropdown-item label="Week" value="week" selected></btu-dropdown-item>
|
|
160
|
+
<btu-dropdown-item label="Month" value="month"></btu-dropdown-item>
|
|
161
|
+
</btu-dropdown-menu>
|
|
162
|
+
</btu-dropdown>
|
|
163
|
+
<button
|
|
164
|
+
slot="jumper"
|
|
165
|
+
class="btu-button btu-button-sm"
|
|
166
|
+
@click=\${(e: Event) => {
|
|
167
|
+
const pagination = (e.target as HTMLElement).closest('btu-pagination');
|
|
168
|
+
if (pagination) pagination.page = 1;
|
|
169
|
+
}}
|
|
170
|
+
>
|
|
171
|
+
Today
|
|
172
|
+
</button>
|
|
173
|
+
</btu-pagination>
|
|
174
|
+
\`,
|
|
175
|
+
parameters: {
|
|
176
|
+
docs: {
|
|
177
|
+
description: {
|
|
178
|
+
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.'
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
}`,...i.parameters?.docs?.source}}};r.parameters={...r.parameters,docs:{...r.parameters?.docs,source:{originalSource:`{
|
|
183
|
+
args: {
|
|
184
|
+
'total-items': 200,
|
|
185
|
+
loading: true
|
|
186
|
+
},
|
|
187
|
+
parameters: {
|
|
188
|
+
docs: {
|
|
189
|
+
description: {
|
|
190
|
+
story: 'Loading state shows a spinner and dims the navigation controls. The \`aria-busy\` attribute is set on the live region.'
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}`,...r.parameters?.docs?.source}}};l.parameters={...l.parameters,docs:{...l.parameters?.docs,source:{originalSource:`{
|
|
195
|
+
args: {
|
|
196
|
+
'total-items': 200,
|
|
197
|
+
disabled: true,
|
|
198
|
+
page: 3
|
|
199
|
+
},
|
|
200
|
+
parameters: {
|
|
201
|
+
docs: {
|
|
202
|
+
description: {
|
|
203
|
+
story: 'Disabled state prevents all interaction. All buttons and dropdowns receive the native \`disabled\` attribute.'
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}`,...l.parameters?.docs?.source}}};d.parameters={...d.parameters,docs:{...d.parameters?.docs,source:{originalSource:`{
|
|
208
|
+
render: () => {
|
|
209
|
+
const simulateLoading = (e: CustomEvent) => {
|
|
210
|
+
const pagination = e.target as HTMLElement & {
|
|
211
|
+
loading: boolean;
|
|
212
|
+
};
|
|
213
|
+
pagination.loading = true;
|
|
214
|
+
setTimeout(() => {
|
|
215
|
+
pagination.loading = false;
|
|
216
|
+
}, 1000);
|
|
217
|
+
};
|
|
218
|
+
return html\`
|
|
219
|
+
<div class="flex flex-col gap-4">
|
|
220
|
+
<div class="flex items-center gap-2">
|
|
221
|
+
<label for="total-input" class="text-sm font-medium">Total Items:</label>
|
|
222
|
+
<input
|
|
223
|
+
id="total-input"
|
|
224
|
+
type="number"
|
|
225
|
+
value="200"
|
|
226
|
+
min="0"
|
|
227
|
+
class="w-24 rounded border px-2 py-1 text-sm"
|
|
228
|
+
@input=\${(e: Event) => {
|
|
229
|
+
const input = e.target as HTMLInputElement;
|
|
230
|
+
const pagination = (input.closest('.flex.flex-col') as HTMLElement)?.querySelector('btu-pagination') as HTMLElement & {
|
|
231
|
+
totalItems: number;
|
|
232
|
+
};
|
|
233
|
+
if (pagination) pagination.totalItems = parseInt(input.value, 10) || 0;
|
|
234
|
+
}}
|
|
235
|
+
/>
|
|
236
|
+
</div>
|
|
237
|
+
<btu-pagination
|
|
238
|
+
total-items="200"
|
|
239
|
+
@btu-pagination-change=\${simulateLoading}
|
|
240
|
+
@btu-pagination-page-size-change=\${simulateLoading}
|
|
241
|
+
></btu-pagination>
|
|
242
|
+
</div>
|
|
243
|
+
\`;
|
|
244
|
+
},
|
|
245
|
+
parameters: {
|
|
246
|
+
docs: {
|
|
247
|
+
description: {
|
|
248
|
+
story: 'Interactive example demonstrating dynamic \`totalItems\` changes at runtime. Navigation triggers a simulated 1s loading state.'
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}`,...d.parameters?.docs?.source}}};const z=["Default","Search","WidgetSmall","Calendar","Loading","Disabled","DynamicTotal"];export{i as Calendar,a as Default,l as Disabled,d as DynamicTotal,r as Loading,o as Search,s as WidgetSmall,z as __namedExportsOrder,$ as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as a,x as r}from"./iframe-
|
|
1
|
+
import{g as a,x as r}from"./iframe-DloIUNZz.js";import{o as c}from"./if-defined-B1RdczOE.js";import{o as d}from"./style-map-DLXysq3r.js";import"./preload-helper-PPVm8Dsz.js";const{events:u,args:g,argTypes:e}=a("btu-popover"),y={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>
|
|
@@ -90,7 +90,7 @@ import{g as a,x as r}from"./iframe-BeKreX-l.js";import{o as c}from"./if-defined-
|
|
|
90
90
|
<div slot="content">Popover positioned right of the trigger</div>
|
|
91
91
|
</btu-popover>
|
|
92
92
|
</div>
|
|
93
|
-
`,parameters:{docs:{description:{story:"Popovers support four positions: `top`, `bottom`, `left`, and `right`. Each auto-flips if constrained by the viewport."}
|
|
93
|
+
`,parameters:{docs:{description:{story:"Popovers support four positions: `top`, `bottom`, `left`, and `right`. Each auto-flips if constrained by the viewport."}}}},s={render:()=>r`
|
|
94
94
|
<style>
|
|
95
95
|
${p} .popover-custom-content {
|
|
96
96
|
display: flex;
|
|
@@ -182,7 +182,7 @@ import{g as a,x as r}from"./iframe-BeKreX-l.js";import{o as c}from"./if-defined-
|
|
|
182
182
|
</div>
|
|
183
183
|
</btu-popover>
|
|
184
184
|
</div>
|
|
185
|
-
`,parameters:{docs:{description:{story:"Two examples of rich popover content: a confirmation dialog with action buttons (click trigger), and a chart legend with colored series data (hover trigger)."}
|
|
185
|
+
`,parameters:{docs:{description:{story:"Two examples of rich popover content: a confirmation dialog with action buttons (click trigger), and a chart legend with colored series data (hover trigger)."}}}},l={render:()=>r`
|
|
186
186
|
<style>
|
|
187
187
|
${p} .custom-popover-trigger {
|
|
188
188
|
display: inline-flex;
|
|
@@ -260,10 +260,6 @@ import{g as a,x as r}from"./iframe-BeKreX-l.js";import{o as c}from"./if-defined-
|
|
|
260
260
|
docs: {
|
|
261
261
|
description: {
|
|
262
262
|
story: 'Popovers support four positions: \`top\`, \`bottom\`, \`left\`, and \`right\`. Each auto-flips if constrained by the viewport.'
|
|
263
|
-
},
|
|
264
|
-
story: {
|
|
265
|
-
inline: false,
|
|
266
|
-
iframeHeight: 300
|
|
267
263
|
}
|
|
268
264
|
}
|
|
269
265
|
}
|
|
@@ -365,10 +361,6 @@ import{g as a,x as r}from"./iframe-BeKreX-l.js";import{o as c}from"./if-defined-
|
|
|
365
361
|
docs: {
|
|
366
362
|
description: {
|
|
367
363
|
story: 'Two examples of rich popover content: a confirmation dialog with action buttons (click trigger), and a chart legend with colored series data (hover trigger).'
|
|
368
|
-
},
|
|
369
|
-
story: {
|
|
370
|
-
inline: false,
|
|
371
|
-
iframeHeight: 300
|
|
372
364
|
}
|
|
373
365
|
}
|
|
374
366
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./iframe-
|
|
1
|
+
import"./iframe-DloIUNZz.js";const i=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){return this.dispatchEvent(new CustomEvent(e,{bubbles:!0,cancelable:!1,composed:!0,detail:c}))}}return n},l=t=>{class n extends t{connectedCallback(){const e=()=>{super.connectedCallback()};document.readyState!=="loading"?e():document.addEventListener("DOMContentLoaded",()=>e())}}return n};export{i as E,l as R};
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
import{x as l,i as v}from"./iframe-DloIUNZz.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
|
+
\`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
|
+
|
|
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.
|
|
5
|
+
|
|
6
|
+
<h3>What RovingTabindexMixin Provides</h3>
|
|
7
|
+
|
|
8
|
+
<table>
|
|
9
|
+
<thead>
|
|
10
|
+
<tr>
|
|
11
|
+
<th>Member</th>
|
|
12
|
+
<th>Type</th>
|
|
13
|
+
<th>Description</th>
|
|
14
|
+
</tr>
|
|
15
|
+
</thead>
|
|
16
|
+
<tbody>
|
|
17
|
+
<tr>
|
|
18
|
+
<td><code>_getRovingTargets()</code></td>
|
|
19
|
+
<td>Method (override)</td>
|
|
20
|
+
<td>Return focusable <code>HTMLElement[]</code> in navigation order. <strong>Subclass must override.</strong></td>
|
|
21
|
+
</tr>
|
|
22
|
+
<tr>
|
|
23
|
+
<td><code>_rovingFocus(index, shouldFocus?)</code></td>
|
|
24
|
+
<td>Method</td>
|
|
25
|
+
<td>Set <code>tabindex="0"</code> on target at index, <code>"-1"</code> on all others. Focuses the element unless <code>shouldFocus=false</code>.</td>
|
|
26
|
+
</tr>
|
|
27
|
+
<tr>
|
|
28
|
+
<td><code>_rovingNext()</code></td>
|
|
29
|
+
<td>Method</td>
|
|
30
|
+
<td>Move focus to next target (wraps to first)</td>
|
|
31
|
+
</tr>
|
|
32
|
+
<tr>
|
|
33
|
+
<td><code>_rovingPrev()</code></td>
|
|
34
|
+
<td>Method</td>
|
|
35
|
+
<td>Move focus to previous target (wraps to last)</td>
|
|
36
|
+
</tr>
|
|
37
|
+
<tr>
|
|
38
|
+
<td><code>_rovingFirst()</code></td>
|
|
39
|
+
<td>Method</td>
|
|
40
|
+
<td>Focus the first target</td>
|
|
41
|
+
</tr>
|
|
42
|
+
<tr>
|
|
43
|
+
<td><code>_rovingLast()</code></td>
|
|
44
|
+
<td>Method</td>
|
|
45
|
+
<td>Focus the last target</td>
|
|
46
|
+
</tr>
|
|
47
|
+
<tr>
|
|
48
|
+
<td><code>_rovingCurrentIndex()</code></td>
|
|
49
|
+
<td>Method</td>
|
|
50
|
+
<td>Find index of the currently focused target</td>
|
|
51
|
+
</tr>
|
|
52
|
+
<tr>
|
|
53
|
+
<td><code>_rovingIndex</code></td>
|
|
54
|
+
<td>Property</td>
|
|
55
|
+
<td>Index of the last focused target</td>
|
|
56
|
+
</tr>
|
|
57
|
+
</tbody>
|
|
58
|
+
</table>
|
|
59
|
+
|
|
60
|
+
<h3>Keydown Handler is NOT Included</h3>
|
|
61
|
+
|
|
62
|
+
<p>The mixin intentionally does <strong>not</strong> install a keyboard event handler. Each component defines its own because:</p>
|
|
63
|
+
<ul>
|
|
64
|
+
<li><strong>Toolbars</strong> use <code>ArrowRight</code>/<code>ArrowLeft</code> (horizontal) with RTL awareness</li>
|
|
65
|
+
<li><strong>Menus</strong> use <code>ArrowDown</code>/<code>ArrowUp</code> (vertical) plus Enter/Space/Escape/Tab</li>
|
|
66
|
+
</ul>
|
|
67
|
+
|
|
68
|
+
<h3>Where It's Used</h3>
|
|
69
|
+
<ul>
|
|
70
|
+
<li><strong>ActionBar</strong> — horizontal toolbar with ArrowRight/Left, RTL support</li>
|
|
71
|
+
<li><strong>DropdownMenu</strong> — vertical menu with ArrowDown/Up, typeahead</li>
|
|
72
|
+
</ul>
|
|
73
|
+
|
|
74
|
+
<h3>TypeScript Usage</h3>
|
|
75
|
+
|
|
76
|
+
\`\`\`typescript
|
|
77
|
+
import { RovingTabindexMixin } from './RovingTabindexMixin'
|
|
78
|
+
import { EventEmitterMixin } from './EventEmitterMixin'
|
|
79
|
+
import { ReadyMixin } from './ReadyMixin'
|
|
80
|
+
import { LitElement } from 'lit'
|
|
81
|
+
|
|
82
|
+
class MyToolbar extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitElement))) {
|
|
83
|
+
// 1. Override to return your focusable elements
|
|
84
|
+
_getRovingTargets(): HTMLElement[] {
|
|
85
|
+
return Array.from(this.querySelectorAll('button'))
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// 2. Install your own keydown handler
|
|
89
|
+
connectedCallback() {
|
|
90
|
+
super.connectedCallback()
|
|
91
|
+
this.addEventListener('keydown', this._handleKeydown)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
private _handleKeydown = (e: KeyboardEvent) => {
|
|
95
|
+
switch (e.key) {
|
|
96
|
+
case 'ArrowRight': e.preventDefault(); this._rovingNext(); break
|
|
97
|
+
case 'ArrowLeft': e.preventDefault(); this._rovingPrev(); break
|
|
98
|
+
case 'Home': e.preventDefault(); this._rovingFirst(); break
|
|
99
|
+
case 'End': e.preventDefault(); this._rovingLast(); break
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
\`\`\`
|
|
104
|
+
|
|
105
|
+
<h3>Mixin Composition Order</h3>
|
|
106
|
+
|
|
107
|
+
\`\`\`typescript
|
|
108
|
+
class MyComponent extends RovingTabindexMixin(EventEmitterMixin(ReadyMixin(LitElement))) {}
|
|
109
|
+
\`\`\`
|
|
110
|
+
`}}}};let g=class extends h(v){constructor(){super(...arguments),this._handleKeydown=n=>{switch(n.key){case"ArrowRight":n.preventDefault(),this._rovingNext();break;case"ArrowLeft":n.preventDefault(),this._rovingPrev();break;case"Home":n.preventDefault(),this._rovingFirst();break;case"End":n.preventDefault(),this._rovingLast();break}}}createRenderRoot(){return this}_getRovingTargets(){return Array.from(this.querySelectorAll(".roving-demo-btn"))}connectedCallback(){super.connectedCallback(),this.addEventListener("keydown",this._handleKeydown)}disconnectedCallback(){super.disconnectedCallback(),this.removeEventListener("keydown",this._handleKeydown)}render(){return l`
|
|
111
|
+
<div role="toolbar" aria-label="Demo toolbar" style="display: flex; gap: 0.5rem;">
|
|
112
|
+
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="0">Item 1</button>
|
|
113
|
+
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 2</button>
|
|
114
|
+
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 3</button>
|
|
115
|
+
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 4</button>
|
|
116
|
+
<button class="roving-demo-btn btu-button btu-button-gray btu-button-md" tabindex="-1">Item 5</button>
|
|
117
|
+
</div>
|
|
118
|
+
`}};g=f([m("roving-demo")],g);const s={render:()=>l(c||(c=y([`<div class="flex flex-col gap-4">
|
|
119
|
+
<div>
|
|
120
|
+
<h4 class="mb-2 font-bold">Interactive Roving Tabindex Demo</h4>
|
|
121
|
+
<p class="mb-2 text-sm text-gray-600">
|
|
122
|
+
Click any button below, then use <strong>Arrow Right/Left</strong> to move focus between items.
|
|
123
|
+
<strong>Home</strong> and <strong>End</strong> jump to first/last. Focus wraps at both ends.
|
|
124
|
+
</p>
|
|
125
|
+
<p class="mb-4 text-sm text-gray-600">
|
|
126
|
+
Notice only the focused button has <code>tabindex="0"</code> — pressing <strong>Tab</strong> leaves the
|
|
127
|
+
toolbar entirely, and <strong>Shift+Tab</strong> returns to the last focused item.
|
|
128
|
+
</p>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<roving-demo id="roving-demo"></roving-demo>
|
|
132
|
+
|
|
133
|
+
<div id="roving-status" class="text-sm text-gray-500" style="font-family: monospace;"></div>
|
|
134
|
+
|
|
135
|
+
<script>
|
|
136
|
+
;(() => {
|
|
137
|
+
const demo = document.getElementById('roving-demo')
|
|
138
|
+
const status = document.getElementById('roving-status')
|
|
139
|
+
if (!demo || !status) return
|
|
140
|
+
|
|
141
|
+
demo.addEventListener('focusin', () => {
|
|
142
|
+
const buttons = demo.querySelectorAll('.roving-demo-btn')
|
|
143
|
+
const indices = Array.from(buttons).map(b => b.getAttribute('tabindex'))
|
|
144
|
+
status.textContent = 'tabindex: [' + indices.join(', ') + '] | _rovingIndex: ' + demo._rovingIndex
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
demo.addEventListener('keyup', () => {
|
|
148
|
+
const buttons = demo.querySelectorAll('.roving-demo-btn')
|
|
149
|
+
const indices = Array.from(buttons).map(b => b.getAttribute('tabindex'))
|
|
150
|
+
status.textContent = 'tabindex: [' + indices.join(', ') + '] | _rovingIndex: ' + demo._rovingIndex
|
|
151
|
+
})
|
|
152
|
+
})()
|
|
153
|
+
<\/script>
|
|
154
|
+
</div>`])))};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
155
|
+
render: () => html\`<div class="flex flex-col gap-4">
|
|
156
|
+
<div>
|
|
157
|
+
<h4 class="mb-2 font-bold">Interactive Roving Tabindex Demo</h4>
|
|
158
|
+
<p class="mb-2 text-sm text-gray-600">
|
|
159
|
+
Click any button below, then use <strong>Arrow Right/Left</strong> to move focus between items.
|
|
160
|
+
<strong>Home</strong> and <strong>End</strong> jump to first/last. Focus wraps at both ends.
|
|
161
|
+
</p>
|
|
162
|
+
<p class="mb-4 text-sm text-gray-600">
|
|
163
|
+
Notice only the focused button has <code>tabindex="0"</code> — pressing <strong>Tab</strong> leaves the
|
|
164
|
+
toolbar entirely, and <strong>Shift+Tab</strong> returns to the last focused item.
|
|
165
|
+
</p>
|
|
166
|
+
</div>
|
|
167
|
+
|
|
168
|
+
<roving-demo id="roving-demo"></roving-demo>
|
|
169
|
+
|
|
170
|
+
<div id="roving-status" class="text-sm text-gray-500" style="font-family: monospace;"></div>
|
|
171
|
+
|
|
172
|
+
<script>
|
|
173
|
+
;(() => {
|
|
174
|
+
const demo = document.getElementById('roving-demo')
|
|
175
|
+
const status = document.getElementById('roving-status')
|
|
176
|
+
if (!demo || !status) return
|
|
177
|
+
|
|
178
|
+
demo.addEventListener('focusin', () => {
|
|
179
|
+
const buttons = demo.querySelectorAll('.roving-demo-btn')
|
|
180
|
+
const indices = Array.from(buttons).map(b => b.getAttribute('tabindex'))
|
|
181
|
+
status.textContent = 'tabindex: [' + indices.join(', ') + '] | _rovingIndex: ' + demo._rovingIndex
|
|
182
|
+
})
|
|
183
|
+
|
|
184
|
+
demo.addEventListener('keyup', () => {
|
|
185
|
+
const buttons = demo.querySelectorAll('.roving-demo-btn')
|
|
186
|
+
const indices = Array.from(buttons).map(b => b.getAttribute('tabindex'))
|
|
187
|
+
status.textContent = 'tabindex: [' + indices.join(', ') + '] | _rovingIndex: ' + demo._rovingIndex
|
|
188
|
+
})
|
|
189
|
+
})()
|
|
190
|
+
<\/script>
|
|
191
|
+
</div>\`
|
|
192
|
+
}`,...s.parameters?.docs?.source}}};const A=["RovingTabindex"];export{s as RovingTabindex,A as __namedExportsOrder,T as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as o}from"./iframe-
|
|
1
|
+
import{x as o}from"./iframe-DloIUNZz.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>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import{x as a}from"./iframe-DloIUNZz.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
|
+
<style>
|
|
3
|
+
:root {
|
|
4
|
+
--can-scroll: ;
|
|
5
|
+
}
|
|
6
|
+
</style>
|
|
7
|
+
<div class=${["flex","gap-2","bg-gray-500",e].join(" ")}>
|
|
8
|
+
${r.map((s,t)=>a`<div
|
|
9
|
+
class="text-md flex aspect-square h-[100px] items-center justify-center"
|
|
10
|
+
style="background:oklch(80% 50% ${Math.floor(Math.random()*710)+10});"
|
|
11
|
+
>
|
|
12
|
+
${s}
|
|
13
|
+
</div>`)}
|
|
14
|
+
</div>
|
|
15
|
+
`},n={title:"CSS Plugins/Scroll Shadow",component:"btu-scrollshadow",tags:["autodocs"],parameters:{docs:{subtitle:"This Tailwind CSS plugin provides the `.btu-scrollshadow` utility class for adding shadows to the edges of a scrollable container once the content overflows. The shadows use our gray color palette. You can choose which shade of gray you want. The scroll container must not already use before & after pseudo elements. But, if you need to use before/after modifiers on the container, make sure you also manually set the content property to the `--whitespace` variable. This is a workaround for TWCSS automatically adding a content property to the before/after pseudo-elements, which overrides the `--whitespace` variable by default. Note: this currently only supports x-axis scrolling."},controls:{expanded:!0}},render:e=>l(e),argTypes:{theme:{control:{type:"select"},description:"Choose a shade of gray for the scroll shadow. 25 is almost white, and 900 is almost black.",options:["btu-scrollshadow-25","btu-scrollshadow-50","btu-scrollshadow-100","btu-scrollshadow-200","btu-scrollshadow-300","btu-scrollshadow-400","btu-scrollshadow-500","btu-scrollshadow-600","btu-scrollshadow-700","btu-scrollshadow-800","btu-scrollshadow-900"]}},args:{}},o={args:{}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
16
|
+
args: {}
|
|
17
|
+
}`,...o.parameters?.docs?.source}}};const i=["Default"];export{o as Default,i as __namedExportsOrder,n as default};
|