@skyscanner/backpack-web 42.16.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.
Files changed (55) hide show
  1. package/bpk-component-autosuggest/index.d.ts +6 -0
  2. package/bpk-component-autosuggest/index.js +3 -1
  3. package/bpk-component-autosuggest/src/BpkAutosuggest.d.ts +2 -0
  4. package/bpk-component-autosuggest/src/BpkAutosuggest.js +14 -15
  5. package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.d.ts +11 -0
  6. package/bpk-component-autosuggest/src/BpkAutosuggestSuggestion.js +35 -55
  7. package/bpk-component-checkbox/index.d.ts +1 -0
  8. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.d.ts +2 -2
  9. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2.module.css +1 -1
  10. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.d.ts +6 -1
  11. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2HiddenInput.js +13 -3
  12. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.d.ts +2 -1
  13. package/bpk-component-checkbox/src/BpkCheckboxV2/BpkCheckboxV2Root.js +2 -0
  14. package/bpk-component-collapsible/index.d.ts +11 -0
  15. package/bpk-component-collapsible/index.js +22 -0
  16. package/bpk-component-collapsible/src/BpkCollapsible.d.ts +8 -0
  17. package/bpk-component-collapsible/src/BpkCollapsible.js +31 -0
  18. package/bpk-component-collapsible/src/BpkCollapsible.module.css +18 -0
  19. package/bpk-component-collapsible/src/BpkCollapsibleContent.d.ts +6 -0
  20. package/bpk-component-collapsible/src/BpkCollapsibleContent.js +36 -0
  21. package/bpk-component-collapsible/src/BpkCollapsibleIndicator.d.ts +6 -0
  22. package/bpk-component-collapsible/src/BpkCollapsibleIndicator.js +34 -0
  23. package/bpk-component-collapsible/src/BpkCollapsibleRoot.d.ts +22 -0
  24. package/bpk-component-collapsible/src/BpkCollapsibleRoot.js +49 -0
  25. package/bpk-component-collapsible/src/BpkCollapsibleRootProvider.d.ts +10 -0
  26. package/bpk-component-collapsible/src/BpkCollapsibleRootProvider.js +33 -0
  27. package/bpk-component-collapsible/src/BpkCollapsibleTrigger.d.ts +6 -0
  28. package/bpk-component-collapsible/src/BpkCollapsibleTrigger.js +43 -0
  29. package/bpk-component-collapsible/src/common-types.d.ts +9 -0
  30. package/bpk-component-collapsible/src/common-types.js +29 -0
  31. package/bpk-component-collapsible/src/useBpkCollapsible.d.ts +5 -0
  32. package/bpk-component-collapsible/src/useBpkCollapsible.js +21 -0
  33. package/bpk-component-fieldset/src/BpkFieldset.js +0 -1
  34. package/bpk-component-form-validation/index.d.ts +5 -0
  35. package/bpk-component-form-validation/src/BpkFormValidation.d.ts +12 -0
  36. package/bpk-component-form-validation/src/BpkFormValidation.js +0 -9
  37. package/bpk-component-form-validation/src/themeAttributes.d.ts +2 -0
  38. package/bpk-component-horizontal-nav/index.d.ts +6 -0
  39. package/bpk-component-horizontal-nav/index.js +3 -1
  40. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.d.ts +27 -0
  41. package/bpk-component-horizontal-nav/src/BpkHorizontalNav.js +79 -114
  42. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.d.ts +25 -0
  43. package/bpk-component-horizontal-nav/src/BpkHorizontalNavItem.js +38 -73
  44. package/bpk-component-radio/index.d.ts +5 -0
  45. package/bpk-component-radio/index.js +3 -1
  46. package/bpk-component-radio/src/BpkRadio.d.ts +13 -0
  47. package/bpk-component-radio/src/BpkRadio.js +3 -11
  48. package/bpk-component-radio/src/themeAttributes.d.ts +2 -0
  49. package/bpk-component-radio/src/themeAttributes.js +3 -1
  50. package/bpk-component-switch/index.d.ts +3 -3
  51. package/bpk-component-switch/index.js +2 -2
  52. package/bpk-component-switch/src/BpkSwitch.d.ts +7 -1
  53. package/bpk-component-switch/src/BpkSwitch.js +10 -1
  54. package/bpk-component-switch/src/BpkSwitch.module.css +1 -1
  55. package/package.json +2 -2
