@luscii-healthtech/web-ui 58.6.5 → 58.6.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.development.js +19 -14
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/src/components/ActionCard/ActionCard.d.ts +7 -2
- package/dist/src/components/ActionCard/ActionIcon.d.ts +15 -0
- package/dist/src/components/ActionCardDetailed/ActionCardDetailed.d.ts +7 -2
- package/dist/src/generated/components/ActionCard/ActionCard.d.ts +7 -2
- package/dist/src/generated/components/ActionCard/ActionIcon.d.ts +15 -0
- package/dist/src/generated/components/ActionCardDetailed/ActionCardDetailed.d.ts +7 -2
- package/dist/stories/ActionCard.stories.d.ts +12 -0
- package/dist/stories/ActionCardDetailed.stories.d.ts +1 -1
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +2 -9
|
@@ -5113,14 +5113,27 @@ const typeIcons = {
|
|
|
5113
5113
|
information: ActionInformationColoredIcon,
|
|
5114
5114
|
contact: ActionContactColoredIcon,
|
|
5115
5115
|
lesson: ActionLessonColoredIcon,
|
|
5116
|
-
calculation: ActionCalculationColoredIcon
|
|
5117
|
-
measurement: ActionBloodPressureColoredIcon
|
|
5116
|
+
calculation: ActionCalculationColoredIcon
|
|
5118
5117
|
};
|
|
5119
|
-
const
|
|
5118
|
+
const ActionIcon = ({ type, iconUrl, size = 20 }) => {
|
|
5119
|
+
const [hasImageError, setHasImageError] = React.useState(false);
|
|
5120
|
+
React.useEffect(() => {
|
|
5121
|
+
setHasImageError(false);
|
|
5122
|
+
}, [type, iconUrl]);
|
|
5123
|
+
if (type === "measurement") {
|
|
5124
|
+
if (!iconUrl || hasImageError) {
|
|
5125
|
+
return jsxRuntime.jsx(ImageIcon, { "aria-hidden": true, width: size, height: size, className: "ui:shrink-0 ui:text-slate-300" });
|
|
5126
|
+
}
|
|
5127
|
+
return jsxRuntime.jsx(Image$1, { src: iconUrl, alt: "", "data-chromatic": "ignore", width: size, height: size, className: "ui:shrink-0", showIconOnFailure: false, onError: () => setHasImageError(true) });
|
|
5128
|
+
}
|
|
5120
5129
|
const TypeIcon = typeIcons[type];
|
|
5130
|
+
return jsxRuntime.jsx(TypeIcon, { "aria-hidden": true, width: size, height: size, className: "ui:shrink-0" });
|
|
5131
|
+
};
|
|
5132
|
+
|
|
5133
|
+
const ActionCard = ({ type, iconUrl, title, metadata, instruments, actions, draggable = false, titleAs = "h3", variant = "default", onClick, className }) => {
|
|
5121
5134
|
const isCompact = variant === "compact";
|
|
5122
5135
|
const isList = variant === "list";
|
|
5123
|
-
return jsxRuntime.jsx(Card, { borderRadius: "m", elevation: isList ? "surface" : "small", elevationOnHover: isList ? void 0 : "medium", padding: false, className: classNames__default.default("ui:w-full", className), children: jsxRuntime.jsxs(Stack, { axis: "x", align: "start", justify: "between", _gap: "base", _p: "l", children: [draggable && jsxRuntime.jsx(Box, { className: "ui:relative ui:z-[1] ui:shrink-0 ui:self-center", children: jsxRuntime.jsx(DragHandle, { grabbing: false }) }), jsxRuntime.jsxs(Stack, { _gap: isCompact ? "s" : "m", className: "ui:min-w-0 ui:flex-1", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "center", _gap: "base", children: [jsxRuntime.jsx(
|
|
5136
|
+
return jsxRuntime.jsx(Card, { borderRadius: "m", elevation: isList ? "surface" : "small", elevationOnHover: isList ? void 0 : "medium", padding: false, className: classNames__default.default("ui:w-full", className), children: jsxRuntime.jsxs(Stack, { axis: "x", align: "start", justify: "between", _gap: "base", _p: "l", children: [draggable && jsxRuntime.jsx(Box, { className: "ui:relative ui:z-[1] ui:shrink-0 ui:self-center", children: jsxRuntime.jsx(DragHandle, { grabbing: false }) }), jsxRuntime.jsxs(Stack, { _gap: isCompact ? "s" : "m", className: "ui:min-w-0 ui:flex-1", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "center", _gap: "base", children: [jsxRuntime.jsx(ActionIcon, { type, iconUrl }), jsxRuntime.jsx(Heading, { as: titleAs, variant: "h4", className: "ui:min-w-0", children: onClick ? (
|
|
5124
5137
|
/**
|
|
5125
5138
|
* The whole card is the click target, but it cannot be a
|
|
5126
5139
|
* `<button>` because the `actions` slot and the drag handle
|
|
@@ -5142,18 +5155,10 @@ const ActionCard = ({ type, title, metadata, instruments, actions, draggable = f
|
|
|
5142
5155
|
}) })] }), actions && jsxRuntime.jsx(Box, { className: "ui:relative ui:z-[1] ui:shrink-0 ui:self-center", children: actions })] }) });
|
|
5143
5156
|
};
|
|
5144
5157
|
|
|
5145
|
-
const actionIcons = {
|
|
5146
|
-
information: ActionInformationColoredIcon,
|
|
5147
|
-
contact: ActionContactColoredIcon,
|
|
5148
|
-
lesson: ActionLessonColoredIcon,
|
|
5149
|
-
calculation: ActionCalculationColoredIcon,
|
|
5150
|
-
measurement: ActionBloodPressureColoredIcon
|
|
5151
|
-
};
|
|
5152
5158
|
const ScheduleItem = ({ icon, label, value, detail }) => jsxRuntime.jsxs(Stack, { axis: "x", align: "start", _gap: "base", children: [jsxRuntime.jsx(Box, { "aria-hidden": true, _p: "s", className: "ui:size-[var(--ui-semantic-size-xl)] ui:shrink-0 ui:[border-radius:var(--ui-semantic-radius-s)]", children: icon }), jsxRuntime.jsxs(Stack, { _gap: "none", className: "ui:min-w-0", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "baseline", _gap: "s", wrap: true, children: [jsxRuntime.jsx(Text, { variant: "body-base-light", color: "neutral-secondary", children: label }), jsxRuntime.jsx(Text, { variant: "body-base-regular", color: "neutral-secondary", children: value })] }), detail && jsxRuntime.jsx(Text, { variant: "body-small-regular", color: "neutral-secondary", children: detail })] })] });
|
|
5153
|
-
const ActionCardDetailed = ({ type, title, category, metadata, schedule, scheduleHeading = "Schedule settings", instruments, instrumentsHeading = "Instruments in this action", onEdit, onDelete, onClose, className }) => {
|
|
5154
|
-
const ActionIcon = actionIcons[type];
|
|
5159
|
+
const ActionCardDetailed = ({ type, iconUrl, title, category, metadata, schedule, scheduleHeading = "Schedule settings", instruments, instrumentsHeading = "Instruments in this action", onEdit, onDelete, onClose, className }) => {
|
|
5155
5160
|
const hasActions = onEdit || onDelete || onClose;
|
|
5156
|
-
return jsxRuntime.jsx(Card, { border: true, borderRadius: "m", elevation: "medium", className: classNames__default.default("ui:w-full ui:max-w-[600px]", className), children: jsxRuntime.jsxs(Stack, { _gap: "xl", width: "full", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "start", justify: "between", _gap: "base", width: "full", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "start", _gap: "base", className: "ui:min-w-0", children: [jsxRuntime.jsx(ActionIcon, {
|
|
5161
|
+
return jsxRuntime.jsx(Card, { border: true, borderRadius: "m", elevation: "medium", className: classNames__default.default("ui:w-full ui:max-w-[600px]", className), children: jsxRuntime.jsxs(Stack, { _gap: "xl", width: "full", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "start", justify: "between", _gap: "base", width: "full", children: [jsxRuntime.jsxs(Stack, { axis: "x", align: "start", _gap: "base", className: "ui:min-w-0", children: [jsxRuntime.jsx(ActionIcon, { type, iconUrl, size: 24 }), jsxRuntime.jsxs(Stack, { _gap: "none", className: "ui:min-w-0", children: [jsxRuntime.jsx(Heading, { variant: "h3", children: title }), category && jsxRuntime.jsx(Text, { variant: "body-base-regular", color: "neutral-secondary", children: category })] })] }), hasActions && jsxRuntime.jsxs(Stack, { axis: "x", align: "center", _gap: "base", className: "ui:shrink-0", children: [onEdit && jsxRuntime.jsx(TertiaryIconButton, { label: "Edit action", onClick: onEdit, children: jsxRuntime.jsx(PencilIcon, { "aria-hidden": true }) }), onDelete && jsxRuntime.jsx(TertiaryIconButton, { label: "Delete action", onClick: onDelete, children: jsxRuntime.jsx(TrashBinIcon, { "aria-hidden": true }) }), onClose && jsxRuntime.jsx(TertiaryIconButton, { label: "Close action details", onClick: onClose, children: jsxRuntime.jsx(CrossIcon, { "aria-hidden": true }) })] })] }), metadata && metadata.length > 0 && jsxRuntime.jsx(Stack, { axis: "x", _gap: "base", wrap: true, children: metadata.map((item, index) => jsxRuntime.jsx(
|
|
5157
5162
|
Tag,
|
|
5158
5163
|
{ _size: "large", _type: "neutral", _variant: "flat", children: item },
|
|
5159
5164
|
`${index}-${item}`
|