@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
@@ -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
- */import PropTypes from 'prop-types';
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;
@@ -0,0 +1,2 @@
1
+ declare const _default: string[];
2
+ export default _default;
@@ -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
- */export default ['radioCheckedColor'];
17
+ */
18
+
19
+ export default ['radioCheckedColor'];
@@ -1,5 +1,5 @@
1
- import BpkSwitch, { type Props as BpkSwitchProps } from './src/BpkSwitch';
1
+ import BpkSwitch, { SWITCH_VARIANTS, type Props as BpkSwitchProps, type SwitchVariant } from './src/BpkSwitch';
2
2
  import themeAttributes from './src/themeAttributes';
3
- export type { BpkSwitchProps };
4
- export { themeAttributes };
3
+ export type { BpkSwitchProps, SwitchVariant };
4
+ export { SWITCH_VARIANTS, themeAttributes };
5
5
  export default BpkSwitch;
@@ -14,7 +14,7 @@
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 BpkSwitch from "./src/BpkSwitch";
17
+ */import BpkSwitch, { SWITCH_VARIANTS } from "./src/BpkSwitch";
18
18
  import themeAttributes from "./src/themeAttributes";
19
- export { themeAttributes };
19
+ export { SWITCH_VARIANTS, themeAttributes };
20
20
  export default BpkSwitch;
@@ -1,8 +1,14 @@
1
+ export declare const SWITCH_VARIANTS: {
2
+ readonly default: "default";
3
+ readonly onContrast: "onContrast";
4
+ };
5
+ export type SwitchVariant = (typeof SWITCH_VARIANTS)[keyof typeof SWITCH_VARIANTS];
1
6
  export type Props = {
2
7
  ariaLabel: string;
3
8
  className?: string | null;
4
9
  small?: boolean;
10
+ variant?: SwitchVariant;
5
11
  [rest: string]: any;
6
12
  };
7
- declare const BpkSwitch: ({ ariaLabel, className, small, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
13
+ declare const BpkSwitch: ({ ariaLabel, className, small, variant, ...rest }: Props) => import("react/jsx-runtime").JSX.Element;
8
14
  export default BpkSwitch;
@@ -19,14 +19,23 @@
19
19
  import { cssModules, getDataComponentAttribute } from "../../bpk-react-utils";
20
20
  import STYLES from "./BpkSwitch.module.css";
21
21
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
22
+ export const SWITCH_VARIANTS = {
23
+ default: 'default',
24
+ onContrast: 'onContrast'
25
+ };
22
26
  const getClassName = cssModules(STYLES);
27
+ const switchVariantClassNames = {
28
+ [SWITCH_VARIANTS.default]: null,
29
+ [SWITCH_VARIANTS.onContrast]: getClassName('bpk-switch__switch--on-contrast')
30
+ };
23
31
  const BpkSwitch = ({
24
32
  ariaLabel,
25
33
  className = null,
26
34
  small = false,
35
+ variant = SWITCH_VARIANTS.default,
27
36
  ...rest
28
37
  }) => {
29
- const switchClassNames = getClassName('bpk-switch__switch', small && 'bpk-switch__switch--small');
38
+ const switchClassNames = getClassName('bpk-switch__switch', small && 'bpk-switch__switch--small', switchVariantClassNames[variant]);
30
39
  return /*#__PURE__*/_jsxs("label", {
31
40
  className: getClassName('bpk-switch', className),
32
41
  ...getDataComponentAttribute('Switch'),
@@ -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-switch{position:relative;display:flex;width:fit-content;align-items:center;border-radius:1rem}.bpk-switch__checkbox{position:absolute;opacity:0}.bpk-switch__checkbox:checked~.bpk-switch__switch{background:#0062e3;background:var(--bpk-switch-checked-color, rgb(0, 98, 227))}.bpk-switch__checkbox:checked~.bpk-switch__switch::before{left:1.375rem}.bpk-switch__checkbox:focus-visible~.bpk-switch__switch{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-switch__switch{position:relative;float:right;display:block;min-width:3.25rem;height:2rem;transition:background 200ms linear;border-radius:1rem;background:rgba(0,0,0,.2);cursor:pointer}.bpk-switch__switch::before{position:absolute;top:.125rem;left:.125rem;content:"";display:block;width:1.75rem;height:1.75rem;transition:left 200ms ease-out;border-radius:50%;background:#fff;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-switch__switch--small{min-width:2.5rem;height:1.25rem}.bpk-switch__switch--small::before{width:1rem;height:1rem}
18
+ .bpk-switch{position:relative;display:flex;width:fit-content;align-items:center;border-radius:1rem}.bpk-switch__checkbox{position:absolute;opacity:0}.bpk-switch__checkbox:checked~.bpk-switch__switch{background:#0062e3;background:var(--bpk-switch-checked-color, rgb(0, 98, 227))}.bpk-switch__checkbox:checked~.bpk-switch__switch::before{left:1.375rem}.bpk-switch__checkbox:focus-visible~.bpk-switch__switch{outline:.125rem solid #0062e3;outline-offset:.125rem}.bpk-switch__switch{position:relative;float:right;display:block;min-width:3.25rem;height:2rem;transition:background 200ms linear;border-radius:1rem;background:rgba(0,0,0,.2);cursor:pointer}.bpk-switch__switch::before{position:absolute;top:.125rem;left:.125rem;content:"";display:block;width:1.75rem;height:1.75rem;transition:left 200ms ease-out;border-radius:50%;background:#fff;box-shadow:0px 1px 3px 0px rgba(37,32,31,.3)}.bpk-switch__switch--small{min-width:2.5rem;height:1.25rem}.bpk-switch__switch--small::before{width:1rem;height:1rem}.bpk-switch__switch--on-contrast{background:hsla(0,0%,100%,.2)}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@skyscanner/backpack-web",
3
- "version": "42.16.0",
3
+ "version": "42.18.0",
4
4
  "description": "Backpack Design System web library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -28,7 +28,7 @@
28
28
  "@radix-ui/react-compose-refs": "^1.1.1",
29
29
  "@radix-ui/react-slider": "1.3.5",
30
30
  "@react-google-maps/api": "^2.19.3",
31
- "@skyscanner/bpk-foundations-web": "^24.5.0",
31
+ "@skyscanner/bpk-foundations-web": "^24.6.0",
32
32
  "@skyscanner/bpk-svgs": "^20.11.0",
33
33
  "tabbable": "^6.4.0",
34
34
  "d3-path": "^3.1.0",