@nice2dev/icons 1.3.14 → 1.3.16

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 (142) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/cjs/NiceDesktopIconExporter.js +688 -599
  3. package/dist/cjs/NiceFaviconGenerator.js +603 -417
  4. package/dist/cjs/NiceIconPicker.js +788 -508
  5. package/dist/cjs/NiceIconPreview.js +246 -188
  6. package/dist/cjs/NiceIconSetCreator.js +683 -552
  7. package/dist/cjs/NiceIconStacker.js +547 -171
  8. package/dist/cjs/NiceIconValue.js +27 -35
  9. package/dist/cjs/NtdIconBadge.js +384 -360
  10. package/dist/cjs/NtdIconMorph.js +419 -354
  11. package/dist/cjs/NtdStateMorph.js +150 -147
  12. package/dist/cjs/advancedIconSearch.js +373 -510
  13. package/dist/cjs/animationControls.js +518 -642
  14. package/dist/cjs/client.js +12 -15
  15. package/dist/cjs/createIcon.js +349 -251
  16. package/dist/cjs/design-tokens.js +324 -390
  17. package/dist/cjs/figmaExport.js +162 -257
  18. package/dist/cjs/figmaSync.js +234 -316
  19. package/dist/cjs/headless-ui.js +240 -368
  20. package/dist/cjs/iconAnalytics.js +337 -393
  21. package/dist/cjs/iconHtml.js +64 -86
  22. package/dist/cjs/iconMetadata.js +392 -472
  23. package/dist/cjs/iconParts.js +120 -90
  24. package/dist/cjs/iconStack.js +136 -155
  25. package/dist/cjs/iconStyles.js +1609 -504
  26. package/dist/cjs/iconValue.js +359 -430
  27. package/dist/cjs/icons/accessibility.js +1119 -134
  28. package/dist/cjs/icons/actions.js +1290 -330
  29. package/dist/cjs/icons/ai.js +1424 -144
  30. package/dist/cjs/icons/brand.js +1344 -172
  31. package/dist/cjs/icons/business.js +903 -193
  32. package/dist/cjs/icons/devtech.js +1656 -227
  33. package/dist/cjs/icons/ecommerce.js +802 -111
  34. package/dist/cjs/icons/education.js +1345 -199
  35. package/dist/cjs/icons/files.js +1597 -328
  36. package/dist/cjs/icons/fintech.js +793 -104
  37. package/dist/cjs/icons/food.js +1507 -153
  38. package/dist/cjs/icons/fun.js +786 -109
  39. package/dist/cjs/icons/gaming.js +916 -170
  40. package/dist/cjs/icons/health.js +623 -112
  41. package/dist/cjs/icons/index.js +34 -35
  42. package/dist/cjs/icons/input.js +282 -83
  43. package/dist/cjs/icons/legal.js +1065 -122
  44. package/dist/cjs/icons/media.js +1061 -267
  45. package/dist/cjs/icons/navigation.js +387 -122
  46. package/dist/cjs/icons/omniverk.js +747 -90
  47. package/dist/cjs/icons/realestate.js +1520 -193
  48. package/dist/cjs/icons/saas.js +867 -98
  49. package/dist/cjs/icons/science.js +1465 -165
  50. package/dist/cjs/icons/shapes.js +1316 -308
  51. package/dist/cjs/icons/smarthome.js +786 -90
  52. package/dist/cjs/icons/social.js +591 -59
  53. package/dist/cjs/icons/sports.js +1225 -133
  54. package/dist/cjs/icons/sustainability.js +1211 -139
  55. package/dist/cjs/icons/travel.js +1470 -148
  56. package/dist/cjs/icons/ui.js +1508 -315
  57. package/dist/cjs/icons/weather.js +1160 -173
  58. package/dist/cjs/index.js +566 -566
  59. package/dist/cjs/lottieIntegration.js +261 -266
  60. package/dist/cjs/nicetodev-icons.css +1 -1
  61. package/dist/cjs/particleEffects.js +270 -251
  62. package/dist/cjs/resolver.js +229 -284
  63. package/dist/cjs/rsc.js +175 -193
  64. package/dist/cjs/sharpen.js +73 -130
  65. package/dist/cjs/smilAnimations.js +371 -165
  66. package/dist/cjs/stacking.js +87 -122
  67. package/dist/cjs/tailwind-plugin.js +280 -320
  68. package/dist/cjs/types.js +46 -72
  69. package/dist/cjs/utilities.js +163 -324
  70. package/dist/cjs/variantProps.js +12 -52
  71. package/dist/esm/NiceDesktopIconExporter.js +671 -598
  72. package/dist/esm/NiceFaviconGenerator.js +583 -416
  73. package/dist/esm/NiceIconPicker.js +789 -507
  74. package/dist/esm/NiceIconPreview.js +247 -187
  75. package/dist/esm/NiceIconSetCreator.js +685 -551
  76. package/dist/esm/NiceIconStacker.js +549 -170
  77. package/dist/esm/NiceIconValue.js +29 -34
  78. package/dist/esm/NtdIconBadge.js +388 -359
  79. package/dist/esm/NtdIconMorph.js +423 -353
  80. package/dist/esm/NtdStateMorph.js +152 -146
  81. package/dist/esm/advancedIconSearch.js +391 -509
  82. package/dist/esm/animationControls.js +527 -641
  83. package/dist/esm/client.js +48 -10
  84. package/dist/esm/createIcon.js +350 -250
  85. package/dist/esm/design-tokens.js +334 -387
  86. package/dist/esm/figmaExport.js +170 -256
  87. package/dist/esm/figmaSync.js +237 -315
  88. package/dist/esm/headless-ui.js +254 -365
  89. package/dist/esm/iconAnalytics.js +342 -392
  90. package/dist/esm/iconHtml.js +67 -85
  91. package/dist/esm/iconMetadata.js +404 -471
  92. package/dist/esm/iconParts.js +125 -89
  93. package/dist/esm/iconStack.js +145 -154
  94. package/dist/esm/iconStyles.js +1620 -503
  95. package/dist/esm/iconValue.js +361 -429
  96. package/dist/esm/icons/accessibility.js +1133 -133
  97. package/dist/esm/icons/actions.js +1320 -329
  98. package/dist/esm/icons/ai.js +1441 -143
  99. package/dist/esm/icons/brand.js +1351 -171
  100. package/dist/esm/icons/business.js +931 -201
  101. package/dist/esm/icons/devtech.js +1687 -226
  102. package/dist/esm/icons/ecommerce.js +816 -110
  103. package/dist/esm/icons/education.js +1364 -198
  104. package/dist/esm/icons/files.js +1628 -327
  105. package/dist/esm/icons/fintech.js +807 -103
  106. package/dist/esm/icons/food.js +1524 -152
  107. package/dist/esm/icons/fun.js +801 -108
  108. package/dist/esm/icons/gaming.js +933 -169
  109. package/dist/esm/icons/health.js +636 -111
  110. package/dist/esm/icons/index.js +596 -32
  111. package/dist/esm/icons/input.js +326 -82
  112. package/dist/esm/icons/legal.js +1079 -121
  113. package/dist/esm/icons/media.js +1086 -266
  114. package/dist/esm/icons/navigation.js +401 -121
  115. package/dist/esm/icons/omniverk.js +759 -89
  116. package/dist/esm/icons/realestate.js +1544 -198
  117. package/dist/esm/icons/saas.js +880 -97
  118. package/dist/esm/icons/science.js +1482 -164
  119. package/dist/esm/icons/shapes.js +1343 -307
  120. package/dist/esm/icons/smarthome.js +799 -89
  121. package/dist/esm/icons/social.js +599 -58
  122. package/dist/esm/icons/sports.js +1240 -132
  123. package/dist/esm/icons/sustainability.js +1226 -138
  124. package/dist/esm/icons/travel.js +1486 -147
  125. package/dist/esm/icons/ui.js +1540 -314
  126. package/dist/esm/icons/weather.js +1181 -172
  127. package/dist/esm/index.js +756 -58
  128. package/dist/esm/lottieIntegration.js +264 -265
  129. package/dist/esm/nicetodev-icons.css +1 -1
  130. package/dist/esm/particleEffects.js +271 -250
  131. package/dist/esm/resolver.js +231 -283
  132. package/dist/esm/rsc.js +182 -192
  133. package/dist/esm/sharpen.js +78 -129
  134. package/dist/esm/smilAnimations.js +376 -164
  135. package/dist/esm/stacking.js +99 -121
  136. package/dist/esm/tailwind-plugin.js +282 -319
  137. package/dist/esm/types.js +50 -71
  138. package/dist/esm/utilities.js +177 -321
  139. package/dist/esm/variantProps.js +23 -52
  140. package/dist/types/icons/index.d.ts +1 -1
  141. package/dist/types/icons/science.d.ts +9 -0
  142. package/package.json +15 -22
