@luscii-healthtech/web-ui 2.57.0 → 2.58.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.types.d.ts +13 -4
- package/dist/components/Form/form.types.d.ts +1 -1
- package/dist/web-ui-tailwind.css +4 -0
- package/dist/web-ui.cjs.development.js +23 -8
- 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 +23 -8
- package/dist/web-ui.esm.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { CheckboxGroupProps } from "./CheckboxList.types";
|
|
2
|
-
export declare const CheckboxGroup: ({ title, items, onChange, className, hasDividers, isCollapsed, }: CheckboxGroupProps) => JSX.Element;
|
|
2
|
+
export declare const CheckboxGroup: ({ title, items, onChange, className, hasDividers, isCollapsed, collapsible, }: CheckboxGroupProps) => JSX.Element;
|
|
@@ -9,14 +9,22 @@ export interface CheckboxListProps {
|
|
|
9
9
|
hasDividers?: boolean;
|
|
10
10
|
className?: string;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
declare type WithCollapsible = {
|
|
13
|
+
/**
|
|
14
|
+
* When `false`, will prevent the checkbox list from being collapsed (also disabling clicking to expand/collapse)
|
|
15
|
+
* in the component and it will be displayed expanded by default.
|
|
16
|
+
* @default true
|
|
17
|
+
*/
|
|
18
|
+
collapsible?: boolean;
|
|
19
|
+
};
|
|
20
|
+
export declare type CheckboxGroupProps = {
|
|
13
21
|
title?: string;
|
|
14
22
|
items: CheckboxListItem[];
|
|
15
23
|
onChange: (event: CheckboxChangeEvent) => void;
|
|
16
24
|
hasDividers?: boolean;
|
|
17
25
|
className?: string;
|
|
18
26
|
isCollapsed?: boolean;
|
|
19
|
-
}
|
|
27
|
+
} & WithCollapsible;
|
|
20
28
|
export interface CheckboxGroupItemProps {
|
|
21
29
|
id: string;
|
|
22
30
|
label: string;
|
|
@@ -32,12 +40,13 @@ export interface CheckboxListItem {
|
|
|
32
40
|
isDisabled?: boolean;
|
|
33
41
|
className?: string;
|
|
34
42
|
}
|
|
35
|
-
export
|
|
43
|
+
export declare type CheckboxGroup = {
|
|
36
44
|
title?: string;
|
|
37
45
|
items: CheckboxListItem[];
|
|
38
46
|
isCollapsed?: boolean;
|
|
39
|
-
}
|
|
47
|
+
} & WithCollapsible;
|
|
40
48
|
export interface CheckboxChangeEvent {
|
|
41
49
|
id: string;
|
|
42
50
|
newCheckedValue: boolean;
|
|
43
51
|
}
|
|
52
|
+
export {};
|
|
@@ -66,7 +66,7 @@ export interface FieldCheckboxConfiguration extends FormFieldBaseConfiguration<O
|
|
|
66
66
|
* Omiting `groups` and `onChange` here because these will be handled by
|
|
67
67
|
* the `Control` component from react-hook-form.
|
|
68
68
|
*/
|
|
69
|
-
export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<
|
|
69
|
+
export interface FieldCheckboxListConfiguration extends FormFieldBaseConfiguration<Pick<CheckboxListProps, "hasDividers" | "className">> {
|
|
70
70
|
type: "checkboxlist";
|
|
71
71
|
}
|
|
72
72
|
/**
|
package/dist/web-ui-tailwind.css
CHANGED
|
@@ -5678,13 +5678,20 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
5678
5678
|
_ref$hasDividers = _ref.hasDividers,
|
|
5679
5679
|
hasDividers = _ref$hasDividers === void 0 ? false : _ref$hasDividers,
|
|
5680
5680
|
_ref$isCollapsed = _ref.isCollapsed,
|
|
5681
|
-
isCollapsed = _ref$isCollapsed === void 0 ? true : _ref$isCollapsed
|
|
5681
|
+
isCollapsed = _ref$isCollapsed === void 0 ? true : _ref$isCollapsed,
|
|
5682
|
+
_ref$collapsible = _ref.collapsible,
|
|
5683
|
+
collapsible = _ref$collapsible === void 0 ? true : _ref$collapsible;
|
|
5682
5684
|
|
|
5683
5685
|
var _useState = React.useState(CheckboxState.UNCHECKED),
|
|
5684
5686
|
groupCheckboxState = _useState[0],
|
|
5685
5687
|
setGroupCheckboxState = _useState[1];
|
|
5688
|
+
/**
|
|
5689
|
+
* If the prop `collapsible` is set to false, the default state of this list will
|
|
5690
|
+
* be expanded, and no change event can update that state.
|
|
5691
|
+
*/
|
|
5686
5692
|
|
|
5687
|
-
|
|
5693
|
+
|
|
5694
|
+
var _useState2 = React.useState(collapsible ? isCollapsed : false),
|
|
5688
5695
|
collapsed = _useState2[0],
|
|
5689
5696
|
setCollapsed = _useState2[1];
|
|
5690
5697
|
|
|
@@ -5752,7 +5759,9 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
5752
5759
|
event.stopPropagation();
|
|
5753
5760
|
}
|
|
5754
5761
|
|
|
5755
|
-
|
|
5762
|
+
if (collapsible) {
|
|
5763
|
+
setCollapsed(!collapsed);
|
|
5764
|
+
}
|
|
5756
5765
|
};
|
|
5757
5766
|
|
|
5758
5767
|
var checkedItemsCount = items == null ? void 0 : items.filter(function (item) {
|
|
@@ -5760,6 +5769,7 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
5760
5769
|
}).length;
|
|
5761
5770
|
var groupTitle = checkedItemsCount > 0 ? title + " (" + checkedItemsCount + ")" : title;
|
|
5762
5771
|
var itemClassName = hasDividers ? "py-3 last:border-b-0 border-b border-slate-200" : "my-1";
|
|
5772
|
+
var CollapseStateChevron = collapsed ? ChevronRightIcon : ChevronDownIcon;
|
|
5763
5773
|
return /*#__PURE__*/React__default.createElement("div", {
|
|
5764
5774
|
className: classNames("flex flex-col ", className, {
|
|
5765
5775
|
"last:border-b-0 border-b border-slate-200": hasDividers && isCollapsed,
|
|
@@ -5775,14 +5785,15 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
5775
5785
|
}, /*#__PURE__*/React__default.createElement("div", {
|
|
5776
5786
|
className: "h-6 cursor-pointer mr-auto flex flex-row items-center text-slate-300 hover:text-slate-500 transition duration-300",
|
|
5777
5787
|
onClick: handleGroupCollapse
|
|
5778
|
-
},
|
|
5779
|
-
onClick: handleGroupCollapse
|
|
5780
|
-
}) : /*#__PURE__*/React__default.createElement(ChevronDownIcon, {
|
|
5788
|
+
}, collapsible && /*#__PURE__*/React__default.createElement(CollapseStateChevron, {
|
|
5781
5789
|
onClick: handleGroupCollapse
|
|
5782
5790
|
}), /*#__PURE__*/React__default.createElement(Text, {
|
|
5783
5791
|
type: "strong",
|
|
5784
5792
|
text: groupTitle || "",
|
|
5785
|
-
className:
|
|
5793
|
+
className: classNames({
|
|
5794
|
+
"ml-4": collapsible,
|
|
5795
|
+
"ml-1": !collapsible
|
|
5796
|
+
})
|
|
5786
5797
|
}), " "), /*#__PURE__*/React__default.createElement(Checkbox, {
|
|
5787
5798
|
onChange: handleGroupClick,
|
|
5788
5799
|
className: "ml-auto",
|
|
@@ -5797,7 +5808,10 @@ var CheckboxGroup = function CheckboxGroup(_ref) {
|
|
|
5797
5808
|
onChange: onChange,
|
|
5798
5809
|
isChecked: item.isChecked,
|
|
5799
5810
|
isDisabled: item.isDisabled,
|
|
5800
|
-
className: classNames(
|
|
5811
|
+
className: classNames({
|
|
5812
|
+
"ml-10": collapsible,
|
|
5813
|
+
"ml-5": !collapsible
|
|
5814
|
+
}, itemClassName)
|
|
5801
5815
|
});
|
|
5802
5816
|
}));
|
|
5803
5817
|
};
|
|
@@ -5818,6 +5832,7 @@ var CheckboxList = function CheckboxList(_ref) {
|
|
|
5818
5832
|
items: group.items,
|
|
5819
5833
|
title: group.title,
|
|
5820
5834
|
isCollapsed: group.isCollapsed,
|
|
5835
|
+
collapsible: group.collapsible,
|
|
5821
5836
|
onChange: onChange,
|
|
5822
5837
|
hasDividers: hasDividers
|
|
5823
5838
|
});
|