@alto-avios/alto-ui 4.3.0 → 4.5.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 (107) hide show
  1. package/dist/assets/Accordion.css +1 -1
  2. package/dist/assets/Breadcrumbs.css +1 -0
  3. package/dist/assets/Carousel.css +1 -1
  4. package/dist/assets/CarouselButton.css +1 -1
  5. package/dist/assets/CarouselDots.css +1 -1
  6. package/dist/assets/Checkbox.css +1 -1
  7. package/dist/assets/Dialog.css +1 -1
  8. package/dist/assets/FieldError.css +1 -1
  9. package/dist/assets/Icon.css +1 -1
  10. package/dist/assets/Link.css +1 -1
  11. package/dist/assets/ListBoxItem.css +1 -1
  12. package/dist/assets/LoadingSpinner.css +1 -1
  13. package/dist/assets/Popover.css +1 -1
  14. package/dist/assets/SelectCard.css +1 -1
  15. package/dist/assets/SelectNative.css +1 -1
  16. package/dist/assets/SkeletonLoader.css +1 -1
  17. package/dist/assets/skeleton.css +1 -0
  18. package/dist/components/Accordion/Accordion.d.ts +2 -0
  19. package/dist/components/Accordion/Accordion.js +16 -16
  20. package/dist/components/AviosCurrencyBadge/AviosCurrencyBadge.d.ts +5 -1
  21. package/dist/components/AviosCurrencyBadge/AviosCurrencyBadge.js +20 -27
  22. package/dist/components/AviosCurrencyBadge/AviosCurrencyBadge.js.map +1 -1
  23. package/dist/components/Badge/Badge.js +13 -2
  24. package/dist/components/Badge/Badge.js.map +1 -1
  25. package/dist/components/Box/Box.js +2 -1
  26. package/dist/components/Box/Box.js.map +1 -1
  27. package/dist/components/Breadcrumbs/Breadcrumbs.d.ts +73 -0
  28. package/dist/components/Breadcrumbs/Breadcrumbs.js +132 -0
  29. package/dist/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
  30. package/dist/components/Breadcrumbs/index.d.ts +2 -0
  31. package/dist/components/Breadcrumbs/index.js +5 -0
  32. package/dist/components/Breadcrumbs/index.js.map +1 -0
  33. package/dist/components/CalloutBanner/CalloutBanner.d.ts +2 -1
  34. package/dist/components/CalloutBanner/CalloutBanner.js +5 -1
  35. package/dist/components/CalloutBanner/CalloutBanner.js.map +1 -1
  36. package/dist/components/Carousel/Carousel.js +23 -23
  37. package/dist/components/Carousel/CarouselButton/CarouselButton.js +11 -11
  38. package/dist/components/Carousel/CarouselDots/CarouselDots.js +6 -6
  39. package/dist/components/Checkbox/Checkbox.d.ts +21 -2
  40. package/dist/components/Checkbox/Checkbox.js +46 -18
  41. package/dist/components/Checkbox/Checkbox.js.map +1 -1
  42. package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +11 -1
  43. package/dist/components/CheckboxGroup/CheckboxGroup.js +4 -1
  44. package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
  45. package/dist/components/ComboBox/ComboBox.js +1 -1
  46. package/dist/components/Dialog/Dialog.d.ts +5 -0
  47. package/dist/components/Dialog/Dialog.js +20 -20
  48. package/dist/components/FieldError/FieldError.d.ts +23 -5
  49. package/dist/components/FieldError/FieldError.js +62 -14
  50. package/dist/components/FieldError/FieldError.js.map +1 -1
  51. package/dist/components/FieldHeader/FieldHeader.d.ts +3 -1
  52. package/dist/components/FieldHeader/FieldHeader.js +4 -2
  53. package/dist/components/FieldHeader/FieldHeader.js.map +1 -1
  54. package/dist/components/Icon/Icon.js +20 -20
  55. package/dist/components/Link/Link.d.ts +7 -1
  56. package/dist/components/Link/Link.js +20 -15
  57. package/dist/components/Link/Link.js.map +1 -1
  58. package/dist/components/ListBox/ListBox.d.ts +1 -1
  59. package/dist/components/ListBoxItem/ListBoxItem.d.ts +7 -2
  60. package/dist/components/ListBoxItem/ListBoxItem.js +18 -6
  61. package/dist/components/ListBoxItem/ListBoxItem.js.map +1 -1
  62. package/dist/components/LoadingSpinner/LoadingSpinner.d.ts +14 -2
  63. package/dist/components/LoadingSpinner/LoadingSpinner.js +73 -12
  64. package/dist/components/LoadingSpinner/LoadingSpinner.js.map +1 -1
  65. package/dist/components/Menu/Menu.d.ts +49 -2
  66. package/dist/components/Menu/Menu.js +54 -6
  67. package/dist/components/Menu/Menu.js.map +1 -1
  68. package/dist/components/MonthYearField/MonthYearField.d.ts +4 -0
  69. package/dist/components/MonthYearField/MonthYearField.js +7 -2
  70. package/dist/components/MonthYearField/MonthYearField.js.map +1 -1
  71. package/dist/components/PasswordField/PasswordField.js +4 -9
  72. package/dist/components/PasswordField/PasswordField.js.map +1 -1
  73. package/dist/components/Popover/Popover.js +4 -4
  74. package/dist/components/RadioGroup/RadioGroup.js +1 -1
  75. package/dist/components/SelectCard/SelectCard.js +22 -15
  76. package/dist/components/SelectCard/SelectCard.js.map +1 -1
  77. package/dist/components/SelectNative/SelectNative.d.ts +7 -2
  78. package/dist/components/SelectNative/SelectNative.js +6 -5
  79. package/dist/components/SelectNative/SelectNative.js.map +1 -1
  80. package/dist/components/SkeletonLoader/SkeletonLoader.js +2 -1
  81. package/dist/components/SkeletonLoader/SkeletonLoader.js.map +1 -1
  82. package/dist/components/_base/Field/Field.d.ts +11 -2
  83. package/dist/components/_base/Field/Field.js +15 -6
  84. package/dist/components/_base/Field/Field.js.map +1 -1
  85. package/dist/components/index.d.ts +2 -0
  86. package/dist/components/index.js +2 -0
  87. package/dist/components/index.js.map +1 -1
  88. package/dist/index.js +2 -0
  89. package/dist/index.js.map +1 -1
  90. package/dist/utils/backgroundColor/backgroundColor.js +5 -1
  91. package/dist/utils/backgroundColor/backgroundColor.js.map +1 -1
  92. package/dist/utils/border/border.d.ts +3 -0
  93. package/dist/utils/border/border.js +71 -19
  94. package/dist/utils/border/border.js.map +1 -1
  95. package/dist/utils/flex/flex.d.ts +145 -0
  96. package/dist/utils/flex/flex.js +245 -0
  97. package/dist/utils/flex/flex.js.map +1 -1
  98. package/dist/utils/foregroundColour/foregroundColor.js +5 -1
  99. package/dist/utils/foregroundColour/foregroundColor.js.map +1 -1
  100. package/dist/utils/padding/padding.js +80 -27
  101. package/dist/utils/padding/padding.js.map +1 -1
  102. package/dist/utils/position/position.js +5 -1
  103. package/dist/utils/position/position.js.map +1 -1
  104. package/dist/utils/stories/DraggableContainer.d.ts +8 -0
  105. package/dist/utils/stories/DraggableContainer.js +134 -0
  106. package/dist/utils/stories/DraggableContainer.js.map +1 -0
  107. package/package.json +4 -1
