@nice2dev/icons 1.4.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (90) hide show
  1. package/CHANGELOG.md +57 -0
  2. package/dist/cjs/NiceIconStacker.js +36 -2
  3. package/dist/cjs/createIcon.js +25 -6
  4. package/dist/cjs/iconParts.js +33 -12
  5. package/dist/cjs/iconValue.js +6 -1
  6. package/dist/cjs/icons/actions.js +86 -122
  7. package/dist/cjs/icons/ai.js +0 -178
  8. package/dist/cjs/icons/business.js +172 -120
  9. package/dist/cjs/icons/ecommerce.js +18 -74
  10. package/dist/cjs/icons/education.js +235 -487
  11. package/dist/cjs/icons/files.js +193 -461
  12. package/dist/cjs/icons/fintech.js +38 -74
  13. package/dist/cjs/icons/food.js +117 -194
  14. package/dist/cjs/icons/fun.js +176 -57
  15. package/dist/cjs/icons/gaming.js +2 -2
  16. package/dist/cjs/icons/health.js +1 -1
  17. package/dist/cjs/icons/index.js +32 -10
  18. package/dist/cjs/icons/legal.js +1 -109
  19. package/dist/cjs/icons/media.js +67 -8
  20. package/dist/cjs/icons/navigation.js +4 -4
  21. package/dist/cjs/icons/omniverk.js +14 -6
  22. package/dist/cjs/icons/realestate.js +99 -98
  23. package/dist/cjs/icons/roman.js +111 -0
  24. package/dist/cjs/icons/science.js +74 -165
  25. package/dist/cjs/icons/shapes.js +58 -39
  26. package/dist/cjs/icons/smarthome.js +18 -16
  27. package/dist/cjs/icons/social.js +22 -20
  28. package/dist/cjs/icons/sports.js +89 -159
  29. package/dist/cjs/icons/sustainability.js +26 -48
  30. package/dist/cjs/icons/travel.js +209 -477
  31. package/dist/cjs/icons/ui.js +140 -240
  32. package/dist/cjs/icons/weather.js +30 -56
  33. package/dist/cjs/index.js +67 -43
  34. package/dist/cjs/stackedIcon.js +19 -0
  35. package/dist/cjs/stacking.js +104 -2
  36. package/dist/esm/NiceIconStacker.js +37 -3
  37. package/dist/esm/createIcon.js +27 -8
  38. package/dist/esm/iconParts.js +33 -12
  39. package/dist/esm/iconValue.js +6 -1
  40. package/dist/esm/icons/actions.js +86 -122
  41. package/dist/esm/icons/ai.js +0 -178
  42. package/dist/esm/icons/business.js +172 -120
  43. package/dist/esm/icons/ecommerce.js +18 -74
  44. package/dist/esm/icons/education.js +236 -488
  45. package/dist/esm/icons/files.js +193 -461
  46. package/dist/esm/icons/fintech.js +38 -74
  47. package/dist/esm/icons/food.js +118 -195
  48. package/dist/esm/icons/fun.js +179 -60
  49. package/dist/esm/icons/gaming.js +2 -2
  50. package/dist/esm/icons/health.js +1 -1
  51. package/dist/esm/icons/index.js +43 -21
  52. package/dist/esm/icons/legal.js +1 -109
  53. package/dist/esm/icons/media.js +67 -8
  54. package/dist/esm/icons/navigation.js +4 -4
  55. package/dist/esm/icons/omniverk.js +15 -7
  56. package/dist/esm/icons/realestate.js +100 -99
  57. package/dist/esm/icons/roman.js +111 -0
  58. package/dist/esm/icons/science.js +74 -165
  59. package/dist/esm/icons/shapes.js +58 -39
  60. package/dist/esm/icons/smarthome.js +18 -16
  61. package/dist/esm/icons/social.js +22 -20
  62. package/dist/esm/icons/sports.js +89 -159
  63. package/dist/esm/icons/sustainability.js +26 -48
  64. package/dist/esm/icons/travel.js +209 -477
  65. package/dist/esm/icons/ui.js +140 -240
  66. package/dist/esm/icons/weather.js +30 -56
  67. package/dist/esm/index.js +45 -21
  68. package/dist/esm/nicetodev-icons.css +1 -1
  69. package/dist/esm/stackedIcon.js +19 -0
  70. package/dist/esm/stacking.js +105 -3
  71. package/dist/types/createIcon.d.ts +14 -1
  72. package/dist/types/iconParts.d.ts +9 -6
  73. package/dist/types/icons/ai.d.ts +0 -4
  74. package/dist/types/icons/business.d.ts +1 -0
  75. package/dist/types/icons/education.d.ts +2 -4
  76. package/dist/types/icons/files.d.ts +3 -1
  77. package/dist/types/icons/fintech.d.ts +1 -1
  78. package/dist/types/icons/fun.d.ts +23 -0
  79. package/dist/types/icons/index.d.ts +14 -12
  80. package/dist/types/icons/legal.d.ts +0 -2
  81. package/dist/types/icons/media.d.ts +1 -0
  82. package/dist/types/icons/realestate.d.ts +17 -1
  83. package/dist/types/icons/roman.d.ts +76 -0
  84. package/dist/types/icons/science.d.ts +0 -2
  85. package/dist/types/icons/ui.d.ts +6 -1
  86. package/dist/types/index.d.ts +2 -1
  87. package/dist/types/stackedIcon.d.ts +11 -0
  88. package/dist/types/stacking.d.ts +48 -1
  89. package/dist/types/types.d.ts +17 -2
  90. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { type ReactElement, type ReactNode } from 'react';