@@ -1,215 +1,591 @@
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
- var navigation = require('./icons/navigation.js');
8
- var iconStack = require('./iconStack.js');
9
- var stacking = require('./stacking.js');
10
-
11
- /** Where a layer can sit, laid out on the 5 × 5 pad as it sits in its parent. */
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");
7
+ const navigation = require("./icons/navigation.js");
8
+ const iconStack = require("./iconStack.js");
9
+ const stacking = require("./stacking.js");
10
+ ;/* empty css */
12
11
  const PAD = [
13
- { align: 'top-left', row: 1, col: 1 },
14
- { align: 'top', row: 1, col: 3 },
15
- { align: 'top-right', row: 1, col: 5 },
16
- { align: 'half-top-left', row: 2, col: 2 },
17
- { align: 'half-top', row: 2, col: 3 },
18
- { align: 'half-top-right', row: 2, col: 4 },
19
- { align: 'left', row: 3, col: 1 },
20
- { align: 'half-left', row: 3, col: 2 },
21
- { align: 'center', row: 3, col: 3 },
22
- { align: 'half-right', row: 3, col: 4 },
23
- { align: 'right', row: 3, col: 5 },
24
- { align: 'half-bottom-left', row: 4, col: 2 },
25
- { align: 'half-bottom', row: 4, col: 3 },
26
- { align: 'half-bottom-right', row: 4, col: 4 },
27
- { align: 'bottom-left', row: 5, col: 1 },
28
- { align: 'bottom', row: 5, col: 3 },
29
- { align: 'bottom-right', row: 5, col: 5 },
12
+ { align: "top-left", row: 1, col: 1 },
13
+ { align: "top", row: 1, col: 3 },
14
+ { align: "top-right", row: 1, col: 5 },
15
+ { align: "half-top-left", row: 2, col: 2 },
16
+ { align: "half-top", row: 2, col: 3 },
17
+ { align: "half-top-right", row: 2, col: 4 },
18
+ { align: "left", row: 3, col: 1 },
19
+ { align: "half-left", row: 3, col: 2 },
20
+ { align: "center", row: 3, col: 3 },
21
+ { align: "half-right", row: 3, col: 4 },
22
+ { align: "right", row: 3, col: 5 },
23
+ { align: "half-bottom-left", row: 4, col: 2 },
24
+ { align: "half-bottom", row: 4, col: 3 },
25
+ { align: "half-bottom-right", row: 4, col: 4 },
26
+ { align: "bottom-left", row: 5, col: 1 },
27
+ { align: "bottom", row: 5, col: 3 },
28
+ { align: "bottom-right", row: 5, col: 5 }
30
29
  ];
31
- /** The positions' names, in words. */
32
30
  function alignNames(t) {
33
- return {
34
- perfect: t('iconStacker.align.perfect', 'Auto'),
35
- center: t('iconStacker.align.center', 'Centre'),
36
- top: t('iconStacker.align.top', 'Top edge'),
37
- bottom: t('iconStacker.align.bottom', 'Bottom edge'),
38
- left: t('iconStacker.align.left', 'Left edge'),
39
- right: t('iconStacker.align.right', 'Right edge'),
40
- 'top-left': t('iconStacker.align.top-left', 'Top-left corner'),
41
- 'top-right': t('iconStacker.align.top-right', 'Top-right corner'),
42
- 'bottom-left': t('iconStacker.align.bottom-left', 'Bottom-left corner'),
43
- 'bottom-right': t('iconStacker.align.bottom-right', 'Bottom-right corner'),
44
- 'half-top': t('iconStacker.align.half-top', 'Halfway to the top'),
45
- 'half-bottom': t('iconStacker.align.half-bottom', 'Halfway to the bottom'),
46
- 'half-left': t('iconStacker.align.half-left', 'Halfway to the left'),
47
- 'half-right': t('iconStacker.align.half-right', 'Halfway to the right'),
48
- 'half-top-left': t('iconStacker.align.half-top-left', 'Halfway to the top-left corner'),
49
- 'half-top-right': t('iconStacker.align.half-top-right', 'Halfway to the top-right corner'),
50
- 'half-bottom-left': t('iconStacker.align.half-bottom-left', 'Halfway to the bottom-left corner'),
51
- 'half-bottom-right': t('iconStacker.align.half-bottom-right', 'Halfway to the bottom-right corner'),
52
- };
31
+ return {
32
+ perfect: t("iconStacker.align.perfect", "Auto"),
33
+ center: t("iconStacker.align.center", "Centre"),
34
+ top: t("iconStacker.align.top", "Top edge"),
35
+ bottom: t("iconStacker.align.bottom", "Bottom edge"),
36
+ left: t("iconStacker.align.left", "Left edge"),
37
+ right: t("iconStacker.align.right", "Right edge"),
38
+ "top-left": t("iconStacker.align.top-left", "Top-left corner"),
39
+ "top-right": t("iconStacker.align.top-right", "Top-right corner"),
40
+ "bottom-left": t("iconStacker.align.bottom-left", "Bottom-left corner"),
41
+ "bottom-right": t("iconStacker.align.bottom-right", "Bottom-right corner"),
42
+ "half-top": t("iconStacker.align.half-top", "Halfway to the top"),
43
+ "half-bottom": t("iconStacker.align.half-bottom", "Halfway to the bottom"),
44
+ "half-left": t("iconStacker.align.half-left", "Halfway to the left"),
45
+ "half-right": t("iconStacker.align.half-right", "Halfway to the right"),
46
+ "half-top-left": t("iconStacker.align.half-top-left", "Halfway to the top-left corner"),
47
+ "half-top-right": t("iconStacker.align.half-top-right", "Halfway to the top-right corner"),
48
+ "half-bottom-left": t(
49
+ "iconStacker.align.half-bottom-left",
50
+ "Halfway to the bottom-left corner"
51
+ ),
52
+ "half-bottom-right": t(
53
+ "iconStacker.align.half-bottom-right",
54
+ "Halfway to the bottom-right corner"
55
+ )
56
+ };
53
57
  }
