@nice2dev/icons 1.4.2 → 1.4.4
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.
- package/CHANGELOG.md +57 -0
- package/dist/cjs/NiceIconStacker.js +36 -2
- package/dist/cjs/createIcon.js +25 -6
- package/dist/cjs/iconParts.js +33 -12
- package/dist/cjs/iconValue.js +6 -1
- package/dist/cjs/icons/actions.js +86 -122
- package/dist/cjs/icons/ai.js +0 -178
- package/dist/cjs/icons/business.js +172 -120
- package/dist/cjs/icons/ecommerce.js +18 -74
- package/dist/cjs/icons/education.js +235 -487
- package/dist/cjs/icons/files.js +193 -461
- package/dist/cjs/icons/fintech.js +38 -74
- package/dist/cjs/icons/food.js +117 -194
- package/dist/cjs/icons/fun.js +176 -57
- package/dist/cjs/icons/gaming.js +2 -2
- package/dist/cjs/icons/health.js +1 -1
- package/dist/cjs/icons/index.js +32 -10
- package/dist/cjs/icons/legal.js +1 -109
- package/dist/cjs/icons/media.js +67 -8
- package/dist/cjs/icons/navigation.js +4 -4
- package/dist/cjs/icons/omniverk.js +14 -6
- package/dist/cjs/icons/realestate.js +99 -98
- package/dist/cjs/icons/roman.js +111 -0
- package/dist/cjs/icons/science.js +74 -165
- package/dist/cjs/icons/shapes.js +58 -39
- package/dist/cjs/icons/smarthome.js +18 -16
- package/dist/cjs/icons/social.js +22 -20
- package/dist/cjs/icons/sports.js +89 -159
- package/dist/cjs/icons/sustainability.js +26 -48
- package/dist/cjs/icons/travel.js +209 -477
- package/dist/cjs/icons/ui.js +140 -240
- package/dist/cjs/icons/weather.js +30 -56
- package/dist/cjs/index.js +67 -43
- package/dist/cjs/stackedIcon.js +19 -0
- package/dist/cjs/stacking.js +104 -2
- package/dist/esm/NiceIconStacker.js +37 -3
- package/dist/esm/createIcon.js +27 -8
- package/dist/esm/iconParts.js +33 -12
- package/dist/esm/iconValue.js +6 -1
- package/dist/esm/icons/actions.js +86 -122
- package/dist/esm/icons/ai.js +0 -178
- package/dist/esm/icons/business.js +172 -120
- package/dist/esm/icons/ecommerce.js +18 -74
- package/dist/esm/icons/education.js +236 -488
- package/dist/esm/icons/files.js +193 -461
- package/dist/esm/icons/fintech.js +38 -74
- package/dist/esm/icons/food.js +118 -195
- package/dist/esm/icons/fun.js +179 -60
- package/dist/esm/icons/gaming.js +2 -2
- package/dist/esm/icons/health.js +1 -1
- package/dist/esm/icons/index.js +43 -21
- package/dist/esm/icons/legal.js +1 -109
- package/dist/esm/icons/media.js +67 -8
- package/dist/esm/icons/navigation.js +4 -4
- package/dist/esm/icons/omniverk.js +15 -7
- package/dist/esm/icons/realestate.js +100 -99
- package/dist/esm/icons/roman.js +111 -0
- package/dist/esm/icons/science.js +74 -165
- package/dist/esm/icons/shapes.js +58 -39
- package/dist/esm/icons/smarthome.js +18 -16
- package/dist/esm/icons/social.js +22 -20
- package/dist/esm/icons/sports.js +89 -159
- package/dist/esm/icons/sustainability.js +26 -48
- package/dist/esm/icons/travel.js +209 -477
- package/dist/esm/icons/ui.js +140 -240
- package/dist/esm/icons/weather.js +30 -56
- package/dist/esm/index.js +45 -21
- package/dist/esm/nicetodev-icons.css +1 -1
- package/dist/esm/stackedIcon.js +19 -0
- package/dist/esm/stacking.js +105 -3
- package/dist/types/createIcon.d.ts +14 -1
- package/dist/types/iconParts.d.ts +9 -6
- package/dist/types/icons/ai.d.ts +0 -4
- package/dist/types/icons/business.d.ts +1 -0
- package/dist/types/icons/education.d.ts +2 -4
- package/dist/types/icons/files.d.ts +3 -1
- package/dist/types/icons/fintech.d.ts +1 -1
- package/dist/types/icons/fun.d.ts +23 -0
- package/dist/types/icons/index.d.ts +14 -12
- package/dist/types/icons/legal.d.ts +0 -2
- package/dist/types/icons/media.d.ts +1 -0
- package/dist/types/icons/realestate.d.ts +17 -1
- package/dist/types/icons/roman.d.ts +76 -0
- package/dist/types/icons/science.d.ts +0 -2
- package/dist/types/icons/ui.d.ts +6 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/stackedIcon.d.ts +11 -0
- package/dist/types/stacking.d.ts +48 -1
- package/dist/types/types.d.ts +17 -2
- package/package.json +2 -2
package/dist/types/stacking.d.ts
CHANGED
|
@@ -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;
|
package/dist/types/types.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "1.4.4",
|
|
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.
|
|
112
|
+
"@nice2dev/ui-core": "^1.4.4",
|
|
113
113
|
"@storybook/addon-a11y": "^10.6.6",
|
|
114
114
|
"@storybook/addon-docs": "^10.6.6",
|
|
115
115
|
"@storybook/react-vite": "^10.6.6",
|