@blueprintjs/icons 6.15.0 → 6.16.0
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/lib/cjs/next/generated/index.d.ts +2 -1
- package/lib/cjs/next/generated/index.js +3 -1
- package/lib/cjs/next/generated/index.js.map +1 -1
- package/lib/cjs/next/iconLoaderNext.d.ts +4 -3
- package/lib/cjs/next/iconLoaderNext.js +12 -9
- package/lib/cjs/next/iconLoaderNext.js.map +1 -1
- package/lib/cjs/next/iconVariant.d.ts +5 -0
- package/lib/cjs/next/iconVariant.js +23 -0
- package/lib/cjs/next/iconVariant.js.map +1 -0
- package/lib/cjs/next/pathsLoader.d.ts +2 -2
- package/lib/cjs/next/pathsLoader.js +2 -1
- package/lib/cjs/next/pathsLoader.js.map +1 -1
- package/lib/cjs/tsconfig.build.tsbuildinfo +1 -1
- package/lib/esm/next/generated/index.d.ts +2 -1
- package/lib/esm/next/generated/index.js +1 -0
- package/lib/esm/next/generated/index.js.map +1 -1
- package/lib/esm/next/iconLoaderNext.d.ts +4 -3
- package/lib/esm/next/iconLoaderNext.js +10 -8
- package/lib/esm/next/iconLoaderNext.js.map +1 -1
- package/lib/esm/next/iconVariant.d.ts +5 -0
- package/lib/esm/next/iconVariant.js +20 -0
- package/lib/esm/next/iconVariant.js.map +1 -0
- package/lib/esm/next/pathsLoader.d.ts +2 -2
- package/lib/esm/next/pathsLoader.js +2 -1
- package/lib/esm/next/pathsLoader.js.map +1 -1
- package/lib/esm/tsconfig.build.tsbuildinfo +1 -1
- package/lib/esnext/next/generated/index.d.ts +2 -1
- package/lib/esnext/next/generated/index.js +1 -0
- package/lib/esnext/next/generated/index.js.map +1 -1
- package/lib/esnext/next/iconLoaderNext.d.ts +4 -3
- package/lib/esnext/next/iconLoaderNext.js +10 -8
- package/lib/esnext/next/iconLoaderNext.js.map +1 -1
- package/lib/esnext/next/iconVariant.d.ts +5 -0
- package/lib/esnext/next/iconVariant.js +20 -0
- package/lib/esnext/next/iconVariant.js.map +1 -0
- package/lib/esnext/next/pathsLoader.d.ts +2 -2
- package/lib/esnext/next/pathsLoader.js +2 -1
- package/lib/esnext/next/pathsLoader.js.map +1 -1
- package/lib/esnext/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/next/generated/index.ts +2 -1
- package/src/next/iconLoaderNext.ts +13 -12
- package/src/next/iconVariant.ts +21 -0
- package/src/next/pathsLoader.ts +3 -3
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ export * from "./components";
|
|
|
3
3
|
export * from "./legacyAliases";
|
|
4
4
|
export { nextIconManifest, type BlueprintIconsNext, type NextIconManifestEntry } from "./manifest";
|
|
5
5
|
export { IconNextNames, IconNextNamesSet, nextFilledIconNames, nextIconNames, type IconNextName } from "../iconNextNames";
|
|
6
|
-
export { IconsNext, type
|
|
6
|
+
export { IconsNext, type NextIconLoaderOptions } from "../iconLoaderNext";
|
|
7
|
+
export { IconVariant } from "../iconVariant";
|
|
7
8
|
export { defaultNextIconPathsLoader, type NextIconPathsLoader } from "../pathsLoader";
|
|
8
9
|
export { SvgIconContainerNext, type SvgIconContainerNextComponent, type SvgIconContainerNextProps } from "../svgIconContainerNext";
|
|
@@ -18,9 +18,10 @@ import type { IconPaths } from "../iconTypes";
|
|
|
18
18
|
|
|
19
19
|
import { nextFilledIconNames, nextIconNames } from "./generated/names";
|
|
20
20
|
import { type IconNextName, IconNextNamesSet } from "./iconNextNames";
|
|
21
|
+
import { IconVariant } from "./iconVariant";
|
|
21
22
|
import { defaultNextIconPathsLoader, type NextIconPathsLoader } from "./pathsLoader";
|
|
22
23
|
|
|
23
|
-
export
|
|
24
|
+
export { IconVariant } from "./iconVariant";
|
|
24
25
|
|
|
25
26
|
export interface NextIconLoaderOptions {
|
|
26
27
|
/**
|
|
@@ -61,7 +62,7 @@ export class IconsNext {
|
|
|
61
62
|
/**
|
|
62
63
|
* Load one or more next icons for use in Blueprint components.
|
|
63
64
|
*/
|
|
64
|
-
public static async load(icons: IconNextName | IconNextName[], variant:
|
|
65
|
+
public static async load(icons: IconNextName | IconNextName[], variant: IconVariant = IconVariant.OUTLINED) {
|
|
65
66
|
const iconNames = Array.isArray(icons) ? icons : [icons];
|
|
66
67
|
|
|
67
68
|
// Validate the whole request before starting any loads so a malformed runtime value cannot
|
|
@@ -79,9 +80,9 @@ export class IconsNext {
|
|
|
79
80
|
* Load all next icons (outlined variant). Optionally also load filled variants.
|
|
80
81
|
*/
|
|
81
82
|
public static async loadAll(options?: { includeFilled?: boolean }) {
|
|
82
|
-
await this.load([...nextIconNames],
|
|
83
|
+
await this.load([...nextIconNames], IconVariant.OUTLINED);
|
|
83
84
|
if (options?.includeFilled) {
|
|
84
|
-
await this.load([...nextFilledIconNames],
|
|
85
|
+
await this.load([...nextFilledIconNames], IconVariant.FILLED);
|
|
85
86
|
}
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -89,7 +90,7 @@ export class IconsNext {
|
|
|
89
90
|
* Get the icon SVG paths. Returns `undefined` if the icon has not been loaded yet.
|
|
90
91
|
* If `variant="filled"` is requested but unavailable, falls back to outlined.
|
|
91
92
|
*/
|
|
92
|
-
public static getPaths(icon: IconNextName, variant:
|
|
93
|
+
public static getPaths(icon: IconNextName, variant: IconVariant = IconVariant.OUTLINED): IconPaths | undefined {
|
|
93
94
|
const resolvedVariant = this.resolveVariant(icon, variant);
|
|
94
95
|
return this.cache.get(this.cacheKey(icon, resolvedVariant));
|
|
95
96
|
}
|
|
@@ -108,7 +109,7 @@ export class IconsNext {
|
|
|
108
109
|
return IconNextNamesSet.has(name as IconNextName);
|
|
109
110
|
}
|
|
110
111
|
|
|
111
|
-
private static async loadImpl(icon: IconNextName, variant:
|
|
112
|
+
private static async loadImpl(icon: IconNextName, variant: IconVariant) {
|
|
112
113
|
const resolvedVariant = this.resolveVariant(icon, variant);
|
|
113
114
|
const key = this.cacheKey(icon, resolvedVariant);
|
|
114
115
|
|
|
@@ -120,12 +121,12 @@ export class IconsNext {
|
|
|
120
121
|
this.cache.set(key, paths);
|
|
121
122
|
}
|
|
122
123
|
|
|
123
|
-
private static resolveVariant(icon: IconNextName, variant:
|
|
124
|
-
if (variant !==
|
|
125
|
-
return
|
|
124
|
+
private static resolveVariant(icon: IconNextName, variant: IconVariant): IconVariant {
|
|
125
|
+
if (variant !== IconVariant.FILLED) {
|
|
126
|
+
return IconVariant.OUTLINED;
|
|
126
127
|
}
|
|
127
128
|
if (this.filledSet.has(icon)) {
|
|
128
|
-
return
|
|
129
|
+
return IconVariant.FILLED;
|
|
129
130
|
}
|
|
130
131
|
|
|
131
132
|
if (
|
|
@@ -137,10 +138,10 @@ export class IconsNext {
|
|
|
137
138
|
console.warn(`[Blueprint] Icon "${icon}" does not have a filled variant. Falling back to outlined.`);
|
|
138
139
|
}
|
|
139
140
|
|
|
140
|
-
return
|
|
141
|
+
return IconVariant.OUTLINED;
|
|
141
142
|
}
|
|
142
143
|
|
|
143
|
-
private static cacheKey(icon: IconNextName, variant:
|
|
144
|
+
private static cacheKey(icon: IconNextName, variant: IconVariant): string {
|
|
144
145
|
return `${icon}:${variant}`;
|
|
145
146
|
}
|
|
146
147
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright 2026 Palantir Technologies, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
* you may not use this file except in compliance with the License.
|
|
6
|
+
* You may obtain a copy of the License at
|
|
7
|
+
*
|
|
8
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
9
|
+
*
|
|
10
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
11
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
12
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
13
|
+
* See the License for the specific language governing permissions and
|
|
14
|
+
* limitations under the License.
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
export const IconVariant = {
|
|
18
|
+
FILLED: "filled" as const,
|
|
19
|
+
OUTLINED: "outlined" as const,
|
|
20
|
+
};
|
|
21
|
+
export type IconVariant = (typeof IconVariant)[keyof typeof IconVariant];
|
package/src/next/pathsLoader.ts
CHANGED
|
@@ -18,11 +18,11 @@ import { pascalCase } from "change-case";
|
|
|
18
18
|
|
|
19
19
|
import type { IconPaths } from "../iconTypes";
|
|
20
20
|
|
|
21
|
-
import type { NextIconVariant } from "./iconLoaderNext";
|
|
22
21
|
import type { IconNextName } from "./iconNextNames";
|
|
22
|
+
import { IconVariant } from "./iconVariant";
|
|
23
23
|
|
|
24
24
|
/** Loader function signature for next icon paths. */
|
|
25
|
-
export type NextIconPathsLoader = (iconName: IconNextName, variant:
|
|
25
|
+
export type NextIconPathsLoader = (iconName: IconNextName, variant: IconVariant) => Promise<IconPaths>;
|
|
26
26
|
|
|
27
27
|
/**
|
|
28
28
|
* Default dynamic loader for next icon paths. Loads all next icon paths into a single chunk.
|
|
@@ -34,7 +34,7 @@ export const defaultNextIconPathsLoader: NextIconPathsLoader = async (name, vari
|
|
|
34
34
|
);
|
|
35
35
|
const outlinedKey = pascalCase(name);
|
|
36
36
|
const filledKey = `${outlinedKey}Filled`;
|
|
37
|
-
const key = variant ===
|
|
37
|
+
const key = variant === IconVariant.FILLED && filledKey in pathsRecord ? filledKey : outlinedKey;
|
|
38
38
|
|
|
39
39
|
return pathsRecord[key];
|
|
40
40
|
};
|