@nice2dev/icons 1.3.15 → 1.3.17

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.
Files changed (153) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +1 -1
  3. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  4. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  5. package/dist/cjs/NiceIconPicker.js +788 -508
  6. package/dist/cjs/NiceIconPreview.js +246 -188
  7. package/dist/cjs/NiceIconSetCreator.js +683 -552
  8. package/dist/cjs/NiceIconStacker.js +547 -171
  9. package/dist/cjs/NiceIconValue.js +27 -35
  10. package/dist/cjs/NtdIconBadge.js +384 -360
  11. package/dist/cjs/NtdIconMorph.js +419 -354
  12. package/dist/cjs/NtdStateMorph.js +150 -147
  13. package/dist/cjs/advancedIconSearch.js +373 -510
  14. package/dist/cjs/animationControls.js +518 -642
  15. package/dist/cjs/animationSpeed.js +69 -0
  16. package/dist/cjs/client.js +12 -15
  17. package/dist/cjs/createIcon.js +374 -252
  18. package/dist/cjs/design-tokens.js +324 -390
  19. package/dist/cjs/figmaExport.js +162 -257
  20. package/dist/cjs/figmaSync.js +234 -316
  21. package/dist/cjs/headless-ui.js +240 -368
  22. package/dist/cjs/iconAnalytics.js +337 -393
  23. package/dist/cjs/iconHtml.js +64 -86
  24. package/dist/cjs/iconMetadata.js +392 -472
  25. package/dist/cjs/iconParts.js +120 -90
  26. package/dist/cjs/iconStack.js +136 -155
  27. package/dist/cjs/iconStyles.js +1670 -509
  28. package/dist/cjs/iconValue.js +359 -430
  29. package/dist/cjs/icons/accessibility.js +1119 -134
  30. package/dist/cjs/icons/actions.js +1290 -330
  31. package/dist/cjs/icons/ai.js +1424 -144
  32. package/dist/cjs/icons/brand.js +613 -184
  33. package/dist/cjs/icons/business.js +938 -192
  34. package/dist/cjs/icons/devtech.js +1656 -227
  35. package/dist/cjs/icons/ecommerce.js +802 -111
  36. package/dist/cjs/icons/education.js +1345 -199
  37. package/dist/cjs/icons/files.js +1597 -328
  38. package/dist/cjs/icons/fintech.js +793 -104
  39. package/dist/cjs/icons/food.js +1028 -156
  40. package/dist/cjs/icons/fun.js +804 -109
  41. package/dist/cjs/icons/gaming.js +916 -170
  42. package/dist/cjs/icons/health.js +623 -112
  43. package/dist/cjs/icons/index.js +32 -42
  44. package/dist/cjs/icons/input.js +282 -83
  45. package/dist/cjs/icons/legal.js +1065 -122
  46. package/dist/cjs/icons/media.js +1061 -267
  47. package/dist/cjs/icons/navigation.js +407 -123
  48. package/dist/cjs/icons/omniverk.js +523 -93
  49. package/dist/cjs/icons/realestate.js +1520 -193
  50. package/dist/cjs/icons/saas.js +867 -98
  51. package/dist/cjs/icons/science.js +1344 -202
  52. package/dist/cjs/icons/shapes.js +1316 -308
  53. package/dist/cjs/icons/smarthome.js +786 -90
  54. package/dist/cjs/icons/social.js +591 -59
  55. package/dist/cjs/icons/sports.js +1133 -133
  56. package/dist/cjs/icons/sustainability.js +1211 -139
  57. package/dist/cjs/icons/travel.js +1470 -148
  58. package/dist/cjs/icons/ui.js +1508 -315
  59. package/dist/cjs/icons/weather.js +1160 -173
  60. package/dist/cjs/index.js +559 -568
  61. package/dist/cjs/lottieIntegration.js +261 -266
  62. package/dist/cjs/nicetodev-icons.css +1 -1
  63. package/dist/cjs/particleEffects.js +270 -251
  64. package/dist/cjs/resolver.js +229 -284
  65. package/dist/cjs/rsc.js +175 -193
  66. package/dist/cjs/sharpen.js +73 -130
  67. package/dist/cjs/smilAnimations.js +380 -165
  68. package/dist/cjs/stacking.js +87 -122
  69. package/dist/cjs/tailwind-plugin.js +280 -320
  70. package/dist/cjs/types.js +46 -72
  71. package/dist/cjs/utilities.js +163 -324
  72. package/dist/cjs/variantProps.js +12 -52
  73. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  74. package/dist/esm/NiceFaviconGenerator.js +583 -416
  75. package/dist/esm/NiceIconPicker.js +789 -507
  76. package/dist/esm/NiceIconPreview.js +247 -187
  77. package/dist/esm/NiceIconSetCreator.js +685 -551
  78. package/dist/esm/NiceIconStacker.js +549 -170
  79. package/dist/esm/NiceIconValue.js +29 -34
  80. package/dist/esm/NtdIconBadge.js +388 -359
  81. package/dist/esm/NtdIconMorph.js +423 -353
  82. package/dist/esm/NtdStateMorph.js +152 -146
  83. package/dist/esm/advancedIconSearch.js +391 -509
  84. package/dist/esm/animationControls.js +527 -641
  85. package/dist/esm/animationSpeed.js +69 -0
  86. package/dist/esm/client.js +48 -10
  87. package/dist/esm/createIcon.js +375 -251
  88. package/dist/esm/design-tokens.js +334 -387
  89. package/dist/esm/figmaExport.js +170 -256
  90. package/dist/esm/figmaSync.js +237 -315
  91. package/dist/esm/headless-ui.js +254 -365
  92. package/dist/esm/iconAnalytics.js +342 -392
  93. package/dist/esm/iconHtml.js +67 -85
  94. package/dist/esm/iconMetadata.js +404 -471
  95. package/dist/esm/iconParts.js +125 -89
  96. package/dist/esm/iconStack.js +145 -154
  97. package/dist/esm/iconStyles.js +1681 -508
  98. package/dist/esm/iconValue.js +361 -429
  99. package/dist/esm/icons/accessibility.js +1133 -133
  100. package/dist/esm/icons/actions.js +1320 -329
  101. package/dist/esm/icons/ai.js +1441 -143
  102. package/dist/esm/icons/brand.js +616 -179
  103. package/dist/esm/icons/business.js +957 -191
  104. package/dist/esm/icons/devtech.js +1687 -226
  105. package/dist/esm/icons/ecommerce.js +816 -110
  106. package/dist/esm/icons/education.js +1364 -198
  107. package/dist/esm/icons/files.js +1628 -327
  108. package/dist/esm/icons/fintech.js +807 -103
  109. package/dist/esm/icons/food.js +1043 -153
  110. package/dist/esm/icons/fun.js +819 -108
  111. package/dist/esm/icons/gaming.js +933 -169
  112. package/dist/esm/icons/health.js +636 -111
  113. package/dist/esm/icons/index.js +589 -32
  114. package/dist/esm/icons/input.js +326 -82
  115. package/dist/esm/icons/legal.js +1079 -121
  116. package/dist/esm/icons/media.js +1086 -266
  117. package/dist/esm/icons/navigation.js +421 -122
  118. package/dist/esm/icons/omniverk.js +534 -91
  119. package/dist/esm/icons/realestate.js +1544 -198
  120. package/dist/esm/icons/saas.js +880 -97
  121. package/dist/esm/icons/science.js +1370 -208
  122. package/dist/esm/icons/shapes.js +1343 -307
  123. package/dist/esm/icons/smarthome.js +799 -89
  124. package/dist/esm/icons/social.js +599 -58
  125. package/dist/esm/icons/sports.js +1148 -132
  126. package/dist/esm/icons/sustainability.js +1226 -138
  127. package/dist/esm/icons/travel.js +1486 -147
  128. package/dist/esm/icons/ui.js +1540 -314
  129. package/dist/esm/icons/weather.js +1181 -172
  130. package/dist/esm/index.js +749 -58
  131. package/dist/esm/lottieIntegration.js +264 -265
  132. package/dist/esm/nicetodev-icons.css +1 -1
  133. package/dist/esm/particleEffects.js +271 -250
  134. package/dist/esm/resolver.js +231 -283
  135. package/dist/esm/rsc.js +182 -192
  136. package/dist/esm/sharpen.js +78 -129
  137. package/dist/esm/smilAnimations.js +385 -164
  138. package/dist/esm/stacking.js +99 -121
  139. package/dist/esm/tailwind-plugin.js +282 -319
  140. package/dist/esm/types.js +50 -71
  141. package/dist/esm/utilities.js +177 -321
  142. package/dist/esm/variantProps.js +23 -52
  143. package/dist/types/animationSpeed.d.ts +19 -0
  144. package/dist/types/createIcon.d.ts +6 -0
  145. package/dist/types/iconStyles.d.ts +6 -1
  146. package/dist/types/icons/brand.d.ts +0 -4
  147. package/dist/types/icons/food.d.ts +0 -3
  148. package/dist/types/icons/index.d.ts +3 -3
  149. package/dist/types/icons/omniverk.d.ts +0 -3
  150. package/dist/types/icons/science.d.ts +1 -1
  151. package/dist/types/smilAnimations.d.ts +4 -2
  152. package/dist/types/types.d.ts +7 -0
  153. package/package.json +15 -22
