@jobber/components 7.1.2 → 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/Chip/Chip.d.ts +7 -1
- package/dist/Chip/Chip.types.d.ts +7 -2
- package/dist/Chip/index.cjs +1 -1
- package/dist/Chip/index.mjs +1 -1
- package/dist/Chip-cjs.js +40 -25
- package/dist/Chip-es.js +40 -25
- package/dist/Combobox/components/ComboboxTrigger/index.cjs +1 -1
- package/dist/Combobox/components/ComboboxTrigger/index.mjs +1 -1
- 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/InternalChipDismissible-cjs.js +1 -1
- package/dist/InternalChipDismissible-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/docs/Chip/Chip.md +4 -2
- 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 };
|
package/dist/Chip/Chip.d.ts
CHANGED
|
@@ -2,7 +2,13 @@ import React from "react";
|
|
|
2
2
|
import { ChipPrefix } from "./components/ChipPrefix/Chip.Prefix";
|
|
3
3
|
import { ChipSuffix } from "./components/ChipSuffix/Chip.Suffix";
|
|
4
4
|
import type { ChipProps } from "./Chip.types";
|
|
5
|
-
|
|
5
|
+
type ChipElement = HTMLButtonElement | HTMLDivElement;
|
|
6
|
+
export declare const Chip: React.ForwardRefExoticComponent<ChipProps & React.HTMLAttributes<ChipElement> & {
|
|
7
|
+
readonly "data-testid"?: string;
|
|
8
|
+
readonly className?: string;
|
|
9
|
+
readonly style?: React.CSSProperties;
|
|
10
|
+
} & React.RefAttributes<HTMLDivElement | HTMLButtonElement>> & {
|
|
6
11
|
Prefix: typeof ChipPrefix;
|
|
7
12
|
Suffix: typeof ChipSuffix;
|
|
8
13
|
};
|
|
14
|
+
export {};
|
|
@@ -44,9 +44,14 @@ export interface ChipProps extends PropsWithChildren {
|
|
|
44
44
|
*/
|
|
45
45
|
readonly variation?: ChipVariations;
|
|
46
46
|
/**
|
|
47
|
-
* Chip
|
|
47
|
+
* Chip click callback using a standard event-first signature.
|
|
48
48
|
*/
|
|
49
|
-
readonly onClick?: (
|
|
49
|
+
readonly onClick?: (ev: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
50
|
+
/**
|
|
51
|
+
* Value-first click callback retained as an upgrade path for existing consumers.
|
|
52
|
+
* @deprecated Prefer `onClick` with a closure over the value.
|
|
53
|
+
*/
|
|
54
|
+
readonly onClickValue?: (value: string | number | undefined, ev: React.MouseEvent<HTMLButtonElement | HTMLDivElement>) => void;
|
|
50
55
|
/**
|
|
51
56
|
* Callback. Called when you keydown on Chip. Ships the event, so you can get the key pushed.
|
|
52
57
|
*/
|
package/dist/Chip/index.cjs
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var Chip = require('../Chip-cjs.js');
|
|
4
4
|
var ChipDismissible = require('../ChipDismissible-cjs.js');
|
|
5
|
+
require('../tslib.es6-cjs.js');
|
|
5
6
|
require('react');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@jobber/hooks');
|
|
@@ -18,7 +19,6 @@ require('react/jsx-runtime');
|
|
|
18
19
|
require('react-dom');
|
|
19
20
|
require('../floating-ui.react-dom-cjs.js');
|
|
20
21
|
require('framer-motion');
|
|
21
|
-
require('../tslib.es6-cjs.js');
|
|
22
22
|
|
|
23
23
|
|
|
24
24
|
|
package/dist/Chip/index.mjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { C as Chip } from '../Chip-es.js';
|
|
2
2
|
export { a as ChipDismissible, C as ChipSelectable } from '../ChipDismissible-es.js';
|
|
3
|
+
import '../tslib.es6-es.js';
|
|
3
4
|
import 'react';
|
|
4
5
|
import 'classnames';
|
|
5
6
|
import '@jobber/hooks';
|
|
@@ -16,4 +17,3 @@ import 'react/jsx-runtime';
|
|
|
16
17
|
import 'react-dom';
|
|
17
18
|
import '../floating-ui.react-dom-es.js';
|
|
18
19
|
import 'framer-motion';
|
|
19
|
-
import '../tslib.es6-es.js';
|
package/dist/Chip-cjs.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var tslib_es6 = require('./tslib.es6-cjs.js');
|
|
3
4
|
var React = require('react');
|
|
4
5
|
var classnames = require('classnames');
|
|
5
6
|
var jobberHooks = require('@jobber/hooks');
|
|
@@ -64,13 +65,14 @@ function ChipSuffix({ children, className, onClick, testID, ariaLabel, }) {
|
|
|
64
65
|
return (React.createElement("span", { className: classnames(onClick ? styles$1.clickableSuffix : styles$1.suffix, className, !singleChild && styles$1.empty), onClick: handleClick, onKeyPress: handleClick, role: onClick ? "button" : undefined, tabIndex: onClick ? 0 : undefined, "data-testid": testID, "aria-label": ariaLabel }, singleChild));
|
|
65
66
|
}
|
|
66
67
|
|
|
67
|
-
const ChipComponent = React.forwardRef((
|
|
68
|
+
const ChipComponent = React.forwardRef((_a, ref) => {
|
|
69
|
+
var { ariaLabel, "aria-label": ariaLabelProp, disabled, heading, invalid, label, value, testID, onClick, onClickValue, onKeyDown, children, role = "button", tabIndex = 0, variation = "base", className, style, onFocus, onBlur, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onTouchStart, onTouchEnd, onContextMenu, title, "data-testid": dataTestId } = _a, rest = tslib_es6.__rest(_a, ["ariaLabel", "aria-label", "disabled", "heading", "invalid", "label", "value", "testID", "onClick", "onClickValue", "onKeyDown", "children", "role", "tabIndex", "variation", "className", "style", "onFocus", "onBlur", "onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd", "onContextMenu", "title", "data-testid"]);
|
|
68
70
|
const classes = classnames(styles$1.chip, {
|
|
69
71
|
[styles$1.invalid]: invalid,
|
|
70
72
|
[styles$1.base]: variation === "base",
|
|
71
73
|
[styles$1.subtle]: variation === "subtle",
|
|
72
74
|
[styles$1.disabled]: disabled,
|
|
73
|
-
});
|
|
75
|
+
}, className);
|
|
74
76
|
const prefix = useChildComponent.useChildComponent(children, d => d.type === ChipPrefix);
|
|
75
77
|
const suffix = useChildComponent.useChildComponent(children, d => d.type === ChipSuffix);
|
|
76
78
|
const [labelRef, labelFullyVisible] = jobberHooks.useInView();
|
|
@@ -90,29 +92,42 @@ const ChipComponent = React.forwardRef(({ ariaLabel, disabled, heading, invalid,
|
|
|
90
92
|
!labelFullyVisible && (React.createElement("div", { className: styles$1.truncateGradient, "data-testid": "ATL-Chip-Truncation-Gradient" },
|
|
91
93
|
React.createElement("span", null)))),
|
|
92
94
|
suffix));
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
?
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
"data-testid": testID,
|
|
114
|
-
|
|
115
|
-
|
|
95
|
+
const isClickable = Boolean(onClick || onClickValue);
|
|
96
|
+
const handleClick = (ev) => {
|
|
97
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
98
|
+
onClickValue === null || onClickValue === void 0 ? void 0 : onClickValue(value, ev);
|
|
99
|
+
};
|
|
100
|
+
return (React.createElement(Tooltip.Tooltip, { message: tooltipMessage, setTabIndex: false }, isClickable
|
|
101
|
+
? React.createElement("button", Object.assign(Object.assign({}, rest), { className: classes, style, onClick: handleClick, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
102
|
+
onFocus,
|
|
103
|
+
onBlur,
|
|
104
|
+
onPointerDown,
|
|
105
|
+
onPointerUp,
|
|
106
|
+
onPointerEnter,
|
|
107
|
+
onPointerLeave,
|
|
108
|
+
onMouseDown,
|
|
109
|
+
onMouseUp,
|
|
110
|
+
onMouseEnter,
|
|
111
|
+
onMouseLeave,
|
|
112
|
+
onTouchStart,
|
|
113
|
+
onTouchEnd,
|
|
114
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, disabled,
|
|
115
|
+
role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title, type: "button", ref }), chipContent)
|
|
116
|
+
: React.createElement("div", Object.assign(Object.assign({}, rest), { className: classes, style, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
117
|
+
onFocus,
|
|
118
|
+
onBlur,
|
|
119
|
+
onPointerDown,
|
|
120
|
+
onPointerUp,
|
|
121
|
+
onPointerEnter,
|
|
122
|
+
onPointerLeave,
|
|
123
|
+
onMouseDown,
|
|
124
|
+
onMouseUp,
|
|
125
|
+
onMouseEnter,
|
|
126
|
+
onMouseLeave,
|
|
127
|
+
onTouchStart,
|
|
128
|
+
onTouchEnd,
|
|
129
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title,
|
|
130
|
+
ref }), chipContent)));
|
|
116
131
|
});
|
|
117
132
|
function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, heading) {
|
|
118
133
|
let message = "";
|
package/dist/Chip-es.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { _ as __rest } from './tslib.es6-es.js';
|
|
1
2
|
import React__default, { useRef, forwardRef } from 'react';
|
|
2
3
|
import classnames from 'classnames';
|
|
3
4
|
import { useInView } from '@jobber/hooks';
|
|
@@ -62,13 +63,14 @@ function ChipSuffix({ children, className, onClick, testID, ariaLabel, }) {
|
|
|
62
63
|
return (React__default.createElement("span", { className: classnames(onClick ? styles$1.clickableSuffix : styles$1.suffix, className, !singleChild && styles$1.empty), onClick: handleClick, onKeyPress: handleClick, role: onClick ? "button" : undefined, tabIndex: onClick ? 0 : undefined, "data-testid": testID, "aria-label": ariaLabel }, singleChild));
|
|
63
64
|
}
|
|
64
65
|
|
|
65
|
-
const ChipComponent = forwardRef((
|
|
66
|
+
const ChipComponent = forwardRef((_a, ref) => {
|
|
67
|
+
var { ariaLabel, "aria-label": ariaLabelProp, disabled, heading, invalid, label, value, testID, onClick, onClickValue, onKeyDown, children, role = "button", tabIndex = 0, variation = "base", className, style, onFocus, onBlur, onPointerDown, onPointerUp, onPointerEnter, onPointerLeave, onMouseDown, onMouseUp, onMouseEnter, onMouseLeave, onTouchStart, onTouchEnd, onContextMenu, title, "data-testid": dataTestId } = _a, rest = __rest(_a, ["ariaLabel", "aria-label", "disabled", "heading", "invalid", "label", "value", "testID", "onClick", "onClickValue", "onKeyDown", "children", "role", "tabIndex", "variation", "className", "style", "onFocus", "onBlur", "onPointerDown", "onPointerUp", "onPointerEnter", "onPointerLeave", "onMouseDown", "onMouseUp", "onMouseEnter", "onMouseLeave", "onTouchStart", "onTouchEnd", "onContextMenu", "title", "data-testid"]);
|
|
66
68
|
const classes = classnames(styles$1.chip, {
|
|
67
69
|
[styles$1.invalid]: invalid,
|
|
68
70
|
[styles$1.base]: variation === "base",
|
|
69
71
|
[styles$1.subtle]: variation === "subtle",
|
|
70
72
|
[styles$1.disabled]: disabled,
|
|
71
|
-
});
|
|
73
|
+
}, className);
|
|
72
74
|
const prefix = useChildComponent(children, d => d.type === ChipPrefix);
|
|
73
75
|
const suffix = useChildComponent(children, d => d.type === ChipSuffix);
|
|
74
76
|
const [labelRef, labelFullyVisible] = useInView();
|
|
@@ -88,29 +90,42 @@ const ChipComponent = forwardRef(({ ariaLabel, disabled, heading, invalid, label
|
|
|
88
90
|
!labelFullyVisible && (React__default.createElement("div", { className: styles$1.truncateGradient, "data-testid": "ATL-Chip-Truncation-Gradient" },
|
|
89
91
|
React__default.createElement("span", null)))),
|
|
90
92
|
suffix));
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
?
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
"data-testid": testID,
|
|
112
|
-
|
|
113
|
-
|
|
93
|
+
const isClickable = Boolean(onClick || onClickValue);
|
|
94
|
+
const handleClick = (ev) => {
|
|
95
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(ev);
|
|
96
|
+
onClickValue === null || onClickValue === void 0 ? void 0 : onClickValue(value, ev);
|
|
97
|
+
};
|
|
98
|
+
return (React__default.createElement(Tooltip, { message: tooltipMessage, setTabIndex: false }, isClickable
|
|
99
|
+
? React__default.createElement("button", Object.assign(Object.assign({}, rest), { className: classes, style, onClick: handleClick, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
100
|
+
onFocus,
|
|
101
|
+
onBlur,
|
|
102
|
+
onPointerDown,
|
|
103
|
+
onPointerUp,
|
|
104
|
+
onPointerEnter,
|
|
105
|
+
onPointerLeave,
|
|
106
|
+
onMouseDown,
|
|
107
|
+
onMouseUp,
|
|
108
|
+
onMouseEnter,
|
|
109
|
+
onMouseLeave,
|
|
110
|
+
onTouchStart,
|
|
111
|
+
onTouchEnd,
|
|
112
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, disabled,
|
|
113
|
+
role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title, type: "button", ref }), chipContent)
|
|
114
|
+
: React__default.createElement("div", Object.assign(Object.assign({}, rest), { className: classes, style, tabIndex: disabled ? -1 : tabIndex, onKeyDown,
|
|
115
|
+
onFocus,
|
|
116
|
+
onBlur,
|
|
117
|
+
onPointerDown,
|
|
118
|
+
onPointerUp,
|
|
119
|
+
onPointerEnter,
|
|
120
|
+
onPointerLeave,
|
|
121
|
+
onMouseDown,
|
|
122
|
+
onMouseUp,
|
|
123
|
+
onMouseEnter,
|
|
124
|
+
onMouseLeave,
|
|
125
|
+
onTouchStart,
|
|
126
|
+
onTouchEnd,
|
|
127
|
+
onContextMenu, "aria-label": ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : ariaLabelProp, role, "data-testid": testID !== null && testID !== void 0 ? testID : dataTestId, title,
|
|
128
|
+
ref }), chipContent)));
|
|
114
129
|
});
|
|
115
130
|
function getTooltipMessage(labelFullyVisible, headingFullyVisible, label, heading) {
|
|
116
131
|
let message = "";
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
var ComboboxTrigger = require('../../../ComboboxTrigger-cjs.js');
|
|
4
4
|
require('react');
|
|
5
5
|
require('../../../Chip-cjs.js');
|
|
6
|
+
require('../../../tslib.es6-cjs.js');
|
|
6
7
|
require('classnames');
|
|
7
8
|
require('@jobber/hooks');
|
|
8
9
|
require('../../../Avatar-cjs.js');
|
|
@@ -18,7 +19,6 @@ require('react/jsx-runtime');
|
|
|
18
19
|
require('react-dom');
|
|
19
20
|
require('../../../floating-ui.react-dom-cjs.js');
|
|
20
21
|
require('framer-motion');
|
|
21
|
-
require('../../../tslib.es6-cjs.js');
|
|
22
22
|
require('../../../ComboboxProvider-cjs.js');
|
|
23
23
|
|
|
24
24
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { C as ComboboxTrigger } from '../../../ComboboxTrigger-es.js';
|
|
2
2
|
import 'react';
|
|
3
3
|
import '../../../Chip-es.js';
|
|
4
|
+
import '../../../tslib.es6-es.js';
|
|
4
5
|
import 'classnames';
|
|
5
6
|
import '@jobber/hooks';
|
|
6
7
|
import '../../../Avatar-es.js';
|
|
@@ -16,5 +17,4 @@ import 'react/jsx-runtime';
|
|
|
16
17
|
import 'react-dom';
|
|
17
18
|
import '../../../floating-ui.react-dom-es.js';
|
|
18
19
|
import 'framer-motion';
|
|
19
|
-
import '../../../tslib.es6-es.js';
|
|
20
20
|
import '../../../ComboboxProvider-es.js';
|
|
@@ -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';
|
|
@@ -14,7 +14,7 @@ var Chip = require('./Chip-cjs.js');
|
|
|
14
14
|
require('./tslib.es6-cjs.js');
|
|
15
15
|
|
|
16
16
|
function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
|
|
17
|
-
return (React.createElement(Chip.Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick
|
|
17
|
+
return (React.createElement(Chip.Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick, label: label },
|
|
18
18
|
prefix && React.createElement(Chip.Chip.Prefix, null, prefix),
|
|
19
19
|
suffix && React.createElement(Chip.Chip.Suffix, null, suffix)));
|
|
20
20
|
}
|
|
@@ -12,7 +12,7 @@ import { C as Chip, I as InternalChipButton } from './Chip-es.js';
|
|
|
12
12
|
import './tslib.es6-es.js';
|
|
13
13
|
|
|
14
14
|
function InternalChip({ label, active = false, disabled = false, invalid = false, prefix, suffix, tabIndex, ariaLabel, onClick, onKeyDown, }) {
|
|
15
|
-
return (React__default.createElement(Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick
|
|
15
|
+
return (React__default.createElement(Chip, { disabled: disabled, invalid: invalid, onKeyDown: onKeyDown, testID: "ATL-InternalChip", ariaLabel: ariaLabel, tabIndex: tabIndex, variation: active ? "base" : "subtle", role: tabIndex !== undefined ? "option" : undefined, onClick: onClick, label: label },
|
|
16
16
|
prefix && React__default.createElement(Chip.Prefix, null, prefix),
|
|
17
17
|
suffix && React__default.createElement(Chip.Suffix, null, suffix)));
|
|
18
18
|
}
|
|
@@ -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/docs/Chip/Chip.md
CHANGED
|
@@ -362,11 +362,13 @@ those more complex selection flows.
|
|
|
362
362
|
|------|------|----------|---------|-------------|
|
|
363
363
|
| `label` | `string` | Yes | — | The content of the chip. Will be displayed on the right if you include a heading. |
|
|
364
364
|
| `ariaLabel` | `string` | No | — | Accessible label, which can be different from the primary label. |
|
|
365
|
+
| `data-testid` | `string` | No | — | |
|
|
365
366
|
| `disabled` | `boolean` | No | — | Disables both mouse and keyboard functionality, and updates the visual style of the Chip to appear disabled. |
|
|
366
367
|
| `heading` | `string` | No | — | Adds more prominent text to act as a heading. Will be displayed on the left with a | separator. |
|
|
367
368
|
| `invalid` | `boolean` | No | — | Changes Chip styling to inform the user of an issue. |
|
|
368
|
-
| `onClick` | `(
|
|
369
|
-
| `
|
|
369
|
+
| `onClick` | `((ev: MouseEvent<HTMLButtonElement | HTMLDivElement, MouseEvent>) => void) & MouseEventHandler<ChipElement>` | No | — | Chip click callback using a standard event-first signature. |
|
|
370
|
+
| `onClickValue` | `(value: string | number, ev: MouseEvent<HTMLButtonElement | HTMLDivElement, MouseEvent>) => void` | No | — | Value-first click callback retained as an upgrade path for existing consumers. @deprecated Prefer `onClick` with a cl... |
|
|
371
|
+
| `onKeyDown` | `((ev: KeyboardEvent<HTMLButtonElement | HTMLDivElement>) => void) & KeyboardEventHandler<ChipElement>` | No | — | Callback. Called when you keydown on Chip. Ships the event, so you can get the key pushed. |
|
|
370
372
|
| `ref` | `Ref<HTMLButtonElement | HTMLDivElement>` | No | — | Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (... |
|
|
371
373
|
| `role` | `string` | No | `button` | The accessible role the Chip is fulfilling. Defaults to 'button' |
|
|
372
374
|
| `tabIndex` | `number` | No | `0` | Used for accessibility purpopses, specifically using the tab key as navigation. |
|
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>>;
|