@youngonesworks/ui 1.0.14 → 1.0.15
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/components/actionIcon/index.d.ts +2 -1
- package/dist/index.cjs +26 -24
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +26 -24
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -251,34 +251,35 @@ function formatIcon(icon, defaultFormatAttributes) {
|
|
|
251
251
|
}
|
|
252
252
|
//#endregion
|
|
253
253
|
//#region src/components/actionIcon/index.tsx
|
|
254
|
-
const ActionIcon = ({ ref, title, disabled = false, styleVariant = "default", icon, type = "button", "data-testid": testId, iconSize = 20, strokeWidth = 1, onClick, className, ...props }) => {
|
|
254
|
+
const ActionIcon = ({ ref, title, disabled = false, styleVariant = "default", icon, type = "button", tooltipTitle, "data-testid": testId, iconSize = 20, strokeWidth = 1, onClick, className, ...props }) => {
|
|
255
255
|
const variantClassNames = clsx({
|
|
256
256
|
"active:translate-y-[1px] content-center flex items-center justify-center rounded-[4px] border border-gray-200 hover:border-black text-black child:p-10 w-[36px] h-[36px] disabled:text-gray-500": styleVariant === ACTION_ICON_STYLE_VARIANT.DEFAULT,
|
|
257
257
|
"active:translate-y-[1px] border-none content-center flex items-center justify-center rounded-[4px] border text-black child:p-10 w-[36px] h-[36px] disabled:text-gray-500": styleVariant === ACTION_ICON_STYLE_VARIANT.TRANSPARENT,
|
|
258
258
|
"active:translate-y-[1px] content-center flex items-center justify-center rounded-[4px] child:p-10 w-[37px] h-[37px] text-black rounded-full bg-primary hover:bg-turquoise-700 disabled:turquoise-50 disabled:text-gray-800": styleVariant === ACTION_ICON_STYLE_VARIANT.ROUND,
|
|
259
259
|
"w-7 h-7 active:translate-y-[1px] content-center flex items-center justify-center rounded-[4px] border border-gray-200 hover:border-black text-black hover:bg-ultra-light-blue-gray disabled:text-gray-500": styleVariant === ACTION_ICON_STYLE_VARIANT.SMALL
|
|
260
260
|
});
|
|
261
|
-
|
|
261
|
+
const renderButton = () => /* @__PURE__ */ jsx("button", {
|
|
262
|
+
title,
|
|
263
|
+
type,
|
|
264
|
+
disabled,
|
|
265
|
+
"data-testid": testId,
|
|
266
|
+
"data-component": "ActionIcon",
|
|
267
|
+
className: cn(variantClassNames, { "hover:bg-transparant cursor-not-allowed hover:border-gray-200": disabled }, className),
|
|
268
|
+
onClick,
|
|
269
|
+
ref,
|
|
270
|
+
"data-tooltip-id": tooltipTitle,
|
|
271
|
+
"data-tooltip-content": tooltipTitle,
|
|
272
|
+
...props,
|
|
273
|
+
children: icon ? formatIcon(icon, {
|
|
274
|
+
stroke: strokeWidth,
|
|
275
|
+
size: iconSize
|
|
276
|
+
}) : props.children
|
|
277
|
+
});
|
|
278
|
+
return tooltipTitle ? /* @__PURE__ */ jsx(Tooltip, {
|
|
262
279
|
size: "sm",
|
|
263
|
-
content:
|
|
264
|
-
children:
|
|
265
|
-
|
|
266
|
-
type,
|
|
267
|
-
disabled,
|
|
268
|
-
"data-testid": testId,
|
|
269
|
-
"data-component": "ActionIcon",
|
|
270
|
-
className: cn(variantClassNames, { "hover:bg-transparant cursor-not-allowed hover:border-gray-200": disabled }, className),
|
|
271
|
-
onClick,
|
|
272
|
-
ref,
|
|
273
|
-
"data-tooltip-id": title,
|
|
274
|
-
"data-tooltip-content": title,
|
|
275
|
-
...props,
|
|
276
|
-
children: icon ? formatIcon(icon, {
|
|
277
|
-
stroke: strokeWidth,
|
|
278
|
-
size: iconSize
|
|
279
|
-
}) : props.children
|
|
280
|
-
})
|
|
281
|
-
}) });
|
|
280
|
+
content: tooltipTitle,
|
|
281
|
+
children: renderButton()
|
|
282
|
+
}) : renderButton();
|
|
282
283
|
};
|
|
283
284
|
ActionIcon.displayName = "ActionIcon";
|
|
284
285
|
//#endregion
|
|
@@ -1219,6 +1220,7 @@ const Divider = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
1219
1220
|
const FavouriteButton = forwardRef((props, ref) => {
|
|
1220
1221
|
const { onClick, favourite, iconFilled, iconOutline, favouriteTitle, iconColorSelected = "text-secondary", iconColor = "text-gray-800", iconSize, className = "", styleVariant = "transparent", children, ...rest } = props;
|
|
1221
1222
|
return /* @__PURE__ */ jsx(ActionIcon, {
|
|
1223
|
+
tooltipTitle: favouriteTitle || "Favorite",
|
|
1222
1224
|
onClick,
|
|
1223
1225
|
"data-component": "favouriteButton",
|
|
1224
1226
|
title: favouriteTitle || "Favorite",
|
|
@@ -1788,12 +1790,12 @@ const Modal = ({ title, children, withCloseButton = true, opened, additionalClas
|
|
|
1788
1790
|
/* @__PURE__ */ jsx("div", {
|
|
1789
1791
|
className: "relative z-10 w-full",
|
|
1790
1792
|
children: withCloseButton && /* @__PURE__ */ jsx(ActionIcon, {
|
|
1793
|
+
title: "Close modal",
|
|
1791
1794
|
onClick: handleClose,
|
|
1792
|
-
"aria-label": "
|
|
1795
|
+
"aria-label": "Close modal",
|
|
1793
1796
|
className: "absolute top-0 right-0",
|
|
1794
1797
|
"data-testid": "close-modal",
|
|
1795
|
-
icon: /* @__PURE__ */ jsx(IconX, {})
|
|
1796
|
-
title: "Close modal"
|
|
1798
|
+
icon: /* @__PURE__ */ jsx(IconX, {})
|
|
1797
1799
|
})
|
|
1798
1800
|
}),
|
|
1799
1801
|
title && /* @__PURE__ */ jsx("div", {
|