@@ -1,575 +1,709 @@
1
- import { jsxs, jsx } from 'react/jsx-runtime';
2
- import { useNiceTranslation } from '@nice2dev/ui-core';
3
- import { useState, useMemo, useCallback } from 'react';
4
- import { NtdCheck } from './icons/actions.js';
5
-
6
- /* ══════════════════════════════════════════════════════════════════════════════
7
- Constants
8
- ══════════════════════════════════════════════════════════════════════════════ */
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useNiceTranslation } from "@nice2dev/ui-core";
3
+ import { useState, useMemo, useCallback } from "react";
4
+ import { NtdCheck } from "./icons/actions.js";
9
5
  const DEFAULT_CONFIG = {
10
- name: 'MyIcons',
11
- packageName: '@myproject/icons',
12
- // audit-allow: i18n — the generated package.json's default description, not UI copy
13
- description: 'Custom icon set',
14
- version: '1.0.0',
15
- author: '',
16
- license: 'MIT',
17
- format: 'esm',
18
- generateTypes: true,
19
- includeMetadata: false,
20
- treeShaking: true,
6
+ name: "MyIcons",
7
+ packageName: "@myproject/icons",
8
+ // audit-allow: i18n — the generated package.json's default description, not UI copy
9
+ description: "Custom icon set",
10
+ version: "1.0.0",
11
+ author: "",
12
+ license: "MIT",
13
+ format: "esm",
14
+ generateTypes: true,
15
+ includeMetadata: false,
16
+ treeShaking: true
21
17
  };
22
- /**
23
- * Converts to PascalCase.
24
- */
25
18
  function toPascalCase(str) {
26
- return str
27
- .split(/[-_\s]+/)
28
- .map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase())
29
- .join('');
19
+ return str.split(/[-_\s]+/).map((part) => part.charAt(0).toUpperCase() + part.slice(1).toLowerCase()).join("");
30
20
  }
31
- /**
32
- * Generates ESM index file.
33
- */
34
21
  function generateESMIndex(items, config) {
35
- const lines = [
36
- `/**`,
37
- ` * ${config.name}`,
38
- ` * ${config.description}`,
39
- ` * @version ${config.version}`,
40
- ` * @license ${config.license}`,
41
- ` */`,
42
- '',
43
- ];
44
- if (config.treeShaking) {
45
- // Individual exports
46
- items
47
- .filter((i) => i.included)
48
- .forEach((item) => {
49
- const exportName = toPascalCase(item.customName);
50
- lines.push(`export { ${item.originalName} as ${exportName} } from '@nice2dev/icons';`);
51
- });
52
- }
53
- else {
54
- // Single object export
55
- lines.push(`import {`);
56
- items
57
- .filter((i) => i.included)
58
- .forEach((item) => {
59
- lines.push(` ${item.originalName},`);
60
- });
61
- lines.push(`} from '@nice2dev/icons';`);
62
- lines.push('');
63
- lines.push(`export const ${config.name} = {`);
64
- items
65
- .filter((i) => i.included)
66
- .forEach((item) => {
67
- const exportName = toPascalCase(item.customName);
68
- lines.push(` ${exportName}: ${item.originalName},`);
69
- });
70
- lines.push(`};`);
71
- }
72
- if (config.includeMetadata) {
73
- lines.push('');
74
- lines.push(`export const iconMetadata = {`);
75
- items
76
- .filter((i) => i.included && i.metadata)
77
- .forEach((item) => {
78
- const exportName = toPascalCase(item.customName);
79
- lines.push(` ${exportName}: ${JSON.stringify(item.metadata, null, 2)},`);
80
- });
81
- lines.push(`};`);
82
- }
83
- return lines.join('\n');
22
+ const lines = [
23
+ `/**`,
24
+ ` * ${config.name}`,
25
+ ` * ${config.description}`,
26
+ ` * @version ${config.version}`,
27
+ ` * @license ${config.license}`,
28
+ ` */`,
29
+ ""
30
+ ];
31
+ if (config.treeShaking) {
32
+ items.filter((i) => i.included).forEach((item) => {
33
+ const exportName = toPascalCase(item.customName);
34
+ lines.push(`export { ${item.originalName} as ${exportName} } from '@nice2dev/icons';`);
35
+ });
36
+ } else {
37
+ lines.push(`import {`);
38
+ items.filter((i) => i.included).forEach((item) => {
39
+ lines.push(` ${item.originalName},`);
40
+ });
41
+ lines.push(`} from '@nice2dev/icons';`);
42
+ lines.push("");
43
+ lines.push(`export const ${config.name} = {`);
44
+ items.filter((i) => i.included).forEach((item) => {
45
+ const exportName = toPascalCase(item.customName);
46
+ lines.push(` ${exportName}: ${item.originalName},`);
47
+ });
48
+ lines.push(`};`);
49
+ }
50
+ if (config.includeMetadata) {
51
+ lines.push("");
52
+ lines.push(`export const iconMetadata = {`);
53
+ items.filter((i) => i.included && i.metadata).forEach((item) => {
54
+ const exportName = toPascalCase(item.customName);
55
+ lines.push(` ${exportName}: ${JSON.stringify(item.metadata, null, 2)},`);
56
+ });
57
+ lines.push(`};`);
58
+ }
59
+ return lines.join("\n");
84
60
  }
