@brightspot/ui 1.3.0 → 1.4.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/custom-elements.json +144 -144
- package/dist/global.d.ts +10 -0
- package/dist/storybook/assets/{Avatar.stories-CpXI9mXR.js → Avatar.stories-QxWs-YfX.js} +1 -1
- package/dist/storybook/assets/{AvatarGroup.stories-D4NymG47.js → AvatarGroup.stories-Cy_Bvn7E.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-BP4Yixze.js → Badge.stories-BpaApWbR.js} +1 -1
- package/dist/storybook/assets/{Button.stories-DDpQzCOq.js → Button.stories-C5h2usmd.js} +1 -1
- package/dist/storybook/assets/{CircularProgress.stories-B82LXwfS.js → CircularProgress.stories-DlPOiGja.js} +1 -1
- package/dist/storybook/assets/{ClipboardMixin.stories-Cr3efF-v.js → ClipboardMixin.stories-Bb45-UOM.js} +1 -1
- package/dist/storybook/assets/Color-6BZIO3FS-CcgGYVAo.js +1 -0
- package/dist/storybook/assets/{Colors.stories-CeKs5FaB.js → Colors.stories-DP2JKWUJ.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin-BkLj42wt.js → ComponentStatesMixin-B7ci0thi.js} +1 -1
- package/dist/storybook/assets/{ComponentStatesMixin.stories--YPoyrpQ.js → ComponentStatesMixin.stories-CyQ2aSTu.js} +1 -1
- package/dist/storybook/assets/{CopyToClipboard.stories-6vqDwd-F.js → CopyToClipboard.stories-DR7pckeV.js} +1 -1
- package/dist/storybook/assets/Debounce.stories-hkqyvqmg.js +199 -0
- package/dist/storybook/assets/DocsRenderer-LL677BLK-Dtw9GMer.js +758 -0
- package/dist/storybook/assets/{Events.stories-DD9wfoHi.js → Events.stories-BAgDzdyl.js} +1 -1
- package/dist/storybook/assets/{Heading.stories-D-Pvm7NG.js → Heading.stories-CN_fPsRf.js} +1 -1
- package/dist/storybook/assets/{Icon.stories-BbR3S56H.js → Icon.stories-CSx_2K8V.js} +1 -1
- package/dist/storybook/assets/{LinearProgress.stories-B9XHLvVn.js → LinearProgress.stories-In48DY2g.js} +1 -1
- package/dist/storybook/assets/Rtc.stories-19d7WXe4.js +281 -0
- package/dist/storybook/assets/{ScrollShadow.stories-CHFpB4Zf.js → ScrollShadow.stories-BFjracVd.js} +1 -1
- package/dist/storybook/assets/{Throttle.stories-BGNJSyDp.js → Throttle.stories-DD6ydiVq.js} +8 -8
- package/dist/storybook/assets/WithTooltip-65CFNBJE-Be1dKqOF.js +9 -0
- package/dist/storybook/assets/formatter-EIJCOSYU-anC2P5HS.js +1 -0
- package/dist/storybook/assets/{iframe-CpEKhsmw.css → iframe-B4njXYq6.css} +1 -1
- package/dist/storybook/assets/iframe-Bl9oHz5c.js +1061 -0
- package/dist/storybook/assets/index-Cn5E5A3G.js +1 -0
- package/dist/storybook/assets/onFind-DqriYjEB.js +1 -0
- package/dist/storybook/assets/onFind.stories-BMDLUk0l.js +1069 -0
- package/dist/storybook/assets/onRemove.stories-C3FcxtYh.js +234 -0
- package/dist/storybook/assets/onVisible.stories-B8Zyu0Th.js +187 -0
- package/dist/storybook/assets/syntaxhighlighter-ED5Y7EFY-BfTKsIVL.js +6 -0
- package/dist/storybook/iframe.html +57 -39
- package/dist/storybook/index.html +11 -4
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/sb-addons/docs-1/manager-bundle.js +1 -1
- package/dist/storybook/sb-addons/storybook-core-server-presets-0/common-manager-bundle.js +112 -290
- package/dist/storybook/sb-addons/vitest-2/manager-bundle.js +3 -0
- package/dist/storybook/sb-manager/globals-runtime.js +60754 -66346
- package/dist/storybook/sb-manager/globals.js +2 -3
- package/dist/storybook/sb-manager/manager-stores.js +23 -0
- package/dist/storybook/sb-manager/runtime.js +12983 -11699
- package/dist/storybook/vite-inject-mocker-entry.js +2 -2
- package/dist/tailwind-plugin-button.js +3 -0
- package/dist/tailwind-plugin-button.js.map +1 -1
- package/dist/tailwind-plugin-button.ts +4 -0
- package/dist/util/Socket.d.ts +29 -0
- package/dist/util/Socket.d.ts.map +1 -0
- package/dist/util/Socket.js +153 -0
- package/dist/util/Socket.js.map +1 -0
- package/dist/util/Tether.d.ts +18 -0
- package/dist/util/Tether.d.ts.map +1 -0
- package/dist/util/Tether.js +102 -0
- package/dist/util/Tether.js.map +1 -0
- package/dist/util/TetherLayout.d.ts +12 -0
- package/dist/util/TetherLayout.d.ts.map +1 -0
- package/dist/util/TetherLayout.js +121 -0
- package/dist/util/TetherLayout.js.map +1 -0
- package/dist/util/debounce.d.ts +3 -0
- package/dist/util/debounce.d.ts.map +1 -0
- package/dist/util/debounce.js +15 -0
- package/dist/util/debounce.js.map +1 -0
- package/dist/util/focusable.d.ts +9 -0
- package/dist/util/focusable.d.ts.map +1 -0
- package/dist/util/focusable.js +19 -0
- package/dist/util/focusable.js.map +1 -0
- package/dist/util/getComponentKey.d.ts +2 -0
- package/dist/util/getComponentKey.d.ts.map +1 -0
- package/dist/util/getComponentKey.js +21 -0
- package/dist/util/getComponentKey.js.map +1 -0
- package/dist/util/keyboard.d.ts +8 -0
- package/dist/util/keyboard.d.ts.map +1 -0
- package/dist/util/keyboard.js +138 -0
- package/dist/util/keyboard.js.map +1 -0
- package/dist/util/noise.d.ts +6 -0
- package/dist/util/noise.d.ts.map +1 -0
- package/dist/util/noise.js +43 -0
- package/dist/util/noise.js.map +1 -0
- package/dist/util/onFind.d.ts +1 -0
- package/dist/util/onFind.d.ts.map +1 -1
- package/dist/util/onFind.js +73 -48
- package/dist/util/onFind.js.map +1 -1
- package/dist/util/onFindOnce.d.ts +3 -0
- package/dist/util/onFindOnce.d.ts.map +1 -0
- package/dist/util/onFindOnce.js +25 -0
- package/dist/util/onFindOnce.js.map +1 -0
- package/dist/util/onRTEReady.d.ts +22 -0
- package/dist/util/onRTEReady.d.ts.map +1 -0
- package/dist/util/onRTEReady.js +69 -0
- package/dist/util/onRTEReady.js.map +1 -0
- package/dist/util/onRemove.d.ts +7 -0
- package/dist/util/onRemove.d.ts.map +1 -0
- package/dist/util/onRemove.js +24 -0
- package/dist/util/onRemove.js.map +1 -0
- package/dist/util/onVisible.d.ts +3 -0
- package/dist/util/onVisible.d.ts.map +1 -0
- package/dist/util/onVisible.js +33 -0
- package/dist/util/onVisible.js.map +1 -0
- package/dist/util/previousUntil.d.ts +2 -0
- package/dist/util/previousUntil.d.ts.map +1 -0
- package/dist/util/previousUntil.js +21 -0
- package/dist/util/previousUntil.js.map +1 -0
- package/dist/util/repaint.d.ts +3 -0
- package/dist/util/repaint.d.ts.map +1 -0
- package/dist/util/repaint.js +14 -0
- package/dist/util/repaint.js.map +1 -0
- package/dist/util/rtc.d.ts +10 -0
- package/dist/util/rtc.d.ts.map +1 -0
- package/dist/util/rtc.js +184 -0
- package/dist/util/rtc.js.map +1 -0
- package/dist/util/storage.d.ts +6 -0
- package/dist/util/storage.d.ts.map +1 -0
- package/dist/util/storage.js +18 -0
- package/dist/util/storage.js.map +1 -0
- package/dist/util/transition.d.ts +2 -0
- package/dist/util/transition.d.ts.map +1 -0
- package/dist/util/transition.js +4 -0
- package/dist/util/transition.js.map +1 -0
- package/dist/util/types.d.ts +10 -0
- package/dist/util/types.d.ts.map +1 -0
- package/dist/util/types.js +2 -0
- package/dist/util/types.js.map +1 -0
- package/package.json +17 -6
- package/dist/storybook/assets/Color-64QXVMR3-BucypS4O.js +0 -1
- package/dist/storybook/assets/WithTooltip-SK46ZJ2J-QQZnlVfm.js +0 -825
- package/dist/storybook/assets/formatter-OMEEQ6HG-D3LRXsK-.js +0 -1
- package/dist/storybook/assets/iframe-D-tG1MVV.js +0 -1064
- package/dist/storybook/assets/index-mcT8sPvs.js +0 -1
- package/dist/storybook/assets/onFind.stories-Dagoyfc5.js +0 -284
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-BoS99i_u.js +0 -6
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as c,i as p}from"./iframe-
|
|
1
|
+
import{x as c,i as p}from"./iframe-Bl9oHz5c.js";import{t as m,C as u}from"./ComponentStatesMixin-B7ci0thi.js";import"./preload-helper-PPVm8Dsz.js";var r=Object.freeze,b=Object.defineProperty,h=Object.getOwnPropertyDescriptor,x=(e,o,g,d)=>{for(var t=d>1?void 0:d?h(o,g):o,s=e.length-1,n;s>=0;s--)(n=e[s])&&(t=n(t)||t);return t},f=(e,o)=>r(b(e,"raw",{value:r(e.slice())})),l;const E={title:"Mixins/Component States",tags:["autodocs"],parameters:{docs:{description:{component:`
|
|
2
2
|
\`ComponentStatesMixin\` provides access to the **Custom State API** for managing component-specific states that can be styled with the \`:state()\` pseudo-class in CSS.
|
|
3
3
|
|
|
4
4
|
Uses \`ElementInternals.states\` (\`CustomStateSet\`) to manage component states that are separate from attributes, providing better encapsulation and performance.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{g as s,x as i}from"./iframe-
|
|
1
|
+
import{g as s,x as i}from"./iframe-Bl9oHz5c.js";import"./preload-helper-PPVm8Dsz.js";var r=Object.freeze,c=Object.defineProperty,p=(e,l)=>r(c(e,"raw",{value:r(l||e.slice())})),d;const{events:b,args:u,argTypes:a}=s("btu-copy-to-clipboard"),f={title:"Components/CopyToClipboard",component:"btu-copy-to-clipboard",tags:["autodocs"],parameters:{docs:{subtitle:"btu-copy-to-clipboard",description:{component:`
|
|
2
2
|
A button component for copying text to the clipboard. The button becomes disabled and displays a success state for 3 seconds after copying.
|
|
3
3
|
|
|
4
4
|
<h3>When to use:</h3>
|
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
import{x as c}from"./iframe-Bl9oHz5c.js";import"./preload-helper-PPVm8Dsz.js";function p(n,e){if(n<=0)return e;let t;return function(){clearTimeout(t),t=setTimeout(()=>{t=void 0,e.apply(this,[...arguments])},n)}}const g={title:"Utilities/Debounce",tags:["autodocs"],parameters:{docs:{subtitle:"The `debounce` utility delays function execution until a specified wait period has elapsed since the last invocation. Useful for search inputs, form validation, and window resize handlers."},controls:{expanded:!0}},argTypes:{wait:{control:{type:"number",min:0,max:2e3,step:50},description:"Debounce wait time in milliseconds"}},args:{wait:300}},o={render:n=>{const e=`debounce-${Math.random().toString(36).substring(2,9)}`;let t=0,i=0;const d=()=>{const a=document.getElementById(`${e}-normal-count`),r=document.getElementById(`${e}-debounced-count`);a&&(a.textContent=String(t)),r&&(r.textContent=String(i))},l=p(n.wait,()=>{i++,d()}),u=()=>{t++,d(),l()};return c`
|
|
2
|
+
<div class="space-y-4">
|
|
3
|
+
<div class="text-base">
|
|
4
|
+
<p class="mb-2">
|
|
5
|
+
Type in the input below. The normal counter increments on every keystroke, while the debounced counter only
|
|
6
|
+
fires after ${n.wait}ms of inactivity.
|
|
7
|
+
</p>
|
|
8
|
+
</div>
|
|
9
|
+
|
|
10
|
+
<input
|
|
11
|
+
@input=${u}
|
|
12
|
+
type="text"
|
|
13
|
+
placeholder="Start typing..."
|
|
14
|
+
class="w-full rounded border-2 border-gray-300 px-4 py-2 focus:border-blue-500 focus:outline-none"
|
|
15
|
+
/>
|
|
16
|
+
|
|
17
|
+
<div class="flex justify-around">
|
|
18
|
+
<div>
|
|
19
|
+
<div class="text-xs text-gray-500">Keystrokes</div>
|
|
20
|
+
<div id="${e}-normal-count" class="text-2xl font-bold text-gray-900">0</div>
|
|
21
|
+
</div>
|
|
22
|
+
<div>
|
|
23
|
+
<div class="text-xs text-gray-500">Debounced calls (${n.wait}ms)</div>
|
|
24
|
+
<div id="${e}-debounced-count" class="text-primary-600 text-2xl font-bold">0</div>
|
|
25
|
+
</div>
|
|
26
|
+
</div>
|
|
27
|
+
|
|
28
|
+
<button
|
|
29
|
+
@click=${()=>{t=0,i=0,d()}}
|
|
30
|
+
class="rounded bg-gray-200 px-4 py-2 hover:bg-gray-300"
|
|
31
|
+
>
|
|
32
|
+
Reset Counters
|
|
33
|
+
</button>
|
|
34
|
+
</div>
|
|
35
|
+
`},parameters:{docs:{description:{story:"Interactive example showing debounce in action. Type rapidly in the input to see how the debounced handler waits for a pause before executing."}}}},s={render:()=>c`
|
|
36
|
+
<div class="space-y-4 text-sm">
|
|
37
|
+
<div>
|
|
38
|
+
<h3 class="mb-2 font-bold">Basic Usage</h3>
|
|
39
|
+
<pre
|
|
40
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
41
|
+
><code>import { debounce } from '@brightspot/ui/util/debounce.js'
|
|
42
|
+
|
|
43
|
+
const handleSearch = debounce(300, () => {
|
|
44
|
+
console.log('Search triggered after 300ms of inactivity')
|
|
45
|
+
})
|
|
46
|
+
|
|
47
|
+
input.addEventListener('input', handleSearch)</code></pre>
|
|
48
|
+
</div>
|
|
49
|
+
|
|
50
|
+
<div>
|
|
51
|
+
<h3 class="mb-2 font-bold">Debounce vs Throttle</h3>
|
|
52
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
53
|
+
<li><strong>Debounce</strong>: Waits until activity stops, then fires once</li>
|
|
54
|
+
<li><strong>Throttle</strong>: Fires at regular intervals during activity</li>
|
|
55
|
+
<li>Use debounce for search inputs, form validation, window resize end</li>
|
|
56
|
+
<li>Use throttle for scroll handlers, mouse tracking, progress updates</li>
|
|
57
|
+
</ul>
|
|
58
|
+
</div>
|
|
59
|
+
|
|
60
|
+
<div>
|
|
61
|
+
<h3 class="mb-2 font-bold">Parameters</h3>
|
|
62
|
+
<ul class="space-y-2">
|
|
63
|
+
<li>
|
|
64
|
+
<code class="rounded bg-gray-200 px-1">wait</code> (number): Delay in milliseconds. If 0, the function
|
|
65
|
+
passes through unchanged.
|
|
66
|
+
</li>
|
|
67
|
+
<li><code class="rounded bg-gray-200 px-1">fn</code> (function): The function to debounce</li>
|
|
68
|
+
</ul>
|
|
69
|
+
</div>
|
|
70
|
+
|
|
71
|
+
<div>
|
|
72
|
+
<h3 class="mb-2 font-bold">Returns</h3>
|
|
73
|
+
<p class="text-gray-700">
|
|
74
|
+
A debounced version of the input function that delays execution until
|
|
75
|
+
<code class="rounded bg-gray-200 px-1">wait</code> milliseconds have elapsed since the last call.
|
|
76
|
+
</p>
|
|
77
|
+
</div>
|
|
78
|
+
</div>
|
|
79
|
+
`,parameters:{docs:{description:{story:"Code examples and documentation for using the debounce utility."}}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
80
|
+
render: args => {
|
|
81
|
+
const instanceId = \`debounce-\${Math.random().toString(36).substring(2, 9)}\`;
|
|
82
|
+
let normalCount = 0;
|
|
83
|
+
let debouncedCount = 0;
|
|
84
|
+
const updateCounts = () => {
|
|
85
|
+
const normalEl = document.getElementById(\`\${instanceId}-normal-count\`);
|
|
86
|
+
const debouncedEl = document.getElementById(\`\${instanceId}-debounced-count\`);
|
|
87
|
+
if (normalEl) normalEl.textContent = String(normalCount);
|
|
88
|
+
if (debouncedEl) debouncedEl.textContent = String(debouncedCount);
|
|
89
|
+
};
|
|
90
|
+
const handleDebounced = debounce(args.wait, () => {
|
|
91
|
+
debouncedCount++;
|
|
92
|
+
updateCounts();
|
|
93
|
+
});
|
|
94
|
+
const handleInput = () => {
|
|
95
|
+
normalCount++;
|
|
96
|
+
updateCounts();
|
|
97
|
+
handleDebounced();
|
|
98
|
+
};
|
|
99
|
+
return html\`
|
|
100
|
+
<div class="space-y-4">
|
|
101
|
+
<div class="text-base">
|
|
102
|
+
<p class="mb-2">
|
|
103
|
+
Type in the input below. The normal counter increments on every keystroke, while the debounced counter only
|
|
104
|
+
fires after \${args.wait}ms of inactivity.
|
|
105
|
+
</p>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<input
|
|
109
|
+
@input=\${handleInput}
|
|
110
|
+
type="text"
|
|
111
|
+
placeholder="Start typing..."
|
|
112
|
+
class="w-full rounded border-2 border-gray-300 px-4 py-2 focus:border-blue-500 focus:outline-none"
|
|
113
|
+
/>
|
|
114
|
+
|
|
115
|
+
<div class="flex justify-around">
|
|
116
|
+
<div>
|
|
117
|
+
<div class="text-xs text-gray-500">Keystrokes</div>
|
|
118
|
+
<div id="\${instanceId}-normal-count" class="text-2xl font-bold text-gray-900">0</div>
|
|
119
|
+
</div>
|
|
120
|
+
<div>
|
|
121
|
+
<div class="text-xs text-gray-500">Debounced calls (\${args.wait}ms)</div>
|
|
122
|
+
<div id="\${instanceId}-debounced-count" class="text-primary-600 text-2xl font-bold">0</div>
|
|
123
|
+
</div>
|
|
124
|
+
</div>
|
|
125
|
+
|
|
126
|
+
<button
|
|
127
|
+
@click=\${() => {
|
|
128
|
+
normalCount = 0;
|
|
129
|
+
debouncedCount = 0;
|
|
130
|
+
updateCounts();
|
|
131
|
+
}}
|
|
132
|
+
class="rounded bg-gray-200 px-4 py-2 hover:bg-gray-300"
|
|
133
|
+
>
|
|
134
|
+
Reset Counters
|
|
135
|
+
</button>
|
|
136
|
+
</div>
|
|
137
|
+
\`;
|
|
138
|
+
},
|
|
139
|
+
parameters: {
|
|
140
|
+
docs: {
|
|
141
|
+
description: {
|
|
142
|
+
story: \`Interactive example showing debounce in action. Type rapidly in the input to see how the debounced handler waits for a pause before executing.\`
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}`,...o.parameters?.docs?.source}}};s.parameters={...s.parameters,docs:{...s.parameters?.docs,source:{originalSource:`{
|
|
147
|
+
render: () => html\`
|
|
148
|
+
<div class="space-y-4 text-sm">
|
|
149
|
+
<div>
|
|
150
|
+
<h3 class="mb-2 font-bold">Basic Usage</h3>
|
|
151
|
+
<pre
|
|
152
|
+
class="overflow-x-auto rounded bg-gray-900 p-4 text-gray-100"
|
|
153
|
+
><code>import { debounce } from '@brightspot/ui/util/debounce.js'
|
|
154
|
+
|
|
155
|
+
const handleSearch = debounce(300, () => {
|
|
156
|
+
console.log('Search triggered after 300ms of inactivity')
|
|
157
|
+
})
|
|
158
|
+
|
|
159
|
+
input.addEventListener('input', handleSearch)</code></pre>
|
|
160
|
+
</div>
|
|
161
|
+
|
|
162
|
+
<div>
|
|
163
|
+
<h3 class="mb-2 font-bold">Debounce vs Throttle</h3>
|
|
164
|
+
<ul class="list-inside list-disc space-y-1 text-gray-700">
|
|
165
|
+
<li><strong>Debounce</strong>: Waits until activity stops, then fires once</li>
|
|
166
|
+
<li><strong>Throttle</strong>: Fires at regular intervals during activity</li>
|
|
167
|
+
<li>Use debounce for search inputs, form validation, window resize end</li>
|
|
168
|
+
<li>Use throttle for scroll handlers, mouse tracking, progress updates</li>
|
|
169
|
+
</ul>
|
|
170
|
+
</div>
|
|
171
|
+
|
|
172
|
+
<div>
|
|
173
|
+
<h3 class="mb-2 font-bold">Parameters</h3>
|
|
174
|
+
<ul class="space-y-2">
|
|
175
|
+
<li>
|
|
176
|
+
<code class="rounded bg-gray-200 px-1">wait</code> (number): Delay in milliseconds. If 0, the function
|
|
177
|
+
passes through unchanged.
|
|
178
|
+
</li>
|
|
179
|
+
<li><code class="rounded bg-gray-200 px-1">fn</code> (function): The function to debounce</li>
|
|
180
|
+
</ul>
|
|
181
|
+
</div>
|
|
182
|
+
|
|
183
|
+
<div>
|
|
184
|
+
<h3 class="mb-2 font-bold">Returns</h3>
|
|
185
|
+
<p class="text-gray-700">
|
|
186
|
+
A debounced version of the input function that delays execution until
|
|
187
|
+
<code class="rounded bg-gray-200 px-1">wait</code> milliseconds have elapsed since the last call.
|
|
188
|
+
</p>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
\`,
|
|
192
|
+
parameters: {
|
|
193
|
+
docs: {
|
|
194
|
+
description: {
|
|
195
|
+
story: \`Code examples and documentation for using the debounce utility.\`
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
}`,...s.parameters?.docs?.source}}};const h=["Interactive","UsageExample"];export{o as Interactive,s as UsageExample,h as __namedExportsOrder,g as default};
|