@skyscanner/backpack-web 42.17.0 → 42.18.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/bpk-component-checkbox/index.d.ts +1 -0
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.d.ts +2 -2
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.module.css +1 -1
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.d.ts +6 -1
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.js +13 -3
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.d.ts +2 -1
- package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.js +2 -0
- package/bpk-component-fieldset/src/BpkFieldset.js +0 -1
- package/bpk-component-form-validation/index.d.ts +5 -0
- package/bpk-component-form-validation/src/BpkFormValidation.d.ts +12 -0
- package/bpk-component-form-validation/src/BpkFormValidation.js +0 -9
- package/bpk-component-form-validation/src/themeAttributes.d.ts +2 -0
- package/bpk-component-radio/index.d.ts +5 -0
- package/bpk-component-radio/index.js +3 -1
- package/bpk-component-radio/src/BpkRadio.d.ts +13 -0
- package/bpk-component-radio/src/BpkRadio.js +3 -11
- package/bpk-component-radio/src/themeAttributes.d.ts +2 -0
- package/bpk-component-radio/src/themeAttributes.js +3 -1
- package/package.json +1 -1
|
@@ -9,3 +9,4 @@ export type { BpkCheckboxV2RootProps, BpkCheckboxV2CheckedState } from './src/Bp
|
|
|
9
9
|
export type { BpkCheckboxV2ControlProps } from './src/BpkCheckboxV2/BpkCheckboxV2Control';
|
|
10
10
|
export type { BpkCheckboxV2LabelProps } from './src/BpkCheckboxV2/BpkCheckboxV2Label';
|
|
11
11
|
export type { BpkCheckboxV2DescriptionProps } from './src/BpkCheckboxV2/BpkCheckboxV2Description';
|
|
12
|
+
export type { BpkCheckboxV2HiddenInputProps } from './src/BpkCheckboxV2/BpkCheckboxV2HiddenInput';
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
declare const BpkCheckboxV2: {
|
|
2
|
-
Root: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: import("./BpkCheckboxV2Root").BpkCheckboxV2RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
|
+
Root: ({ checked, children, "data-testid": dataTestId, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: import("./BpkCheckboxV2Root").BpkCheckboxV2RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
Control: ({ children }: import("./BpkCheckboxV2Control").BpkCheckboxV2ControlProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
4
|
Indicator: () => null;
|
|
5
5
|
Label: ({ children }: import("./BpkCheckboxV2Label").BpkCheckboxV2LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
6
|
Description: ({ children }: import("./BpkCheckboxV2Description").BpkCheckboxV2DescriptionProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
|
-
HiddenInput: () => import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
HiddenInput: ({ "aria-describedby": ariaDescribedby, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }?: import("./BpkCheckboxV2HiddenInput").BpkCheckboxV2HiddenInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
8
|
};
|
|
9
9
|
export default BpkCheckboxV2;
|
|
@@ -15,4 +15,4 @@
|
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
|
-
.bpk-checkbox-v2{display:inline-flex;align-items:flex-start;cursor:pointer;gap:.5rem}.bpk-checkbox-v2[data-disabled]{cursor:not-allowed}.bpk-checkbox-v2__control{position:relative;display:flex;width:1.25rem;height:1.25rem;margin-top:.125rem;justify-content:center;align-items:center;flex-shrink:0;border:.1875rem solid #626971;background-color:#fff;border-radius:.25rem;border-radius:var(--bpk-checkbox-border-radius, 0.25rem)}.bpk-checkbox-v2__control[data-focus-visible]{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-checkbox-v2__control[data-state=checked]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");background-repeat:no-repeat;background-position:.0625rem center;background-size:calc(100% - .15625rem) auto}.bpk-checkbox-v2__control[data-state=checked]:disabled{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__control[data-state=indeterminate]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227))}.bpk-checkbox-v2__control[data-state=indeterminate]::before{content:"";width:.625rem;height:.1875rem;border-radius:2px;background-color:#fff}.bpk-checkbox-v2__control[data-invalid]{border-color:#e70866}.bpk-checkbox-v2__control[data-disabled]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked],.bpk-checkbox-v2__control[data-disabled][data-state=indeterminate]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked]{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__label{color:#161616;user-select:none;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-checkbox-v2__label a{color:inherit}[data-disabled] .bpk-checkbox-v2__label{color:rgba(0,0,0,.2)}.bpk-checkbox-v2__description{display:block;margin-top:.25rem;color:#626971;font-size:.875rem;line-height:1.25rem;font-weight:400}[data-disabled] .bpk-checkbox-v2__description{color:rgba(0,0,0,.2)}
|
|
18
|
+
.bpk-checkbox-v2{position:relative;display:inline-flex;align-items:flex-start;cursor:pointer;gap:.5rem}.bpk-checkbox-v2[data-disabled]{cursor:not-allowed}.bpk-checkbox-v2__control{position:relative;display:flex;width:1.25rem;height:1.25rem;margin-top:.125rem;justify-content:center;align-items:center;flex-shrink:0;border:.1875rem solid #626971;background-color:#fff;border-radius:.25rem;border-radius:var(--bpk-checkbox-border-radius, 0.25rem)}.bpk-checkbox-v2__control[data-focus-visible]{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-checkbox-v2__control[data-state=checked]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22white%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E");background-repeat:no-repeat;background-position:.0625rem center;background-size:calc(100% - .15625rem) auto}.bpk-checkbox-v2__control[data-state=checked]:disabled{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__control[data-state=indeterminate]{border-width:.1875rem;border-color:#0062e3;border-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227));background-color:#0062e3;background-color:var(--bpk-checkbox-selected-color, rgb(0, 98, 227))}.bpk-checkbox-v2__control[data-state=indeterminate]::before{content:"";width:.625rem;height:.1875rem;border-radius:2px;background-color:#fff}.bpk-checkbox-v2__control[data-invalid]{border-color:#e70866}.bpk-checkbox-v2__control[data-disabled]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked],.bpk-checkbox-v2__control[data-disabled][data-state=indeterminate]{border-color:rgba(0,0,0,.2);background-color:#fff}.bpk-checkbox-v2__control[data-disabled][data-state=checked]{background-image:url("data:image/svg+xml,%3Csvg%20width%3D%2213%22%20height%3D%229%22%20viewBox%3D%220%200%2013%209%22%20fill%3D%22none%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20d%3D%22M2.35352%203.64648L5.5%207.5L11.5%201.5%22%20stroke%3D%22lightgrey%22%20stroke-width%3D%223%22%20stroke-linecap%3D%22round%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E")}.bpk-checkbox-v2__label{color:#161616;user-select:none;font-size:1rem;line-height:1.5rem;font-weight:400}.bpk-checkbox-v2__label a{color:inherit}[data-disabled] .bpk-checkbox-v2__label{color:rgba(0,0,0,.2)}.bpk-checkbox-v2__description{display:block;margin-top:.25rem;color:#626971;font-size:.875rem;line-height:1.25rem;font-weight:400}[data-disabled] .bpk-checkbox-v2__description{color:rgba(0,0,0,.2)}
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
export type BpkCheckboxV2HiddenInputProps = {
|
|
2
|
+
'aria-label'?: string;
|
|
3
|
+
'aria-labelledby'?: string;
|
|
4
|
+
'aria-describedby'?: string;
|
|
5
|
+
};
|
|
6
|
+
declare const BpkCheckboxV2HiddenInput: ({ "aria-describedby": ariaDescribedby, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledby, }?: BpkCheckboxV2HiddenInputProps) => import("react/jsx-runtime").JSX.Element;
|
|
2
7
|
export default BpkCheckboxV2HiddenInput;
|
|
@@ -17,9 +17,19 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { Checkbox } from '@ark-ui/react';
|
|
20
|
-
|
|
20
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
21
|
// Renders Ark's visually hidden native <input type="checkbox">.
|
|
22
22
|
// Include when the checkbox is inside a <form> for native form submission.
|
|
23
|
-
|
|
24
|
-
|
|
23
|
+
// Accepts aria-* attributes so consumers can override the screen-reader
|
|
24
|
+
// announcement when the visible <BpkCheckboxV2.Label> is missing or differs
|
|
25
|
+
// from the desired accessible name.
|
|
26
|
+
const BpkCheckboxV2HiddenInput = ({
|
|
27
|
+
'aria-describedby': ariaDescribedby,
|
|
28
|
+
'aria-label': ariaLabel,
|
|
29
|
+
'aria-labelledby': ariaLabelledby
|
|
30
|
+
} = {}) => /*#__PURE__*/_jsx(Checkbox.HiddenInput, {
|
|
31
|
+
"aria-describedby": ariaDescribedby,
|
|
32
|
+
"aria-label": ariaLabel,
|
|
33
|
+
"aria-labelledby": ariaLabelledby
|
|
34
|
+
});
|
|
25
35
|
export default BpkCheckboxV2HiddenInput;
|
|
@@ -3,6 +3,7 @@ export type BpkCheckboxV2CheckedState = boolean | 'indeterminate';
|
|
|
3
3
|
export type BpkCheckboxV2RootProps = {
|
|
4
4
|
children: ReactNode;
|
|
5
5
|
checked?: BpkCheckboxV2CheckedState;
|
|
6
|
+
'data-testid'?: string;
|
|
6
7
|
defaultChecked?: BpkCheckboxV2CheckedState;
|
|
7
8
|
disabled?: boolean;
|
|
8
9
|
id?: string;
|
|
@@ -12,5 +13,5 @@ export type BpkCheckboxV2RootProps = {
|
|
|
12
13
|
required?: boolean;
|
|
13
14
|
value?: string;
|
|
14
15
|
};
|
|
15
|
-
declare const BpkCheckboxV2Root: ({ checked, children, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: BpkCheckboxV2RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
declare const BpkCheckboxV2Root: ({ checked, children, "data-testid": dataTestId, defaultChecked, disabled, id, invalid, name, onCheckedChange, required, value, }: BpkCheckboxV2RootProps) => import("react/jsx-runtime").JSX.Element;
|
|
16
17
|
export default BpkCheckboxV2Root;
|
|
@@ -24,6 +24,7 @@ const getClassName = cssModules(STYLES);
|
|
|
24
24
|
const BpkCheckboxV2Root = ({
|
|
25
25
|
checked,
|
|
26
26
|
children,
|
|
27
|
+
'data-testid': dataTestId,
|
|
27
28
|
defaultChecked,
|
|
28
29
|
disabled = false,
|
|
29
30
|
id,
|
|
@@ -35,6 +36,7 @@ const BpkCheckboxV2Root = ({
|
|
|
35
36
|
}) => /*#__PURE__*/_jsx(Checkbox.Root, {
|
|
36
37
|
className: getClassName('bpk-checkbox-v2'),
|
|
37
38
|
checked: checked,
|
|
39
|
+
"data-testid": dataTestId,
|
|
38
40
|
defaultChecked: defaultChecked,
|
|
39
41
|
disabled: disabled,
|
|
40
42
|
id: id,
|
|
@@ -17,7 +17,6 @@
|
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
19
|
import { cloneElement } from 'react';
|
|
20
|
-
// @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
|
|
21
20
|
import BpkFormValidation from "../../bpk-component-form-validation";
|
|
22
21
|
import BpkLabel from "../../bpk-component-label";
|
|
23
22
|
import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { type Props as AnimateHeightProps } from '../../bpk-animate-height';
|
|
3
|
+
export type Props = Omit<HTMLAttributes<HTMLDivElement>, 'className'> & {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
id: string;
|
|
6
|
+
expanded: boolean;
|
|
7
|
+
isCheckbox?: boolean;
|
|
8
|
+
className?: string | null;
|
|
9
|
+
containerProps?: Partial<AnimateHeightProps>;
|
|
10
|
+
};
|
|
11
|
+
declare const BpkFormValidation: ({ children, className, containerProps, expanded, isCheckbox, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export default BpkFormValidation;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
* limitations under the License.
|
|
17
17
|
*/
|
|
18
18
|
|
|
19
|
-
import PropTypes from 'prop-types';
|
|
20
19
|
import { lineHeightSm, iconSizeSm } from '@skyscanner/bpk-foundations-web/tokens/base.es6';
|
|
21
20
|
import AnimateHeight from "../../bpk-animate-height";
|
|
22
21
|
import { withAlignment } from "../../bpk-component-icon";
|
|
@@ -53,12 +52,4 @@ const BpkFormValidation = ({
|
|
|
53
52
|
})
|
|
54
53
|
});
|
|
55
54
|
};
|
|
56
|
-
BpkFormValidation.propTypes = {
|
|
57
|
-
children: PropTypes.node.isRequired,
|
|
58
|
-
id: PropTypes.string.isRequired,
|
|
59
|
-
expanded: PropTypes.bool.isRequired,
|
|
60
|
-
isCheckbox: PropTypes.bool,
|
|
61
|
-
className: PropTypes.string,
|
|
62
|
-
containerProps: PropTypes.object // eslint-disable-line react/forbid-prop-types
|
|
63
|
-
};
|
|
64
55
|
export default BpkFormValidation;
|
|
@@ -14,7 +14,9 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import BpkRadio from "./src/BpkRadio";
|
|
18
20
|
import themeAttributes from "./src/themeAttributes";
|
|
19
21
|
export default BpkRadio;
|
|
20
22
|
export { themeAttributes };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { InputHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
type NativeInputProps = InputHTMLAttributes<HTMLInputElement>;
|
|
3
|
+
export type Props = Omit<NativeInputProps, 'type' | 'className'> & {
|
|
4
|
+
name: string;
|
|
5
|
+
label: ReactNode;
|
|
6
|
+
ariaLabel?: string | null;
|
|
7
|
+
className?: string | null;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
white?: boolean;
|
|
10
|
+
valid?: boolean | null;
|
|
11
|
+
};
|
|
12
|
+
declare const BpkRadio: ({ ariaLabel, className, disabled, label, name, valid, white, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default BpkRadio;
|
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
18
19
|
import { cssModules } from "../../bpk-react-utils";
|
|
19
20
|
import STYLES from "./BpkRadio.module.css";
|
|
20
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -40,7 +41,7 @@ const BpkRadio = ({
|
|
|
40
41
|
className: getClassName('bpk-radio__input'),
|
|
41
42
|
name: name,
|
|
42
43
|
disabled: disabled,
|
|
43
|
-
"aria-label": ariaLabel || label,
|
|
44
|
+
"aria-label": ariaLabel || (typeof label === 'string' ? label : undefined),
|
|
44
45
|
"aria-invalid": isInvalid,
|
|
45
46
|
...rest
|
|
46
47
|
}), /*#__PURE__*/_jsx("div", {
|
|
@@ -51,13 +52,4 @@ const BpkRadio = ({
|
|
|
51
52
|
})]
|
|
52
53
|
});
|
|
53
54
|
};
|
|
54
|
-
BpkRadio.propTypes = {
|
|
55
|
-
name: PropTypes.string.isRequired,
|
|
56
|
-
label: PropTypes.node.isRequired,
|
|
57
|
-
ariaLabel: PropTypes.string,
|
|
58
|
-
disabled: PropTypes.bool,
|
|
59
|
-
white: PropTypes.bool,
|
|
60
|
-
className: PropTypes.string,
|
|
61
|
-
valid: PropTypes.bool
|
|
62
|
-
};
|
|
63
55
|
export default BpkRadio;
|
|
@@ -14,4 +14,6 @@
|
|
|
14
14
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
15
15
|
* See the License for the specific language governing permissions and
|
|
16
16
|
* limitations under the License.
|
|
17
|
-
*/
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
export default ['radioCheckedColor'];
|