@@ -0,0 +1,6 @@
1
+ import BpkAutosuggestLegacy from './src/BpkAutosuggest';
2
+ import BpkAutosuggestSuggestion from './src/BpkAutosuggestSuggestion';
3
+ import { defaultTheme } from './src/BpkAutosuggestV2/BpkAutosuggest';
4
+ declare const BpkAutosuggest: import("react").ForwardRefExoticComponent<import("./src/BpkAutosuggestV2/BpkAutosuggest").BpkAutoSuggestProps<any> & import("react").RefAttributes<HTMLInputElement>>;
5
+ export default BpkAutosuggest;
6
+ export { BpkAutosuggestLegacy, BpkAutosuggestSuggestion, defaultTheme };
@@ -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
- */import BpkAutosuggestLegacy from "./src/BpkAutosuggest";
17
+ */
18
+
19
+ import BpkAutosuggestLegacy from "./src/BpkAutosuggest";
18
20
  import BpkAutosuggestSuggestion from "./src/BpkAutosuggestSuggestion";
19
21
  import BpkAutosuggestV2, { defaultTheme } from "./src/BpkAutosuggestV2/BpkAutosuggest";
20
22
  const BpkAutosuggest = BpkAutosuggestV2;
@@ -0,0 +1,2 @@
1
+ import Autosuggest from 'react-autosuggest';
2
+ export default Autosuggest;
@@ -14,7 +14,10 @@
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
- */import Autosuggest from 'react-autosuggest';
17
+ */
18
+
19
+ // @ts-expect-error Untyped import. See `decisions/imports-ts-suppressions.md`.
20
+ import Autosuggest from 'react-autosuggest';
18
21
  import BpkInput from "../../bpk-component-input";
19
22
  import { cssModules } from "../../bpk-react-utils";
20
23
  import STYLES from "./BpkAutosuggest.module.css";
@@ -47,19 +50,15 @@ Autosuggest.defaultProps.renderInputComponent = inputProps => {
47
50
  ref,
48
51
  ...rest
49
52
  } = inputProps;
50
- return (
51
- /*#__PURE__*/
52
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
53
- _jsx(BpkInput, {
54
- inputRef: element => {
55
- ref(element);
56
- if (typeof inputRef === 'function') {
57
- inputRef(element);
58
- }
59
- },
60
- autoComplete: autoComplete,
61
- ...rest
62
- })
63
- );
53
+ return /*#__PURE__*/_jsx(BpkInput, {
54
+ inputRef: element => {
55
+ ref(element);
56
+ if (typeof inputRef === 'function') {
57
+ inputRef(element);
58
+ }
59
+ },
60
+ autoComplete: autoComplete,
61
+ ...rest
62
+ });
64
63
  };
65
64
  export default Autosuggest;
