@luscii-healthtech/web-ui 58.4.0 → 58.6.0

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.
@@ -2556,8 +2556,22 @@ const LabelText = (props) => {
2556
2556
  };
2557
2557
 
2558
2558
  const StyledCheckbox = React__namespace.default.forwardRef((props, ref) => {
2559
- const { className } = props, attributes = __rest(props, ["className"]);
2560
- return jsxRuntime.jsx("input", Object.assign({ ref, type: "checkbox" }, attributes, { className: classNames__default.default(
2559
+ const { className, indeterminate } = props, attributes = __rest(props, ["className", "indeterminate"]);
2560
+ const inputRef = React__namespace.default.useRef(null);
2561
+ const setRefs = React__namespace.default.useCallback((node) => {
2562
+ inputRef.current = node;
2563
+ if (typeof ref === "function") {
2564
+ ref(node);
2565
+ } else if (ref) {
2566
+ ref.current = node;
2567
+ }
2568
+ }, [ref]);
2569
+ React__namespace.default.useEffect(() => {
2570
+ if (inputRef.current) {
2571
+ inputRef.current.indeterminate = !!indeterminate;
2572
+ }
2573
+ });
2574
+ return jsxRuntime.jsx("input", Object.assign({ ref: setRefs }, attributes, { type: "checkbox", className: classNames__default.default(
2561
2575
  "ui:block ui:appearance-none ui:w-6 ui:h-6 ui:rounded",
2562
2576
  "ui:cursor-pointer ui:disabled:cursor-not-allowed",
2563
2577
  // Default styles
@@ -2566,15 +2580,21 @@ const StyledCheckbox = React__namespace.default.forwardRef((props, ref) => {
2566
2580
  "ui:hover:border-border-neutral-primary-hovered",
2567
2581
  // Checked styles
2568
2582
  "ui:checked:bg-icon-brand-primary-default ui:checked:border-border-brand-primary-default ui:checked:before:scale-[1]",
2583
+ // Indeterminate styles
2584
+ "ui:indeterminate:bg-icon-brand-primary-default ui:indeterminate:border-border-brand-primary-default ui:indeterminate:before:scale-[1]",
2569
2585
  // Disabled styles
2570
2586
  "ui:disabled:border-border-neutral-primary-disabled",
2571
2587
  // Disabled and checked styles
2572
2588
  "ui:disabled:checked:bg-icon-brand-primary-disabled",
2589
+ // Disabled and indeterminate styles
2590
+ "ui:disabled:indeterminate:bg-icon-brand-primary-disabled",
2573
2591
  // Checked and hovered styles
2574
2592
  "ui:checked:hover:bg-icon-brand-primary-hover",
2593
+ // Indeterminate and hovered styles
2594
+ "ui:indeterminate:hover:bg-icon-brand-primary-hover",
2575
2595
  "ui:transition-colors ui:duration-150 ui:ease-in-out",
2576
2596
  "ui:before:content-[''] ui:before:block ui:before:w-full ui:before:h-full",
2577
- "ui:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M13.0421%200.43918C13.3233%200.720471%2013.4812%201.10193%2013.4812%201.49968C13.4812%201.89743%2013.3233%202.27889%2013.0421%202.56018L5.54207%2010.0602C5.26078%2010.3414%204.87931%2010.4994%204.48157%2010.4994C4.08382%2010.4994%203.70236%2010.3414%203.42107%2010.0602L0.421068%207.06018C0.147831%206.77728%20-0.00336092%206.39837%205.6704e-05%206.00508C0.00347433%205.61178%200.161228%205.23556%200.43934%204.95745C0.717452%204.67934%201.09367%204.52159%201.48697%204.51817C1.88026%204.51475%202.25916%204.66594%202.54207%204.93918L4.48157%206.87868L10.9211%200.43918C11.2024%200.157973%2011.5838%200%2011.9816%200C12.3793%200%2012.7608%200.157973%2013.0421%200.43918Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:before:bg-center ui:before:bg-no-repeat",
2597
+ "ui:not-indeterminate:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2214%22%20height%3D%2211%22%20viewBox%3D%220%200%2014%2011%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M13.0421%200.43918C13.3233%200.720471%2013.4812%201.10193%2013.4812%201.49968C13.4812%201.89743%2013.3233%202.27889%2013.0421%202.56018L5.54207%2010.0602C5.26078%2010.3414%204.87931%2010.4994%204.48157%2010.4994C4.08382%2010.4994%203.70236%2010.3414%203.42107%2010.0602L0.421068%207.06018C0.147831%206.77728%20-0.00336092%206.39837%205.6704e-05%206.00508C0.00347433%205.61178%200.161228%205.23556%200.43934%204.95745C0.717452%204.67934%201.09367%204.52159%201.48697%204.51817C1.88026%204.51475%202.25916%204.66594%202.54207%204.93918L4.48157%206.87868L10.9211%200.43918C11.2024%200.157973%2011.5838%200%2011.9816%200C12.3793%200%2012.7608%200.157973%2013.0421%200.43918Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:indeterminate:before:bg-[url('data:image/svg+xml;utf8,%3Csvg%20width%3D%2210%22%20height%3D%222%22%20viewBox%3D%220%200%2010%202%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M9%20-4.37114e-08C9.55228%20-1.95703e-08%2010%200.447715%2010%201C10%201.55228%209.55228%202%209%202L1%202C0.447716%202%20-6.78525e-08%201.55228%20-4.37114e-08%201C-1.95703e-08%200.447715%200.447715%20-4.17544e-07%201%20-3.93402e-07L9%20-4.37114e-08Z%22%20fill%3D%22white%22%2F%3E%3C%2Fsvg%3E')] ui:before:bg-center ui:before:bg-no-repeat",
2578
2598
  "ui:before:scale-[0] ui:before:transition-[scale] ui:before:duration-200 ui:before:ease-[cubic-bezier(.17,.67,.16,1.5)]",
2579
2599
  className
2580
2600
  ) }));
@@ -3864,46 +3884,25 @@ var CheckboxState;
3864
3884
  })(CheckboxState || (CheckboxState = {}));
3865
3885
 
3866
3886
  const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCollapsed = true, collapsible = true }) => {
3867
- const [groupCheckboxState, setGroupCheckboxState] = React.useState(CheckboxState.UNCHECKED);
3887
+ const groupCheckboxId = React__namespace.default.useId();
3868
3888
  const [collapsed, setCollapsed] = React.useState(collapsible ? isCollapsed : false);
3869
- const [isDisabled, setIsDisabled] = React.useState(false);
3870
- React.useEffect(() => {
3871
- if (items.length === 0) {
3872
- return;
3873
- }
3874
- const enabledItems = items.filter((item) => !item.isDisabled);
3875
- const allItemsChecked = items.every((item) => item.isChecked);
3876
- if (enabledItems.length === 0) {
3877
- setGroupCheckboxState(allItemsChecked ? CheckboxState.CHECKED : CheckboxState.UNCHECKED);
3878
- setIsDisabled(true);
3879
- return;
3880
- }
3881
- const indeterminate = enabledItems.some((item) => item.isChecked !== enabledItems[0].isChecked);
3882
- if (indeterminate) {
3883
- setGroupCheckboxState(CheckboxState.INDETERMINATE);
3884
- return;
3885
- }
3886
- if (enabledItems[0].isChecked) {
3887
- setGroupCheckboxState(CheckboxState.CHECKED);
3888
- } else if (!enabledItems[0].isChecked) {
3889
- setGroupCheckboxState(CheckboxState.UNCHECKED);
3890
- }
3891
- setIsDisabled(!enabledItems.some((item) => !item.isDisabled));
3892
- }, [items]);
3889
+ const enabledItems = items.filter((item) => !item.isDisabled);
3890
+ const isDisabled = items.length > 0 && enabledItems.length === 0;
3891
+ const groupCheckboxState = getGroupCheckboxState({ items, enabledItems });
3893
3892
  const handleGroupClick = (event) => {
3894
3893
  event.stopPropagation();
3895
- const enabledItems = [];
3894
+ const itemsToChange = [];
3896
3895
  const newState = [];
3897
3896
  items.forEach((item) => {
3898
3897
  if (item.isDisabled) {
3899
3898
  newState.push(item);
3900
3899
  return;
3901
3900
  }
3902
- enabledItems.push(item);
3901
+ itemsToChange.push(item);
3903
3902
  newState.push(Object.assign(Object.assign({}, item), { isChecked: event.currentTarget.checked }));
3904
3903
  });
3905
3904
  const newCheckedValue = event.currentTarget.checked;
3906
- enabledItems.forEach((item) => onChange === null || onChange === void 0 ? void 0 : onChange({ id: item.id, newCheckedValue }));
3905
+ itemsToChange.forEach((item) => onChange === null || onChange === void 0 ? void 0 : onChange({ id: item.id, newCheckedValue }));
3907
3906
  onStateChange === null || onStateChange === void 0 ? void 0 : onStateChange(newState);
3908
3907
  };
3909
3908
  const handleGroupCollapse = (event) => {
@@ -3913,6 +3912,7 @@ const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCol
3913
3912
  }
3914
3913
  };
3915
3914
  const handleCheckboxChange = (e) => {
3915
+ e.stopPropagation();
3916
3916
  onChange === null || onChange === void 0 ? void 0 : onChange({
3917
3917
  id: e.target.id,
3918
3918
  newCheckedValue: e.target.checked
@@ -3926,14 +3926,31 @@ const CheckboxGroup = ({ title, items, onChange, onStateChange, className, isCol
3926
3926
  };
3927
3927
  const checkedItemsCount = items === null || items === void 0 ? void 0 : items.filter((item) => item === null || item === void 0 ? void 0 : item.isChecked).length;
3928
3928
  const groupTitle = checkedItemsCount > 0 ? `${title} (${checkedItemsCount})` : title;
3929
- return jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-col", className), children: [title && jsxRuntime.jsxs("div", { className: "ui:flex ui:w-full ui:flex-row ui:items-center", children: [jsxRuntime.jsx(Checkbox, { renderLabel: () => jsxRuntime.jsx(Text, { variant: "strong", children: groupTitle }), onChange: handleGroupClick, isChecked: groupCheckboxState === CheckboxState.CHECKED, isDisabled, isIndeterminate: groupCheckboxState === CheckboxState.INDETERMINATE, className: "ui:flex-1 ui:py-3" }, title), collapsible && jsxRuntime.jsx(GroupCollapseButton, { "aria-label": getGroupCollapseButtonAriaLabel({
3929
+ return jsxRuntime.jsxs("div", { className: classNames__default.default("ui:flex ui:flex-col", className), children: [title && jsxRuntime.jsxs("div", { className: "ui:flex ui:w-full ui:flex-row ui:items-center", children: [jsxRuntime.jsx(LabeledCheckbox, { id: groupCheckboxId, onChange: handleGroupClick, checked: groupCheckboxState === CheckboxState.CHECKED, indeterminate: groupCheckboxState === CheckboxState.INDETERMINATE, disabled: isDisabled, className: "ui:flex-1 ui:py-3", children: jsxRuntime.jsx(Text, { as: "span", variant: "strong", children: groupTitle }) }), collapsible && jsxRuntime.jsx(GroupCollapseButton, { "aria-label": getGroupCollapseButtonAriaLabel({
3930
3930
  groupTitle: title,
3931
3931
  collapsed
3932
- }), collapsed, type: "button", onClick: handleGroupCollapse })] }), !collapsed && items.map((item) => React.createElement(Checkbox, Object.assign({}, item, { key: item.id, text: item.label, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", {
3933
- "ui:ml-10": collapsible,
3934
- "ui:ml-5": !collapsible
3935
- }) })))] });
3932
+ }), collapsed, type: "button", onClick: handleGroupCollapse })] }), !collapsed && items.map((item) => {
3933
+ var _a;
3934
+ return jsxRuntime.jsx(LabeledCheckbox, { id: item.id, name: item.name, value: item.value, label: item.label, helperText: item.explanation, checked: (_a = item.isChecked) !== null && _a !== void 0 ? _a : false, disabled: item.isDisabled, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", {
3935
+ "ui:ml-10": collapsible,
3936
+ "ui:ml-5": !collapsible
3937
+ }, item.className) }, item.id);
3938
+ })] });
3936
3939
  };