2
- import type { IconStackAlign, IconVariant, NtdIconProps } from './types';
2
+ import type { IconStackAlign, IconStackSeriesAlign, IconVariant, NtdIconProps } from './types';
3
3
  /**
4
4
  * Icons stacked by nesting (1.3.5): `<NtdSquare><NtdStar stackAlign="center">1</NtdStar></NtdSquare>`.
5
5
  * An icon draws its children inside its own `<svg>` — an icon child as a nested `<svg>` placed by
@@ -19,6 +19,8 @@ export interface PerfectStack {
19
19
  y: number;
20
20
  rotation: number;
21
21
  size: number;
22
+ /** The variants in which the spot lies on a fill (`perfectStackFilled`, 1.4.3); unset — all filled ones. */
23
+ filled?: readonly IconVariant[];
22
24
  }
23
25
  /** Set on every component createIcon makes, next to {@link NTD_ICON_MARK}: its {@link PerfectStack}. */
24
26
  export declare const PERFECT_STACK = "perfectStack";
@@ -72,3 +74,48 @@ export interface StackContext {
72
74
  * larger than itself — a gap cut into the parent where they overlap, unseen beyond it.
73
75
  */
74
76
  export declare function renderStackChildren(children: ReactNode, ctx: StackContext): ReactNode;
77
+ /** A `next-…` position: the child stands beside its parent, not inside it. */
78
+ export declare function isSeriesAlign(align: IconStackAlign | undefined): align is IconStackSeriesAlign;
79
+ /**
80
+ * Set on every component createIcon makes: the width of its glyph across, in the 24-unit box
81
+ * (`createIcon`'s `seriesWidth`, default 24) — how much room it takes in a left / right series,
82
+ * like a letter's advance in a font, so `I` sits close to `X`.
83
+ */
84
+ export declare const SERIES_WIDTH = "seriesWidth";
85
+ /** The glyph width icon component `icon` declares for series; 24 when it declares none. */
86
+ export declare function seriesWidthOf(icon: unknown): number;
87
+ /** One child of a series, placed in the parent's units (its own 24-unit box at `x`, `y`). */
88
+ export interface StackSeriesItem {
89
+ child: ReactElement<NtdIconProps>;
90
+ x: number;
91
+ y: number;
92
+ size: number;
93
+ }
94
+ /** Where a series' children go and the box that holds the parent and all of them. */
95
+ export interface StackSeriesLayout {
96
+ items: StackSeriesItem[];
97
+ /** `[minX, minY, width, height]` in the parent's units — the root SVG's new viewBox. */
98
+ box: [number, number, number, number];
99
+ }
100
+ /**
101
+ * Lays out the `next-…` children of an icon whose glyph is `parentWidth` units across (its
102
+ * `seriesWidth`). Each direction keeps its own cursor and the children follow in order: across,
103
+ * each takes its glyph width (`seriesWidth` × `stackSize`) and is centred on the parent's middle
104
+ * line; up and down, each takes its full height. The box keeps the parent's side bearing at both
105
+ * outer ends, so a series of narrow glyphs is as tight as it looks. `null` without a series.
106
+ */
107
+ export declare function layoutStackSeries(children: ReactNode, parentWidth?: number): StackSeriesLayout | null;
108
+ /** The parent's look a series child takes, unless it sets its own. */
109
+ export interface StackSeriesContext {
110
+ variant: IconVariant;
111
+ primaryColor: string;
112
+ secondaryColor: string;
113
+ accentColor: string;
114
+ strokeWidth: number;
115
+ }
116
+ /**
117
+ * The series children, each as a nested SVG at its place, in the parent's variant and colours
118
+ * (nothing inverted, nothing shrunk — "the same icon, the next one along", R43). Drawn outside the
119
+ * parent's mini / cutout / 3D groups: each child draws its own.
120
+ */
121
+ export declare function renderStackSeries(layout: StackSeriesLayout, ctx: StackSeriesContext): ReactNode;
@@ -301,7 +301,8 @@ export interface NtdIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
301
301
  * the parent icon keeps for what is stacked in it (a pin's head, along a tag; 1.3.8), the
302
302
  * centre when it keeps none; `'center'` is the middle of the box. `half-…` positions sit
303
303
  * halfway from the centre to that edge or corner (1.3.6). Text children
304
- * (`<NtdStar>1</NtdStar>`) go to the icon's own spot too.
304
+ * (`<NtdStar>1</NtdStar>`) go to the icon's own spot too. `next-…` (1.4.3) puts the child
305
+ * beside the icon instead — a series, see {@link IconStackSeriesAlign}.
305
306
  */
306
307
  stackAlign?: IconStackAlign;
307
308
  /**
@@ -343,7 +344,15 @@ export interface NtdIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
343
344
  * (1.3.5), halfway from the centre to one (`half-…`, 1.3.6), or the spot the parent keeps for
344
345
  * stacked icons (`perfect`, the default, 1.3.8).
345
346
  */
346
- export type IconStackAlign = 'perfect' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'half-top' | 'half-bottom' | 'half-left' | 'half-right' | 'half-top-left' | 'half-top-right' | 'half-bottom-left' | 'half-bottom-right';
347
+ export type IconStackAlign = 'perfect' | 'center' | 'top' | 'bottom' | 'left' | 'right' | 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'half-top' | 'half-bottom' | 'half-left' | 'half-right' | 'half-top-left' | 'half-top-right' | 'half-bottom-left' | 'half-bottom-right' | IconStackSeriesAlign;
348
+ /**
349
+ * A series (1.4.3): the child stands next to the icon instead of inside it — to its right, left,
350
+ * above or below, in the icon's own colours, variant and size (`stackSize` 1 by default), one after
351
+ * another in the order given. The icon's SVG grows to hold them, so `<NtdRomanX><NtdRomanI
352
+ * stackAlign="next-right" /><NtdRomanV stackAlign="next-right" /></NtdRomanX>` is one SVG reading
353
+ * XIV. An icon that declares a narrower glyph (`createIcon`'s `seriesWidth`) takes less room across.
354
+ */
355
+ export type IconStackSeriesAlign = 'next-right' | 'next-left' | 'next-up' | 'next-down';
347
356
  /**
348
357
  * Props received by icon path renderer functions inside {@link CreateIconOptions.paths}.
349
358
  *
@@ -371,6 +380,12 @@ export interface IconRenderProps {
371
380
  * renderer runs outside createIcon; the content is then drawn unclipped.
372
381
  */
373
382
  uid?: string;
383
+ /**
384
+ * Something is stacked inside the icon — an icon child or text (1.4.3). A renderer leaves out
385
+ * details the stacked content would land on (a calendar's date cells under a day number).
386
+ * A series beside the icon does not count. Absent outside createIcon.
387
+ */
388
+ stacked?: boolean;
374
389
  }
375
390
  /**
376
391
  * Map of named size presets to their pixel values.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nice2dev/icons",
3
- "version": "1.4.1",
3
+ "version": "1.4.3",
4
4
  "description": "Beautiful, lightweight, multi-color SVG icon library for React with animations",
5
5
  "author": "NiceToDev <contact@nicetodev.com>",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -109,7 +109,7 @@
109
109
  },
110
110
  "devDependencies": {
111
111
  "@chromatic-com/storybook": "^5.3.1",
112
- "@nice2dev/ui-core": "^1.4.1",
112
+ "@nice2dev/ui-core": "^1.4.3",
113
113
  "@storybook/addon-a11y": "^10.6.6",
114
114
  "@storybook/addon-docs": "^10.6.6",
115
115
  "@storybook/react-vite": "^10.6.6",