85
- /**
86
- * Generates CommonJS index file.
87
- */
88
61
  function generateCJSIndex(items, config) {
89
- const lines = [
90
- `/**`,
91
- ` * ${config.name}`,
92
- ` * ${config.description}`,
93
- ` * @version ${config.version}`,
94
- ` * @license ${config.license}`,
95
- ` */`,
96
- '',
97
- `const icons = require('@nice2dev/icons');`,
98
- '',
99
- ];
100
- if (config.treeShaking) {
101
- items
102
- .filter((i) => i.included)
103
- .forEach((item) => {
104
- const exportName = toPascalCase(item.customName);
105
- lines.push(`exports.${exportName} = icons.${item.originalName};`);
106
- });
107
- }
108
- else {
109
- lines.push(`exports.${config.name} = {`);
110
- items
111
- .filter((i) => i.included)
112
- .forEach((item) => {
113
- const exportName = toPascalCase(item.customName);
114
- lines.push(` ${exportName}: icons.${item.originalName},`);
115
- });
116
- lines.push(`};`);
117
- }
118
- return lines.join('\n');
62
+ const lines = [
63
+ `/**`,
64
+ ` * ${config.name}`,
65
+ ` * ${config.description}`,
66
+ ` * @version ${config.version}`,
67
+ ` * @license ${config.license}`,
68
+ ` */`,
69
+ "",
70
+ `const icons = require('@nice2dev/icons');`,
71
+ ""
72
+ ];
73
+ if (config.treeShaking) {
74
+ items.filter((i) => i.included).forEach((item) => {
75
+ const exportName = toPascalCase(item.customName);
76
+ lines.push(`exports.${exportName} = icons.${item.originalName};`);
77
+ });
78
+ } else {
79
+ lines.push(`exports.${config.name} = {`);
80
+ items.filter((i) => i.included).forEach((item) => {
81
+ const exportName = toPascalCase(item.customName);
82
+ lines.push(` ${exportName}: icons.${item.originalName},`);
83
+ });
84
+ lines.push(`};`);
85
+ }
86
+ return lines.join("\n");
119
87
  }
