@alto-avios/alto-ui 3.1.0 → 3.2.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.
Files changed (116) hide show
  1. package/dist/assets/Accordion.css +1 -0
  2. package/dist/assets/AviosBadge.css +1 -0
  3. package/dist/assets/Button.css +1 -1
  4. package/dist/assets/CalloutBanner.css +1 -0
  5. package/dist/assets/CreditCardNumberField.css +1 -1
  6. package/dist/assets/CreditCardSecurityCodeField.css +1 -0
  7. package/dist/assets/ErrorSummary.css +1 -0
  8. package/dist/assets/FieldHeader.css +1 -1
  9. package/dist/assets/FieldLabel.css +1 -1
  10. package/dist/assets/Image.css +1 -1
  11. package/dist/assets/Menu.css +1 -0
  12. package/dist/assets/PhoneNumberField.css +1 -1
  13. package/dist/assets/Section.css +1 -1
  14. package/dist/assets/SelectCard.css +1 -0
  15. package/dist/assets/Tag.css +1 -1
  16. package/dist/assets/flex.css +1 -1
  17. package/dist/assets/position.css +1 -0
  18. package/dist/components/Accordion/Accordion.d.ts +35 -0
  19. package/dist/components/Accordion/Accordion.js +140 -0
  20. package/dist/components/Accordion/Accordion.js.map +1 -0
  21. package/dist/components/Accordion/index.d.ts +1 -0
  22. package/dist/components/Accordion/index.js +5 -0
  23. package/dist/components/Accordion/index.js.map +1 -0
  24. package/dist/components/AviosBadge/AviosBadge.d.ts +34 -0
  25. package/dist/components/AviosBadge/AviosBadge.js +58 -0
  26. package/dist/components/AviosBadge/AviosBadge.js.map +1 -0
  27. package/dist/components/AviosBadge/index.d.ts +1 -0
  28. package/dist/components/AviosBadge/index.js +5 -0
  29. package/dist/components/AviosBadge/index.js.map +1 -0
  30. package/dist/components/Badge/Badge.d.ts +7 -2
  31. package/dist/components/Badge/Badge.js +2 -1
  32. package/dist/components/Badge/Badge.js.map +1 -1
  33. package/dist/components/Box/Box.d.ts +4 -4
  34. package/dist/components/Box/Box.js +6 -3
  35. package/dist/components/Box/Box.js.map +1 -1
  36. package/dist/components/Button/Button.js +31 -31
  37. package/dist/components/CalloutBanner/CalloutBanner.d.ts +21 -0
  38. package/dist/components/CalloutBanner/CalloutBanner.js +96 -0
  39. package/dist/components/CalloutBanner/CalloutBanner.js.map +1 -0
  40. package/dist/components/CalloutBanner/index.d.ts +1 -0
  41. package/dist/components/CalloutBanner/index.js +5 -0
  42. package/dist/components/CalloutBanner/index.js.map +1 -0
  43. package/dist/components/Checkbox/index.d.ts +1 -0
  44. package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +2 -2
  45. package/dist/components/CreditCardNumberField/CreditCardNumberField.js +7 -6
  46. package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -1
  47. package/dist/components/CreditCardSecurityCodeField/CreditCardSecurityCodeField.d.ts +35 -0
  48. package/dist/components/CreditCardSecurityCodeField/CreditCardSecurityCodeField.js +65 -0
  49. package/dist/components/CreditCardSecurityCodeField/CreditCardSecurityCodeField.js.map +1 -0
  50. package/dist/components/CreditCardSecurityCodeField/index.d.ts +1 -0
  51. package/dist/components/CreditCardSecurityCodeField/index.js +5 -0
  52. package/dist/components/CreditCardSecurityCodeField/index.js.map +1 -0
  53. package/dist/components/DateField/DateField.d.ts +22 -3
  54. package/dist/components/DateField/DateField.js +856 -2
  55. package/dist/components/DateField/DateField.js.map +1 -1
  56. package/dist/components/ErrorSummary/ErrorSummary.d.ts +7 -0
  57. package/dist/components/ErrorSummary/ErrorSummary.js +44 -0
  58. package/dist/components/ErrorSummary/ErrorSummary.js.map +1 -0
  59. package/dist/components/ErrorSummary/index.d.ts +1 -0
  60. package/dist/components/ErrorSummary/index.js +5 -0
  61. package/dist/components/ErrorSummary/index.js.map +1 -0
  62. package/dist/components/FieldHeader/FieldHeader.js +6 -6
  63. package/dist/components/FieldLabel/FieldLabel.js +1 -1
  64. package/dist/components/Heading/Heading.d.ts +1 -1
  65. package/dist/components/Icon/Icon.d.ts +1 -0
  66. package/dist/components/Image/Image.d.ts +1 -1
  67. package/dist/components/Image/Image.js +6 -6
  68. package/dist/components/Menu/Menu.d.ts +75 -0
  69. package/dist/components/Menu/Menu.js +356 -0
  70. package/dist/components/Menu/Menu.js.map +1 -0
  71. package/dist/components/Menu/index.d.ts +1 -0
  72. package/dist/components/Menu/index.js +5 -0
  73. package/dist/components/Menu/index.js.map +1 -0
  74. package/dist/components/Paragraph/Paragraph.d.ts +1 -1
  75. package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +1 -1
  76. package/dist/components/PhoneNumberField/PhoneNumberField.js +13 -8
  77. package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -1
  78. package/dist/components/Popover/Popover.d.ts +36 -4
  79. package/dist/components/Popover/Popover.js +21 -24
  80. package/dist/components/Popover/Popover.js.map +1 -1
  81. package/dist/components/Radio/index.d.ts +1 -0
  82. package/dist/components/Section/Section.d.ts +6 -2
  83. package/dist/components/Section/Section.js +42 -14
  84. package/dist/components/Section/Section.js.map +1 -1
  85. package/dist/components/SelectCard/SelectCard.d.ts +51 -0
  86. package/dist/components/SelectCard/SelectCard.js +85 -0
  87. package/dist/components/SelectCard/SelectCard.js.map +1 -0
  88. package/dist/components/SelectCard/index.d.ts +1 -0
  89. package/dist/components/SelectCard/index.js +5 -0
  90. package/dist/components/SelectCard/index.js.map +1 -0
  91. package/dist/components/SelectNative/SelectNative.d.ts +6 -1
  92. package/dist/components/SelectNative/SelectNative.js +7 -1
  93. package/dist/components/SelectNative/SelectNative.js.map +1 -1
  94. package/dist/components/SubHeading/SubHeading.d.ts +1 -1
  95. package/dist/components/Tag/Tag.js +4 -4
  96. package/dist/components/TagGroup/TagGroup.d.ts +21 -1
  97. package/dist/components/TagGroup/TagGroup.js +6 -2
  98. package/dist/components/TagGroup/TagGroup.js.map +1 -1
  99. package/dist/components/index.d.ts +7 -0
  100. package/dist/components/index.js +18 -4
  101. package/dist/components/index.js.map +1 -1
  102. package/dist/index.js +18 -4
  103. package/dist/index.js.map +1 -1
  104. package/dist/utils/border/border.d.ts +2 -2
  105. package/dist/utils/flex/flex.d.ts +10 -5
  106. package/dist/utils/flex/flex.js +383 -51
  107. package/dist/utils/flex/flex.js.map +1 -1
  108. package/dist/utils/flex/flex.test.d.ts +1 -0
  109. package/dist/utils/focus/focusStyles.d.ts +1 -1
  110. package/dist/utils/foregroundColour/foregroundColor.d.ts +1 -1
  111. package/dist/utils/position/position.d.ts +8 -0
  112. package/dist/utils/position/position.js +57 -0
  113. package/dist/utils/position/position.js.map +1 -0
  114. package/dist/utils/position/position.test.d.ts +1 -0
  115. package/dist/utils/stories/iconPropsArgTypes.js +49 -49
  116. package/package.json +1 -1
