@conveyorhq/arrow-ds 1.64.0 → 1.65.1
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/Menu/MenuItem.d.ts +1 -1
- package/public/components/Menu/MenuItem.js +2 -2
- package/public/components/Modal/Modal.js +9 -0
- package/public/css/styles.css +12 -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/Menu/MenuItem.tsx +3 -3
- package/src/components/Modal/Modal.tsx +10 -0
- package/src/css/base.css +7 -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 })) },
|
|
@@ -30,9 +30,9 @@ const MenuRenderer_1 = require("../MenuRenderer");
|
|
|
30
30
|
const cn = "Menu";
|
|
31
31
|
exports.MenuItem = react_1.forwardRef(({ children, className, isSelected = false, isHighlighted = false, as: Component = "button", onClick, ...rest }, ref) => {
|
|
32
32
|
const { onClose, itemProps } = MenuRenderer_1.useMenuContext();
|
|
33
|
-
const clickHandler = () => {
|
|
33
|
+
const clickHandler = (event) => {
|
|
34
34
|
if (typeof onClick === "function") {
|
|
35
|
-
onClick();
|
|
35
|
+
onClick(event);
|
|
36
36
|
}
|
|
37
37
|
if (typeof onClose === "function") {
|
|
38
38
|
onClose();
|
|
@@ -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
|
@@ -586,6 +586,14 @@ a:focus-visible,
|
|
|
586
586
|
--tw-backdrop-sepia: ;
|
|
587
587
|
}
|
|
588
588
|
|
|
589
|
+
/* Disable all scrolling outside of a modal when one is open */
|
|
590
|
+
|
|
591
|
+
.modal-open [class^="overflow"],
|
|
592
|
+
.modal-open .ads-ScrollPane-container {
|
|
593
|
+
pointer-events: none !important;
|
|
594
|
+
overflow: hidden !important;
|
|
595
|
+
}
|
|
596
|
+
|
|
589
597
|
/* BASICS */
|
|
590
598
|
|
|
591
599
|
.CodeMirror {
|
|
@@ -8687,6 +8695,10 @@ override built-in Image component classes */
|
|
|
8687
8695
|
padding-right: 128px;
|
|
8688
8696
|
}
|
|
8689
8697
|
|
|
8698
|
+
.pl-4 {
|
|
8699
|
+
padding-left: 16px;
|
|
8700
|
+
}
|
|
8701
|
+
|
|
8690
8702
|
.pb-20 {
|
|
8691
8703
|
padding-bottom: 80px;
|
|
8692
8704
|
}
|
|
@@ -8695,10 +8707,6 @@ override built-in Image component classes */
|
|
|
8695
8707
|
padding-top: 8px;
|
|
8696
8708
|
}
|
|
8697
8709
|
|
|
8698
|
-
.pl-4 {
|
|
8699
|
-
padding-left: 16px;
|
|
8700
|
-
}
|
|
8701
|
-
|
|
8702
8710
|
.pt-3 {
|
|
8703
8711
|
padding-top: 12px;
|
|
8704
8712
|
}
|