@hitachivantara/uikit-react-core 5.65.0 → 5.65.1
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.
|
@@ -46,7 +46,6 @@ const HvActionsGeneric = (props) => {
|
|
|
46
46
|
const actionId = setId.setId(idProp, idx, "action", action.id);
|
|
47
47
|
const renderedIcon = React.isValidElement(icon) ? icon : icon?.({ isDisabled: disabled });
|
|
48
48
|
const commonButtonProps = {
|
|
49
|
-
key: actionId || idx,
|
|
50
49
|
id: actionId,
|
|
51
50
|
variant,
|
|
52
51
|
className: classes.button,
|
|
@@ -54,11 +53,12 @@ const HvActionsGeneric = (props) => {
|
|
|
54
53
|
onClick: (event) => handleCallback(event, idProp || "", action),
|
|
55
54
|
...other
|
|
56
55
|
};
|
|
56
|
+
const key = actionId || idx;
|
|
57
57
|
const isIcon = iconOnly ?? iconOnlyProp;
|
|
58
58
|
if (isIcon) {
|
|
59
|
-
return /* @__PURE__ */ jsxRuntime.jsx(IconButton.HvIconButton, { ...commonButtonProps, title: label, children: renderedIcon });
|
|
59
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IconButton.HvIconButton, { ...commonButtonProps, title: label, children: renderedIcon }, key);
|
|
60
60
|
}
|
|
61
|
-
return /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { ...commonButtonProps, startIcon: renderedIcon, children: label });
|
|
61
|
+
return /* @__PURE__ */ jsxRuntime.jsx(Button.HvButton, { ...commonButtonProps, startIcon: renderedIcon, children: label }, key);
|
|
62
62
|
};
|
|
63
63
|
const renderActionsGrid = () => {
|
|
64
64
|
const actsVisible = actions.slice(0, maxVisibleActions);
|
|
@@ -45,7 +45,6 @@ const HvActionsGeneric = (props) => {
|
|
|
45
45
|
const actionId = setId(idProp, idx, "action", action.id);
|
|
46
46
|
const renderedIcon = isValidElement(icon) ? icon : icon?.({ isDisabled: disabled });
|
|
47
47
|
const commonButtonProps = {
|
|
48
|
-
key: actionId || idx,
|
|
49
48
|
id: actionId,
|
|
50
49
|
variant,
|
|
51
50
|
className: classes.button,
|
|
@@ -53,11 +52,12 @@ const HvActionsGeneric = (props) => {
|
|
|
53
52
|
onClick: (event) => handleCallback(event, idProp || "", action),
|
|
54
53
|
...other
|
|
55
54
|
};
|
|
55
|
+
const key = actionId || idx;
|
|
56
56
|
const isIcon = iconOnly ?? iconOnlyProp;
|
|
57
57
|
if (isIcon) {
|
|
58
|
-
return /* @__PURE__ */ jsx(HvIconButton, { ...commonButtonProps, title: label, children: renderedIcon });
|
|
58
|
+
return /* @__PURE__ */ jsx(HvIconButton, { ...commonButtonProps, title: label, children: renderedIcon }, key);
|
|
59
59
|
}
|
|
60
|
-
return /* @__PURE__ */ jsx(HvButton, { ...commonButtonProps, startIcon: renderedIcon, children: label });
|
|
60
|
+
return /* @__PURE__ */ jsx(HvButton, { ...commonButtonProps, startIcon: renderedIcon, children: label }, key);
|
|
61
61
|
};
|
|
62
62
|
const renderActionsGrid = () => {
|
|
63
63
|
const actsVisible = actions.slice(0, maxVisibleActions);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionsGeneric.js","sources":["../../../src/ActionsGeneric/ActionsGeneric.tsx"],"sourcesContent":["import { isValidElement } from \"react\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton, HvButtonProps, HvButtonVariant } from \"../Button\";\nimport { HvDropDownMenu } from \"../DropDownMenu\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { HvIconButton } from \"../IconButton\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./ActionsGeneric.styles\";\n\nexport { staticClasses as actionsGenericClasses };\n\nexport type HvActionsGenericClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvActionGeneric {\n /** Action id. */\n id: string;\n /** Action label. */\n label: string;\n /** Action icon. */\n icon?:\n | React.ReactNode\n | ((params: { isDisabled?: boolean }) => React.ReactNode);\n /** Whether the action is disabled or not. */\n disabled?: boolean;\n /** When set to `true`, the button will have the icon has its content and a tooltip with the label will appear when the button is visible and hovered. */\n iconOnly?: boolean;\n}\n\nexport interface HvActionsGenericProps extends HvBaseProps {\n /**\n * The button category for all actions.\n *\n * @deprecated Use `variant` instead.\n */\n category?: HvButtonVariant;\n /** The button variant for all actions. */\n variant?: HvButtonVariant;\n /** Whether the actions should be all disabled. */\n disabled?: boolean;\n /** Whether the actions should be all icon buttons when visible. */\n iconOnly?: boolean;\n /** The renderable content inside the actions slot of the footer, or an array of actions. */\n actions: React.ReactNode | HvActionGeneric[];\n /**\n * The callback function called when an action is triggered, receiving the `action` as parameter.\n *\n * @deprecated Use `onAction` instead.\n * */\n actionsCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric,\n ) => void;\n /** The callback function called when an action is triggered, receiving the `action` as parameter. */\n onAction?: (event: React.SyntheticEvent, action: HvActionGeneric) => void;\n /** The maximum number of visible actions before they're collapsed into a dropdown menu. */\n maxVisibleActions?: number;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvActionsGenericClasses;\n}\n\nexport const HvActionsGeneric = (props: HvActionsGenericProps) => {\n const {\n id: idProp,\n classes: classesProp,\n className,\n category = \"secondaryGhost\", // TODO - remove and update variant default in v6\n variant: variantProp,\n disabled = false,\n actions = [],\n actionsCallback, // TODO - remove in v6\n onAction,\n maxVisibleActions = Infinity,\n iconOnly: iconOnlyProp,\n ...others\n } = useDefaultProps(\"HvActionsGeneric\", props);\n\n const variant = variantProp || category;\n\n const { classes, cx } = useClasses(classesProp);\n\n const handleCallback: HvActionsGenericProps[\"actionsCallback\"] = (\n event,\n id,\n action,\n ) => {\n actionsCallback?.(event, id, action);\n onAction?.(event, action);\n };\n\n if (!Array.isArray(actions)) return isValidElement(actions) ? actions : null;\n\n const renderButton = (action: HvActionGeneric, idx: number) => {\n const {\n disabled: actDisabled,\n id: actId,\n icon,\n label,\n iconOnly,\n ...other\n } = action;\n const actionId = setId(idProp, idx, \"action\", action.id);\n\n const renderedIcon = isValidElement(icon)\n ? icon\n : (icon as Function)?.({ isDisabled: disabled });\n\n const commonButtonProps: HvButtonProps = {\n
|
|
1
|
+
{"version":3,"file":"ActionsGeneric.js","sources":["../../../src/ActionsGeneric/ActionsGeneric.tsx"],"sourcesContent":["import { isValidElement } from \"react\";\nimport { MoreOptionsVertical } from \"@hitachivantara/uikit-react-icons\";\n\nimport { HvButton, HvButtonProps, HvButtonVariant } from \"../Button\";\nimport { HvDropDownMenu } from \"../DropDownMenu\";\nimport { useDefaultProps } from \"../hooks/useDefaultProps\";\nimport { HvIconButton } from \"../IconButton\";\nimport { HvBaseProps } from \"../types/generic\";\nimport { ExtractNames } from \"../utils/classes\";\nimport { setId } from \"../utils/setId\";\nimport { staticClasses, useClasses } from \"./ActionsGeneric.styles\";\n\nexport { staticClasses as actionsGenericClasses };\n\nexport type HvActionsGenericClasses = ExtractNames<typeof useClasses>;\n\nexport interface HvActionGeneric {\n /** Action id. */\n id: string;\n /** Action label. */\n label: string;\n /** Action icon. */\n icon?:\n | React.ReactNode\n | ((params: { isDisabled?: boolean }) => React.ReactNode);\n /** Whether the action is disabled or not. */\n disabled?: boolean;\n /** When set to `true`, the button will have the icon has its content and a tooltip with the label will appear when the button is visible and hovered. */\n iconOnly?: boolean;\n}\n\nexport interface HvActionsGenericProps extends HvBaseProps {\n /**\n * The button category for all actions.\n *\n * @deprecated Use `variant` instead.\n */\n category?: HvButtonVariant;\n /** The button variant for all actions. */\n variant?: HvButtonVariant;\n /** Whether the actions should be all disabled. */\n disabled?: boolean;\n /** Whether the actions should be all icon buttons when visible. */\n iconOnly?: boolean;\n /** The renderable content inside the actions slot of the footer, or an array of actions. */\n actions: React.ReactNode | HvActionGeneric[];\n /**\n * The callback function called when an action is triggered, receiving the `action` as parameter.\n *\n * @deprecated Use `onAction` instead.\n * */\n actionsCallback?: (\n event: React.SyntheticEvent,\n id: string,\n action: HvActionGeneric,\n ) => void;\n /** The callback function called when an action is triggered, receiving the `action` as parameter. */\n onAction?: (event: React.SyntheticEvent, action: HvActionGeneric) => void;\n /** The maximum number of visible actions before they're collapsed into a dropdown menu. */\n maxVisibleActions?: number;\n /** A Jss Object used to override or extend the styles applied to the component. */\n classes?: HvActionsGenericClasses;\n}\n\nexport const HvActionsGeneric = (props: HvActionsGenericProps) => {\n const {\n id: idProp,\n classes: classesProp,\n className,\n category = \"secondaryGhost\", // TODO - remove and update variant default in v6\n variant: variantProp,\n disabled = false,\n actions = [],\n actionsCallback, // TODO - remove in v6\n onAction,\n maxVisibleActions = Infinity,\n iconOnly: iconOnlyProp,\n ...others\n } = useDefaultProps(\"HvActionsGeneric\", props);\n\n const variant = variantProp || category;\n\n const { classes, cx } = useClasses(classesProp);\n\n const handleCallback: HvActionsGenericProps[\"actionsCallback\"] = (\n event,\n id,\n action,\n ) => {\n actionsCallback?.(event, id, action);\n onAction?.(event, action);\n };\n\n if (!Array.isArray(actions)) return isValidElement(actions) ? actions : null;\n\n const renderButton = (action: HvActionGeneric, idx: number) => {\n const {\n disabled: actDisabled,\n id: actId,\n icon,\n label,\n iconOnly,\n ...other\n } = action;\n const actionId = setId(idProp, idx, \"action\", action.id);\n\n const renderedIcon = isValidElement(icon)\n ? icon\n : (icon as Function)?.({ isDisabled: disabled });\n\n const commonButtonProps: HvButtonProps = {\n id: actionId,\n variant,\n className: classes.button,\n disabled: actDisabled ?? disabled,\n onClick: (event) => handleCallback(event, idProp || \"\", action),\n ...other,\n };\n\n const key = actionId || idx;\n const isIcon = iconOnly ?? iconOnlyProp;\n\n if (isIcon) {\n return (\n <HvIconButton key={key} {...commonButtonProps} title={label}>\n {renderedIcon}\n </HvIconButton>\n );\n }\n\n return (\n <HvButton key={key} {...commonButtonProps} startIcon={renderedIcon}>\n {label}\n </HvButton>\n );\n };\n\n const renderActionsGrid = () => {\n const actsVisible = actions.slice(0, maxVisibleActions);\n const actsDropdown = actions.slice(maxVisibleActions);\n\n const semantic = variant === \"semantic\";\n const iconColor =\n (disabled && \"secondary_60\") || (semantic && \"base_dark\") || undefined;\n\n return (\n <>\n {actsVisible.map((action, idx) => renderButton(action, idx))}\n <HvDropDownMenu\n id={setId(idProp, \"menu\")}\n disabled={disabled}\n variant={variant}\n classes={{\n root: classes.dropDownMenu,\n icon: classes.dropDownMenuButton,\n iconSelected: classes.dropDownMenuButtonSelected,\n }}\n icon={<MoreOptionsVertical color={iconColor} />}\n placement=\"left\"\n onClick={(event, action) =>\n handleCallback(event, idProp || \"\", action as HvActionGeneric)\n }\n dataList={actsDropdown}\n keepOpened={false}\n disablePortal={false}\n />\n </>\n );\n };\n\n const actionOverflow = actions.length > maxVisibleActions;\n\n return (\n <div\n className={cx(\n classes.root,\n { [classes.actionContainer]: actionOverflow },\n className,\n )}\n {...others}\n >\n {actionOverflow\n ? renderActionsGrid()\n : actions.map((action, idx) => renderButton(action, idx))}\n </div>\n );\n};\n"],"names":[],"mappings":";;;;;;;;;;AAgEa,MAAA,mBAAmB,CAAC,UAAiC;AAC1D,QAAA;AAAA,IACJ,IAAI;AAAA,IACJ,SAAS;AAAA,IACT;AAAA,IACA,WAAW;AAAA;AAAA,IACX,SAAS;AAAA,IACT,WAAW;AAAA,IACX,UAAU,CAAC;AAAA,IACX;AAAA;AAAA,IACA;AAAA,IACA,oBAAoB;AAAA,IACpB,UAAU;AAAA,IACV,GAAG;AAAA,EAAA,IACD,gBAAgB,oBAAoB,KAAK;AAE7C,QAAM,UAAU,eAAe;AAE/B,QAAM,EAAE,SAAS,GAAG,IAAI,WAAW,WAAW;AAE9C,QAAM,iBAA2D,CAC/D,OACA,IACA,WACG;AACe,sBAAA,OAAO,IAAI,MAAM;AACnC,eAAW,OAAO,MAAM;AAAA,EAAA;AAGtB,MAAA,CAAC,MAAM,QAAQ,OAAO;AAAU,WAAA,eAAe,OAAO,IAAI,UAAU;AAElE,QAAA,eAAe,CAAC,QAAyB,QAAgB;A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,SAAS,CAAC,OAAO,WACf,eAAe,OAAO,UAAU,IAAI,MAAyB;AAAA,UAE/D,UAAU;AAAA,UACV,YAAY;AAAA,UACZ,eAAe;AAAA,QAAA;AAAA,MACjB;AAAA,IACF,EAAA,CAAA;AAAA,EAAA;AAIE,QAAA,iBAAiB,QAAQ,SAAS;AAGtC,SAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,WAAW;AAAA,QACT,QAAQ;AAAA,QACR,EAAE,CAAC,QAAQ,eAAe,GAAG,eAAe;AAAA,QAC5C;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAEH,UAAA,iBACG,kBAAkB,IAClB,QAAQ,IAAI,CAAC,QAAQ,QAAQ,aAAa,QAAQ,GAAG,CAAC;AAAA,IAAA;AAAA,EAAA;AAGhE;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hitachivantara/uikit-react-core",
|
|
3
|
-
"version": "5.65.
|
|
3
|
+
"version": "5.65.1",
|
|
4
4
|
"private": false,
|
|
5
5
|
"author": "Hitachi Vantara UI Kit Team",
|
|
6
6
|
"description": "Core React components for the NEXT Design System.",
|
|
@@ -62,7 +62,7 @@
|
|
|
62
62
|
"access": "public",
|
|
63
63
|
"directory": "package"
|
|
64
64
|
},
|
|
65
|
-
"gitHead": "
|
|
65
|
+
"gitHead": "1502305db73d20325c3997f89e82efb9c7468e26",
|
|
66
66
|
"exports": {
|
|
67
67
|
".": {
|
|
68
68
|
"require": "./dist/cjs/index.cjs",
|