@luscii-healthtech/web-ui 2.73.0 → 2.74.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.
- package/dist/components/Section/Section.d.ts +10 -1
- package/dist/components/Section/subcomponents/SectionActions.d.ts +21 -0
- package/dist/components/SettingsMenuButton/SettingsMenuButton.d.ts +8 -5
- package/dist/index.d.ts +1 -1
- package/dist/web-ui-tailwind.css +5 -0
- package/dist/web-ui.cjs.development.js +18 -15
- package/dist/web-ui.cjs.development.js.map +1 -1
- package/dist/web-ui.cjs.production.min.js +1 -1
- package/dist/web-ui.cjs.production.min.js.map +1 -1
- package/dist/web-ui.esm.js +18 -15
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -5,12 +5,21 @@ import { RestPropped } from "../../types/general.types";
|
|
|
5
5
|
import "./Section.scss";
|
|
6
6
|
export interface SectionProps extends RestPropped {
|
|
7
7
|
title?: string;
|
|
8
|
+
/**
|
|
9
|
+
* @deprecated
|
|
10
|
+
* Use the `sectionHeaderAside` prop to render any button(s)
|
|
11
|
+
* or other component(s) automatically in the correct area.
|
|
12
|
+
*/
|
|
8
13
|
buttons?: ButtonProps[];
|
|
9
14
|
footer?: React.ReactNode;
|
|
10
15
|
className?: string;
|
|
11
16
|
isLoading?: boolean;
|
|
12
17
|
loadingIndicatorProps?: LoadingIndicatorProps;
|
|
13
18
|
children?: React.ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* Rendered opposite of the `title`.
|
|
21
|
+
*/
|
|
22
|
+
headerAside?: React.ReactNode;
|
|
14
23
|
}
|
|
15
|
-
export declare function Section({ title, buttons, footer, children, className, isLoading, loadingIndicatorProps, ...restProps }: SectionProps): JSX.Element;
|
|
24
|
+
export declare function Section({ title, buttons, footer, children, headerAside, className, isLoading, loadingIndicatorProps, ...restProps }: SectionProps): JSX.Element;
|
|
16
25
|
export default Section;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Use in the aside of a header section. Spaces out the action
|
|
4
|
+
* components correctly in relation to the styling of the Section component.
|
|
5
|
+
*
|
|
6
|
+
* @usage
|
|
7
|
+
* ```tsx
|
|
8
|
+
* <Section
|
|
9
|
+
* title="My section title"
|
|
10
|
+
* headerAside={
|
|
11
|
+
* <SectionActions>
|
|
12
|
+
* <PrimaryButton />
|
|
13
|
+
* <SecondaryButton />
|
|
14
|
+
* </SectionActions>
|
|
15
|
+
* }
|
|
16
|
+
* >
|
|
17
|
+
* <Text>Content that is shown in the expandable "body" of the section.</Text>
|
|
18
|
+
* </Section>
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export declare const SectionActions: React.FC<React.PropsWithChildren>;
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { IconProps } from "../Icons/types/IconProps.type";
|
|
3
|
-
|
|
3
|
+
interface ConfigurationItem<ExtraDataType extends object> {
|
|
4
4
|
itemId: string;
|
|
5
5
|
itemName: string;
|
|
6
6
|
on: boolean;
|
|
7
|
+
/** Additional info that can be used by the parent component */
|
|
8
|
+
extra?: ExtraDataType;
|
|
7
9
|
}
|
|
8
|
-
export interface SettingsMenuButtonProps {
|
|
9
|
-
configuration: ConfigurationItem[];
|
|
10
|
-
onConfigurationChange: (newConfig: ConfigurationItem) => void;
|
|
10
|
+
export interface SettingsMenuButtonProps<ExtraDataType extends object = Record<string, unknown>> {
|
|
11
|
+
configuration: ConfigurationItem<ExtraDataType>[];
|
|
12
|
+
onConfigurationChange: (newConfig: ConfigurationItem<ExtraDataType>) => void;
|
|
11
13
|
shiftMenuTo?: "right" | "right-md" | "left" | "left-md";
|
|
12
14
|
buttonTitle?: string;
|
|
13
15
|
menuTitle?: string;
|
|
14
16
|
iconComponent: React.FunctionComponent<IconProps>;
|
|
15
17
|
}
|
|
16
|
-
export declare const SettingsMenuButton: (props: SettingsMenuButtonProps) =>
|
|
18
|
+
export declare const SettingsMenuButton: <ExtraDataType extends object = Record<string, unknown>>(props: SettingsMenuButtonProps<ExtraDataType>) => React.ReactElement;
|
|
19
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -50,7 +50,7 @@ export { default as Section, SectionProps } from "./components/Section/Section";
|
|
|
50
50
|
export { default as SectionItemWithContent } from "./components/Section/SectionItemWithContent";
|
|
51
51
|
export { default as SectionItem, SectionItemProps, } from "./components/Section/SectionItem";
|
|
52
52
|
export { SelectProps, Select } from "./components/Select/Select";
|
|
53
|
-
export { SettingsMenuButton
|
|
53
|
+
export { SettingsMenuButton } from "./components/SettingsMenuButton/SettingsMenuButton";
|
|
54
54
|
export { Spinner } from "./components/Spinner/Spinner";
|
|
55
55
|
export { Steps } from "./components/Steps/Steps";
|
|
56
56
|
export { default as Switcher } from "./components/Switcher/Switcher";
|
package/dist/web-ui-tailwind.css
CHANGED
|
@@ -6684,12 +6684,13 @@ RadioGroup.propTypes = {
|
|
|
6684
6684
|
var css_248z$o = ".cweb-section .cweb-button:last-of-type {\n margin-right: 24px;\n}\n\n.cweb-section .cweb-button:not(:last-of-type) {\n margin-right: 8px;\n}\n\n.cweb-section .cweb-button.add-button, .cweb-section .cweb-button.edit-button, .cweb-section .cweb-button.delete-button {\n margin-left: auto;\n width: 32px;\n height: 32px;\n}\n\n.cweb-section .cweb-button.add-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Ccircle cx%3D%2222%22 cy%3D%2222%22 r%3D%2222%22 fill%3D%22white%22%2F%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23009FE3%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M22 32C23.1046 32 24 31.1046 24 30L24 24H30C31.1046 24 32 23.1046 32 22C32 20.8954 31.1046 20 30 20H24L24 14C24 12.8954 23.1046 12 22 12C20.8954 12 20 12.8954 20 14L20 20H14C12.8954 20 12 20.8954 12 22C12 23.1046 12.8954 24 14 24H20L20 30C20 31.1046 20.8954 32 22 32Z%22 fill%3D%22%23009FE3%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.add-button:hover, .cweb-section .cweb-button.add-button:active, .cweb-section .cweb-button.add-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%230A78B2%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M21 12C19.8954 12 19 12.8954 19 14V19L14 19C12.8954 19 12 19.8954 12 21V23C12 24.1046 12.8954 25 14 25H19V30C19 31.1046 19.8954 32 21 32H23C24.1046 32 25 31.1046 25 30V25H30C31.1046 25 32 24.1046 32 23V21C32 19.8954 31.1046 19 30 19L25 19V14C25 12.8954 24.1046 12 23 12H21Z%22 fill%3D%22%23007BBB%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.edit-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M13.5643 27.1001C13.4169 26.9527 13.1433 27.0159 13.1012 27.2266L12.0065 31.6507C11.9644 31.8614 12.1328 32.051 12.3433 31.9878L16.7851 30.9134C16.9956 30.8712 17.0799 30.5973 16.9114 30.4499L13.5643 27.1001Z%22 fill%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M26.2161 14.1222C26.1109 14.0169 25.9214 14.0169 25.8161 14.1222L14.4484 25.4987C14.3432 25.604 14.3432 25.7936 14.4484 25.8989L18.1114 29.5647C18.2166 29.67 18.4061 29.67 18.5113 29.5647L29.879 18.1882C29.9843 18.0829 29.9843 17.8933 29.879 17.788L26.2161 14.1222Z%22 fill%3D%22%23009FE3%22%2F%3E%3Cpath d%3D%22M31.1633 12.8374C30.0475 11.7209 28.2161 11.7209 27.1004 12.8374C27.0583 12.8796 27.0583 12.9217 27.1004 12.9638L31.037 16.9035C31.0791 16.9456 31.1212 16.9456 31.1633 16.9035C32.279 15.7869 32.279 13.954 31.1633 12.8374Z%22 fill%3D%22%23009FE3%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.edit-button:hover, .cweb-section .cweb-button.edit-button:active, .cweb-section .cweb-button.edit-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23007BBB%22%2F%3E%3Cpath d%3D%22M13.5643 27.1001C13.4169 26.9527 13.1433 27.0159 13.1012 27.2266L12.0065 31.6507C11.9644 31.8614 12.1328 32.051 12.3433 31.9878L16.7851 30.9134C16.9956 30.8712 17.0799 30.5973 16.9114 30.4499L13.5643 27.1001Z%22 fill%3D%22%230A78B2%22%2F%3E%3Cpath d%3D%22M26.2161 14.1222C26.1109 14.0169 25.9214 14.0169 25.8161 14.1222L14.4484 25.4987C14.3432 25.604 14.3432 25.7936 14.4484 25.8989L18.1114 29.5647C18.2166 29.67 18.4061 29.67 18.5113 29.5647L29.879 18.1882C29.9843 18.0829 29.9843 17.8933 29.879 17.788L26.2161 14.1222Z%22 fill%3D%22%230A78B2%22%2F%3E%3Cpath d%3D%22M31.1633 12.8374C30.0475 11.7209 28.2161 11.7209 27.1004 12.8374C27.0583 12.8796 27.0583 12.9217 27.1004 12.9638L31.037 16.9035C31.0791 16.9456 31.1212 16.9456 31.1633 16.9035C32.279 15.7869 32.279 13.954 31.1633 12.8374Z%22 fill%3D%22%230A78B2%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.delete-button {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23FF6266%22%2F%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M13 12C12.4477 12 12 12.4477 12 13C12 13.5523 12.4477 14 13 14H31C31.5523 14 32 13.5523 32 13C32 12.4477 31.5523 12 31 12H13ZM14 16H30V30C30 31.1046 29.1046 32 28 32H16C14.8954 32 14 31.1046 14 30V16ZM17 18H19V30H17V18ZM21 18H23V30H21V18ZM27 18H25V30H27V18Z%22 fill%3D%22%23FF6266%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section .cweb-button.delete-button:hover, .cweb-section .cweb-button.delete-button:active, .cweb-section .cweb-button.delete-button:focus {\n background: url(\"data:image/svg+xml,%3Csvg width%3D%2244%22 height%3D%2244%22 viewBox%3D%220 0 44 44%22 fill%3D%22none%22 xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath fill-rule%3D%22evenodd%22 clip-rule%3D%22evenodd%22 d%3D%22M13 12C12.4477 12 12 12.4477 12 13C12 13.5523 12.4477 14 13 14H31C31.5523 14 32 13.5523 32 13C32 12.4477 31.5523 12 31 12H13ZM14 16H30V30C30 31.1046 29.1046 32 28 32H16C14.8954 32 14 31.1046 14 30V16ZM17 18H19V30H17V18ZM21 18H23V30H21V18ZM27 18H25V30H27V18Z%22 fill%3D%22%23FC494E%22%2F%3E%3Crect x%3D%220.5%22 y%3D%220.5%22 width%3D%2243%22 height%3D%2243%22 rx%3D%2221.5%22 stroke%3D%22%23FC494E%22%2F%3E%3C%2Fsvg%3E\") no-repeat center;\n background-size: contain;\n}\n\n.cweb-section > .cweb-section-header {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n border-bottom: 1px solid #eeeeee;\n width: 100%;\n padding: 18px 24px;\n}\n\n.cweb-section > .cweb-section-footer {\n display: flex;\n justify-content: space-between;\n flex-direction: row;\n align-items: center;\n border-top: 1px solid #eeeeee;\n width: 100%;\n padding: 1rem 24px 1rem 24px;\n}\n\n.cweb-section > .cweb-section-footer img {\n width: 32px;\n height: 32px;\n}";
|
|
6685
6685
|
styleInject(css_248z$o);
|
|
6686
6686
|
|
|
6687
|
-
var _excluded$o = ["title", "buttons", "footer", "children", "className", "isLoading", "loadingIndicatorProps"];
|
|
6687
|
+
var _excluded$o = ["title", "buttons", "footer", "children", "headerAside", "className", "isLoading", "loadingIndicatorProps"];
|
|
6688
6688
|
function Section(_ref) {
|
|
6689
6689
|
var title = _ref.title,
|
|
6690
6690
|
buttons = _ref.buttons,
|
|
6691
6691
|
footer = _ref.footer,
|
|
6692
6692
|
children = _ref.children,
|
|
6693
|
+
headerAside = _ref.headerAside,
|
|
6693
6694
|
className = _ref.className,
|
|
6694
6695
|
_ref$isLoading = _ref.isLoading,
|
|
6695
6696
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
@@ -6698,23 +6699,23 @@ function Section(_ref) {
|
|
|
6698
6699
|
return /*#__PURE__*/React__default.createElement("div", _extends({}, restProps, {
|
|
6699
6700
|
className: classNames("cweb-section", "flex justify-start flex-col items-start", "rounded-lg", "mx-0 my-4", "bg-white", "w-full", className)
|
|
6700
6701
|
}), (title || buttons) && /*#__PURE__*/React__default.createElement("div", {
|
|
6701
|
-
className: "cweb-section-header",
|
|
6702
|
+
className: "cweb-section-header gap-3",
|
|
6702
6703
|
"data-test-id": "section-header"
|
|
6703
6704
|
}, title && /*#__PURE__*/React__default.createElement("div", {
|
|
6704
|
-
className: "flex flex-row items-center"
|
|
6705
|
+
className: "flex flex-1 flex-row items-center gap-3"
|
|
6705
6706
|
}, /*#__PURE__*/React__default.createElement(Title, {
|
|
6706
6707
|
text: title,
|
|
6707
|
-
className: "
|
|
6708
|
+
className: "cweb-section-title",
|
|
6708
6709
|
type: "sm"
|
|
6709
6710
|
}), isLoading && /*#__PURE__*/React__default.createElement(LoadingIndicator, _extends({
|
|
6710
6711
|
asSpinner: true
|
|
6711
|
-
}, loadingIndicatorProps))), /*#__PURE__*/React__default.createElement("div", {
|
|
6712
|
+
}, loadingIndicatorProps))), buttons && buttons.length > 0 && /*#__PURE__*/React__default.createElement("div", {
|
|
6712
6713
|
className: classNames("cweb-section-header-buttons-container", "flex flex-row space-x-3")
|
|
6713
|
-
}, buttons
|
|
6714
|
+
}, buttons.map(function (button) {
|
|
6714
6715
|
return /*#__PURE__*/React__default.createElement(Button, _extends({}, button, {
|
|
6715
6716
|
key: button.key || button.id || button.text
|
|
6716
6717
|
}));
|
|
6717
|
-
}))), /*#__PURE__*/React__default.createElement("div", {
|
|
6718
|
+
})), headerAside && /*#__PURE__*/React__default.createElement("div", null, headerAside)), /*#__PURE__*/React__default.createElement("div", {
|
|
6718
6719
|
className: "cweb-section-content w-full"
|
|
6719
6720
|
}, !isLoading && children), footer && /*#__PURE__*/React__default.createElement("div", {
|
|
6720
6721
|
className: "cweb-section-footer"
|
|
@@ -6801,7 +6802,7 @@ var SettingsMenuButton = function SettingsMenuButton(props) {
|
|
|
6801
6802
|
var handleShowMenu = function handleShowMenu() {
|
|
6802
6803
|
setShowMenu(true);
|
|
6803
6804
|
};
|
|
6804
|
-
var
|
|
6805
|
+
var handleOnVisibilitySwitchChanged = function handleOnVisibilitySwitchChanged(event) {
|
|
6805
6806
|
var _event$currentTarget = event.currentTarget,
|
|
6806
6807
|
id = _event$currentTarget.id,
|
|
6807
6808
|
name = _event$currentTarget.name,
|
|
@@ -6809,19 +6810,21 @@ var SettingsMenuButton = function SettingsMenuButton(props) {
|
|
|
6809
6810
|
var newConfig = innerConfiguration.find(function (config) {
|
|
6810
6811
|
return config.itemId === id && config.itemName === name;
|
|
6811
6812
|
});
|
|
6812
|
-
|
|
6813
|
-
|
|
6814
|
-
|
|
6813
|
+
if (newConfig) {
|
|
6814
|
+
onConfigurationChange(_extends({}, newConfig, {
|
|
6815
|
+
on: checked
|
|
6816
|
+
}));
|
|
6817
|
+
}
|
|
6815
6818
|
};
|
|
6816
6819
|
if (!iconComponent) {
|
|
6817
|
-
console.error("
|
|
6820
|
+
console.error("An icon component is required to use this component, please make sure to pass it as a prop. ");
|
|
6818
6821
|
return /*#__PURE__*/React__default.createElement("span", null, "Invalid props passed to this component.");
|
|
6819
6822
|
}
|
|
6820
6823
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
6821
6824
|
onClick: handleShowMenu,
|
|
6822
6825
|
className: "relative"
|
|
6823
|
-
}, /*#__PURE__*/React__default.createElement(
|
|
6824
|
-
|
|
6826
|
+
}, /*#__PURE__*/React__default.createElement(TertiaryButton, {
|
|
6827
|
+
icon: iconComponent,
|
|
6825
6828
|
onClick: handleShowMenu,
|
|
6826
6829
|
text: buttonTitle,
|
|
6827
6830
|
role: "tertiary"
|
|
@@ -6854,7 +6857,7 @@ var SettingsMenuButton = function SettingsMenuButton(props) {
|
|
|
6854
6857
|
id: innerConfig.itemId,
|
|
6855
6858
|
type: "switch",
|
|
6856
6859
|
isChecked: innerConfig.on,
|
|
6857
|
-
onChange:
|
|
6860
|
+
onChange: handleOnVisibilitySwitchChanged
|
|
6858
6861
|
}));
|
|
6859
6862
|
})));
|
|
6860
6863
|
};
|