@linagora/twake-icons 2.6.0 → 2.6.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,3 +1,17 @@
1
+ ## @linagora/twake-icons [2.6.2](https://github.com/linagora/twake-ui/compare/@linagora/twake-icons@2.6.1...@linagora/twake-icons@2.6.2) (2026-06-22)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **twake-icons:** Mark styles module as side effect to prevent CSS tree-shaking ([29f86c8](https://github.com/linagora/twake-ui/commit/29f86c8dd724b94161d358df99b81d06b19bdc98))
7
+
8
+ ## @linagora/twake-icons [2.6.1](https://github.com/linagora/twake-ui/compare/@linagora/twake-icons@2.6.0...@linagora/twake-icons@2.6.1) (2026-06-22)
9
+
10
+
11
+ ### Bug Fixes
12
+
13
+ * **twake-icons:** Use css class instead of inline style ([b905906](https://github.com/linagora/twake-ui/commit/b90590622d2f0370560747b1a10e65835cce56e3))
14
+
1
15
  # @linagora/twake-icons [2.6.0](https://github.com/linagora/twake-ui/compare/@linagora/twake-icons@2.5.0...@linagora/twake-icons@2.6.0) (2026-06-22)
2
16
 
3
17
 
@@ -1,4 +1,5 @@
1
1
  import { type ComponentType, type ReactElement, type SVGAttributes } from 'react';
2
+ import './styles';
2
3
  export interface IconProps extends SVGAttributes<SVGSVGElement> {
3
4
  icon: string | ComponentType<SVGAttributes<SVGSVGElement>> | ReactElement;
4
5
  width?: number | string;
@@ -1,10 +1,6 @@
1
1
  import React from 'react';
2
- import { iconSpinStyle } from './styles';
2
+ import './styles';
3
3
  const DEFAULT_SIZE = '16';
4
- const iconStyle = {
5
- fill: 'currentColor',
6
- transform: 'translateZ(0)'
7
- };
8
4
  function makeSvgObject(icon) {
9
5
  const anchor = icon.startsWith('#') ? icon : `#${icon}`;
10
6
  function SvgObject(props) {
@@ -32,15 +28,16 @@ function Icon(props) {
32
28
  return (React.createElement("img", { src: icon, className: className, style: style, width: width || size || DEFAULT_SIZE, height: height || size || DEFAULT_SIZE, ...restProps }));
33
29
  const Svg = isFunction(icon) ? icon : makeSvgObject(icon);
34
30
  const _style = {
35
- ...iconStyle,
36
31
  ...style,
37
32
  ...(color ? { fill: color } : {}),
38
- ...(preserveColor ? { fill: 'inherit' } : {}),
39
- ...(rotate ? { transform: `rotate(${rotate}deg)` } : {}),
40
- ...(spin ? iconSpinStyle : {})
33
+ ...(rotate ? { transform: `rotate(${rotate}deg)` } : {})
41
34
  };
35
+ const baseClass = preserveColor ? 'twake-icon--preserveColor' : 'twake-icon';
36
+ const iconClass = [baseClass, spin && 'twake-icon--spin', className]
37
+ .filter(Boolean)
38
+ .join(' ');
42
39
  return Svg ? (
43
40
  // eslint-disable-next-line react-hooks/static-components
44
- React.createElement(Svg, { className: className, style: _style, width: width || size || DEFAULT_SIZE, height: height || size || DEFAULT_SIZE, ...restProps })) : null;
41
+ React.createElement(Svg, { className: iconClass, style: _style, width: width || size || DEFAULT_SIZE, height: height || size || DEFAULT_SIZE, ...restProps })) : null;
45
42
  }
46
43
  export default Icon;
@@ -1,2 +0,0 @@
1
- import { type CSSProperties } from 'react';
2
- export declare const iconSpinStyle: CSSProperties;
@@ -1,4 +1,4 @@
1
- // Inject spin keyframes once at module load (SSR-safe)
1
+ "use strict";
2
2
  if (typeof document !== 'undefined') {
3
3
  const style = document.createElement('style');
4
4
  style.textContent = `
@@ -6,9 +6,9 @@ if (typeof document !== 'undefined') {
6
6
  from { transform: rotate(0deg) translateZ(0); }
7
7
  to { transform: rotate(360deg) translateZ(0); }
8
8
  }
9
+ .twake-icon { fill: currentColor; transform: translateZ(0); }
10
+ .twake-icon--preserveColor { fill: inherit; }
11
+ .twake-icon--spin { animation: twake-icon-spin 1s linear infinite; }
9
12
  `;
10
13
  document.head.appendChild(style);
11
14
  }
12
- export const iconSpinStyle = {
13
- animation: 'twake-icon-spin 1s linear infinite'
14
- };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@linagora/twake-icons",
3
3
  "type": "module",
4
- "version": "2.6.0",
4
+ "version": "2.6.2",
5
5
  "description": "Icon library for Twake applications — SVG icons and illustrations",
6
6
  "author": "Twake",
7
7
  "license": "MIT",
@@ -27,7 +27,9 @@
27
27
  },
28
28
  "main": "dist/index.js",
29
29
  "types": "dist/index.d.ts",
30
- "sideEffects": false,
30
+ "sideEffects": [
31
+ "dist/Icon/styles.js"
32
+ ],
31
33
  "files": [
32
34
  "dist",
33
35
  "README.md",