@@ -4,10 +4,10 @@ import { TextField, Input } from "react-aria-components";
4
4
  import { u as usePatternFormat, N as NumberFormatBase } from "../../react-number-format.es-DMLgWFZX.js";
5
5
  import { DEFAULT_PATTERN, getCountryOptions, getCountryFlagEmoji, countryPhoneMap, getPhoneNumberValue } from "../../utils/phoneNumber/phoneNumber.js";
6
6
  import { Field } from "../_base/Field/Field.js";
7
- import '../../assets/PhoneNumberField.css';const phoneNumberField = "_phoneNumberField_1owea_1";
8
- const selectHandlerValue = "_selectHandlerValue_1owea_35";
9
- const selectHandlerIcon = "_selectHandlerIcon_1owea_66";
10
- const selectWrapper = "_selectWrapper_1owea_78";
7
+ import '../../assets/PhoneNumberField.css';const phoneNumberField = "_phoneNumberField_trpoz_1";
8
+ const selectHandlerValue = "_selectHandlerValue_trpoz_34";
9
+ const selectHandlerIcon = "_selectHandlerIcon_trpoz_65";
10
+ const selectWrapper = "_selectWrapper_trpoz_77";
11
11
  const styles = {
12
12
  phoneNumberField,
13
13
  selectHandlerValue,
@@ -25,6 +25,7 @@ const PhoneNumberField = ({
25
25
  isFormatted = true,
26
26
  id: providedId,
27
27
  countrySelectLabel = "Select a country",
28
+ label = "Phone number",
28
29
  ...props
29
30
  }) => {
30
31
  const inputRef = useRef(null);
@@ -73,15 +74,19 @@ const PhoneNumberField = ({
73
74
  };
74
75
  const countryOptions = getCountryOptions(options, countryCodes);
75
76
  const defaultValue = countryOptions.find((opt) => opt.value === defaultCountry);
76
- return /* @__PURE__ */ jsx(Field, { as: TextField, ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.phoneNumberField, children: [
77
- /* @__PURE__ */ jsx(NumberFormatBase, { type: "tel", format: handleFormat, autoComplete: "tel", customInput: Input, getInputRef: inputRef, "aria-label": (props == null ? void 0 : props.label) || "Phone number", ...inputProps, onValueChange: (e) => handleInputChange(e.value), value: valueDefinitive, placeholder: props == null ? void 0 : props.placeholder }),
77
+ return /* @__PURE__ */ jsx(Field, { as: TextField, label, labelFor: id, ...props, children: /* @__PURE__ */ jsxs("div", { className: styles.phoneNumberField, children: [
78
78
  hasCountrySelect && /* @__PURE__ */ jsxs("div", { className: styles.selectWrapper, children: [
79
- /* @__PURE__ */ jsx("select", { className: styles.selectInput, defaultValue: defaultValue == null ? void 0 : defaultValue.value, value: countryCodeDefinitive, onChange: (e) => handleSelectCountry(e.target.value), "aria-label": countrySelectLabel, id: `${id}-country-select`, disabled: props == null ? void 0 : props.isDisabled, "aria-disabled": props == null ? void 0 : props.isDisabled, children: countryOptions.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value)) }),
79
+ /* @__PURE__ */ jsx("select", { className: styles.selectInput, ...countryCodeControlled ? {
80
+ value: countryCodeDefinitive
81
+ } : {
82
+ defaultValue: defaultValue == null ? void 0 : defaultValue.value
83
+ }, onChange: (e) => handleSelectCountry(e.target.value), "aria-label": countrySelectLabel, id: `${id}-country-select`, disabled: props == null ? void 0 : props.isDisabled, "aria-disabled": props == null ? void 0 : props.isDisabled, children: countryOptions.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value)) }),
80
84
  /* @__PURE__ */ jsxs("div", { className: styles.selectHandlerValue, "aria-hidden": "true", id: `${id}-country-display`, children: [
81
85
  getCountryFlagEmoji(countryCodeDefinitive) + " " + countryCodeDefinitive,
82
86
  /* @__PURE__ */ jsx("svg", { xmlns: "http://www.w3.org/2000/svg", width: "13", height: "16", fill: "none", viewBox: "0 0 13 16", className: styles.selectHandlerIcon, "aria-hidden": "true", role: "presentation", children: /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "m6.926 2.664 3.75 3c.305.281.375.75.117 1.055-.28.328-.75.375-1.054.117L6.457 4.21l-3.28 2.625a.747.747 0 0 1-1.056-.117.75.75 0 0 1 .118-1.055l3.75-3c.257-.21.656-.21.937 0m3.75 8.672-3.75 3a.71.71 0 0 1-.937 0l-3.75-3c-.328-.258-.399-.727-.118-1.055a.77.77 0 0 1 1.055-.117l3.281 2.625 3.282-2.625c.304-.258.797-.187 1.054.117a.77.77 0 0 1-.117 1.055" }) })
83
87
  ] })
84
- ] })
88
+ ] }),
89
+ /* @__PURE__ */ jsx(NumberFormatBase, { id, type: "tel", format: handleFormat, autoComplete: "tel", customInput: Input, getInputRef: inputRef, ...inputProps, onValueChange: (e) => handleInputChange(e.value), value: valueDefinitive, placeholder: props == null ? void 0 : props.placeholder })
85
90
  ] }) });
