@descope/flow-components 2.0.140 → 2.0.142

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/dist/index.cjs.js CHANGED
@@ -101,8 +101,16 @@ var icons = /*#__PURE__*/Object.freeze({
101
101
  sso: sso
102
102
  });
103
103
 
104
+ const isImageSource = (src) => src.startsWith('data:image') || src.startsWith('http');
105
+
104
106
  const Button = React__default.default.forwardRef(({ children, startIcon, startIconColorText, color, ...props }, ref) => {
105
- const icon = React.useMemo(() => icons[startIcon]?.({ noColor: startIconColorText }), [startIcon, startIconColorText]);
107
+ const icon = React.useMemo(() => {
108
+ if (!startIcon)
109
+ return undefined;
110
+ if (isImageSource(startIcon))
111
+ return (React__default.default.createElement("img", { src: startIcon, alt: props.name, style: { height: '1.5em', width: '1.5em' } }));
112
+ return icons[startIcon]?.({ noColor: startIconColorText });
113
+ }, [startIcon, props.name, startIconColorText]);
106
114
  const isSquare = React.useMemo(() => !!(icon && !children), [icon, children]);
107
115
  return (React__default.default.createElement("descope-button", { ...props, mode: color, ref: ref, square: isSquare },
108
116
  icon,
package/dist/index.esm.js CHANGED
@@ -95,8 +95,16 @@ var icons = /*#__PURE__*/Object.freeze({
95
95
  sso: sso
96
96
  });
97
97
 
98
+ const isImageSource = (src) => src.startsWith('data:image') || src.startsWith('http');
99
+
98
100
  const Button = React.forwardRef(({ children, startIcon, startIconColorText, color, ...props }, ref) => {
99
- const icon = useMemo(() => icons[startIcon]?.({ noColor: startIconColorText }), [startIcon, startIconColorText]);
101
+ const icon = useMemo(() => {
102
+ if (!startIcon)
103
+ return undefined;
104
+ if (isImageSource(startIcon))
105
+ return (React.createElement("img", { src: startIcon, alt: props.name, style: { height: '1.5em', width: '1.5em' } }));
106
+ return icons[startIcon]?.({ noColor: startIconColorText });
107
+ }, [startIcon, props.name, startIconColorText]);
100
108
  const isSquare = useMemo(() => !!(icon && !children), [icon, children]);
101
109
  return (React.createElement("descope-button", { ...props, mode: color, ref: ref, square: isSquare },
102
110
  icon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@descope/flow-components",
3
- "version": "2.0.140",
3
+ "version": "2.0.142",
4
4
  "description": "",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",
@@ -99,7 +99,7 @@
99
99
  "typescript": "^5.0.0"
100
100
  },
101
101
  "dependencies": {
102
- "@descope/web-components-ui": "1.0.193",
102
+ "@descope/web-components-ui": "1.0.194",
103
103
  "rollup-plugin-dts": "^5.3.0"
104
104
  },
105
105
  "peerDependencies": {