@jobber/components 6.60.5 → 6.61.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Checkbox/Checkbox.rebuilt.d.ts +6 -2
- package/dist/Checkbox/Checkbox.types.d.ts +4 -0
- package/dist/Checkbox/index.cjs +10 -8
- package/dist/Checkbox/index.d.ts +1 -1
- package/dist/Checkbox/index.mjs +11 -9
- package/dist/Modal/index.cjs +2 -2
- package/dist/Modal/index.mjs +2 -2
- package/dist/styles.css +21 -0
- package/package.json +2 -2
|
@@ -1,3 +1,7 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
|
|
3
|
-
|
|
2
|
+
export declare const CheckboxRebuilt: React.ForwardRefExoticComponent<Omit<import("./Checkbox.types").BaseCheckboxProps, "children" | "onChange" | "label" | "description"> & {
|
|
3
|
+
label?: string | React.ReactElement;
|
|
4
|
+
description?: string | React.ReactElement;
|
|
5
|
+
onChange?(newValue: boolean, event: React.ChangeEvent<HTMLInputElement>): void;
|
|
6
|
+
version: 2;
|
|
7
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -49,6 +49,10 @@ export interface BaseCheckboxProps {
|
|
|
49
49
|
* Called when the checkbox loses focus
|
|
50
50
|
*/
|
|
51
51
|
onBlur?(event: React.FocusEvent<HTMLInputElement>): void;
|
|
52
|
+
/**
|
|
53
|
+
* Whether the checkbox is invalid
|
|
54
|
+
*/
|
|
55
|
+
invalid?: boolean;
|
|
52
56
|
}
|
|
53
57
|
interface CheckboxLabelProps extends BaseCheckboxProps {
|
|
54
58
|
/**
|
package/dist/Checkbox/index.cjs
CHANGED
|
@@ -9,7 +9,7 @@ var Text = require('../Text-cjs.js');
|
|
|
9
9
|
require('@jobber/design');
|
|
10
10
|
require('../Typography-cjs.js');
|
|
11
11
|
|
|
12
|
-
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
12
|
+
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-"};
|
|
13
13
|
|
|
14
14
|
function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
|
|
15
15
|
const { control, setValue, watch } = reactHookForm.useFormContext() != undefined
|
|
@@ -54,8 +54,8 @@ function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value,
|
|
|
54
54
|
} }));
|
|
55
55
|
}
|
|
56
56
|
|
|
57
|
-
|
|
58
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
|
|
57
|
+
const CheckboxRebuilt = React.forwardRef(function CheckboxRebuiltInternal({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, invalid, }, ref) {
|
|
58
|
+
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
59
59
|
const inputClassName = classnames(styles.input, {
|
|
60
60
|
[styles.indeterminate]: indeterminate,
|
|
61
61
|
});
|
|
@@ -69,21 +69,23 @@ function CheckboxRebuilt({ checked, defaultChecked, disabled, label, name, value
|
|
|
69
69
|
return (React.createElement("div", { className: styles.checkBoxParent },
|
|
70
70
|
React.createElement("label", { className: wrapperClassName },
|
|
71
71
|
React.createElement("span", { className: styles.checkHolder },
|
|
72
|
-
React.createElement("input", { type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
|
|
72
|
+
React.createElement("input", { ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
|
|
73
73
|
React.createElement("span", { className: styles.checkBox },
|
|
74
74
|
React.createElement(Icon.Icon, { name: iconName, color: "surface" }))),
|
|
75
75
|
labelContent && React.createElement("span", { className: styles.label }, labelContent)),
|
|
76
76
|
description && (React.createElement("div", { className: styles.description }, descriptionContent))));
|
|
77
|
-
}
|
|
77
|
+
});
|
|
78
|
+
CheckboxRebuilt.displayName = "CheckboxRebuilt";
|
|
78
79
|
|
|
79
80
|
function isNewCheckboxProps(props) {
|
|
80
81
|
return props.version === 2;
|
|
81
82
|
}
|
|
82
|
-
|
|
83
|
+
const Checkbox = React.forwardRef(function CheckboxShim(props, ref) {
|
|
83
84
|
if (isNewCheckboxProps(props)) {
|
|
84
|
-
return React.createElement(CheckboxRebuilt, Object.assign({}, props));
|
|
85
|
+
return React.createElement(CheckboxRebuilt, Object.assign({}, props, { ref: ref }));
|
|
85
86
|
}
|
|
86
87
|
return React.createElement(CheckboxLegacy, Object.assign({}, props));
|
|
87
|
-
}
|
|
88
|
+
});
|
|
89
|
+
Checkbox.displayName = "Checkbox";
|
|
88
90
|
|
|
89
91
|
exports.Checkbox = Checkbox;
|
package/dist/Checkbox/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import { CheckboxLegacyProps, CheckboxRebuiltProps } from "./Checkbox.types";
|
|
3
3
|
type CheckboxShimProps = CheckboxLegacyProps | CheckboxRebuiltProps;
|
|
4
|
-
export declare
|
|
4
|
+
export declare const Checkbox: React.ForwardRefExoticComponent<CheckboxShimProps & React.RefAttributes<HTMLInputElement>>;
|
|
5
5
|
export type { CheckboxLegacyProps, CheckboxRebuiltProps };
|
package/dist/Checkbox/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React__default, { useState, useId, useEffect } from 'react';
|
|
1
|
+
import React__default, { useState, useId, useEffect, forwardRef } from 'react';
|
|
2
2
|
import { _ as __rest } from '../tslib.es6-es.js';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import { useFormContext, useForm, Controller } from 'react-hook-form';
|
|
@@ -7,7 +7,7 @@ import { T as Text } from '../Text-es.js';
|
|
|
7
7
|
import '@jobber/design';
|
|
8
8
|
import '../Typography-es.js';
|
|
9
9
|
|
|
10
|
-
var styles = {"checkBoxParent":"YxKKPXAU10s-","wrapper":"KxWx-msbH9c-","disabled":"TKr3J-6ARFo-","checkHolder":"NO34ZbhNqhI-","input":"XnCmS-EzK2M-","checkBox":"_-8JCQE6SA9s-","indeterminate":"rqHq3ff9In0-","label":"l8z5TxzVvqA-","description":"DcBfVgpiWa4-","spinning":"rFBN9M5-4Ok-"};
|
|
10
|
+
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-"};
|
|
11
11
|
|
|
12
12
|
function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, children, onBlur, onChange, onFocus, }) {
|
|
13
13
|
const { control, setValue, watch } = useFormContext() != undefined
|
|
@@ -52,8 +52,8 @@ function CheckboxLegacy({ checked, defaultChecked, disabled, label, name, value,
|
|
|
52
52
|
} }));
|
|
53
53
|
}
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled);
|
|
55
|
+
const CheckboxRebuilt = forwardRef(function CheckboxRebuiltInternal({ checked, defaultChecked, disabled, label, name, value, indeterminate = false, description, id, onBlur, onChange, onFocus, invalid, }, ref) {
|
|
56
|
+
const wrapperClassName = classnames(styles.wrapper, disabled && styles.disabled, invalid && styles.invalid);
|
|
57
57
|
const inputClassName = classnames(styles.input, {
|
|
58
58
|
[styles.indeterminate]: indeterminate,
|
|
59
59
|
});
|
|
@@ -67,21 +67,23 @@ function CheckboxRebuilt({ checked, defaultChecked, disabled, label, name, value
|
|
|
67
67
|
return (React__default.createElement("div", { className: styles.checkBoxParent },
|
|
68
68
|
React__default.createElement("label", { className: wrapperClassName },
|
|
69
69
|
React__default.createElement("span", { className: styles.checkHolder },
|
|
70
|
-
React__default.createElement("input", { type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
|
|
70
|
+
React__default.createElement("input", { ref: ref, type: "checkbox", id: id, className: inputClassName, name: name, checked: checked, value: value, defaultChecked: defaultChecked, disabled: disabled, onChange: handleChange, onFocus: onFocus, onBlur: onBlur }),
|
|
71
71
|
React__default.createElement("span", { className: styles.checkBox },
|
|
72
72
|
React__default.createElement(Icon, { name: iconName, color: "surface" }))),
|
|
73
73
|
labelContent && React__default.createElement("span", { className: styles.label }, labelContent)),
|
|
74
74
|
description && (React__default.createElement("div", { className: styles.description }, descriptionContent))));
|
|
75
|
-
}
|
|
75
|
+
});
|
|
76
|
+
CheckboxRebuilt.displayName = "CheckboxRebuilt";
|
|
76
77
|
|
|
77
78
|
function isNewCheckboxProps(props) {
|
|
78
79
|
return props.version === 2;
|
|
79
80
|
}
|
|
80
|
-
|
|
81
|
+
const Checkbox = forwardRef(function CheckboxShim(props, ref) {
|
|
81
82
|
if (isNewCheckboxProps(props)) {
|
|
82
|
-
return React__default.createElement(CheckboxRebuilt, Object.assign({}, props));
|
|
83
|
+
return React__default.createElement(CheckboxRebuilt, Object.assign({}, props, { ref: ref }));
|
|
83
84
|
}
|
|
84
85
|
return React__default.createElement(CheckboxLegacy, Object.assign({}, props));
|
|
85
|
-
}
|
|
86
|
+
});
|
|
87
|
+
Checkbox.displayName = "Checkbox";
|
|
86
88
|
|
|
87
89
|
export { Checkbox };
|
package/dist/Modal/index.cjs
CHANGED
|
@@ -181,9 +181,9 @@ function ModalActions({ primary, secondary, tertiary, }) {
|
|
|
181
181
|
return (React.createElement(React.Fragment, null, shouldShow && (React.createElement("div", { className: actionBar, "data-testid": "ATL-Modal-Actions" },
|
|
182
182
|
React.createElement("div", { className: rightAction },
|
|
183
183
|
primary && React.createElement(Button.Button, Object.assign({}, primary)),
|
|
184
|
-
secondary && (React.createElement(Button.Button, Object.assign({
|
|
184
|
+
secondary && (React.createElement(Button.Button, Object.assign({ type: "primary", variation: "subtle" }, secondary)))),
|
|
185
185
|
tertiary && (React.createElement("div", { className: leftAction },
|
|
186
|
-
React.createElement(Button.Button, Object.assign({
|
|
186
|
+
React.createElement(Button.Button, Object.assign({ type: "secondary", variation: "destructive" }, tertiary))))))));
|
|
187
187
|
}
|
|
188
188
|
function ModalActivator({ children }) {
|
|
189
189
|
const { activatorRef } = useModalContext();
|
package/dist/Modal/index.mjs
CHANGED
|
@@ -179,9 +179,9 @@ function ModalActions({ primary, secondary, tertiary, }) {
|
|
|
179
179
|
return (React__default.createElement(React__default.Fragment, null, shouldShow && (React__default.createElement("div", { className: actionBar, "data-testid": "ATL-Modal-Actions" },
|
|
180
180
|
React__default.createElement("div", { className: rightAction },
|
|
181
181
|
primary && React__default.createElement(Button, Object.assign({}, primary)),
|
|
182
|
-
secondary && (React__default.createElement(Button, Object.assign({
|
|
182
|
+
secondary && (React__default.createElement(Button, Object.assign({ type: "primary", variation: "subtle" }, secondary)))),
|
|
183
183
|
tertiary && (React__default.createElement("div", { className: leftAction },
|
|
184
|
-
React__default.createElement(Button, Object.assign({
|
|
184
|
+
React__default.createElement(Button, Object.assign({ type: "secondary", variation: "destructive" }, tertiary))))))));
|
|
185
185
|
}
|
|
186
186
|
function ModalActivator({ children }) {
|
|
187
187
|
const { activatorRef } = useModalContext();
|
package/dist/styles.css
CHANGED
|
@@ -3214,6 +3214,7 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
3214
3214
|
--checkbox--size: 20px;
|
|
3215
3215
|
--checkbox--border--checked: var(--color-interactive);
|
|
3216
3216
|
--checkbox--border--unchecked: var(--color-border--interactive);
|
|
3217
|
+
--checkbox--border--invalid: var(--color-critical);
|
|
3217
3218
|
--checkbox--border--hover: var(--color-interactive);
|
|
3218
3219
|
display: inline-block;
|
|
3219
3220
|
}
|
|
@@ -3308,6 +3309,26 @@ a._7BLGtYNuJOU-.zgRx3ehZ2z8-:hover {
|
|
|
3308
3309
|
opacity: 1;
|
|
3309
3310
|
}
|
|
3310
3311
|
|
|
3312
|
+
/* Invalid states set border and fill color when field not disabled
|
|
3313
|
+
- note, some rules are duplicated to ensure selectors follow
|
|
3314
|
+
descending cascade linting rules
|
|
3315
|
+
*/
|
|
3316
|
+
|
|
3317
|
+
.Gqnclw4WaeQ-:not(.TKr3J-6ARFo-) .XnCmS-EzK2M- + ._-8JCQE6SA9s- {
|
|
3318
|
+
border-color: var(--checkbox--border--invalid);
|
|
3319
|
+
}
|
|
3320
|
+
|
|
3321
|
+
.Gqnclw4WaeQ-:not(.TKr3J-6ARFo-) .XnCmS-EzK2M-:checked + ._-8JCQE6SA9s-,
|
|
3322
|
+
.Gqnclw4WaeQ-:not(.TKr3J-6ARFo-) .XnCmS-EzK2M-.rqHq3ff9In0- + ._-8JCQE6SA9s- {
|
|
3323
|
+
background-color: hsl(6, 64%, 51%);
|
|
3324
|
+
background-color: var(--color-critical);
|
|
3325
|
+
}
|
|
3326
|
+
|
|
3327
|
+
.Gqnclw4WaeQ-:not(.TKr3J-6ARFo-):focus-within .XnCmS-EzK2M- + ._-8JCQE6SA9s-,
|
|
3328
|
+
.Gqnclw4WaeQ-:not(.TKr3J-6ARFo-) .XnCmS-EzK2M-.rqHq3ff9In0-:focus-within + ._-8JCQE6SA9s- {
|
|
3329
|
+
border-color: var(--checkbox--border--invalid);
|
|
3330
|
+
}
|
|
3331
|
+
|
|
3311
3332
|
.l8z5TxzVvqA- {
|
|
3312
3333
|
margin: 0 8px;
|
|
3313
3334
|
margin: 0 var(--space-small);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jobber/components",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.61.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -542,5 +542,5 @@
|
|
|
542
542
|
"> 1%",
|
|
543
543
|
"IE 10"
|
|
544
544
|
],
|
|
545
|
-
"gitHead": "
|
|
545
|
+
"gitHead": "1ccb1b893cc5ebfe13df5e850c2b51f9265ffdde"
|
|
546
546
|
}
|