120
- /**
121
- * Generates TypeScript types file.
122
- */
123
88
  function generateTypes(items, config) {
124
- const lines = [
125
- `/**`,
126
- ` * TypeScript declarations for ${config.name}`,
127
- ` * @version ${config.version}`,
128
- ` */`,
129
- '',
130
- `import type { ComponentType } from 'react';`,
131
- `import type { NtdIconProps } from '@nice2dev/icons';`,
132
- '',
133
- ];
134
- const includedItems = items.filter((i) => i.included);
135
- if (config.treeShaking) {
136
- includedItems.forEach((item) => {
137
- const exportName = toPascalCase(item.customName);
138
- lines.push(`export declare const ${exportName}: ComponentType<NtdIconProps>;`);
139
- });
140
- }
141
- else {
142
- lines.push(`export declare const ${config.name}: {`);
143
- includedItems.forEach((item) => {
144
- const exportName = toPascalCase(item.customName);
145
- lines.push(` ${exportName}: ComponentType<NtdIconProps>;`);
146
- });
147
- lines.push(`};`);
148
- }
149
- // Icon names union type
150
- lines.push('');
151
- lines.push(`export type ${config.name}Name =`);
152
- includedItems.forEach((item, i) => {
153
- const exportName = toPascalCase(item.customName);
154
- const suffix = i < includedItems.length - 1 ? ' |' : ';';
155
- lines.push(` | '${exportName}'${suffix}`);
89
+ const lines = [
90
+ `/**`,
91
+ ` * TypeScript declarations for ${config.name}`,
92
+ ` * @version ${config.version}`,
93
+ ` */`,
94
+ "",
95
+ `import type { ComponentType } from 'react';`,
96
+ `import type { NtdIconProps } from '@nice2dev/icons';`,
97
+ ""
98
+ ];
99
+ const includedItems = items.filter((i) => i.included);
100
+ if (config.treeShaking) {
101
+ includedItems.forEach((item) => {
102
+ const exportName = toPascalCase(item.customName);
103
+ lines.push(`export declare const ${exportName}: ComponentType<NtdIconProps>;`);
156
104
  });
157
- return lines.join('\n');
105
+ } else {
106
+ lines.push(`export declare const ${config.name}: {`);
107
+ includedItems.forEach((item) => {
108
+ const exportName = toPascalCase(item.customName);
109
+ lines.push(` ${exportName}: ComponentType<NtdIconProps>;`);
110
+ });
111
+ lines.push(`};`);
112
+ }
113
+ lines.push("");
114
+ lines.push(`export type ${config.name}Name =`);
115
+ includedItems.forEach((item, i) => {
116
+ const exportName = toPascalCase(item.customName);
117
+ const suffix = i < includedItems.length - 1 ? " |" : ";";
118
+ lines.push(` | '${exportName}'${suffix}`);
119
+ });
120
+ return lines.join("\n");
158
121
  }
159
- /**
160
- * Generates package.json.
161
- */
162
122
  function generatePackageJson(items, config) {
163
- const pkg = {
164
- name: config.packageName,
165
- version: config.version,
166
- description: config.description,
167
- author: config.author,
168
- license: config.license,
169
- sideEffects: false,
170
- peerDependencies: {
171
- '@nice2dev/icons': '^1.0.0',
172
- react: '>=17.0.0',
173
- },
123
+ const pkg = {
124
+ name: config.packageName,
125
+ version: config.version,
126
+ description: config.description,
127
+ author: config.author,
128
+ license: config.license,
129
+ sideEffects: false,
130
+ peerDependencies: {
131
+ "@nice2dev/icons": "^1.0.0",
132
+ react: ">=17.0.0"
133
+ }
134
+ };
135
+ if (config.format === "esm" || config.format === "both") {
136
+ pkg.type = "module";
137
+ pkg.main = "./index.js";
138
+ pkg.module = "./index.js";
139
+ }
140
+ if (config.format === "cjs") {
141
+ pkg.main = "./index.cjs";
142
+ }
143
+ if (config.format === "both") {
144
+ pkg.exports = {
145
+ ".": {
146
+ import: "./index.js",
147
+ require: "./index.cjs",
148
+ types: "./index.d.ts"
149
+ }
174
150
  };
175
- if (config.format === 'esm' || config.format === 'both') {
176
- pkg.type = 'module';
177
- pkg.main = './index.js';
178
- pkg.module = './index.js';
151
+ }
152
+ if (config.generateTypes) {
153
+ pkg.types = "./index.d.ts";
154
+ }
155
+ return JSON.stringify(pkg, null, 2);
156
+ }
157
+ function useIconSetCreator(options) {
158
+ const [items, setItems] = useState(
159
+ () => options.icons.map((i) => ({
160
+ originalName: i.name,
161
+ customName: i.name,
162
+ icon: i.icon,
163
+ metadata: i.metadata,
164
+ included: options.initialSelection?.includes(i.name) ?? false
165
+ }))
166
+ );
167
+ const [config, setConfig] = useState({
168
+ ...DEFAULT_CONFIG,
169
+ ...options.defaultConfig
170
+ });
171
+ const selectedCount = useMemo(() => items.filter((i) => i.included).length, [items]);
172
+ const toggleIcon = useCallback((name) => {
173
+ setItems(
174
+ (prev) => prev.map(
175
+ (item) => item.originalName === name ? { ...item, included: !item.included } : item
176
+ )
177
+ );
178
+ }, []);
179
+ const selectAll = useCallback(() => {
180
+ setItems((prev) => prev.map((item) => ({ ...item, included: true })));
181
+ }, []);
182
+ const deselectAll = useCallback(() => {
183
+ setItems((prev) => prev.map((item) => ({ ...item, included: false })));
184
+ }, []);
185
+ const renameIcon = useCallback((originalName, newName) => {
186
+ setItems(
187
+ (prev) => prev.map(
188
+ (item) => item.originalName === originalName ? { ...item, customName: newName } : item
189
+ )
190
+ );
191
+ }, []);
192
+ const updateConfig = useCallback((updates) => {
193
+ setConfig((prev) => ({ ...prev, ...updates }));
194
+ }, []);
195
+ const getSelectedItems = useCallback(() => items.filter((i) => i.included), [items]);
196
+ const generateExport = useCallback(() => {
197
+ const output = [];
198
+ const selectedItems = items.filter((i) => i.included);
199
+ if (selectedItems.length === 0) {
200
+ return output;
179
201
  }
180
- if (config.format === 'cjs') {
181
- pkg.main = './index.cjs';
202
+ if (config.format === "esm" || config.format === "both") {
203
+ output.push({
204
+ filename: "index.js",
205
+ content: generateESMIndex(selectedItems, config),
206
+ type: "js"
207
+ });
182
208
  }
183
- if (config.format === 'both') {
184
- pkg.exports = {
185
- '.': {
186
- import: './index.js',
187
- require: './index.cjs',
188
- types: './index.d.ts',
189
- },
190
- };
209
+ if (config.format === "cjs" || config.format === "both") {
210
+ output.push({
211
+ filename: config.format === "both" ? "index.cjs" : "index.js",
212
+ content: generateCJSIndex(selectedItems, config),
213
+ type: "js"
214
+ });
191
215
  }
192
216
  if (config.generateTypes) {
193
- pkg.types = './index.d.ts';
217
+ output.push({
218
+ filename: "index.d.ts",
219
+ content: generateTypes(selectedItems, config),
220
+ type: "d.ts"
221
+ });
194
222
  }
195
- return JSON.stringify(pkg, null, 2);
196
- }
197
- /**
198
- * Hook for managing icon set creator state.
199
- */
200
- function useIconSetCreator(options) {
201
- const [items, setItems] = useState(() => options.icons.map((i) => {
202
- var _a, _b;
203
- return ({
204
- originalName: i.name,
205
- customName: i.name,
206
- icon: i.icon,
207
- metadata: i.metadata,
208
- included: (_b = (_a = options.initialSelection) === null || _a === void 0 ? void 0 : _a.includes(i.name)) !== null && _b !== void 0 ? _b : false,
209
- });
210
- }));
211
- const [config, setConfig] = useState({
212
- ...DEFAULT_CONFIG,
213
- ...options.defaultConfig,
223
+ output.push({
224
+ filename: "package.json",
225
+ content: generatePackageJson(selectedItems, config),
226
+ type: "json"
214
227
  });
215
- const selectedCount = useMemo(() => items.filter((i) => i.included).length, [items]);
216
- const toggleIcon = useCallback((name) => {
217
- setItems((prev) => prev.map((item) => item.originalName === name ? { ...item, included: !item.included } : item));
218
- }, []);
219
- const selectAll = useCallback(() => {
220
- setItems((prev) => prev.map((item) => ({ ...item, included: true })));
221
- }, []);
222
- const deselectAll = useCallback(() => {
223
- setItems((prev) => prev.map((item) => ({ ...item, included: false })));
224
- }, []);
225
- const renameIcon = useCallback((originalName, newName) => {
226
- setItems((prev) => prev.map((item) => item.originalName === originalName ? { ...item, customName: newName } : item));
227
- }, []);
228
- const updateConfig = useCallback((updates) => {
229
- setConfig((prev) => ({ ...prev, ...updates }));
230
- }, []);
231
- const getSelectedItems = useCallback(() => items.filter((i) => i.included), [items]);
232
- const generateExport = useCallback(() => {
233
- const output = [];
234
- const selectedItems = items.filter((i) => i.included);
235
- if (selectedItems.length === 0) {
236
- return output;
237
- }
238
- // ESM index
239
- if (config.format === 'esm' || config.format === 'both') {
240
- output.push({
241
- filename: 'index.js',
242
- content: generateESMIndex(selectedItems, config),
243
- type: 'js',
244
- });
245
- }
246
- // CJS index
247
- if (config.format === 'cjs' || config.format === 'both') {
248
- output.push({
249
- filename: config.format === 'both' ? 'index.cjs' : 'index.js',
250
- content: generateCJSIndex(selectedItems, config),
251
- type: 'js',
252
- });
253
- }
254
- // TypeScript types
255
- if (config.generateTypes) {
256
- output.push({
257
- filename: 'index.d.ts',
258
- content: generateTypes(selectedItems, config),
259
- type: 'd.ts',
260
- });
261
- }
262
- // package.json
263
- output.push({
264
- filename: 'package.json',
265
- content: generatePackageJson(selectedItems, config),
266
- type: 'json',
267
- });
268
- return output;
269
- }, [items, config]);
270
- return {
271
- items,
272
- config,
273
- selectedCount,
274
- toggleIcon,
275
- selectAll,
276
- deselectAll,
277
- renameIcon,
278
- updateConfig,
279
- generateExport,
280
- getSelectedItems,
281
- };
228
+ return output;
229
+ }, [items, config]);
230
+ return {
231
+ items,
232
+ config,
233
+ selectedCount,
234
+ toggleIcon,
235
+ selectAll,
236
+ deselectAll,
237
+ renameIcon,
238
+ updateConfig,
239
+ generateExport,
240
+ getSelectedItems
241
+ };
282
242
  }
283
- /* ══════════════════════════════════════════════════════════════════════════════
284
- Component
285
- ══════════════════════════════════════════════════════════════════════════════ */
286
- /**
287
- * Icon Set Creator component for building custom icon packages.
288
- */
289
- function NiceIconSetCreator({ icons, initialSelection, defaultConfig, onSelectionChange: _onSelectionChange, onExport, className = '', }) {
290
- const { t } = useNiceTranslation();
291
- const creator = useIconSetCreator({ icons, initialSelection, defaultConfig });
292
- const [searchQuery, setSearchQuery] = useState('');
293
- const [categoryFilter, setCategoryFilter] = useState('all');
294
- const [previewOutput, setPreviewOutput] = useState(null);
295
- // Filter items
296
- const filteredItems = useMemo(() => {
297
- return creator.items.filter((item) => {
298
- var _a, _b, _c;
299
- const matchesSearch = searchQuery === '' ||
300
- item.originalName.toLowerCase().includes(searchQuery.toLowerCase()) ||
301
- item.customName.toLowerCase().includes(searchQuery.toLowerCase()) ||
302
- ((_b = (_a = item.metadata) === null || _a === void 0 ? void 0 : _a.tags) === null || _b === void 0 ? void 0 : _b.some((t) => t.toLowerCase().includes(searchQuery.toLowerCase())));
303
- const matchesCategory = categoryFilter === 'all' || ((_c = item.metadata) === null || _c === void 0 ? void 0 : _c.category) === categoryFilter;
304
- return matchesSearch && matchesCategory;
305
- });
306
- }, [creator.items, searchQuery, categoryFilter]);
307
- // Get unique categories
308
- const categories = useMemo(() => {
309
- const cats = new Set();
310
- icons.forEach((i) => {
311
- var _a;
312
- if ((_a = i.metadata) === null || _a === void 0 ? void 0 : _a.category) {
313
- cats.add(i.metadata.category);
243
+ function NiceIconSetCreator({
244
+ icons,
245
+ initialSelection,
246
+ defaultConfig,
247
+ onSelectionChange: _onSelectionChange,
248
+ onExport,
249
+ className = ""
250
+ }) {
251
+ const { t } = useNiceTranslation();
252
+ const creator = useIconSetCreator({ icons, initialSelection, defaultConfig });
253
+ const [searchQuery, setSearchQuery] = useState("");
254
+ const [categoryFilter, setCategoryFilter] = useState("all");
255
+ const [previewOutput, setPreviewOutput] = useState(null);
256
+ const filteredItems = useMemo(() => {
257
+ return creator.items.filter((item) => {
258
+ const matchesSearch = searchQuery === "" || item.originalName.toLowerCase().includes(searchQuery.toLowerCase()) || item.customName.toLowerCase().includes(searchQuery.toLowerCase()) || item.metadata?.tags?.some((t2) => t2.toLowerCase().includes(searchQuery.toLowerCase()));
259
+ const matchesCategory = categoryFilter === "all" || item.metadata?.category === categoryFilter;
260
+ return matchesSearch && matchesCategory;
261
+ });
262
+ }, [creator.items, searchQuery, categoryFilter]);
263
+ const categories = useMemo(() => {
264
+ const cats = /* @__PURE__ */ new Set();
265
+ icons.forEach((i) => {
266
+ if (i.metadata?.category) {
267
+ cats.add(i.metadata.category);
268
+ }
269
+ });
270
+ return Array.from(cats);
271
+ }, [icons]);
272
+ const handleExport = useCallback(() => {
273
+ const output = creator.generateExport();
274
+ setPreviewOutput(output);
275
+ onExport?.(output);
276
+ }, [creator, onExport]);
277
+ const handleDownloadZip = useCallback(async () => {
278
+ const output = creator.generateExport();
279
+ if (output.length === 0) {
280
+ return;
281
+ }
282
+ output.forEach((file) => {
283
+ const blob = new Blob([file.content], { type: "text/plain" });
284
+ const url = URL.createObjectURL(blob);
285
+ const a = document.createElement("a");
286
+ a.href = url;
287
+ a.download = file.filename;
288
+ document.body.appendChild(a);
289
+ a.click();
290
+ document.body.removeChild(a);
291
+ URL.revokeObjectURL(url);
292
+ });
293
+ }, [creator]);
294
+ return /* @__PURE__ */ jsxs("div", { className: `nice-icon-set-creator ${className}`, style: styles.container, children: [
295
+ /* @__PURE__ */ jsxs("div", { style: styles.header, children: [
296
+ /* @__PURE__ */ jsx("h2", { style: styles.title, children: t("iconSetCreator.iconSetCreator", "Icon Set Creator") }),
297
+ /* @__PURE__ */ jsx("div", { style: styles.stats, children: t("iconSetCreator.iconsSelected", "{selectedCount} / {items} icons selected").replace("{selectedCount}", String(creator.selectedCount)).replace("{items}", String(creator.items.length)) })
298
+ ] }),
299
+ /* @__PURE__ */ jsxs("div", { style: styles.content, children: [
300
+ /* @__PURE__ */ jsxs("div", { style: styles.configPanel, children: [
301
+ /* @__PURE__ */ jsx("h3", { style: styles.sectionTitle, children: t("iconSetCreator.configuration", "Configuration") }),
302
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
303
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.setName", "Set Name") }),
304
+ /* @__PURE__ */ jsx(
305
+ "input",
306
+ {
307
+ type: "text",
308
+ value: creator.config.name,
309
+ onChange: (e) => creator.updateConfig({ name: e.target.value }),
310
+ style: styles.input,
311
+ placeholder: "MyIcons"
314
312
  }
315
- });
316
- return Array.from(cats);
317
- }, [icons]);
318
- // Handle export
319
- const handleExport = useCallback(() => {
320
- const output = creator.generateExport();
321
- setPreviewOutput(output);
322
- onExport === null || onExport === void 0 ? void 0 : onExport(output);
323
- }, [creator, onExport]);
324
- // Download as ZIP
325
- const handleDownloadZip = useCallback(async () => {
326
- const output = creator.generateExport();
327
- if (output.length === 0) {
328
- return;
329
- }
330
- // For simplicity, download files individually
331
- // In production, use JSZip library
332
- output.forEach((file) => {
333
- const blob = new Blob([file.content], { type: 'text/plain' });
334
- const url = URL.createObjectURL(blob);
335
- const a = document.createElement('a');
336
- a.href = url;
337
- a.download = file.filename;
338
- document.body.appendChild(a);
339
- a.click();
340
- document.body.removeChild(a);
341
- URL.revokeObjectURL(url);
342
- });
343
- }, [creator]);
344
- return (jsxs("div", { className: `nice-icon-set-creator ${className}`, style: styles.container, children: [jsxs("div", { style: styles.header, children: [jsx("h2", { style: styles.title, children: t('iconSetCreator.iconSetCreator', 'Icon Set Creator') }), jsx("div", { style: styles.stats, children: t('iconSetCreator.iconsSelected', '{selectedCount} / {items} icons selected')
345
- .replace('{selectedCount}', String(creator.selectedCount))
346
- .replace('{items}', String(creator.items.length)) })] }), jsxs("div", { style: styles.content, children: [jsxs("div", { style: styles.configPanel, children: [jsx("h3", { style: styles.sectionTitle, children: t('iconSetCreator.configuration', 'Configuration') }), jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.setName', 'Set Name') }), jsx("input", { type: "text", value: creator.config.name, onChange: (e) => creator.updateConfig({ name: e.target.value }), style: styles.input, placeholder: "MyIcons" })] }), jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.packageName', 'Package Name') }), jsx("input", { type: "text", value: creator.config.packageName, onChange: (e) => creator.updateConfig({ packageName: e.target.value }), style: styles.input, placeholder: "@myproject/icons" })] }), jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.description', 'Description') }), jsx("input", { type: "text", value: creator.config.description, onChange: (e) => creator.updateConfig({ description: e.target.value }), style: styles.input })] }), jsxs("div", { style: styles.fieldRow, children: [jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.version', 'Version') }), jsx("input", { type: "text", value: creator.config.version, onChange: (e) => creator.updateConfig({ version: e.target.value }), style: styles.input })] }), jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.license', 'License') }), jsx("input", { type: "text", value: creator.config.license, onChange: (e) => creator.updateConfig({ license: e.target.value }), style: styles.input })] })] }), jsxs("div", { style: styles.field, children: [jsx("label", { style: styles.fieldLabel, children: t('iconSetCreator.exportFormat', 'Export Format') }), jsxs("select", { value: creator.config.format, onChange: (e) => creator.updateConfig({ format: e.target.value }), style: styles.select, children: [jsx("option", { value: "esm", children: t('iconSetCreator.esModules', 'ES Modules') }), jsx("option", { value: "cjs", children: "CommonJS" }), jsx("option", { value: "both", children: t('iconSetCreator.both', 'Both') })] })] }), jsxs("div", { style: styles.checkboxGroup, children: [jsxs("label", { style: styles.checkbox, children: [jsx("input", { type: "checkbox", checked: creator.config.generateTypes, onChange: (e) => creator.updateConfig({ generateTypes: e.target.checked }) }), t('iconSetCreator.generateTypescriptTypes', 'Generate TypeScript types')] }), jsxs("label", { style: styles.checkbox, children: [jsx("input", { type: "checkbox", checked: creator.config.treeShaking, onChange: (e) => creator.updateConfig({ treeShaking: e.target.checked }) }), t('iconSetCreator.treeShakingFriendly', 'Tree-shaking friendly')] }), jsxs("label", { style: styles.checkbox, children: [jsx("input", { type: "checkbox", checked: creator.config.includeMetadata, onChange: (e) => creator.updateConfig({ includeMetadata: e.target.checked }) }), t('iconSetCreator.includeMetadata', 'Include metadata')] })] }), jsxs("div", { style: styles.exportActions, children: [jsx("button", { onClick: handleExport, style: styles.primaryButton, children: t('iconSetCreator.previewExport', 'Preview Export') }), jsx("button", { onClick: handleDownloadZip, style: styles.secondaryButton, children: t('iconSetCreator.downloadFiles', 'Download Files') })] })] }), jsxs("div", { style: styles.selectionPanel, children: [jsxs("div", { style: styles.selectionHeader, children: [jsx("input", { type: "text", value: searchQuery, onChange: (e) => setSearchQuery(e.target.value), placeholder: t('iconSetCreator.searchIcons', 'Search icons...'), style: styles.searchInput }), jsxs("select", { value: categoryFilter, onChange: (e) => setCategoryFilter(e.target.value), style: styles.categorySelect, children: [jsx("option", { value: "all", children: t('iconSetCreator.allCategories', 'All Categories') }), categories.map((cat) => (jsx("option", { value: cat, children: cat }, cat)))] })] }), jsxs("div", { style: styles.selectionActions, children: [jsx("button", { onClick: creator.selectAll, style: styles.smallButton, children: t('iconSetCreator.selectAll', 'Select All') }), jsx("button", { onClick: creator.deselectAll, style: styles.smallButton, children: t('iconSetCreator.deselectAll', 'Deselect All') })] }), jsx("div", { style: styles.iconGrid, children: filteredItems.map((item) => (jsxs("div", { role: "checkbox", "aria-checked": item.included, "aria-label": item.customName, tabIndex: 0, onClick: () => creator.toggleIcon(item.originalName), onKeyDown: (e) => {
347
- if (e.key === 'Enter' || e.key === ' ') {
348
- e.preventDefault();
349
- creator.toggleIcon(item.originalName);
350
- }
351
- }, style: {
352
- ...styles.iconItem,
353
- borderColor: item.included ? '#3b82f6' : '#e5e7eb',
354
- backgroundColor: item.included ? '#eff6ff' : '#fff',
355
- }, children: [jsx(item.icon, { size: 32 }), jsx("span", { style: styles.iconName, children: item.customName }), item.included && (jsx("span", { style: styles.checkmark, children: jsx(NtdCheck, { size: 14 }) }))] }, item.originalName))) })] }), previewOutput && (jsxs("div", { style: styles.previewPanel, children: [jsx("h3", { style: styles.sectionTitle, children: t('iconSetCreator.exportPreview', 'Export Preview') }), previewOutput.map((file) => (jsxs("div", { style: styles.filePreview, children: [jsx("div", { style: styles.fileName, children: file.filename }), jsxs("pre", { style: styles.codePreview, children: [file.content.slice(0, 1000), file.content.length > 1000 && '...'] })] }, file.filename)))] }))] })] }));
313
+ )
314
+ ] }),
315
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
316
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.packageName", "Package Name") }),
317
+ /* @__PURE__ */ jsx(
318
+ "input",
319
+ {
320
+ type: "text",
321
+ value: creator.config.packageName,
322
+ onChange: (e) => creator.updateConfig({ packageName: e.target.value }),
323
+ style: styles.input,
324
+ placeholder: "@myproject/icons"
325
+ }
326
+ )
327
+ ] }),
328
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
329
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.description", "Description") }),
330
+ /* @__PURE__ */ jsx(
331
+ "input",
332
+ {
333
+ type: "text",
334
+ value: creator.config.description,
335
+ onChange: (e) => creator.updateConfig({ description: e.target.value }),
336
+ style: styles.input
337
+ }
338
+ )
339
+ ] }),
340
+ /* @__PURE__ */ jsxs("div", { style: styles.fieldRow, children: [
341
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
342
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.version", "Version") }),
343
+ /* @__PURE__ */ jsx(
344
+ "input",
345
+ {
346
+ type: "text",
347
+ value: creator.config.version,
348
+ onChange: (e) => creator.updateConfig({ version: e.target.value }),
349
+ style: styles.input
350
+ }
351
+ )
352
+ ] }),
353
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
354
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.license", "License") }),
355
+ /* @__PURE__ */ jsx(
356
+ "input",
357
+ {
358
+ type: "text",
359
+ value: creator.config.license,
360
+ onChange: (e) => creator.updateConfig({ license: e.target.value }),
361
+ style: styles.input
362
+ }
363
+ )
364
+ ] })
365
+ ] }),
366
+ /* @__PURE__ */ jsxs("div", { style: styles.field, children: [
367
+ /* @__PURE__ */ jsx("label", { style: styles.fieldLabel, children: t("iconSetCreator.exportFormat", "Export Format") }),
368
+ /* @__PURE__ */ jsxs(
369
+ "select",
370
+ {
371
+ value: creator.config.format,
372
+ onChange: (e) => creator.updateConfig({ format: e.target.value }),
373
+ style: styles.select,
374
+ children: [
375
+ /* @__PURE__ */ jsx("option", { value: "esm", children: t("iconSetCreator.esModules", "ES Modules") }),
376
+ /* @__PURE__ */ jsx("option", { value: "cjs", children: "CommonJS" }),
377
+ /* @__PURE__ */ jsx("option", { value: "both", children: t("iconSetCreator.both", "Both") })
378
+ ]
379
+ }
380
+ )
381
+ ] }),
382
+ /* @__PURE__ */ jsxs("div", { style: styles.checkboxGroup, children: [
383
+ /* @__PURE__ */ jsxs("label", { style: styles.checkbox, children: [
384
+ /* @__PURE__ */ jsx(
385
+ "input",
386
+ {
387
+ type: "checkbox",
388
+ checked: creator.config.generateTypes,
389
+ onChange: (e) => creator.updateConfig({ generateTypes: e.target.checked })
390
+ }
391
+ ),
392
+ t("iconSetCreator.generateTypescriptTypes", "Generate TypeScript types")
393
+ ] }),
394
+ /* @__PURE__ */ jsxs("label", { style: styles.checkbox, children: [
395
+ /* @__PURE__ */ jsx(
396
+ "input",
397
+ {
398
+ type: "checkbox",
399
+ checked: creator.config.treeShaking,
400
+ onChange: (e) => creator.updateConfig({ treeShaking: e.target.checked })
401
+ }
402
+ ),
403
+ t("iconSetCreator.treeShakingFriendly", "Tree-shaking friendly")
404
+ ] }),
405
+ /* @__PURE__ */ jsxs("label", { style: styles.checkbox, children: [
406
+ /* @__PURE__ */ jsx(
407
+ "input",
408
+ {
409
+ type: "checkbox",
410
+ checked: creator.config.includeMetadata,
411
+ onChange: (e) => creator.updateConfig({ includeMetadata: e.target.checked })
412
+ }
413
+ ),
414
+ t("iconSetCreator.includeMetadata", "Include metadata")
415
+ ] })
416
+ ] }),
417
+ /* @__PURE__ */ jsxs("div", { style: styles.exportActions, children: [
418
+ /* @__PURE__ */ jsx("button", { onClick: handleExport, style: styles.primaryButton, children: t("iconSetCreator.previewExport", "Preview Export") }),
419
+ /* @__PURE__ */ jsx("button", { onClick: handleDownloadZip, style: styles.secondaryButton, children: t("iconSetCreator.downloadFiles", "Download Files") })
420
+ ] })
421
+ ] }),
422
+ /* @__PURE__ */ jsxs("div", { style: styles.selectionPanel, children: [
423
+ /* @__PURE__ */ jsxs("div", { style: styles.selectionHeader, children: [
424
+ /* @__PURE__ */ jsx(
425
+ "input",
426
+ {
427
+ type: "text",
428
+ value: searchQuery,
429
+ onChange: (e) => setSearchQuery(e.target.value),
430
+ placeholder: t("iconSetCreator.searchIcons", "Search icons..."),
431
+ style: styles.searchInput
432
+ }
433
+ ),
434
+ /* @__PURE__ */ jsxs(
435
+ "select",
436
+ {
437
+ value: categoryFilter,
438
+ onChange: (e) => setCategoryFilter(e.target.value),
439
+ style: styles.categorySelect,
440
+ children: [
441
+ /* @__PURE__ */ jsx("option", { value: "all", children: t("iconSetCreator.allCategories", "All Categories") }),
442
+ categories.map((cat) => /* @__PURE__ */ jsx("option", { value: cat, children: cat }, cat))
443
+ ]
444
+ }
445
+ )
446
+ ] }),
447
+ /* @__PURE__ */ jsxs("div", { style: styles.selectionActions, children: [
448
+ /* @__PURE__ */ jsx("button", { onClick: creator.selectAll, style: styles.smallButton, children: t("iconSetCreator.selectAll", "Select All") }),
449
+ /* @__PURE__ */ jsx("button", { onClick: creator.deselectAll, style: styles.smallButton, children: t("iconSetCreator.deselectAll", "Deselect All") })
450
+ ] }),
451
+ /* @__PURE__ */ jsx("div", { style: styles.iconGrid, children: filteredItems.map((item) => /* @__PURE__ */ jsxs(
452
+ "div",
453
+ {
454
+ role: "checkbox",
455
+ "aria-checked": item.included,
456
+ "aria-label": item.customName,
457
+ tabIndex: 0,
458
+ onClick: () => creator.toggleIcon(item.originalName),
459
+ onKeyDown: (e) => {
460
+ if (e.key === "Enter" || e.key === " ") {
461
+ e.preventDefault();
462
+ creator.toggleIcon(item.originalName);
463
+ }
464
+ },
465
+ style: {
466
+ ...styles.iconItem,
467
+ borderColor: item.included ? "#3b82f6" : "#e5e7eb",
468
+ backgroundColor: item.included ? "#eff6ff" : "#fff"
469
+ },
470
+ children: [
471
+ /* @__PURE__ */ jsx(item.icon, { size: 32 }),
472
+ /* @__PURE__ */ jsx("span", { style: styles.iconName, children: item.customName }),
473
+ item.included && /* @__PURE__ */ jsx("span", { style: styles.checkmark, children: /* @__PURE__ */ jsx(NtdCheck, { size: 14 }) })
474
+ ]
475
+ },
476
+ item.originalName
477
+ )) })
478
+ ] }),
479
+ previewOutput && /* @__PURE__ */ jsxs("div", { style: styles.previewPanel, children: [
480
+ /* @__PURE__ */ jsx("h3", { style: styles.sectionTitle, children: t("iconSetCreator.exportPreview", "Export Preview") }),
481
+ previewOutput.map((file) => /* @__PURE__ */ jsxs("div", { style: styles.filePreview, children: [
482
+ /* @__PURE__ */ jsx("div", { style: styles.fileName, children: file.filename }),
483
+ /* @__PURE__ */ jsxs("pre", { style: styles.codePreview, children: [
484
+ file.content.slice(0, 1e3),
485
+ file.content.length > 1e3 && "..."
486
+ ] })
487
+ ] }, file.filename))
488
+ ] })
489
+ ] })
490
+ ] });
356
491
  }