@@ -0,0 +1,132 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React__default, { forwardRef, Children, useState, useLayoutEffect } from "react";
3
+ import { useBreadcrumbs } from "@react-aria/breadcrumbs";
4
+ import { useObjectRef, mergeProps } from "@react-aria/utils";
5
+ import Link from "../Link/Link.js";
6
+ import { Icon } from "../Icon/Icon.js";
7
+ import { Menu } from "../Menu/Menu.js";
8
+ import { IconButton } from "../IconButton/IconButton.js";
9
+ import { foregroundColorVariants } from "../../utils/foregroundColour/foregroundColor.js";
10
+ import '../../assets/Breadcrumbs.css';const breadcrumbs = "_breadcrumbs_xrrvy_1";
11
+ const breadcrumbs__list = "_breadcrumbs__list_xrrvy_8";
12
+ const styles = {
13
+ breadcrumbs,
14
+ breadcrumbs__list,
15
+ "breadcrumbs__list-item": "_breadcrumbs__list-item_xrrvy_20",
16
+ "breadcrumbs__overflow-list": "_breadcrumbs__overflow-list_xrrvy_30",
17
+ "breadcrumbs__list-separator": "_breadcrumbs__list-separator_xrrvy_82"
18
+ };
19
+ function BreadcrumbItem({
20
+ as = Link,
21
+ isCurrent = false,
22
+ foregroundColor = "default",
23
+ "data-parent": dataParent,
24
+ children,
25
+ ...props
26
+ }) {
27
+ const className = foregroundColorVariants({
28
+ foregroundColor
29
+ });
30
+ const itemProps = mergeProps(props, {
31
+ className
32
+ });
33
+ const itemElement = React__default.createElement(as, itemProps, children);
34
+ return /* @__PURE__ */ jsx("li", { className: styles["breadcrumbs__list-item"], "data-parent": dataParent, children: isCurrent ? /* @__PURE__ */ jsx("span", { "aria-current": "page", className, children }) : itemElement });
35
+ }
36
+ const SeparatorItem = ({
37
+ color
38
+ }) => {
39
+ return /* @__PURE__ */ jsx("li", { className: styles["breadcrumbs__list-separator"], "aria-hidden": true, children: /* @__PURE__ */ jsx(Icon, { iconName: "chevron-right", iconSize: "0.75x", size: "sm", color }) });
40
+ };
41
+ const OverflowMenu = ({
42
+ children,
43
+ buttonStyleVariant = "neutral",
44
+ ...props
45
+ }) => {
46
+ return /* @__PURE__ */ jsx("li", { className: styles["breadcrumbs__list-item"], children: /* @__PURE__ */ jsxs(Menu, { shouldFlip: true, "aria-label": `${props["aria-label"]} menu`, children: [
47
+ /* @__PURE__ */ jsx(Menu.Trigger, { children: /* @__PURE__ */ jsx(IconButton, { emphasis: "quaternary", iconProps: {
48
+ iconName: "ellipsis"
49
+ }, "aria-label": `${props["aria-label"]} menu button`, size: "sm", styleVariant: buttonStyleVariant }) }),
50
+ /* @__PURE__ */ jsx("ol", { className: styles["breadcrumbs__overflow-list"], children })
51
+ ] }) });
52
+ };
53
+ const CURRENT_ITEM_WHITE_FOREGROUND_COLORS = ["accentOnVibrant", "accentOnVibrantAccent", "accentOnDeep", "criticalOnVibrant", "warningOnVibrant", "successOnVibrant", "informationOnVibrant", "inversePrimary", "inverseOnVibrant", "whitePrimary", "whiteOnSubtle", "disabledOnVibrant", "saleOnVibrant"];
54
+ const getDefaultCurrentItemColour = (foregroundColor) => CURRENT_ITEM_WHITE_FOREGROUND_COLORS.includes(foregroundColor) ? "whitePrimary" : "secondary";
55
+ const Breadcrumbs = forwardRef((props, forwardedRef) => {
56
+ const {
57
+ navProps
58
+ } = useBreadcrumbs(props);
59
+ const {
60
+ as = Link,
61
+ children,
62
+ maxItems = 4,
63
+ itemForegroundColor = "primary",
64
+ separatorForegroundColor = itemForegroundColor,
65
+ buttonStyleVariant = "neutral",
66
+ hasCurrentItem = true,
67
+ disableAutomaticOverflow = false
68
+ } = props;
69
+ const ariaLabel = (props == null ? void 0 : props["aria-label"]) || "Breadcrumb";
70
+ const navRef = useObjectRef(forwardedRef);
71
+ const itemsArray = Children.toArray(children);
72
+ let items = itemsArray.map((child, index) => {
73
+ var _a, _b, _c;
74
+ const item = child;
75
+ const itemColor = ((_a = item.props) == null ? void 0 : _a.isCurrent) ? getDefaultCurrentItemColour(itemForegroundColor) : itemForegroundColor;
76
+ const iconEndProps = ((_b = item.props) == null ? void 0 : _b.iconEndProps) || false;
77
+ return React__default.cloneElement(item, {
78
+ as,
79
+ "data-parent": index === itemsArray.length - 2 || void 0,
80
+ iconEndProps: as === Link ? iconEndProps : void 0,
81
+ foregroundColor: ((_c = item.props) == null ? void 0 : _c.foregroundColor) || itemColor,
82
+ ...item.props
83
+ });
84
+ });
85
+ if (!hasCurrentItem) {
86
+ items = items.filter((item) => {
87
+ var _a;
88
+ return !((_a = item == null ? void 0 : item.props) == null ? void 0 : _a.isCurrent);
89
+ });
90
+ }
91
+ const itemCount = items.length;
92
+ const shouldOverflowMaxItems = itemCount > maxItems;
93
+ const [hasOverflow, setHasOverflow] = useState(false);
94
+ const [breadcrumbsWidth, setBreadcrumbsWidth] = useState(-1);
95
+ const shouldOverflowAutomatically = !disableAutomaticOverflow && breadcrumbsWidth > 0 && hasOverflow;
96
+ const checkForOverflow = (element) => {
97
+ if (!navRef.current) return;
98
+ const parentWidth = element.contentRect.width;
99
+ setHasOverflow(parentWidth <= breadcrumbsWidth);
100
+ };
101
+ useLayoutEffect(() => {
102
+ if (!navRef.current || disableAutomaticOverflow) return;
103
+ setBreadcrumbsWidth(navRef.current.clientWidth);
104
+ }, [navRef.current]);
105
+ useLayoutEffect(() => {
106
+ if (!navRef.current || disableAutomaticOverflow) return;
107
+ const observer = new ResizeObserver((entries) => {
108
+ entries.forEach((entry) => {
109
+ checkForOverflow(entry);
110
+ });
111
+ });
112
+ const parent = navRef.current.parentNode;
113
+ observer.observe(parent);
114
+ return () => {
115
+ observer.disconnect();
116
+ };
117
+ }, [navRef.current]);
118
+ const shouldOverflow = itemCount > 2 && (shouldOverflowMaxItems || shouldOverflowAutomatically);
119
+ const visibleItems = shouldOverflow ? [/* @__PURE__ */ jsx(OverflowMenu, { buttonStyleVariant, "aria-label": ariaLabel, children: items.slice(0, -2) }, "overflow"), items[itemCount - 2], items[itemCount - 1]] : items;
120
+ const breadcrumbItems = visibleItems.flatMap((child, index) => {
121
+ return index === visibleItems.length - 1 ? child : [child, /* @__PURE__ */ jsx(SeparatorItem, { color: separatorForegroundColor }, `separator-${index}`)];
122
+ });
123
+ return /* @__PURE__ */ jsx("nav", { ...navProps, className: styles.breadcrumbs, "aria-label": ariaLabel, ref: navRef, children: /* @__PURE__ */ jsx("ol", { className: styles["breadcrumbs__list"], children: breadcrumbItems }) });
124
+ });
125
+ Breadcrumbs.displayName = "Breadcrumbs";
126
+ Breadcrumbs.Item = BreadcrumbItem;
127
+ export {
128
+ BreadcrumbItem,
129
+ Breadcrumbs,
130
+ Breadcrumbs as default
131
+ };
132
+ //# sourceMappingURL=Breadcrumbs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Breadcrumbs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,2 @@
1
+ export { default } from './Breadcrumbs';
2
+ export type * from './Breadcrumbs';
@@ -0,0 +1,5 @@
1
+ import { Breadcrumbs } from "./Breadcrumbs.js";
2
+ export {
3
+ Breadcrumbs as default
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -9,8 +9,9 @@ export interface CalloutBannerBaseProps {
9
9
  title: string;
10
10
  /**
11
11
  * Optional secondary text providing more details
12
+ * Can be a string or React node
12
13
  */
13
- description?: string;
14
+ description?: string | React.ReactNode;
14
15
  /**
15
16
  * Optional emphasis style for the banner
16
17
  * @default 'primary'
@@ -105,6 +105,10 @@ const CalloutBanner = ({
105
105
  const descriptionId = React__default.useId();
106
106
  const resolvedSeverityLabel = severityLabel ?? defaultSeverityLabel;
107
107
  const resolvedRole = role || bannerRole;
108
+ const renderDescriptionContent = () => {
109
+ if (!description) return null;
110
+ return description;
111
+ };
108
112
  return /* @__PURE__ */ jsxs("div", { className: calloutBanner({
109
113
  emphasis,
110
114
  styleVariant
@@ -129,7 +133,7 @@ const CalloutBanner = ({
129
133
  ] }),
130
134
  /* @__PURE__ */ jsx("bdi", { dir: "auto", children: title })
131
135
  ] }),
132
- description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: styles["calloutBanner__meta-description"], children: description })
136
+ description && /* @__PURE__ */ jsx("p", { id: descriptionId, className: styles["calloutBanner__meta-description"], children: renderDescriptionContent() })
133
137
  ] }) }),
