@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
|
@@ -6,6 +6,7 @@ export interface ActionIconProps {
|
|
|
6
6
|
disabled?: boolean;
|
|
7
7
|
type?: 'button' | 'submit' | 'reset' | undefined;
|
|
8
8
|
styleVariant?: 'default' | 'transparent' | 'small' | 'round';
|
|
9
|
+
tooltipTitle?: string;
|
|
9
10
|
onClick?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
10
11
|
icon?: React.ReactNode;
|
|
11
12
|
iconSize?: number;
|
|
@@ -22,7 +23,7 @@ export interface ActionIconProps {
|
|
|
22
23
|
height?: string;
|
|
23
24
|
}
|
|
24
25
|
declare const ActionIcon: {
|
|
25
|
-
({ ref, title, disabled, styleVariant, icon, type, "data-testid": testId, iconSize, strokeWidth, onClick, className, ...props }: ActionIconProps): import("react/jsx-runtime").JSX.Element;
|
|
26
|
+
({ ref, title, disabled, styleVariant, icon, type, tooltipTitle, "data-testid": testId, iconSize, strokeWidth, onClick, className, ...props }: ActionIconProps): import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
28
29
|
export { ActionIcon };
|
package/dist/index.cjs
CHANGED
|
@@ -281,34 +281,35 @@ function formatIcon(icon, defaultFormatAttributes) {
|
|
|
281
281
|
}
|
|
282
282
|
//#endregion
|
|
283
283
|
//#region src/components/actionIcon/index.tsx
|
|
284
|
-
const ActionIcon = ({ ref, title, disabled = false, styleVariant = "default", icon, type = "button", "data-testid": testId, iconSize = 20, strokeWidth = 1, onClick, className, ...props }) => {
|
|
284
|
+
const ActionIcon = ({ ref, title, disabled = false, styleVariant = "default", icon, type = "button", tooltipTitle, "data-testid": testId, iconSize = 20, strokeWidth = 1, onClick, className, ...props }) => {
|
|
285
285
|
const variantClassNames = (0, clsx.default)({
|
|
286
286
|
"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,
|
|
287
287
|
"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,
|
|
288
288
|
"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,
|
|
289
289
|
"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
|
|
290
290
|
});
|
|
291
|
-
|
|
291
|
+
const renderButton = () => /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
292
|
+
title,
|
|
293
|
+
type,
|
|
294
|
+
disabled,
|
|
295
|
+
"data-testid": testId,
|
|
296
|
+
"data-component": "ActionIcon",
|
|
297
|
+
className: cn(variantClassNames, { "hover:bg-transparant cursor-not-allowed hover:border-gray-200": disabled }, className),
|
|
298
|
+
onClick,
|
|
299
|
+
ref,
|
|
300
|
+
"data-tooltip-id": tooltipTitle,
|
|
301
|
+
"data-tooltip-content": tooltipTitle,
|
|
302
|
+
...props,
|
|
303
|
+
children: icon ? formatIcon(icon, {
|
|
304
|
+
stroke: strokeWidth,
|
|
305
|
+
size: iconSize
|
|
306
|
+
}) : props.children
|
|
307
|
+
});
|
|
308
|
+
return tooltipTitle ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tooltip, {
|
|
292
309
|
size: "sm",
|
|
293
|
-
content:
|
|
294
|
-
children:
|
|
295
|
-
|
|
296
|
-
type,
|
|
297
|
-
disabled,
|
|
298
|
-
"data-testid": testId,
|
|
299
|
-
"data-component": "ActionIcon",
|
|
300
|
-
className: cn(variantClassNames, { "hover:bg-transparant cursor-not-allowed hover:border-gray-200": disabled }, className),
|
|
301
|
-
onClick,
|
|
302
|
-
ref,
|
|
303
|
-
"data-tooltip-id": title,
|
|
304
|
-
"data-tooltip-content": title,
|
|
305
|
-
...props,
|
|
306
|
-
children: icon ? formatIcon(icon, {
|
|
307
|
-
stroke: strokeWidth,
|
|
308
|
-
size: iconSize
|
|
309
|
-
}) : props.children
|
|
310
|
-
})
|
|
311
|
-
}) });
|
|
310
|
+
content: tooltipTitle,
|
|
311
|
+
children: renderButton()
|
|
312
|
+
}) : renderButton();
|
|
312
313
|
};
|
|
313
314
|
ActionIcon.displayName = "ActionIcon";
|
|
314
315
|
//#endregion
|
|
@@ -1250,6 +1251,7 @@ const Divider = ({ className, ...props }) => /* @__PURE__ */ (0, react_jsx_runti
|
|
|
1250
1251
|
const FavouriteButton = (0, react.forwardRef)((props, ref) => {
|
|
1251
1252
|
const { onClick, favourite, iconFilled, iconOutline, favouriteTitle, iconColorSelected = "text-secondary", iconColor = "text-gray-800", iconSize, className = "", styleVariant = "transparent", children, ...rest } = props;
|
|
1252
1253
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionIcon, {
|
|
1254
|
+
tooltipTitle: favouriteTitle || "Favorite",
|
|
1253
1255
|
onClick,
|
|
1254
1256
|
"data-component": "favouriteButton",
|
|
1255
1257
|
title: favouriteTitle || "Favorite",
|
|
@@ -1819,12 +1821,12 @@ const Modal = ({ title, children, withCloseButton = true, opened, additionalClas
|
|
|
1819
1821
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
1820
1822
|
className: "relative z-10 w-full",
|
|
1821
1823
|
children: withCloseButton && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(ActionIcon, {
|
|
1824
|
+
title: "Close modal",
|
|
1822
1825
|
onClick: handleClose,
|
|
1823
|
-
"aria-label": "
|
|
1826
|
+
"aria-label": "Close modal",
|
|
1824
1827
|
className: "absolute top-0 right-0",
|
|
1825
1828
|
"data-testid": "close-modal",
|
|
1826
|
-
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tabler_icons_react.IconX, {})
|
|
1827
|
-
title: "Close modal"
|
|
1829
|
+
icon: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_tabler_icons_react.IconX, {})
|
|
1828
1830
|
})
|
|
1829
1831
|
}),
|
|
1830
1832
|
title && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|