@coveord/plasma-react-icons 56.3.2 → 56.4.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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mock/index.tsx"],"names":[],"mappings":";AA0CA,wBAAsC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mock/index.tsx"],"names":[],"mappings":";AA8CA,wBAAsC"}
@@ -21,15 +21,18 @@ var _MockUtils = require("./MockUtils");
21
21
  get: function(obj, prop) {
22
22
  if (prop.startsWith('Icon')) {
23
23
  var TablerIconMock = /*#__PURE__*/ (0, _react.forwardRef)(function(_param, ref) {
24
- var height = _param.height, width = _param.width, others = _object_without_properties._(_param, [
24
+ var height = _param.height, width = _param.width, className = _param.className, others = _object_without_properties._(_param, [
25
25
  "height",
26
- "width"
26
+ "width",
27
+ "className"
27
28
  ]);
29
+ var tablerClassName = _MockUtils.MockUtils.formatToTablerClassName(prop);
30
+ var combinedClassName = className ? "".concat(tablerClassName, " ").concat(className) : tablerClassName;
28
31
  return /*#__PURE__*/ (0, _jsxruntime.jsx)("svg", _object_spread._({
29
32
  ref: ref,
30
33
  width: width || height || '1em',
31
34
  height: height || width || '1em',
32
- className: _MockUtils.MockUtils.formatToTablerClassName(prop)
35
+ className: combinedClassName
33
36
  }, others));
34
37
  });
35
38
  TablerIconMock.displayName = prop;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/mock/index.tsx"],"sourcesContent":["import {forwardRef, type SVGProps} from 'react';\nimport {MockUtils} from './MockUtils';\n\n/**\n * You can use the following mock in jest to avoid loading the actual icons during tests, it can slow down your tests if you don't.\n * Just add the following entry to your moduleNameMappter config\n * '^@coveord/plasma-react-icons$': '<rootDir>/node_modules/@coveord/plasma-react-icons/mock',\n */\n\nconst handler = {\n get: (obj: any, prop: string) => {\n if (prop.startsWith('Icon')) {\n const TablerIconMock = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n ({height, width, ...others}, ref) => (\n <svg\n ref={ref}\n width={width || height || '1em'}\n height={height || width || '1em'}\n className={MockUtils.formatToTablerClassName(prop)}\n {...others}\n />\n ),\n );\n TablerIconMock.displayName = prop;\n return TablerIconMock;\n }\n\n const IconMock = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(({height, width, ...others}, ref) => (\n <svg\n ref={ref}\n role=\"img\"\n aria-label={MockUtils.formatLabel(prop)}\n width={width || height || '1em'}\n height={height || width || '1em'}\n {...others}\n />\n ));\n IconMock.displayName = prop;\n return IconMock;\n },\n};\n\nexport default new Proxy({}, handler);\n"],"names":["handler","get","obj","prop","startsWith","TablerIconMock","forwardRef","ref","height","width","others","svg","className","MockUtils","formatToTablerClassName","displayName","IconMock","role","aria-label","formatLabel","Proxy"],"mappings":";;;;+BA0CA;;;eAAA;;;;;;qBA1CwC;yBAChB;AAExB;;;;CAIC,GAED,IAAMA,UAAU;IACZC,KAAK,SAACC,KAAUC;QACZ,IAAIA,KAAKC,UAAU,CAAC,SAAS;YACzB,IAAMC,+BAAiBC,IAAAA,iBAAU,EAC7B,iBAA6BC;oBAA3BC,gBAAAA,QAAQC,eAAAA,OAAUC;oBAAlBF;oBAAQC;;qCACN,qBAACE;oBACGJ,KAAKA;oBACLE,OAAOA,SAASD,UAAU;oBAC1BA,QAAQA,UAAUC,SAAS;oBAC3BG,WAAWC,oBAAS,CAACC,uBAAuB,CAACX;mBACzCO;;YAIhBL,eAAeU,WAAW,GAAGZ;YAC7B,OAAOE;QACX;QAEA,IAAMW,yBAAWV,IAAAA,iBAAU,EAAyC,iBAA6BC;gBAA3BC,gBAAAA,QAAQC,eAAAA,OAAUC;gBAAlBF;gBAAQC;;iCAC1E,qBAACE;gBACGJ,KAAKA;gBACLU,MAAK;gBACLC,cAAYL,oBAAS,CAACM,WAAW,CAAChB;gBAClCM,OAAOA,SAASD,UAAU;gBAC1BA,QAAQA,UAAUC,SAAS;eACvBC;;QAGZM,SAASD,WAAW,GAAGZ;QACvB,OAAOa;IACX;AACJ;IAEA,WAAe,IAAII,MAAM,CAAC,GAAGpB"}
1
+ {"version":3,"sources":["../../../src/mock/index.tsx"],"sourcesContent":["import {forwardRef, type SVGProps} from 'react';\nimport {MockUtils} from './MockUtils';\n\n/**\n * You can use the following mock in jest to avoid loading the actual icons during tests, it can slow down your tests if you don't.\n * Just add the following entry to your moduleNameMappter config\n * '^@coveord/plasma-react-icons$': '<rootDir>/node_modules/@coveord/plasma-react-icons/mock',\n */\n\nconst handler = {\n get: (obj: any, prop: string) => {\n if (prop.startsWith('Icon')) {\n const TablerIconMock = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(\n ({height, width, className, ...others}, ref) => {\n const tablerClassName = MockUtils.formatToTablerClassName(prop);\n const combinedClassName = className ? `${tablerClassName} ${className}` : tablerClassName;\n return (\n <svg\n ref={ref}\n width={width || height || '1em'}\n height={height || width || '1em'}\n className={combinedClassName}\n {...others}\n />\n );\n },\n );\n TablerIconMock.displayName = prop;\n return TablerIconMock;\n }\n\n const IconMock = forwardRef<SVGSVGElement, SVGProps<SVGSVGElement>>(({height, width, ...others}, ref) => (\n <svg\n ref={ref}\n role=\"img\"\n aria-label={MockUtils.formatLabel(prop)}\n width={width || height || '1em'}\n height={height || width || '1em'}\n {...others}\n />\n ));\n IconMock.displayName = prop;\n return IconMock;\n },\n};\n\nexport default new Proxy({}, handler);\n"],"names":["handler","get","obj","prop","startsWith","TablerIconMock","forwardRef","ref","height","width","className","others","tablerClassName","MockUtils","formatToTablerClassName","combinedClassName","svg","displayName","IconMock","role","aria-label","formatLabel","Proxy"],"mappings":";;;;+BA8CA;;;eAAA;;;;;;qBA9CwC;yBAChB;AAExB;;;;CAIC,GAED,IAAMA,UAAU;IACZC,KAAK,SAACC,KAAUC;QACZ,IAAIA,KAAKC,UAAU,CAAC,SAAS;YACzB,IAAMC,+BAAiBC,IAAAA,iBAAU,EAC7B,iBAAwCC;oBAAtCC,gBAAAA,QAAQC,eAAAA,OAAOC,mBAAAA,WAAcC;oBAA7BH;oBAAQC;oBAAOC;;gBACb,IAAME,kBAAkBC,oBAAS,CAACC,uBAAuB,CAACX;gBAC1D,IAAMY,oBAAoBL,YAAY,AAAC,GAAqBA,OAAnBE,iBAAgB,KAAa,OAAVF,aAAcE;gBAC1E,qBACI,qBAACI;oBACGT,KAAKA;oBACLE,OAAOA,SAASD,UAAU;oBAC1BA,QAAQA,UAAUC,SAAS;oBAC3BC,WAAWK;mBACPJ;YAGhB;YAEJN,eAAeY,WAAW,GAAGd;YAC7B,OAAOE;QACX;QAEA,IAAMa,yBAAWZ,IAAAA,iBAAU,EAAyC,iBAA6BC;gBAA3BC,gBAAAA,QAAQC,eAAAA,OAAUE;gBAAlBH;gBAAQC;;iCAC1E,qBAACO;gBACGT,KAAKA;gBACLY,MAAK;gBACLC,cAAYP,oBAAS,CAACQ,WAAW,CAAClB;gBAClCM,OAAOA,SAASD,UAAU;gBAC1BA,QAAQA,UAAUC,SAAS;eACvBE;;QAGZO,SAASD,WAAW,GAAGd;QACvB,OAAOe;IACX;AACJ;IAEA,WAAe,IAAII,MAAM,CAAC,GAAGtB"}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/vite-plugin/index.ts"],"sourcesContent":["import type {Plugin} from 'vite';\n\n/**\n * Vitest plugin to mock @coveord/plasma-react-icons with the mock version.\n * The mock uses a Proxy that dynamically generates icon components based on the property name.\n * This plugin transforms named imports into property access on the default import.\n */\nconst plasmaIconsMockPlugin = () =>\n ({\n name: 'coveord/plasma-react-icons/mock',\n enforce: 'pre',\n transform: (code: string, id: string) => {\n // Only transform relevant files (e.g., .ts, .tsx, .js, .jsx) that import from @coveord/plasma-react-icons and aren't in node_modules\n if (\n !code.includes('@coveord/plasma-react-icons') ||\n id.includes('/node_modules/') ||\n !/\\.(ts|tsx|js|jsx)$/.test(id)\n ) {\n return null;\n }\n\n // Transform named imports to default import + destructuring\n // e.g., import { ArrowUpSize16Px, IconHome } from '@coveord/plasma-react-icons'\n // becomes:\n // import __plasmaIcons from '@coveord/plasma-react-icons/mock';\n // const ArrowUpSize16Px = __plasmaIcons.ArrowUpSize16Px;\n // const IconHome = __plasmaIcons.IconHome;\n const namedImportRegex = /import\\s+(?!type\\b)\\{([^}]+)}\\s+from\\s+['\"]@coveord\\/plasma-react-icons['\"];?/g;\n\n let transformedCode = code;\n const imports: string[] = [];\n\n // Collect all matches first to avoid issues with regex state and string mutation\n const matches = Array.from(code.matchAll(namedImportRegex));\n for (const match of matches) {\n // Extra safety: skip if this is a type-only import (shouldn't match, but just in case)\n if (/import\\s+type\\s*\\{/.test(match[0])) {\n continue;\n }\n\n const importedNames = match[1]\n .split(',')\n .map((name) => name.trim())\n .filter((name) => !name.startsWith('type ')) // avoid type-only imports\n .filter((name) => name);\n\n imports.push(...importedNames);\n\n // Remove the original import\n transformedCode = transformedCode.replace(match[0], '');\n }\n\n if (imports.length > 0) {\n // Add the default import and const declarations at the top\n const mockImport = `import __plasmaIconsMock from '@coveord/plasma-react-icons/mock';\\n`;\n const constDeclarations = imports\n .map((name) => `const ${name} = __plasmaIconsMock.${name};`)\n .join('\\n');\n transformedCode = mockImport + constDeclarations + '\\n' + transformedCode;\n\n return {\n code: transformedCode,\n map: null,\n };\n }\n\n return null;\n },\n }) satisfies Plugin;\n\nexport default plasmaIconsMockPlugin;\n"],"names":["plasmaIconsMockPlugin","name","enforce","transform","code","id","includes","test","namedImportRegex","transformedCode","imports","matches","Array","from","matchAll","match","importedNames","split","map","trim","filter","startsWith","push","replace","length","mockImport","constDeclarations","join"],"mappings":";;;;+BAsEA;;;eAAA;;;;AApEA;;;;CAIC,GACD,IAAMA,wBAAwB;WACzB;QACGC,MAAM;QACNC,SAAS;QACTC,WAAW,SAACC,MAAcC;YACtB,qIAAqI;YACrI,IACI,CAACD,KAAKE,QAAQ,CAAC,kCACfD,GAAGC,QAAQ,CAAC,qBACZ,CAAC,qBAAqBC,IAAI,CAACF,KAC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B"}
1
+ {"version":3,"sources":["../../../src/vite-plugin/index.ts"],"sourcesContent":["import type {Plugin} from 'vite';\n\n/**\n * Vitest plugin to mock @coveord/plasma-react-icons with the mock version.\n * The mock uses a Proxy that dynamically generates icon components based on the property name.\n * This plugin transforms named imports into property access on the default import.\n */\nconst plasmaIconsMockPlugin = () =>\n ({\n name: 'coveord/plasma-react-icons/mock',\n enforce: 'pre',\n transform: (code: string, id: string) => {\n // Only transform relevant files (e.g., .ts, .tsx, .js, .jsx) that import from @coveord/plasma-react-icons and aren't in node_modules\n if (\n !code.includes('@coveord/plasma-react-icons') ||\n id.includes('/node_modules/') ||\n !/\\.(ts|tsx|js|jsx)$/.test(id)\n ) {\n return null;\n }\n\n // Transform named imports to default import + destructuring\n // e.g., import { ArrowUpSize16Px, IconHome } from '@coveord/plasma-react-icons'\n // becomes:\n // import __plasmaIcons from '@coveord/plasma-react-icons/mock';\n // const ArrowUpSize16Px = __plasmaIcons.ArrowUpSize16Px;\n // const IconHome = __plasmaIcons.IconHome;\n const namedImportRegex = /import\\s+(?!type\\b)\\{([^}]+)}\\s+from\\s+['\"]@coveord\\/plasma-react-icons['\"];?/g;\n\n let transformedCode = code;\n const imports: string[] = [];\n\n // Collect all matches first to avoid issues with regex state and string mutation\n const matches = Array.from(code.matchAll(namedImportRegex));\n for (const match of matches) {\n // Extra safety: skip if this is a type-only import (shouldn't match, but just in case)\n if (/import\\s+type\\s*\\{/.test(match[0])) {\n continue;\n }\n\n const importedNames = match[1]\n .split(',')\n .map((name) => name.trim())\n .filter((name) => !name.startsWith('type ')) // avoid type-only imports\n .filter((name) => name);\n\n imports.push(...importedNames);\n\n // Remove the original import\n transformedCode = transformedCode.replace(match[0], '');\n }\n\n if (imports.length > 0) {\n // Add the default import and const declarations at the top\n const mockImport = `import __plasmaIconsMock from '@coveord/plasma-react-icons/mock';\\n`;\n const constDeclarations = imports\n .map((name) => `const ${name} = __plasmaIconsMock.${name};`)\n .join('\\n');\n transformedCode = mockImport + constDeclarations + '\\n' + transformedCode;\n\n return {\n code: transformedCode,\n map: null,\n };\n }\n\n return null;\n },\n }) satisfies Plugin;\n\nexport default plasmaIconsMockPlugin;\n"],"names":["plasmaIconsMockPlugin","name","enforce","transform","code","id","includes","test","namedImportRegex","transformedCode","imports","matches","Array","from","matchAll","match","importedNames","split","map","trim","filter","startsWith","push","replace","length","mockImport","constDeclarations","join"],"mappings":";;;;+BAsEA;;;eAAA;;;;AApEA;;;;CAIC,GACD,IAAMA,wBAAwB;WACzB;QACGC,MAAM;QACNC,SAAS;QACTC,WAAW,SAACC,MAAcC;YACtB,qIAAqI;YACrI,IACI,CAACD,KAAKE,QAAQ,CAAC,kCACfD,GAAGC,QAAQ,CAAC,qBACZ,CAAC,qBAAqBC,IAAI,CAACF,KAC7B;gBACE,OAAO;YACX;YAEA,4DAA4D;YAC5D,gFAAgF;YAChF,WAAW;YACX,gEAAgE;YAChE,yDAAyD;YACzD,2CAA2C;YAC3C,IAAMG,mBAAmB;YAEzB,IAAIC,kBAAkBL;YACtB,IAAMM,UAAoB,EAAE;YAE5B,iFAAiF;YACjF,IAAMC,UAAUC,MAAMC,IAAI,CAACT,KAAKU,QAAQ,CAACN;gBACpC,kCAAA,2BAAA;;gBAAL,QAAK,YAAeG,4BAAf,SAAA,6BAAA,QAAA,yBAAA,iCAAwB;oBAAxB,IAAMI,QAAN;wBAYDL;oBAXA,uFAAuF;oBACvF,IAAI,qBAAqBH,IAAI,CAACQ,KAAK,CAAC,EAAE,GAAG;wBACrC;oBACJ;oBAEA,IAAMC,gBAAgBD,KAAK,CAAC,EAAE,CACzBE,KAAK,CAAC,KACNC,GAAG,CAAC,SAACjB;+BAASA,KAAKkB,IAAI;uBACvBC,MAAM,CAAC,SAACnB;+BAAS,CAACA,KAAKoB,UAAU,CAAC;uBAAU,0BAA0B;qBACtED,MAAM,CAAC,SAACnB;+BAASA;;oBAEtBS,CAAAA,WAAAA,SAAQY,IAAI,OAAZZ,UAAa,uBAAGM;oBAEhB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