@pdfme/ui 5.2.15-dev.2 → 5.2.16-dev.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pdfme/ui",
3
- "version": "5.2.15-dev.2",
3
+ "version": "5.2.16-dev.2",
4
4
  "sideEffects": false,
5
5
  "author": "hand-dot",
6
6
  "license": "MIT",
@@ -1,7 +1,6 @@
1
- import { Button, Form } from 'antd';
1
+ import { Button, Form, theme } from 'antd';
2
2
  import React from 'react';
3
3
  import type { PropPanelWidgetProps, SchemaForUI } from '@pdfme/common';
4
-
5
4
  interface ButtonConfig {
6
5
  key: string;
7
6
  icon: string;
@@ -11,6 +10,7 @@ interface ButtonConfig {
11
10
 
12
11
  const ButtonGroupWidget = (props: PropPanelWidgetProps) => {
13
12
  const { activeElements, changeSchemas, schemas, schema } = props;
13
+ const { token } = theme.useToken();
14
14
 
15
15
  const apply = (btn: ButtonConfig) => {
16
16
  const key = btn.key;
@@ -38,8 +38,13 @@ const ButtonGroupWidget = (props: PropPanelWidgetProps) => {
38
38
  return active;
39
39
  };
40
40
 
41
+ const replaceCurrentColor = (svgString: string, color?: string) =>
42
+ color ? svgString.replace(/="currentColor"/g, `="${color}"`) : svgString;
43
+
41
44
  const svgIcon = (svgString: string) => {
42
- const svgDataUrl = `data:image/svg+xml;utf8,${encodeURIComponent(svgString)}`;
45
+ const svgDataUrl = `data:image/svg+xml;utf8,${encodeURIComponent(
46
+ replaceCurrentColor(svgString, token.colorText)
47
+ )}`;
43
48
  return <img width={17} height={17} src={svgDataUrl} />;
44
49
  };
45
50