@brightspot/ui 1.0.0-alpha.2 → 1.0.0-alpha.3
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/LucideDynamicLoader.js +21 -0
- package/dist/LucideDynamicLoader.ts +23 -0
- package/dist/storybook/342.9186a774.iframe.bundle.js +2 -0
- package/dist/storybook/342.9186a774.iframe.bundle.js.LICENSE.txt +6 -0
- package/dist/storybook/{906.c7ad56cf.iframe.bundle.js → 906.72b6fffa.iframe.bundle.js} +4 -4
- package/dist/storybook/{906.c7ad56cf.iframe.bundle.js.map → 906.72b6fffa.iframe.bundle.js.map} +1 -1
- package/dist/storybook/iframe.html +3 -3
- package/dist/storybook/index.json +1 -1
- package/dist/storybook/main.8dadaa0a.iframe.bundle.js +1 -0
- package/dist/storybook/project.json +1 -1
- package/dist/storybook/runtime~main.36ab40ff.iframe.bundle.js +1 -0
- package/dist/storybook/stories-Icon-stories.171bf8c3.iframe.bundle.js +8 -0
- package/dist/storybook/stories-Icon-stories.171bf8c3.iframe.bundle.js.map +1 -0
- package/dist/tailwind-plugin-icon.js +4 -133
- package/dist/tailwind-plugin-icon.ts +4 -147
- package/dist/util/string.js +14 -0
- package/dist/util/svg.js +13 -0
- package/package.json +1 -1
- package/dist/storybook/main.7b0cb99d.iframe.bundle.js +0 -1
- package/dist/storybook/runtime~main.a1926d89.iframe.bundle.js +0 -1
- /package/dist/storybook/{906.c7ad56cf.iframe.bundle.js.LICENSE.txt → 906.72b6fffa.iframe.bundle.js.LICENSE.txt} +0 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import * as LucideIcons from 'lucide-static';
|
|
2
|
+
import icons from 'lucide-static/font/info.json';
|
|
3
|
+
import { kebabToPascal } from '../src/util/string';
|
|
4
|
+
import { addNameSpaceXML, encodeSVG } from '../src/util/svg';
|
|
5
|
+
export function getIcon(iconName) {
|
|
6
|
+
try {
|
|
7
|
+
const kebabName = iconName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase();
|
|
8
|
+
const pascalName = kebabToPascal(kebabName);
|
|
9
|
+
if (LucideIcons[pascalName]) {
|
|
10
|
+
const svg = LucideIcons[pascalName];
|
|
11
|
+
const encodedSvg = encodeSVG(addNameSpaceXML(svg));
|
|
12
|
+
return {
|
|
13
|
+
compat: icons[kebabName]?.encodedCode || '',
|
|
14
|
+
iconSvg: encodedSvg,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
console.error('Error loading Lucide icon ${iconName}:', e);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as LucideIcons from 'lucide-static'
|
|
2
|
+
import icons from 'lucide-static/font/info.json'
|
|
3
|
+
import { kebabToPascal } from '../src/util/string'
|
|
4
|
+
import { addNameSpaceXML, encodeSVG } from '../src/util/svg'
|
|
5
|
+
|
|
6
|
+
export function getIcon(iconName: string) {
|
|
7
|
+
try {
|
|
8
|
+
const kebabName = iconName.replace(/([a-z])([A-Z])/g, '$1-$2').toLowerCase()
|
|
9
|
+
const pascalName = kebabToPascal(kebabName)
|
|
10
|
+
|
|
11
|
+
if (LucideIcons[pascalName as keyof typeof LucideIcons]) {
|
|
12
|
+
const svg = LucideIcons[pascalName as keyof typeof LucideIcons] as string
|
|
13
|
+
const encodedSvg = encodeSVG(addNameSpaceXML(svg))
|
|
14
|
+
|
|
15
|
+
return {
|
|
16
|
+
compat: icons[kebabName as keyof typeof icons]?.encodedCode || '',
|
|
17
|
+
iconSvg: encodedSvg,
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
} catch (e) {
|
|
21
|
+
console.error('Error loading Lucide icon ${iconName}:', e)
|
|
22
|
+
}
|
|
23
|
+
}
|