54
58
  const STAGE_SIZE = 64;
55
59
  const STAGE_SMALL = [32, 24, 16];
56
60
  const NO_LAYERS = [];
57
- /** What a colour field shows while the colour is unset (follows the parent). */
58
- const AUTO_SWATCH = '#808080';
59
- /** The layers in tree order (each followed by what sits in it), with their depth. */
61
+ const AUTO_SWATCH = "#808080";
60
62
  function walk(layers) {
61
- const out = [];
62
- const visit = (layer, depth) => {
63
- out.push({ layer, depth });
64
- for (const child of iconStack.stackChildrenOf(layers, layer.id)) {
65
- visit(child, depth + 1);
66
- }
67
- };
68
- if (layers[0]) {
69
- visit(layers[0], 0);
63
+ const out = [];
64
+ const visit = (layer, depth) => {
65
+ out.push({ layer, depth });
66
+ for (const child of iconStack.stackChildrenOf(layers, layer.id)) {
67
+ visit(child, depth + 1);
70
68
  }
71
- return out;
69
+ };
70
+ if (layers[0]) {
71
+ visit(layers[0], 0);
72
+ }
73
+ return out;
72
74
  }
73
- /** A colour of the layer's own, or "auto" — following its parent — until one is picked. */
74
75
  function Swatch({ label, value, onChange, autoLabel, resetLabel }) {
75
- return (jsxRuntime.jsxs("span", { className: "nice-icon-stacker__swatch", children: [jsxRuntime.jsxs("label", { className: `nice-icon-stacker__swatch-pick${value ? '' : ' nice-icon-stacker__swatch-pick--auto'}`, title: `${label}: ${value !== null && value !== void 0 ? value : autoLabel}`, children: [jsxRuntime.jsx("span", { className: "nice-icon-stacker__swatch-dot", style: value ? { background: value } : undefined }), jsxRuntime.jsx("span", { children: label }), jsxRuntime.jsx("input", { type: "color", value: value !== null && value !== void 0 ? value : AUTO_SWATCH, onChange: (e) => onChange(e.target.value) })] }), value && (jsxRuntime.jsx("button", { type: "button", className: "nice-icon-stacker__reset", onClick: () => onChange(undefined), "aria-label": `${resetLabel}: ${label}`, title: resetLabel, children: jsxRuntime.jsx(navigation.NtdClose, { size: 10 }) }))] }));
76
+ return /* @__PURE__ */ jsxRuntime.jsxs("span", { className: "nice-icon-stacker__swatch", children: [
77
+ /* @__PURE__ */ jsxRuntime.jsxs(
78
+ "label",
79
+ {
80
+ className: `nice-icon-stacker__swatch-pick${value ? "" : " nice-icon-stacker__swatch-pick--auto"}`,
81
+ title: `${label}: ${value ?? autoLabel}`,
82
+ children: [
83
+ /* @__PURE__ */ jsxRuntime.jsx(
84
+ "span",
85
+ {
86
+ className: "nice-icon-stacker__swatch-dot",
87
+ style: value ? { background: value } : void 0
88
+ }
89
+ ),
90
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: label }),
91
+ /* @__PURE__ */ jsxRuntime.jsx(
92
+ "input",
93
+ {
94
+ type: "color",
95
+ value: value ?? AUTO_SWATCH,
96
+ onChange: (e) => onChange(e.target.value)
97
+ }
98
+ )
99
+ ]
100
+ }
101
+ ),
102
+ value && /* @__PURE__ */ jsxRuntime.jsx(
103
+ "button",
104
+ {
105
+ type: "button",
106
+ className: "nice-icon-stacker__reset",
107
+ onClick: () => onChange(void 0),
108
+ "aria-label": `${resetLabel}: ${label}`,
109
+ title: resetLabel,
110
+ children: /* @__PURE__ */ jsxRuntime.jsx(navigation.NtdClose, { size: 10 })
111
+ }
112
+ )
113
+ ] });
76
114
  }
