@jobber/components 7.2.0 → 7.3.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/Checkbox/Checkbox.d.ts +6 -2
- package/dist/Checkbox/Checkbox.types.d.ts +2 -55
- package/dist/Checkbox/index.cjs +7 -92
- package/dist/Checkbox/index.d.ts +2 -5
- package/dist/Checkbox/index.mjs +6 -95
- package/dist/Checkbox-cjs.js +41 -0
- package/dist/Checkbox-es.js +39 -0
- package/dist/DataList/components/DataListHeader/index.cjs +1 -2
- package/dist/DataList/components/DataListHeader/index.mjs +1 -2
- package/dist/DataList/components/DataListItem/index.cjs +1 -2
- package/dist/DataList/components/DataListItem/index.mjs +1 -2
- package/dist/DataList/components/DataListItems/index.cjs +1 -2
- package/dist/DataList/components/DataListItems/index.mjs +1 -2
- package/dist/DataList/components/DataListLayout/index.cjs +1 -2
- package/dist/DataList/components/DataListLayout/index.mjs +1 -2
- package/dist/DataList/index.cjs +2 -2
- package/dist/DataList/index.mjs +2 -2
- package/dist/DataListHeader-cjs.js +2 -3
- package/dist/DataListHeader-es.js +2 -3
- package/dist/DataListItem-cjs.js +2 -2
- package/dist/DataListItem-es.js +1 -1
- package/dist/MultiSelect/index.cjs +1 -3
- package/dist/MultiSelect/index.mjs +1 -3
- package/dist/MultiSelect-cjs.js +2 -2
- package/dist/MultiSelect-es.js +1 -1
- package/dist/docs/Checkbox/Checkbox.md +24 -10
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +1 -1
- package/package.json +2 -2
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +0 -7
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import
|
|
3
|
-
|
|
2
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<import("./Checkbox.types").CheckboxCoreProps & import("../sharedHelpers/types").AriaInputProps & import("../sharedHelpers/types").FocusEvents<HTMLInputElement> & import("../sharedHelpers/types").MouseEvents<HTMLInputElement> & Pick<import("../sharedHelpers/types").HTMLInputBaseProps, "id" | "name" | "disabled"> & {
|
|
3
|
+
label?: string | React.ReactElement;
|
|
4
|
+
description?: React.ReactNode;
|
|
5
|
+
invalid?: boolean;
|
|
6
|
+
onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
|
|
7
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { ReactElement, ReactNode } from "react";
|
|
2
|
-
import type {
|
|
3
|
-
import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, MouseEvents, RebuiltInputCommonProps } from "../sharedHelpers/types";
|
|
2
|
+
import type { AriaInputProps, FocusEvents, HTMLInputBaseProps, MouseEvents } from "../sharedHelpers/types";
|
|
4
3
|
/**
|
|
5
4
|
* Shared checkbox-specific props used by both legacy and rebuilt versions
|
|
6
5
|
*/
|
|
@@ -26,52 +25,7 @@ export interface CheckboxCoreProps {
|
|
|
26
25
|
*/
|
|
27
26
|
readonly value?: string;
|
|
28
27
|
}
|
|
29
|
-
|
|
30
|
-
* Base props for legacy checkbox
|
|
31
|
-
*/
|
|
32
|
-
export interface BaseCheckboxProps extends CheckboxCoreProps {
|
|
33
|
-
/**
|
|
34
|
-
* Disables the checkbox.
|
|
35
|
-
*/
|
|
36
|
-
readonly disabled?: boolean;
|
|
37
|
-
/**
|
|
38
|
-
* Checkbox input name
|
|
39
|
-
*/
|
|
40
|
-
readonly name?: string;
|
|
41
|
-
/**
|
|
42
|
-
* Further description of the label
|
|
43
|
-
*/
|
|
44
|
-
readonly description?: ReactNode;
|
|
45
|
-
/**
|
|
46
|
-
* ID for the checkbox input
|
|
47
|
-
*/
|
|
48
|
-
readonly id?: string;
|
|
49
|
-
/**
|
|
50
|
-
* Called when the checkbox value changes
|
|
51
|
-
*/
|
|
52
|
-
onChange?(newValue: boolean): void;
|
|
53
|
-
/**
|
|
54
|
-
* Called when the checkbox is focused
|
|
55
|
-
*/
|
|
56
|
-
onFocus?(event: React.FocusEvent<HTMLInputElement>): void;
|
|
57
|
-
/**
|
|
58
|
-
* Called when the checkbox loses focus
|
|
59
|
-
*/
|
|
60
|
-
onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
|
|
61
|
-
}
|
|
62
|
-
interface CheckboxLabelProps extends BaseCheckboxProps {
|
|
63
|
-
/**
|
|
64
|
-
* Label that shows up beside the checkbox.
|
|
65
|
-
*/
|
|
66
|
-
readonly label?: string;
|
|
67
|
-
}
|
|
68
|
-
interface CheckboxChildrenProps extends BaseCheckboxProps {
|
|
69
|
-
/**
|
|
70
|
-
* Component children, which shows up as a label
|
|
71
|
-
*/
|
|
72
|
-
readonly children?: ReactElement;
|
|
73
|
-
}
|
|
74
|
-
export type CheckboxRebuiltProps = CheckboxCoreProps & AriaInputProps & FocusEvents<HTMLInputElement> & MouseEvents<HTMLInputElement> & Pick<HTMLInputBaseProps, "id" | "name" | "disabled"> & Pick<RebuiltInputCommonProps, "version"> & {
|
|
28
|
+
export type CheckboxProps = CheckboxCoreProps & AriaInputProps & FocusEvents<HTMLInputElement> & MouseEvents<HTMLInputElement> & Pick<HTMLInputBaseProps, "id" | "name" | "disabled"> & {
|
|
75
29
|
/**
|
|
76
30
|
* Label that shows up beside the checkbox.
|
|
77
31
|
* String will be rendered with the default markup.
|
|
@@ -95,10 +49,3 @@ export type CheckboxRebuiltProps = CheckboxCoreProps & AriaInputProps & FocusEve
|
|
|
95
49
|
*/
|
|
96
50
|
onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
|
|
97
51
|
};
|
|
98
|
-
/**
|
|
99
|
-
* @deprecated Use the v2 Checkbox component instead (version={2}).
|
|
100
|
-
*/
|
|
101
|
-
export type CheckboxLegacyProps = XOR<CheckboxLabelProps, CheckboxChildrenProps> & {
|
|
102
|
-
version?: 1;
|
|
103
|
-
};
|
|
104
|
-
export {};
|
package/dist/Checkbox/index.cjs
CHANGED
|
@@ -1,99 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
var Icon = require('../Icon-cjs.js');
|
|
8
|
-
var Text = require('../Text-cjs.js');
|
|
9
|
-
var filterDataAttributes = require('../filterDataAttributes-cjs.js');
|
|
3
|
+
var Checkbox = require('../Checkbox-cjs.js');
|
|
4
|
+
require('react');
|
|
5
|
+
require('classnames');
|
|
6
|
+
require('../Icon-cjs.js');
|
|
10
7
|
require('@jobber/design');
|
|
8
|
+
require('../Text-cjs.js');
|
|
11
9
|
require('../Typography-cjs.js');
|
|
10
|
+
require('../filterDataAttributes-cjs.js');
|
|
12
11
|
|
|
13
|
-
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","invalid":"Gqnclw4WaeQ-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
14
12
|
|
|
15
|
-
function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
|
|
16
|
-
const { control, setValue, watch } = reactHookForm.useFormContext() != undefined
|
|
17
|
-
? reactHookForm.useFormContext()
|
|
18
|
-
: // If there isn't a Form Context being provided, get a form for this field.
|
|
19
|
-
reactHookForm.useForm({ mode: "onTouched" });
|
|
20
|
-
const [identifier] = React.useState(React.useId());
|
|
21
|
-
/**
|
|
22
|
-
* Generate a name if one is not supplied, this is the name
|
|
23
|
-
* that will be used for react-hook-form and not neccessarily
|
|
24
|
-
* attached to the DOM
|
|
25
|
-
*/
|
|
26
|
-
const [controlledName] = React.useState(name ? name : `generatedName--${identifier}`);
|
|
27
|
-
React.useEffect(() => {
|
|
28
|
-
if (value != undefined) {
|
|
29
|
-
setValue(controlledName, value);
|
|
30
|
-
}
|
|
31
|
-
}, [value, watch(controlledName)]);
|
|
32
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
|
|
33
|
-
const inputClassName = classnames(styles.input, {
|
|
34
|
-
[styles.indeterminate]: indeterminate,
|
|
35
|
-
});
|
|
36
|
-
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
37
|
-
const labelText = label ? React.createElement(Text.Text, null, label) : children;
|
|
38
|
-
return (React.createElement(reactHookForm.Controller, { control: control, name: controlledName, defaultValue: defaultChecked, render: (_a) => {
|
|
39
|
-
var _b = _a.field, { onChange: onControllerChange, name: controllerName } = _b, rest = tslib_es6.__rest(_b, ["onChange", "name"]);
|
|
40
|
-
const fieldProps = Object.assign(Object.assign({}, rest), { id: identifier, className: inputClassName, name: name && controllerName, onChange: handleChange, disabled: disabled });
|
|
41
|
-
return (React.createElement("div", { className: styles.checkBoxParent },
|
|
42
|
-
React.createElement("label", { className: wrapperClassName },
|
|
43
|
-
React.createElement("span", { className: styles.checkHolder },
|
|
44
|
-
React.createElement("input", Object.assign({}, fieldProps, { type: "checkbox", checked: checked, defaultChecked: defaultChecked, "aria-label": label, onChange: handleChange, onFocus: onFocus, onBlur: onBlur })),
|
|
45
|
-
React.createElement("span", { className: styles.checkBox },
|
|
46
|
-
React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
|
|
47
|
-
labelText && React.createElement("span", { className: styles.label }, labelText)),
|
|
48
|
-
description && (React.createElement("div", { className: styles.description },
|
|
49
|
-
React.createElement(Text.Text, { variation: "subdued", size: "small" }, description)))));
|
|
50
|
-
function handleChange(event) {
|
|
51
|
-
const newChecked = event.currentTarget.checked;
|
|
52
|
-
onChange && onChange(newChecked);
|
|
53
|
-
onControllerChange(event);
|
|
54
|
-
}
|
|
55
|
-
} }));
|
|
56
|
-
}
|
|
57
13
|
|
|
58
|
-
|
|
59
|
-
const { checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, invalid, } = props;
|
|
60
|
-
const descriptionIdentifier = React.useId();
|
|
61
|
-
const descriptionVisible = Boolean(description);
|
|
62
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
63
|
-
const isInvalid = Boolean(invalid);
|
|
64
|
-
const inputClassName = classnames(styles.input, {
|
|
65
|
-
[styles.indeterminate]: indeterminate,
|
|
66
|
-
});
|
|
67
|
-
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
68
|
-
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
69
|
-
const labelContent = typeof label === "string" ? React.createElement(Text.Text, null, label) : label;
|
|
70
|
-
const descriptionContent = typeof description === "string" ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description);
|
|
71
|
-
function handleChange(event) {
|
|
72
|
-
const newChecked = event.currentTarget.checked;
|
|
73
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
|
|
74
|
-
}
|
|
75
|
-
return (React.createElement("div", { className: styles.checkBoxParent },
|
|
76
|
-
React.createElement("label", { className: wrapperClassName },
|
|
77
|
-
React.createElement("span", { className: styles.checkHolder },
|
|
78
|
-
React.createElement("input", Object.assign({ ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
79
|
-
? descriptionIdentifier
|
|
80
|
-
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onClick: onClick, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onPointerDown: onPointerDown, onPointerUp: onPointerUp }, dataAttrs)),
|
|
81
|
-
React.createElement("span", { className: styles.checkBox },
|
|
82
|
-
React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
|
|
83
|
-
labelContent && React.createElement("span", { className: styles.label }, labelContent)),
|
|
84
|
-
description && (React.createElement("div", { id: descriptionIdentifier, className: styles.description }, descriptionContent))));
|
|
85
|
-
});
|
|
86
|
-
CheckboxRebuilt.displayName = "CheckboxRebuilt";
|
|
87
|
-
|
|
88
|
-
function isNewCheckboxProps(props) {
|
|
89
|
-
return props.version === 2;
|
|
90
|
-
}
|
|
91
|
-
const Checkbox = React.forwardRef(function CheckboxShim(props, ref) {
|
|
92
|
-
if (isNewCheckboxProps(props)) {
|
|
93
|
-
return React.createElement(CheckboxRebuilt, Object.assign({}, props, { ref: ref }));
|
|
94
|
-
}
|
|
95
|
-
return React.createElement(CheckboxLegacy, Object.assign({}, props));
|
|
96
|
-
});
|
|
97
|
-
Checkbox.displayName = "Checkbox";
|
|
98
|
-
|
|
99
|
-
exports.Checkbox = Checkbox;
|
|
14
|
+
exports.Checkbox = Checkbox.Checkbox;
|
package/dist/Checkbox/index.d.ts
CHANGED
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
type CheckboxShimProps = CheckboxLegacyProps | CheckboxRebuiltProps;
|
|
4
|
-
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxShimProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
|
-
export type { CheckboxLegacyProps, CheckboxRebuiltProps };
|
|
1
|
+
export { Checkbox } from "./Checkbox";
|
|
2
|
+
export type { CheckboxProps } from "./Checkbox.types";
|
package/dist/Checkbox/index.mjs
CHANGED
|
@@ -1,97 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { I as Icon } from '../Icon-es.js';
|
|
6
|
-
import { T as Text } from '../Text-es.js';
|
|
7
|
-
import { f as filterDataAttributes } from '../filterDataAttributes-es.js';
|
|
1
|
+
export { C as Checkbox } from '../Checkbox-es.js';
|
|
2
|
+
import 'react';
|
|
3
|
+
import 'classnames';
|
|
4
|
+
import '../Icon-es.js';
|
|
8
5
|
import '@jobber/design';
|
|
6
|
+
import '../Text-es.js';
|
|
9
7
|
import '../Typography-es.js';
|
|
10
|
-
|
|
11
|
-
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","invalid":"Gqnclw4WaeQ-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
12
|
-
|
|
13
|
-
function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
|
|
14
|
-
const { control, setValue, watch } = useFormContext() != undefined
|
|
15
|
-
? useFormContext()
|
|
16
|
-
: // If there isn't a Form Context being provided, get a form for this field.
|
|
17
|
-
useForm({ mode: "onTouched" });
|
|
18
|
-
const [identifier] = useState(useId());
|
|
19
|
-
/**
|
|
20
|
-
* Generate a name if one is not supplied, this is the name
|
|
21
|
-
* that will be used for react-hook-form and not neccessarily
|
|
22
|
-
* attached to the DOM
|
|
23
|
-
*/
|
|
24
|
-
const [controlledName] = useState(name ? name : `generatedName--${identifier}`);
|
|
25
|
-
useEffect(() => {
|
|
26
|
-
if (value != undefined) {
|
|
27
|
-
setValue(controlledName, value);
|
|
28
|
-
}
|
|
29
|
-
}, [value, watch(controlledName)]);
|
|
30
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
|
|
31
|
-
const inputClassName = classnames(styles.input, {
|
|
32
|
-
[styles.indeterminate]: indeterminate,
|
|
33
|
-
});
|
|
34
|
-
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
35
|
-
const labelText = label ? React__default.createElement(Text, null, label) : children;
|
|
36
|
-
return (React__default.createElement(Controller, { control: control, name: controlledName, defaultValue: defaultChecked, render: (_a) => {
|
|
37
|
-
var _b = _a.field, { onChange: onControllerChange, name: controllerName } = _b, rest = __rest(_b, ["onChange", "name"]);
|
|
38
|
-
const fieldProps = Object.assign(Object.assign({}, rest), { id: identifier, className: inputClassName, name: name && controllerName, onChange: handleChange, disabled: disabled });
|
|
39
|
-
return (React__default.createElement("div", { className: styles.checkBoxParent },
|
|
40
|
-
React__default.createElement("label", { className: wrapperClassName },
|
|
41
|
-
React__default.createElement("span", { className: styles.checkHolder },
|
|
42
|
-
React__default.createElement("input", Object.assign({}, fieldProps, { type: "checkbox", checked: checked, defaultChecked: defaultChecked, "aria-label": label, onChange: handleChange, onFocus: onFocus, onBlur: onBlur })),
|
|
43
|
-
React__default.createElement("span", { className: styles.checkBox },
|
|
44
|
-
React__default.createElement(Icon, { name: iconName, color: "surface" }))),
|
|
45
|
-
labelText && React__default.createElement("span", { className: styles.label }, labelText)),
|
|
46
|
-
description && (React__default.createElement("div", { className: styles.description },
|
|
47
|
-
React__default.createElement(Text, { variation: "subdued", size: "small" }, description)))));
|
|
48
|
-
function handleChange(event) {
|
|
49
|
-
const newChecked = event.currentTarget.checked;
|
|
50
|
-
onChange && onChange(newChecked);
|
|
51
|
-
onControllerChange(event);
|
|
52
|
-
}
|
|
53
|
-
} }));
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const CheckboxRebuilt = forwardRef(function CheckboxRebuiltInternal(props, ref) {
|
|
57
|
-
const { checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, invalid, } = props;
|
|
58
|
-
const descriptionIdentifier = useId();
|
|
59
|
-
const descriptionVisible = Boolean(description);
|
|
60
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
61
|
-
const isInvalid = Boolean(invalid);
|
|
62
|
-
const inputClassName = classnames(styles.input, {
|
|
63
|
-
[styles.indeterminate]: indeterminate,
|
|
64
|
-
});
|
|
65
|
-
const dataAttrs = filterDataAttributes(props);
|
|
66
|
-
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
67
|
-
const labelContent = typeof label === "string" ? React__default.createElement(Text, null, label) : label;
|
|
68
|
-
const descriptionContent = typeof description === "string" ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description);
|
|
69
|
-
function handleChange(event) {
|
|
70
|
-
const newChecked = event.currentTarget.checked;
|
|
71
|
-
onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
|
|
72
|
-
}
|
|
73
|
-
return (React__default.createElement("div", { className: styles.checkBoxParent },
|
|
74
|
-
React__default.createElement("label", { className: wrapperClassName },
|
|
75
|
-
React__default.createElement("span", { className: styles.checkHolder },
|
|
76
|
-
React__default.createElement("input", Object.assign({ ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
77
|
-
? descriptionIdentifier
|
|
78
|
-
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onClick: onClick, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onPointerDown: onPointerDown, onPointerUp: onPointerUp }, dataAttrs)),
|
|
79
|
-
React__default.createElement("span", { className: styles.checkBox },
|
|
80
|
-
React__default.createElement(Icon, { name: iconName, color: "surface" }))),
|
|
81
|
-
labelContent && React__default.createElement("span", { className: styles.label }, labelContent)),
|
|
82
|
-
description && (React__default.createElement("div", { id: descriptionIdentifier, className: styles.description }, descriptionContent))));
|
|
83
|
-
});
|
|
84
|
-
CheckboxRebuilt.displayName = "CheckboxRebuilt";
|
|
85
|
-
|
|
86
|
-
function isNewCheckboxProps(props) {
|
|
87
|
-
return props.version === 2;
|
|
88
|
-
}
|
|
89
|
-
const Checkbox = forwardRef(function CheckboxShim(props, ref) {
|
|
90
|
-
if (isNewCheckboxProps(props)) {
|
|
91
|
-
return React__default.createElement(CheckboxRebuilt, Object.assign({}, props, { ref: ref }));
|
|
92
|
-
}
|
|
93
|
-
return React__default.createElement(CheckboxLegacy, Object.assign({}, props));
|
|
94
|
-
});
|
|
95
|
-
Checkbox.displayName = "Checkbox";
|
|
96
|
-
|
|
97
|
-
export { Checkbox };
|
|
8
|
+
import '../filterDataAttributes-es.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
var classnames = require('classnames');
|
|
5
|
+
var Icon = require('./Icon-cjs.js');
|
|
6
|
+
var Text = require('./Text-cjs.js');
|
|
7
|
+
var filterDataAttributes = require('./filterDataAttributes-cjs.js');
|
|
8
|
+
|
|
9
|
+
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","invalid":"Gqnclw4WaeQ-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
10
|
+
|
|
11
|
+
const Checkbox = React.forwardRef(function CheckboxInternal(props, ref) {
|
|
12
|
+
const { checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, invalid, } = props;
|
|
13
|
+
const descriptionIdentifier = React.useId();
|
|
14
|
+
const descriptionVisible = Boolean(description);
|
|
15
|
+
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
16
|
+
const isInvalid = Boolean(invalid);
|
|
17
|
+
const inputClassName = classnames(styles.input, {
|
|
18
|
+
[styles.indeterminate]: indeterminate,
|
|
19
|
+
});
|
|
20
|
+
const dataAttrs = filterDataAttributes.filterDataAttributes(props);
|
|
21
|
+
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
22
|
+
const labelContent = typeof label === "string" ? React.createElement(Text.Text, null, label) : label;
|
|
23
|
+
const descriptionContent = typeof description === "string" ? (React.createElement(Text.Text, { size: "small", variation: "subdued" }, description)) : (description);
|
|
24
|
+
function handleChange(event) {
|
|
25
|
+
const newChecked = event.currentTarget.checked;
|
|
26
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
|
|
27
|
+
}
|
|
28
|
+
return (React.createElement("div", { className: styles.checkBoxParent },
|
|
29
|
+
React.createElement("label", { className: wrapperClassName },
|
|
30
|
+
React.createElement("span", { className: styles.checkHolder },
|
|
31
|
+
React.createElement("input", Object.assign({ ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
32
|
+
? descriptionIdentifier
|
|
33
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onClick: onClick, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onPointerDown: onPointerDown, onPointerUp: onPointerUp }, dataAttrs)),
|
|
34
|
+
React.createElement("span", { className: styles.checkBox },
|
|
35
|
+
React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
|
|
36
|
+
labelContent && React.createElement("span", { className: styles.label }, labelContent)),
|
|
37
|
+
description && (React.createElement("div", { id: descriptionIdentifier, className: styles.description }, descriptionContent))));
|
|
38
|
+
});
|
|
39
|
+
Checkbox.displayName = "Checkbox";
|
|
40
|
+
|
|
41
|
+
exports.Checkbox = Checkbox;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import React__default, { forwardRef, useId } from 'react';
|
|
2
|
+
import classnames from 'classnames';
|
|
3
|
+
import { I as Icon } from './Icon-es.js';
|
|
4
|
+
import { T as Text } from './Text-es.js';
|
|
5
|
+
import { f as filterDataAttributes } from './filterDataAttributes-es.js';
|
|
6
|
+
|
|
7
|
+
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","invalid":"Gqnclw4WaeQ-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
8
|
+
|
|
9
|
+
const Checkbox = forwardRef(function CheckboxInternal(props, ref) {
|
|
10
|
+
const { checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, onClick, onMouseDown, onMouseUp, onPointerDown, onPointerUp, invalid, } = props;
|
|
11
|
+
const descriptionIdentifier = useId();
|
|
12
|
+
const descriptionVisible = Boolean(description);
|
|
13
|
+
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
14
|
+
const isInvalid = Boolean(invalid);
|
|
15
|
+
const inputClassName = classnames(styles.input, {
|
|
16
|
+
[styles.indeterminate]: indeterminate,
|
|
17
|
+
});
|
|
18
|
+
const dataAttrs = filterDataAttributes(props);
|
|
19
|
+
const iconName = indeterminate ? "minus2" : "checkmark";
|
|
20
|
+
const labelContent = typeof label === "string" ? React__default.createElement(Text, null, label) : label;
|
|
21
|
+
const descriptionContent = typeof description === "string" ? (React__default.createElement(Text, { size: "small", variation: "subdued" }, description)) : (description);
|
|
22
|
+
function handleChange(event) {
|
|
23
|
+
const newChecked = event.currentTarget.checked;
|
|
24
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newChecked, event);
|
|
25
|
+
}
|
|
26
|
+
return (React__default.createElement("div", { className: styles.checkBoxParent },
|
|
27
|
+
React__default.createElement("label", { className: wrapperClassName },
|
|
28
|
+
React__default.createElement("span", { className: styles.checkHolder },
|
|
29
|
+
React__default.createElement("input", Object.assign({ ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, "aria-label": props["aria-label"], "aria-describedby": descriptionVisible
|
|
30
|
+
? descriptionIdentifier
|
|
31
|
+
: props["aria-describedby"], "aria-invalid": isInvalid ? true : undefined, "aria-required": props["aria-required"], checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onClick: onClick, onMouseDown: onMouseDown, onMouseUp: onMouseUp, onPointerDown: onPointerDown, onPointerUp: onPointerUp }, dataAttrs)),
|
|
32
|
+
React__default.createElement("span", { className: styles.checkBox },
|
|
33
|
+
React__default.createElement(Icon, { name: iconName, color: "surface" }))),
|
|
34
|
+
labelContent && React__default.createElement("span", { className: styles.label }, labelContent)),
|
|
35
|
+
description && (React__default.createElement("div", { id: descriptionIdentifier, className: styles.description }, descriptionContent))));
|
|
36
|
+
});
|
|
37
|
+
Checkbox.displayName = "Checkbox";
|
|
38
|
+
|
|
39
|
+
export { Checkbox as C };
|
|
@@ -28,8 +28,7 @@ require('framer-motion');
|
|
|
28
28
|
require('../../../Button-cjs.js');
|
|
29
29
|
require('react-router-dom');
|
|
30
30
|
require('../../../tslib.es6-cjs.js');
|
|
31
|
-
require('../../../Checkbox
|
|
32
|
-
require('react-hook-form');
|
|
31
|
+
require('../../../Checkbox-cjs.js');
|
|
33
32
|
require('../../../filterDataAttributes-cjs.js');
|
|
34
33
|
require('../../../DataList.module-cjs.js');
|
|
35
34
|
require('../../../DataListBulkActions-cjs.js');
|
|
@@ -26,8 +26,7 @@ import 'framer-motion';
|
|
|
26
26
|
import '../../../Button-es.js';
|
|
27
27
|
import 'react-router-dom';
|
|
28
28
|
import '../../../tslib.es6-es.js';
|
|
29
|
-
import '../../../Checkbox
|
|
30
|
-
import 'react-hook-form';
|
|
29
|
+
import '../../../Checkbox-es.js';
|
|
31
30
|
import '../../../filterDataAttributes-es.js';
|
|
32
31
|
import '../../../DataList.module-es.js';
|
|
33
32
|
import '../../../DataListBulkActions-es.js';
|
|
@@ -38,8 +38,7 @@ require('../../../Heading-cjs.js');
|
|
|
38
38
|
require('../../../DataListLayoutContext-cjs2.js');
|
|
39
39
|
require('../../../DataListItemActionsOverflow-cjs.js');
|
|
40
40
|
require('../../../DataListActionsMenu-cjs.js');
|
|
41
|
-
require('../../../Checkbox
|
|
42
|
-
require('react-hook-form');
|
|
41
|
+
require('../../../Checkbox-cjs.js');
|
|
43
42
|
require('../../../filterDataAttributes-cjs.js');
|
|
44
43
|
require('../../../useBatchSelect-cjs.js');
|
|
45
44
|
require('../../../DataList.module-cjs.js');
|
|
@@ -36,8 +36,7 @@ import '../../../Heading-es.js';
|
|
|
36
36
|
import '../../../DataListLayoutContext-es2.js';
|
|
37
37
|
import '../../../DataListItemActionsOverflow-es.js';
|
|
38
38
|
import '../../../DataListActionsMenu-es.js';
|
|
39
|
-
import '../../../Checkbox
|
|
40
|
-
import 'react-hook-form';
|
|
39
|
+
import '../../../Checkbox-es.js';
|
|
41
40
|
import '../../../filterDataAttributes-es.js';
|
|
42
41
|
import '../../../useBatchSelect-es.js';
|
|
43
42
|
import '../../../DataList.module-es.js';
|
|
@@ -39,8 +39,7 @@ require('../../../Heading-cjs.js');
|
|
|
39
39
|
require('../../../DataListLayoutContext-cjs2.js');
|
|
40
40
|
require('../../../DataListItemActionsOverflow-cjs.js');
|
|
41
41
|
require('../../../DataListActionsMenu-cjs.js');
|
|
42
|
-
require('../../../Checkbox
|
|
43
|
-
require('react-hook-form');
|
|
42
|
+
require('../../../Checkbox-cjs.js');
|
|
44
43
|
require('../../../filterDataAttributes-cjs.js');
|
|
45
44
|
require('../../../useBatchSelect-cjs.js');
|
|
46
45
|
require('../../../DataList.module-cjs.js');
|
|
@@ -37,8 +37,7 @@ import '../../../Heading-es.js';
|
|
|
37
37
|
import '../../../DataListLayoutContext-es2.js';
|
|
38
38
|
import '../../../DataListItemActionsOverflow-es.js';
|
|
39
39
|
import '../../../DataListActionsMenu-es.js';
|
|
40
|
-
import '../../../Checkbox
|
|
41
|
-
import 'react-hook-form';
|
|
40
|
+
import '../../../Checkbox-es.js';
|
|
42
41
|
import '../../../filterDataAttributes-es.js';
|
|
43
42
|
import '../../../useBatchSelect-es.js';
|
|
44
43
|
import '../../../DataList.module-es.js';
|
|
@@ -40,8 +40,7 @@ require('../../../Heading-cjs.js');
|
|
|
40
40
|
require('../../../DataListLayoutContext-cjs2.js');
|
|
41
41
|
require('../../../DataListItemActionsOverflow-cjs.js');
|
|
42
42
|
require('../../../DataListActionsMenu-cjs.js');
|
|
43
|
-
require('../../../Checkbox
|
|
44
|
-
require('react-hook-form');
|
|
43
|
+
require('../../../Checkbox-cjs.js');
|
|
45
44
|
require('../../../filterDataAttributes-cjs.js');
|
|
46
45
|
require('../../../useBatchSelect-cjs.js');
|
|
47
46
|
require('../../../DataList.module-cjs.js');
|
|
@@ -38,8 +38,7 @@ import '../../../Heading-es.js';
|
|
|
38
38
|
import '../../../DataListLayoutContext-es2.js';
|
|
39
39
|
import '../../../DataListItemActionsOverflow-es.js';
|
|
40
40
|
import '../../../DataListActionsMenu-es.js';
|
|
41
|
-
import '../../../Checkbox
|
|
42
|
-
import 'react-hook-form';
|
|
41
|
+
import '../../../Checkbox-es.js';
|
|
43
42
|
import '../../../filterDataAttributes-es.js';
|
|
44
43
|
import '../../../useBatchSelect-es.js';
|
|
45
44
|
import '../../../DataList.module-es.js';
|
package/dist/DataList/index.cjs
CHANGED
|
@@ -48,8 +48,7 @@ require('../Heading-cjs.js');
|
|
|
48
48
|
require('../DataListLayoutContext-cjs2.js');
|
|
49
49
|
require('../DataListItemActionsOverflow-cjs.js');
|
|
50
50
|
require('../DataListActionsMenu-cjs.js');
|
|
51
|
-
require('../Checkbox
|
|
52
|
-
require('react-hook-form');
|
|
51
|
+
require('../Checkbox-cjs.js');
|
|
53
52
|
require('../filterDataAttributes-cjs.js');
|
|
54
53
|
require('../useBatchSelect-cjs.js');
|
|
55
54
|
require('../DataListItemClickable-cjs.js');
|
|
@@ -84,6 +83,7 @@ require('../InputText/index.cjs');
|
|
|
84
83
|
require('../FormField-cjs.js');
|
|
85
84
|
require('../useFormFieldFocus-cjs.js');
|
|
86
85
|
require('../InputValidation-cjs.js');
|
|
86
|
+
require('react-hook-form');
|
|
87
87
|
require('../DataListEmptyState-cjs.js');
|
|
88
88
|
require('../DataListLoadMore-cjs.js');
|
|
89
89
|
require('../DataListAction-cjs.js');
|
package/dist/DataList/index.mjs
CHANGED
|
@@ -46,8 +46,7 @@ import '../Heading-es.js';
|
|
|
46
46
|
import '../DataListLayoutContext-es2.js';
|
|
47
47
|
import '../DataListItemActionsOverflow-es.js';
|
|
48
48
|
import '../DataListActionsMenu-es.js';
|
|
49
|
-
import '../Checkbox
|
|
50
|
-
import 'react-hook-form';
|
|
49
|
+
import '../Checkbox-es.js';
|
|
51
50
|
import '../filterDataAttributes-es.js';
|
|
52
51
|
import '../useBatchSelect-es.js';
|
|
53
52
|
import '../DataListItemClickable-es.js';
|
|
@@ -82,6 +81,7 @@ import '../InputText/index.mjs';
|
|
|
82
81
|
import '../FormField-es.js';
|
|
83
82
|
import '../useFormFieldFocus-es.js';
|
|
84
83
|
import '../InputValidation-es.js';
|
|
84
|
+
import 'react-hook-form';
|
|
85
85
|
import '../DataListEmptyState-es.js';
|
|
86
86
|
import '../DataListLoadMore-es.js';
|
|
87
87
|
import '../DataListAction-es.js';
|
|
@@ -8,7 +8,7 @@ var classnames = require('classnames');
|
|
|
8
8
|
var AnimatedSwitcher = require('./AnimatedSwitcher-cjs.js');
|
|
9
9
|
var Text = require('./Text-cjs.js');
|
|
10
10
|
var Button = require('./Button-cjs.js');
|
|
11
|
-
var
|
|
11
|
+
var Checkbox = require('./Checkbox-cjs.js');
|
|
12
12
|
var DataList_module = require('./DataList.module-cjs.js');
|
|
13
13
|
var DataListBulkActions = require('./DataListBulkActions-cjs.js');
|
|
14
14
|
var useBatchSelect = require('./useBatchSelect-cjs.js');
|
|
@@ -30,8 +30,7 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
30
30
|
React.createElement("div", { "data-testid": DATA_LIST_HEADER_CHECKBOX_TEST_ID, style: {
|
|
31
31
|
visibility: canSelectAll ? "visible" : "hidden",
|
|
32
32
|
}, className: classnames(DataList_module.styles.selectAllCheckbox) },
|
|
33
|
-
React.createElement(
|
|
34
|
-
React.createElement("div", { className: DataList_module.styles.srOnly }, selectedLabel))),
|
|
33
|
+
React.createElement(Checkbox.Checkbox, { checked: isAllSelected(), indeterminate: isIndeterminate(), onChange: handleSelectAll, label: React.createElement("div", { className: DataList_module.styles.srOnly }, selectedLabel) })),
|
|
35
34
|
React.createElement(ColumnHeaderContent, { canSelectAll: canSelectAll, hasAtLeastOneSelected: hasAtLeastOneSelected, selectedCount: selectedCount, deselectText: deselectText, onSelect: onSelect }, children)));
|
|
36
35
|
function isIndeterminate() {
|
|
37
36
|
if (isSelectAll)
|
|
@@ -6,7 +6,7 @@ import classnames from 'classnames';
|
|
|
6
6
|
import { A as AnimatedSwitcher } from './AnimatedSwitcher-es.js';
|
|
7
7
|
import { T as Text } from './Text-es.js';
|
|
8
8
|
import { B as Button } from './Button-es.js';
|
|
9
|
-
import { Checkbox } from './Checkbox
|
|
9
|
+
import { C as Checkbox } from './Checkbox-es.js';
|
|
10
10
|
import { s as styles } from './DataList.module-es.js';
|
|
11
11
|
import { I as InternalDataListBulkActions } from './DataListBulkActions-es.js';
|
|
12
12
|
import { u as useBatchSelect } from './useBatchSelect-es.js';
|
|
@@ -28,8 +28,7 @@ function DataListHeaderCheckbox({ children }) {
|
|
|
28
28
|
React__default.createElement("div", { "data-testid": DATA_LIST_HEADER_CHECKBOX_TEST_ID, style: {
|
|
29
29
|
visibility: canSelectAll ? "visible" : "hidden",
|
|
30
30
|
}, className: classnames(styles.selectAllCheckbox) },
|
|
31
|
-
React__default.createElement(Checkbox, { checked: isAllSelected(), indeterminate: isIndeterminate(), onChange: handleSelectAll },
|
|
32
|
-
React__default.createElement("div", { className: styles.srOnly }, selectedLabel))),
|
|
31
|
+
React__default.createElement(Checkbox, { checked: isAllSelected(), indeterminate: isIndeterminate(), onChange: handleSelectAll, label: React__default.createElement("div", { className: styles.srOnly }, selectedLabel) })),
|
|
33
32
|
React__default.createElement(ColumnHeaderContent, { canSelectAll: canSelectAll, hasAtLeastOneSelected: hasAtLeastOneSelected, selectedCount: selectedCount, deselectText: deselectText, onSelect: onSelect }, children)));
|
|
34
33
|
function isIndeterminate() {
|
|
35
34
|
if (isSelectAll)
|
package/dist/DataListItem-cjs.js
CHANGED
|
@@ -8,7 +8,7 @@ var DataListItemActions = require('./DataListItemActions-cjs.js');
|
|
|
8
8
|
var DataListActionsMenu = require('./DataListActionsMenu-cjs.js');
|
|
9
9
|
var DataListLayoutContext$1 = require('./DataListLayoutContext-cjs2.js');
|
|
10
10
|
var DataList_utils = require('./DataList.utils-cjs.js');
|
|
11
|
-
var
|
|
11
|
+
var Checkbox = require('./Checkbox-cjs.js');
|
|
12
12
|
var useBatchSelect = require('./useBatchSelect-cjs.js');
|
|
13
13
|
var DataList_module = require('./DataList.module-cjs.js');
|
|
14
14
|
var DataListItemClickable = require('./DataListItemClickable-cjs.js');
|
|
@@ -22,7 +22,7 @@ function DataListItemInternal({ children, item, }) {
|
|
|
22
22
|
[DataList_module.styles.selected]: hasAtLeastOneSelected,
|
|
23
23
|
}) },
|
|
24
24
|
children,
|
|
25
|
-
React.createElement(
|
|
25
|
+
React.createElement(Checkbox.Checkbox, { checked: getIsChecked(), onChange: handleChange })));
|
|
26
26
|
function getIsChecked() {
|
|
27
27
|
const isItemInSelectedIDs = selectedIDs.includes(item.id);
|
|
28
28
|
// If we're in a "select all" state, the selectedID's becomes a list of
|
package/dist/DataListItem-es.js
CHANGED
|
@@ -6,7 +6,7 @@ import { I as InternalDataListItemActions } from './DataListItemActions-es.js';
|
|
|
6
6
|
import { D as DataListActionsMenu } from './DataListActionsMenu-es.js';
|
|
7
7
|
import { D as DataListLayoutActionsContext } from './DataListLayoutContext-es2.js';
|
|
8
8
|
import { d as generateListItemElement } from './DataList.utils-es.js';
|
|
9
|
-
import { Checkbox } from './Checkbox
|
|
9
|
+
import { C as Checkbox } from './Checkbox-es.js';
|
|
10
10
|
import { u as useBatchSelect } from './useBatchSelect-es.js';
|
|
11
11
|
import { s as styles } from './DataList.module-es.js';
|
|
12
12
|
import { D as DataListItemClickable } from './DataListItemClickable-es.js';
|
|
@@ -3,9 +3,7 @@
|
|
|
3
3
|
var MultiSelect = require('../MultiSelect-cjs.js');
|
|
4
4
|
require('react');
|
|
5
5
|
require('classnames');
|
|
6
|
-
require('../Checkbox
|
|
7
|
-
require('../tslib.es6-cjs.js');
|
|
8
|
-
require('react-hook-form');
|
|
6
|
+
require('../Checkbox-cjs.js');
|
|
9
7
|
require('../Icon-cjs.js');
|
|
10
8
|
require('@jobber/design');
|
|
11
9
|
require('../Text-cjs.js');
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
export { M as MultiSelect } from '../MultiSelect-es.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import 'classnames';
|
|
4
|
-
import '../Checkbox
|
|
5
|
-
import '../tslib.es6-es.js';
|
|
6
|
-
import 'react-hook-form';
|
|
4
|
+
import '../Checkbox-es.js';
|
|
7
5
|
import '../Icon-es.js';
|
|
8
6
|
import '@jobber/design';
|
|
9
7
|
import '../Text-es.js';
|
package/dist/MultiSelect-cjs.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
4
|
var classnames = require('classnames');
|
|
5
|
-
var
|
|
5
|
+
var Checkbox = require('./Checkbox-cjs.js');
|
|
6
6
|
var Text = require('./Text-cjs.js');
|
|
7
7
|
var Icon = require('./Icon-cjs.js');
|
|
8
8
|
|
|
@@ -81,7 +81,7 @@ function DropDownMenu({ options, setOptions }) {
|
|
|
81
81
|
event.preventDefault();
|
|
82
82
|
handleOptionClick(option);
|
|
83
83
|
}, onMouseOver: e => handleOptionHover(e, index) },
|
|
84
|
-
React.createElement(
|
|
84
|
+
React.createElement(Checkbox.Checkbox, { label: option.label, checked: option.checked, onFocus: () => setHighlightedIndex(index) })));
|
|
85
85
|
})));
|
|
86
86
|
function handlePressUp(event) {
|
|
87
87
|
event.preventDefault();
|
package/dist/MultiSelect-es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React__default, { useState, useRef, useCallback, useEffect } from 'react';
|
|
2
2
|
import classnames from 'classnames';
|
|
3
|
-
import { Checkbox } from './Checkbox
|
|
3
|
+
import { C as Checkbox } from './Checkbox-es.js';
|
|
4
4
|
import { T as Text } from './Text-es.js';
|
|
5
5
|
import { I as Icon } from './Icon-es.js';
|
|
6
6
|
|
|
@@ -58,17 +58,31 @@ able to keep track the state of the child Checkboxes. See
|
|
|
58
58
|
|
|
59
59
|
| Prop | Type | Required | Default | Description |
|
|
60
60
|
|------|------|----------|---------|-------------|
|
|
61
|
+
| `aria-activedescendant` | `string` | No | — | ID of the currently active descendant element. Used for composite widgets like combobox or listbox. @see {@link https... |
|
|
62
|
+
| `aria-autocomplete` | `"none" | "inline" | "list" | "both"` | No | — | Indicates the type of autocomplete interaction. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-autocomplete} |
|
|
63
|
+
| `aria-controls` | `string` | No | — | Indicates the element that controls the current element. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-controls} |
|
|
64
|
+
| `aria-describedby` | `string` | No | — | Identifies the element (or elements) that describes the object. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-... |
|
|
65
|
+
| `aria-details` | `string` | No | — | Identifies the element (or elements) that provide a detailed, extended description. @see {@link https://www.w3.org/TR... |
|
|
66
|
+
| `aria-expanded` | `Booleanish` | No | — | Indicates whether the element is expanded or collapsed. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-expanded} |
|
|
67
|
+
| `aria-label` | `string` | No | — | Defines a string value that labels the current element. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-label} |
|
|
68
|
+
| `aria-labelledby` | `string` | No | — | Identifies the element (or elements) that labels the current element. @see {@link https://www.w3.org/TR/wai-aria-1.2/... |
|
|
69
|
+
| `aria-required` | `Booleanish` | No | — | Indicates that user input is required before form submission. @see {@link https://www.w3.org/TR/wai-aria-1.2/#aria-re... |
|
|
61
70
|
| `checked` | `boolean` | No | — | Determines if the checkbox is checked or not. |
|
|
62
|
-
| `children` | `ReactElement<unknown, string | JSXElementConstructor<any>>` | No | — | Component children, which shows up as a label |
|
|
63
71
|
| `defaultChecked` | `boolean` | No | — | Initial checked value of the checkbox. Only use this when you need to pre-populate the checked attribute that is not ... |
|
|
64
|
-
| `description` | `ReactNode` | No | — |
|
|
65
|
-
| `disabled` | `boolean` | No | — |
|
|
66
|
-
| `id` | `string` | No | — |
|
|
72
|
+
| `description` | `ReactNode` | No | — | Additional description of the checkbox. String will be rendered with the default markup. ReactElement will be rendere... |
|
|
73
|
+
| `disabled` | `boolean` | No | — | Whether the input is disabled. |
|
|
74
|
+
| `id` | `string` | No | — | The unique identifier for the input element. |
|
|
67
75
|
| `indeterminate` | `boolean` | No | `false` | When `true` the checkbox to appears in indeterminate. |
|
|
68
|
-
| `
|
|
69
|
-
| `
|
|
70
|
-
| `
|
|
71
|
-
| `
|
|
72
|
-
| `
|
|
76
|
+
| `invalid` | `boolean` | No | — | Whether the checkbox is invalid |
|
|
77
|
+
| `label` | `string | ReactElement<unknown, string | JSXElementConstructor<any>>` | No | — | Label that shows up beside the checkbox. String will be rendered with the default markup. ReactElement will be render... |
|
|
78
|
+
| `name` | `string` | No | — | The name attribute for the input element. |
|
|
79
|
+
| `onBlur` | `(event: FocusEvent<HTMLInputElement, Element>) => void` | No | — | Blur event handler. |
|
|
80
|
+
| `onChange` | `(newValue: boolean, event: ChangeEvent<HTMLInputElement>) => void` | No | — | Called when the checkbox value changes. Includes the change event as a second argument. This is the recommended event... |
|
|
81
|
+
| `onClick` | `(event: MouseEvent<HTMLInputElement, MouseEvent>) => void` | No | — | Click event handler. |
|
|
82
|
+
| `onFocus` | `(event: FocusEvent<HTMLInputElement, Element>) => void` | No | — | Focus event handler. |
|
|
83
|
+
| `onMouseDown` | `(event: MouseEvent<HTMLInputElement, MouseEvent>) => void` | No | — | Mouse down event handler. |
|
|
84
|
+
| `onMouseUp` | `(event: MouseEvent<HTMLInputElement, MouseEvent>) => void` | No | — | Mouse up event handler. |
|
|
85
|
+
| `onPointerDown` | `(event: PointerEvent<HTMLInputElement>) => void` | No | — | Pointer down event handler. |
|
|
86
|
+
| `onPointerUp` | `(event: PointerEvent<HTMLInputElement>) => void` | No | — | Pointer up event handler. |
|
|
87
|
+
| `ref` | `Ref<HTMLInputElement>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
73
88
|
| `value` | `string` | No | — | Value of the checkbox. |
|
|
74
|
-
| `version` | `1` | No | — | |
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var Card = require('./Card-cjs.js');
|
|
|
15
15
|
var Cluster = require('./Cluster-cjs.js');
|
|
16
16
|
var Container = require('./Container-cjs.js');
|
|
17
17
|
var Cover = require('./Cover-cjs.js');
|
|
18
|
-
var
|
|
18
|
+
var Checkbox = require('./Checkbox-cjs.js');
|
|
19
19
|
var Chip = require('./Chip-cjs.js');
|
|
20
20
|
var ChipDismissible = require('./ChipDismissible-cjs.js');
|
|
21
21
|
require('react');
|
|
@@ -222,7 +222,7 @@ exports.Card = Card.Card;
|
|
|
222
222
|
exports.Cluster = Cluster.Cluster;
|
|
223
223
|
exports.Container = Container.Container;
|
|
224
224
|
exports.Cover = Cover.Cover;
|
|
225
|
-
exports.Checkbox =
|
|
225
|
+
exports.Checkbox = Checkbox.Checkbox;
|
|
226
226
|
exports.Chip = Chip.Chip;
|
|
227
227
|
exports.ChipDismissible = ChipDismissible.ChipDismissible;
|
|
228
228
|
exports.ChipSelectable = ChipDismissible.ChipSelectable;
|
package/dist/index.mjs
CHANGED
|
@@ -13,7 +13,7 @@ export { C as Card } from './Card-es.js';
|
|
|
13
13
|
export { C as Cluster } from './Cluster-es.js';
|
|
14
14
|
export { C as Container } from './Container-es.js';
|
|
15
15
|
export { C as Cover } from './Cover-es.js';
|
|
16
|
-
export { Checkbox } from './Checkbox
|
|
16
|
+
export { C as Checkbox } from './Checkbox-es.js';
|
|
17
17
|
export { C as Chip } from './Chip-es.js';
|
|
18
18
|
export { a as ChipDismissible, C as ChipSelectable } from './ChipDismissible-es.js';
|
|
19
19
|
import 'react';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -583,5 +583,5 @@
|
|
|
583
583
|
"> 1%",
|
|
584
584
|
"IE 10"
|
|
585
585
|
],
|
|
586
|
-
"gitHead": "
|
|
586
|
+
"gitHead": "3de45c6bd3fda1207525ad3328be9c60b407765b"
|
|
587
587
|
}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
export declare const CheckboxRebuilt: React.ForwardRefExoticComponent<import("./Checkbox.types").CheckboxCoreProps & import("../sharedHelpers/types").AriaInputProps & import("../sharedHelpers/types").FocusEvents<HTMLInputElement> & import("../sharedHelpers/types").MouseEvents<HTMLInputElement> & Pick<import("../sharedHelpers/types").HTMLInputBaseProps, "id" | "name" | "disabled"> & Pick<import("../sharedHelpers/types").RebuiltInputCommonProps, "version"> & {
|
|
3
|
-
label?: string | React.ReactElement;
|
|
4
|
-
description?: React.ReactNode;
|
|
5
|
-
invalid?: boolean;
|
|
6
|
-
onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
|
|
7
|
-
} & React.RefAttributes<HTMLInputElement>>;
|