@chayns-components/core 5.0.7 → 5.0.9
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/lib/cjs/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js +35 -21
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js +14 -4
- package/lib/cjs/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/esm/components/multi-action-button/MultiActionButton.types.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js +34 -20
- package/lib/esm/components/multi-action-button/action-button/ActionButton.js.map +1 -1
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js +14 -4
- package/lib/esm/components/multi-action-button/action-button/ActionButton.styles.js.map +1 -1
- package/lib/types/components/multi-action-button/MultiActionButton.types.d.ts +6 -0
- package/lib/types/components/multi-action-button/action-button/ActionButton.styles.d.ts +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","exports","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom ReactNode.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactNode;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":";;;;;;AAGA;AACA;AACA;AAFA,IAGYA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;AASvC;AACA;AACA;AAFA,IAGYE,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAWnC;AACA;AACA;AAiBA;AACA;AACA;AA0BA;AACA;AACA;
|
|
1
|
+
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","exports","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom ReactNode.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactNode;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":";;;;;;AAGA;AACA;AACA;AAFA,IAGYA,2BAA2B,GAAAC,OAAA,CAAAD,2BAAA,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;AASvC;AACA;AACA;AAFA,IAGYE,uBAAuB,GAAAD,OAAA,CAAAC,uBAAA,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;AAWnC;AACA;AACA;AAiBA;AACA;AACA;AA0BA;AACA;AACA;AAgDA;AACA;AACA","ignoreList":[]}
|
|
@@ -7,7 +7,9 @@ exports.default = void 0;
|
|
|
7
7
|
var _react = require("motion/react");
|
|
8
8
|
var _react2 = _interopRequireDefault(require("react"));
|
|
9
9
|
var _Icon = _interopRequireDefault(require("../../icon/Icon"));
|
|
10
|
+
var _Tooltip = _interopRequireDefault(require("../../tooltip/Tooltip"));
|
|
10
11
|
var _ActionButton = require("./ActionButton.styles");
|
|
12
|
+
var _popup = require("../../../types/popup");
|
|
11
13
|
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
12
14
|
const LABEL_GAP = 6;
|
|
13
15
|
const LABEL_TRANSITION = {
|
|
@@ -34,29 +36,14 @@ const ActionButton = ({
|
|
|
34
36
|
shouldUseContentWidth,
|
|
35
37
|
height
|
|
36
38
|
}) => {
|
|
37
|
-
var _action$status, _action$status2;
|
|
39
|
+
var _action$disabledReaso, _action$status, _action$status2;
|
|
38
40
|
const isPrimary = actionType === 'primary';
|
|
39
41
|
const isSecondary = actionType === 'secondary';
|
|
40
42
|
const actionColor = action.color ?? '#FFFFFF';
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
$isExpanded: isSecondary ? isExpanded : undefined,
|
|
46
|
-
$isHidden: isSecondary ? isHidden : undefined,
|
|
47
|
-
$isPrimary: isPrimary,
|
|
48
|
-
$isSecondary: isSecondary,
|
|
49
|
-
$isShrunk: isPrimary ? isShrunk : undefined,
|
|
50
|
-
$isSolo: isPrimary ? isSolo : undefined,
|
|
51
|
-
$pulseColors: (_action$status = action.status) === null || _action$status === void 0 ? void 0 : _action$status.pulseColors,
|
|
52
|
-
$height: height,
|
|
53
|
-
$statusType: (_action$status2 = action.status) === null || _action$status2 === void 0 ? void 0 : _action$status2.type,
|
|
54
|
-
$shouldUseContentWidth: shouldUseContentWidth,
|
|
55
|
-
onClick: onClick,
|
|
56
|
-
onMouseEnter: onMouseEnter,
|
|
57
|
-
onMouseLeave: onMouseLeave,
|
|
58
|
-
type: "button"
|
|
59
|
-
}, /*#__PURE__*/_react2.default.createElement(_ActionButton.StyledActionContent, null, /*#__PURE__*/_react2.default.createElement(_ActionButton.StyledIconSlot, {
|
|
43
|
+
const isActionDisabled = isDisabled || Boolean(action.isDisabled);
|
|
44
|
+
const disabledReason = (_action$disabledReaso = action.disabledReason) === null || _action$disabledReaso === void 0 ? void 0 : _action$disabledReaso.trim();
|
|
45
|
+
const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;
|
|
46
|
+
const actionContent = /*#__PURE__*/_react2.default.createElement(_ActionButton.StyledActionContent, null, /*#__PURE__*/_react2.default.createElement(_ActionButton.StyledIconSlot, {
|
|
60
47
|
$height: height
|
|
61
48
|
}, typeof action.icon === 'string' ? /*#__PURE__*/_react2.default.createElement(_Icon.default, {
|
|
62
49
|
icons: [action.icon],
|
|
@@ -85,7 +72,34 @@ const ActionButton = ({
|
|
|
85
72
|
style: {
|
|
86
73
|
color: actionColor
|
|
87
74
|
}
|
|
88
|
-
}, action.label))))
|
|
75
|
+
}, action.label))));
|
|
76
|
+
return /*#__PURE__*/_react2.default.createElement(_ActionButton.StyledActionButton, {
|
|
77
|
+
"aria-disabled": isActionDisabled,
|
|
78
|
+
disabled: isActionDisabled && !shouldShowDisabledReason,
|
|
79
|
+
$backgroundColor: backgroundColor,
|
|
80
|
+
$isCollapsed: isCollapsed,
|
|
81
|
+
$isExpanded: isSecondary ? isExpanded : undefined,
|
|
82
|
+
$isInteractionDisabled: isActionDisabled,
|
|
83
|
+
$isHidden: isSecondary ? isHidden : undefined,
|
|
84
|
+
$isPrimary: isPrimary,
|
|
85
|
+
$isSecondary: isSecondary,
|
|
86
|
+
$isShrunk: isPrimary ? isShrunk : undefined,
|
|
87
|
+
$isSolo: isPrimary ? isSolo : undefined,
|
|
88
|
+
$pulseColors: (_action$status = action.status) === null || _action$status === void 0 ? void 0 : _action$status.pulseColors,
|
|
89
|
+
$height: height,
|
|
90
|
+
$statusType: (_action$status2 = action.status) === null || _action$status2 === void 0 ? void 0 : _action$status2.type,
|
|
91
|
+
$shouldUseContentWidth: shouldUseContentWidth,
|
|
92
|
+
onClick: onClick,
|
|
93
|
+
onMouseEnter: onMouseEnter,
|
|
94
|
+
onMouseLeave: onMouseLeave,
|
|
95
|
+
type: "button"
|
|
96
|
+
}, shouldShowDisabledReason && disabledReason ? /*#__PURE__*/_react2.default.createElement(_Tooltip.default, {
|
|
97
|
+
alignment: _popup.PopupAlignment.BottomRight,
|
|
98
|
+
item: {
|
|
99
|
+
text: disabledReason
|
|
100
|
+
},
|
|
101
|
+
maxItemWidth: 400
|
|
102
|
+
}, actionContent) : actionContent);
|
|
89
103
|
};
|
|
90
104
|
ActionButton.displayName = 'ActionButton';
|
|
91
105
|
var _default = exports.default = ActionButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.js","names":["_react","require","_react2","_interopRequireDefault","_Icon","_ActionButton","e","__esModule","default","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","showLabel","shouldUseContentWidth","height","_action$status","_action$status2","isPrimary","isSecondary","actionColor","color","createElement","
|
|
1
|
+
{"version":3,"file":"ActionButton.js","names":["_react","require","_react2","_interopRequireDefault","_Icon","_Tooltip","_ActionButton","_popup","e","__esModule","default","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","showLabel","shouldUseContentWidth","height","_action$disabledReaso","_action$status","_action$status2","isPrimary","isSecondary","actionColor","color","isActionDisabled","Boolean","disabledReason","trim","shouldShowDisabledReason","actionContent","createElement","StyledActionContent","StyledIconSlot","$height","icon","icons","size","AnimatePresence","initial","StyledLabelWrapper","animate","opacity","width","marginLeft","exit","transition","StyledSecondaryLabel","style","label","StyledActionButton","disabled","$backgroundColor","$isCollapsed","$isExpanded","undefined","$isInteractionDisabled","$isHidden","$isPrimary","$isSecondary","$isShrunk","$isSolo","$pulseColors","status","pulseColors","$statusType","type","$shouldUseContentWidth","alignment","PopupAlignment","BottomRight","item","text","maxItemWidth","displayName","_default","exports"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEvent } from 'react';\nimport Icon from '../../icon/Icon';\nimport Tooltip from '../../tooltip/Tooltip';\nimport {\n StyledActionButton,\n StyledActionContent,\n StyledIconSlot,\n StyledLabelWrapper,\n StyledSecondaryLabel,\n} from './ActionButton.styles';\nimport type { MultiActionButtonAction } from '../MultiActionButton.types';\nimport { PopupAlignment } from '../../../types/popup';\n\nconst LABEL_GAP = 6;\nconst LABEL_TRANSITION = { duration: 0.3 };\n\nexport type ActionButtonProps = {\n action: MultiActionButtonAction;\n actionType: 'primary' | 'secondary';\n backgroundColor?: string;\n isCollapsed: boolean;\n isDisabled: boolean;\n isExpanded?: boolean;\n isHidden?: boolean;\n isShrunk?: boolean;\n isSolo?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n showLabel: boolean;\n shouldUseContentWidth: boolean;\n height: number;\n};\n\n/**\n * Shared action button UI used by both primary and secondary actions.\n * Keeps layout and animations consistent while isolating styling details.\n */\nconst ActionButton: FC<ActionButtonProps> = ({\n action,\n actionType,\n backgroundColor,\n isCollapsed,\n isDisabled,\n isExpanded,\n isHidden,\n isShrunk,\n isSolo,\n onClick,\n onMouseEnter,\n onMouseLeave,\n showLabel,\n shouldUseContentWidth,\n height,\n}) => {\n const isPrimary = actionType === 'primary';\n const isSecondary = actionType === 'secondary';\n const actionColor = action.color ?? '#FFFFFF';\n const isActionDisabled = isDisabled || Boolean(action.isDisabled);\n const disabledReason = action.disabledReason?.trim();\n const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;\n\n const actionContent = (\n <StyledActionContent>\n <StyledIconSlot $height={height}>\n {typeof action.icon === 'string' ? (\n <Icon icons={[action.icon]} color={actionColor} size={height - 24} />\n ) : (\n action.icon\n )}\n </StyledIconSlot>\n <AnimatePresence initial={false}>\n {/* Animate width and margin to avoid layout jumps when labels mount/unmount. */}\n {showLabel && (\n <StyledLabelWrapper\n animate={{ opacity: 1, width: 'auto', marginLeft: LABEL_GAP }}\n exit={{ opacity: 0, width: 0, marginLeft: 0 }}\n initial={{ opacity: 0, width: 0, marginLeft: 0 }}\n transition={LABEL_TRANSITION}\n >\n <StyledSecondaryLabel style={{ color: actionColor }}>\n {action.label}\n </StyledSecondaryLabel>\n </StyledLabelWrapper>\n )}\n </AnimatePresence>\n </StyledActionContent>\n );\n\n return (\n <StyledActionButton\n aria-disabled={isActionDisabled}\n disabled={isActionDisabled && !shouldShowDisabledReason}\n $backgroundColor={backgroundColor}\n $isCollapsed={isCollapsed}\n $isExpanded={isSecondary ? isExpanded : undefined}\n $isInteractionDisabled={isActionDisabled}\n $isHidden={isSecondary ? isHidden : undefined}\n $isPrimary={isPrimary}\n $isSecondary={isSecondary}\n $isShrunk={isPrimary ? isShrunk : undefined}\n $isSolo={isPrimary ? isSolo : undefined}\n $pulseColors={action.status?.pulseColors}\n $height={height}\n $statusType={action.status?.type}\n $shouldUseContentWidth={shouldUseContentWidth}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n type=\"button\"\n >\n {shouldShowDisabledReason && disabledReason ? (\n <Tooltip\n alignment={PopupAlignment.BottomRight}\n item={{ text: disabledReason }}\n maxItemWidth={400}\n >\n {actionContent}\n </Tooltip>\n ) : (\n actionContent\n )}\n </StyledActionButton>\n );\n};\n\nActionButton.displayName = 'ActionButton';\n\nexport default ActionButton;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,OAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,KAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,aAAA,GAAAL,OAAA;AAQA,IAAAM,MAAA,GAAAN,OAAA;AAAsD,SAAAE,uBAAAK,CAAA,WAAAA,CAAA,IAAAA,CAAA,CAAAC,UAAA,GAAAD,CAAA,KAAAE,OAAA,EAAAF,CAAA;AAEtD,MAAMG,SAAS,GAAG,CAAC;AACnB,MAAMC,gBAAgB,GAAG;EAAEC,QAAQ,EAAE;AAAI,CAAC;AAoB1C;AACA;AACA;AACA;AACA,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,MAAM;EACNC,UAAU;EACVC,eAAe;EACfC,WAAW;EACXC,UAAU;EACVC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,qBAAqB;EACrBC;AACJ,CAAC,KAAK;EAAA,IAAAC,qBAAA,EAAAC,cAAA,EAAAC,eAAA;EACF,MAAMC,SAAS,GAAGjB,UAAU,KAAK,SAAS;EAC1C,MAAMkB,WAAW,GAAGlB,UAAU,KAAK,WAAW;EAC9C,MAAMmB,WAAW,GAAGpB,MAAM,CAACqB,KAAK,IAAI,SAAS;EAC7C,MAAMC,gBAAgB,GAAGlB,UAAU,IAAImB,OAAO,CAACvB,MAAM,CAACI,UAAU,CAAC;EACjE,MAAMoB,cAAc,IAAAT,qBAAA,GAAGf,MAAM,CAACwB,cAAc,cAAAT,qBAAA,uBAArBA,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CAACwE,WAAW,GAAG,cAAc;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA9E,OAAA,GAE3BI,YAAY","ignoreList":[]}
|
|
@@ -139,6 +139,13 @@ const StyledActionButton = exports.StyledActionButton = _styledComponents.defaul
|
|
|
139
139
|
border-radius: ${props.$height / 2}px;
|
|
140
140
|
`}
|
|
141
141
|
|
|
142
|
+
${({
|
|
143
|
+
$isInteractionDisabled
|
|
144
|
+
}) => $isInteractionDisabled && (0, _styledComponents.css)`
|
|
145
|
+
cursor: default;
|
|
146
|
+
opacity: 0.5;
|
|
147
|
+
`}
|
|
148
|
+
|
|
142
149
|
/* Optional pulse overlay used by status. */
|
|
143
150
|
${({
|
|
144
151
|
$statusType,
|
|
@@ -162,12 +169,15 @@ const StyledActionButton = exports.StyledActionButton = _styledComponents.defaul
|
|
|
162
169
|
opacity: 0.5;
|
|
163
170
|
}
|
|
164
171
|
|
|
165
|
-
|
|
166
|
-
|
|
172
|
+
${({
|
|
173
|
+
$isInteractionDisabled,
|
|
167
174
|
$backgroundColor,
|
|
168
175
|
theme
|
|
169
|
-
}) =>
|
|
170
|
-
|
|
176
|
+
}) => !$isInteractionDisabled && (0, _styledComponents.css)`
|
|
177
|
+
&:hover:not(:disabled) {
|
|
178
|
+
background-color: ${`color-mix(in srgb, ${$backgroundColor || (theme === null || theme === void 0 ? void 0 : theme.primary) || '#000'} 85%, black)`};
|
|
179
|
+
}
|
|
180
|
+
`}
|
|
171
181
|
`;
|
|
172
182
|
const StyledActionContent = exports.StyledActionContent = _styledComponents.default.span`
|
|
173
183
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_MultiActionButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pulse","color1","color2","keyframes","StyledActionButton","exports","styled","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","css","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$statusType","$pulseColors","MultiActionButtonStatusType","Pulse","StyledActionContent","span","StyledIconSlot","StyledLabelWrapper","motion","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n &:hover:not(:disabled) {\n background-color: ${({ $backgroundColor, theme }) =>\n `color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAAyE,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,O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AGtB,yBAAM,CAACqB,IAAyB;AAC9D;AACA;AACA;AACA,cAAc,CAAC;EAAEnB;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,aAAa,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AACrC,CAAC;AAEM,MAAMqB,kBAAkB,GAAAxB,OAAA,CAAAwB,kBAAA,GAAG,IAAAvB,yBAAM,EAACwB,aAAM,CAACH,IAAI,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMI,oBAAoB,GAAA1B,OAAA,CAAA0B,oBAAA,GAAGzB,yBAAM,CAACqB,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ActionButton.styles.js","names":["_react","require","_styledComponents","_interopRequireWildcard","_MultiActionButton","e","t","WeakMap","r","n","__esModule","o","i","f","__proto__","default","has","get","set","hasOwnProperty","call","Object","defineProperty","getOwnPropertyDescriptor","pulse","color1","color2","keyframes","StyledActionButton","exports","styled","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","css","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","MultiActionButtonStatusType","Pulse","StyledActionContent","span","StyledIconSlot","StyledLabelWrapper","motion","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n opacity: 0.5;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,OAAA;AACA,IAAAC,iBAAA,GAAAC,uBAAA,CAAAF,OAAA;AAEA,IAAAG,kBAAA,GAAAH,OAAA;AAAyE,SAAAE,wBAAAE,CAAA,EAAAC,CAAA,6BAAAC,OAAA,MAAAC,CAAA,OAAAD,OAAA,IAAAE,CAAA,OAAAF,OAAA,YAAAJ,uBAAA,YAAAA,CAAAE,CAAA,EAAAC,CAAA,SAAAA,CAAA,IAAAD,CAAA,IAAAA,CAAA,CAAAK,UAAA,SAAAL,CAAA,MAAAM,CAAA,EAAAC,CAAA,EAAAC,CAAA,KAAAC,SAAA,QAAAC,OAAA,EAAAV,CAAA,iBAAAA,CAAA,uBAAAA,CAAA,yBAAAA,CAAA,SAAAQ,CAAA,MAAAF,CAAA,GAAAL,CAAA,GAAAG,CAAA,GAAAD,CAAA,QAAAG,CAAA,CAAAK,GAAA,CAAAX,CAAA,UAAAM,CAAA,CAAAM,GAAA,CAAAZ,CAAA,GAAAM,CAAA,CAAAO,GAAA,CAAAb,CAAA,EAAAQ,CAAA,gBAAAP,CAAA,IAAAD,CAAA,gBAAAC,CAAA,OAAAa,cAAA,CAAAC,IAAA,CAAAf,CAAA,EAAAC,CAAA,OAAAM,CAAA,IAAAD,CAAA,GAAAU,MAAA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AAxB,yBAAM,EAACyB,aAAM,CAACH,IAAI,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAEM,MAAMI,oBAAoB,GAAA3B,OAAA,CAAA2B,oBAAA,GAAG1B,yBAAM,CAACsB,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom ReactNode.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactNode;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":"AAGA;AACA;AACA;AACA,WAAYA,2BAA2B,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AASvC;AACA;AACA;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAWnC;AACA;AACA;;AAiBA;AACA;AACA;;AA0BA;AACA;AACA;;
|
|
1
|
+
{"version":3,"file":"MultiActionButton.types.js","names":["MultiActionButtonStatusType","MultiActionButtonHeight"],"sources":["../../../../src/components/multi-action-button/MultiActionButton.types.ts"],"sourcesContent":["import type { MouseEvent, ReactNode } from 'react';\nimport type { MotionValue } from 'motion/react';\n\n/**\n * Supported status types for the multi action button.\n */\nexport enum MultiActionButtonStatusType {\n /**\n * Pulsing background effect.\n * @description Applies a subtle animated overlay on the action background to draw attention.\n * This is intended for temporary states like recording or live activity indicators.\n */\n Pulse = 'pulse',\n}\n\n/**\n * Supported heights for the multi action button.\n */\nexport enum MultiActionButtonHeight {\n /**\n * Medium height (42px).\n */\n Medium = 42,\n /**\n * Large height (48px).\n */\n Large = 48,\n}\n\n/**\n * Minimal status configuration for an action.\n */\nexport type MultiActionButtonActionStatus = {\n /**\n * Optional pulse colors for the animation.\n * @description Defines the two colors for the pulsing background animation. If not provided, defaults to ['#A50000', '#630000'].\n * @optional\n */\n pulseColors?: [string, string];\n /**\n * Status type to apply.\n * @description Selects the visual emphasis type applied to the action. The component currently\n * supports a pulsing overlay, and additional types may be added later.\n * @optional\n */\n type?: MultiActionButtonStatusType;\n};\n\n/**\n * Event payload emitted on action click.\n */\nexport type MultiActionButtonActionEvent = {\n /**\n * Which action was clicked.\n * @description Indicates whether the primary or secondary action fired. This is helpful when\n * sharing a handler between both actions.\n */\n action: 'primary' | 'secondary';\n /**\n * Original click event.\n * @description Useful to access modifier keys, prevent default, or stop propagation.\n */\n event: MouseEvent<HTMLButtonElement>;\n /**\n * Whether the secondary action is currently extended.\n * @description Useful for flows that need to distinguish between a collapsed and expanded\n * secondary action, especially on touch devices.\n */\n isExtended: boolean;\n /**\n * Whether the device is considered touch.\n * @description Derived from pointer capabilities and used to decide between hover and click behavior.\n */\n isTouch: boolean;\n};\n\n/**\n * Configuration for a single action.\n */\nexport type MultiActionButtonAction = {\n /**\n * Optional color for the icon and label.\n * @description Overrides the default text/icon color. If omitted, the current theme text color is used.\n * @optional\n */\n color?: string;\n /**\n * The icon for the action.\n * @description Can be a FontAwesome class string (e.g., 'fa fa-microphone') or a custom ReactNode.\n * The icon is always rendered inside a fixed-size slot to keep alignment stable.\n */\n icon: string | ReactNode;\n /**\n * Whether the action is disabled.\n * @description Disabled actions do not respond to hover or click and are visually dimmed.\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Optional reason shown in a tooltip when the action is disabled.\n * @description Use this to explain why the action is currently unavailable.\n * @optional\n */\n disabledReason?: string;\n /**\n * The optional label for the action.\n * @description The label is shown next to the icon and will be truncated with ellipsis when\n * there is not enough horizontal space.\n * @optional\n */\n label: ReactNode;\n /**\n * Click handler for the action.\n * @description Receives a payload that includes the action type, extension state, and device info.\n * This allows external logic to decide whether the click should trigger an action immediately.\n * @optional\n */\n onClick?: (info: MultiActionButtonActionEvent) => void;\n /**\n * Status effect configuration for the action.\n * @description Controls optional visual emphasis like pulsing, without changing layout or sizing.\n * @optional\n */\n status?: MultiActionButtonActionStatus;\n};\n\n/**\n * Props for the MultiActionButton component.\n */\nexport type MultiActionButtonProps = {\n /**\n * Optional background color for both actions.\n * @description Overrides the default background color for the action buttons. This is useful\n * when the button is used on different backgrounds or when a specific brand color is needed.\n * If omitted, the primary color from the theme is used.\n * @default theme.primary\n * @optional\n */\n backgroundColor?: string;\n /**\n * Additional class name for the wrapper element.\n * @description Useful for custom styling or testing hooks.\n * @optional\n */\n className?: string;\n /**\n * Timeout in ms before the secondary action collapses after a click.\n * @description Set to 0 to keep the secondary action extended until the user collapses it.\n * @example\n * <MultiActionButton\n * primaryAction={primaryAction}\n * secondaryAction={secondaryAction}\n * extendedTimeoutMs={0}\n * />\n * @default 3000\n * @optional\n */\n extendedTimeoutMs?: number;\n /**\n * Height of the button.\n * @description Controls the height of the button. Use values from MultiActionButtonHeight enum or custom number.\n * @default MultiActionButtonHeight.Medium\n * @optional\n */\n height?: number;\n /**\n * Optional color for the 1px separator line between actions.\n * @description Defaults to theme.cw-body-background and falls back to #fff if not available.\n * @optional\n */\n gapColor?: string;\n /**\n * Whether the button is collapsed to a single icon.\n * @description When collapsed, only the primary icon is shown and the overall width shrinks to a circle.\n * Use this to provide compact states or toolbar modes.\n * @default false\n * @optional\n */\n isCollapsed?: boolean;\n /**\n * Whether the whole control is disabled.\n * @description Disables interactions for both actions, including hover expansion and clicks.\n * @default false\n * @optional\n */\n isDisabled?: boolean;\n /**\n * Primary action configuration.\n * @description Required action shown on the left side (or as the only action when no secondary is provided).\n */\n primaryAction: MultiActionButtonAction;\n /**\n * Secondary action configuration.\n * @description Optional action shown on the right side. When present, it can expand on hover or click.\n * @optional\n */\n secondaryAction?: MultiActionButtonAction;\n /**\n * Whether the button should take the full width of its parent.\n * @description When true, the control stretches to 100% width unless `width` is provided.\n * @optional\n */\n shouldUseFullWidth?: boolean;\n /**\n * Optional width override for the whole button.\n * @description Can be a fixed number or a MotionValue for external animations. When omitted,\n * the width is driven by the content unless `shouldUseFullWidth` is true.\n * @optional\n */\n width?: number | MotionValue<number>;\n};\n"],"mappings":"AAGA;AACA;AACA;AACA,WAAYA,2BAA2B,0BAA3BA,2BAA2B;EACnC;AACJ;AACA;AACA;AACA;EALYA,2BAA2B;EAAA,OAA3BA,2BAA2B;AAAA;;AASvC;AACA;AACA;AACA,WAAYC,uBAAuB,0BAAvBA,uBAAuB;EAC/B;AACJ;AACA;EAHYA,uBAAuB,CAAvBA,uBAAuB;EAK/B;AACJ;AACA;EAPYA,uBAAuB,CAAvBA,uBAAuB;EAAA,OAAvBA,uBAAuB;AAAA;;AAWnC;AACA;AACA;;AAiBA;AACA;AACA;;AA0BA;AACA;AACA;;AAgDA;AACA;AACA","ignoreList":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { AnimatePresence } from 'motion/react';
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import Icon from '../../icon/Icon';
|
|
4
|
+
import Tooltip from '../../tooltip/Tooltip';
|
|
4
5
|
import { StyledActionButton, StyledActionContent, StyledIconSlot, StyledLabelWrapper, StyledSecondaryLabel } from './ActionButton.styles';
|
|
6
|
+
import { PopupAlignment } from '../../../types/popup';
|
|
5
7
|
const LABEL_GAP = 6;
|
|
6
8
|
const LABEL_TRANSITION = {
|
|
7
9
|
duration: 0.3
|
|
@@ -30,25 +32,10 @@ const ActionButton = ({
|
|
|
30
32
|
const isPrimary = actionType === 'primary';
|
|
31
33
|
const isSecondary = actionType === 'secondary';
|
|
32
34
|
const actionColor = action.color ?? '#FFFFFF';
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
$isExpanded: isSecondary ? isExpanded : undefined,
|
|
38
|
-
$isHidden: isSecondary ? isHidden : undefined,
|
|
39
|
-
$isPrimary: isPrimary,
|
|
40
|
-
$isSecondary: isSecondary,
|
|
41
|
-
$isShrunk: isPrimary ? isShrunk : undefined,
|
|
42
|
-
$isSolo: isPrimary ? isSolo : undefined,
|
|
43
|
-
$pulseColors: action.status?.pulseColors,
|
|
44
|
-
$height: height,
|
|
45
|
-
$statusType: action.status?.type,
|
|
46
|
-
$shouldUseContentWidth: shouldUseContentWidth,
|
|
47
|
-
onClick: onClick,
|
|
48
|
-
onMouseEnter: onMouseEnter,
|
|
49
|
-
onMouseLeave: onMouseLeave,
|
|
50
|
-
type: "button"
|
|
51
|
-
}, /*#__PURE__*/React.createElement(StyledActionContent, null, /*#__PURE__*/React.createElement(StyledIconSlot, {
|
|
35
|
+
const isActionDisabled = isDisabled || Boolean(action.isDisabled);
|
|
36
|
+
const disabledReason = action.disabledReason?.trim();
|
|
37
|
+
const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;
|
|
38
|
+
const actionContent = /*#__PURE__*/React.createElement(StyledActionContent, null, /*#__PURE__*/React.createElement(StyledIconSlot, {
|
|
52
39
|
$height: height
|
|
53
40
|
}, typeof action.icon === 'string' ? /*#__PURE__*/React.createElement(Icon, {
|
|
54
41
|
icons: [action.icon],
|
|
@@ -77,7 +64,34 @@ const ActionButton = ({
|
|
|
77
64
|
style: {
|
|
78
65
|
color: actionColor
|
|
79
66
|
}
|
|
80
|
-
}, action.label))))
|
|
67
|
+
}, action.label))));
|
|
68
|
+
return /*#__PURE__*/React.createElement(StyledActionButton, {
|
|
69
|
+
"aria-disabled": isActionDisabled,
|
|
70
|
+
disabled: isActionDisabled && !shouldShowDisabledReason,
|
|
71
|
+
$backgroundColor: backgroundColor,
|
|
72
|
+
$isCollapsed: isCollapsed,
|
|
73
|
+
$isExpanded: isSecondary ? isExpanded : undefined,
|
|
74
|
+
$isInteractionDisabled: isActionDisabled,
|
|
75
|
+
$isHidden: isSecondary ? isHidden : undefined,
|
|
76
|
+
$isPrimary: isPrimary,
|
|
77
|
+
$isSecondary: isSecondary,
|
|
78
|
+
$isShrunk: isPrimary ? isShrunk : undefined,
|
|
79
|
+
$isSolo: isPrimary ? isSolo : undefined,
|
|
80
|
+
$pulseColors: action.status?.pulseColors,
|
|
81
|
+
$height: height,
|
|
82
|
+
$statusType: action.status?.type,
|
|
83
|
+
$shouldUseContentWidth: shouldUseContentWidth,
|
|
84
|
+
onClick: onClick,
|
|
85
|
+
onMouseEnter: onMouseEnter,
|
|
86
|
+
onMouseLeave: onMouseLeave,
|
|
87
|
+
type: "button"
|
|
88
|
+
}, shouldShowDisabledReason && disabledReason ? /*#__PURE__*/React.createElement(Tooltip, {
|
|
89
|
+
alignment: PopupAlignment.BottomRight,
|
|
90
|
+
item: {
|
|
91
|
+
text: disabledReason
|
|
92
|
+
},
|
|
93
|
+
maxItemWidth: 400
|
|
94
|
+
}, actionContent) : actionContent);
|
|
81
95
|
};
|
|
82
96
|
ActionButton.displayName = 'ActionButton';
|
|
83
97
|
export default ActionButton;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.js","names":["AnimatePresence","React","Icon","StyledActionButton","StyledActionContent","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","showLabel","shouldUseContentWidth","height","isPrimary","isSecondary","actionColor","color","
|
|
1
|
+
{"version":3,"file":"ActionButton.js","names":["AnimatePresence","React","Icon","Tooltip","StyledActionButton","StyledActionContent","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel","PopupAlignment","LABEL_GAP","LABEL_TRANSITION","duration","ActionButton","action","actionType","backgroundColor","isCollapsed","isDisabled","isExpanded","isHidden","isShrunk","isSolo","onClick","onMouseEnter","onMouseLeave","showLabel","shouldUseContentWidth","height","isPrimary","isSecondary","actionColor","color","isActionDisabled","Boolean","disabledReason","trim","shouldShowDisabledReason","actionContent","createElement","$height","icon","icons","size","initial","animate","opacity","width","marginLeft","exit","transition","style","label","disabled","$backgroundColor","$isCollapsed","$isExpanded","undefined","$isInteractionDisabled","$isHidden","$isPrimary","$isSecondary","$isShrunk","$isSolo","$pulseColors","status","pulseColors","$statusType","type","$shouldUseContentWidth","alignment","BottomRight","item","text","maxItemWidth","displayName"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.tsx"],"sourcesContent":["import { AnimatePresence } from 'motion/react';\nimport React, { FC, MouseEvent } from 'react';\nimport Icon from '../../icon/Icon';\nimport Tooltip from '../../tooltip/Tooltip';\nimport {\n StyledActionButton,\n StyledActionContent,\n StyledIconSlot,\n StyledLabelWrapper,\n StyledSecondaryLabel,\n} from './ActionButton.styles';\nimport type { MultiActionButtonAction } from '../MultiActionButton.types';\nimport { PopupAlignment } from '../../../types/popup';\n\nconst LABEL_GAP = 6;\nconst LABEL_TRANSITION = { duration: 0.3 };\n\nexport type ActionButtonProps = {\n action: MultiActionButtonAction;\n actionType: 'primary' | 'secondary';\n backgroundColor?: string;\n isCollapsed: boolean;\n isDisabled: boolean;\n isExpanded?: boolean;\n isHidden?: boolean;\n isShrunk?: boolean;\n isSolo?: boolean;\n onClick?: (event: MouseEvent<HTMLButtonElement>) => void;\n onMouseEnter?: () => void;\n onMouseLeave?: () => void;\n showLabel: boolean;\n shouldUseContentWidth: boolean;\n height: number;\n};\n\n/**\n * Shared action button UI used by both primary and secondary actions.\n * Keeps layout and animations consistent while isolating styling details.\n */\nconst ActionButton: FC<ActionButtonProps> = ({\n action,\n actionType,\n backgroundColor,\n isCollapsed,\n isDisabled,\n isExpanded,\n isHidden,\n isShrunk,\n isSolo,\n onClick,\n onMouseEnter,\n onMouseLeave,\n showLabel,\n shouldUseContentWidth,\n height,\n}) => {\n const isPrimary = actionType === 'primary';\n const isSecondary = actionType === 'secondary';\n const actionColor = action.color ?? '#FFFFFF';\n const isActionDisabled = isDisabled || Boolean(action.isDisabled);\n const disabledReason = action.disabledReason?.trim();\n const shouldShowDisabledReason = Boolean(disabledReason) && isActionDisabled;\n\n const actionContent = (\n <StyledActionContent>\n <StyledIconSlot $height={height}>\n {typeof action.icon === 'string' ? (\n <Icon icons={[action.icon]} color={actionColor} size={height - 24} />\n ) : (\n action.icon\n )}\n </StyledIconSlot>\n <AnimatePresence initial={false}>\n {/* Animate width and margin to avoid layout jumps when labels mount/unmount. */}\n {showLabel && (\n <StyledLabelWrapper\n animate={{ opacity: 1, width: 'auto', marginLeft: LABEL_GAP }}\n exit={{ opacity: 0, width: 0, marginLeft: 0 }}\n initial={{ opacity: 0, width: 0, marginLeft: 0 }}\n transition={LABEL_TRANSITION}\n >\n <StyledSecondaryLabel style={{ color: actionColor }}>\n {action.label}\n </StyledSecondaryLabel>\n </StyledLabelWrapper>\n )}\n </AnimatePresence>\n </StyledActionContent>\n );\n\n return (\n <StyledActionButton\n aria-disabled={isActionDisabled}\n disabled={isActionDisabled && !shouldShowDisabledReason}\n $backgroundColor={backgroundColor}\n $isCollapsed={isCollapsed}\n $isExpanded={isSecondary ? isExpanded : undefined}\n $isInteractionDisabled={isActionDisabled}\n $isHidden={isSecondary ? isHidden : undefined}\n $isPrimary={isPrimary}\n $isSecondary={isSecondary}\n $isShrunk={isPrimary ? isShrunk : undefined}\n $isSolo={isPrimary ? isSolo : undefined}\n $pulseColors={action.status?.pulseColors}\n $height={height}\n $statusType={action.status?.type}\n $shouldUseContentWidth={shouldUseContentWidth}\n onClick={onClick}\n onMouseEnter={onMouseEnter}\n onMouseLeave={onMouseLeave}\n type=\"button\"\n >\n {shouldShowDisabledReason && disabledReason ? (\n <Tooltip\n alignment={PopupAlignment.BottomRight}\n item={{ text: disabledReason }}\n maxItemWidth={400}\n >\n {actionContent}\n </Tooltip>\n ) : (\n actionContent\n )}\n </StyledActionButton>\n );\n};\n\nActionButton.displayName = 'ActionButton';\n\nexport default ActionButton;\n"],"mappings":"AAAA,SAASA,eAAe,QAAQ,cAAc;AAC9C,OAAOC,KAAK,MAA0B,OAAO;AAC7C,OAAOC,IAAI,MAAM,iBAAiB;AAClC,OAAOC,OAAO,MAAM,uBAAuB;AAC3C,SACIC,kBAAkB,EAClBC,mBAAmB,EACnBC,cAAc,EACdC,kBAAkB,EAClBC,oBAAoB,QACjB,uBAAuB;AAE9B,SAASC,cAAc,QAAQ,sBAAsB;AAErD,MAAMC,SAAS,GAAG,CAAC;AACnB,MAAMC,gBAAgB,GAAG;EAAEC,QAAQ,EAAE;AAAI,CAAC;AAoB1C;AACA;AACA;AACA;AACA,MAAMC,YAAmC,GAAGA,CAAC;EACzCC,MAAM;EACNC,UAAU;EACVC,eAAe;EACfC,WAAW;EACXC,UAAU;EACVC,UAAU;EACVC,QAAQ;EACRC,QAAQ;EACRC,MAAM;EACNC,OAAO;EACPC,YAAY;EACZC,YAAY;EACZC,SAAS;EACTC,qBAAqB;EACrBC;AACJ,CAAC,KAAK;EACF,MAAMC,SAAS,GAAGd,UAAU,KAAK,SAAS;EAC1C,MAAMe,WAAW,GAAGf,UAAU,KAAK,WAAW;EAC9C,MAAMgB,WAAW,GAAGjB,MAAM,CAACkB,KAAK,IAAI,SAAS;EAC7C,MAAMC,gBAAgB,GAAGf,UAAU,IAAIgB,OAAO,CAACpB,MAAM,CAACI,UAAU,CAAC;EACjE,MAAMiB,cAAc,GAAGrB,MAAM,CAACqB,cAAc,EAAEC,IAAI,CAAC,CAAC;EACpD,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C,YAAY,EAAEtC,WAAY;IAC1BuC,WAAW,EAAE1B,WAAW,GAAGX,UAAU,GAAGsC,SAAU;IAClDC,sBAAsB,EAAEzB,gBAAiB;IACzC0B,SAAS,EAAE7B,WAAW,GAAGV,QAAQ,GAAGqC,SAAU;IAC9CG,UAAU,EAAE/B,SAAU;IACtBgC,YAAY,EAAE/B,WAAY;IAC1BgC,SAAS,EAAEjC,SAAS,GAAGR,QAAQ,GAAGoC,SAAU;IAC5CM,OAAO,EAAElC,SAAS,GAAGP,MAAM,GAAGmC,SAAU;IACxCO,YAAY,EAAElD,MAAM,CAACmD,MAAM,EAAEC,WAAY;IACzC1B,OAAO,EAAEZ,MAAO;IAChBuC,WAAW,EAAErD,MAAM,CAACmD,MAAM,EAAEG,IAAK;IACjCC,sBAAsB,EAAE1C,qBAAsB;IAC9CJ,OAAO,EAAEA,OAAQ;IACjBC,YAAY,EAAEA,YAAa;IAC3BC,YAAY,EAAEA,YAAa;IAC3B2C,IAAI,EAAC;EAAQ,GAEZ/B,wBAAwB,IAAIF,cAAc,gBACvClC,KAAA,CAAAsC,aAAA,CAACpC,OAAO;IACJmE,SAAS,EAAE7D,cAAc,CAAC8D,WAAY;IACtCC,IAAI,EAAE;MAAEC,IAAI,EAAEtC;IAAe,CAAE;IAC/BuC,YAAY,EAAE;EAAI,GAEjBpC,aACI,CAAC,GAEVA,aAEY,CAAC;AAE7B,CAAC;AAEDzB,YAAY,CAAC8D,WAAW,GAAG,cAAc;AAEzC,eAAe9D,YAAY","ignoreList":[]}
|
|
@@ -132,6 +132,13 @@ export const StyledActionButton = styled.button`
|
|
|
132
132
|
border-radius: ${props.$height / 2}px;
|
|
133
133
|
`}
|
|
134
134
|
|
|
135
|
+
${({
|
|
136
|
+
$isInteractionDisabled
|
|
137
|
+
}) => $isInteractionDisabled && css`
|
|
138
|
+
cursor: default;
|
|
139
|
+
opacity: 0.5;
|
|
140
|
+
`}
|
|
141
|
+
|
|
135
142
|
/* Optional pulse overlay used by status. */
|
|
136
143
|
${({
|
|
137
144
|
$statusType,
|
|
@@ -155,12 +162,15 @@ export const StyledActionButton = styled.button`
|
|
|
155
162
|
opacity: 0.5;
|
|
156
163
|
}
|
|
157
164
|
|
|
158
|
-
|
|
159
|
-
|
|
165
|
+
${({
|
|
166
|
+
$isInteractionDisabled,
|
|
160
167
|
$backgroundColor,
|
|
161
168
|
theme
|
|
162
|
-
}) =>
|
|
163
|
-
|
|
169
|
+
}) => !$isInteractionDisabled && css`
|
|
170
|
+
&:hover:not(:disabled) {
|
|
171
|
+
background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};
|
|
172
|
+
}
|
|
173
|
+
`}
|
|
164
174
|
`;
|
|
165
175
|
export const StyledActionContent = styled.span`
|
|
166
176
|
align-items: center;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionButton.styles.js","names":["motion","styled","css","keyframes","MultiActionButtonStatusType","pulse","color1","color2","StyledActionButton","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$statusType","$pulseColors","Pulse","StyledActionContent","span","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n &:hover:not(:disabled) {\n background-color: ${({ $backgroundColor, theme }) =>\n `color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,EAAEC,SAAS,QAAQ,mBAAmB;AAE1D,SAASC,2BAA2B,QAAQ,4BAA4B;AAiBxE,MAAMC,KAAK,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAKJ,SAAS;AAC3D;AACA,sBAAsBG,MAAM;AAC5B;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA,sBAAsBD,MAAM;AAC5B;AACA,CAAC;AAED,OAAO,MAAME,kBAAkB,GAAGP,MAAM,CAACQ,MAA+B;AACxE;AACA;AACA,qBAAqB,CAAC;EAAEC;AAAQ,CAAC,KAAKA,OAAO,GAAG,CAAC;AACjD;AACA;AACA;AACA,cAAc,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,kBAAkB,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AAC1C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,wBAAwB,CAAC;EAAEC,gBAAgB;EAAEC;AAAM,CAAC,KAC5CD,gBAAgB,IAAIC,KAAK,EAAEC,OAAO,IAAI,MAAM;AACpD;AACA;AACA;AACA,MAAM,CAAC;EAAEC;AAAuB,CAAC,KACzBA,sBAAsB,IACtBZ,GAAG;AACX;AACA,SAAS;AACT;AACA;AACA,MAAM,CAAC;EAAEa,WAAW;EAAED;AAAuB,CAAC,KACtCC,WAAW,IACX,CAACD,sBAAsB,IACvBZ,GAAG;AACX;AACA;AACA,SAAS;AACT;AACA;AACA,MAAOc,KAAK,IACJA,KAAK,CAACC,YAAY,IACl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OAAO,GAAG,CAAC;AAC9C,SAAS;AACT;AACA;AACA,MAAM,CAAC;EAAEa,WAAW;EAAEC;AAAa,CAAC,KAC5BD,WAAW,KAAKnB,2BAA2B,CAACqB,KAAK,IACjDvB,GAAG;AACX;AACA;AACA;AACA,6BAA6BG,KAAK,CAACmB,YAAY,GAAG,CAAC,CAAC,IAAI,SAAS,EAAEA,YAAY,GAAG,CAAC,CAAC,IAAI,SAAS,CAAC;AAClG;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAAS;AACT;AACA;AACA;AACA;AACA;AACA;AACA;AACA,4BAA4B,CAAC;EAAEb,gBAAgB;EAAEC;AAAM,CAAC,KAC5C,sBAAsBD,gBAAgB,IAAIC,KAAK,EAAEC,OAAO,IAAI,MAAM,cAAc;AAC5F;AACA,CAAC;AAED,OAAO,MAAMa,mBAAmB,GAAGzB,MAAM,CAAC0B,IAAI;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG3B,MAAM,CAAC0B,IAAyB;AAC9D;AACA;AACA;AACA,cAAc,CAAC;EAAEjB;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,aAAa,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AACrC,CAAC;AAED,OAAO,MAAMmB,kBAAkB,GAAG5B,MAAM,CAACD,MAAM,CAAC2B,IAAI,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,oBAAoB,GAAG7B,MAAM,CAAC0B,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"ActionButton.styles.js","names":["motion","styled","css","keyframes","MultiActionButtonStatusType","pulse","color1","color2","StyledActionButton","button","$height","$backgroundColor","theme","primary","$shouldUseContentWidth","$isExpanded","props","$isCollapsed","$isPrimary","$isShrunk","$isSecondary","$isHidden","$isSolo","$isInteractionDisabled","$statusType","$pulseColors","Pulse","StyledActionContent","span","StyledIconSlot","StyledLabelWrapper","StyledSecondaryLabel"],"sources":["../../../../../src/components/multi-action-button/action-button/ActionButton.styles.ts"],"sourcesContent":["import { motion } from 'motion/react';\nimport styled, { css, keyframes } from 'styled-components';\nimport type { WithTheme } from '../../color-scheme-provider/ColorSchemeProvider';\nimport { MultiActionButtonStatusType } from '../MultiActionButton.types';\n\ntype StyledActionButtonProps = WithTheme<{\n $backgroundColor?: string;\n $isCollapsed?: boolean;\n $isExpanded?: boolean;\n $isHidden?: boolean;\n $isPrimary?: boolean;\n $isSecondary?: boolean;\n $isShrunk?: boolean;\n $isSolo?: boolean;\n $pulseColors?: [string, string];\n $isInteractionDisabled?: boolean;\n $height: number;\n $statusType?: MultiActionButtonStatusType;\n $shouldUseContentWidth?: boolean;\n}>;\n\nconst pulse = (color1: string, color2: string) => keyframes`\n 0% {\n background: ${color1};\n }\n 50% {\n background: ${color2};\n }\n 100% {\n background: ${color1};\n }\n`;\n\nexport const StyledActionButton = styled.button<StyledActionButtonProps>`\n align-items: center;\n border: none;\n border-radius: ${({ $height }) => $height / 2}px;\n cursor: pointer;\n display: inline-flex;\n flex: 1 1 auto;\n height: ${({ $height }) => $height}px;\n line-height: 22px;\n min-height: ${({ $height }) => $height}px;\n overflow: hidden;\n padding: 0;\n position: relative;\n transition:\n background-color 0.2s ease,\n border-radius 0.2s ease,\n color 0.2s ease,\n flex-grow 0.2s ease,\n opacity 0.2s ease,\n padding 0.2s ease,\n width 0.2s ease;\n user-select: none;\n white-space: nowrap;\n\n background-color: ${({ $backgroundColor, theme }) =>\n $backgroundColor || theme?.primary || '#000'};\n color: #fff;\n\n /* When width is content-driven, avoid flex stretching. */\n ${({ $shouldUseContentWidth }) =>\n $shouldUseContentWidth &&\n css`\n flex: 0 1 auto;\n `}\n\n /* Expanded secondary button when width is not content-driven. */\n ${({ $isExpanded, $shouldUseContentWidth }) =>\n $isExpanded &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Collapsed state clamps to a fixed icon size. */\n ${(props) =>\n props.$isCollapsed &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Primary action stretches unless content-driven. */\n ${({ $isPrimary, $isCollapsed, $shouldUseContentWidth }) =>\n $isPrimary &&\n !$isCollapsed &&\n !$shouldUseContentWidth &&\n css`\n flex: 1 1 auto;\n min-width: 0;\n `}\n\n /* Shrink the primary action to icon size when secondary is expanded. */\n ${(props) =>\n props.$isShrunk &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Keep secondary icon-only when collapsed and not expanded. */\n ${(props) =>\n props.$isSecondary &&\n !props.$isExpanded &&\n !props.$shouldUseContentWidth &&\n css`\n flex: 0 0 auto;\n padding: 0;\n width: ${props.$height}px;\n `}\n\n /* Fully hide the secondary action when the whole control is collapsed. */\n ${({ $isHidden }) =>\n $isHidden &&\n css`\n opacity: 0;\n pointer-events: none;\n width: 0;\n `}\n\n /* Joining both buttons into a pill shape. */\n ${({ $isPrimary }) =>\n $isPrimary &&\n css`\n border-bottom-right-radius: 0;\n border-top-right-radius: 0;\n `}\n\n ${(props) =>\n props.$isPrimary &&\n props.$isCollapsed &&\n css`\n border-bottom-right-radius: ${props.$height / 2}px;\n border-top-right-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isSecondary }) =>\n $isSecondary &&\n css`\n border-bottom-left-radius: 0;\n border-top-left-radius: 0;\n `}\n\n ${(props) =>\n props.$isSolo &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${(props) =>\n props.$isCollapsed &&\n css`\n border-radius: ${props.$height / 2}px;\n `}\n\n ${({ $isInteractionDisabled }) =>\n $isInteractionDisabled &&\n css`\n cursor: default;\n opacity: 0.5;\n `}\n\n /* Optional pulse overlay used by status. */\n ${({ $statusType, $pulseColors }) =>\n $statusType === MultiActionButtonStatusType.Pulse &&\n css`\n overflow: hidden;\n\n &::before {\n animation: ${pulse($pulseColors?.[0] || '#A50000', $pulseColors?.[1] || '#630000')}\n 1.6s ease-in-out infinite;\n border-radius: 3px;\n content: '';\n inset: 0;\n pointer-events: none;\n position: absolute;\n }\n `}\n\n &:disabled {\n cursor: default;\n opacity: 0.5;\n }\n\n ${({ $isInteractionDisabled, $backgroundColor, theme }) =>\n !$isInteractionDisabled &&\n css`\n &:hover:not(:disabled) {\n background-color: ${`color-mix(in srgb, ${$backgroundColor || theme?.primary || '#000'} 85%, black)`};\n }\n `}\n`;\n\nexport const StyledActionContent = styled.span`\n align-items: center;\n display: inline-flex;\n flex: 1 1 auto;\n gap: 0;\n min-width: 0;\n position: relative;\n z-index: 1;\n`;\n\nexport const StyledIconSlot = styled.span<{ $height: number }>`\n align-items: center;\n display: inline-flex;\n flex: 0 0 auto;\n height: ${({ $height }) => $height}px;\n justify-content: center;\n width: ${({ $height }) => $height}px;\n`;\n\nexport const StyledLabelWrapper = styled(motion.span)`\n /* The wrapper animates width/margin to avoid layout jumps. */\n display: inline-flex;\n flex: 1 1 auto;\n min-width: 0;\n overflow: hidden;\n text-align: left;\n`;\n\nexport const StyledSecondaryLabel = styled.span`\n display: block;\n flex: 1 1 auto;\n min-width: 0;\n max-width: 100%;\n overflow: hidden;\n padding-right: 18px;\n text-overflow: ellipsis;\n white-space: nowrap;\n`;\n"],"mappings":"AAAA,SAASA,MAAM,QAAQ,cAAc;AACrC,OAAOC,MAAM,IAAIC,GAAG,EAAEC,SAAS,QAAQ,mBAAmB;AAE1D,SAASC,2BAA2B,QAAQ,4BAA4B;AAkBxE,MAAMC,KAAK,GAAGA,CAACC,MAAc,EAAEC,MAAc,KAAKJ,SAAS;AAC3D;AACA,sBAAsBG,MAAM;AAC5B;AACA;AACA,sBAAsBC,MAAM;AAC5B;AACA;AACA,sBAAsBD,MAAM;AAC5B;AACA,CAAC;AAED,OAAO,MAAME,kBAAkB,GAAGP,MAAM,CAACQ,MAA+B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AsBS,gBAAgB,IAAIC,KAAK,EAAEC,OAAO,IAAI,MAAM,cAAc;AACpH;AACA,SAAS;AACT,CAAC;AAED,OAAO,MAAMc,mBAAmB,GAAG1B,MAAM,CAAC2B,IAAI;AAC9C;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMC,cAAc,GAAG5B,MAAM,CAAC2B,IAAyB;AAC9D;AACA;AACA;AACA,cAAc,CAAC;EAAElB;AAAQ,CAAC,KAAKA,OAAO;AACtC;AACA,aAAa,CAAC;EAAEA;AAAQ,CAAC,KAAKA,OAAO;AACrC,CAAC;AAED,OAAO,MAAMoB,kBAAkB,GAAG7B,MAAM,CAACD,MAAM,CAAC4B,IAAI,CAAC;AACrD;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AAED,OAAO,MAAMG,oBAAoB,GAAG9B,MAAM,CAAC2B,IAAI;AAC/C;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC","ignoreList":[]}
|
|
@@ -91,6 +91,12 @@ export type MultiActionButtonAction = {
|
|
|
91
91
|
* @optional
|
|
92
92
|
*/
|
|
93
93
|
isDisabled?: boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Optional reason shown in a tooltip when the action is disabled.
|
|
96
|
+
* @description Use this to explain why the action is currently unavailable.
|
|
97
|
+
* @optional
|
|
98
|
+
*/
|
|
99
|
+
disabledReason?: string;
|
|
94
100
|
/**
|
|
95
101
|
* The optional label for the action.
|
|
96
102
|
* @description The label is shown next to the icon and will be truncated with ellipsis when
|
|
@@ -10,6 +10,7 @@ type StyledActionButtonProps = WithTheme<{
|
|
|
10
10
|
$isShrunk?: boolean;
|
|
11
11
|
$isSolo?: boolean;
|
|
12
12
|
$pulseColors?: [string, string];
|
|
13
|
+
$isInteractionDisabled?: boolean;
|
|
13
14
|
$height: number;
|
|
14
15
|
$statusType?: MultiActionButtonStatusType;
|
|
15
16
|
$shouldUseContentWidth?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@chayns-components/core",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.9",
|
|
4
4
|
"description": "A set of beautiful React components for developing your own applications with chayns.",
|
|
5
5
|
"sideEffects": false,
|
|
6
6
|
"browserslist": [
|
|
@@ -86,5 +86,5 @@
|
|
|
86
86
|
"publishConfig": {
|
|
87
87
|
"access": "public"
|
|
88
88
|
},
|
|
89
|
-
"gitHead": "
|
|
89
|
+
"gitHead": "bcd0a506394b53466667deac455edf4d408fc2f2"
|
|
90
90
|
}
|