77
- /**
78
- * NiceIconStacker (1.3.5) — builds an icon stack: the base icon and the icons stacked in it, nested
79
- * any number of levels deep (1.3.6) with text innermost. Since 1.3.9 it is laid out to fit a picker's
80
- * panel: the stack drawn large and small, the layers as a list, and under it the selected layer —
81
- * where it sits (picked on a pad shaped like its parent), its size and text, with the turn, nudge,
82
- * colours and binding folded under "More". A new icon goes into the selected layer and is selected,
83
- * so adding again goes one level deeper; select an outer layer to add side by side. The JSX that
84
- * draws the stack is folded at the end. `NiceIconStack` draws a stack built here from data.
85
- */
86
- const NiceIconStacker = React.forwardRef(function NiceIconStacker({ icons, layers: layersProp, defaultLayers, onLayersChange, current, onAddClick, previewProps, iconLabel = iconStack.iconDisplayName, showCode = true, keepBase = false, className, }, ref) {
87
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p;
115
+ const NiceIconStacker = React.forwardRef(
116
+ function NiceIconStacker2({
117
+ icons,
118
+ layers: layersProp,
119
+ defaultLayers,
120
+ onLayersChange,
121
+ current,
122
+ onAddClick,
123
+ previewProps,
124
+ iconLabel = iconStack.iconDisplayName,
125
+ showCode = true,
126
+ keepBase = false,
127
+ className
128
+ }, ref) {
88
129
  const { t } = uiCore.useNiceTranslation();
89
130
  const [layers, setLayers] = uiCore.useControllableState({
90
- value: layersProp,
91
- defaultValue: defaultLayers,
92
- fallbackValue: NO_LAYERS,
93
- onChange: onLayersChange,
94
- componentName: 'NiceIconStacker',
131
+ value: layersProp,
132
+ defaultValue: defaultLayers,
133
+ fallbackValue: NO_LAYERS,
134
+ onChange: onLayersChange,
135
+ componentName: "NiceIconStacker"
95
136
  });
96
137
  const [copied, setCopied] = React.useState(false);
97
- // The layer being edited, which the next icon goes into — the newest by default, so adding nests deeper.
98
- const [selected, setSelected] = React.useState(undefined);
138
+ const [selected, setSelected] = React.useState(void 0);
99
139
  const base = layers[0];
100
- const target = (_b = (_a = layers.find((l) => l.id === selected)) !== null && _a !== void 0 ? _a : layers[layers.length - 1]) !== null && _b !== void 0 ? _b : undefined;
140
+ const target = layers.find((l) => l.id === selected) ?? layers[layers.length - 1] ?? void 0;
101
141
  const listRef = React.useRef(null);
102
142
  uiCore.useRovingFocus(listRef, {
103
- orientation: 'vertical',
104
- itemSelector: '.nice-icon-stacker__layer-select',
143
+ orientation: "vertical",
144
+ itemSelector: ".nice-icon-stacker__layer-select"
105
145
  });
106
146
  const padRef = React.useRef(null);
107
147
  uiCore.useRovingFocus(padRef, {
108
- orientation: 'grid',
109
- itemSelector: '[role="radio"]',
110
- activateOnMove: true,
148
+ orientation: "grid",
149
+ itemSelector: '[role="radio"]',
150
+ activateOnMove: true
111
151
  });
112
- const resolve = React.useCallback((name) => (typeof icons === 'function' ? icons(name) : icons[name]), [icons]);
152
+ const resolve = React.useCallback(
153
+ (name) => typeof icons === "function" ? icons(name) : icons[name],
154
+ [icons]
155
+ );
113
156
  const tree = React.useMemo(() => walk(layers), [layers]);
114
- const code = React.useMemo(() => (showCode ? iconStack.niceIconStackCode(layers) : ''), [layers, showCode]);
115
- const update = (id, patch) => setLayers((prev) => prev.map((l) => (l.id === id ? { ...l, ...patch } : l)));
157
+ const code = React.useMemo(() => showCode ? iconStack.niceIconStackCode(layers) : "", [layers, showCode]);
158
+ const update = (id, patch) => setLayers((prev) => prev.map((l) => l.id === id ? { ...l, ...patch } : l));
116
159
  const add = (icon = current) => {
117
- if (!icon) {
118
- return;
119
- }
120
- let added = '';
121
- setLayers((prev) => {
122
- var _a;
123
- const next = iconStack.addStackLayer(prev, icon, (_a = prev.find((l) => l.id === (target === null || target === void 0 ? void 0 : target.id))) === null || _a === void 0 ? void 0 : _a.id);
124
- added = next.id;
125
- return next.layers;
126
- });
127
- setSelected(added);
160
+ if (!icon) {
161
+ return;
162
+ }
163
+ let added = "";
164
+ setLayers((prev) => {
165
+ const next = iconStack.addStackLayer(prev, icon, prev.find((l) => l.id === target?.id)?.id);
166
+ added = next.id;
167
+ return next.layers;
168
+ });
169
+ setSelected(added);
128
170
  };
129
171
  const remove = (id) => {
130
- setLayers((prev) => iconStack.removeStackLayer(prev, id));
131
- if (selected === id) {
132
- setSelected(undefined);
133
- }
172
+ setLayers((prev) => iconStack.removeStackLayer(prev, id));
173
+ if (selected === id) {
174
+ setSelected(void 0);
175
+ }
134
176
  };
135
177
  const clear = () => {
136
- setLayers((prev) => (keepBase && prev[0] ? [prev[0]] : NO_LAYERS));
137
- setSelected(undefined);
178
+ setLayers((prev) => keepBase && prev[0] ? [prev[0]] : NO_LAYERS);
179
+ setSelected(void 0);
138
180
  };
139
181
  React.useImperativeHandle(ref, () => ({ add, clear }));
140
182
  const copy = () => {
141
- var _a;
142
- void ((_a = navigator.clipboard) === null || _a === void 0 ? void 0 : _a.writeText(code).then(() => {
143
- setCopied(true);
144
- window.setTimeout(() => setCopied(false), 1500);
145
- }));
183
+ void navigator.clipboard?.writeText(code).then(() => {
184
+ setCopied(true);
185
+ window.setTimeout(() => setCopied(false), 1500);
186
+ });
146
187
  };
147
- const autoLabel = t('iconStacker.auto', 'auto');
148
- const resetLabel = t('iconStacker.reset', 'Back to auto');
188
+ const autoLabel = t("iconStacker.auto", "auto");
189
+ const resetLabel = t("iconStacker.reset", "Back to auto");
149
190
  const names = alignNames(t);
150
191
  const alignName = (a) => names[a];
151
- const currentName = current ? iconLabel(current.icon) : '';
152
- const targetName = target ? iconLabel(target.icon) : '';
192
+ const currentName = current ? iconLabel(current.icon) : "";
193
+ const targetName = target ? iconLabel(target.icon) : "";
153
194
  const asks = !!onAddClick || !current;
154
- const addText = asks
155
- ? t('iconStacker.addIcon', 'Add an icon')
156
- : t('iconStacker.addShort', 'Add {icon}').replace('{icon}', currentName);
157
- const addLabel = asks
158
- ? base && target
159
- ? t('iconStacker.addIconInto', 'Add an icon into {target}').replace('{target}', targetName)
160
- : addText
161
- : base && target
162
- ? t('iconStacker.addInto', 'Add {icon} into {target}')
163
- .replace('{icon}', currentName)
164
- .replace('{target}', targetName)
165
- : t('iconStacker.add', 'Add {icon} to the stack').replace('{icon}', currentName);
166
- const clearLabel = keepBase
167
- ? t('iconStacker.clearOverlays', 'Take off the stacked icons')
168
- : t('iconStacker.clear', 'Clear the stack');
169
- // the selected layer, as the inspector edits it
195
+ const addText = asks ? t("iconStacker.addIcon", "Add an icon") : t("iconStacker.addShort", "Add {icon}").replace("{icon}", currentName);
196
+ const addLabel = asks ? base && target ? t("iconStacker.addIconInto", "Add an icon into {target}").replace("{target}", targetName) : addText : base && target ? t("iconStacker.addInto", "Add {icon} into {target}").replace("{icon}", currentName).replace("{target}", targetName) : t("iconStacker.add", "Add {icon} to the stack").replace("{icon}", currentName);
197
+ const clearLabel = keepBase ? t("iconStacker.clearOverlays", "Take off the stacked icons") : t("iconStacker.clear", "Clear the stack");
170
198
  const edited = target;
171
- const editedIcon = edited ? resolve(edited.icon) : undefined;
199
+ const editedIcon = edited ? resolve(edited.icon) : void 0;
172
200
  const editedIsBase = !!edited && edited === base;
173
- const align = (_c = edited === null || edited === void 0 ? void 0 : edited.align) !== null && _c !== void 0 ? _c : 'perfect';
174
- // the spot the parent keeps for stacked icons (1.3.8): its size and turn are the layer's
175
- // defaults while it sits there
176
- const parentId = edited ? iconStack.stackParentId(layers, edited) : undefined;
177
- const parentLayer = parentId ? layers.find((p) => p.id === parentId) : undefined;
178
- const spot = (parentLayer && stacking.perfectStackOf(resolve(parentLayer.icon))) || stacking.BOX_PERFECT_STACK;
179
- const atSpot = align === 'perfect';
180
- const share = (_d = edited === null || edited === void 0 ? void 0 : edited.size) !== null && _d !== void 0 ? _d : (atSpot ? spot.size : stacking.defaultStackSize(align));
201
+ const align = edited?.align ?? "perfect";
202
+ const parentId = edited ? iconStack.stackParentId(layers, edited) : void 0;
203
+ const parentLayer = parentId ? layers.find((p) => p.id === parentId) : void 0;
204
+ const spot = parentLayer && stacking.perfectStackOf(resolve(parentLayer.icon)) || stacking.BOX_PERFECT_STACK;
205
+ const atSpot = align === "perfect";
206
+ const share = edited?.size ?? (atSpot ? spot.size : stacking.defaultStackSize(align));
181
207
  const turnDefault = atSpot ? spot.rotation : 0;
182
- const turn = (_e = edited === null || edited === void 0 ? void 0 : edited.rotation) !== null && _e !== void 0 ? _e : turnDefault;
208
+ const turn = edited?.rotation ?? turnDefault;
183
209
  const innermost = !!edited && iconStack.stackChildrenOf(layers, edited.id).length === 0;
184
210
  const hasText = !!edited && (innermost || !!edited.text || !!edited.textBinding);
185
- const textSize = (_f = edited === null || edited === void 0 ? void 0 : edited.textSize) !== null && _f !== void 0 ? _f : stacking.defaultTextSize(((_g = edited === null || edited === void 0 ? void 0 : edited.text) !== null && _g !== void 0 ? _g : '').length || 1, (_h = stacking.perfectStackOf(editedIcon)) === null || _h === void 0 ? void 0 : _h.size);
186
- const bindingInvalid = !!(edited === null || edited === void 0 ? void 0 : edited.textBinding) && !iconStack.isValidTextBinding(edited.textBinding);
187
- return (jsxRuntime.jsxs("div", { className: ['nice-icon-stacker', className].filter(Boolean).join(' '), children: [jsxRuntime.jsxs("div", { className: "nice-icon-stacker__bar", children: [jsxRuntime.jsx("span", { className: "nice-icon-stacker__title", children: t('iconStacker.layers', 'Layers') }), jsxRuntime.jsxs("button", { type: "button", className: "nice-icon-stacker__add", onClick: () => (onAddClick ? onAddClick(target) : add()), disabled: !onAddClick && !current, "aria-label": addLabel, title: addLabel, children: [jsxRuntime.jsx(actions.NtdPlus, { size: 14 }), " ", addText] }), jsxRuntime.jsx("button", { type: "button", className: "nice-icon-stacker__clear", onClick: clear, disabled: keepBase ? layers.length < 2 : layers.length === 0, "aria-label": clearLabel, title: clearLabel, children: jsxRuntime.jsx(actions.NtdTrash, { size: 14 }) })] }), !base || !edited ? (jsxRuntime.jsx("p", { className: "nice-icon-stacker__empty", children: t('iconStacker.empty', 'The stack is empty. Add an icon to start one.') })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { className: "nice-icon-stacker__top", children: [jsxRuntime.jsxs("div", { className: "nice-icon-stacker__preview", "aria-label": t('iconStacker.preview', 'Preview'), role: "group", children: [jsxRuntime.jsx("span", { className: "nice-icon-stacker__preview-main", title: `${STAGE_SIZE}px`, children: iconStack.renderIconStack(layers, icons, {
188
- baseProps: { ...previewProps, size: STAGE_SIZE, title: iconLabel(base.icon) },
189
- }) }), jsxRuntime.jsx("span", { className: "nice-icon-stacker__preview-small", children: STAGE_SMALL.map((s) => (jsxRuntime.jsx("span", { title: `${s}px`, children: iconStack.renderIconStack(layers, icons, { baseProps: { ...previewProps, size: s } }) }, s))) })] }), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__layers-wrap", children: [jsxRuntime.jsx("ol", { ref: listRef, className: "nice-icon-stacker__layers", "aria-label": t('iconStacker.layers', 'Layers'), children: tree.map(({ layer: l, depth }) => {
190
- const Icon = resolve(l.icon);
191
- const isBase = l === base;
192
- const isSelected = l === edited;
193
- const name = iconLabel(l.icon);
194
- const removable = !(isBase && keepBase);
195
- const removeLabel = t('iconStacker.remove', 'Remove {icon}').replace('{icon}', name);
196
- return (jsxRuntime.jsxs("li", { className: `nice-icon-stacker__layer${isSelected ? ' nice-icon-stacker__layer--selected' : ''}`, style: { ['--nice-icon-stacker-depth']: String(depth) }, children: [jsxRuntime.jsxs("button", { type: "button", className: "nice-icon-stacker__layer-select", "aria-pressed": isSelected, onClick: () => setSelected(l.id), onKeyDown: (e) => {
197
- if (removable && (e.key === 'Delete' || e.key === 'Backspace')) {
198
- e.preventDefault();
199
- remove(l.id);
200
- }
201
- }, children: [jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-icon", children: Icon ? jsxRuntime.jsx(Icon, { size: 18, variant: l.variant }) : null }), jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-name", children: name }), l.text && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-text", children: l.text })] })), isBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [' ', jsxRuntime.jsx("span", { className: "nice-icon-stacker__badge", children: t('iconStacker.base', 'Base') })] }))] }), removable && (jsxRuntime.jsx("button", { type: "button", className: "nice-icon-stacker__remove", onClick: () => remove(l.id), "aria-label": removeLabel, title: removeLabel, children: jsxRuntime.jsx(navigation.NtdClose, { size: 10 }) }))] }, l.id));
202
- }) }), jsxRuntime.jsx("small", { className: "nice-icon-stacker__hint", children: t('iconStacker.hint', 'A new icon goes into the selected layer.') })] })] }), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__inspector", role: "group", "aria-label": iconLabel(edited.icon), children: [jsxRuntime.jsxs("div", { className: "nice-icon-stacker__inspector-head", children: [editedIcon &&
203
- React.createElement(editedIcon, { size: 16, variant: edited.variant }), jsxRuntime.jsx("span", { children: iconLabel(edited.icon) }), parentLayer && (jsxRuntime.jsx("small", { children: t('iconStacker.inside', 'in {icon}').replace('{icon}', iconLabel(parentLayer.icon)) }))] }), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__inspector-body", children: [!editedIsBase && (jsxRuntime.jsxs("div", { ref: padRef, className: "nice-icon-stacker__pad", role: "radiogroup", "aria-label": t('iconStacker.align', 'Position'), children: [jsxRuntime.jsx("button", { type: "button", role: "radio", "aria-checked": align === 'perfect', className: "nice-icon-stacker__pad-auto", title: t('iconStacker.align.perfectHint', 'The spot the icon keeps for what is stacked in it'), onClick: () => update(edited.id, { align: undefined }), children: alignName('perfect') }), jsxRuntime.jsx("span", { className: "nice-icon-stacker__pad-box", children: PAD.map(({ align: a, row, col }) => (jsxRuntime.jsx("button", { type: "button", role: "radio", "aria-checked": align === a, "aria-label": alignName(a), title: alignName(a), className: "nice-icon-stacker__pad-dot", style: { gridRow: row, gridColumn: col }, onClick: () => update(edited.id, { align: a }) }, a))) })] })), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__fields", children: [!editedIsBase && (jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.size', 'Size') }), jsxRuntime.jsx("input", { type: "range", min: 0.2, max: 1, step: 0.05, value: share, onChange: (e) => update(edited.id, { size: Number(e.target.value) }) }), jsxRuntime.jsxs("output", { children: [Math.round(share * 100), "%"] })] })), hasText && (jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.text', 'Text') }), jsxRuntime.jsx("input", { type: "text", value: (_j = edited.text) !== null && _j !== void 0 ? _j : '', maxLength: 4, onChange: (e) => update(edited.id, { text: e.target.value || undefined }) })] }))] })] }), jsxRuntime.jsxs("details", { className: "nice-icon-stacker__more", children: [jsxRuntime.jsx("summary", { children: t('iconStacker.more', 'More') }), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__more-body", children: [!editedIsBase && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.rotation', 'Turn') }), jsxRuntime.jsx("input", { type: "range", min: -180, max: 180, step: 15, value: turn, onChange: (e) => {
204
- const v = Number(e.target.value);
205
- update(edited.id, { rotation: v === turnDefault ? undefined : v });
206
- } }), jsxRuntime.jsxs("output", { children: [turn, "\u00B0"] })] }), jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.offsetX', 'Shift right') }), jsxRuntime.jsx("input", { type: "range", min: -50, max: 50, step: 1, value: (_k = edited.offsetX) !== null && _k !== void 0 ? _k : 0, onChange: (e) => update(edited.id, { offsetX: Number(e.target.value) || undefined }) }), jsxRuntime.jsxs("output", { children: [(_l = edited.offsetX) !== null && _l !== void 0 ? _l : 0, "%"] })] }), jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.offsetY', 'Shift down') }), jsxRuntime.jsx("input", { type: "range", min: -50, max: 50, step: 1, value: (_m = edited.offsetY) !== null && _m !== void 0 ? _m : 0, onChange: (e) => update(edited.id, { offsetY: Number(e.target.value) || undefined }) }), jsxRuntime.jsxs("output", { children: [(_o = edited.offsetY) !== null && _o !== void 0 ? _o : 0, "%"] })] })] })), jsxRuntime.jsxs("div", { className: "nice-icon-stacker__swatches", children: [jsxRuntime.jsx(Swatch, { label: t('iconStacker.primary', 'Primary'), value: edited.primaryColor, onChange: (v) => update(edited.id, { primaryColor: v }), autoLabel: autoLabel, resetLabel: resetLabel }), jsxRuntime.jsx(Swatch, { label: t('iconStacker.secondary', 'Secondary'), value: edited.secondaryColor, onChange: (v) => update(edited.id, { secondaryColor: v }), autoLabel: autoLabel, resetLabel: resetLabel }), jsxRuntime.jsx(Swatch, { label: t('iconStacker.accent', 'Accent'), value: edited.accentColor, onChange: (v) => update(edited.id, { accentColor: v }), autoLabel: autoLabel, resetLabel: resetLabel }), hasText && (jsxRuntime.jsx(Swatch, { label: t('iconStacker.textColor', 'Text colour'), value: edited.textColor, onChange: (v) => update(edited.id, { textColor: v }), autoLabel: autoLabel, resetLabel: resetLabel }))] }), hasText && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.textSize', 'Text size') }), jsxRuntime.jsx("input", { type: "range", min: 3, max: 14, step: 0.5, value: textSize, onChange: (e) => update(edited.id, { textSize: Number(e.target.value) }) }), jsxRuntime.jsx("output", { children: textSize }), edited.textSize !== undefined && (jsxRuntime.jsx("button", { type: "button", className: "nice-icon-stacker__reset", onClick: () => update(edited.id, { textSize: undefined }), "aria-label": `${resetLabel}: ${t('iconStacker.textSize', 'Text size')}`, title: resetLabel, children: jsxRuntime.jsx(navigation.NtdClose, { size: 10 }) }))] }), jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [jsxRuntime.jsx("span", { children: t('iconStacker.bind', 'Bind to') }), jsxRuntime.jsx("input", { type: "text", value: (_p = edited.textBinding) !== null && _p !== void 0 ? _p : '', "aria-invalid": bindingInvalid || undefined, title: t('iconStacker.bindHint', 'The name of the value the text shows, e.g. count — the text above is a sample'), onChange: (e) => update(edited.id, { textBinding: e.target.value.trim() || undefined }) })] })] }))] })] })] }), showCode && (jsxRuntime.jsxs("details", { className: "nice-icon-stacker__code", children: [jsxRuntime.jsx("summary", { children: t('iconStacker.code', 'JSX code') }), jsxRuntime.jsx("pre", { children: code }), jsxRuntime.jsxs("button", { type: "button", onClick: copy, children: [copied ? jsxRuntime.jsx(actions.NtdCheck, { size: 14 }) : jsxRuntime.jsx(actions.NtdCopy, { size: 14 }), ' ', copied
207
- ? t('iconStacker.copied', 'Copied')
208
- : t('iconStacker.copy', 'Copy the code')] })] }))] }))] }));
209
- });
210
- if (process.env.NODE_ENV !== 'production') {
211
- NiceIconStacker.displayName = 'NiceIconStacker';
211
+ const textSize = edited?.textSize ?? stacking.defaultTextSize((edited?.text ?? "").length || 1, stacking.perfectStackOf(editedIcon)?.size);
212
+ const bindingInvalid = !!edited?.textBinding && !iconStack.isValidTextBinding(edited.textBinding);
213
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: ["nice-icon-stacker", className].filter(Boolean).join(" "), children: [
214
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__bar", children: [
215
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__title", children: t("iconStacker.layers", "Layers") }),
216
+ /* @__PURE__ */ jsxRuntime.jsxs(
217
+ "button",
218
+ {
219
+ type: "button",
220
+ className: "nice-icon-stacker__add",
221
+ onClick: () => onAddClick ? onAddClick(target) : add(),
222
+ disabled: !onAddClick && !current,
223
+ "aria-label": addLabel,
224
+ title: addLabel,
225
+ children: [
226
+ /* @__PURE__ */ jsxRuntime.jsx(actions.NtdPlus, { size: 14 }),
227
+ " ",
228
+ addText
229
+ ]
230
+ }
231
+ ),
232
+ /* @__PURE__ */ jsxRuntime.jsx(
233
+ "button",
234
+ {
235
+ type: "button",
236
+ className: "nice-icon-stacker__clear",
237
+ onClick: clear,
238
+ disabled: keepBase ? layers.length < 2 : layers.length === 0,
239
+ "aria-label": clearLabel,
240
+ title: clearLabel,
241
+ children: /* @__PURE__ */ jsxRuntime.jsx(actions.NtdTrash, { size: 14 })
242
+ }
243
+ )
244
+ ] }),
245
+ !base || !edited ? /* @__PURE__ */ jsxRuntime.jsx("p", { className: "nice-icon-stacker__empty", children: t("iconStacker.empty", "The stack is empty. Add an icon to start one.") }) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
246
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__top", children: [
247
+ /* @__PURE__ */ jsxRuntime.jsxs(
248
+ "div",
249
+ {
250
+ className: "nice-icon-stacker__preview",
251
+ "aria-label": t("iconStacker.preview", "Preview"),
252
+ role: "group",
253
+ children: [
254
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__preview-main", title: `${STAGE_SIZE}px`, children: iconStack.renderIconStack(layers, icons, {
255
+ baseProps: { ...previewProps, size: STAGE_SIZE, title: iconLabel(base.icon) }
256
+ }) }),
257
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__preview-small", children: STAGE_SMALL.map((s) => /* @__PURE__ */ jsxRuntime.jsx("span", { title: `${s}px`, children: iconStack.renderIconStack(layers, icons, { baseProps: { ...previewProps, size: s } }) }, s)) })
258
+ ]
259
+ }
260
+ ),
261
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__layers-wrap", children: [
262
+ /* @__PURE__ */ jsxRuntime.jsx(
263
+ "ol",
264
+ {
265
+ ref: listRef,
266
+ className: "nice-icon-stacker__layers",
267
+ "aria-label": t("iconStacker.layers", "Layers"),
268
+ children: tree.map(({ layer: l, depth }) => {
269
+ const Icon = resolve(l.icon);
270
+ const isBase = l === base;
271
+ const isSelected = l === edited;
272
+ const name = iconLabel(l.icon);
273
+ const removable = !(isBase && keepBase);
274
+ const removeLabel = t("iconStacker.remove", "Remove {icon}").replace(
275
+ "{icon}",
276
+ name
277
+ );
278
+ return /* @__PURE__ */ jsxRuntime.jsxs(
279
+ "li",
280
+ {
281
+ className: `nice-icon-stacker__layer${isSelected ? " nice-icon-stacker__layer--selected" : ""}`,
282
+ style: { ["--nice-icon-stacker-depth"]: String(depth) },
283
+ children: [
284
+ /* @__PURE__ */ jsxRuntime.jsxs(
285
+ "button",
286
+ {
287
+ type: "button",
288
+ className: "nice-icon-stacker__layer-select",
289
+ "aria-pressed": isSelected,
290
+ onClick: () => setSelected(l.id),
291
+ onKeyDown: (e) => {
292
+ if (removable && (e.key === "Delete" || e.key === "Backspace")) {
293
+ e.preventDefault();
294
+ remove(l.id);
295
+ }
296
+ },
297
+ children: [
298
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-icon", children: Icon ? /* @__PURE__ */ jsxRuntime.jsx(Icon, { size: 18, variant: l.variant }) : null }),
299
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-name", children: name }),
300
+ l.text && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
301
+ " ",
302
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__layer-text", children: l.text })
303
+ ] }),
304
+ isBase && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
305
+ " ",
306
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__badge", children: t("iconStacker.base", "Base") })
307
+ ] })
308
+ ]
309
+ }
310
+ ),
311
+ removable && /* @__PURE__ */ jsxRuntime.jsx(
312
+ "button",
313
+ {
314
+ type: "button",
315
+ className: "nice-icon-stacker__remove",
316
+ onClick: () => remove(l.id),
317
+ "aria-label": removeLabel,
318
+ title: removeLabel,
319
+ children: /* @__PURE__ */ jsxRuntime.jsx(navigation.NtdClose, { size: 10 })
320
+ }
321
+ )
322
+ ]
323
+ },
324
+ l.id
325
+ );
326
+ })
327
+ }
328
+ ),
329
+ /* @__PURE__ */ jsxRuntime.jsx("small", { className: "nice-icon-stacker__hint", children: t("iconStacker.hint", "A new icon goes into the selected layer.") })
330
+ ] })
331
+ ] }),
332
+ /* @__PURE__ */ jsxRuntime.jsxs(
333
+ "div",
334
+ {
335
+ className: "nice-icon-stacker__inspector",
336
+ role: "group",
337
+ "aria-label": iconLabel(edited.icon),
338
+ children: [
339
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__inspector-head", children: [
340
+ editedIcon && React.createElement(editedIcon, { size: 16, variant: edited.variant }),
341
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: iconLabel(edited.icon) }),
342
+ parentLayer && /* @__PURE__ */ jsxRuntime.jsx("small", { children: t("iconStacker.inside", "in {icon}").replace(
343
+ "{icon}",
344
+ iconLabel(parentLayer.icon)
345
+ ) })
346
+ ] }),
347
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__inspector-body", children: [
348
+ !editedIsBase && /* @__PURE__ */ jsxRuntime.jsxs(
349
+ "div",
350
+ {
351
+ ref: padRef,
352
+ className: "nice-icon-stacker__pad",
353
+ role: "radiogroup",
354
+ "aria-label": t("iconStacker.align", "Position"),
355
+ children: [
356
+ /* @__PURE__ */ jsxRuntime.jsx(
357
+ "button",
358
+ {
359
+ type: "button",
360
+ role: "radio",
361
+ "aria-checked": align === "perfect",
362
+ className: "nice-icon-stacker__pad-auto",
363
+ title: t(
364
+ "iconStacker.align.perfectHint",
365
+ "The spot the icon keeps for what is stacked in it"
366
+ ),
367
+ onClick: () => update(edited.id, { align: void 0 }),
368
+ children: alignName("perfect")
369
+ }
370
+ ),
371
+ /* @__PURE__ */ jsxRuntime.jsx("span", { className: "nice-icon-stacker__pad-box", children: PAD.map(({ align: a, row, col }) => /* @__PURE__ */ jsxRuntime.jsx(
372
+ "button",
373
+ {
374
+ type: "button",
375
+ role: "radio",
376
+ "aria-checked": align === a,
377
+ "aria-label": alignName(a),
378
+ title: alignName(a),
379
+ className: "nice-icon-stacker__pad-dot",
380
+ style: { gridRow: row, gridColumn: col },
381
+ onClick: () => update(edited.id, { align: a })
382
+ },
383
+ a
384
+ )) })
385
+ ]
386
+ }
387
+ ),
388
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__fields", children: [
389
+ !editedIsBase && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
390
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.size", "Size") }),
391
+ /* @__PURE__ */ jsxRuntime.jsx(
392
+ "input",
393
+ {
394
+ type: "range",
395
+ min: 0.2,
396
+ max: 1,
397
+ step: 0.05,
398
+ value: share,
399
+ onChange: (e) => update(edited.id, { size: Number(e.target.value) })
400
+ }
401
+ ),
402
+ /* @__PURE__ */ jsxRuntime.jsxs("output", { children: [
403
+ Math.round(share * 100),
404
+ "%"
405
+ ] })
406
+ ] }),
407
+ hasText && /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
408
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.text", "Text") }),
409
+ /* @__PURE__ */ jsxRuntime.jsx(
410
+ "input",
411
+ {
412
+ type: "text",
413
+ value: edited.text ?? "",
414
+ maxLength: 4,
415
+ onChange: (e) => update(edited.id, { text: e.target.value || void 0 })
416
+ }
417
+ )
418
+ ] })
419
+ ] })
420
+ ] }),
421
+ /* @__PURE__ */ jsxRuntime.jsxs("details", { className: "nice-icon-stacker__more", children: [
422
+ /* @__PURE__ */ jsxRuntime.jsx("summary", { children: t("iconStacker.more", "More") }),
423
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__more-body", children: [
424
+ !editedIsBase && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
425
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
426
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.rotation", "Turn") }),
427
+ /* @__PURE__ */ jsxRuntime.jsx(
428
+ "input",
429
+ {
430
+ type: "range",
431
+ min: -180,
432
+ max: 180,
433
+ step: 15,
434
+ value: turn,
435
+ onChange: (e) => {
436
+ const v = Number(e.target.value);
437
+ update(edited.id, { rotation: v === turnDefault ? void 0 : v });
438
+ }
439
+ }
440
+ ),
441
+ /* @__PURE__ */ jsxRuntime.jsxs("output", { children: [
442
+ turn,
443
+ "°"
444
+ ] })
445
+ ] }),
446
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
447
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.offsetX", "Shift right") }),
448
+ /* @__PURE__ */ jsxRuntime.jsx(
449
+ "input",
450
+ {
451
+ type: "range",
452
+ min: -50,
453
+ max: 50,
454
+ step: 1,
455
+ value: edited.offsetX ?? 0,
456
+ onChange: (e) => update(edited.id, { offsetX: Number(e.target.value) || void 0 })
457
+ }
458
+ ),
459
+ /* @__PURE__ */ jsxRuntime.jsxs("output", { children: [
460
+ edited.offsetX ?? 0,
461
+ "%"
462
+ ] })
463
+ ] }),
464
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
465
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.offsetY", "Shift down") }),
466
+ /* @__PURE__ */ jsxRuntime.jsx(
467
+ "input",
468
+ {
469
+ type: "range",
470
+ min: -50,
471
+ max: 50,
472
+ step: 1,
473
+ value: edited.offsetY ?? 0,
474
+ onChange: (e) => update(edited.id, { offsetY: Number(e.target.value) || void 0 })
475
+ }
476
+ ),
477
+ /* @__PURE__ */ jsxRuntime.jsxs("output", { children: [
478
+ edited.offsetY ?? 0,
479
+ "%"
480
+ ] })
481
+ ] })
482
+ ] }),
483
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "nice-icon-stacker__swatches", children: [
484
+ /* @__PURE__ */ jsxRuntime.jsx(
485
+ Swatch,
486
+ {
487
+ label: t("iconStacker.primary", "Primary"),
488
+ value: edited.primaryColor,
489
+ onChange: (v) => update(edited.id, { primaryColor: v }),
490
+ autoLabel,
491
+ resetLabel
492
+ }
493
+ ),
494
+ /* @__PURE__ */ jsxRuntime.jsx(
495
+ Swatch,
496
+ {
497
+ label: t("iconStacker.secondary", "Secondary"),
498
+ value: edited.secondaryColor,
499
+ onChange: (v) => update(edited.id, { secondaryColor: v }),
500
+ autoLabel,
501
+ resetLabel
502
+ }
503
+ ),
504
+ /* @__PURE__ */ jsxRuntime.jsx(
505
+ Swatch,
506
+ {
507
+ label: t("iconStacker.accent", "Accent"),
508
+ value: edited.accentColor,
509
+ onChange: (v) => update(edited.id, { accentColor: v }),
510
+ autoLabel,
511
+ resetLabel
512
+ }
513
+ ),
514
+ hasText && /* @__PURE__ */ jsxRuntime.jsx(
515
+ Swatch,
516
+ {
517
+ label: t("iconStacker.textColor", "Text colour"),
518
+ value: edited.textColor,
519
+ onChange: (v) => update(edited.id, { textColor: v }),
520
+ autoLabel,
521
+ resetLabel
522
+ }
523
+ )
524
+ ] }),
525
+ hasText && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
526
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
527
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.textSize", "Text size") }),
528
+ /* @__PURE__ */ jsxRuntime.jsx(
529
+ "input",
530
+ {
531
+ type: "range",
532
+ min: 3,
533
+ max: 14,
534
+ step: 0.5,
535
+ value: textSize,
536
+ onChange: (e) => update(edited.id, { textSize: Number(e.target.value) })
537
+ }
538
+ ),
539
+ /* @__PURE__ */ jsxRuntime.jsx("output", { children: textSize }),
540
+ edited.textSize !== void 0 && /* @__PURE__ */ jsxRuntime.jsx(
541
+ "button",
542
+ {
543
+ type: "button",
544
+ className: "nice-icon-stacker__reset",
545
+ onClick: () => update(edited.id, { textSize: void 0 }),
546
+ "aria-label": `${resetLabel}: ${t("iconStacker.textSize", "Text size")}`,
547
+ title: resetLabel,
548
+ children: /* @__PURE__ */ jsxRuntime.jsx(navigation.NtdClose, { size: 10 })
549
+ }
550
+ )
551
+ ] }),
552
+ /* @__PURE__ */ jsxRuntime.jsxs("label", { className: "nice-icon-stacker__field", children: [
553
+ /* @__PURE__ */ jsxRuntime.jsx("span", { children: t("iconStacker.bind", "Bind to") }),
554
+ /* @__PURE__ */ jsxRuntime.jsx(
555
+ "input",
556
+ {
557
+ type: "text",
558
+ value: edited.textBinding ?? "",
559
+ "aria-invalid": bindingInvalid || void 0,
560
+ title: t(
561
+ "iconStacker.bindHint",
562
+ "The name of the value the text shows, e.g. count — the text above is a sample"
563
+ ),
564
+ onChange: (e) => update(edited.id, { textBinding: e.target.value.trim() || void 0 })
565
+ }
566
+ )
567
+ ] })
568
+ ] })
569
+ ] })
570
+ ] })
571
+ ]
572
+ }
573
+ ),
574
+ showCode && /* @__PURE__ */ jsxRuntime.jsxs("details", { className: "nice-icon-stacker__code", children: [
575
+ /* @__PURE__ */ jsxRuntime.jsx("summary", { children: t("iconStacker.code", "JSX code") }),
576
+ /* @__PURE__ */ jsxRuntime.jsx("pre", { children: code }),
577
+ /* @__PURE__ */ jsxRuntime.jsxs("button", { type: "button", onClick: copy, children: [
578
+ copied ? /* @__PURE__ */ jsxRuntime.jsx(actions.NtdCheck, { size: 14 }) : /* @__PURE__ */ jsxRuntime.jsx(actions.NtdCopy, { size: 14 }),
579
+ " ",
580
+ copied ? t("iconStacker.copied", "Copied") : t("iconStacker.copy", "Copy the code")
581
+ ] })
582
+ ] })
583
+ ] })
584
+ ] });
585
+ }
586
+ );
587
+ if (process.env.NODE_ENV !== "production") {
588
+ NiceIconStacker.displayName = "NiceIconStacker";
212
589
  }
213
-
214
590
  exports.niceIconStackCode = iconStack.niceIconStackCode;
215
591
  exports.NiceIconStacker = NiceIconStacker;