134
138
  label && /* @__PURE__ */ jsx("div", { className: styles["calloutBanner__meta-label"], children: label })
135
139
  ] })
@@ -1 +1 @@
1
- {"version":3,"file":"CalloutBanner.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CalloutBanner.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -9,26 +9,26 @@ import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
9
9
  import { useFocusRing } from "@react-aria/focus";
10
10
  import { resolveResponsiveProp } from "../../utils/breakpoint/responsive.js";
11
11
  import { useBreakpoint } from "../../utils/breakpoint/hooks/useBreakpoint.js";
12
- import '../../assets/Carousel.css';const carouselWrapper = "_carouselWrapper_1bise_2";
13
- const showPartialItems = "_showPartialItems_1bise_14";
14
- const carousel$1 = "_carousel_1bise_2";
15
- const hasScrollPadding = "_hasScrollPadding_1bise_25";
16
- const scroller = "_scroller_1bise_43";
17
- const item = "_item_1bise_84";
18
- const slideLeft = "_slideLeft_1bise_122";
19
- const slideRight = "_slideRight_1bise_126";
20
- const controls = "_controls_1bise_149";
21
- const defaultPrevButton = "_defaultPrevButton_1bise_160";
22
- const defaultNextButton = "_defaultNextButton_1bise_168";
23
- const defaultDotsContainer = "_defaultDotsContainer_1bise_177";
24
- const defaultCarouselWrapper = "_defaultCarouselWrapper_1bise_188";
25
- const autoplayControlWrapper = "_autoplayControlWrapper_1bise_195";
26
- const defaultAutoplayControl = "_defaultAutoplayControl_1bise_195";
27
- const showOnHover = "_showOnHover_1bise_204";
28
- const hidden = "_hidden_1bise_214";
29
- const hiddenTabs = "_hiddenTabs_1bise_245";
30
- const infinite = "_infinite_1bise_264";
31
- const native = "_native_1bise_269";
12
+ import '../../assets/Carousel.css';const carouselWrapper = "_carouselWrapper_16uhe_2";
13
+ const showPartialItems = "_showPartialItems_16uhe_14";
14
+ const carousel$1 = "_carousel_16uhe_2";
15
+ const hasScrollPadding = "_hasScrollPadding_16uhe_25";
16
+ const scroller = "_scroller_16uhe_43";
17
+ const item = "_item_16uhe_84";
18
+ const slideLeft = "_slideLeft_16uhe_122";
19
+ const slideRight = "_slideRight_16uhe_126";
20
+ const controls = "_controls_16uhe_149";
21
+ const defaultPrevButton = "_defaultPrevButton_16uhe_160";
22
+ const defaultNextButton = "_defaultNextButton_16uhe_168";
23
+ const defaultDotsContainer = "_defaultDotsContainer_16uhe_177";
24
+ const defaultCarouselWrapper = "_defaultCarouselWrapper_16uhe_188";
25
+ const defaultAutoplayControl = "_defaultAutoplayControl_16uhe_195";
26
+ const showOnHover = "_showOnHover_16uhe_204";
27
+ const hidden = "_hidden_16uhe_214";
28
+ const hiddenTabs = "_hiddenTabs_16uhe_245";
29
+ const infinite = "_infinite_16uhe_264";
30
+ const native = "_native_16uhe_269";
31
+ const autoplayControlWrapper = "_autoplayControlWrapper_16uhe_273";
32
32
  const styles = {
33
33
  carouselWrapper,
34
34
  showPartialItems,
@@ -43,13 +43,13 @@ const styles = {
43
43
  defaultNextButton,
44
44
  defaultDotsContainer,
45
45
  defaultCarouselWrapper,
46
- autoplayControlWrapper,
47
46
  defaultAutoplayControl,
48
47
  showOnHover,
49
48
  hidden,
50
49
  hiddenTabs,
51
50
  infinite,
52
- native
51
+ native,
52
+ autoplayControlWrapper
53
53
  };
54
54
  const carousel = cva(styles.carousel, {
55
55
  variants: {
@@ -357,7 +357,7 @@ const Carousel = ({
357
357
  focusStyle
358
358
  })}`, ...focusProps, "data-focused": isFocusVisible ? true : void 0, "data-focus-visible": isFocusVisible ? true : void 0, "data-transitioning": isTransitioning ? "true" : void 0, style: getScrollerStyles(), tabIndex: 0, role: "region", "aria-label": "Carousel content", onKeyDown: handleCarouselKeyDown, children: items.map((child, index) => {
359
359
  const isActiveItem = activeItemIndices.includes(index);
360
- const itemClasses = [styles.item, itemWrapperClassName || "", isActiveItem && activeItemClassName ? activeItemClassName : ""].filter(Boolean).join(" ");
360
+ const itemClasses = [itemWrapperClassName || "", styles.item, isActiveItem && activeItemClassName ? activeItemClassName : ""].filter(Boolean).join(" ");
361
361
  return /* @__PURE__ */ jsx(CarouselItem, { className: itemClasses, "data-is-active": isActiveItem ? "true" : void 0, "data-item-index": index, "aria-label": `Slide ${index + 1} of ${totalItems}`, children: child }, index);
362
362
  }) }),
363
363
  /* @__PURE__ */ jsxs("div", { className: `${styles.controls} ${showArrowsOnHover ? styles.showOnHover : ""}`, children: [
@@ -4,17 +4,17 @@ import { e as CarouselButton$1, i as iconButtonStyles } from "../../../IconButto
4
4
  import { useFocusRing } from "@react-aria/focus";
5
5
  import { focusStyleVariants } from "../../../utils/focus/focusStyles.js";
6
6
  import { Icon } from "../../Icon/Icon.js";
7
- import '../../../assets/CarouselButton.css';const arrowContainer = "_arrowContainer_1j6wm_1";
8
- const iconButton = "_iconButton_1j6wm_20";
9
- const hideDisabledArrow = "_hideDisabledArrow_1j6wm_26";
10
- const neutral = "_neutral_1j6wm_32";
11
- const white = "_white_1j6wm_44";
12
- const shapeFlat = "_shapeFlat_1j6wm_62";
13
- const shapeElevated = "_shapeElevated_1j6wm_75";
14
- const gradient = "_gradient_1j6wm_99";
15
- const next = "_next_1j6wm_106";
16
- const fullHeight = "_fullHeight_1j6wm_140";
17
- const prev = "_prev_1j6wm_151";
7
+ import '../../../assets/CarouselButton.css';const arrowContainer = "_arrowContainer_x58j2_1";
8
+ const iconButton = "_iconButton_x58j2_19";
9
+ const hideDisabledArrow = "_hideDisabledArrow_x58j2_25";
10
+ const neutral = "_neutral_x58j2_31";
11
+ const white = "_white_x58j2_43";
12
+ const shapeFlat = "_shapeFlat_x58j2_61";
13
+ const shapeElevated = "_shapeElevated_x58j2_74";
14
+ const gradient = "_gradient_x58j2_98";
15
+ const next = "_next_x58j2_105";
16
+ const fullHeight = "_fullHeight_x58j2_139";
17
+ const prev = "_prev_x58j2_150";
18
18
  const styles = {
19
19
  arrowContainer,
20
20
  iconButton,
@@ -3,12 +3,12 @@ import { useRef } from "react";
3
3
  import { useFocusRing } from "@react-aria/focus";
4
4
  import { useHover } from "@react-aria/interactions";
5
5
  import { focusStyleVariants } from "../../../utils/focus/focusStyles.js";
6
- import '../../../assets/CarouselDots.css';const tabsContainer = "_tabsContainer_1aqyc_1";
7
- const tabs = "_tabs_1aqyc_1";
8
- const transparent = "_transparent_1aqyc_21";
9
- const dotsScroller = "_dotsScroller_1aqyc_25";
10
- const tab = "_tab_1aqyc_1";
11
- const activeTab = "_activeTab_1aqyc_52";
6
+ import '../../../assets/CarouselDots.css';const tabsContainer = "_tabsContainer_nzxrr_1";
7
+ const tabs = "_tabs_nzxrr_1";
8
+ const transparent = "_transparent_nzxrr_20";
9
+ const dotsScroller = "_dotsScroller_nzxrr_24";
10
+ const tab = "_tab_nzxrr_1";
11
+ const activeTab = "_activeTab_nzxrr_51";
12
12
  const styles = {
13
13
  tabsContainer,
14
14
  tabs,
@@ -1,6 +1,6 @@
1
1
  import { default as React } from 'react';
2
2
  import { ValidationError } from '@react-types/shared';
3
- import { CheckboxProps as AriaCheckboxProps } from 'react-aria-components';
3
+ import { ValidationResult, CheckboxProps as AriaCheckboxProps } from 'react-aria-components';
4
4
  export interface CheckboxProps extends AriaCheckboxProps {
5
5
  /** The label of the checkbox, can be a string or a React node. */
6
6
  label?: string | React.ReactNode;
@@ -33,9 +33,28 @@ export interface CheckboxProps extends AriaCheckboxProps {
33
33
  * @default 'aria'
34
34
  */
35
35
  validationBehavior?: 'native' | 'aria';
36
+ /** Description text for the checkbox */
36
37
  description?: string;
38
+ /** Alternate way to provide label content */
37
39
  children?: React.ReactNode;
40
+ /** Focus style variant */
38
41
  focusStyle?: 'default' | 'white';
42
+ /**
43
+ * Error message to display when the checkbox is invalid
44
+ * Can be a static string or a function that returns an error message
45
+ * @default undefined
46
+ */
47
+ errorMessage?: string | ((validation: ValidationResult) => string);
48
+ /**
49
+ * Prefix text for screen readers only in error messages
50
+ * @default 'Error:'
51
+ */
52
+ errorPrefix?: string;
53
+ /**
54
+ * Custom test ID for testing purposes
55
+ * @default undefined
56
+ */
57
+ testId?: string;
39
58
  }
40
- export declare const Checkbox: ({ label, isIndeterminate, defaultSelected, isSelected, value, isDisabled, isReadOnly, isRequired, isInvalid, validate, autoFocus, name, validationBehavior, description, children, focusStyle, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
59
+ export declare const Checkbox: ({ label, isIndeterminate, defaultSelected, isSelected, value, isDisabled, isReadOnly, isRequired, isInvalid, validate, autoFocus, name, validationBehavior, description, children, errorMessage, errorPrefix, testId, focusStyle, ...props }: CheckboxProps) => import("react/jsx-runtime").JSX.Element;
41
60
  export default Checkbox;
@@ -1,15 +1,18 @@
1
1
  import { jsxs, jsx, Fragment } from "react/jsx-runtime";
2
+ import { useId, useMemo } from "react";
2
3
  import { Checkbox as Checkbox$1 } from "react-aria-components";
3
4
  import { c as cva } from "../../index-DdUYounA.js";
4
5
  import FieldDescription from "../FieldDescription/FieldDescription.js";
5
- import '../../assets/Checkbox.css';const checkbox$1 = "_checkbox_1twm2_2";
6
- const checkboxContainer = "_checkboxContainer_1twm2_19";
7
- const checkboxLabel = "_checkboxLabel_1twm2_24";
8
- const checkboxDescription = "_checkboxDescription_1twm2_28";
9
- const checkboxSvgWrapper = "_checkboxSvgWrapper_1twm2_32";
10
- const svg = "_svg_1twm2_46";
11
- const defaultFocus = "_defaultFocus_1twm2_74";
12
- const whiteFocus = "_whiteFocus_1twm2_78";
6
+ import { FieldError } from "../FieldError/FieldError.js";
7
+ import '../../assets/Checkbox.css';const checkbox$1 = "_checkbox_dtluy_2";
8
+ const checkboxContainer = "_checkboxContainer_dtluy_26";
9
+ const checkboxLabel = "_checkboxLabel_dtluy_31";
10
+ const checkboxDescription = "_checkboxDescription_dtluy_35";
11
+ const checkboxSvgWrapper = "_checkboxSvgWrapper_dtluy_40";
12
+ const svg = "_svg_dtluy_54";
13
+ const defaultFocus = "_defaultFocus_dtluy_82";
14
+ const whiteFocus = "_whiteFocus_dtluy_86";
15
+ const checkboxLabelWrapper = "_checkboxLabelWrapper_dtluy_180";
13
16
  const styles = {
14
17
  checkbox: checkbox$1,
15
18
  checkboxContainer,
@@ -18,7 +21,15 @@ const styles = {
18
21
  checkboxSvgWrapper,
19
22
  svg,
20
23
  defaultFocus,
21
- whiteFocus
24
+ whiteFocus,
25
+ checkboxLabelWrapper
26
+ };
27
+ const DEFAULT_VALIDATION_RESULT = {
28
+ isInvalid: true,
29
+ validationErrors: ["Invalid"],
30
+ validationDetails: {
31
+ valid: false
32
+ }
22
33
  };
23
34
  const checkbox = cva(styles.checkbox, {
24
35
  variants: {
@@ -47,19 +58,36 @@ const Checkbox = ({
47
58
  validationBehavior,
48
59
  description,
49
60
  children,
61
+ errorMessage,
62
+ errorPrefix = "Error:",
63
+ testId,
50
64
  focusStyle = "default",
51
65
  ...props
52
66
  }) => {
67
+ const errorId = useId();
68
+ const descriptionId = useId();
69
+ const resolvedErrorMessage = useMemo(() => {
70
+ if (!isInvalid) return null;
71
+ if (typeof errorMessage === "function") {
72
+ return errorMessage(DEFAULT_VALIDATION_RESULT);
73
+ }
74
+ return errorMessage;
75
+ }, [errorMessage, isInvalid]);
76
+ const describedById = [description ? descriptionId : null, isInvalid && resolvedErrorMessage ? errorId : null].filter(Boolean).join(" ");
77
+ const labelContent = label || children;
53
78
  return /* @__PURE__ */ jsxs("div", { className: styles.checkboxContainer, children: [
54
- /* @__PURE__ */ jsx(Checkbox$1, { className: checkbox({
55
- focusStyle
56
- }), isIndeterminate, defaultSelected, isSelected, value, isDisabled, isReadOnly, isRequired, isInvalid, validate, autoFocus, name, validationBehavior, ...props, children: ({
57
- isIndeterminate: isIndeterminate2
58
- }) => /* @__PURE__ */ jsxs(Fragment, { children: [
59
- /* @__PURE__ */ jsx("div", { className: `${styles.checkboxSvgWrapper}`, "data-disabled": isDisabled, children: /* @__PURE__ */ jsx("svg", { className: styles.svg, viewBox: "0 0 18 18", "aria-hidden": "true", children: isIndeterminate2 ? /* @__PURE__ */ jsx("rect", { x: 1, y: 7.5, width: 15, height: 3 }) : /* @__PURE__ */ jsx("polyline", { points: "1 9 7 14 15 4" }) }) }),
60
- label || children ? /* @__PURE__ */ jsx("span", { className: styles.checkboxLabel, children: label || children }) : null
61
- ] }) }),
62
- description && /* @__PURE__ */ jsx(FieldDescription, { className: styles.checkboxDescription, children: description })
79
+ isInvalid && resolvedErrorMessage && /* @__PURE__ */ jsx(FieldError, { id: errorId, errorPrefix, isInvalid, children: resolvedErrorMessage }),
80
+ /* @__PURE__ */ jsxs("div", { className: styles.checkboxLabelWrapper, children: [
81
+ /* @__PURE__ */ jsx(Checkbox$1, { className: checkbox({
82
+ focusStyle
83
+ }), isIndeterminate, defaultSelected, isSelected, value, isDisabled, isReadOnly, isRequired, isInvalid, validate, autoFocus, name, validationBehavior, "aria-describedby": describedById || void 0, ...props, children: ({
84
+ isIndeterminate: isIndeterminate2
85
+ }) => /* @__PURE__ */ jsxs(Fragment, { children: [
86
+ /* @__PURE__ */ jsx("div", { className: `${styles.checkboxSvgWrapper}`, "data-disabled": isDisabled, children: /* @__PURE__ */ jsx("svg", { className: styles.svg, viewBox: "0 0 18 18", "aria-hidden": "true", children: isIndeterminate2 ? /* @__PURE__ */ jsx("rect", { x: 1, y: 7.5, width: 15, height: 3 }) : /* @__PURE__ */ jsx("polyline", { points: "1 9 7 14 15 4" }) }) }),
87
+ labelContent ? /* @__PURE__ */ jsx("span", { className: styles.checkboxLabel, children: labelContent }) : null
88
+ ] }) }),
89
+ description && /* @__PURE__ */ jsx(FieldDescription, { id: descriptionId, className: styles.checkboxDescription, children: description })
90
+ ] })
63
91
  ] });
64
92
  };
65
93
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Checkbox.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -17,6 +17,16 @@ export interface CheckboxGroupProps extends AriaCheckboxGroupProps {
17
17
  * The error message to display when the input value is invalid.
18
18
  */
19
19
  errorMessage?: string | ((validation: ValidationResult) => string);
20
+ /**
21
+ * Prefix text for screen readers only in error messages
22
+ * @default 'Error:'
23
+ */
24
+ errorPrefix?: string;
25
+ /**
26
+ * Whether to show the error message. Defaults to true.
27
+ * @default true
28
+ */
29
+ showError?: boolean;
20
30
  /**
21
31
  * Whether the input is disabled.
22
32
  */
@@ -26,5 +36,5 @@ export interface CheckboxGroupProps extends AriaCheckboxGroupProps {
26
36
  */
27
37
  isInvalid?: boolean;
28
38
  }
29
- export declare const CheckboxGroup: ({ label, children, description, errorMessage, isDisabled, isInvalid, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
39
+ export declare const CheckboxGroup: ({ label, children, description, errorMessage, isDisabled, isInvalid, showError, errorPrefix, ...props }: CheckboxGroupProps) => import("react/jsx-runtime").JSX.Element;
30
40
  export default CheckboxGroup;
@@ -12,10 +12,13 @@ const CheckboxGroup = ({
12
12
  errorMessage,
13
13
  isDisabled,
14
14
  isInvalid,
15
+ showError = true,
16
+ // Default to true
17
+ errorPrefix = "Error:",
15
18
  ...props
16
19
  }) => {
17
20
  return /* @__PURE__ */ jsxs(CheckboxGroup$1, { className: styles.checkboxGroup, isDisabled, isInvalid, ...props, children: [
18
- /* @__PURE__ */ jsx(FieldHeader, { label, description, errorMessage, isRequired: true, isInvalid }),
21
+ /* @__PURE__ */ jsx(FieldHeader, { label, description, errorMessage, isRequired: true, isInvalid, showError, errorPrefix }),
19
22
  children
20
23
  ] });
21
24
  };
@@ -1 +1 @@
1
- {"version":3,"file":"CheckboxGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CheckboxGroup.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -21,7 +21,7 @@ const ComboBox = ({
21
21
  return /* @__PURE__ */ jsxs(Field, { as: ComboBox$1, className: styles["comboBox"], ...props, children: [
22
22
  /* @__PURE__ */ jsxs(Group, { className: styles["comboBox-group"], children: [
23
23
  /* @__PURE__ */ jsx(Input, { className: styles["comboBox-input"] }),
24
- isLoading ? /* @__PURE__ */ jsx(LoadingSpinner, { size: "1x", buttonSize: "sm", className: styles["comboBox-loading"] }) : /* @__PURE__ */ jsx(Button, { className: styles.comboBoxButton, isDisabled: props == null ? void 0 : props.isDisabled, children: /* @__PURE__ */ jsx(Icon, { iconName: "angles-up-down", iconPrefix: "fas", padding: "roomy", scale: "1x" }) })
24
+ isLoading ? /* @__PURE__ */ jsx(LoadingSpinner, { size: "1.25x", className: styles["comboBox-loading"] }) : /* @__PURE__ */ jsx(Button, { className: styles.comboBoxButton, isDisabled: props == null ? void 0 : props.isDisabled, children: /* @__PURE__ */ jsx(Icon, { iconName: "angles-up-down", iconPrefix: "fas", padding: "roomy", scale: "1x" }) })
25
25
  ] }),
26
26
  /* @__PURE__ */ jsx(Popover, { className: styles["comboBox-popover"], children })
27
27
  ] });
@@ -49,6 +49,11 @@ export interface DialogProps extends AriaDialogProps {
49
49
  * @default false
50
50
  */
51
51
  removePadding?: boolean;
52
+ /**
53
+ * Custom z-index for the dialog wrapper
54
+ * @default 99 (from CSS)
55
+ */
56
+ zIndex?: number;
52
57
  }
53
58
  export interface DialogComposition {
54
59
  Header: typeof DialogHeader;
@@ -4,18 +4,18 @@ import { IconButton } from "../IconButton/IconButton.js";
4
4
  import { OverlayContainer, useOverlay, usePreventScroll, useModal } from "@react-aria/overlays";
5
5
  import { useDialog } from "@react-aria/dialog";
6
6
  import { FocusScope } from "@react-aria/focus";
7
- import '../../assets/Dialog.css';const dialogWrapper = "_dialogWrapper_yj1df_1";
8
- const overlay = "_overlay_yj1df_10";
9
- const dialog = "_dialog_yj1df_1";
10
- const noPadding = "_noPadding_yj1df_30";
11
- const dialogContent = "_dialogContent_yj1df_59";
12
- const dialogHeading = "_dialogHeading_yj1df_66";
13
- const dialogContentInner = "_dialogContentInner_yj1df_70";
14
- const noHeader = "_noHeader_yj1df_76";
15
- const closeButton = "_closeButton_yj1df_80";
16
- const dialogSmall = "_dialogSmall_yj1df_106";
17
- const dialogMedium = "_dialogMedium_yj1df_110";
18
- const dialogLarge = "_dialogLarge_yj1df_114";
7
+ import '../../assets/Dialog.css';const dialogWrapper = "_dialogWrapper_1i48s_1";
8
+ const overlay = "_overlay_1i48s_10";
9
+ const dialog = "_dialog_1i48s_1";
10
+ const noPadding = "_noPadding_1i48s_30";
11
+ const dialogContent = "_dialogContent_1i48s_59";
12
+ const dialogHeading = "_dialogHeading_1i48s_66";
13
+ const dialogContentInner = "_dialogContentInner_1i48s_70";
14
+ const noHeader = "_noHeader_1i48s_76";
15
+ const closeButton = "_closeButton_1i48s_80";
16
+ const dialogSmall = "_dialogSmall_1i48s_106";
17
+ const dialogMedium = "_dialogMedium_1i48s_110";
18
+ const dialogLarge = "_dialogLarge_1i48s_114";
19
19
  const styles = {
20
20
  dialogWrapper,
21
21
  overlay,
@@ -31,9 +31,7 @@ const styles = {
31
31
  dialogLarge
32
32
  };
33
33
  const DialogHeader = ({
34
- /** ID used to reference this header for aria-labelledby */
35
34
  id,
36
- /** Content of the header section */
37
35
  children
38
36
  }) => {
39
37
  return /* @__PURE__ */ jsx("div", { className: styles.dialogHeading, id, children });
@@ -45,10 +43,7 @@ const DialogContent = ({
45
43
  };
46
44
  DialogHeader.displayName = "Dialog.Header";
47
45
  DialogContent.displayName = "Dialog.Content";
48
- function DialogWrapper({
49
- children,
50
- ...props
51
- }) {
46
+ function DialogWrapper(props) {
52
47
  const {
53
48
  onClose,
54
49
  size = "dialogMedium",
@@ -57,7 +52,9 @@ function DialogWrapper({
57
52
  dismissButtonLabel = "Close dialog",
58
53
  role = "dialog",
59
54
  id,
60
- removePadding = false
55
+ removePadding = false,
56
+ zIndex,
57
+ children
61
58
  } = props;
62
59
  const ref = useRef(null);
63
60
  const {
@@ -85,7 +82,10 @@ function DialogWrapper({
85
82
  const headerId = props["aria-labelledby"] || `${id}-header`;
86
83
  const contentId = props["aria-describedby"] || `${id}-content`;
87
84
  const dialogClasses = [styles.dialog, styles[size], removePadding ? styles.noPadding : ""].filter(Boolean).join(" ");
88
- return /* @__PURE__ */ jsxs("div", { className: `${styles.dialogWrapper} ${modal ? styles.modal : ""}`, children: [
85
+ const wrapperStyle = zIndex !== void 0 ? {
86
+ zIndex
87
+ } : {};
88
+ return /* @__PURE__ */ jsxs("div", { className: `${styles.dialogWrapper} ${modal ? styles.modal : ""}`, style: wrapperStyle, children: [
89
89
  modal && /* @__PURE__ */ jsx("div", { className: styles.overlay, ...underlayProps, onClick: onClose, "aria-hidden": "true" }),
90
90
  /* @__PURE__ */ jsx(FocusScope, { contain: true, restoreFocus: true, autoFocus: false, children: /* @__PURE__ */ jsxs("div", { ...overlayProps, ...dialogProps, ...modalProps, ref, className: dialogClasses, "data-size": size, id, role, "aria-labelledby": headerId, "aria-describedby": contentId, children: [
91
91
  /* @__PURE__ */ jsxs("div", { className: `${styles.dialogContent} ${!hasHeader ? styles.noHeader : ""}`, children: [
@@ -1,10 +1,28 @@
1
- import { FieldErrorProps as AriaFieldErrorProps } from 'react-aria-components';
2
- export interface FieldErrorProps extends AriaFieldErrorProps {
3
- children?: React.ReactNode | any;
1
+ import { default as React } from 'react';
2
+ import { FieldErrorProps as AriaFieldErrorProps, ValidationResult } from 'react-aria-components';
3
+ export interface FieldErrorProps extends Omit<AriaFieldErrorProps, 'children' | 'className'> {
4
4
  /**
5
- * Whether the field is invalid.
5
+ * Error message content
6
+ * Can be a static string or a function that returns an error message
7
+ */
8
+ children?: React.ReactNode | ((validation: ValidationResult) => string);
9
+ /**
10
+ * Prefix text for screen readers
11
+ * @default 'Error:'
12
+ */
13
+ errorPrefix?: string;
14
+ /**
15
+ * Label of the field to include in the error prefix
16
+ */
17
+ fieldLabel?: string;
18
+ /**
19
+ * Explicitly mark the field as invalid
6
20
  */
7
21
  isInvalid?: boolean;
22
+ /**
23
+ * CSS class name for the error
24
+ */
25
+ className?: string;
8
26
  }
9
- export declare const FieldError: ({ children, isInvalid: isInvalidProp, ...props }: FieldErrorProps) => import("react/jsx-runtime").JSX.Element;
27
+ export declare const FieldError: ({ children, errorPrefix, fieldLabel, isInvalid, className, ...props }: FieldErrorProps) => import("react/jsx-runtime").JSX.Element;
10
28
  export default FieldError;