@salutejs/sdds-icons 0.2.0-next-sbcom.0 → 0.2.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.
package/README.md CHANGED
@@ -42,6 +42,12 @@ import { AddFillIcon as AddFillIcon36 } from '@salutejs/sdds-icons/36';
42
42
  <AddFillIcon width={32} height={32} color="tomato" />
43
43
  ```
44
44
 
45
+ В `color` также можно передать CSS-градиент. В этом случае контур иконки используется как маска, а градиент заполняет всю область иконки:
46
+
47
+ ```tsx
48
+ <AddFillIcon color="linear-gradient(135deg, #00d6ff 0%, #9b51e0 100%)" />
49
+ ```
50
+
45
51
  ## Динамические иконки
46
52
 
47
53
  Если имя иконки приходит во время выполнения, например из CMS или с сервера, используйте отдельную динамическую точку входа нужного размера:
@@ -92,7 +98,7 @@ svg/
92
98
  npm run build
93
99
  ```
94
100
 
95
- Временное дерево `build-temp` удаляется и после успешной сборки, и при ошибке. В `src` находятся только общие фабрики `createIcon16`, `createIcon24` и `createIcon36`: они задают размер, `viewBox`, поддержку `ref` и стандартных SVG-свойств. Единственным источником геометрии иконок остаются файлы в `svg`. SVGO оптимизирует SVG-разметку, а SVGR преобразует её в JSX; заполнения и обводки становятся `currentColor`.
101
+ Временное дерево `build-temp` удаляется и после успешной сборки, и при ошибке. В `src` находятся общая фабрика `createIcon` и размерные фабрики `createIcon16`, `createIcon24`, `createIcon36`: они задают размер, `viewBox`, поддержку `ref`, стандартных SVG-свойств и градиентного `color`. Единственным источником геометрии иконок остаются файлы в `svg`. SVGO оптимизирует SVG-разметку, а SVGR преобразует её в JSX; заполнения и обводки становятся `currentColor`.
96
102
 
97
103
  ### Android