3940
+ function getGroupCheckboxState(args) {
3941
+ const { items, enabledItems } = args;
3942
+ if (items.length === 0) {
3943
+ return CheckboxState.UNCHECKED;
3944
+ }
3945
+ if (enabledItems.length === 0) {
3946
+ return items.every((item) => item.isChecked) ? CheckboxState.CHECKED : CheckboxState.UNCHECKED;
3947
+ }
3948
+ const isIndeterminate = enabledItems.some((item) => item.isChecked !== enabledItems[0].isChecked);
3949
+ if (isIndeterminate) {
3950
+ return CheckboxState.INDETERMINATE;
3951
+ }
3952
+ return enabledItems[0].isChecked ? CheckboxState.CHECKED : CheckboxState.UNCHECKED;
3953
+ }
3937
3954
  function getGroupCollapseButtonAriaLabel(args) {
3938
3955
  const { groupTitle, collapsed } = args;
3939
3956
  const localizedActionLabel = collapsed ? "Expand" : "Collapse";
@@ -3956,6 +3973,7 @@ function GroupCollapseButton(props) {
3956
3973
 
3957
3974
  const CheckboxList = ({ groups, onChange, onStateChange, className }) => {
3958
3975
  const handleCheckboxChange = (e) => {
3976
+ e.stopPropagation();
3959
3977
  onChange === null || onChange === void 0 ? void 0 : onChange({
3960
3978
  id: e.target.id,
3961
3979
  newCheckedValue: e.target.checked
@@ -3984,7 +4002,10 @@ const CheckboxList = ({ groups, onChange, onStateChange, className }) => {
3984
4002
  const groupTitle = group.title;
3985
4003
  return jsxRuntime.jsx(CheckboxGroup, { items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange, onStateChange: (items) => handleGroupChange({ groupTitle, items }) }, group.title);
3986
4004
  } else {
3987
- return group.items.map((item) => React.createElement(Checkbox, Object.assign({}, item, { key: item.id, text: item.label, onChange: handleCheckboxChange, classNameCheckboxLabel: "ui:py-3" })));
4005
+ return group.items.map((item) => {
4006
+ var _a;
4007
+ return jsxRuntime.jsx(LabeledCheckbox, { id: item.id, name: item.name, value: item.value, label: item.label, helperText: item.explanation, checked: (_a = item.isChecked) !== null && _a !== void 0 ? _a : false, disabled: item.isDisabled, onChange: handleCheckboxChange, className: classNames__default.default("ui:py-3", item.className) }, item.id);
4008
+ });
3988
4009
  }
3989
4010
  }) });
3990
4011
  };
@@ -5121,6 +5142,32 @@ const ActionCard = ({ type, title, metadata, instruments, actions, draggable = f
5121
5142
  }) })] }), actions && jsxRuntime.jsx(Box, { className: "ui:relative ui:z-[1] ui:shrink-0 ui:self-center", children: actions })] }) });
