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