@2hoch1/pixel-icon-library-react 2.0.0 → 2.0.1

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/README.md CHANGED
@@ -124,11 +124,14 @@ function Icon({ name, ...props }) {
124
124
 
125
125
  ### [2.0.0]
126
126
 
127
- Removed the `variant` concept; icons now resolve purely by name. The `variant` prop on `PixelIcon` and `DynamicPixelIcon` is gone, along with the `IconVariant`, `RegularIconName`, and `SolidIconName` type exports. Pass the full icon name instead: solid icons end in `-solid` (`heart-solid`), brand and category icons use their plain name (`github`, `business`).
127
+ Removed the `variant` concept; icons now resolve purely by name, along with the `IconVariant`, `RegularIconName`, and `SolidIconName` type exports. The `variant` prop on `PixelIcon` and `DynamicPixelIcon` is deprecated. Pass the full icon name instead: solid icons end in `-solid` (`heart-solid`), brand and category icons use their plain name (`github`, `business`).
128
128
 
129
129
  ```diff
130
130
  - <PixelIcon name="heart" variant="solid" />
131
131
  + <PixelIcon name="heart-solid" />
132
+
133
+ - <DynamicPixelIcon name="heart" variant="solid" />
134
+ + <DynamicPixelIcon name="heart-solid" />
132
135
  ```
133
136
 
134
137
  ## Credits
package/dist/index.cjs CHANGED
@@ -587,16 +587,30 @@ var jsxRuntime = require('react/jsx-runtime');
587
587
  function resolveIconName(name) {
588
588
  return chunkYUI4KOHQ_cjs.dynamicIconImports_default[name] ? name : void 0;
589
589
  }
590
+
591
+ // src/utils/warnOnce.ts
592
+ var warned = /* @__PURE__ */ new Set();
593
+ function warnOnce(message) {
594
+ if (typeof process !== "undefined" && process.env?.["NODE_ENV"] === "production") return;
595
+ if (warned.has(message)) return;
596
+ warned.add(message);
597
+ console.warn(message);
598
+ }
590
599
  var DEFAULT_SIZE = 24;
600
+ var VARIANT_DEPRECATION_MESSAGE = '[pixel-icon-library-react] The `variant` prop was removed in v2.0.0 and is ignored. Icons resolve by name only: use the full name (solid icons end in `-solid`), e.g. <PixelIcon name="heart-solid" /> instead of <PixelIcon name="heart" variant="solid" />.';
591
601
  function PixelIcon({
592
602
  name,
593
603
  size = DEFAULT_SIZE,
594
604
  title,
595
605
  fallback = null,
606
+ variant,
596
607
  ...rest
597
608
  }) {
598
609
  const [IconComponent, setIconComponent] = react.useState();
599
610
  const resolvedName = react.useMemo(() => resolveIconName(name), [name]);
611
+ react.useEffect(() => {
612
+ if (variant !== void 0) warnOnce(VARIANT_DEPRECATION_MESSAGE);
613
+ }, [variant]);
600
614
  react.useEffect(() => {
601
615
  let cancelled = false;
602
616
  if (!resolvedName) {
@@ -633,15 +647,20 @@ function PixelIcon({
633
647
  }
634
648
  var lazyCache = /* @__PURE__ */ new Map();
635
649
  var DEFAULT_SIZE2 = 24;
650
+ var VARIANT_DEPRECATION_MESSAGE2 = '[pixel-icon-library-react] The `variant` prop was removed in v2.0.0 and is ignored. Icons resolve by name only: use the full name (solid icons end in `-solid`), e.g. <DynamicPixelIcon name="heart-solid" /> instead of <DynamicPixelIcon name="heart" variant="solid" />.';
636
651
  var DynamicPixelIcon = ({
637
652
  name,
638
653
  size = DEFAULT_SIZE2,
639
654
  title,
640
655
  fallback = null,
656
+ variant,
641
657
  ...props
642
658
  }) => {
643
659
  const dimension = typeof size === "number" ? `${size}px` : size ?? `${DEFAULT_SIZE2}px`;
644
660
  const resolvedName = react.useMemo(() => resolveIconName(name), [name]);
661
+ react.useEffect(() => {
662
+ if (variant !== void 0) warnOnce(VARIANT_DEPRECATION_MESSAGE2);
663
+ }, [variant]);
645
664
  const LazyIcon = react.useMemo(() => {
646
665
  if (!resolvedName) return void 0;
647
666
  if (lazyCache.has(resolvedName)) return lazyCache.get(resolvedName);
package/dist/index.d.cts CHANGED
@@ -586,6 +586,12 @@ type PixelIconProps = SVGProps<SVGSVGElement> & {
586
586
  size?: number | string;
587
587
  title?: string;
588
588
  fallback?: ReactNode;
589
+ /**
590
+ * @deprecated Removed in v2.0.0 and ignored. Icons now resolve purely by name:
591
+ * pass the full name instead, e.g. `name="heart-solid"` rather than
592
+ * `name="heart" variant="solid"`.
593
+ */
594
+ variant?: 'regular' | 'solid';
589
595
  };
590
596
  /**
591
597
  * Resolves and renders a pixel icon by dynamically importing its module at runtime.
@@ -599,13 +605,19 @@ type PixelIconProps = SVGProps<SVGSVGElement> & {
599
605
  * @param props.title - Accessible label rendered as an SVG `<title>` element.
600
606
  * @param props.fallback - React node shown while the icon is loading. Defaults to null.
601
607
  */
602
- declare function PixelIcon({ name, size, title, fallback, ...rest }: PixelIconProps): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
608
+ declare function PixelIcon({ name, size, title, fallback, variant, ...rest }: PixelIconProps): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
603
609
 
604
610
  interface DynamicPixelIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
605
611
  name: IconName;
606
612
  size?: number | string;
607
613
  title?: string;
608
614
  fallback?: ReactNode;
615
+ /**
616
+ * @deprecated Removed in v2.0.0 and ignored. Icons now resolve purely by name:
617
+ * pass the full name instead, e.g. `name="heart-solid"` rather than
618
+ * `name="heart" variant="solid"`.
619
+ */
620
+ variant?: 'regular' | 'solid';
609
621
  }
610
622
  /**
611
623
  * Lazy-loads icon components on demand using `React.lazy` and `Suspense` for
@@ -619,7 +631,7 @@ interface DynamicPixelIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
619
631
  * @param props.title - Accessible label rendered as an SVG `<title>` element.
620
632
  * @param props.fallback - React node shown while the icon chunk is loading. Defaults to null.
621
633
  */
622
- declare const DynamicPixelIcon: ({ name, size, title, fallback, ...props }: DynamicPixelIconProps) => string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
634
+ declare const DynamicPixelIcon: ({ name, size, title, fallback, variant, ...props }: DynamicPixelIconProps) => string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
623
635
 
624
636
  /**
625
637
  * Minimal SVG element names supported by the icon set.
package/dist/index.d.ts CHANGED
@@ -586,6 +586,12 @@ type PixelIconProps = SVGProps<SVGSVGElement> & {
586
586
  size?: number | string;
587
587
  title?: string;
588
588
  fallback?: ReactNode;
589
+ /**
590
+ * @deprecated Removed in v2.0.0 and ignored. Icons now resolve purely by name:
591
+ * pass the full name instead, e.g. `name="heart-solid"` rather than
592
+ * `name="heart" variant="solid"`.
593
+ */
594
+ variant?: 'regular' | 'solid';
589
595
  };
590
596
  /**
591
597
  * Resolves and renders a pixel icon by dynamically importing its module at runtime.
@@ -599,13 +605,19 @@ type PixelIconProps = SVGProps<SVGSVGElement> & {
599
605
  * @param props.title - Accessible label rendered as an SVG `<title>` element.
600
606
  * @param props.fallback - React node shown while the icon is loading. Defaults to null.
601
607
  */
602
- declare function PixelIcon({ name, size, title, fallback, ...rest }: PixelIconProps): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
608
+ declare function PixelIcon({ name, size, title, fallback, variant, ...rest }: PixelIconProps): string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
603
609
 
604
610
  interface DynamicPixelIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
605
611
  name: IconName;
606
612
  size?: number | string;
607
613
  title?: string;
608
614
  fallback?: ReactNode;
615
+ /**
616
+ * @deprecated Removed in v2.0.0 and ignored. Icons now resolve purely by name:
617
+ * pass the full name instead, e.g. `name="heart-solid"` rather than
618
+ * `name="heart" variant="solid"`.
619
+ */
620
+ variant?: 'regular' | 'solid';
609
621
  }
610
622
  /**
611
623
  * Lazy-loads icon components on demand using `React.lazy` and `Suspense` for
@@ -619,7 +631,7 @@ interface DynamicPixelIconProps extends Omit<SVGProps<SVGSVGElement>, 'ref'> {
619
631
  * @param props.title - Accessible label rendered as an SVG `<title>` element.
620
632
  * @param props.fallback - React node shown while the icon chunk is loading. Defaults to null.
621
633
  */
622
- declare const DynamicPixelIcon: ({ name, size, title, fallback, ...props }: DynamicPixelIconProps) => string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
634
+ declare const DynamicPixelIcon: ({ name, size, title, fallback, variant, ...props }: DynamicPixelIconProps) => string | number | boolean | react_jsx_runtime.JSX.Element | Iterable<ReactNode> | null;
623
635
 
624
636
  /**
625
637
  * Minimal SVG element names supported by the icon set.
package/dist/index.js CHANGED
@@ -586,16 +586,30 @@ import { jsx } from 'react/jsx-runtime';
586
586
  function resolveIconName(name) {
587
587
  return dynamicIconImports_default[name] ? name : void 0;
588
588
  }
589
+
590
+ // src/utils/warnOnce.ts
591
+ var warned = /* @__PURE__ */ new Set();
592
+ function warnOnce(message) {
593
+ if (typeof process !== "undefined" && process.env?.["NODE_ENV"] === "production") return;
594
+ if (warned.has(message)) return;
595
+ warned.add(message);
596
+ console.warn(message);
597
+ }
589
598
  var DEFAULT_SIZE = 24;
599
+ var VARIANT_DEPRECATION_MESSAGE = '[pixel-icon-library-react] The `variant` prop was removed in v2.0.0 and is ignored. Icons resolve by name only: use the full name (solid icons end in `-solid`), e.g. <PixelIcon name="heart-solid" /> instead of <PixelIcon name="heart" variant="solid" />.';
590
600
  function PixelIcon({
591
601
  name,
592
602
  size = DEFAULT_SIZE,
593
603
  title,
594
604
  fallback = null,
605
+ variant,
595
606
  ...rest
596
607
  }) {
597
608
  const [IconComponent, setIconComponent] = useState();
598
609
  const resolvedName = useMemo(() => resolveIconName(name), [name]);
610
+ useEffect(() => {
611
+ if (variant !== void 0) warnOnce(VARIANT_DEPRECATION_MESSAGE);
612
+ }, [variant]);
599
613
  useEffect(() => {
600
614
  let cancelled = false;
601
615
  if (!resolvedName) {
@@ -632,15 +646,20 @@ function PixelIcon({
632
646
  }
633
647
  var lazyCache = /* @__PURE__ */ new Map();
634
648
  var DEFAULT_SIZE2 = 24;
649
+ var VARIANT_DEPRECATION_MESSAGE2 = '[pixel-icon-library-react] The `variant` prop was removed in v2.0.0 and is ignored. Icons resolve by name only: use the full name (solid icons end in `-solid`), e.g. <DynamicPixelIcon name="heart-solid" /> instead of <DynamicPixelIcon name="heart" variant="solid" />.';
635
650
  var DynamicPixelIcon = ({
636
651
  name,
637
652
  size = DEFAULT_SIZE2,
638
653
  title,
639
654
  fallback = null,
655
+ variant,
640
656
  ...props
641
657
  }) => {
642
658
  const dimension = typeof size === "number" ? `${size}px` : size ?? `${DEFAULT_SIZE2}px`;
643
659
  const resolvedName = useMemo(() => resolveIconName(name), [name]);
660
+ useEffect(() => {
661
+ if (variant !== void 0) warnOnce(VARIANT_DEPRECATION_MESSAGE2);
662
+ }, [variant]);
644
663
  const LazyIcon = useMemo(() => {
645
664
  if (!resolvedName) return void 0;
646
665
  if (lazyCache.has(resolvedName)) return lazyCache.get(resolvedName);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://json.schemastore.org/package",
3
3
  "name": "@2hoch1/pixel-icon-library-react",
4
- "version": "2.0.0",
4
+ "version": "2.0.1",
5
5
  "description": "React wrapper for the HackerNoon Pixel Icon Library.",
6
6
  "license": "MIT",
7
7
  "type": "module",