5122
5143
  };
5123
5144
 
5145
+ const actionIcons = {
5146
+ information: ActionInformationColoredIcon,
5147
+ contact: ActionContactColoredIcon,
5148
+ lesson: ActionLessonColoredIcon,
5149
+ calculation: ActionCalculationColoredIcon,
5150
+ measurement: ActionBloodPressureColoredIcon
5151
+ };
5152
+ 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];
5155
+ 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, { "aria-hidden": true, width: 24, height: 24, className: "ui:shrink-0" }), 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
+ Tag,
5158
+ { _size: "large", _type: "neutral", _variant: "flat", children: item },
5159
+ `${index}-${item}`
5160
+ )) }), schedule && schedule.length > 0 && jsxRuntime.jsxs(Stack, { _gap: "base", width: "full", children: [jsxRuntime.jsx(Heading, { variant: "h4", children: scheduleHeading }), jsxRuntime.jsx(Stack, { _gap: "l", width: "full", children: schedule.map((row, index) => jsxRuntime.jsx(
5161
+ ScheduleItem,
5162
+ Object.assign({}, row),
5163
+ index
5164
+ )) })] }), instruments && instruments.length > 0 && jsxRuntime.jsxs(Stack, { _gap: "base", width: "full", children: [jsxRuntime.jsx(Heading, { variant: "h4", children: instrumentsHeading }), jsxRuntime.jsx(Stack, { _gap: "base", width: "full", children: instruments.map((instrument, index) => jsxRuntime.jsx(
5165
+ InstrumentCard,
5166
+ Object.assign({}, instrument, { variant: "detailed" }),
5167
+ index
5168
+ )) })] })] }) });
5169
+ };
5170
+
5124
5171
  var css_248z$1 = "/*! tailwindcss v4.1.12 | MIT License | https://tailwindcss.com */\n.cweb-textarea {\n resize: none;\n background-color: field;\n}\n.cweb-textarea.has-icon {\n background-size: 24px;\n background-position: 10px 10px;\n background-repeat: no-repeat;\n padding-left: 44px;\n}\n.cweb-textarea.resizable {\n resize: both;\n}\n.cweb-textarea.resizable-x {\n resize: horizontal;\n}\n.cweb-textarea.resizable-y {\n resize: vertical;\n}\n.cweb-textarea:focus {\n border-color: var(--color-primary);\n}\n.cweb-textarea:disabled {\n cursor: not-allowed;\n}\n.cweb-textarea.has-error {\n border: 1px solid #b91c1c;\n color: #991b1b;\n}";
5125
5172
  styleInject(css_248z$1);
5126
5173
 
@@ -7212,6 +7259,7 @@ exports.AccordionTemporary = Accordion;
7212
7259
  exports.ActionBloodPressureColoredIcon = ActionBloodPressureColoredIcon;
7213
7260
  exports.ActionCalculationColoredIcon = ActionCalculationColoredIcon;
7214
7261
  exports.ActionCard = ActionCard;
7262
+ exports.ActionCardDetailed = ActionCardDetailed;
7215
7263
  exports.ActionContactColoredIcon = ActionContactColoredIcon;
7216
7264
  exports.ActionController = ActionController;
7217
7265
  exports.ActionHeartRateColoredIcon = ActionHeartRateColoredIcon;