98
104
 
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const AccessibilityIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
+ export default AccessibilityIcon;
@@ -0,0 +1,7 @@
1
+ // This file is generated. Do not edit it manually.
2
+ import React from 'react';
3
+ import { createIcon16 } from '../createIcon16.js';
4
+ export const AccessibilityIcon = /* @__PURE__ */ createIcon16(React.createElement(React.Fragment, null,
5
+ React.createElement("path", { fill: "currentColor", d: "M12 6.5A2.25 2.25 0 1 0 12 2a2.25 2.25 0 0 0 0 4.5" }),
6
+ React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M4.46 6.272a1 1 0 0 0-.42 1.956 48 48 0 0 0 4.045.705c.588.096.737.316.792.414.108.192.123.44.123.76V21a1 1 0 1 0 2 0v-3.45c0-1.038.19-1.55.359-1.78.123-.17.288-.27.641-.27s.519.1.641.27c.169.23.36.742.36 1.78V21a1 1 0 1 0 2 0V10.108c0-.322.015-.569.122-.76.055-.099.205-.32.793-.415l.215-.027a48 48 0 0 0 3.83-.678 1 1 0 0 0-.421-1.956 46 46 0 0 1-3.896.68 28.3 28.3 0 0 1-7.527-.031 46 46 0 0 1-3.657-.649", clipRule: "evenodd" })));
7
+ export default AccessibilityIcon;
@@ -1,4 +1,4 @@
1
1
  declare const dynamicIconImports: {
2
- readonly AddFillIcon: () => Promise<typeof import("./AddFillIcon.js")>;
2
+ readonly AccessibilityIcon: () => Promise<typeof import("./AccessibilityIcon.js")>;
3
3
  };
4
4
  export default dynamicIconImports;
@@ -1,5 +1,5 @@
1
1
  // This file is generated from svg/16. Do not edit it manually.
2
2
  const dynamicIconImports = {
3
- AddFillIcon: () => import('./AddFillIcon.js'),
3
+ AccessibilityIcon: () => import('./AccessibilityIcon.js'),
4
4
  };
5
5
  export default dynamicIconImports;
@@ -1 +1 @@
1
- export { AddFillIcon } from './AddFillIcon.js';
1
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
package/dist/16/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is generated from svg/16. Do not edit it manually.
2
- export { AddFillIcon } from './AddFillIcon.js';
2
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const AccessibilityIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
+ export default AccessibilityIcon;
@@ -0,0 +1,7 @@
1
+ // This file is generated. Do not edit it manually.
2
+ import React from 'react';
3
+ import { createIcon24 } from '../createIcon24.js';
4
+ export const AccessibilityIcon = /* @__PURE__ */ createIcon24(React.createElement(React.Fragment, null,
5
+ React.createElement("path", { fill: "currentColor", d: "M12 6.5A2.25 2.25 0 1 0 12 2a2.25 2.25 0 0 0 0 4.5" }),
6
+ React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M4.46 6.272a1 1 0 0 0-.42 1.956 48 48 0 0 0 4.045.705c.588.096.737.316.792.414.108.192.123.44.123.76V21a1 1 0 1 0 2 0v-3.45c0-1.038.19-1.55.359-1.78.123-.17.288-.27.641-.27s.519.1.641.27c.169.23.36.742.36 1.78V21a1 1 0 1 0 2 0V10.108c0-.322.015-.569.122-.76.055-.099.205-.32.793-.415l.215-.027a48 48 0 0 0 3.83-.678 1 1 0 0 0-.421-1.956 46 46 0 0 1-3.896.68 28.3 28.3 0 0 1-7.527-.031 46 46 0 0 1-3.657-.649", clipRule: "evenodd" })));
7
+ export default AccessibilityIcon;
@@ -1,4 +1,4 @@
1
1
  declare const dynamicIconImports: {
2
- readonly AddFillIcon: () => Promise<typeof import("./AddFillIcon.js")>;
2
+ readonly AccessibilityIcon: () => Promise<typeof import("./AccessibilityIcon.js")>;
3
3
  };
4
4
  export default dynamicIconImports;
@@ -1,5 +1,5 @@
1
1
  // This file is generated from svg/24. Do not edit it manually.
2
2
  const dynamicIconImports = {
3
- AddFillIcon: () => import('./AddFillIcon.js'),
3
+ AccessibilityIcon: () => import('./AccessibilityIcon.js'),
4
4
  };
5
5
  export default dynamicIconImports;
@@ -1 +1 @@
1
- export { AddFillIcon } from './AddFillIcon.js';
1
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
package/dist/24/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is generated from svg/24. Do not edit it manually.
2
- export { AddFillIcon } from './AddFillIcon.js';
2
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ export declare const AccessibilityIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
+ export default AccessibilityIcon;
@@ -0,0 +1,7 @@
1
+ // This file is generated. Do not edit it manually.
2
+ import React from 'react';
3
+ import { createIcon36 } from '../createIcon36.js';
4
+ export const AccessibilityIcon = /* @__PURE__ */ createIcon36(React.createElement(React.Fragment, null,
5
+ React.createElement("path", { fill: "currentColor", d: "M12 6.5A2.25 2.25 0 1 0 12 2a2.25 2.25 0 0 0 0 4.5" }),
6
+ React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M4.46 6.272a1 1 0 0 0-.42 1.956 48 48 0 0 0 4.045.705c.588.096.737.316.792.414.108.192.123.44.123.76V21a1 1 0 1 0 2 0v-3.45c0-1.038.19-1.55.359-1.78.123-.17.288-.27.641-.27s.519.1.641.27c.169.23.36.742.36 1.78V21a1 1 0 1 0 2 0V10.108c0-.322.015-.569.122-.76.055-.099.205-.32.793-.415l.215-.027a48 48 0 0 0 3.83-.678 1 1 0 0 0-.421-1.956 46 46 0 0 1-3.896.68 28.3 28.3 0 0 1-7.527-.031 46 46 0 0 1-3.657-.649", clipRule: "evenodd" })));
7
+ export default AccessibilityIcon;
@@ -1,4 +1,4 @@
1
1
  declare const dynamicIconImports: {
2
- readonly AddFillIcon: () => Promise<typeof import("./AddFillIcon.js")>;
2
+ readonly AccessibilityIcon: () => Promise<typeof import("./AccessibilityIcon.js")>;
3
3
  };
4
4
  export default dynamicIconImports;
@@ -1,5 +1,5 @@
1
1
  // This file is generated from svg/36. Do not edit it manually.
2
2
  const dynamicIconImports = {
3
- AddFillIcon: () => import('./AddFillIcon.js'),
3
+ AccessibilityIcon: () => import('./AccessibilityIcon.js'),
4
4
  };
5
5
  export default dynamicIconImports;
@@ -1 +1 @@
1
- export { AddFillIcon } from './AddFillIcon.js';
1
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
package/dist/36/index.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // This file is generated from svg/36. Do not edit it manually.
2
- export { AddFillIcon } from './AddFillIcon.js';
2
+ export { AccessibilityIcon } from './AccessibilityIcon.js';
@@ -0,0 +1,3 @@
1
+ import React from 'react';
2
+ import type { ReactNode } from 'react';
3
+ export declare const createIcon: (content: ReactNode, size: number) => React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
@@ -0,0 +1,20 @@
1
+ import React, { forwardRef, useRef } from 'react';
2
+ const isGradient = (color) => typeof color === 'string' && /gradient/.test(color);
3
+ let maskCounter = 0;
4
+ export const createIcon = (content, size) => {
5
+ return forwardRef(({ color, ...props }, ref) => {
6
+ const maskIdRef = useRef('');
7
+ if (!maskIdRef.current) {
8
+ maskIdRef.current = `sdds-icon-${maskCounter++}-${size}`;
9
+ }
10
+ const maskId = maskIdRef.current;
11
+ const gradient = isGradient(color);
12
+ return (React.createElement("svg", { ref: ref, width: size, height: size, viewBox: `0 0 ${size} ${size}`, fill: "none", xmlns: "http://www.w3.org/2000/svg", color: gradient ? undefined : color, ...props }, gradient ? (React.createElement(React.Fragment, null,
13
+ React.createElement("defs", null,
14
+ React.createElement("mask", { id: maskId },
15
+ React.createElement("g", { color: "white" }, content))),
16
+ React.createElement("g", { mask: `url(#${maskId})` },
17
+ React.createElement("foreignObject", { width: "100%", height: "100%" },
18
+ React.createElement("div", { style: { width: '100%', height: '100%', background: color } }))))) : (content)));
19
+ });
20
+ };
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { ReactNode } from 'react';
3
- export declare const createIcon16: (content: ReactNode) => React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
2
+ export declare const createIcon16: (content: ReactNode) => import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,2 +1,2 @@
1
- import React, { forwardRef } from 'react';
2
- export const createIcon16 = (content) => forwardRef((props, ref) => (React.createElement("svg", { ref: ref, width: 16, height: 16, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, content)));
1
+ import { createIcon } from './createIcon.js';
2
+ export const createIcon16 = (content) => createIcon(content, 16);
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { ReactNode } from 'react';
3
- export declare const createIcon24: (content: ReactNode) => React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
2
+ export declare const createIcon24: (content: ReactNode) => import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,2 +1,2 @@
1
- import React, { forwardRef } from 'react';
2
- export const createIcon24 = (content) => forwardRef((props, ref) => (React.createElement("svg", { ref: ref, width: 24, height: 24, viewBox: "0 0 24 24", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, content)));
1
+ import { createIcon } from './createIcon.js';
2
+ export const createIcon24 = (content) => createIcon(content, 24);
@@ -1,3 +1,2 @@
1
- import React from 'react';
2
1
  import type { ReactNode } from 'react';
3
- export declare const createIcon36: (content: ReactNode) => React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
2
+ export declare const createIcon36: (content: ReactNode) => import("react").ForwardRefExoticComponent<Omit<import("react").SVGProps<SVGSVGElement>, "ref"> & import("react").RefAttributes<SVGSVGElement>>;
@@ -1,2 +1,2 @@
1
- import React, { forwardRef } from 'react';
2
- export const createIcon36 = (content) => forwardRef((props, ref) => (React.createElement("svg", { ref: ref, width: 36, height: 36, viewBox: "0 0 36 36", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...props }, content)));
1
+ import { createIcon } from './createIcon.js';
2
+ export const createIcon36 = (content) => createIcon(content, 36);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salutejs/sdds-icons",
3
- "version": "0.2.0-next-sbcom.0",
3
+ "version": "0.2.0",
4
4
  "description": "SDDS icons",
5
5
  "author": "Salute Frontend Team <salute.developers@gmail.com>",
6
6
  "license": "MIT",
@@ -80,5 +80,5 @@
80
80
  "contributors": [
81
81
  "salute.developers@gmail.com"
82
82
  ],
83
- "gitHead": "24bceb36ff9e792411ee166bd57ccf5f938feb46"
83
+ "gitHead": "8adbf69d7ee75803b6d25b4a2e19f8ca16b29191"
84
84
  }
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const AddFillIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
- export default AddFillIcon;
@@ -1,7 +0,0 @@
1
- // This file is generated. Do not edit it manually.
2
- import React from 'react';
3
- import { createIcon16 } from '../createIcon16.js';
4
- export const AddFillIcon = /* @__PURE__ */ createIcon16(React.createElement(React.Fragment, null,
5
- React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M3.698 3.25c0-.966.783-1.75 1.75-1.75h7.304c.966 0 1.75.784 1.75 1.75v7.238a1.75 1.75 0 0 1-1.75 1.75H5.448a1.75 1.75 0 0 1-1.75-1.75zm5.401.434a.5.5 0 0 1 .5.5v2.184h2.2a.5.5 0 1 1 0 1H9.607l.029 2.178a.5.5 0 1 1-1 .013l-.03-2.191H6.399a.5.5 0 1 1 0-1H8.6V4.184a.5.5 0 0 1 .5-.5", clipRule: "evenodd" }),
6
- React.createElement("path", { fill: "currentColor", d: "M2.5 5.411a.5.5 0 0 0-1 0v6.84a2.25 2.25 0 0 0 2.25 2.25h6.893a.5.5 0 1 0 0-1H3.75c-.69 0-1.25-.56-1.25-1.25z" })));
7
- export default AddFillIcon;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const AddFillIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
- export default AddFillIcon;
@@ -1,7 +0,0 @@
1
- // This file is generated. Do not edit it manually.
2
- import React from 'react';
3
- import { createIcon24 } from '../createIcon24.js';
4
- export const AddFillIcon = /* @__PURE__ */ createIcon24(React.createElement(React.Fragment, null,
5
- React.createElement("path", { fill: "currentColor", d: "M5.226 19.482c.212.017.492.018.924.018h10.1a.75.75 0 0 1 0 1.5H6.121c-.395 0-.736 0-1.017-.023a2.3 2.3 0 0 1-.875-.222 2.25 2.25 0 0 1-.984-.983 2.3 2.3 0 0 1-.222-.876C3 18.616 3 18.274 3 17.88V7.75a.75.75 0 0 1 1.5 0v10.1c0 .432 0 .712.018.924.017.204.045.28.064.316a.75.75 0 0 0 .328.328c.037.02.112.047.316.064" }),
6
- React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M18.896 17.977c-.28.023-.622.023-1.017.023H9.12c-.395 0-.736 0-1.017-.023a2.3 2.3 0 0 1-.875-.222 2.25 2.25 0 0 1-.984-.983 2.3 2.3 0 0 1-.222-.876C6 15.616 6 15.274 6 14.88V6.12c0-.395 0-.736.023-1.017a2.3 2.3 0 0 1 .222-.875 2.25 2.25 0 0 1 .984-.984 2.3 2.3 0 0 1 .875-.222C8.384 3 8.726 3 9.12 3h8.758c.395 0 .736 0 1.017.023.297.024.592.078.875.222.424.216.768.56.984.984.144.283.198.578.222.875.023.28.023.622.023 1.017v8.758c0 .395 0 .736-.023 1.017a2.3 2.3 0 0 1-.222.875c-.216.424-.56.768-.983.984-.284.144-.58.198-.876.222M14.25 6.75a.75.75 0 0 0-1.5 0v3h-3a.75.75 0 0 0 0 1.5h3.01l.04 3.01a.75.75 0 1 0 1.5-.02l-.04-2.99h2.99a.75.75 0 0 0 0-1.5h-3z", clipRule: "evenodd" })));
7
- export default AddFillIcon;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- export declare const AddFillIcon: React.ForwardRefExoticComponent<Omit<React.SVGProps<SVGSVGElement>, "ref"> & React.RefAttributes<SVGSVGElement>>;
3
- export default AddFillIcon;
@@ -1,6 +0,0 @@
1
- // This file is generated. Do not edit it manually.
2
- import React from 'react';
3
- import { createIcon36 } from '../createIcon36.js';
4
- export const AddFillIcon = /* @__PURE__ */ createIcon36(React.createElement(React.Fragment, null,
5
- React.createElement("path", { fill: "currentColor", fillRule: "evenodd", d: "M8.725 7a3 3 0 0 1 3-3h17.277a3 3 0 0 1 3 3v17.278a3 3 0 0 1-3 3H11.725a3 3 0 0 1-3-3zm11.639 1.82a1 1 0 0 1 1 1v4.819h4.82a1 1 0 1 1 0 2h-4.807l.064 4.806a1 1 0 1 1-2 .026l-.064-4.832h-4.833a1 1 0 1 1 0-2h4.82v-4.82a1 1 0 0 1 1-1M6 11.45a1 1 0 1 0-2 0v16.553a4 4 0 0 0 4 4h17.485a1 1 0 0 0 0-2H8a2 2 0 0 1-2-2z", clipRule: "evenodd" })));
6
- export default AddFillIcon;