@@ -0,0 +1,11 @@
1
+ import type { ComponentType, HTMLAttributes, ReactNode } from 'react';
2
+ type Props = Omit<HTMLAttributes<HTMLElement>, 'className'> & {
3
+ value: ReactNode;
4
+ subHeading?: ReactNode | null;
5
+ tertiaryLabel?: string | null;
6
+ icon?: ComponentType | null;
7
+ indent?: boolean;
8
+ className?: string | null;
9
+ };
10
+ declare const BpkAutosuggestSuggestion: ({ className, icon: Icon, indent, subHeading, tertiaryLabel, value, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
11
+ export default BpkAutosuggestSuggestion;
@@ -14,72 +14,52 @@
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
- */import PropTypes from 'prop-types';
17
+ */
18
+
18
19
  import { cssModules } from "../../bpk-react-utils";
19
20
  import STYLES from "./BpkAutosuggest.module.css";
20
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
21
22
  const getClassName = cssModules(STYLES);
22
- const BpkAutosuggestSuggestion = props => {
23
+ const BpkAutosuggestSuggestion = ({
24
+ className,
25
+ icon: Icon,
26
+ indent = false,
27
+ subHeading,
28
+ tertiaryLabel,
29
+ value,
30
+ ...rest
31
+ }) => {
23
32
  const classNames = [getClassName('bpk-autosuggest__suggestion')];
24
- const {
25
- className,
26
- icon,
27
- indent,
28
- subHeading,
29
- tertiaryLabel,
30
- value,
31
- ...rest
32
- } = props;
33
- const Icon = icon;
34
33
  if (indent) {
35
34
  classNames.push(getClassName('bpk-autosuggest__suggestion--indent'));
36
35
  }
37
36
  if (className) {
38
37
  classNames.push(className);
39
38
  }
40
- return (
41
- /*#__PURE__*/
42
- // $FlowFixMe[cannot-spread-inexact] - inexact rest. See 'decisions/flowfixme.md'.
43
- _jsxs("section", {
44
- className: classNames.join(' '),
45
- ...rest,
46
- children: [icon ? /*#__PURE__*/_jsx("div", {
47
- className: getClassName('bpk-autosuggest__suggestion-icon'),
48
- children: /*#__PURE__*/_jsx(Icon, {})
49
- }) : null, /*#__PURE__*/_jsx("div", {
50
- className: getClassName('bpk-autosuggest__suggestion-content'),
51
- children: /*#__PURE__*/_jsxs("div", {
52
- className: getClassName('bpk-autosuggest__suggestion-inner'),
53
- children: [/*#__PURE__*/_jsxs("div", {
54
- children: [/*#__PURE__*/_jsx("span", {
55
- className: getClassName('bpk-autosuggest__suggestion-value'),
56
- children: value
57
- }), subHeading || tertiaryLabel ? /*#__PURE__*/_jsx("small", {
58
- className: getClassName('bpk-autosuggest__suggestion-sub-heading'),
59
- children: subHeading
60
- }) : null]
61
- }), tertiaryLabel ? /*#__PURE__*/_jsx("aside", {
62
- className: getClassName('bpk-autosuggest__suggestion-tertiary-label'),
63
- children: tertiaryLabel
39
+ return /*#__PURE__*/_jsxs("section", {
40
+ className: classNames.join(' '),
41
+ ...rest,
42
+ children: [Icon ? /*#__PURE__*/_jsx("div", {
43
+ className: getClassName('bpk-autosuggest__suggestion-icon'),
44
+ children: /*#__PURE__*/_jsx(Icon, {})
45
+ }) : null, /*#__PURE__*/_jsx("div", {
46
+ className: getClassName('bpk-autosuggest__suggestion-content'),
47
+ children: /*#__PURE__*/_jsxs("div", {
48
+ className: getClassName('bpk-autosuggest__suggestion-inner'),
49
+ children: [/*#__PURE__*/_jsxs("div", {
50
+ children: [/*#__PURE__*/_jsx("span", {
51
+ className: getClassName('bpk-autosuggest__suggestion-value'),
52
+ children: value
53
+ }), subHeading || tertiaryLabel ? /*#__PURE__*/_jsx("small", {
54
+ className: getClassName('bpk-autosuggest__suggestion-sub-heading'),
55
+ children: subHeading
64
56
  }) : null]
65
- })
66
- })]
67
- })
68
- );
69
- };
70
- BpkAutosuggestSuggestion.propTypes = {
71
- value: PropTypes.node.isRequired,
72
- subHeading: PropTypes.node,
73
- tertiaryLabel: PropTypes.string,
74
- icon: PropTypes.func,
75
- indent: PropTypes.bool,
76
- className: PropTypes.string
77
- };
78
- BpkAutosuggestSuggestion.defaultProps = {
79
- subHeading: null,
80
- tertiaryLabel: null,
81
- icon: null,
82
- indent: false,
83
- className: null
57
+ }), tertiaryLabel ? /*#__PURE__*/_jsx("aside", {
58
+ className: getClassName('bpk-autosuggest__suggestion-tertiary-label'),
59
+ children: tertiaryLabel
60
+ }) : null]
61
+ })
62
+ })]
63
+ });
84
64
  };
85
65
  export default BpkAutosuggestSuggestion;
@@ -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
- declare const BpkCheckboxV2HiddenInput: () => import("react/jsx-runtime").JSX.Element;
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
- import { jsx as _jsx } from "react/jsx-runtime";
24
- const BpkCheckboxV2HiddenInput = () => /*#__PURE__*/_jsx(Checkbox.HiddenInput, {});
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,
@@ -0,0 +1,11 @@
1
+ import BpkCollapsible from './src/BpkCollapsible';
2
+ export { default as useBpkCollapsible } from './src/useBpkCollapsible';
3
+ export { COLLAPSIBLE_VARIANTS } from './src/common-types';
4
+ export default BpkCollapsible;
5
+ export type { BpkCollapsibleOpenChangeDetails, BpkCollapsibleVariant, } from './src/common-types';
6
+ export type { BpkCollapsibleRootProps } from './src/BpkCollapsibleRoot';
7
+ export type { BpkCollapsibleRootProviderProps } from './src/BpkCollapsibleRootProvider';
8
+ export type { BpkCollapsibleTriggerProps } from './src/BpkCollapsibleTrigger';
9
+ export type { BpkCollapsibleIndicatorProps } from './src/BpkCollapsibleIndicator';
10
+ export type { BpkCollapsibleContentProps } from './src/BpkCollapsibleContent';
11
+ export type { BpkUseCollapsibleProps, BpkUseCollapsibleReturn, } from './src/useBpkCollapsible';
@@ -0,0 +1,22 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import BpkCollapsible from "./src/BpkCollapsible";
20
+ export { default as useBpkCollapsible } from "./src/useBpkCollapsible";
21
+ export { COLLAPSIBLE_VARIANTS } from "./src/common-types";
22
+ export default BpkCollapsible;
@@ -0,0 +1,8 @@
1
+ declare const BpkCollapsible: {
2
+ Root: ({ children, collapsedHeight, defaultOpen, disabled, ids, lazyMount, onExitComplete, onOpenChange, open, unmountOnExit, variant, }: import("./BpkCollapsibleRoot").BpkCollapsibleRootProps) => import("react/jsx-runtime").JSX.Element;
3
+ RootProvider: ({ children, value, variant, }: import("./BpkCollapsibleRootProvider").BpkCollapsibleRootProviderProps) => import("react/jsx-runtime").JSX.Element;
4
+ Trigger: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleTrigger").BpkCollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
5
+ Indicator: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleIndicator").BpkCollapsibleIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ Content: import("react").ForwardRefExoticComponent<import("./BpkCollapsibleContent").BpkCollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
7
+ };
8
+ export default BpkCollapsible;
@@ -0,0 +1,31 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import BpkCollapsibleContent from "./BpkCollapsibleContent";
20
+ import BpkCollapsibleIndicator from "./BpkCollapsibleIndicator";
21
+ import BpkCollapsibleRoot from "./BpkCollapsibleRoot";
22
+ import BpkCollapsibleRootProvider from "./BpkCollapsibleRootProvider";
23
+ import BpkCollapsibleTrigger from "./BpkCollapsibleTrigger";
24
+ const BpkCollapsible = {
25
+ Root: BpkCollapsibleRoot,
26
+ RootProvider: BpkCollapsibleRootProvider,
27
+ Trigger: BpkCollapsibleTrigger,
28
+ Indicator: BpkCollapsibleIndicator,
29
+ Content: BpkCollapsibleContent
30
+ };
31
+ export default BpkCollapsible;
@@ -0,0 +1,18 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+ .bpk-collapsible{display:block;inline-size:100%;min-inline-size:0}.bpk-collapsible--default{color:#161616}.bpk-collapsible--on-contrast{color:#fff}.bpk-collapsible--on-contrast .bpk-collapsible__trigger:disabled,.bpk-collapsible--on-contrast .bpk-collapsible__content[data-disabled]{color:hsla(0,0%,100%,.5)}.bpk-collapsible__trigger{display:flex;padding:0;align-items:center;border:0;background:rgba(0,0,0,0);color:inherit;text-align:start;cursor:pointer;appearance:none;gap:.25rem;inline-size:100%}.bpk-collapsible__trigger:disabled,.bpk-collapsible__trigger[data-disabled]{cursor:not-allowed}.bpk-collapsible__trigger:disabled{color:rgba(0,0,0,.2)}.bpk-collapsible__trigger:focus-visible{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-collapsible__indicator{display:inline-flex;justify-content:center;align-items:center;transition:transform 200ms ease;color:inherit;margin-inline-start:auto}@media(prefers-reduced-motion: reduce){.bpk-collapsible__indicator{transition:none}}.bpk-collapsible__indicator svg{fill:currentcolor}.bpk-collapsible__indicator[data-state=open]{transform:rotate(180deg)}.bpk-collapsible__content{overflow:hidden}@media(prefers-reduced-motion: reduce){.bpk-collapsible__content[data-state=open],.bpk-collapsible__content[data-state=closing],.bpk-collapsible__content[data-state=closed]{animation:none}}.bpk-collapsible__content[data-disabled]{color:rgba(0,0,0,.2)}.bpk-collapsible__content[data-state=open]{animation:bpk-collapsible-expand 200ms ease}.bpk-collapsible__content[data-state=closing],.bpk-collapsible__content[data-state=closed]{animation:bpk-collapsible-collapse 200ms ease}.bpk-collapsible__content-inner{display:block}@keyframes bpk-collapsible-expand{from{block-size:var(--collapsed-height, 0)}to{block-size:var(--height)}}@keyframes bpk-collapsible-collapse{from{block-size:var(--height)}to{block-size:var(--collapsed-height, 0)}}
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export type BpkCollapsibleContentProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkCollapsibleContent: import("react").ForwardRefExoticComponent<BpkCollapsibleContentProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export default BpkCollapsibleContent;
@@ -0,0 +1,36 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { forwardRef } from 'react';
20
+ import { Collapsible } from '@ark-ui/react';
21
+ import { cssModules } from "../../bpk-react-utils";
22
+ import STYLES from "./BpkCollapsible.module.css";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ const getClassName = cssModules(STYLES);
25
+ const BpkCollapsibleContent = /*#__PURE__*/forwardRef(({
26
+ children
27
+ }, ref) => /*#__PURE__*/_jsx(Collapsible.Content, {
28
+ ref: ref,
29
+ className: getClassName('bpk-collapsible__content'),
30
+ children: /*#__PURE__*/_jsx("div", {
31
+ className: getClassName('bpk-collapsible__content-inner'),
32
+ children: children
33
+ })
34
+ }));
35
+ BpkCollapsibleContent.displayName = 'BpkCollapsibleContent';
36
+ export default BpkCollapsibleContent;
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export type BpkCollapsibleIndicatorProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkCollapsibleIndicator: import("react").ForwardRefExoticComponent<BpkCollapsibleIndicatorProps & import("react").RefAttributes<HTMLDivElement>>;
6
+ export default BpkCollapsibleIndicator;
@@ -0,0 +1,34 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { forwardRef } from 'react';
20
+ import { Collapsible } from '@ark-ui/react';
21
+ import { cssModules } from "../../bpk-react-utils";
22
+ import STYLES from "./BpkCollapsible.module.css";
23
+ import { jsx as _jsx } from "react/jsx-runtime";
24
+ const getClassName = cssModules(STYLES);
25
+ const BpkCollapsibleIndicator = /*#__PURE__*/forwardRef(({
26
+ children
27
+ }, ref) => /*#__PURE__*/_jsx(Collapsible.Indicator, {
28
+ ref: ref,
29
+ className: getClassName('bpk-collapsible__indicator'),
30
+ "aria-hidden": true,
31
+ children: children
32
+ }));
33
+ BpkCollapsibleIndicator.displayName = 'BpkCollapsibleIndicator';
34
+ export default BpkCollapsibleIndicator;
@@ -0,0 +1,22 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BpkCollapsibleOpenChangeDetails, BpkCollapsibleVariant } from './common-types';
3
+ type ElementIds = Partial<{
4
+ root: string;
5
+ trigger: string;
6
+ content: string;
7
+ }>;
8
+ export type BpkCollapsibleRootProps = {
9
+ children: ReactNode;
10
+ collapsedHeight?: string | number;
11
+ defaultOpen?: boolean;
12
+ disabled?: boolean;
13
+ ids?: ElementIds;
14
+ lazyMount?: boolean;
15
+ onExitComplete?: () => void;
16
+ onOpenChange?: (details: BpkCollapsibleOpenChangeDetails) => void;
17
+ open?: boolean;
18
+ unmountOnExit?: boolean;
19
+ variant?: BpkCollapsibleVariant;
20
+ };
21
+ declare const BpkCollapsibleRoot: ({ children, collapsedHeight, defaultOpen, disabled, ids, lazyMount, onExitComplete, onOpenChange, open, unmountOnExit, variant, }: BpkCollapsibleRootProps) => import("react/jsx-runtime").JSX.Element;
22
+ export default BpkCollapsibleRoot;
@@ -0,0 +1,49 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { Collapsible } from '@ark-ui/react';
20
+ import { getDataComponentAttribute } from "../../bpk-react-utils";
21
+ import { COLLAPSIBLE_VARIANTS, getRootClassName } from "./common-types";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const BpkCollapsibleRoot = ({
24
+ children,
25
+ collapsedHeight,
26
+ defaultOpen,
27
+ disabled = false,
28
+ ids,
29
+ lazyMount,
30
+ onExitComplete,
31
+ onOpenChange,
32
+ open,
33
+ unmountOnExit,
34
+ variant = COLLAPSIBLE_VARIANTS.default
35
+ }) => /*#__PURE__*/_jsx(Collapsible.Root, {
36
+ className: getRootClassName(variant),
37
+ collapsedHeight: collapsedHeight,
38
+ defaultOpen: defaultOpen,
39
+ disabled: disabled,
40
+ ids: ids,
41
+ lazyMount: lazyMount,
42
+ onExitComplete: onExitComplete,
43
+ onOpenChange: onOpenChange,
44
+ open: open,
45
+ unmountOnExit: unmountOnExit,
46
+ ...getDataComponentAttribute('Collapsible'),
47
+ children: children
48
+ });
49
+ export default BpkCollapsibleRoot;
@@ -0,0 +1,10 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { BpkCollapsibleVariant } from './common-types';
3
+ import type { BpkUseCollapsibleReturn } from './useBpkCollapsible';
4
+ export type BpkCollapsibleRootProviderProps = {
5
+ children: ReactNode;
6
+ value: BpkUseCollapsibleReturn;
7
+ variant?: BpkCollapsibleVariant;
8
+ };
9
+ declare const BpkCollapsibleRootProvider: ({ children, value, variant, }: BpkCollapsibleRootProviderProps) => import("react/jsx-runtime").JSX.Element;
10
+ export default BpkCollapsibleRootProvider;
@@ -0,0 +1,33 @@
1
+ /*
2
+ * Backpack - Skyscanner's Design System
3
+ *
4
+ * Copyright 2016 Skyscanner Ltd
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ */
18
+
19
+ import { Collapsible } from '@ark-ui/react';
20
+ import { getDataComponentAttribute } from "../../bpk-react-utils";
21
+ import { COLLAPSIBLE_VARIANTS, getRootClassName } from "./common-types";
22
+ import { jsx as _jsx } from "react/jsx-runtime";
23
+ const BpkCollapsibleRootProvider = ({
24
+ children,
25
+ value,
26
+ variant = COLLAPSIBLE_VARIANTS.default
27
+ }) => /*#__PURE__*/_jsx(Collapsible.RootProvider, {
28
+ className: getRootClassName(variant),
29
+ value: value,
30
+ ...getDataComponentAttribute('Collapsible'),
31
+ children: children
32
+ });
33
+ export default BpkCollapsibleRootProvider;
@@ -0,0 +1,6 @@
1
+ import type { ReactNode } from 'react';
2
+ export type BpkCollapsibleTriggerProps = {
3
+ children: ReactNode;
4
+ };
5
+ declare const BpkCollapsibleTrigger: import("react").ForwardRefExoticComponent<BpkCollapsibleTriggerProps & import("react").RefAttributes<HTMLButtonElement>>;
6
+ export default BpkCollapsibleTrigger;