357
- /* ══════════════════════════════════════════════════════════════════════════════
358
- Styles
359
- ══════════════════════════════════════════════════════════════════════════════ */
360
492
  const styles = {
361
- container: {
362
- fontFamily: 'system-ui, -apple-system, sans-serif',
363
- fontSize: '14px',
364
- border: '1px solid #e5e7eb',
365
- borderRadius: '8px',
366
- overflow: 'hidden',
367
- },
368
- header: {
369
- display: 'flex',
370
- justifyContent: 'space-between',
371
- alignItems: 'center',
372
- padding: '16px 20px',
373
- borderBottom: '1px solid #e5e7eb',
374
- backgroundColor: '#f9fafb',
375
- },
376
- title: {
377
- margin: 0,
378
- fontSize: '18px',
379
- fontWeight: 600,
380
- },
381
- stats: {
382
- color: '#6b7280',
383
- fontSize: '13px',
384
- },
385
- content: {
386
- display: 'flex',
387
- minHeight: '500px',
388
- },
389
- configPanel: {
390
- width: '280px',
391
- padding: '16px',
392
- borderRight: '1px solid #e5e7eb',
393
- backgroundColor: '#fafafa',
394
- },
395
- sectionTitle: {
396
- margin: '0 0 16px 0',
397
- fontSize: '14px',
398
- fontWeight: 600,
399
- color: '#374151',
400
- },
401
- field: {
402
- marginBottom: '12px',
403
- },
404
- fieldRow: {
405
- display: 'flex',
406
- gap: '12px',
407
- },
408
- fieldLabel: {
409
- display: 'block',
410
- marginBottom: '4px',
411
- fontSize: '12px',
412
- fontWeight: 500,
413
- color: '#6b7280',
414
- },
415
- input: {
416
- width: '100%',
417
- padding: '8px 10px',
418
- borderRadius: '4px',
419
- border: '1px solid #d1d5db',
420
- fontSize: '13px',
421
- boxSizing: 'border-box',
422
- },
423
- select: {
424
- width: '100%',
425
- padding: '8px 10px',
426
- borderRadius: '4px',
427
- border: '1px solid #d1d5db',
428
- fontSize: '13px',
429
- backgroundColor: '#fff',
430
- },
431
- checkboxGroup: {
432
- display: 'flex',
433
- flexDirection: 'column',
434
- gap: '8px',
435
- marginTop: '16px',
436
- },
437
- checkbox: {
438
- display: 'flex',
439
- alignItems: 'center',
440
- gap: '8px',
441
- fontSize: '13px',
442
- cursor: 'pointer',
443
- },
444
- exportActions: {
445
- display: 'flex',
446
- flexDirection: 'column',
447
- gap: '8px',
448
- marginTop: '20px',
449
- },
450
- primaryButton: {
451
- padding: '10px 16px',
452
- borderRadius: '6px',
453
- border: 'none',
454
- backgroundColor: '#3b82f6',
455
- color: '#fff',
456
- fontWeight: 500,
457
- cursor: 'pointer',
458
- },
459
- secondaryButton: {
460
- padding: '10px 16px',
461
- borderRadius: '6px',
462
- border: '1px solid #d1d5db',
463
- backgroundColor: '#fff',
464
- fontWeight: 500,
465
- cursor: 'pointer',
466
- },
467
- selectionPanel: {
468
- flex: 1,
469
- padding: '16px',
470
- display: 'flex',
471
- flexDirection: 'column',
472
- },
473
- selectionHeader: {
474
- display: 'flex',
475
- gap: '12px',
476
- marginBottom: '12px',
477
- },
478
- searchInput: {
479
- flex: 1,
480
- padding: '8px 12px',
481
- borderRadius: '6px',
482
- border: '1px solid #d1d5db',
483
- fontSize: '13px',
484
- },
485
- categorySelect: {
486
- padding: '8px 12px',
487
- borderRadius: '6px',
488
- border: '1px solid #d1d5db',
489
- fontSize: '13px',
490
- backgroundColor: '#fff',
491
- },
492
- selectionActions: {
493
- display: 'flex',
494
- gap: '8px',
495
- marginBottom: '12px',
496
- },
497
- smallButton: {
498
- padding: '6px 12px',
499
- borderRadius: '4px',
500
- border: '1px solid #d1d5db',
501
- backgroundColor: '#fff',
502
- fontSize: '12px',
503
- cursor: 'pointer',
504
- },
505
- iconGrid: {
506
- display: 'grid',
507
- gridTemplateColumns: 'repeat(auto-fill, minmax(100px, 1fr))',
508
- gap: '8px',
509
- overflowY: 'auto',
510
- flex: 1,
511
- },
512
- iconItem: {
513
- display: 'flex',
514
- flexDirection: 'column',
515
- alignItems: 'center',
516
- gap: '6px',
517
- padding: '12px 8px',
518
- borderRadius: '6px',
519
- border: '2px solid',
520
- cursor: 'pointer',
521
- transition: 'all 0.15s ease',
522
- position: 'relative',
523
- },
524
- iconName: {
525
- fontSize: '11px',
526
- color: '#6b7280',
527
- textAlign: 'center',
528
- wordBreak: 'break-word',
529
- },
530
- checkmark: {
531
- position: 'absolute',
532
- top: '4px',
533
- right: '4px',
534
- width: '18px',
535
- height: '18px',
536
- borderRadius: '50%',
537
- backgroundColor: '#3b82f6',
538
- color: '#fff',
539
- fontSize: '11px',
540
- display: 'flex',
541
- alignItems: 'center',
542
- justifyContent: 'center',
543
- },
544
- previewPanel: {
545
- width: '350px',
546
- padding: '16px',
547
- borderLeft: '1px solid #e5e7eb',
548
- backgroundColor: '#f9fafb',
549
- overflowY: 'auto',
550
- },
551
- filePreview: {
552
- marginBottom: '16px',
553
- },
554
- fileName: {
555
- fontSize: '12px',
556
- fontWeight: 600,
557
- color: '#374151',
558
- marginBottom: '6px',
559
- fontFamily: 'monospace',
560
- },
561
- codePreview: {
562
- padding: '12px',
563
- borderRadius: '6px',
564
- backgroundColor: '#1e1e1e',
565
- color: '#d4d4d4',
566
- fontSize: '11px',
567
- overflow: 'auto',
568
- maxHeight: '200px',
569
- fontFamily: 'monospace',
570
- whiteSpace: 'pre-wrap',
571
- margin: 0,
572
- },
493
+ container: {
494
+ fontFamily: "system-ui, -apple-system, sans-serif",
495
+ fontSize: "14px",
496
+ border: "1px solid #e5e7eb",
497
+ borderRadius: "8px",
498
+ overflow: "hidden"
499
+ },
500
+ header: {
501
+ display: "flex",
502
+ justifyContent: "space-between",
503
+ alignItems: "center",
504
+ padding: "16px 20px",
505
+ borderBottom: "1px solid #e5e7eb",
506
+ backgroundColor: "#f9fafb"
507
+ },
508
+ title: {
509
+ margin: 0,
510
+ fontSize: "18px",
511
+ fontWeight: 600
512
+ },
513
+ stats: {
514
+ color: "#6b7280",
515
+ fontSize: "13px"
516
+ },
517
+ content: {
518
+ display: "flex",
519
+ minHeight: "500px"
520
+ },
521
+ configPanel: {
522
+ width: "280px",
523
+ padding: "16px",
524
+ borderRight: "1px solid #e5e7eb",
525
+ backgroundColor: "#fafafa"
526
+ },
527
+ sectionTitle: {
528
+ margin: "0 0 16px 0",
529
+ fontSize: "14px",
530
+ fontWeight: 600,
531
+ color: "#374151"
532
+ },
533
+ field: {
534
+ marginBottom: "12px"
535
+ },
536
+ fieldRow: {
537
+ display: "flex",
538
+ gap: "12px"
539
+ },
540
+ fieldLabel: {
541
+ display: "block",
542
+ marginBottom: "4px",
543
+ fontSize: "12px",
544
+ fontWeight: 500,
545
+ color: "#6b7280"
546
+ },
547
+ input: {
548
+ width: "100%",
549
+ padding: "8px 10px",
550
+ borderRadius: "4px",
551
+ border: "1px solid #d1d5db",
552
+ fontSize: "13px",
553
+ boxSizing: "border-box"
554
+ },
555
+ select: {
556
+ width: "100%",
557
+ padding: "8px 10px",
558
+ borderRadius: "4px",
559
+ border: "1px solid #d1d5db",
560
+ fontSize: "13px",
561
+ backgroundColor: "#fff"
562
+ },
563
+ checkboxGroup: {
564
+ display: "flex",
565
+ flexDirection: "column",
566
+ gap: "8px",
567
+ marginTop: "16px"
568
+ },
569
+ checkbox: {
570
+ display: "flex",
571
+ alignItems: "center",
572
+ gap: "8px",
573
+ fontSize: "13px",
574
+ cursor: "pointer"
575
+ },
576
+ exportActions: {
577
+ display: "flex",
578
+ flexDirection: "column",
579
+ gap: "8px",
580
+ marginTop: "20px"
581
+ },
582
+ primaryButton: {
583
+ padding: "10px 16px",
584
+ borderRadius: "6px",
585
+ border: "none",
586
+ backgroundColor: "#3b82f6",
587
+ color: "#fff",
588
+ fontWeight: 500,
589
+ cursor: "pointer"
590
+ },
591
+ secondaryButton: {
592
+ padding: "10px 16px",
593
+ borderRadius: "6px",
594
+ border: "1px solid #d1d5db",
595
+ backgroundColor: "#fff",
596
+ fontWeight: 500,
597
+ cursor: "pointer"
598
+ },
599
+ selectionPanel: {
600
+ flex: 1,
601
+ padding: "16px",
602
+ display: "flex",
603
+ flexDirection: "column"
604
+ },
605
+ selectionHeader: {
606
+ display: "flex",
607
+ gap: "12px",
608
+ marginBottom: "12px"
609
+ },
610
+ searchInput: {
611
+ flex: 1,
612
+ padding: "8px 12px",
613
+ borderRadius: "6px",
614
+ border: "1px solid #d1d5db",
615
+ fontSize: "13px"
616
+ },
617
+ categorySelect: {
618
+ padding: "8px 12px",
619
+ borderRadius: "6px",
620
+ border: "1px solid #d1d5db",
621
+ fontSize: "13px",
622
+ backgroundColor: "#fff"
623
+ },
624
+ selectionActions: {
625
+ display: "flex",
626
+ gap: "8px",
627
+ marginBottom: "12px"
628
+ },
629
+ smallButton: {
630
+ padding: "6px 12px",
631
+ borderRadius: "4px",
632
+ border: "1px solid #d1d5db",
633
+ backgroundColor: "#fff",
634
+ fontSize: "12px",
635
+ cursor: "pointer"
636
+ },
637
+ iconGrid: {
638
+ display: "grid",
639
+ gridTemplateColumns: "repeat(auto-fill, minmax(100px, 1fr))",
640
+ gap: "8px",
641
+ overflowY: "auto",
642
+ flex: 1
643
+ },
644
+ iconItem: {
645
+ display: "flex",
646
+ flexDirection: "column",
647
+ alignItems: "center",
648
+ gap: "6px",
649
+ padding: "12px 8px",
650
+ borderRadius: "6px",
651
+ border: "2px solid",
652
+ cursor: "pointer",
653
+ transition: "all 0.15s ease",
654
+ position: "relative"
655
+ },
656
+ iconName: {
657
+ fontSize: "11px",
658
+ color: "#6b7280",
659
+ textAlign: "center",
660
+ wordBreak: "break-word"
661
+ },
662
+ checkmark: {
663
+ position: "absolute",
664
+ top: "4px",
665
+ right: "4px",
666
+ width: "18px",
667
+ height: "18px",
668
+ borderRadius: "50%",
669
+ backgroundColor: "#3b82f6",
670
+ color: "#fff",
671
+ fontSize: "11px",
672
+ display: "flex",
673
+ alignItems: "center",
674
+ justifyContent: "center"
675
+ },
676
+ previewPanel: {
677
+ width: "350px",
678
+ padding: "16px",
679
+ borderLeft: "1px solid #e5e7eb",
680
+ backgroundColor: "#f9fafb",
681
+ overflowY: "auto"
682
+ },
683
+ filePreview: {
684
+ marginBottom: "16px"
685
+ },
686
+ fileName: {
687
+ fontSize: "12px",
688
+ fontWeight: 600,
689
+ color: "#374151",
690
+ marginBottom: "6px",
691
+ fontFamily: "monospace"
692
+ },
693
+ codePreview: {
694
+ padding: "12px",
695
+ borderRadius: "6px",
696
+ backgroundColor: "#1e1e1e",
697
+ color: "#d4d4d4",
698
+ fontSize: "11px",
699
+ overflow: "auto",
700
+ maxHeight: "200px",
701
+ fontFamily: "monospace",
702
+ whiteSpace: "pre-wrap",
703
+ margin: 0
704
+ }
705
+ };
706
+ export {
707
+ NiceIconSetCreator,
708
+ useIconSetCreator
573
709
  };
574
-
575
- export { NiceIconSetCreator, useIconSetCreator };