86
91
  };
87
92
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"PhoneNumberField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"PhoneNumberField.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,16 +1,48 @@
1
1
  import { default as React } from 'react';
2
2
  import { OverlayTriggerState } from 'react-stately';
3
+ type PlacementType = 'top' | 'top start' | 'top end' | 'right' | 'right top' | 'right bottom' | 'bottom' | 'bottom start' | 'bottom end' | 'left' | 'left top' | 'left bottom';
4
+ type ArrowDirectionType = 'top' | 'right' | 'bottom' | 'left';
5
+ interface InternalPopoverProps {
6
+ /**
7
+ * @private Internal use only - placement of the popover
8
+ * This prop should only be used by internal components like Menu
9
+ */
10
+ placement?: PlacementType;
11
+ /**
12
+ * @private Internal use only - whether the popover should flip to fit in the viewport
13
+ * This prop should only be used by internal components like Menu
14
+ */
15
+ shouldFlip?: boolean;
16
+ /**
17
+ * @private Internal use only - whether to allow elements outside the popover may be interacted with
18
+ * This prop should only be used by internal components like Menu
19
+ */
20
+ isNonModal?: boolean;
21
+ /**
22
+ * @private Internal use only - whether to allow tabbing out of the popover
23
+ * This prop should only be used by internal components like Menu
24
+ */
25
+ allowTabOut?: boolean;
26
+ /**
27
+ * @private Internal use only - whether to auto-focus elements within the popover
28
+ * This prop should only be used by internal components like Menu
29
+ */
30
+ autoFocus?: boolean;
31
+ }
3
32
  export interface PopoverProps {
4
33
  /** Content to be rendered inside the popover */
5
34
  children: React.ReactNode;
6
35
  /** State object controlling the overlay's open/closed status */
7
36
  state: OverlayTriggerState;
8
- /** Direction of the popover arrow - affects initial placement */
9
- arrowDirection?: 'top' | 'right' | 'bottom' | 'left';
37
+ /** Direction of the arrow that points to the trigger element */
38
+ arrowDirection?: ArrowDirectionType;
10
39
  /** Reference to the trigger element that opens the popover */
11
- triggerRef: React.RefObject<HTMLButtonElement>;
40
+ triggerRef: React.RefObject<HTMLButtonElement> | {
41
+ current: HTMLElement;
42
+ };
12
43
  /** Whether to show the directional arrow on the popover */
13
44
  hasArrow?: boolean;
14
45
  }
15
- export declare const Popover: ({ children, state, arrowDirection, triggerRef, hasArrow, }: PopoverProps) => import("react/jsx-runtime").JSX.Element;
46
+ type CombinedPopoverProps = PopoverProps & InternalPopoverProps;
47
+ export declare const Popover: ({ children, state, arrowDirection, triggerRef, hasArrow, placement, shouldFlip, isNonModal, allowTabOut, autoFocus, }: CombinedPopoverProps) => import("react/jsx-runtime").JSX.Element;
16
48
  export default Popover;
