@nice2dev/icons 1.3.8 → 1.3.10
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 +99 -0
- package/dist/cjs/NiceIconPicker.js +310 -92
- package/dist/cjs/NiceIconStacker.js +137 -120
- package/dist/cjs/NiceIconValue.js +44 -0
- package/dist/cjs/client.js +11 -0
- package/dist/cjs/iconHtml.js +104 -0
- package/dist/cjs/iconStack.js +74 -1
- package/dist/cjs/iconValue.js +473 -0
- package/dist/cjs/icons/actions.js +39 -8
- package/dist/cjs/icons/files.js +23 -2
- package/dist/cjs/icons/fintech.js +12 -5
- package/dist/cjs/icons/index.js +1 -0
- package/dist/cjs/icons/media.js +7 -4
- package/dist/cjs/icons/realestate.js +8 -7
- package/dist/cjs/icons/shapes.js +55 -4
- package/dist/cjs/index.js +12 -0
- package/dist/cjs/nicetodev-icons.css +1 -1
- package/dist/esm/NiceIconPicker.js +313 -95
- package/dist/esm/NiceIconStacker.js +140 -123
- package/dist/esm/NiceIconValue.js +41 -0
- package/dist/esm/client.js +4 -1
- package/dist/esm/iconHtml.js +100 -0
- package/dist/esm/iconStack.js +72 -2
- package/dist/esm/iconValue.js +470 -0
- package/dist/esm/icons/actions.js +39 -9
- package/dist/esm/icons/files.js +23 -2
- package/dist/esm/icons/fintech.js +12 -5
- package/dist/esm/icons/index.js +1 -1
- package/dist/esm/icons/media.js +8 -5
- package/dist/esm/icons/realestate.js +8 -7
- package/dist/esm/icons/shapes.js +55 -4
- package/dist/esm/index.js +5 -2
- package/dist/esm/nicetodev-icons.css +1 -1
- package/dist/types/NiceIconPicker.d.ts +72 -20
- package/dist/types/NiceIconStacker.d.ts +30 -9
- package/dist/types/NiceIconValue.d.ts +40 -0
- package/dist/types/client.d.ts +8 -2
- package/dist/types/iconHtml.d.ts +22 -0
- package/dist/types/iconStack.d.ts +18 -0
- package/dist/types/iconValue.d.ts +22 -0
- package/dist/types/icons/actions.d.ts +1 -0
- package/dist/types/icons/index.d.ts +1 -1
- package/dist/types/index.d.ts +8 -2
- package/package.json +2 -2
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type NiceIconResolver } from './iconStack';
|
|
3
|
+
import type { NtdIconProps } from './types';
|
|
4
|
+
/** `values` is the bound text here, not the SVG animation attribute of the same name. */
|
|
5
|
+
export interface NiceIconValueProps extends Partial<Omit<NtdIconProps, 'children' | 'values'>> {
|
|
6
|
+
/**
|
|
7
|
+
* The icon as NiceIconPicker stores it, in any of its formats: a name (`'NtdStar'`), the code of a
|
|
8
|
+
* stack (`'Folder(Star@tr)'`), JSON or HTML.
|
|
9
|
+
*/
|
|
10
|
+
value: string | null | undefined;
|
|
11
|
+
/** Resolves the icon names — a map of exports or a function. */
|
|
12
|
+
icons: NiceIconResolver;
|
|
13
|
+
/** Values for bound text of a stack. */
|
|
14
|
+
values?: Record<string, React.ReactNode>;
|
|
15
|
+
/** Drawn when the value holds no icon (default: nothing). */
|
|
16
|
+
fallback?: React.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* NiceIconValue (1.3.10) — shows an icon as NiceIconPicker stored it, whatever the format: a name,
|
|
20
|
+
* the code of a stack, JSON or HTML. It draws the icon again from the data; stored markup is never
|
|
21
|
+
* injected, so a value from a database cannot run anything. The rest of the props go to the base
|
|
22
|
+
* icon.
|
|
23
|
+
*/
|
|
24
|
+
export declare function NiceIconValue({ value, icons, values, fallback, ...baseProps }: NiceIconValueProps): React.ReactElement | null;
|
|
25
|
+
export declare namespace NiceIconValue {
|
|
26
|
+
var displayName: string;
|
|
27
|
+
}
|
|
28
|
+
export interface NiceIconHtmlProps extends Omit<NiceIconValueProps, 'value'> {
|
|
29
|
+
/** The icon's HTML as NiceIconPicker wrote it (or any other of its formats). */
|
|
30
|
+
html: string | null | undefined;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* NiceIconHtml (1.3.9) — shows an icon kept as HTML.
|
|
34
|
+
*
|
|
35
|
+
* @deprecated Since 1.3.10 use `NiceIconValue`, which reads every format the picker writes.
|
|
36
|
+
*/
|
|
37
|
+
export declare function NiceIconHtml({ html, ...props }: NiceIconHtmlProps): React.ReactElement | null;
|
|
38
|
+
export declare namespace NiceIconHtml {
|
|
39
|
+
var displayName: string;
|
|
40
|
+
}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -18,9 +18,15 @@
|
|
|
18
18
|
export { AnimationController, InteractiveIcon, useAnimationSequence, createAnimationSequence, createHoverAnimation, createClickAnimation, createVisibilityAnimation, PRESET_SEQUENCES, PRESET_INTERACTIONS, } from './animationControls';
|
|
19
19
|
export type { AnimationStep, AnimationSequenceConfig, AnimationPlaybackState, AnimationTrigger, InteractiveAnimationConfig, AnimationControllerHandle, AnimationControllerProps, InteractiveIconProps, } from './animationControls';
|
|
20
20
|
export { NiceIconPicker } from './NiceIconPicker';
|
|
21
|
-
export type { NiceIconPickerProps, NiceIconPickerHandle, IconPickerEntry } from './NiceIconPicker';
|
|
21
|
+
export type { NiceIconPickerProps, NiceIconPickerHandle, IconPickerEntry, NiceIconPickerValueFormat, NiceIconPickerDisplayMode, } from './NiceIconPicker';
|
|
22
|
+
export { NiceIconValue, NiceIconHtml } from './NiceIconValue';
|
|
23
|
+
export type { NiceIconValueProps, NiceIconHtmlProps } from './NiceIconValue';
|
|
24
|
+
export { formatIconValue, parseIconValue } from './iconValue';
|
|
25
|
+
export type { FormatIconValueOptions } from './iconValue';
|
|
26
|
+
export { parseIconHtml } from './iconHtml';
|
|
27
|
+
export type { NiceIconHtmlSource } from './iconHtml';
|
|
22
28
|
export { NiceIconStacker } from './NiceIconStacker';
|
|
23
|
-
export { NiceIconStack, niceIconStackCode, renderIconStack, isValidTextBinding } from './iconStack';
|
|
29
|
+
export { NiceIconStack, niceIconStackCode, renderIconStack, isValidTextBinding, addStackLayer, removeStackLayer, iconDisplayName, } from './iconStack';
|
|
24
30
|
export type { NiceIconStackProps, NiceIconResolver, RenderIconStackOptions } from './iconStack';
|
|
25
31
|
export type { NiceIconStackerProps, NiceIconStackerHandle, NiceIconStackLayer, } from './NiceIconStacker';
|
|
26
32
|
export { NtdIconMorph, NtdPathMorph, NtdMorphPair, useMorphState } from './NtdIconMorph';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { NiceIconStackLayer } from './iconStack';
|
|
2
|
+
/** What an icon's HTML was drawn from. */
|
|
3
|
+
export interface NiceIconHtmlSource {
|
|
4
|
+
/** The base icon's export name, e.g. `'NtdStar'`. */
|
|
5
|
+
icon: string;
|
|
6
|
+
/** The whole stack — one layer for a plain icon. */
|
|
7
|
+
layers: NiceIconStackLayer[];
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads back what an icon's HTML was drawn from — the base icon and the stack. `null` for anything
|
|
11
|
+
* else: empty, plain text or HTML the picker did not write.
|
|
12
|
+
*/
|
|
13
|
+
export declare function parseIconHtml(html: string | null | undefined): NiceIconHtmlSource | null;
|
|
14
|
+
/** The data attributes that let the HTML of a stack be read back: the base, and the stack unless it is a plain icon. */
|
|
15
|
+
export declare function iconHtmlAttributes(layers: readonly NiceIconStackLayer[]): Record<string, string>;
|
|
16
|
+
/**
|
|
17
|
+
* Renames the ids inside an icon's markup (masks, gradients, clip paths) after the drawing itself.
|
|
18
|
+
* React's ids (`_r_3_`) are unique only within the page that drew them; pasted into another page they
|
|
19
|
+
* could hit an element of its own and borrow the wrong mask. Named after the drawing, two copies of
|
|
20
|
+
* one icon share ids that point at identical definitions.
|
|
21
|
+
*/
|
|
22
|
+
export declare function scopeIconHtmlIds(markup: string): string;
|
|
@@ -59,6 +59,24 @@ export declare function isValidTextBinding(name: string | undefined): name is st
|
|
|
59
59
|
export declare function stackParentId(layers: readonly NiceIconStackLayer[], layer: NiceIconStackLayer): string | undefined;
|
|
60
60
|
/** The layers that sit directly in layer `id`, in order. */
|
|
61
61
|
export declare function stackChildrenOf(layers: readonly NiceIconStackLayer[], id: string): NiceIconStackLayer[];
|
|
62
|
+
/** An icon's name as people read it: the export name without `Ntd` — `NtdAlertBell` → `AlertBell`. */
|
|
63
|
+
export declare function iconDisplayName(name: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* Puts an icon on the stack (1.3.9): into layer `into` (the base when absent or unknown), or as the
|
|
66
|
+
* base of an empty stack. Returns the new layers and the new layer's id.
|
|
67
|
+
*/
|
|
68
|
+
export declare function addStackLayer(layers: readonly NiceIconStackLayer[], icon: {
|
|
69
|
+
icon: string;
|
|
70
|
+
variant?: IconVariant;
|
|
71
|
+
}, into?: string): {
|
|
72
|
+
layers: NiceIconStackLayer[];
|
|
73
|
+
id: string;
|
|
74
|
+
};
|
|
75
|
+
/**
|
|
76
|
+
* Takes a layer off the stack (1.3.9; NiceIconStacker's own until then): what sat in it moves up
|
|
77
|
+
* into its parent, and a removed base hands over to its first child.
|
|
78
|
+
*/
|
|
79
|
+
export declare function removeStackLayer(layers: readonly NiceIconStackLayer[], id: string): NiceIconStackLayer[];
|
|
62
80
|
/** The stack as JSX: every layer wrapping the layers that sit in it, text innermost. */
|
|
63
81
|
export declare function niceIconStackCode(layers: readonly NiceIconStackLayer[]): string;
|
|
64
82
|
export interface RenderIconStackOptions {
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { type NiceIconStackLayer } from './iconStack';
|
|
2
|
+
type Shorten = (name: string) => string;
|
|
3
|
+
export interface FormatIconValueOptions {
|
|
4
|
+
/**
|
|
5
|
+
* The name written for an icon in a stack. Default: without `Ntd` (`NtdStar` → `Star`). Pass your
|
|
6
|
+
* own when your icons hold names that differ only by `Ntd`; NiceIconPicker does.
|
|
7
|
+
*/
|
|
8
|
+
shortName?: Shorten;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Writes an icon or a stack as short text (1.3.10): `'name'` — a plain icon's name, a stack's code
|
|
12
|
+
* (`Folder(Star@tr)`) — or `'json'` (`["Folder",["Star",{"a":"tr"}]]`). Empty for no layers.
|
|
13
|
+
* `parseIconValue` reads it back; the ids of the layers are not kept.
|
|
14
|
+
*/
|
|
15
|
+
export declare function formatIconValue(layers: readonly NiceIconStackLayer[], format?: 'name' | 'json', { shortName }?: FormatIconValueOptions): string;
|
|
16
|
+
/**
|
|
17
|
+
* Reads an icon kept as text (1.3.10) — a name, the code (`Folder(Star@tr)`), JSON or the HTML of
|
|
18
|
+
* NiceIconPicker 1.3.9 — into stack layers (ids `'1'`, `'2'`… in document order). `null` for empty
|
|
19
|
+
* or unreadable text. Names stay as written: `renderIconStack` resolves `Star` to `NtdStar`.
|
|
20
|
+
*/
|
|
21
|
+
export declare function parseIconValue(value: string | null | undefined): NiceIconStackLayer[] | null;
|
|
22
|
+
export {};
|
|
@@ -25,5 +25,6 @@ export declare const NtdLogIn: import("react").ForwardRefExoticComponent<import(
|
|
|
25
25
|
export declare const NtdLogOut: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
26
26
|
export declare const NtdLock: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
27
27
|
export declare const NtdUnlock: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
28
|
+
export declare const NtdFrameCorners: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
28
29
|
export declare const NtdGroup: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
29
30
|
export declare const NtdUngroup: import("react").ForwardRefExoticComponent<import("..").NtdIconProps & import("react").RefAttributes<SVGSVGElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { NtdArrowUp, NtdArrowDown, NtdArrowLeft, NtdArrowRight, NtdChevronUp, NtdChevronDown, NtdChevronLeft, NtdChevronRight, NtdMenu, NtdClose, NtdMoreHorizontal, NtdMoreVertical, NtdExternalLink, NtdRefresh, } from './navigation';
|
|
2
|
-
export { NtdSearch, NtdEdit, NtdEditDetail, NtdTrash, NtdSave, NtdDownload, NtdUpload, NtdShare, NtdCopy, NtdClipboard, NtdPlus, NtdMinus, NtdCheck, NtdFilter, NtdSort, NtdPrint, NtdZoomIn, NtdZoomOut, NtdUndo, NtdRedo, NtdReply, NtdLink, NtdSettings, NtdLogIn, NtdLogOut, NtdLock, NtdUnlock, NtdGroup, NtdUngroup, } from './actions';
|
|
2
|
+
export { NtdSearch, NtdEdit, NtdEditDetail, NtdTrash, NtdSave, NtdDownload, NtdUpload, NtdShare, NtdCopy, NtdClipboard, NtdPlus, NtdMinus, NtdCheck, NtdFilter, NtdSort, NtdPrint, NtdZoomIn, NtdZoomOut, NtdUndo, NtdRedo, NtdReply, NtdLink, NtdSettings, NtdLogIn, NtdLogOut, NtdLock, NtdUnlock, NtdFrameCorners, NtdGroup, NtdUngroup, } from './actions';
|
|
3
3
|
export { NtdHome, NtdUser, NtdAdmin, NtdUsers, NtdHeart, NtdStar, NtdBell, NtdEye, NtdEyeOff, NtdInfo, NtdWarning, NtdError, NtdSuccess, NtdHelp, NtdClock, NtdHourglass, NtdCalendar, NtdTag, NtdBackspace, NtdBookmark, NtdFlag, NtdThumbUp, NtdThumbDown, NtdShield, NtdGlobe, NtdMap, NtdPin, NtdMapPin, NtdSun, NtdMoon, NtdCursor, NtdWireframe, } from './ui';
|
|
4
4
|
export { NtdRecycle, NtdCompost, NtdTrashSort, NtdSolarPanel, NtdWindTurbine, NtdEvCharger, NtdCarbonFootprint, NtdCo2, NtdNetZero, NtdEcoFriendly, NtdOrganic, NtdBiodegradable, NtdPlantTree, NtdWildlife, sustainabilityIcons, } from './sustainability';
|
|
5
5
|
export { NtdAccessibility, NtdWheelchair, NtdBlind, NtdDeaf, NtdSignLanguage, NtdBraille, NtdAudioDescription, NtdClosedCaptions, NtdDyslexia, NtdEasyRead, NtdScreenReader, NtdHearingAid, NtdAssistiveTech, accessibilityIcons, } from './accessibility';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -53,9 +53,15 @@ export { createIcon } from './createIcon';
|
|
|
53
53
|
export { generateSmilAnimation, SmilAnimationWrapper as NiceSmilAnimationWrapper, SmilAnimationWrapper, createSmilAnimationDef, isSmilSupported, SMIL_ANIMATION_TYPES, } from './smilAnimations';
|
|
54
54
|
export type { SmilAnimationType, SmilAnimationConfig, SmilAnimationWrapperProps, } from './smilAnimations';
|
|
55
55
|
export { NiceIconPicker } from './NiceIconPicker';
|
|
56
|
-
export type { NiceIconPickerProps, NiceIconPickerHandle, IconPickerEntry } from './NiceIconPicker';
|
|
56
|
+
export type { NiceIconPickerProps, NiceIconPickerHandle, IconPickerEntry, NiceIconPickerValueFormat, NiceIconPickerDisplayMode, } from './NiceIconPicker';
|
|
57
|
+
export { NiceIconValue, NiceIconHtml } from './NiceIconValue';
|
|
58
|
+
export type { NiceIconValueProps, NiceIconHtmlProps } from './NiceIconValue';
|
|
59
|
+
export { formatIconValue, parseIconValue } from './iconValue';
|
|
60
|
+
export type { FormatIconValueOptions } from './iconValue';
|
|
61
|
+
export { parseIconHtml } from './iconHtml';
|
|
62
|
+
export type { NiceIconHtmlSource } from './iconHtml';
|
|
57
63
|
export { NiceIconStacker } from './NiceIconStacker';
|
|
58
|
-
export { NiceIconStack, niceIconStackCode, renderIconStack, isValidTextBinding } from './iconStack';
|
|
64
|
+
export { NiceIconStack, niceIconStackCode, renderIconStack, isValidTextBinding, addStackLayer, removeStackLayer, iconDisplayName, } from './iconStack';
|
|
59
65
|
export type { NiceIconStackProps, NiceIconResolver, RenderIconStackOptions } from './iconStack';
|
|
60
66
|
export type { NiceIconStackerProps, NiceIconStackerHandle, NiceIconStackLayer, } from './NiceIconStacker';
|
|
61
67
|
export { AnimationController as NiceAnimationController, AnimationController, InteractiveIcon as NiceInteractiveIcon, InteractiveIcon, useAnimationSequence, createAnimationSequence, createHoverAnimation, createClickAnimation, createVisibilityAnimation, PRESET_SEQUENCES, PRESET_INTERACTIONS, } from './animationControls';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nice2dev/icons",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.10",
|
|
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.3.
|
|
112
|
+
"@nice2dev/ui-core": "^1.3.10",
|
|
113
113
|
"@rollup/plugin-commonjs": "^29.0.3",
|
|
114
114
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
|
115
115
|
"@rollup/plugin-typescript": "^12.3.0",
|