@atls-ui-generators/icons 1.1.5 → 1.1.8

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,41 @@
1
1
 
2
2
 
3
+ ## [1.1.8](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.1.6...@atls-ui-generators/icons@1.1.8) (2025-06-30)
4
+
5
+
6
+ ### Bug Fixes
7
+
8
+
9
+ * **icons:** generator template ([78c04b6](https://github.com/atls/hyperion/commit/78c04b6951a51f0bbcded17dd2da85082da9a49f))
10
+
11
+
12
+
13
+
14
+
15
+ ## [1.1.6](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.1.6...@atls-ui-generators/icons@1.1.6) (2025-06-30)
16
+
17
+
18
+ ### Bug Fixes
19
+
20
+
21
+ * **icons:** generator template ([78c04b6](https://github.com/atls/hyperion/commit/78c04b6951a51f0bbcded17dd2da85082da9a49f))
22
+
23
+
24
+
25
+
26
+
27
+ ## [1.1.6](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.1.5...@atls-ui-generators/icons@1.1.6) (2025-06-24)
28
+
29
+
30
+ ### Features
31
+
32
+
33
+ * **icons:** add added color extraction from theme via icon sprinkles ([2f37178](https://github.com/atls/hyperion/commit/2f37178dabc502d922db0172a75ae2c5da6e2a5c))
34
+
35
+
36
+
37
+
38
+
3
39
  ## [1.1.5](https://github.com/atls/hyperion/compare/@atls-ui-generators/icons@1.1.3...@atls-ui-generators/icons@1.1.5) (2025-04-29)
4
40
 
5
41
 
@@ -1,4 +1,3 @@
1
- import type { Config } from '@svgr/core';
2
1
  export interface Icon {
3
2
  name: string;
4
3
  source: string;
@@ -10,4 +9,3 @@ export interface Source {
10
9
  withReplacement: boolean;
11
10
  }
12
11
  export type Replacements = Record<string, Record<string, string>>;
13
- export type CreateSvgrTemplate = (withReplacement: boolean) => Config['template'];
@@ -10,10 +10,10 @@ export const testCases = [
10
10
  },
11
11
  expectedResult: {
12
12
  CircleIcon: {
13
- '#18181B': '{(color && vars.colors[color]) || color || "#18181B"}',
13
+ '#18181B': 'currentColor',
14
14
  },
15
15
  LeftIcon: {
16
- '#18181B': '{(color && vars.colors[color]) || color || "#18181B"}',
16
+ '#18181B': 'currentColor',
17
17
  },
18
18
  },
19
19
  },
@@ -24,13 +24,13 @@ export const testCases = [
24
24
  },
25
25
  expectedResult: {
26
26
  CircleIcon: {
27
- '#18181B': '{(color && vars.colors[color]) || color || "#18181B"}',
28
- '#000000': '{(color && vars.colors[color]) || color || "#000000"}',
27
+ '#18181B': 'currentColor',
28
+ '#000000': 'currentColor',
29
29
  },
30
30
  LeftIcon: {
31
- '#18181B': '{(color && vars.colors[color]) || color || "#18181B"}',
32
- '#000000': '{(color && vars.colors[color]) || color || "#000000"}',
33
- '#0000FF': '{(color && vars.colors[color]) || color || "#0000FF"}',
31
+ '#18181B': 'currentColor',
32
+ '#000000': 'currentColor',
33
+ '#0000FF': 'currentColor',
34
34
  },
35
35
  },
36
36
  },
@@ -1,5 +1,4 @@
1
1
  export interface GetColorReplacementOptions {
2
- themePaths?: Array<string>;
3
2
  color: string;
4
3
  }
5
4
  export type GetColorReplacement = (options: GetColorReplacementOptions) => Record<string, string>;
@@ -2,6 +2,6 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.getColorReplacement = void 0;
4
4
  const getColorReplacement = (options) => ({
5
- [options.color]: `{(color && vars.colors${(options.themePaths || []).reduce((str, prop) => `${str}.${prop}`, '')}[color]) || color || "${options.color}"}`,
5
+ [options.color]: `currentColor`,
6
6
  });
7
7
  exports.getColorReplacement = getColorReplacement;
@@ -1,3 +1,3 @@
1
1
  export const getColorReplacement = (options) => ({
2
- [options.color]: `{(color && vars.colors${(options.themePaths || []).reduce((str, prop) => `${str}.${prop}`, '')}[color]) || color || "${options.color}"}`,
2
+ [options.color]: `currentColor`,
3
3
  });
@@ -1,5 +1,5 @@
1
1
  import { transform } from '@svgr/core';
2
- const createSvgrTemplate = (withReplacement) => ({ jsx, componentName }, { tpl }) => tpl `
2
+ const svgrTemplate = ({ jsx, componentName }, { tpl }) => tpl `
3
3
  import type { IconProps } from '../icons.interfaces.js'
4
4
 
5
5
  import type { ReactNode } from 'react'
@@ -7,11 +7,9 @@ const createSvgrTemplate = (withReplacement) => ({ jsx, componentName }, { tpl }
7
7
  import React from 'react'
8
8
  import { clsx } from 'clsx'
9
9
 
10
- ${withReplacement ? `import { vars } from '@ui/theme'` : ''}
11
-
12
10
  import { iconSprinkles } from '../icon.css.js'
13
11
 
14
- export const ${componentName} = ({ color, ...props }: IconProps): ReactNode => {
12
+ export const ${componentName} = (props: IconProps): ReactNode => {
15
13
  const { className, style, otherProps } = iconSprinkles(props)
16
14
 
17
15
  const iconStyle = { ...style, ...otherProps.style }
@@ -26,13 +24,13 @@ export const compileIcons = async (icons, replacements) => Promise.all(icons.map
26
24
  code: await transform(icon.source.replace(/mask0/g, icon.name), {
27
25
  icon: true,
28
26
  typescript: true,
29
- template: createSvgrTemplate(Boolean(replacements[icon.name])),
27
+ template: svgrTemplate,
30
28
  plugins: ['@svgr/plugin-svgo', '@svgr/plugin-jsx', '@svgr/plugin-prettier'],
31
29
  svgProps: {
32
- className: `{clsx(className, typeof otherProps?.className === 'string' && otherProps.className)}`,
30
+ className: `{clsx(className, String(otherProps.className || ''))}`,
33
31
  style: '{iconStyle}',
34
32
  },
35
33
  replaceAttrValues: { ...replacements[icon.name] },
36
- }, { componentName: icon.name.replace('50+', 'FiftyPlus') }),
34
+ }, { componentName: icon.name.replace('50+', 'FiftyPlus') }).then((value) => value.replace('...props', '...otherProps')),
37
35
  withReplacement: Boolean(replacements[icon.name]),
38
36
  })));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atls-ui-generators/icons",
3
- "version": "1.1.5",
3
+ "version": "1.1.8",
4
4
  "license": "BSD-3-Clause",
5
5
  "type": "module",
6
6
  "exports": {