@clubmed/trident-icons 1.3.2-beta.1 → 1.3.2-beta.2

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 CHANGED
@@ -1,5 +1,12 @@
1
1
  # ClubMed React UI components changelog
2
2
 
3
+ ## [1.3.2-beta.2](https://scm.clubmed.com/clubmed/ui/trident-icons/compare/v1.3.2-beta.1...v1.3.2-beta.2) (2025-08-08)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+ * **icons:** enhance accessibility attributes for icon components ([f10e0a8](https://scm.clubmed.com/clubmed/ui/trident-icons/-/commit/f10e0a8e05d011bcb8522bc0188e548e591b6f4b))
9
+
3
10
  ## [1.3.2-beta.1](https://scm.clubmed.com/clubmed/ui/trident-icons/compare/v1.3.1...v1.3.2-beta.1) (2025-03-21)
4
11
 
5
12
 
@@ -1,7 +1,6 @@
1
- import { FunctionComponent, PropsWithChildren } from 'react';
1
+ import { AriaRole, ComponentPropsWithoutRef, FunctionComponent, PropsWithChildren } from 'react';
2
2
  import { IconOrientationProps } from '../hooks/useIconOrientation';
3
- import { CSS, Interpolation, SpringValue } from '@react-spring/web';
4
- export interface IconProps extends IconOrientationProps {
3
+ export interface IconProps extends IconOrientationProps, Omit<ComponentPropsWithoutRef<'span'>, 'role' | 'aria-label'> {
5
4
  name: string;
6
5
  type?: string;
7
6
  /**
@@ -12,16 +11,8 @@ export interface IconProps extends IconOrientationProps {
12
11
  * Color
13
12
  */
14
13
  color?: string;
15
- /**
16
- * Additional class names
17
- */
18
- className?: string;
19
- /**
20
- * Additional styles
21
- */
22
- style?: {
23
- [key: string]: string | number | SpringValue<string> | SpringValue<number> | Interpolation<string, string> | CSS.Properties;
24
- };
14
+ 'aria-label'?: string | null;
15
+ role?: AriaRole | null;
25
16
  }
26
17
  export type IconsRegistryValue<Props extends IconProps = IconProps> = IconResolverProps<Props> & {
27
18
  key: string;
@@ -1 +1 @@
1
- {"version":3,"file":"IconsContext.js","sources":["../../lib/contexts/IconsContext.tsx"],"sourcesContent":["import { createContext, type FunctionComponent, type PropsWithChildren, useState } from 'react';\nimport type { IconOrientationProps } from '@/hooks/useIconOrientation';\nimport type { CSS, Interpolation, SpringValue } from '@react-spring/web';\n\nexport interface IconProps extends IconOrientationProps {\n name: string;\n type?: string;\n /**\n * Width of the icon\n */\n width?: string | null;\n /**\n * Color\n */\n color?: string;\n /**\n * Additional class names\n */\n className?: string;\n /**\n * Additional styles\n */\n style?: {\n [key: string]:\n | string\n | number\n | SpringValue<string>\n | SpringValue<number>\n | Interpolation<string, string>\n | CSS.Properties;\n };\n}\n\nexport type IconsRegistryValue<Props extends IconProps = IconProps> = IconResolverProps<Props> & {\n key: string;\n};\n\nexport type IconResolverProps<Props extends IconProps = IconProps> = Props & {\n name: string;\n group?: string;\n withOrientation?: boolean;\n component: FunctionComponent<Props>;\n};\n\nexport const IconTypesRegistry = new Map<string, Map<string, IconsRegistryValue>>();\n\nfunction ucFirst(str: string | undefined) {\n return str ? str.charAt(0).toUpperCase() + str.slice(1) : '';\n}\n\nfunction registerIcon<Props extends IconProps = IconProps>(props: IconResolverProps<Props>) {\n const type = props.type || 'default';\n\n const registry = IconTypesRegistry.get(type) || new Map<string, IconsRegistryValue>();\n\n IconTypesRegistry.set(type, registry);\n\n const key = props.name + ucFirst(props.orientation);\n\n registry.set(key, { ...props, type, key } as unknown as IconsRegistryValue);\n}\n\nexport function loadIcons<Props extends IconProps = IconProps>(\n icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][],\n) {\n icons.flat().forEach((options) => {\n registerIcon<Props>(options as IconResolverProps<Props>);\n });\n\n return IconTypesRegistry;\n}\n\nexport const IconsContext = createContext<{\n locale?: string;\n container: Map<string, Map<string, IconsRegistryValue>>;\n updateContainer: (_: IconResolverProps[] | IconResolverProps[][]) => void;\n}>({\n locale: '',\n container: IconTypesRegistry,\n updateContainer: () => {},\n});\n\nexport function IconsProvider<Props extends IconProps = IconProps>({\n icons,\n locale,\n children,\n}: PropsWithChildren<{\n locale?: string;\n icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][];\n}>) {\n const [container, updateContainer] = useState(() => {\n return loadIcons(icons);\n });\n\n return (\n <IconsContext.Provider\n value={{\n locale,\n container,\n updateContainer: (icons) => {\n updateContainer(loadIcons(icons));\n },\n }}\n >\n {children}\n </IconsContext.Provider>\n );\n}\n"],"names":["IconTypesRegistry","ucFirst","str","registerIcon","props","type","registry","key","loadIcons","icons","options","IconsContext","createContext","IconsProvider","locale","children","container","updateContainer","useState","jsx"],"mappings":";;AA4Ca,MAAAA,wBAAwB,IAA6C;AAElF,SAASC,EAAQC,GAAyB;AACjC,SAAAA,IAAMA,EAAI,OAAO,CAAC,EAAE,YAAgB,IAAAA,EAAI,MAAM,CAAC,IAAI;AAC5D;AAEA,SAASC,EAAkDC,GAAiC;AACpF,QAAAC,IAAOD,EAAM,QAAQ,WAErBE,IAAWN,EAAkB,IAAIK,CAAI,yBAAS;AAElC,EAAAL,EAAA,IAAIK,GAAMC,CAAQ;AAEpC,QAAMC,IAAMH,EAAM,OAAOH,EAAQG,EAAM,WAAW;AAElD,EAAAE,EAAS,IAAIC,GAAK,EAAE,GAAGH,GAAO,MAAAC,GAAM,KAAAE,GAAsC;AAC5E;AAEO,SAASC,EACdC,GACA;AACA,SAAAA,EAAM,KAAK,EAAE,QAAQ,CAACC,MAAY;AAChC,IAAAP,EAAoBO,CAAmC;AAAA,EAAA,CACxD,GAEMV;AACT;AAEO,MAAMW,IAAeC,EAIzB;AAAA,EACD,QAAQ;AAAA,EACR,WAAWZ;AAAA,EACX,iBAAiB,MAAM;AAAA,EAAC;AAC1B,CAAC;AAEM,SAASa,EAAmD;AAAA,EACjE,OAAAJ;AAAA,EACA,QAAAK;AAAA,EACA,UAAAC;AACF,GAGI;AACF,QAAM,CAACC,GAAWC,CAAe,IAAIC,EAAS,MACrCV,EAAUC,CAAK,CACvB;AAGC,SAAA,gBAAAU;AAAA,IAACR,EAAa;AAAA,IAAb;AAAA,MACC,OAAO;AAAA,QACL,QAAAG;AAAA,QACA,WAAAE;AAAA,QACA,iBAAiB,CAACP,MAAU;AACV,UAAAQ,EAAAT,EAAUC,CAAK,CAAC;AAAA,QAClC;AAAA,MACF;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAAA;AAGP;"}
1
+ {"version":3,"file":"IconsContext.js","sources":["../../lib/contexts/IconsContext.tsx"],"sourcesContent":["import {\n type AriaRole,\n type ComponentPropsWithoutRef,\n createContext,\n type FunctionComponent,\n type PropsWithChildren,\n useState,\n} from 'react';\nimport type { IconOrientationProps } from '@/hooks/useIconOrientation';\n\nexport interface IconProps\n extends IconOrientationProps,\n Omit<ComponentPropsWithoutRef<'span'>, 'role' | 'aria-label'> {\n name: string;\n type?: string;\n /**\n * Width of the icon\n */\n width?: string | null;\n /**\n * Color\n */\n color?: string;\n 'aria-label'?: string | null;\n role?: AriaRole | null;\n}\n\nexport type IconsRegistryValue<Props extends IconProps = IconProps> = IconResolverProps<Props> & {\n key: string;\n};\n\nexport type IconResolverProps<Props extends IconProps = IconProps> = Props & {\n name: string;\n group?: string;\n withOrientation?: boolean;\n component: FunctionComponent<Props>;\n};\n\nexport const IconTypesRegistry = new Map<string, Map<string, IconsRegistryValue>>();\n\nfunction ucFirst(str: string | undefined) {\n return str ? str.charAt(0).toUpperCase() + str.slice(1) : '';\n}\n\nfunction registerIcon<Props extends IconProps = IconProps>(props: IconResolverProps<Props>) {\n const type = props.type || 'default';\n\n const registry = IconTypesRegistry.get(type) || new Map<string, IconsRegistryValue>();\n\n IconTypesRegistry.set(type, registry);\n\n const key = props.name + ucFirst(props.orientation);\n\n registry.set(key, { ...props, type, key } as unknown as IconsRegistryValue);\n}\n\nexport function loadIcons<Props extends IconProps = IconProps>(\n icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][],\n) {\n icons.flat().forEach((options) => {\n registerIcon<Props>(options as IconResolverProps<Props>);\n });\n\n return IconTypesRegistry;\n}\n\nexport const IconsContext = createContext<{\n locale?: string;\n container: Map<string, Map<string, IconsRegistryValue>>;\n updateContainer: (_: IconResolverProps[] | IconResolverProps[][]) => void;\n}>({\n locale: '',\n container: IconTypesRegistry,\n updateContainer: () => {},\n});\n\nexport function IconsProvider<Props extends IconProps = IconProps>({\n icons,\n locale,\n children,\n}: PropsWithChildren<{\n locale?: string;\n icons: IconResolverProps<Props>[] | IconResolverProps<Props>[][];\n}>) {\n const [container, updateContainer] = useState(() => {\n return loadIcons(icons);\n });\n\n return (\n <IconsContext.Provider\n value={{\n locale,\n container,\n updateContainer: (icons) => {\n updateContainer(loadIcons(icons));\n },\n }}\n >\n {children}\n </IconsContext.Provider>\n );\n}\n"],"names":["IconTypesRegistry","ucFirst","str","registerIcon","props","type","registry","key","loadIcons","icons","options","IconsContext","createContext","IconsProvider","locale","children","container","updateContainer","useState","jsx"],"mappings":";;AAsCa,MAAAA,wBAAwB,IAA6C;AAElF,SAASC,EAAQC,GAAyB;AACjC,SAAAA,IAAMA,EAAI,OAAO,CAAC,EAAE,YAAgB,IAAAA,EAAI,MAAM,CAAC,IAAI;AAC5D;AAEA,SAASC,EAAkDC,GAAiC;AACpF,QAAAC,IAAOD,EAAM,QAAQ,WAErBE,IAAWN,EAAkB,IAAIK,CAAI,yBAAS;AAElC,EAAAL,EAAA,IAAIK,GAAMC,CAAQ;AAEpC,QAAMC,IAAMH,EAAM,OAAOH,EAAQG,EAAM,WAAW;AAElD,EAAAE,EAAS,IAAIC,GAAK,EAAE,GAAGH,GAAO,MAAAC,GAAM,KAAAE,GAAsC;AAC5E;AAEO,SAASC,EACdC,GACA;AACA,SAAAA,EAAM,KAAK,EAAE,QAAQ,CAACC,MAAY;AAChC,IAAAP,EAAoBO,CAAmC;AAAA,EAAA,CACxD,GAEMV;AACT;AAEO,MAAMW,IAAeC,EAIzB;AAAA,EACD,QAAQ;AAAA,EACR,WAAWZ;AAAA,EACX,iBAAiB,MAAM;AAAA,EAAC;AAC1B,CAAC;AAEM,SAASa,EAAmD;AAAA,EACjE,OAAAJ;AAAA,EACA,QAAAK;AAAA,EACA,UAAAC;AACF,GAGI;AACF,QAAM,CAACC,GAAWC,CAAe,IAAIC,EAAS,MACrCV,EAAUC,CAAK,CACvB;AAGC,SAAA,gBAAAU;AAAA,IAACR,EAAa;AAAA,IAAb;AAAA,MACC,OAAO;AAAA,QACL,QAAAG;AAAA,QACA,WAAAE;AAAA,QACA,iBAAiB,CAACP,MAAU;AACV,UAAAQ,EAAAT,EAAUC,CAAK,CAAC;AAAA,QAClC;AAAA,MACF;AAAA,MAEC,UAAAM;AAAA,IAAA;AAAA,EAAA;AAGP;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@clubmed/trident-icons",
3
- "version": "1.3.2-beta.1",
3
+ "version": "1.3.2-beta.2",
4
4
  "type": "module",
5
5
  "description": "Shared ClubMed Icons library",
6
6
  "keywords": [
package/svg/SvgIcon.js CHANGED
@@ -1,35 +1,38 @@
1
- import { jsx as n } from "react/jsx-runtime";
2
- import { c as d } from "../chunks/index.js";
3
- import { Suspense as h } from "react";
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { c as h } from "../chunks/index.js";
3
+ import { Suspense as u } from "react";
4
4
  import { useIconOrientation as x } from "../hooks/useIconOrientation.js";
5
- function b(e) {
5
+ import { omit as g } from "../utils/omit.js";
6
+ function k(t) {
6
7
  const {
7
- name: o,
8
- className: i,
9
- width: t = "16px",
10
- color: s = "inherit",
11
- style: r,
8
+ name: n,
9
+ className: e,
10
+ width: i = "16px",
11
+ color: r = "inherit",
12
+ style: s,
12
13
  element: a,
13
- aspectRatio: c,
14
- viewBox: l
15
- } = e, { intrinsicClassName: m, transform: p } = x(e), f = `text-${s}`;
16
- return /* @__PURE__ */ n(
14
+ aspectRatio: m,
15
+ viewBox: c,
16
+ ...l
17
+ } = t, { intrinsicClassName: p, transform: f } = x(t), d = `text-${r}`;
18
+ return /* @__PURE__ */ o(
17
19
  "span",
18
20
  {
19
- className: d(
21
+ role: "presentation",
22
+ "aria-label": `Icon ${n}`,
23
+ ...g(l, ["group", "orientation", "type"]),
24
+ className: h(
20
25
  "inline-block shrink-0 align-middle",
21
- m,
22
- f,
23
- i
26
+ p,
27
+ d,
28
+ e
24
29
  ),
25
- style: { width: t, transform: p, aspectRatio: c, ...r },
26
- role: "presentation",
27
- "aria-label": `Icon ${o}`,
28
- children: /* @__PURE__ */ n(h, { children: /* @__PURE__ */ n(a, { viewBox: l }) })
30
+ style: { width: i, transform: f, aspectRatio: m, ...s },
31
+ children: /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o(a, { viewBox: c }) })
29
32
  }
30
33
  );
31
34
  }
32
35
  export {
33
- b as SvgIcon
36
+ k as SvgIcon
34
37
  };
35
38
  //# sourceMappingURL=SvgIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SvgIcon.js","sources":["../../lib/svg/SvgIcon.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type ComponentProps, type ComponentType, type LazyExoticComponent, Suspense } from 'react';\nimport type { IconProps } from '@/IconsResolver';\nimport { useIconOrientation } from '@/hooks/useIconOrientation';\n\ntype SvgComponent = ComponentType<ComponentProps<'svg'> & { title?: string }>;\n\nexport interface SvgIconProps extends IconProps {\n element: LazyExoticComponent<SvgComponent>;\n /**\n * default: '0 0 30 30',\n */\n viewBox?: string;\n /**\n * aspectRatio: 1\n */\n aspectRatio?: number;\n intrinsicRotation?: number;\n intrinsicClassName?: string;\n}\n\nexport function SvgIcon(props: SvgIconProps) {\n const {\n name,\n className,\n width = '16px',\n color = 'inherit',\n style,\n element: SVG,\n aspectRatio,\n viewBox,\n } = props;\n\n const { intrinsicClassName, transform } = useIconOrientation(props);\n const iconColor = `text-${color}`;\n\n return (\n <span\n className={classnames(\n 'inline-block shrink-0 align-middle',\n intrinsicClassName,\n iconColor,\n className,\n )}\n style={{ width: width!, transform, aspectRatio, ...style }}\n role=\"presentation\"\n aria-label={`Icon ${name}`}\n >\n <Suspense>\n <SVG viewBox={viewBox} />\n </Suspense>\n </span>\n );\n}\n"],"names":["SvgIcon","props","name","className","width","color","style","SVG","aspectRatio","viewBox","intrinsicClassName","transform","useIconOrientation","iconColor","jsx","classnames","Suspense"],"mappings":";;;;AAqBO,SAASA,EAAQC,GAAqB;AACrC,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,OAAAC,IAAQ;AAAA,IACR,OAAAC;AAAA,IACA,SAASC;AAAA,IACT,aAAAC;AAAA,IACA,SAAAC;AAAA,EACE,IAAAR,GAEE,EAAE,oBAAAS,GAAoB,WAAAC,EAAU,IAAIC,EAAmBX,CAAK,GAC5DY,IAAY,QAAQR,CAAK;AAG7B,SAAA,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAL;AAAA,QACAG;AAAA,QACAV;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAAC,GAAe,WAAAO,GAAW,aAAAH,GAAa,GAAGF,EAAM;AAAA,MACzD,MAAK;AAAA,MACL,cAAY,QAAQJ,CAAI;AAAA,MAExB,UAAC,gBAAAY,EAAAE,GAAA,EACC,UAAC,gBAAAF,EAAAP,GAAA,EAAI,SAAAE,EAAkB,CAAA,GACzB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"SvgIcon.js","sources":["../../lib/svg/SvgIcon.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport { type ComponentProps, type ComponentType, type LazyExoticComponent, Suspense } from 'react';\nimport type { IconProps } from '@/IconsResolver';\nimport { useIconOrientation } from '@/hooks/useIconOrientation';\nimport { omit } from '@/utils/omit';\n\ntype SvgComponent = ComponentType<ComponentProps<'svg'> & { title?: string }>;\n\nexport interface SvgIconProps extends IconProps {\n element: LazyExoticComponent<SvgComponent>;\n /**\n * default: '0 0 30 30',\n */\n viewBox?: string;\n /**\n * aspectRatio: 1\n */\n aspectRatio?: number;\n intrinsicRotation?: number;\n intrinsicClassName?: string;\n}\n\nexport function SvgIcon(props: SvgIconProps) {\n const {\n name,\n className,\n width = '16px',\n color = 'inherit',\n style,\n element: SVG,\n aspectRatio,\n viewBox,\n ...attrs\n } = props;\n\n const { intrinsicClassName, transform } = useIconOrientation(props);\n const iconColor = `text-${color}`;\n\n return (\n <span\n role=\"presentation\"\n aria-label={`Icon ${name}`}\n {...omit(attrs, ['group', 'orientation', 'type'])}\n className={classnames(\n 'inline-block shrink-0 align-middle',\n intrinsicClassName,\n iconColor,\n className,\n )}\n style={{ width: width!, transform, aspectRatio, ...style }}\n >\n <Suspense>\n <SVG viewBox={viewBox} />\n </Suspense>\n </span>\n );\n}\n"],"names":["SvgIcon","props","name","className","width","color","style","SVG","aspectRatio","viewBox","attrs","intrinsicClassName","transform","useIconOrientation","iconColor","jsx","omit","classnames","Suspense"],"mappings":";;;;;AAsBO,SAASA,EAAQC,GAAqB;AACrC,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,OAAAC,IAAQ;AAAA,IACR,OAAAC;AAAA,IACA,SAASC;AAAA,IACT,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAAT,GAEE,EAAE,oBAAAU,GAAoB,WAAAC,EAAU,IAAIC,EAAmBZ,CAAK,GAC5Da,IAAY,QAAQT,CAAK;AAG7B,SAAA,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAY,QAAQb,CAAI;AAAA,MACvB,GAAGc,EAAKN,GAAO,CAAC,SAAS,eAAe,MAAM,CAAC;AAAA,MAChD,WAAWO;AAAA,QACT;AAAA,QACAN;AAAA,QACAG;AAAA,QACAX;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAAC,GAAe,WAAAQ,GAAW,aAAAJ,GAAa,GAAGF,EAAM;AAAA,MAEzD,UAAC,gBAAAS,EAAAG,GAAA,EACC,UAAC,gBAAAH,EAAAR,GAAA,EAAI,SAAAE,EAAkB,CAAA,GACzB;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -1,34 +1,37 @@
1
- import { jsx as n } from "react/jsx-runtime";
1
+ import { jsx as o } from "react/jsx-runtime";
2
2
  import { c as x } from "../chunks/index.js";
3
3
  import { useIconOrientation as d } from "../hooks/useIconOrientation.js";
4
- function k(e) {
4
+ import { omit as h } from "../utils/omit.js";
5
+ function I(n) {
5
6
  const {
6
- name: i,
7
- className: o,
8
- width: s = "16px",
7
+ name: t,
8
+ className: i,
9
+ width: e = "16px",
9
10
  color: r = "inherit",
10
- style: t,
11
+ style: s,
11
12
  url: a,
12
13
  aspectRatio: l,
13
- viewBox: c
14
- } = e, { intrinsicClassName: m, transform: f } = d(e), p = `text-${r}`;
15
- return /* @__PURE__ */ n(
14
+ viewBox: c,
15
+ ...m
16
+ } = n, { intrinsicClassName: p, transform: f } = d(n), u = `text-${r}`;
17
+ return /* @__PURE__ */ o(
16
18
  "span",
17
19
  {
20
+ "aria-label": `Icon ${t}`,
21
+ role: "presentation",
22
+ ...h(m, ["group", "orientation", "type"]),
18
23
  className: x(
19
24
  "inline-block shrink-0 align-middle",
20
- m,
21
25
  p,
22
- o
26
+ u,
27
+ i
23
28
  ),
24
- style: { width: s, transform: f, aspectRatio: l, ...t },
25
- "aria-label": `Icon ${i}`,
26
- role: "presentation",
27
- children: /* @__PURE__ */ n("svg", { viewBox: c, children: /* @__PURE__ */ n("use", { xlinkHref: a }) })
29
+ style: { width: e, transform: f, aspectRatio: l, ...s },
30
+ children: /* @__PURE__ */ o("svg", { viewBox: c, children: /* @__PURE__ */ o("use", { xlinkHref: a }) })
28
31
  }
29
32
  );
30
33
  }
31
34
  export {
32
- k as SvgUseIcon
35
+ I as SvgUseIcon
33
36
  };
34
37
  //# sourceMappingURL=SvgUseIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SvgUseIcon.js","sources":["../../lib/svg-use/SvgUseIcon.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { IconProps } from '@/IconsResolver';\nimport { useIconOrientation } from '@/hooks/useIconOrientation';\n\nexport interface SvgUseIconProps extends IconProps {\n url: string;\n /**\n * default: '0 0 30 30',\n */\n viewBox?: string;\n /**\n * aspectRatio: 1\n */\n aspectRatio?: number;\n intrinsicRotation?: number;\n intrinsicClassName?: string;\n}\n\nexport function SvgUseIcon(props: SvgUseIconProps) {\n const {\n name,\n className,\n width = '16px',\n color = 'inherit',\n style,\n url,\n aspectRatio,\n viewBox,\n } = props;\n const { intrinsicClassName, transform } = useIconOrientation(props);\n\n const iconColor = `text-${color}`;\n\n return (\n <span\n className={classnames(\n 'inline-block shrink-0 align-middle',\n intrinsicClassName,\n iconColor,\n className,\n )}\n style={{ width: width!, transform, aspectRatio, ...style }}\n aria-label={`Icon ${name}`}\n role=\"presentation\"\n >\n <svg viewBox={viewBox}>\n <use xlinkHref={url} />\n </svg>\n </span>\n );\n}\n"],"names":["SvgUseIcon","props","name","className","width","color","style","url","aspectRatio","viewBox","intrinsicClassName","transform","useIconOrientation","iconColor","jsx","classnames"],"mappings":";;;AAkBO,SAASA,EAAWC,GAAwB;AAC3C,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,OAAAC,IAAQ;AAAA,IACR,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,EACE,IAAAR,GACE,EAAE,oBAAAS,GAAoB,WAAAC,EAAU,IAAIC,EAAmBX,CAAK,GAE5DY,IAAY,QAAQR,CAAK;AAG7B,SAAA,gBAAAS;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAWC;AAAA,QACT;AAAA,QACAL;AAAA,QACAG;AAAA,QACAV;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAAC,GAAe,WAAAO,GAAW,aAAAH,GAAa,GAAGF,EAAM;AAAA,MACzD,cAAY,QAAQJ,CAAI;AAAA,MACxB,MAAK;AAAA,MAEL,4BAAC,OAAI,EAAA,SAAAO,GACH,4BAAC,OAAI,EAAA,WAAWF,GAAK,EACvB,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"SvgUseIcon.js","sources":["../../lib/svg-use/SvgUseIcon.tsx"],"sourcesContent":["import classnames from 'classnames';\nimport type { IconProps } from '@/IconsResolver';\nimport { useIconOrientation } from '@/hooks/useIconOrientation';\nimport { omit } from '@/utils/omit';\n\nexport interface SvgUseIconProps extends IconProps {\n url: string;\n /**\n * default: '0 0 30 30',\n */\n viewBox?: string;\n /**\n * aspectRatio: 1\n */\n aspectRatio?: number;\n intrinsicRotation?: number;\n intrinsicClassName?: string;\n}\n\nexport function SvgUseIcon(props: SvgUseIconProps) {\n const {\n name,\n className,\n width = '16px',\n color = 'inherit',\n style,\n url,\n aspectRatio,\n viewBox,\n ...attrs\n } = props;\n const { intrinsicClassName, transform } = useIconOrientation(props);\n\n const iconColor = `text-${color}`;\n\n return (\n <span\n aria-label={`Icon ${name}`}\n role=\"presentation\"\n {...omit(attrs, ['group', 'orientation', 'type'])}\n className={classnames(\n 'inline-block shrink-0 align-middle',\n intrinsicClassName,\n iconColor,\n className,\n )}\n style={{ width: width!, transform, aspectRatio, ...style }}\n >\n <svg viewBox={viewBox}>\n <use xlinkHref={url} />\n </svg>\n </span>\n );\n}\n"],"names":["SvgUseIcon","props","name","className","width","color","style","url","aspectRatio","viewBox","attrs","intrinsicClassName","transform","useIconOrientation","iconColor","jsx","omit","classnames"],"mappings":";;;;AAmBO,SAASA,EAAWC,GAAwB;AAC3C,QAAA;AAAA,IACJ,MAAAC;AAAA,IACA,WAAAC;AAAA,IACA,OAAAC,IAAQ;AAAA,IACR,OAAAC,IAAQ;AAAA,IACR,OAAAC;AAAA,IACA,KAAAC;AAAA,IACA,aAAAC;AAAA,IACA,SAAAC;AAAA,IACA,GAAGC;AAAA,EACD,IAAAT,GACE,EAAE,oBAAAU,GAAoB,WAAAC,EAAU,IAAIC,EAAmBZ,CAAK,GAE5Da,IAAY,QAAQT,CAAK;AAG7B,SAAA,gBAAAU;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,cAAY,QAAQb,CAAI;AAAA,MACxB,MAAK;AAAA,MACJ,GAAGc,EAAKN,GAAO,CAAC,SAAS,eAAe,MAAM,CAAC;AAAA,MAChD,WAAWO;AAAA,QACT;AAAA,QACAN;AAAA,QACAG;AAAA,QACAX;AAAA,MACF;AAAA,MACA,OAAO,EAAE,OAAAC,GAAe,WAAAQ,GAAW,aAAAJ,GAAa,GAAGF,EAAM;AAAA,MAEzD,4BAAC,OAAI,EAAA,SAAAG,GACH,4BAAC,OAAI,EAAA,WAAWF,GAAK,EACvB,CAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
@@ -0,0 +1 @@
1
+ export declare function omit<T extends Record<string, unknown>, K extends keyof T>(obj: any, keys: K[]): Omit<T, K>;
package/utils/omit.js ADDED
@@ -0,0 +1,10 @@
1
+ function c(e, o) {
2
+ const n = {};
3
+ for (const t of Object.keys(e))
4
+ o.includes(t) || (n[t] = e[t]);
5
+ return n;
6
+ }
7
+ export {
8
+ c as omit
9
+ };
10
+ //# sourceMappingURL=omit.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"omit.js","sources":["../../lib/utils/omit.ts"],"sourcesContent":["export function omit<T extends Record<string, unknown>, K extends keyof T>(\n obj: any,\n keys: K[],\n): Omit<T, K> {\n const result: any = {};\n\n for (const key of Object.keys(obj)) {\n if (!keys.includes(key as K)) {\n result[key] = obj[key];\n }\n }\n\n return result;\n}\n"],"names":["omit","obj","keys","result","key"],"mappings":"AAAgB,SAAAA,EACdC,GACAC,GACY;AACZ,QAAMC,IAAc,CAAA;AAEpB,aAAWC,KAAO,OAAO,KAAKH,CAAG;AAC/B,IAAKC,EAAK,SAASE,CAAQ,MAClBD,EAAAC,CAAG,IAAIH,EAAIG,CAAG;AAIlB,SAAAD;AACT;"}