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