@@ -2,7 +2,6 @@ import { jsx, jsxs } from "react/jsx-runtime";
2
2
  import React, { useRef, useEffect } from "react";
3
3
  import { usePopover, Overlay, DismissButton } from "@react-aria/overlays";
4
4
  import { FocusScope } from "@react-aria/focus";
5
- import { mergeProps } from "@react-aria/utils";
6
5
  import '../../assets/Popover.css';const popoverWrapper = "_popoverWrapper_qrzbw_1";
7
6
  const popover = "_popover_qrzbw_1";
8
7
  const arrow = "_arrow_qrzbw_16";
@@ -11,54 +10,52 @@ const styles = {
11
10
  popover,
12
11
  arrow
13
12
  };
13
+ const arrowDirectionToPlacement = {
14
+ top: "top",
15
+ right: "right",
16
+ bottom: "bottom",
17
+ left: "left"
18
+ };
14
19
  const Popover = ({
15
20
  children,
16
21
  state,
17
22
  arrowDirection = "bottom",
18
23
  triggerRef,
19
- hasArrow = true
24
+ hasArrow = true,
25
+ placement,
26
+ shouldFlip = true,
27
+ isNonModal = false,
28
+ allowTabOut = false,
29
+ autoFocus = false
20
30
  }) => {
21
31
  const popoverRef = useRef(null);
22
- const [optimalPlacement, setOptimalPlacement] = React.useState(arrowDirection);
32
+ const initialPlacement = placement || arrowDirectionToPlacement[arrowDirection];
33
+ const [optimalPlacement, setOptimalPlacement] = React.useState(initialPlacement);
23
34
  useEffect(() => {
24
35
  const updatePlacement = () => {
25
36
  if (!popoverRef.current || !triggerRef.current) return;
26
- const popoverRect = popoverRef.current.getBoundingClientRect();
27
- const triggerRect = triggerRef.current.getBoundingClientRect();
28
- const viewportHeight = window.innerHeight;
29
- const viewportWidth = window.innerWidth;
30
- let newPlacement = arrowDirection;
31
- if (arrowDirection === "bottom" && triggerRect.bottom + popoverRect.height > viewportHeight) {
32
- newPlacement = "top";
33
- } else if (arrowDirection === "top" && triggerRect.top - popoverRect.height < 0) {
34
- newPlacement = "bottom";
35
- }
36
- if (arrowDirection === "right" && triggerRect.right + popoverRect.width > viewportWidth) {
37
- newPlacement = "left";
38
- } else if (arrowDirection === "left" && triggerRect.left - popoverRect.width < 0) {
39
- newPlacement = "right";
40
- }
41
- setOptimalPlacement(newPlacement);
37
+ setOptimalPlacement(initialPlacement);
42
38
  };
43
39
  updatePlacement();
44
40
  window.addEventListener("resize", updatePlacement);
45
41
  return () => window.removeEventListener("resize", updatePlacement);
46
- }, [arrowDirection, popoverRef.current]);
42
+ }, [initialPlacement, popoverRef.current]);
47
43
  const {
48
44
  popoverProps,
49
45
  arrowProps,
50
- placement
46
+ placement: finalPlacement
51
47
  } = usePopover({
52
48
  popoverRef,
53
49
  triggerRef,
54
50
  offset: 12,
55
51
  placement: optimalPlacement,
56
- shouldFlip: true
52
+ shouldFlip,
53
+ isNonModal
57
54
  }, state);
