@brightspot/ui 1.1.0 → 1.3.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/README.md +3 -90
- package/dist/LucideDynamicLoader.d.ts +1 -0
- package/dist/LucideDynamicLoader.d.ts.map +1 -1
- package/dist/LucideDynamicLoader.js +2 -0
- package/dist/LucideDynamicLoader.js.map +1 -1
- package/dist/LucideDynamicLoader.ts +3 -0
- package/dist/components/avatar/Avatar.d.ts +1 -1
- package/dist/components/avatar/Avatar.js +2 -2
- package/dist/components/avatar/Avatar.js.map +1 -1
- package/dist/components/avatar/AvatarGroup.d.ts +1 -1
- package/dist/components/avatar/AvatarGroup.js +2 -2
- package/dist/components/avatar/AvatarGroup.js.map +1 -1
- package/dist/components/badge/Badge.d.ts +1 -1
- package/dist/components/badge/Badge.js +2 -2
- package/dist/components/badge/Badge.js.map +1 -1
- package/dist/components/circular-progress/CircularProgress.d.ts +57 -0
- package/dist/components/circular-progress/CircularProgress.d.ts.map +1 -0
- package/dist/components/circular-progress/CircularProgress.js +173 -0
- package/dist/components/circular-progress/CircularProgress.js.map +1 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.d.ts +57 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.d.ts.map +1 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.js +84 -0
- package/dist/components/copy-to-clipboard/CopyToClipboard.js.map +1 -0
- package/dist/components/icon/Icon.d.ts +90 -0
- package/dist/components/icon/Icon.d.ts.map +1 -0
- package/dist/components/icon/Icon.js +172 -0
- package/dist/components/icon/Icon.js.map +1 -0
- package/dist/components/linear-progress/LinearProgress.d.ts +40 -0
- package/dist/components/linear-progress/LinearProgress.d.ts.map +1 -0
- package/dist/components/linear-progress/LinearProgress.js +95 -0
- package/dist/components/linear-progress/LinearProgress.js.map +1 -0
- package/dist/custom-elements.json +455 -6
- package/dist/global.d.ts +4 -0
- package/dist/storybook/assets/{Avatar.stories-BONZm4v8.js → Avatar.stories-CpXI9mXR.js} +2 -2
- package/dist/storybook/assets/{AvatarGroup.stories-DDKujPh2.js → AvatarGroup.stories-D4NymG47.js} +1 -1
- package/dist/storybook/assets/{Badge.stories-C8Ahfpp6.js → Badge.stories-BP4Yixze.js} +5 -18
- package/dist/storybook/assets/Button.stories-DDpQzCOq.js +63 -0
- package/dist/storybook/assets/CircularProgress.stories-B82LXwfS.js +451 -0
- package/dist/storybook/assets/ClipboardMixin.stories-Cr3efF-v.js +228 -0
- package/dist/storybook/assets/Color-64QXVMR3-BucypS4O.js +1 -0
- package/dist/storybook/assets/{Colors.stories-BajWDIwn.js → Colors.stories-CeKs5FaB.js} +1 -1
- package/dist/storybook/assets/ComponentStatesMixin-BkLj42wt.js +1 -0
- package/dist/storybook/assets/ComponentStatesMixin.stories--YPoyrpQ.js +313 -0
- package/dist/storybook/assets/CopyToClipboard.stories-6vqDwd-F.js +277 -0
- package/dist/storybook/assets/{Events.stories-B32yjxgf.js → Events.stories-DD9wfoHi.js} +1 -1
- package/dist/storybook/assets/Heading.stories-D-Pvm7NG.js +3 -0
- package/dist/storybook/assets/Icon.stories-BbR3S56H.js +245 -0
- package/dist/storybook/assets/LinearProgress.stories-B9XHLvVn.js +397 -0
- package/dist/storybook/assets/ScrollShadow.stories-CHFpB4Zf.js +17 -0
- package/dist/storybook/assets/Throttle.stories-BGNJSyDp.js +303 -0
- package/dist/storybook/assets/{WithTooltip-SK46ZJ2J-BO-IGPcG.js → WithTooltip-SK46ZJ2J-QQZnlVfm.js} +43 -43
- package/dist/storybook/assets/_commonjsHelpers-CqkleIqs.js +1 -0
- package/dist/storybook/assets/formatter-OMEEQ6HG-D3LRXsK-.js +1 -0
- package/dist/storybook/assets/iframe-CpEKhsmw.css +1 -0
- package/dist/storybook/assets/{iframe-BIFmrRK7.js → iframe-D-tG1MVV.js} +101 -141
- package/dist/storybook/assets/index-mcT8sPvs.js +1 -0
- package/dist/storybook/assets/onFind.stories-Dagoyfc5.js +284 -0
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-BoS99i_u.js +6 -0
- package/dist/storybook/iframe.html +2 -2
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/project.json +1 -1
- package/dist/tailwind-plugin-button.js +11 -9
- package/dist/tailwind-plugin-button.js.map +1 -1
- package/dist/tailwind-plugin-button.ts +11 -10
- package/dist/tailwind-plugin-contrast.d.ts +2 -0
- package/dist/tailwind-plugin-contrast.d.ts.map +1 -0
- package/dist/tailwind-plugin-contrast.js +17 -0
- package/dist/tailwind-plugin-contrast.js.map +1 -0
- package/dist/tailwind-plugin-contrast.ts +18 -0
- package/dist/tailwind-plugin-icon.js +17 -10
- package/dist/tailwind-plugin-icon.js.map +1 -1
- package/dist/tailwind-plugin-icon.ts +17 -10
- package/dist/tailwind-plugin-ring-contrast.d.ts +2 -0
- package/dist/tailwind-plugin-ring-contrast.d.ts.map +1 -0
- package/dist/tailwind-plugin-ring-contrast.js +76 -0
- package/dist/tailwind-plugin-ring-contrast.js.map +1 -0
- package/dist/tailwind-plugin-ring-contrast.ts +90 -0
- package/dist/tailwind.config.d.ts +21 -0
- package/dist/tailwind.config.d.ts.map +1 -1
- package/dist/tailwind.config.js +25 -0
- package/dist/tailwind.config.js.map +1 -1
- package/dist/tailwind.config.ts +25 -0
- package/dist/util/ClipboardMixin.d.ts +39 -0
- package/dist/util/ClipboardMixin.d.ts.map +1 -0
- package/dist/util/ClipboardMixin.js +77 -0
- package/dist/util/ClipboardMixin.js.map +1 -0
- package/dist/util/ComponentStatesMixin.d.ts +54 -0
- package/dist/util/ComponentStatesMixin.d.ts.map +1 -0
- package/dist/util/ComponentStatesMixin.js +58 -0
- package/dist/util/ComponentStatesMixin.js.map +1 -0
- package/dist/{utils → util}/EventEmitterMixin.d.ts +7 -2
- package/dist/util/EventEmitterMixin.d.ts.map +1 -0
- package/dist/util/EventEmitterMixin.js.map +1 -0
- package/dist/util/ProgressMixin.d.ts +52 -0
- package/dist/util/ProgressMixin.d.ts.map +1 -0
- package/dist/util/ProgressMixin.js +190 -0
- package/dist/util/ProgressMixin.js.map +1 -0
- package/dist/util/ReadyMixin.d.ts.map +1 -0
- package/dist/util/ReadyMixin.js.map +1 -0
- package/dist/util/aria.d.ts +3 -0
- package/dist/util/aria.d.ts.map +1 -0
- package/dist/util/aria.js +44 -0
- package/dist/util/aria.js.map +1 -0
- package/dist/util/onFind.d.ts +11 -0
- package/dist/util/onFind.d.ts.map +1 -0
- package/dist/util/onFind.js +210 -0
- package/dist/util/onFind.js.map +1 -0
- package/dist/util/svg.d.ts +9 -0
- package/dist/util/svg.d.ts.map +1 -1
- package/dist/util/svg.js +22 -0
- package/dist/util/svg.js.map +1 -1
- package/dist/util/throttle.d.ts +4 -0
- package/dist/util/throttle.d.ts.map +1 -0
- package/dist/util/throttle.js +30 -0
- package/dist/util/throttle.js.map +1 -0
- package/package.json +3 -2
- package/dist/storybook/assets/Button.stories-Cwdvbnu1.js +0 -63
- package/dist/storybook/assets/Color-64QXVMR3-CqLd5_0n.js +0 -1
- package/dist/storybook/assets/Heading.stories-C0ji1wRG.js +0 -3
- package/dist/storybook/assets/Icon.stories-DeEHMd7f.js +0 -28543
- package/dist/storybook/assets/Loader.stories-NxZ0SGA0.js +0 -3
- package/dist/storybook/assets/ScrollShadow.stories-1W8nsrPe.js +0 -17
- package/dist/storybook/assets/formatter-OMEEQ6HG-wqmAyL2n.js +0 -1
- package/dist/storybook/assets/iframe-BEH5EoNR.css +0 -1
- package/dist/storybook/assets/index-B4dkQq9N.js +0 -1
- package/dist/storybook/assets/syntaxhighlighter-CAVLW7PM-kyZrfiLk.js +0 -6
- package/dist/utils/EventEmitterMixin.d.ts.map +0 -1
- package/dist/utils/EventEmitterMixin.js.map +0 -1
- package/dist/utils/ReadyMixin.d.ts.map +0 -1
- package/dist/utils/ReadyMixin.js.map +0 -1
- /package/dist/{utils → util}/EventEmitterMixin.js +0 -0
- /package/dist/{utils → util}/ReadyMixin.d.ts +0 -0
- /package/dist/{utils → util}/ReadyMixin.js +0 -0
|
@@ -0,0 +1,277 @@
|
|
|
1
|
+
import{g as s,x as i}from"./iframe-D-tG1MVV.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
|
+
A button component for copying text to the clipboard. The button becomes disabled and displays a success state for 3 seconds after copying.
|
|
3
|
+
|
|
4
|
+
<h3>When to use:</h3>
|
|
5
|
+
<ul>
|
|
6
|
+
<li>To allow users to quickly copy text, URLs, or codes</li>
|
|
7
|
+
<li>When providing API keys or tokens, which may be hidden</li>
|
|
8
|
+
<li>For giving users access to text content that does not need to be displayed</li>
|
|
9
|
+
</ul>
|
|
10
|
+
|
|
11
|
+
<h3>Use Cases in the CMS:</h3>
|
|
12
|
+
<ul>
|
|
13
|
+
<li>Saved Searches > more actions button > Copy Shareable Link</li>
|
|
14
|
+
<li>Mirror Preview (accessed via profile dropdown)</li>
|
|
15
|
+
<li>Admin > APIs >
|
|
16
|
+
<ul>
|
|
17
|
+
<li>Clients > \`.ApiKey-copy\`</li>
|
|
18
|
+
<li>GraphQL > \`.GraphQL-copy\`</li>
|
|
19
|
+
</ul>
|
|
20
|
+
</li>
|
|
21
|
+
</ul>
|
|
22
|
+
|
|
23
|
+
<h3>Behavior Notes:</h3>
|
|
24
|
+
<ul>
|
|
25
|
+
<li>The button is disabled when there is no text to copy (<code>copydata</code> is empty or not set)</li>
|
|
26
|
+
<li>Success styles are dependent on the <code>btu-clipboard-copied</code> state, which can be styled using the <code>:state()</code> pseudo-class</li>
|
|
27
|
+
</ul>
|
|
28
|
+
`}},actions:{handles:b},controls:{expanded:!0}},args:{...u,copydata:"https://example.com/cms/content/edit",buttonClasses:""},argTypes:{...a,copydata:{...a.copydata,control:{type:"text"},description:"The text to copy to clipboard"},buttonClasses:{...a.buttonClasses,control:{type:"text"},description:"Custom CSS classes for the button. If provided, replaces the default classes."}},render:e=>i`
|
|
29
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
30
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
31
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">${e.copydata}</code>
|
|
32
|
+
<btu-copy-to-clipboard copydata="${e.copydata}" .buttonClasses="${e.buttonClasses||void 0}"
|
|
33
|
+
>Copy to Clipboard</btu-copy-to-clipboard
|
|
34
|
+
>
|
|
35
|
+
</div>
|
|
36
|
+
<div style="display: flex; flex-direction: column; gap: 0.25rem;">
|
|
37
|
+
<textarea
|
|
38
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
39
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
40
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
41
|
+
></textarea>
|
|
42
|
+
</div>
|
|
43
|
+
</div>
|
|
44
|
+
`},t={args:{}},o={render:()=>i(d||(d=p([`
|
|
45
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
46
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
47
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">Hello, World!</code>
|
|
48
|
+
<btu-copy-to-clipboard copydata="Hello, World!" id="event-demo-button">Copy</btu-copy-to-clipboard>
|
|
49
|
+
</div>
|
|
50
|
+
<div
|
|
51
|
+
id="event-log"
|
|
52
|
+
style="padding: 0.5rem; background: #fffbeb; border: 1px solid #fbbf24; border-radius: 4px; font-family: monospace; font-size: 0.875rem; color: #92400e;"
|
|
53
|
+
>
|
|
54
|
+
Event Log: Waiting for copy event...
|
|
55
|
+
</div>
|
|
56
|
+
<div style="display: flex; flex-direction: column; gap: 0.25rem;">
|
|
57
|
+
<textarea
|
|
58
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
59
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
60
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
61
|
+
></textarea>
|
|
62
|
+
</div>
|
|
63
|
+
<script>
|
|
64
|
+
;(() => {
|
|
65
|
+
const button = document.getElementById('event-demo-button')
|
|
66
|
+
const log = document.getElementById('event-log')
|
|
67
|
+
if (button && log) {
|
|
68
|
+
button.addEventListener('btu-clipboard-copied', e => {
|
|
69
|
+
const timestamp = new Date().toLocaleTimeString()
|
|
70
|
+
log.textContent = \`Event Log: btu-clipboard-copied fired at \${timestamp}\`
|
|
71
|
+
console.log('Event fired:', e)
|
|
72
|
+
})
|
|
73
|
+
}
|
|
74
|
+
})()
|
|
75
|
+
<\/script>
|
|
76
|
+
</div>
|
|
77
|
+
`],[`
|
|
78
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
79
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
80
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">Hello, World!</code>
|
|
81
|
+
<btu-copy-to-clipboard copydata="Hello, World!" id="event-demo-button">Copy</btu-copy-to-clipboard>
|
|
82
|
+
</div>
|
|
83
|
+
<div
|
|
84
|
+
id="event-log"
|
|
85
|
+
style="padding: 0.5rem; background: #fffbeb; border: 1px solid #fbbf24; border-radius: 4px; font-family: monospace; font-size: 0.875rem; color: #92400e;"
|
|
86
|
+
>
|
|
87
|
+
Event Log: Waiting for copy event...
|
|
88
|
+
</div>
|
|
89
|
+
<div style="display: flex; flex-direction: column; gap: 0.25rem;">
|
|
90
|
+
<textarea
|
|
91
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
92
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
93
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
94
|
+
></textarea>
|
|
95
|
+
</div>
|
|
96
|
+
<script>
|
|
97
|
+
;(() => {
|
|
98
|
+
const button = document.getElementById('event-demo-button')
|
|
99
|
+
const log = document.getElementById('event-log')
|
|
100
|
+
if (button && log) {
|
|
101
|
+
button.addEventListener('btu-clipboard-copied', e => {
|
|
102
|
+
const timestamp = new Date().toLocaleTimeString()
|
|
103
|
+
log.textContent = \\\`Event Log: btu-clipboard-copied fired at \\\${timestamp}\\\`
|
|
104
|
+
console.log('Event fired:', e)
|
|
105
|
+
})
|
|
106
|
+
}
|
|
107
|
+
})()
|
|
108
|
+
<\/script>
|
|
109
|
+
</div>
|
|
110
|
+
`]))),parameters:{docs:{description:{story:"You can listen for the `btu-clipboard-copied` event to perform custom actions when text is copied. This example displays an event log that updates with a timestamp each time the button is clicked."}}}},n={render:()=>i`
|
|
111
|
+
<div class="flex flex-col gap-6">
|
|
112
|
+
<div class="flex flex-col gap-2">
|
|
113
|
+
<strong>Custom Button Styling:</strong>
|
|
114
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
115
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">
|
|
116
|
+
https://example.com/cms/content/edit
|
|
117
|
+
</code>
|
|
118
|
+
<btu-copy-to-clipboard
|
|
119
|
+
copydata="https://example.com/cms/content/edit"
|
|
120
|
+
buttonClasses="btu-button btu-button-primary btu-button-fill-none after:btu-icon after:btu-icon-clipboard-copy"
|
|
121
|
+
>Copy Link</btu-copy-to-clipboard
|
|
122
|
+
>
|
|
123
|
+
</div>
|
|
124
|
+
<textarea
|
|
125
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
126
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
127
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
128
|
+
></textarea>
|
|
129
|
+
</div>
|
|
130
|
+
|
|
131
|
+
<div class="flex flex-col gap-2">
|
|
132
|
+
<strong>Icon-Only Button:</strong>
|
|
133
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
134
|
+
<div
|
|
135
|
+
style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1; display: flex; align-items: center; gap: 0.5rem; color: #6b7280;"
|
|
136
|
+
>
|
|
137
|
+
<span class="before:btu-icon before:btu-icon-key"></span>
|
|
138
|
+
<span style="font-family: monospace; font-style: italic;">API Key (hidden)</span>
|
|
139
|
+
</div>
|
|
140
|
+
<btu-copy-to-clipboard
|
|
141
|
+
id="icon-only-demo"
|
|
142
|
+
aria-label="Copy API key to clipboard"
|
|
143
|
+
copydata="sk_live_abc123xyz789secret"
|
|
144
|
+
buttonClasses="btu-button btu-button-primary before:btu-icon before:btu-icon-clipboard-copy btu-button-text-hidden"
|
|
145
|
+
>Copy API Key</btu-copy-to-clipboard
|
|
146
|
+
>
|
|
147
|
+
</div>
|
|
148
|
+
<textarea
|
|
149
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
150
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
151
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
152
|
+
></textarea>
|
|
153
|
+
<style>
|
|
154
|
+
#icon-only-demo:state(btu-clipboard-copied) button {
|
|
155
|
+
background-color: oklch(68.59% 0.167 157);
|
|
156
|
+
}
|
|
157
|
+
#icon-only-demo:state(btu-clipboard-copied) button::before {
|
|
158
|
+
content: '\\e168';
|
|
159
|
+
}
|
|
160
|
+
</style>
|
|
161
|
+
</div>
|
|
162
|
+
</div>
|
|
163
|
+
`,parameters:{docs:{description:{story:"\n**Custom Button Styling:** Use the `buttonClasses` attribute to override default button classes with your own styling.\n\n**Icon-Only Button:** An icon-only button for a minimal style. Uses `buttonClasses` for initial styles, notably `btu-button-text-hidden` to hide the text. The `aria-label` attribute is passed from the host element to the inner button for accessibility. CSS `:state(btu-clipboard-copied)` is used to change styles when copied.\n "}}}};t.parameters={...t.parameters,docs:{...t.parameters?.docs,source:{originalSource:`{
|
|
164
|
+
args: {}
|
|
165
|
+
}`,...t.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
166
|
+
render: () => {
|
|
167
|
+
return html\`
|
|
168
|
+
<div style="display: flex; flex-direction: column; gap: 1rem;">
|
|
169
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
170
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">Hello, World!</code>
|
|
171
|
+
<btu-copy-to-clipboard copydata="Hello, World!" id="event-demo-button">Copy</btu-copy-to-clipboard>
|
|
172
|
+
</div>
|
|
173
|
+
<div
|
|
174
|
+
id="event-log"
|
|
175
|
+
style="padding: 0.5rem; background: #fffbeb; border: 1px solid #fbbf24; border-radius: 4px; font-family: monospace; font-size: 0.875rem; color: #92400e;"
|
|
176
|
+
>
|
|
177
|
+
Event Log: Waiting for copy event...
|
|
178
|
+
</div>
|
|
179
|
+
<div style="display: flex; flex-direction: column; gap: 0.25rem;">
|
|
180
|
+
<textarea
|
|
181
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
182
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
183
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
184
|
+
></textarea>
|
|
185
|
+
</div>
|
|
186
|
+
<script>
|
|
187
|
+
;(() => {
|
|
188
|
+
const button = document.getElementById('event-demo-button')
|
|
189
|
+
const log = document.getElementById('event-log')
|
|
190
|
+
if (button && log) {
|
|
191
|
+
button.addEventListener('btu-clipboard-copied', e => {
|
|
192
|
+
const timestamp = new Date().toLocaleTimeString()
|
|
193
|
+
log.textContent = \\\`Event Log: btu-clipboard-copied fired at \\\${timestamp}\\\`
|
|
194
|
+
console.log('Event fired:', e)
|
|
195
|
+
})
|
|
196
|
+
}
|
|
197
|
+
})()
|
|
198
|
+
<\/script>
|
|
199
|
+
</div>
|
|
200
|
+
\`;
|
|
201
|
+
},
|
|
202
|
+
parameters: {
|
|
203
|
+
docs: {
|
|
204
|
+
description: {
|
|
205
|
+
story: \`You can listen for the \\\`btu-clipboard-copied\\\` event to perform custom actions when text is copied. This example displays an event log that updates with a timestamp each time the button is clicked.\`
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
}`,...o.parameters?.docs?.source}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
210
|
+
render: () => {
|
|
211
|
+
return html\`
|
|
212
|
+
<div class="flex flex-col gap-6">
|
|
213
|
+
<div class="flex flex-col gap-2">
|
|
214
|
+
<strong>Custom Button Styling:</strong>
|
|
215
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
216
|
+
<code style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1;">
|
|
217
|
+
https://example.com/cms/content/edit
|
|
218
|
+
</code>
|
|
219
|
+
<btu-copy-to-clipboard
|
|
220
|
+
copydata="https://example.com/cms/content/edit"
|
|
221
|
+
buttonClasses="btu-button btu-button-primary btu-button-fill-none after:btu-icon after:btu-icon-clipboard-copy"
|
|
222
|
+
>Copy Link</btu-copy-to-clipboard
|
|
223
|
+
>
|
|
224
|
+
</div>
|
|
225
|
+
<textarea
|
|
226
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
227
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
228
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
229
|
+
></textarea>
|
|
230
|
+
</div>
|
|
231
|
+
|
|
232
|
+
<div class="flex flex-col gap-2">
|
|
233
|
+
<strong>Icon-Only Button:</strong>
|
|
234
|
+
<div style="display: flex; align-items: center; gap: 1rem;">
|
|
235
|
+
<div
|
|
236
|
+
style="padding: 0.5rem; background: #f5f5f5; border-radius: 4px; flex: 1; display: flex; align-items: center; gap: 0.5rem; color: #6b7280;"
|
|
237
|
+
>
|
|
238
|
+
<span class="before:btu-icon before:btu-icon-key"></span>
|
|
239
|
+
<span style="font-family: monospace; font-style: italic;">API Key (hidden)</span>
|
|
240
|
+
</div>
|
|
241
|
+
<btu-copy-to-clipboard
|
|
242
|
+
id="icon-only-demo"
|
|
243
|
+
aria-label="Copy API key to clipboard"
|
|
244
|
+
copydata="sk_live_abc123xyz789secret"
|
|
245
|
+
buttonClasses="btu-button btu-button-primary before:btu-icon before:btu-icon-clipboard-copy btu-button-text-hidden"
|
|
246
|
+
>Copy API Key</btu-copy-to-clipboard
|
|
247
|
+
>
|
|
248
|
+
</div>
|
|
249
|
+
<textarea
|
|
250
|
+
aria-label="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
251
|
+
placeholder="Click the copy button, then paste here (Cmd/Ctrl+V) to test"
|
|
252
|
+
style="padding: 0.5rem; border: 1px solid #d1d5db; border-radius: 4px; font-family: monospace; font-size: 0.875rem;"
|
|
253
|
+
></textarea>
|
|
254
|
+
<style>
|
|
255
|
+
#icon-only-demo:state(btu-clipboard-copied) button {
|
|
256
|
+
background-color: oklch(68.59% 0.167 157);
|
|
257
|
+
}
|
|
258
|
+
#icon-only-demo:state(btu-clipboard-copied) button::before {
|
|
259
|
+
content: '\\\\e168';
|
|
260
|
+
}
|
|
261
|
+
</style>
|
|
262
|
+
</div>
|
|
263
|
+
</div>
|
|
264
|
+
\`;
|
|
265
|
+
},
|
|
266
|
+
parameters: {
|
|
267
|
+
docs: {
|
|
268
|
+
description: {
|
|
269
|
+
story: \`
|
|
270
|
+
**Custom Button Styling:** Use the \\\`buttonClasses\\\` attribute to override default button classes with your own styling.
|
|
271
|
+
|
|
272
|
+
**Icon-Only Button:** An icon-only button for a minimal style. Uses \\\`buttonClasses\\\` for initial styles, notably \\\`btu-button-text-hidden\\\` to hide the text. The \\\`aria-label\\\` attribute is passed from the host element to the inner button for accessibility. CSS \\\`:state(btu-clipboard-copied)\\\` is used to change styles when copied.
|
|
273
|
+
\`
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}`,...n.parameters?.docs?.source}}};const g=["Default","CopiedEvent","AdvancedUsage"];export{n as AdvancedUsage,o as CopiedEvent,t as Default,g as __namedExportsOrder,f as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{x as d}from"./iframe-
|
|
1
|
+
import{x as d}from"./iframe-D-tG1MVV.js";import"./preload-helper-PPVm8Dsz.js";var n=Object.freeze,r=Object.defineProperty,s=(t,i)=>n(r(t,"raw",{value:n(t.slice())})),o;const l={title:"Mixins/Events",tags:["autodocs"],parameters:{docs:{subtitle:"Events inherited from EventEmitterMixin",description:{component:`
|
|
2
2
|
<h3>EventEmitterMixin Events</h3>
|
|
3
3
|
|
|
4
4
|
<p>All Brightspot UI components that extend EventEmitterMixin emit the following lifecycle events in addition to those inherited from LitElement. These events use CustomEvent and bubble through the DOM with <code>composed: true</code>, meaning they cross shadow DOM boundaries.</p>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{x as s}from"./iframe-D-tG1MVV.js";import"./preload-helper-PPVm8Dsz.js";const r=({size:t})=>s` <div class=${[`btu-heading-${t}`].join(" ")}>Heading</div> `,o={title:"CSS Plugins/Heading",component:"btu-heading",tags:["autodocs"],parameters:{docs:{subtitle:"This Tailwind CSS plugin provides the `.btu-heading` utility class for styling headings. It supports five different sizes, from 1 (largest) to 5 (smallest). Apply the class to `<h1>` through `<h5>` elements to style them accordingly."},controls:{expanded:!0}},render:t=>r(t),argTypes:{size:{control:{type:"range",min:1,max:5,step:1},description:"Heading size from 1 to 5, where 1 is the largest and 5 is the smallest."}},args:{size:1}},e={args:{}};e.parameters={...e.parameters,docs:{...e.parameters?.docs,source:{originalSource:`{
|
|
2
|
+
args: {}
|
|
3
|
+
}`,...e.parameters?.docs?.source}}};const n=["Default"];export{e as Default,n as __namedExportsOrder,o as default};
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import{g as d,x as r}from"./iframe-D-tG1MVV.js";import"./preload-helper-PPVm8Dsz.js";const p="0.508.0",b={version:p},l=b.version,{events:u,args:m,argTypes:t}=d("btu-icon"),g=["xs","sm","md","lg","xl"],x=["ai","error","gray","primary","purple","rose","success","teal","warning"],v={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
|
+
<strong>When to use:</strong>
|
|
3
|
+
<ul>
|
|
4
|
+
<li>To visually reinforce actions, states, or categories</li>
|
|
5
|
+
<li>For navigation elements and buttons</li>
|
|
6
|
+
<li>To provide visual cues alongside text labels</li>
|
|
7
|
+
<li>For decorative elements that enhance understanding</li>
|
|
8
|
+
</ul>
|
|
9
|
+
|
|
10
|
+
<strong>When not to use:</strong>
|
|
11
|
+
<ul>
|
|
12
|
+
<li>As the sole means of conveying critical information without an accompanying label</li>
|
|
13
|
+
<li>When text would be clearer than an icon</li>
|
|
14
|
+
</ul>
|
|
15
|
+
|
|
16
|
+
<h3>Icon Library:</h3>
|
|
17
|
+
<p>All icons are from <a href="https://lucide.dev/icons/" target="_blank">Lucide</a>. Note that the Lucide library is updated regularly, but the Brightspot UI library uses <strong>Lucide v${l}</strong>. Keep this in mind when choosing icons for your project, as icon names and styles may differ between versions.</p>
|
|
18
|
+
`}},actions:{handles:u},controls:{expanded:!0}},args:{...m,symbol:"heart",size:"md"},argTypes:{...t,"--Icon-size":{table:{disable:!0}},"--Icon-fill":{table:{disable:!0}},"--Icon-svg":{table:{disable:!0}},symbol:{...t.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'+l+" are supported.",table:{...t.symbol?.table,type:{summary:"string"}}},size:{...t.size,control:{type:"select"},options:g,description:"Icon size preset"},gradient:{...t.gradient,control:{type:"select"},options:x,description:"Gradient theme icon fill. When not set, icon inherits parent text color."},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"}}},render:e=>{const s=[];e.customSize&&s.push(`--Icon-size: ${e.customSize}`),e.customFill&&s.push(`--Icon-fill: ${e.customFill}`);const c=s.length>0?s.join("; "):"";return r`<btu-icon
|
|
19
|
+
symbol="${e.symbol}"
|
|
20
|
+
size="${e.size}"
|
|
21
|
+
gradient="${e.gradient||""}"
|
|
22
|
+
style="${c}"
|
|
23
|
+
></btu-icon>`}},n={args:{}},i={render:()=>r`<div class="flex items-center gap-4">
|
|
24
|
+
<btu-icon symbol="heart" size="xs"></btu-icon>
|
|
25
|
+
<btu-icon symbol="heart" size="sm"></btu-icon>
|
|
26
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
27
|
+
<btu-icon symbol="heart" size="lg"></btu-icon>
|
|
28
|
+
<btu-icon symbol="heart" size="xl"></btu-icon>
|
|
29
|
+
</div>`,parameters:{docs:{description:{story:"Icons come in five preset sizes: xs, sm, md, lg, and xl. Choose the size that best fits your design context."}}}},o={render:()=>r`<div class="flex flex-wrap items-center justify-between gap-4 px-4">
|
|
30
|
+
<div class="flex flex-col items-center gap-2">
|
|
31
|
+
<btu-icon symbol="zap" size="xl" gradient="primary"></btu-icon>
|
|
32
|
+
<span class="text-xs font-bold">primary</span>
|
|
33
|
+
</div>
|
|
34
|
+
<div class="flex flex-col items-center gap-2">
|
|
35
|
+
<btu-icon symbol="check-circle" size="xl" gradient="success"></btu-icon>
|
|
36
|
+
<span class="text-xs font-bold">success</span>
|
|
37
|
+
</div>
|
|
38
|
+
<div class="flex flex-col items-center gap-2">
|
|
39
|
+
<btu-icon symbol="trash-2" size="xl" gradient="error"></btu-icon>
|
|
40
|
+
<span class="text-xs font-bold">error</span>
|
|
41
|
+
</div>
|
|
42
|
+
<div class="flex flex-col items-center gap-2">
|
|
43
|
+
<btu-icon symbol="alert-triangle" size="xl" gradient="warning"></btu-icon>
|
|
44
|
+
<span class="text-xs font-bold">warning</span>
|
|
45
|
+
</div>
|
|
46
|
+
<div class="flex flex-col items-center gap-2">
|
|
47
|
+
<btu-icon symbol="sparkles" size="xl" gradient="ai"></btu-icon>
|
|
48
|
+
<span class="text-xs font-bold">ai</span>
|
|
49
|
+
</div>
|
|
50
|
+
<div class="flex flex-col items-center gap-2">
|
|
51
|
+
<btu-icon symbol="info" size="xl" gradient="purple"></btu-icon>
|
|
52
|
+
<span class="text-xs font-bold">purple</span>
|
|
53
|
+
</div>
|
|
54
|
+
<div class="flex flex-col items-center gap-2">
|
|
55
|
+
<btu-icon symbol="book" size="xl" gradient="teal"></btu-icon>
|
|
56
|
+
<span class="text-xs font-bold">teal</span>
|
|
57
|
+
</div>
|
|
58
|
+
<div class="flex flex-col items-center gap-2">
|
|
59
|
+
<btu-icon symbol="flower" size="xl" gradient="rose"></btu-icon>
|
|
60
|
+
<span class="text-xs font-bold">rose</span>
|
|
61
|
+
</div>
|
|
62
|
+
</div>`,parameters:{docs:{description:{story:"Icons support gradient fills using the following theme colors. Set the `gradient` attribute to one of the theme colors and watch the icon's color come to life! Note that gradient icons use mask-based rendering for smooth color transitions."}}}},a={render:()=>r`<div class="flex flex-col gap-6">
|
|
63
|
+
<div class="flex items-center gap-2">
|
|
64
|
+
<strong>Custom sizing:</strong>
|
|
65
|
+
<btu-icon symbol="trophy" size="md" style="--Icon-size: 4rem" class="text-warning-500"></btu-icon>
|
|
66
|
+
</div>
|
|
67
|
+
|
|
68
|
+
<div class="flex items-center gap-2">
|
|
69
|
+
<strong>Filled icons:</strong>
|
|
70
|
+
<div class="flex items-center gap-3">
|
|
71
|
+
<btu-icon symbol="star" size="xl" class="text-warning-500" style="--Icon-fill: currentColor"></btu-icon>
|
|
72
|
+
<btu-icon symbol="heart" size="xl" class="text-error-600" style="--Icon-fill: currentColor"></btu-icon>
|
|
73
|
+
</div>
|
|
74
|
+
</div>
|
|
75
|
+
|
|
76
|
+
<div class="flex flex-col gap-3">
|
|
77
|
+
<strong>RTL language support:</strong>
|
|
78
|
+
<div class="flex flex-col gap-3 rounded-lg border border-gray-200 bg-gray-50 p-4 text-gray-900">
|
|
79
|
+
<div class="flex items-center gap-2">
|
|
80
|
+
<span class="text-sm">Open panel</span>
|
|
81
|
+
<btu-icon symbol="panel-right-close" size="md"></btu-icon>
|
|
82
|
+
</div>
|
|
83
|
+
<div class="flex items-center gap-2" dir="rtl">
|
|
84
|
+
<span class="text-sm">افتح اللوحة</span>
|
|
85
|
+
<btu-icon symbol="panel-right-close" size="md" class="rtl:-scale-x-100"></btu-icon>
|
|
86
|
+
</div>
|
|
87
|
+
</div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
<div class="flex items-center gap-2">
|
|
91
|
+
<strong>Unlabeled icon button (A11y concern!):</strong>
|
|
92
|
+
<button class="bg-error-200 hover:bg-error-300 rounded p-2">
|
|
93
|
+
<btu-icon symbol="trash-2" size="md" class="text-gray-900"></btu-icon>
|
|
94
|
+
</button>
|
|
95
|
+
</div>
|
|
96
|
+
|
|
97
|
+
<div class="flex items-center gap-2">
|
|
98
|
+
<strong>Labeled via <code>aria-label</code> and <code>title</code>:</strong>
|
|
99
|
+
<button
|
|
100
|
+
class="bg-primary-600 hover:bg-primary-800 rounded p-2 text-white"
|
|
101
|
+
aria-label="Favorite this item"
|
|
102
|
+
title="Favorite this item"
|
|
103
|
+
>
|
|
104
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
105
|
+
</button>
|
|
106
|
+
</div>
|
|
107
|
+
|
|
108
|
+
<div class="flex items-center gap-2">
|
|
109
|
+
<strong>Labeled via accompanying text:</strong>
|
|
110
|
+
<button class="bg-primary-100 hover:bg-primary-200 text-primary-700 rounded p-2">
|
|
111
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
112
|
+
<span class="ml-1">Favorite</span>
|
|
113
|
+
</button>
|
|
114
|
+
</div>
|
|
115
|
+
</div>`,parameters:{docs:{description:{story:'\n- **Custom sizing** is available via the `--Icon-size` CSS property for precise control. \n- You can create **filled icons** by setting the `--Icon-fill: currentColor` CSS property. Note that this works best with simple icons like "heart" or "star".\n\n- **RTL language support:** Directional icons can be flipped for right-to-left languages using Tailwind\'s `rtl:-scale-x-100` utility class. This ensures icons like panels, arrows, and navigation elements point in the correct direction.\n\n**Accessibility best practices:**\n- If an icon conveys information and there is no visible text to accompany it (e.g., a delete button with only a trash can icon), add an `aria-label` attribute to the component to help users using screen readers understand its purpose.\n- If an icon is purely decorative (e.g. a sparkle icon, accompanying text that already conveys meaning), add `aria-hidden="true"` to the icon to hide it from screen readers.\n- You may consider adding a tooltip (via `title` attribute) to icon buttons for better discoverability.'}}}};n.parameters={...n.parameters,docs:{...n.parameters?.docs,source:{originalSource:`{
|
|
116
|
+
args: {}
|
|
117
|
+
}`,...n.parameters?.docs?.source}}};i.parameters={...i.parameters,docs:{...i.parameters?.docs,source:{originalSource:`{
|
|
118
|
+
render: () => html\`<div class="flex items-center gap-4">
|
|
119
|
+
<btu-icon symbol="heart" size="xs"></btu-icon>
|
|
120
|
+
<btu-icon symbol="heart" size="sm"></btu-icon>
|
|
121
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
122
|
+
<btu-icon symbol="heart" size="lg"></btu-icon>
|
|
123
|
+
<btu-icon symbol="heart" size="xl"></btu-icon>
|
|
124
|
+
</div>\`,
|
|
125
|
+
parameters: {
|
|
126
|
+
docs: {
|
|
127
|
+
description: {
|
|
128
|
+
story: \`Icons come in five preset sizes: xs, sm, md, lg, and xl. Choose the size that best fits your design context.\`
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}`,...i.parameters?.docs?.source}}};o.parameters={...o.parameters,docs:{...o.parameters?.docs,source:{originalSource:`{
|
|
133
|
+
render: () => html\`<div class="flex flex-wrap items-center justify-between gap-4 px-4">
|
|
134
|
+
<div class="flex flex-col items-center gap-2">
|
|
135
|
+
<btu-icon symbol="zap" size="xl" gradient="primary"></btu-icon>
|
|
136
|
+
<span class="text-xs font-bold">primary</span>
|
|
137
|
+
</div>
|
|
138
|
+
<div class="flex flex-col items-center gap-2">
|
|
139
|
+
<btu-icon symbol="check-circle" size="xl" gradient="success"></btu-icon>
|
|
140
|
+
<span class="text-xs font-bold">success</span>
|
|
141
|
+
</div>
|
|
142
|
+
<div class="flex flex-col items-center gap-2">
|
|
143
|
+
<btu-icon symbol="trash-2" size="xl" gradient="error"></btu-icon>
|
|
144
|
+
<span class="text-xs font-bold">error</span>
|
|
145
|
+
</div>
|
|
146
|
+
<div class="flex flex-col items-center gap-2">
|
|
147
|
+
<btu-icon symbol="alert-triangle" size="xl" gradient="warning"></btu-icon>
|
|
148
|
+
<span class="text-xs font-bold">warning</span>
|
|
149
|
+
</div>
|
|
150
|
+
<div class="flex flex-col items-center gap-2">
|
|
151
|
+
<btu-icon symbol="sparkles" size="xl" gradient="ai"></btu-icon>
|
|
152
|
+
<span class="text-xs font-bold">ai</span>
|
|
153
|
+
</div>
|
|
154
|
+
<div class="flex flex-col items-center gap-2">
|
|
155
|
+
<btu-icon symbol="info" size="xl" gradient="purple"></btu-icon>
|
|
156
|
+
<span class="text-xs font-bold">purple</span>
|
|
157
|
+
</div>
|
|
158
|
+
<div class="flex flex-col items-center gap-2">
|
|
159
|
+
<btu-icon symbol="book" size="xl" gradient="teal"></btu-icon>
|
|
160
|
+
<span class="text-xs font-bold">teal</span>
|
|
161
|
+
</div>
|
|
162
|
+
<div class="flex flex-col items-center gap-2">
|
|
163
|
+
<btu-icon symbol="flower" size="xl" gradient="rose"></btu-icon>
|
|
164
|
+
<span class="text-xs font-bold">rose</span>
|
|
165
|
+
</div>
|
|
166
|
+
</div>\`,
|
|
167
|
+
parameters: {
|
|
168
|
+
docs: {
|
|
169
|
+
description: {
|
|
170
|
+
story: \`Icons support gradient fills using the following theme colors. Set the \\\`gradient\\\` attribute to one of the theme colors and watch the icon's color come to life! Note that gradient icons use mask-based rendering for smooth color transitions.\`
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}`,...o.parameters?.docs?.source}}};a.parameters={...a.parameters,docs:{...a.parameters?.docs,source:{originalSource:`{
|
|
175
|
+
render: () => html\`<div class="flex flex-col gap-6">
|
|
176
|
+
<div class="flex items-center gap-2">
|
|
177
|
+
<strong>Custom sizing:</strong>
|
|
178
|
+
<btu-icon symbol="trophy" size="md" style="--Icon-size: 4rem" class="text-warning-500"></btu-icon>
|
|
179
|
+
</div>
|
|
180
|
+
|
|
181
|
+
<div class="flex items-center gap-2">
|
|
182
|
+
<strong>Filled icons:</strong>
|
|
183
|
+
<div class="flex items-center gap-3">
|
|
184
|
+
<btu-icon symbol="star" size="xl" class="text-warning-500" style="--Icon-fill: currentColor"></btu-icon>
|
|
185
|
+
<btu-icon symbol="heart" size="xl" class="text-error-600" style="--Icon-fill: currentColor"></btu-icon>
|
|
186
|
+
</div>
|
|
187
|
+
</div>
|
|
188
|
+
|
|
189
|
+
<div class="flex flex-col gap-3">
|
|
190
|
+
<strong>RTL language support:</strong>
|
|
191
|
+
<div class="flex flex-col gap-3 rounded-lg border border-gray-200 bg-gray-50 p-4 text-gray-900">
|
|
192
|
+
<div class="flex items-center gap-2">
|
|
193
|
+
<span class="text-sm">Open panel</span>
|
|
194
|
+
<btu-icon symbol="panel-right-close" size="md"></btu-icon>
|
|
195
|
+
</div>
|
|
196
|
+
<div class="flex items-center gap-2" dir="rtl">
|
|
197
|
+
<span class="text-sm">افتح اللوحة</span>
|
|
198
|
+
<btu-icon symbol="panel-right-close" size="md" class="rtl:-scale-x-100"></btu-icon>
|
|
199
|
+
</div>
|
|
200
|
+
</div>
|
|
201
|
+
</div>
|
|
202
|
+
|
|
203
|
+
<div class="flex items-center gap-2">
|
|
204
|
+
<strong>Unlabeled icon button (A11y concern!):</strong>
|
|
205
|
+
<button class="bg-error-200 hover:bg-error-300 rounded p-2">
|
|
206
|
+
<btu-icon symbol="trash-2" size="md" class="text-gray-900"></btu-icon>
|
|
207
|
+
</button>
|
|
208
|
+
</div>
|
|
209
|
+
|
|
210
|
+
<div class="flex items-center gap-2">
|
|
211
|
+
<strong>Labeled via <code>aria-label</code> and <code>title</code>:</strong>
|
|
212
|
+
<button
|
|
213
|
+
class="bg-primary-600 hover:bg-primary-800 rounded p-2 text-white"
|
|
214
|
+
aria-label="Favorite this item"
|
|
215
|
+
title="Favorite this item"
|
|
216
|
+
>
|
|
217
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
218
|
+
</button>
|
|
219
|
+
</div>
|
|
220
|
+
|
|
221
|
+
<div class="flex items-center gap-2">
|
|
222
|
+
<strong>Labeled via accompanying text:</strong>
|
|
223
|
+
<button class="bg-primary-100 hover:bg-primary-200 text-primary-700 rounded p-2">
|
|
224
|
+
<btu-icon symbol="heart" size="md"></btu-icon>
|
|
225
|
+
<span class="ml-1">Favorite</span>
|
|
226
|
+
</button>
|
|
227
|
+
</div>
|
|
228
|
+
</div>\`,
|
|
229
|
+
parameters: {
|
|
230
|
+
docs: {
|
|
231
|
+
description: {
|
|
232
|
+
story: \`
|
|
233
|
+
- **Custom sizing** is available via the \\\`--Icon-size\\\` CSS property for precise control.
|
|
234
|
+
- You can create **filled icons** by setting the \\\`--Icon-fill: currentColor\\\` CSS property. Note that this works best with simple icons like "heart" or "star".
|
|
235
|
+
|
|
236
|
+
- **RTL language support:** Directional icons can be flipped for right-to-left languages using Tailwind's \\\`rtl:-scale-x-100\\\` utility class. This ensures icons like panels, arrows, and navigation elements point in the correct direction.
|
|
237
|
+
|
|
238
|
+
**Accessibility best practices:**
|
|
239
|
+
- If an icon conveys information and there is no visible text to accompany it (e.g., a delete button with only a trash can icon), add an \\\`aria-label\\\` attribute to the component to help users using screen readers understand its purpose.
|
|
240
|
+
- If an icon is purely decorative (e.g. a sparkle icon, accompanying text that already conveys meaning), add \\\`aria-hidden="true"\\\` to the icon to hide it from screen readers.
|
|
241
|
+
- You may consider adding a tooltip (via \\\`title\\\` attribute) to icon buttons for better discoverability.\`
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
}`,...a.parameters?.docs?.source}}};const h=["Default","Sizes","GradientIcons","AdvancedUsage"];export{a as AdvancedUsage,n as Default,o as GradientIcons,i as Sizes,h as __namedExportsOrder,v as default};
|