@conveyorhq/arrow-ds 1.64.1 → 1.65.2
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/package.json +1 -1
- package/public/components/Checkbox/Checkbox.d.ts +3 -2
- package/public/components/Checkbox/Checkbox.js +6 -2
- package/public/components/Modal/Modal.js +9 -0
- package/public/css/styles.css +4 -4
- package/public/css/styles.min.css +1 -1
- package/public/css/styles.min.css.map +1 -1
- package/src/components/Checkbox/Checkbox.story.mdx +64 -0
- package/src/components/Checkbox/Checkbox.tsx +19 -6
- package/src/components/Modal/Modal.tsx +10 -0
package/package.json
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { InputProps } from "../Input";
|
|
2
2
|
import { StackProps } from "../Stack";
|
|
3
|
-
export
|
|
3
|
+
export declare type CheckboxProps = InputProps & {
|
|
4
4
|
label?: string;
|
|
5
5
|
hideRequiredStyles?: boolean;
|
|
6
6
|
isRequired?: boolean;
|
|
7
|
-
|
|
7
|
+
checked?: boolean | "indeterminate";
|
|
8
|
+
};
|
|
8
9
|
export declare const Checkbox: {
|
|
9
10
|
({ checked, children, className, disabled, id: idProp, label, onBlur, onChange, onClick, onFocus, hideRequiredStyles, isRequired, tabIndex, theme: themeProp, ...rest }: CheckboxProps): JSX.Element;
|
|
10
11
|
Group: (props: StackProps) => JSX.Element;
|
|
@@ -59,10 +59,14 @@ const Checkbox = ({ checked, children, className, disabled = false, id: idProp,
|
|
|
59
59
|
else if (isRequiredContext !== undefined) {
|
|
60
60
|
calculatedRequired = isRequiredContext;
|
|
61
61
|
}
|
|
62
|
+
const [isIndeterminate, setIndeterminate] = react_1.useState(false);
|
|
63
|
+
react_1.useEffect(() => {
|
|
64
|
+
setIndeterminate(typeof checked === "string" && checked === "indeterminate");
|
|
65
|
+
}, [checked]);
|
|
62
66
|
const bareCheckbox = (react_1.default.createElement(Box_1.Box, { className: bem_1.bem(cn, { e: "BoxWrapper" }) },
|
|
63
|
-
react_1.default.createElement(Input_1.Input, Object.assign({ "aria-checked":
|
|
67
|
+
react_1.default.createElement(Input_1.Input, Object.assign({ "aria-checked": isIndeterminate ? "mixed" : checked, checked: checked, className: bem_1.bem(cn, { e: "Input" }), disabled: disabled, id: id, onChange: onChange, type: "checkbox", onFocus: onFocus, onBlur: onBlur, onClick: label ? handleClick : undefined, tabIndex: tabIndex }, rest)),
|
|
64
68
|
react_1.default.createElement(Box_1.Box, { className: classnames_1.default(bem_1.bem(cn, { e: "Box" }), bem_1.bem(cn, { e: "Box", m: theme }), checked && bem_1.bem(cn, { e: "Box", m: "checked" })) }),
|
|
65
|
-
checked && (react_1.default.createElement(Icon_1.Icon, { className: classnames_1.default(bem_1.bem(cn, { e: "Check" }), bem_1.bem(cn, { e: "Check", m: theme })), icon: Icon_1.ICON_TYPE.CHECK }))));
|
|
69
|
+
checked && (react_1.default.createElement(Icon_1.Icon, { className: classnames_1.default(bem_1.bem(cn, { e: "Check" }), bem_1.bem(cn, { e: "Check", m: theme })), icon: isIndeterminate ? Icon_1.ICON_TYPE.MINUS : Icon_1.ICON_TYPE.CHECK }))));
|
|
66
70
|
const checkboxWithLabel = label || children ? (react_1.default.createElement(Label_1.Label, { className: bem_1.bem(cn, { e: "Label" }), isRequired: calculatedRequired && !hideRequiredStyles },
|
|
67
71
|
bareCheckbox,
|
|
68
72
|
react_1.default.createElement(Text_1.Text, { as: "span", className: classnames_1.default(bem_1.bem(cn, { e: "LabelText" }), bem_1.bem(cn, { e: "LabelText", m: theme })) },
|
|
@@ -108,6 +108,15 @@ const Modal = (props) => {
|
|
|
108
108
|
onClose();
|
|
109
109
|
}
|
|
110
110
|
});
|
|
111
|
+
react_1.useEffect(() => {
|
|
112
|
+
if (isOpen) {
|
|
113
|
+
document.body.classList.add("modal-open");
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
document.body.classList.remove("modal-open");
|
|
117
|
+
}
|
|
118
|
+
return () => document.body.classList.remove("modal-open");
|
|
119
|
+
}, [isOpen]);
|
|
111
120
|
return isOpen ? (react_1.default.createElement(context_1.ModalContext.Provider, { value: { onClose } },
|
|
112
121
|
react_1.default.createElement(Portal_1.Portal, null,
|
|
113
122
|
react_1.default.createElement(react_focus_lock_1.default, { autoFocus: autoFocus, returnFocus: true },
|
package/public/css/styles.css
CHANGED
|
@@ -8687,6 +8687,10 @@ override built-in Image component classes */
|
|
|
8687
8687
|
padding-right: 128px;
|
|
8688
8688
|
}
|
|
8689
8689
|
|
|
8690
|
+
.pl-4 {
|
|
8691
|
+
padding-left: 16px;
|
|
8692
|
+
}
|
|
8693
|
+
|
|
8690
8694
|
.pb-20 {
|
|
8691
8695
|
padding-bottom: 80px;
|
|
8692
8696
|
}
|
|
@@ -8695,10 +8699,6 @@ override built-in Image component classes */
|
|
|
8695
8699
|
padding-top: 8px;
|
|
8696
8700
|
}
|
|
8697
8701
|
|
|
8698
|
-
.pl-4 {
|
|
8699
|
-
padding-left: 16px;
|
|
8700
|
-
}
|
|
8701
|
-
|
|
8702
8702
|
.pt-3 {
|
|
8703
8703
|
padding-top: 12px;
|
|
8704
8704
|
}
|