@luscii-healthtech/web-ui 8.3.1 → 9.0.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/CheckboxList/CheckboxGroup.d.ts +1 -1
- package/dist/components/CheckboxList/CheckboxList.d.ts +1 -1
- package/dist/components/CheckboxList/CheckboxList.types.d.ts +0 -5
- package/dist/components/Form/form.types.d.ts +3 -2
- package/dist/components/Link/Link.d.ts +19 -0
- package/dist/components/TextLink/TextLink.d.ts +3 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.development.js +21 -18
- package/dist/index.development.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/web-ui.esm.js +1 -1
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckboxGroupProps } from "./CheckboxList.types";
|
|
3
|
-
export declare const CheckboxGroup: ({ title, items, onChange, className,
|
|
3
|
+
export declare const CheckboxGroup: ({ title, items, onChange, className, isCollapsed, collapsible, }: CheckboxGroupProps) => JSX.Element;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { CheckboxListProps } from "./CheckboxList.types";
|
|
3
3
|
export { CheckboxListProps };
|
|
4
|
-
export declare const CheckboxList: ({ groups, onChange, className,
|
|
4
|
+
export declare const CheckboxList: ({ groups, onChange, className, }: CheckboxListProps) => JSX.Element;
|
|
5
5
|
export default CheckboxList;
|
|
@@ -29,10 +29,6 @@ export interface CheckboxListProps {
|
|
|
29
29
|
*/
|
|
30
30
|
groups: CheckboxGroup[];
|
|
31
31
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
32
|
-
/**
|
|
33
|
-
* Renders dividers between each item, including groups and inside of groups.
|
|
34
|
-
*/
|
|
35
|
-
hasDividers?: boolean;
|
|
36
32
|
className?: string;
|
|
37
33
|
}
|
|
38
34
|
type WithCollapsible = {
|
|
@@ -45,7 +41,6 @@ type WithCollapsible = {
|
|
|
45
41
|
};
|
|
46
42
|
export type CheckboxGroupProps = CheckboxGroup & {
|
|
47
43
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
48
|
-
hasDividers?: boolean;
|
|
49
44
|
className?: string;
|
|
50
45
|
} & WithCollapsible;
|
|
51
46
|
export interface CheckboxGroupItemProps extends CheckboxListItem {
|
|
@@ -6,7 +6,6 @@ import { SelectProps } from "../Select/Select";
|
|
|
6
6
|
import { ImagePickerProps } from "../MediaPicker/MediaPicker";
|
|
7
7
|
import { PartialProperties } from "../../types/general.types";
|
|
8
8
|
import { CheckboxProps } from "../Checkbox/Checkbox";
|
|
9
|
-
import { CheckboxListProps } from "../CheckboxList/CheckboxList.types";
|
|
10
9
|
import { TextareaProps } from "../Textarea/Textarea";
|
|
11
10
|
import { TitleProps } from "../Title/Title";
|
|
12
11
|
export type AllowedTextInputTypes = Extract<HTMLInputTypeAttribute, "email" | "number" | "password" | "text">;
|
|
@@ -74,7 +73,9 @@ export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<O
|
|
|
74
73
|
* Omiting `groups` and `onChange` here because these will be handled by
|
|
75
74
|
* the `Control` component from react-hook-form.
|
|
76
75
|
*/
|
|
77
|
-
export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<
|
|
76
|
+
export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<{
|
|
77
|
+
className?: string;
|
|
78
|
+
}> {
|
|
78
79
|
type: "checkboxlist";
|
|
79
80
|
}
|
|
80
81
|
/**
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Source for the typing of the `as` prop: https://stackoverflow.com/a/66568474
|
|
4
|
+
*/
|
|
5
|
+
type Props<E extends React.ElementType> = React.PropsWithChildren<{
|
|
6
|
+
/**
|
|
7
|
+
* Provide a custom component tag name to render instead of the default `a` tag.
|
|
8
|
+
*
|
|
9
|
+
* @default "a"
|
|
10
|
+
* @example "button"
|
|
11
|
+
*/
|
|
12
|
+
as?: E;
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* A bare-bones wrapper around an <a> tag, containing only our preferred styling. This is component
|
|
16
|
+
* can be used for any link and not just text links.
|
|
17
|
+
*/
|
|
18
|
+
export declare function Link<T extends React.ElementType = "a">(props: Props<T> & Omit<React.ComponentPropsWithoutRef<T>, keyof Props<T>>): React.JSX.Element;
|
|
19
|
+
export {};
|
package/dist/index.d.ts
CHANGED
|
@@ -64,6 +64,7 @@ export { default as TagGroup } from "./components/Tag/TagGroup";
|
|
|
64
64
|
export { Textarea, TextareaProps, ResizeTypes, } from "./components/Textarea/Textarea";
|
|
65
65
|
export { TextEditor } from "./components/TextEditor/TextEditor";
|
|
66
66
|
export { default as TextEditorV2 } from "./components/TextEditorV2/TextEditorV2";
|
|
67
|
+
export { Link } from "./components/Link/Link";
|
|
67
68
|
export { TextLink, TextLinkProps } from "./components/TextLink/TextLink";
|
|
68
69
|
export { Title, TitleStyle } from "./components/Title/Title";
|
|
69
70
|
export { Timeline } from "./components/Timeline/Timeline";
|
|
@@ -3545,7 +3545,7 @@ var CheckboxState;
|
|
|
3545
3545
|
CheckboxState2["UNCHECKED"] = "unchecked";
|
|
3546
3546
|
})(CheckboxState || (CheckboxState = {}));
|
|
3547
3547
|
|
|
3548
|
-
const CheckboxGroup = ({ title, items, onChange, className,
|
|
3548
|
+
const CheckboxGroup = ({ title, items, onChange, className, isCollapsed = true, collapsible = true }) => {
|
|
3549
3549
|
const [groupCheckboxState, setGroupCheckboxState] = React.useState(CheckboxState.UNCHECKED);
|
|
3550
3550
|
const [collapsed, setCollapsed] = React.useState(collapsible ? isCollapsed : false);
|
|
3551
3551
|
const [isDisabled, setIsDisabled] = React.useState(false);
|
|
@@ -3586,20 +3586,13 @@ const CheckboxGroup = ({ title, items, onChange, className, hasDividers = false,
|
|
|
3586
3586
|
};
|
|
3587
3587
|
const checkedItemsCount = items === null || items === void 0 ? void 0 : items.filter((item) => item === null || item === void 0 ? void 0 : item.isChecked).length;
|
|
3588
3588
|
const groupTitle = checkedItemsCount > 0 ? `${title} (${checkedItemsCount})` : title;
|
|
3589
|
-
const itemClassName = hasDividers ? "ui-py-3 last:ui-border-b-0 ui-border-b ui-border-slate-200" : "ui-my-1";
|
|
3590
3589
|
const CollapseStateChevron = collapsed ? ChevronRightIcon : ChevronDownIcon;
|
|
3591
3590
|
return React__namespace.default.createElement(
|
|
3592
3591
|
"div",
|
|
3593
|
-
{ className: classNames__default.default("ui-flex ui-flex-col ", className,
|
|
3594
|
-
"ui-border-b ui-border-slate-200 last:ui-border-b-0": hasDividers && isCollapsed,
|
|
3595
|
-
"ui-border-b-0": hasDividers && !isCollapsed
|
|
3596
|
-
}) },
|
|
3592
|
+
{ className: classNames__default.default("ui-flex ui-flex-col ", className) },
|
|
3597
3593
|
title && React__namespace.default.createElement(
|
|
3598
3594
|
"div",
|
|
3599
|
-
{ className: classNames__default.default("ui-space-between ui-flex ui-w-full ui-flex-row ui-items-center",
|
|
3600
|
-
"ui-border-b ui-border-slate-200 ui-py-3": hasDividers,
|
|
3601
|
-
"ui-my-1": !hasDividers
|
|
3602
|
-
}, { "last:ui-border-b-0": hasDividers && isCollapsed }) },
|
|
3595
|
+
{ className: classNames__default.default("ui-space-between ui-flex ui-w-full ui-flex-row ui-items-center", "ui-my-1") },
|
|
3603
3596
|
React__namespace.default.createElement(
|
|
3604
3597
|
"div",
|
|
3605
3598
|
{ className: "ui-mr-auto ui-flex ui-h-6 ui-cursor-pointer ui-flex-row ui-items-center ui-text-slate-300 ui-transition ui-duration-300 hover:ui-text-slate-500", onClick: handleGroupCollapse },
|
|
@@ -3615,17 +3608,16 @@ const CheckboxGroup = ({ title, items, onChange, className, hasDividers = false,
|
|
|
3615
3608
|
!collapsed && items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className: classNames__default.default({
|
|
3616
3609
|
"ui-ml-10": collapsible,
|
|
3617
3610
|
"ui-ml-5": !collapsible
|
|
3618
|
-
},
|
|
3611
|
+
}, "ui-my-1") }))
|
|
3619
3612
|
);
|
|
3620
3613
|
};
|
|
3621
3614
|
|
|
3622
|
-
const CheckboxList = ({ groups, onChange, className
|
|
3623
|
-
|
|
3624
|
-
return React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-col", className) }, (groups === null || groups === void 0 ? void 0 : groups.length) > 0 && groups.map((group) => {
|
|
3615
|
+
const CheckboxList = ({ groups, onChange, className }) => {
|
|
3616
|
+
return React__namespace.default.createElement("div", { className: classNames__default.default("ui-flex ui-flex-col", className) }, groups.map((group) => {
|
|
3625
3617
|
if (group.title) {
|
|
3626
|
-
return React__namespace.default.createElement(CheckboxGroup, { key: group.title, items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange
|
|
3618
|
+
return React__namespace.default.createElement(CheckboxGroup, { key: group.title, items: group.items, title: group.title, isCollapsed: group.isCollapsed, collapsible: group.collapsible, onChange });
|
|
3627
3619
|
} else {
|
|
3628
|
-
return group.items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className:
|
|
3620
|
+
return group.items.map((item) => React__namespace.default.createElement(CheckboxListItem, { key: item.id, id: item.id, label: item.label, onChange, isChecked: item.isChecked, isDisabled: item.isDisabled, className: "ui-my-1" }));
|
|
3629
3621
|
}
|
|
3630
3622
|
}));
|
|
3631
3623
|
};
|
|
@@ -4942,6 +4934,16 @@ const TextEditorV2 = ({ defaultValue, onValueChange, locale }) => {
|
|
|
4942
4934
|
));
|
|
4943
4935
|
};
|
|
4944
4936
|
|
|
4937
|
+
function Link(props) {
|
|
4938
|
+
const { as: Element = "a", className } = props, rest = __rest(props, ["as", "className"]);
|
|
4939
|
+
const ownClasses = ["ui-cursor-pointer ui-focus:ui-outline-primary"];
|
|
4940
|
+
if (typeof props.children === "string") {
|
|
4941
|
+
ownClasses.push("ui-text-blue-800", "hover:ui-underline", "hover:ui-text-blue-900");
|
|
4942
|
+
}
|
|
4943
|
+
const classes = classNames__default.default(ownClasses, className);
|
|
4944
|
+
return React__namespace.default.createElement(Element, Object.assign({ className: classes }, rest));
|
|
4945
|
+
}
|
|
4946
|
+
|
|
4945
4947
|
const TimelineStep = React__namespace.default.forwardRef(({ content, type = "base", dataTestId, title }, ref) => {
|
|
4946
4948
|
const isWideStep = type === "wide";
|
|
4947
4949
|
const borderClassNames = "ui-ml-4 ui-pl-6 ui-border-blue-800 ui-border-l-2";
|
|
@@ -5150,12 +5152,12 @@ const FormFieldCheckboxList = ({ control, name, rules, fieldErrors, fieldRequire
|
|
|
5150
5152
|
FormFieldLabeler,
|
|
5151
5153
|
{ name, fieldErrors, fieldRequired, label, info, decoratorClassname },
|
|
5152
5154
|
React__namespace.default.createElement(index_ie11.Controller, { name, control, rules, render: ({ onChange, value }) => {
|
|
5153
|
-
const { className
|
|
5155
|
+
const { className } = fieldProps;
|
|
5154
5156
|
const [checkboxListValues, setCheckboxListValues] = React.useState(value);
|
|
5155
5157
|
React.useEffect(() => {
|
|
5156
5158
|
setCheckboxListValues(value);
|
|
5157
5159
|
}, [value]);
|
|
5158
|
-
return React__namespace.default.createElement(CheckboxList, { groups: checkboxListValues,
|
|
5160
|
+
return React__namespace.default.createElement(CheckboxList, { groups: checkboxListValues, className, onChange: (event) => {
|
|
5159
5161
|
setCheckboxListValues((previousState) => {
|
|
5160
5162
|
const newState = previousState.map((group) => {
|
|
5161
5163
|
const newItems = group.items.map((item) => {
|
|
@@ -5579,6 +5581,7 @@ exports.Input = Input;
|
|
|
5579
5581
|
exports.LeftArrowIcon = LeftArrowIcon;
|
|
5580
5582
|
exports.LightBulbIcon = LightBulbIcon;
|
|
5581
5583
|
exports.Line = Line;
|
|
5584
|
+
exports.Link = Link;
|
|
5582
5585
|
exports.LinkIcon = LinkIcon;
|
|
5583
5586
|
exports.List = List;
|
|
5584
5587
|
exports.ListItem = ListItem;
|