58
- return /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx("div", { className: styles.popoverWrapper, children: /* @__PURE__ */ jsx(FocusScope, { restoreFocus: true, contain: true, children: /* @__PURE__ */ jsxs("div", { ...mergeProps(popoverProps), ref: popoverRef, className: styles.popover, children: [
55
+ return /* @__PURE__ */ jsx(Overlay, { children: /* @__PURE__ */ jsx("div", { className: styles.popoverWrapper, children: /* @__PURE__ */ jsx(FocusScope, { restoreFocus: true, contain: !allowTabOut, autoFocus, children: /* @__PURE__ */ jsxs("div", { ...popoverProps, ref: popoverRef, className: styles.popover, children: [
59
56
  /* @__PURE__ */ jsx(DismissButton, { onDismiss: state.close }),
60
57
  children,
61
- hasArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, className: styles.arrow, "data-placement": placement })
58
+ hasArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, className: styles.arrow, "data-placement": finalPlacement })
62
59
  ] }) }) }) });
63
60
  };
64
61
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Popover.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Popover.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1 +1,2 @@
1
+ export type { RadioProps } from './Radio';
1
2
  export { default } from './Radio';
@@ -1,6 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { BackgroundVariants } from '../../utils/backgroundColor/backgroundColor';
3
3
  import { PaddingVariants } from '../../utils/padding/padding';
4
+ import { FlexVariants } from '../../utils/flex/flex';
4
5
  type SectionPaddingValue = 'default' | PaddingVariants['paddingX'];
5
6
  type SectionPadding = {
6
7
  paddingX?: SectionPaddingValue;
@@ -10,7 +11,7 @@ type SectionPadding = {
10
11
  paddingBottom?: SectionPaddingValue;
11
12
  paddingLeft?: SectionPaddingValue;
12
13
  };
13
- export interface SectionProps extends BackgroundVariants, SectionPadding {
14
+ export interface SectionProps extends BackgroundVariants, SectionPadding, Pick<FlexVariants, 'flexDirection' | 'justifyContent' | 'alignItems'> {
14
15
  children: React.ReactNode;
15
16
  containerMaxWidth?: 'full-width' | 'page';
16
17
  style?: React.CSSProperties;
@@ -21,8 +22,11 @@ interface ContainerProps {
21
22
  children: React.ReactNode;
22
23
  className?: string;
23
24
  containerMaxWidth?: 'full-width' | 'page';
25
+ flexDirection?: FlexVariants['flexDirection'];
26
+ justifyContent?: FlexVariants['justifyContent'];
27
+ alignItems?: FlexVariants['alignItems'];
24
28
  }
25
- declare const Container: ({ children, className, containerMaxWidth, }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
29
+ declare const Container: ({ children, className, containerMaxWidth, flexDirection, justifyContent, alignItems, }: ContainerProps) => import("react/jsx-runtime").JSX.Element;
26
30
  interface SectionComponent extends React.ForwardRefExoticComponent<SectionProps & React.RefAttributes<HTMLElement>> {
27
31
  Container: typeof Container;
28
32
  }
@@ -3,21 +3,22 @@ import React, { forwardRef } from "react";
3
3
  import { backgroundColorVariants } from "../../utils/backgroundColor/backgroundColor.js";
4
4
  import { paddingVariants } from "../../utils/padding/padding.js";
5
5
  import { c as cva } from "../../index-Bi3v_EjJ.js";
6
- import '../../assets/Section.css';const section = "_section_1lo00_1";
7
- const container = "_container_1lo00_8";
8
- const pageWidth = "_pageWidth_1lo00_16";
9
- const fullWidth = "_fullWidth_1lo00_20";
10
- const paddingTopDefault = "_paddingTopDefault_1lo00_34";
11
- const paddingRightDefault = "_paddingRightDefault_1lo00_38";
12
- const paddingBottomDefault = "_paddingBottomDefault_1lo00_42";
13
- const paddingLeftDefault = "_paddingLeftDefault_1lo00_46";
6
+ import { flexVariants } from "../../utils/flex/flex.js";
7
+ import '../../assets/Section.css';const section = "_section_1w3or_1";
8
+ const container = "_container_1w3or_7";
9
+ const pageWidth = "_pageWidth_1w3or_15";
10
+ const fullWidth = "_fullWidth_1w3or_19";
11
+ const paddingTopDefault = "_paddingTopDefault_1w3or_33";
12
+ const paddingRightDefault = "_paddingRightDefault_1w3or_37";
13
+ const paddingBottomDefault = "_paddingBottomDefault_1w3or_41";
14
+ const paddingLeftDefault = "_paddingLeftDefault_1w3or_45";
14
15
  const styles = {
15
16
  section,
16
17
  container,
17
18
  pageWidth,
18
19
  fullWidth,
19
- "paddingX-default": "_paddingX-default_1lo00_24",
20
- "paddingY-default": "_paddingY-default_1lo00_29",
20
+ "paddingX-default": "_paddingX-default_1w3or_23",
21
+ "paddingY-default": "_paddingY-default_1w3or_28",
21
22
  paddingTopDefault,
22
23
  paddingRightDefault,
23
24
  paddingBottomDefault,
@@ -48,8 +49,23 @@ const sectionPaddingVariants = cva("", {
48
49
  const Container = ({
49
50
  children,
50
51
  className,
51
- containerMaxWidth = "page"
52
- }) => /* @__PURE__ */ jsx("div", { className: `${styles.container} ${styles[`${containerMaxWidth}Width`]} ${className || ""}`, children });
52
+ containerMaxWidth = "page",
53
+ flexDirection,
54
+ justifyContent,
55
+ alignItems
56
+ }) => {
57
+ const widthClassName = containerMaxWidth === "full-width" ? "fullWidth" : "pageWidth";
58
+ return /* @__PURE__ */ jsx("div", { className: `
59
+ ${styles.container}
60
+ ${styles[widthClassName]}
61
+ ${flexVariants({
62
+ flexDirection,
63
+ justifyContent,
64
+ alignItems
65
+ })}
66
+ ${className || ""}
67
+ `.trim(), children });
68
+ };
53
69
  const Section = forwardRef(({
54
70
  children,
55
71
  containerMaxWidth = "page",
@@ -62,7 +78,10 @@ const Section = forwardRef(({
62
78
  paddingX,
63
79
  paddingY = "default",
64
80
  style,
65
- className
81
+ className,
82
+ flexDirection,
83
+ justifyContent,
84
+ alignItems
66
85
  }, ref) => {
67
86
  if (backgroundColour && !backgroundColor) {
68
87
  console.warn("Warning: `backgroundColour` is deprecated and will be removed in a future release. Please use `backgroundColor` instead.");
@@ -89,12 +108,21 @@ const Section = forwardRef(({
89
108
  ${backgroundColorVariants({
90
109
  backgroundColor: resolvedBackgroundColor
91
110
  })}
111
+ ${flexVariants({
112
+ display: flexDirection || justifyContent ? "flex" : void 0,
113
+ flexDirection,
114
+ justifyContent,
115
+ alignItems
116
+ })}
92
117
  ${className || ""}
93
118
  `.trim(), style, children: React.Children.map(children, (child) => {
94
119
  if (React.isValidElement(child) && child.type === Container) {
95
120
  return React.cloneElement(child, {
96
121
  ...child.props,
97
- containerMaxWidth
122
+ containerMaxWidth,
123
+ flexDirection,
124
+ justifyContent,
125
+ alignItems
98
126
  });
99
127
  }
100
128
  return child;
@@ -1 +1 @@
1
- {"version":3,"file":"Section.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Section.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,51 @@
1
+ import { default as React } from 'react';
2
+ import { CheckboxProps } from 'react-aria-components';
3
+ import { RadioProps } from '../Radio';
4
+ type SelectCardContextType = {
5
+ /**
6
+ * The input type of the select card.
7
+ * @default 'checkbox'
8
+ */
9
+ type?: 'checkbox' | 'radio';
10
+ /**
11
+ * The ID of the title for a11y labelling.
12
+ * @default useId()
13
+ */
14
+ 'aria-labelledby'?: string;
15
+ } & (({
16
+ type?: 'checkbox';
17
+ } & Omit<CheckboxProps, 'children' | 'focusStyle'>) | ({
18
+ type: 'radio';
19
+ } & Omit<RadioProps, 'children' | 'focusStyle'>));
20
+ type SelectCardProps = SelectCardContextType & {
21
+ /**
22
+ * The compounds components of the SelectCard:
23
+ * - SelectCard.Header
24
+ * - SelectCard.StartSlot
25
+ * - SelectCard.EndSlot
26
+ * - SelectCard.Label
27
+ * - SelectCard.Body
28
+ * - SelectCard.Details
29
+ */
30
+ children?: React.ReactNode;
31
+ };
32
+ declare const SelectCard: {
33
+ ({ children, type, ...contextProps }: SelectCardProps): import("react/jsx-runtime").JSX.Element;
34
+ Header: ({ children }: HeaderProps) => import("react/jsx-runtime").JSX.Element;
35
+ StartSlot: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
36
+ EndSlot: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
37
+ Label: ({ title, description }: LabelProps) => import("react/jsx-runtime").JSX.Element;
38
+ Body: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
39
+ Details: ({ children }: SlotProps) => import("react/jsx-runtime").JSX.Element;
40
+ };
41
+ interface HeaderProps {
42
+ children?: React.ReactNode;
43
+ }
44
+ interface SlotProps {
45
+ children: React.ReactNode;
46
+ }
47
+ interface LabelProps {
48
+ title: string;
49
+ description?: string;
50
+ }
51
+ export default SelectCard;
@@ -0,0 +1,85 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { createContext, useContext } from "react";
3
+ import { Paragraph } from "../Paragraph/Paragraph.js";
4
+ import { Checkbox, Radio } from "react-aria-components";
5
+ import '../../assets/SelectCard.css';const checkboxSvgWrapper = "_checkboxSvgWrapper_dir9q_104";
6
+ const svg = "_svg_dir9q_118";
7
+ const styles = {
8
+ "select-card": "_select-card_dir9q_1",
9
+ "select-card__header": "_select-card__header_dir9q_30",
10
+ "select-card__start-slot": "_select-card__start-slot_dir9q_38",
11
+ "select-card__label-title": "_select-card__label-title_dir9q_43",
12
+ "select-card__label": "_select-card__label_dir9q_43",
13
+ "select-card__end-slot": "_select-card__end-slot_dir9q_67",
14
+ "select-card__body": "_select-card__body_dir9q_79",
15
+ "select-card__details": "_select-card__details_dir9q_90",
16
+ "select-card__checkbox": "_select-card__checkbox_dir9q_104",
17
+ checkboxSvgWrapper,
18
+ svg,
19
+ "select-card__radio": "_select-card__radio_dir9q_183"
20
+ };
21
+ const SelectCardContext = createContext({});
22
+ const SelectCard = ({
23
+ children,
24
+ type = "checkbox",
25
+ ...contextProps
26
+ }) => {
27
+ const labelId = React.useId();
28
+ if (type === "checkbox") {
29
+ return /* @__PURE__ */ jsx(SelectCardContext.Provider, { value: {
30
+ type,
31
+ "aria-labelledby": labelId,
32
+ ...contextProps
33
+ }, children: /* @__PURE__ */ jsx(Checkbox, { className: `${styles["select-card"]} ${styles["select-card__checkbox"]}`, ...contextProps, "aria-labelledby": labelId, children }) });
34
+ }
35
+ return /* @__PURE__ */ jsx(SelectCardContext.Provider, { value: {
36
+ "aria-labelledby": labelId,
37
+ ...contextProps
38
+ }, children: /* @__PURE__ */ jsx(Radio, { className: `${styles["select-card"]} ${styles["select-card__radio"]}`, ...contextProps, "aria-labelledby": labelId, children }) });
39
+ };
40
+ const Header = ({
41
+ children
42
+ }) => {
43
+ const state = useContext(SelectCardContext);
44
+ if ((state == null ? void 0 : state.type) === "checkbox") {
45
+ return /* @__PURE__ */ jsxs("div", { className: styles["select-card__header"], children: [
46
+ /* @__PURE__ */ jsx("div", { className: `${styles.checkboxSvgWrapper}`, "data-disabled": state == null ? void 0 : state.isDisabled, children: /* @__PURE__ */ jsx("svg", { className: styles.svg, viewBox: "0 0 18 18", "aria-hidden": "true", children: (state == null ? void 0 : state.isIndeterminate) ? /* @__PURE__ */ jsx("rect", { x: 1, y: 7.5, width: 15, height: 3 }) : /* @__PURE__ */ jsx("polyline", { points: "1 9 7 14 15 4" }) }) }),
47
+ children
48
+ ] });
49
+ }
50
+ return /* @__PURE__ */ jsx("div", { className: styles["select-card__header"], children });
51
+ };
52
+ const StartSlot = ({
53
+ children
54
+ }) => /* @__PURE__ */ jsx("div", { className: styles["select-card__start-slot"], children });
55
+ const EndSlot = ({
56
+ children
57
+ }) => /* @__PURE__ */ jsx("div", { className: styles["select-card__end-slot"], children });
58
+ const Label = ({
59
+ title,
60
+ description
61
+ }) => {
62
+ const state = useContext(SelectCardContext);
63
+ return /* @__PURE__ */ jsxs("div", { className: styles["select-card__label"], children: [
64
+ /* @__PURE__ */ jsx("div", { className: styles["select-card__label-title"], id: state == null ? void 0 : state["aria-labelledby"], children: title }),
65
+ /* @__PURE__ */ jsx(Paragraph, { size: "sm", foregroundColor: (state == null ? void 0 : state.isDisabled) ? "disabledOnSubtle" : "default", children: description })
66
+ ] });
67
+ };
68
+ const Body = ({
69
+ children
70
+ }) => /* @__PURE__ */ jsx("div", { className: styles["select-card__body"], children });
71
+ const Details = ({
72
+ children
73
+ }) => {
74
+ return /* @__PURE__ */ jsx("div", { className: styles["select-card__details"], children });
75
+ };
76
+ SelectCard.Header = Header;
77
+ SelectCard.StartSlot = StartSlot;
78
+ SelectCard.EndSlot = EndSlot;
79
+ SelectCard.Label = Label;
80
+ SelectCard.Body = Body;
81
+ SelectCard.Details = Details;
82
+ export {
83
+ SelectCard as default
84
+ };
85
+ //# sourceMappingURL=SelectCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SelectCard.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export { default } from './SelectCard';
@@ -0,0 +1,5 @@
1
+ import { default as default2 } from "./SelectCard.js";
2
+ export {
3
+ default2 as default
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -1,4 +1,5 @@
1
1
  import { ValidationResult } from 'react-aria-components';
2
+ import { ChangeEvent } from 'react';
2
3
  export interface SelectNativeOption {
3
4
  label: string;
4
5
  value: string;
@@ -51,6 +52,10 @@ export interface SelectNativeProps {
51
52
  * Optional ID for the select element. If not provided, one will be generated.
52
53
  */
53
54
  id?: string;
55
+ /**
56
+ * Callback function when the selection changes
57
+ */
58
+ onChange?: (event: ChangeEvent<HTMLSelectElement>) => void;
54
59
  }
55
- export declare const SelectNative: ({ label, description, errorMessage, isInvalid, isDisabled, isRequired, placeholder, options, defaultValue, value, id: providedId, ...props }: SelectNativeProps) => import("react/jsx-runtime").JSX.Element;
60
+ export declare const SelectNative: ({ label, description, errorMessage, isInvalid, isDisabled, isRequired, placeholder, options, defaultValue, value, id: providedId, onChange, ...props }: SelectNativeProps) => import("react/jsx-runtime").JSX.Element;
56
61
  export default SelectNative;
@@ -20,14 +20,20 @@ const SelectNative = ({
20
20
  defaultValue,
21
21
  value,
22
22
  id: providedId,
23
+ onChange,
23
24
  ...props
24
25
  }) => {
25
26
  const uniqueId = useId();
26
27
  const id = providedId || `select-${uniqueId}`;
27
28
  const showPlaceholder = !defaultValue && !value;
29
+ const handleChange = (event) => {
30
+ if (onChange) {
31
+ onChange(event);
32
+ }
33
+ };
28
34
  return /* @__PURE__ */ jsxs(TextField, { className: styles.select, defaultValue, value, isDisabled, isInvalid, ...props, children: [
29
35
  label && /* @__PURE__ */ jsx(FieldHeader, { label, description, isInvalid, isRequired, errorMessage, labelFor: id }),
30
- /* @__PURE__ */ jsxs("select", { id, className: styles.selectInput, defaultValue, value, disabled: isDisabled, required: isRequired, "aria-invalid": isInvalid, children: [
36
+ /* @__PURE__ */ jsxs("select", { id, className: styles.selectInput, defaultValue, value, disabled: isDisabled, required: isRequired, "aria-invalid": isInvalid, onChange: handleChange, children: [
31
37
  showPlaceholder && placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, hidden: true, children: placeholder }),
32
38
  options.map((option) => /* @__PURE__ */ jsx("option", { value: option.value, children: option.label }, option.value))
33
39
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"SelectNative.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"SelectNative.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -3,7 +3,7 @@ import { VariantProps } from 'class-variance-authority';
3
3
  import { ForegroundVariants } from '../../utils/foregroundColour/foregroundColor';
4
4
  declare const subHeading: (props?: ({
5
5
  size?: "sm" | "xs" | null | undefined;
6
- textAlign?: "end" | "start" | "center" | null | undefined;
6
+ textAlign?: "center" | "end" | "start" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
8
  type HeadingVariants = VariantProps<typeof subHeading>;
9
9
  type SubHeadingLevel = 'span' | 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
@@ -3,9 +3,9 @@ import { Tag as Tag$1 } from "react-aria-components";
3
3
  import { Icon } from "../Icon/Icon.js";
4
4
  import { IconButton } from "../IconButton/IconButton.js";
5
5
  import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
6
- import '../../assets/Tag.css';const tag = "_tag_ob7tq_1";
7
- const isRemovable = "_isRemovable_ob7tq_21";
8
- const iconWrapper = "_iconWrapper_ob7tq_123";
6
+ import '../../assets/Tag.css';const tag = "_tag_1jz2y_1";
7
+ const isRemovable = "_isRemovable_1jz2y_21";
8
+ const iconWrapper = "_iconWrapper_1jz2y_123";
9
9
  const styles = {
10
10
  tag,
11
11
  isRemovable,
@@ -24,7 +24,7 @@ const Tag = ({
24
24
  return /* @__PURE__ */ jsxs(Tag$1, { className: `${styles.tag} ${isRemovable2 ? styles.isRemovable : ""} ${focusStyleVariants({
25
25
  focusStyle
26
26
  })}`, isDisabled, id: id == null ? void 0 : id.toString(), textValue, ...props, children: [
27
- leadingIconProps ? /* @__PURE__ */ jsx("span", { className: styles.iconWrapper, children: /* @__PURE__ */ jsx(Icon, { ...leadingIconProps }) }) : null,
27
+ leadingIconProps ? /* @__PURE__ */ jsx("span", { className: styles.iconWrapper, children: /* @__PURE__ */ jsx(Icon, { ...leadingIconProps, iconSize: "0.75x", padding: "square" }) }) : null,
28
28
  children,
29
29
  isRemovable2 && /* @__PURE__ */ jsx(IconButton, { slot: "remove", size: "sm", iconProps: {
30
30
  iconName: "close"
@@ -1,10 +1,30 @@
1
1
  import { TagGroupProps as AriaTagGroupProps, PressEvent, TagListProps } from 'react-aria-components';
2
2
  export interface TagGroupProps<T> extends Omit<AriaTagGroupProps, 'children'>, Pick<TagListProps<T>, 'items' | 'children' | 'renderEmptyState'> {
3
+ /**
4
+ * Optional label text
5
+ */
3
6
  label?: string;
7
+ /**
8
+ * Optional description text
9
+ */
4
10
  description?: string;
11
+ /**
12
+ * AriaLabel for the tag group. Required for accessibility if no label is provided
13
+ */
14
+ ariaLabel?: string;
15
+ /**
16
+ * Selection mode for the tag group
17
+ * @default 'single'
18
+ */
5
19
  selectionMode?: 'single' | 'multiple';
20
+ /**
21
+ * Whether to show a clear button
22
+ */
6
23
  clearButton?: boolean;
24
+ /**
25
+ * Function to call when the clear button is clicked
26
+ */
7
27
  clearButtonOnClick?: (e: PressEvent) => void;
8
28
  }
9
- export declare const TagGroup: <T extends object>({ label, description, items, children, renderEmptyState, clearButton, clearButtonOnClick, selectionMode, ...props }: TagGroupProps<T>) => import("react/jsx-runtime").JSX.Element;
29
+ export declare const TagGroup: <T extends object>({ label, description, ariaLabel, items, children, renderEmptyState, clearButton, clearButtonOnClick, selectionMode, ...props }: TagGroupProps<T>) => import("react/jsx-runtime").JSX.Element;
10
30
  export default TagGroup;
@@ -15,6 +15,7 @@ const styles = {
15
15
  const TagGroup = ({
16
16
  label,
17
17
  description,
18
+ ariaLabel,
18
19
  items,
19
20
  children,
20
21
  renderEmptyState,
@@ -23,8 +24,11 @@ const TagGroup = ({
23
24
  selectionMode = "single",
24
25
  ...props
25
26
  }) => {
26
- return /* @__PURE__ */ jsxs(TagGroup$1, { className: styles.tagGroup, selectionMode, ...props, children: [
27
- /* @__PURE__ */ jsxs("span", { className: styles.spanContainer, children: [
27
+ if (!label && !ariaLabel) {
28
+ console.warn("⚠️ [TagGroup] Accessibility Warning: You must provide either a 'label' or 'ariaLabel' for screen reader support.");
29
+ }
30
+ return /* @__PURE__ */ jsxs(TagGroup$1, { className: styles.tagGroup, selectionMode, "aria-label": label ? void 0 : ariaLabel, ...props, children: [
31
+ (label || clearButton) && /* @__PURE__ */ jsxs("span", { className: styles.spanContainer, children: [
28
32
  /* @__PURE__ */ jsx(FieldLabel, { children: label }),
29
33
  clearButton && /* @__PURE__ */ jsx(Button, { styleVariant: "accent", emphasis: "quaternary", size: "sm", onPress: clearButtonOnClick, children: "Clear" })
30
34
  ] }),
@@ -1 +1 @@
1
- {"version":3,"file":"TagGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"TagGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}