@alto-avios/alto-ui 2.4.0 → 3.1.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 (235) hide show
  1. package/README.md +13 -0
  2. package/dist/assets/AviosCurrencySymbol.css +1 -0
  3. package/dist/assets/Badge.css +1 -1
  4. package/dist/assets/Button.css +1 -1
  5. package/dist/assets/CardSection.css +1 -1
  6. package/dist/assets/CreditCardNumberField.css +1 -0
  7. package/dist/assets/DateField.css +1 -1
  8. package/dist/assets/DetailsDisclosure.css +1 -0
  9. package/dist/assets/Dialog.css +1 -0
  10. package/dist/assets/Fieldset.css +1 -0
  11. package/dist/assets/FieldsetHeader.css +1 -0
  12. package/dist/assets/Form.css +1 -0
  13. package/dist/assets/Icon.css +1 -0
  14. package/dist/assets/IconBackdrop.css +1 -0
  15. package/dist/assets/IconButton.css +1 -1
  16. package/dist/assets/Image.css +1 -0
  17. package/dist/assets/Link.css +1 -1
  18. package/dist/assets/NumberField.css +1 -1
  19. package/dist/assets/PasswordField.css +1 -0
  20. package/dist/assets/PhoneNumberField.css +1 -0
  21. package/dist/assets/Popover.css +1 -0
  22. package/dist/assets/Section.css +1 -1
  23. package/dist/assets/SelectNative.css +1 -0
  24. package/dist/assets/Slider.css +1 -0
  25. package/dist/assets/Switch.css +1 -0
  26. package/dist/assets/TextAreaField.css +1 -1
  27. package/dist/assets/ToggleButton.css +1 -1
  28. package/dist/assets/ToggleIconButton.css +1 -1
  29. package/dist/assets/backgroundColor.css +1 -0
  30. package/dist/assets/flex.css +1 -1
  31. package/dist/assets/focusStyles.css +1 -1
  32. package/dist/assets/foregroundColor.css +1 -0
  33. package/dist/assets/global.css +1 -1
  34. package/dist/assets/padding.css +1 -1
  35. package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.d.ts +25 -0
  36. package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js +80 -0
  37. package/dist/components/AviosCurrencySymbol/AviosCurrencySymbol.js.map +1 -0
  38. package/dist/components/AviosCurrencySymbol/index.d.ts +1 -0
  39. package/dist/components/AviosCurrencySymbol/index.js +5 -0
  40. package/dist/components/Badge/Badge.js +11 -11
  41. package/dist/components/Box/Box.d.ts +21 -2
  42. package/dist/components/Box/Box.js +16 -4
  43. package/dist/components/Box/Box.js.map +1 -1
  44. package/dist/components/Button/Button.d.ts +128 -36
  45. package/dist/components/Button/Button.js +129 -66
  46. package/dist/components/Button/Button.js.map +1 -1
  47. package/dist/components/CardSection/CardSection.d.ts +12 -6
  48. package/dist/components/CardSection/CardSection.js +9 -7
  49. package/dist/components/CardSection/CardSection.js.map +1 -1
  50. package/dist/components/Checkbox/Checkbox.d.ts +3 -1
  51. package/dist/components/Checkbox/Checkbox.js +1 -1
  52. package/dist/components/ClearFieldButton/ClearFieldButton.d.ts +4 -6
  53. package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +29 -0
  54. package/dist/components/CreditCardNumberField/CreditCardNumberField.js +45 -0
  55. package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -0
  56. package/dist/components/CreditCardNumberField/index.d.ts +1 -0
  57. package/dist/components/CreditCardNumberField/index.js +5 -0
  58. package/dist/components/CreditCardNumberField/index.js.map +1 -0
  59. package/dist/components/DateField/DateField.d.ts +4 -24
  60. package/dist/components/DateField/DateField.js +7 -19
  61. package/dist/components/DateField/DateField.js.map +1 -1
  62. package/dist/components/DetailsDisclosure/DetailsDisclosure.d.ts +33 -0
  63. package/dist/components/DetailsDisclosure/DetailsDisclosure.js +39 -0
  64. package/dist/components/DetailsDisclosure/DetailsDisclosure.js.map +1 -0
  65. package/dist/components/DetailsDisclosure/index.d.ts +2 -0
  66. package/dist/components/DetailsDisclosure/index.js +5 -0
  67. package/dist/components/DetailsDisclosure/index.js.map +1 -0
  68. package/dist/components/Dialog/Dialog.d.ts +46 -0
  69. package/dist/components/Dialog/Dialog.js +117 -0
  70. package/dist/components/Dialog/Dialog.js.map +1 -0
  71. package/dist/components/Dialog/index.d.ts +1 -0
  72. package/dist/components/Dialog/index.js +5 -0
  73. package/dist/components/Dialog/index.js.map +1 -0
  74. package/dist/components/FieldError/FieldError.d.ts +1 -1
  75. package/dist/components/FieldError/FieldError.js +11 -8
  76. package/dist/components/FieldError/FieldError.js.map +1 -1
  77. package/dist/components/FieldHeader/index.d.ts +1 -0
  78. package/dist/components/Fieldset/Fieldset.d.ts +18 -0
  79. package/dist/components/Fieldset/Fieldset.js +24 -0
  80. package/dist/components/Fieldset/Fieldset.js.map +1 -0
  81. package/dist/components/Fieldset/index.d.ts +2 -0
  82. package/dist/components/Fieldset/index.js +5 -0
  83. package/dist/components/Fieldset/index.js.map +1 -0
  84. package/dist/components/FieldsetHeader/FieldsetHeader.d.ts +7 -0
  85. package/dist/components/FieldsetHeader/FieldsetHeader.js +21 -0
  86. package/dist/components/FieldsetHeader/FieldsetHeader.js.map +1 -0
  87. package/dist/components/FieldsetHeader/index.d.ts +1 -0
  88. package/dist/components/FieldsetHeader/index.js +5 -0
  89. package/dist/components/FieldsetHeader/index.js.map +1 -0
  90. package/dist/components/Form/Form.d.ts +7 -0
  91. package/dist/components/Form/Form.js +17 -0
  92. package/dist/components/Form/Form.js.map +1 -0
  93. package/dist/components/Form/index.d.ts +1 -0
  94. package/dist/components/Form/index.js +5 -0
  95. package/dist/components/Form/index.js.map +1 -0
  96. package/dist/components/Heading/Heading.d.ts +26 -7
  97. package/dist/components/Heading/Heading.js +12 -5
  98. package/dist/components/Heading/Heading.js.map +1 -1
  99. package/dist/components/Icon/Icon.d.ts +30 -4
  100. package/dist/components/Icon/Icon.js +98 -5
  101. package/dist/components/Icon/Icon.js.map +1 -1
  102. package/dist/components/IconBackdrop/IconBackdrop.d.ts +24 -0
  103. package/dist/components/IconBackdrop/IconBackdrop.js +34 -0
  104. package/dist/components/IconBackdrop/IconBackdrop.js.map +1 -0
  105. package/dist/components/IconBackdrop/index.d.ts +1 -0
  106. package/dist/components/IconBackdrop/index.js +5 -0
  107. package/dist/components/IconBackdrop/index.js.map +1 -0
  108. package/dist/components/IconButton/IconButton.d.ts +13 -4
  109. package/dist/components/IconButton/IconButton.js +40 -31
  110. package/dist/components/IconButton/IconButton.js.map +1 -1
  111. package/dist/components/Image/Image.d.ts +24 -0
  112. package/dist/components/Image/Image.js +135 -0
  113. package/dist/components/Image/Image.js.map +1 -0
  114. package/dist/components/Image/index.d.ts +1 -0
  115. package/dist/components/Image/index.js +5 -0
  116. package/dist/components/Image/index.js.map +1 -0
  117. package/dist/components/Link/Link.d.ts +32 -34
  118. package/dist/components/Link/Link.js +34 -22
  119. package/dist/components/Link/Link.js.map +1 -1
  120. package/dist/components/NumberField/NumberField.d.ts +4 -34
  121. package/dist/components/NumberField/NumberField.js +11 -19
  122. package/dist/components/NumberField/NumberField.js.map +1 -1
  123. package/dist/components/Paragraph/Paragraph.d.ts +9 -5
  124. package/dist/components/Paragraph/Paragraph.js +9 -4
  125. package/dist/components/Paragraph/Paragraph.js.map +1 -1
  126. package/dist/components/PasswordField/PasswordField.d.ts +30 -0
  127. package/dist/components/PasswordField/PasswordField.js +104 -0
  128. package/dist/components/PasswordField/PasswordField.js.map +1 -0
  129. package/dist/components/PasswordField/index.d.ts +1 -0
  130. package/dist/components/PasswordField/index.js +5 -0
  131. package/dist/components/PasswordField/index.js.map +1 -0
  132. package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +53 -0
  133. package/dist/components/PhoneNumberField/PhoneNumberField.js +91 -0
  134. package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -0
  135. package/dist/components/PhoneNumberField/index.d.ts +3 -0
  136. package/dist/components/PhoneNumberField/index.js +7 -0
  137. package/dist/components/PhoneNumberField/index.js.map +1 -0
  138. package/dist/components/Popover/Popover.d.ts +16 -0
  139. package/dist/components/Popover/Popover.js +68 -0
  140. package/dist/components/Popover/Popover.js.map +1 -0
  141. package/dist/components/Popover/index.d.ts +1 -0
  142. package/dist/components/Popover/index.js +5 -0
  143. package/dist/components/Popover/index.js.map +1 -0
  144. package/dist/components/Section/Section.d.ts +4 -3
  145. package/dist/components/Section/Section.js +18 -13
  146. package/dist/components/Section/Section.js.map +1 -1
  147. package/dist/components/SelectNative/SelectNative.d.ts +56 -0
  148. package/dist/components/SelectNative/SelectNative.js +40 -0
  149. package/dist/components/SelectNative/SelectNative.js.map +1 -0
  150. package/dist/components/SelectNative/index.d.ts +1 -0
  151. package/dist/components/SelectNative/index.js +5 -0
  152. package/dist/components/SelectNative/index.js.map +1 -0
  153. package/dist/components/Slider/Slider.d.ts +33 -0
  154. package/dist/components/Slider/Slider.js +113 -0
  155. package/dist/components/Slider/Slider.js.map +1 -0
  156. package/dist/components/Slider/index.d.ts +1 -0
  157. package/dist/components/Slider/index.js +5 -0
  158. package/dist/components/Slider/index.js.map +1 -0
  159. package/dist/components/SubHeading/SubHeading.d.ts +26 -5
  160. package/dist/components/SubHeading/SubHeading.js +9 -4
  161. package/dist/components/SubHeading/SubHeading.js.map +1 -1
  162. package/dist/components/Switch/Switch.d.ts +7 -0
  163. package/dist/components/Switch/Switch.js +18 -0
  164. package/dist/components/Switch/Switch.js.map +1 -0
  165. package/dist/components/Switch/index.d.ts +1 -0
  166. package/dist/components/Switch/index.js +5 -0
  167. package/dist/components/Switch/index.js.map +1 -0
  168. package/dist/components/TagGroup/TagGroup.js +1 -1
  169. package/dist/components/TextAreaField/TextAreaField.d.ts +1 -1
  170. package/dist/components/TextAreaField/TextAreaField.js +6 -18
  171. package/dist/components/TextAreaField/TextAreaField.js.map +1 -1
  172. package/dist/components/TextField/TextField.d.ts +4 -31
  173. package/dist/components/TextField/TextField.js +7 -17
  174. package/dist/components/TextField/TextField.js.map +1 -1
  175. package/dist/components/ToggleButton/ToggleButton.js +6 -6
  176. package/dist/components/ToggleIconButton/ToggleIconButton.d.ts +9 -1
  177. package/dist/components/ToggleIconButton/ToggleIconButton.js +15 -8
  178. package/dist/components/ToggleIconButton/ToggleIconButton.js.map +1 -1
  179. package/dist/components/Tooltip/Tooltip.d.ts +5 -1
  180. package/dist/components/Tooltip/Tooltip.js +3 -2
  181. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  182. package/dist/components/_base/Field/Field.d.ts +16 -0
  183. package/dist/components/_base/Field/Field.js +29 -0
  184. package/dist/components/_base/Field/Field.js.map +1 -0
  185. package/dist/components/_base/Field/index.d.ts +2 -0
  186. package/dist/components/_base/Field/index.js +5 -0
  187. package/dist/components/_base/Field/index.js.map +1 -0
  188. package/dist/components/index.d.ts +15 -1
  189. package/dist/components/index.js +41 -14
  190. package/dist/components/index.js.map +1 -1
  191. package/dist/index.js +41 -14
  192. package/dist/index.js.map +1 -1
  193. package/dist/react-number-format.es-DMLgWFZX.js +760 -0
  194. package/dist/react-number-format.es-DMLgWFZX.js.map +1 -0
  195. package/dist/utils/backgroundColor/backgroundColor.d.ts +8 -0
  196. package/dist/utils/backgroundColor/backgroundColor.js +102 -0
  197. package/dist/utils/backgroundColor/backgroundColor.js.map +1 -0
  198. package/dist/utils/border/border.d.ts +3 -3
  199. package/dist/utils/creditCard/creditCard.d.ts +7 -0
  200. package/dist/utils/creditCard/creditCard.js +25 -0
  201. package/dist/utils/creditCard/creditCard.js.map +1 -0
  202. package/dist/utils/flex/flex.d.ts +3 -3
  203. package/dist/utils/flex/flex.js +49 -35
  204. package/dist/utils/flex/flex.js.map +1 -1
  205. package/dist/utils/focus/focusStyles.d.ts +1 -1
  206. package/dist/utils/focus/focusStyles.js +2 -2
  207. package/dist/utils/foregroundColour/foregroundColor.d.ts +8 -0
  208. package/dist/utils/foregroundColour/foregroundColor.js +125 -0
  209. package/dist/utils/foregroundColour/foregroundColor.js.map +1 -0
  210. package/dist/utils/forms/formProps.d.ts +2 -0
  211. package/dist/utils/forms/formProps.js +2 -0
  212. package/dist/utils/forms/formProps.js.map +1 -0
  213. package/dist/utils/padding/padding.d.ts +7 -7
  214. package/dist/utils/padding/padding.js +98 -98
  215. package/dist/utils/phoneNumber/phoneNumber.d.ts +24 -0
  216. package/dist/utils/phoneNumber/phoneNumber.js +566 -0
  217. package/dist/utils/phoneNumber/phoneNumber.js.map +1 -0
  218. package/dist/utils/stories/iconPropsArgTypes.js +50 -13
  219. package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
  220. package/package.json +39 -19
  221. package/dist/assets/NewButton.css +0 -1
  222. package/dist/assets/backgroundColour.css +0 -1
  223. package/dist/assets/fgColor.css +0 -1
  224. package/dist/components/NewButton/NewButton.d.ts +0 -87
  225. package/dist/components/NewButton/NewButton.js +0 -189
  226. package/dist/components/NewButton/NewButton.js.map +0 -1
  227. package/dist/components/NewButton/index.d.ts +0 -1
  228. package/dist/components/NewButton/index.js +0 -5
  229. package/dist/utils/backgroundColour/backgroundColour.d.ts +0 -8
  230. package/dist/utils/backgroundColour/backgroundColour.js +0 -102
  231. package/dist/utils/backgroundColour/backgroundColour.js.map +0 -1
  232. package/dist/utils/fgColour/fgColor.d.ts +0 -5
  233. package/dist/utils/fgColour/fgColor.js +0 -84
  234. package/dist/utils/fgColour/fgColor.js.map +0 -1
  235. /package/dist/components/{NewButton → AviosCurrencySymbol}/index.js.map +0 -0
@@ -2,17 +2,17 @@ import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { c as cva } from "../../index-Bi3v_EjJ.js";
3
3
  import { Icon } from "../Icon/Icon.js";
4
4
  import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
5
- import '../../assets/Badge.css';const badge$1 = "_badge_6jwot_1";
6
- const md = "_md_6jwot_16";
7
- const sm = "_sm_6jwot_25";
8
- const neutral = "_neutral_6jwot_33";
9
- const critical = "_critical_6jwot_37";
10
- const warning = "_warning_6jwot_41";
11
- const caution = "_caution_6jwot_45";
12
- const success = "_success_6jwot_49";
13
- const info = "_info_6jwot_53";
14
- const brand = "_brand_6jwot_57";
15
- const sale = "_sale_6jwot_61";
5
+ import '../../assets/Badge.css';const badge$1 = "_badge_cjbra_1";
6
+ const md = "_md_cjbra_16";
7
+ const sm = "_sm_cjbra_25";
8
+ const neutral = "_neutral_cjbra_33";
9
+ const critical = "_critical_cjbra_37";
10
+ const warning = "_warning_cjbra_41";
11
+ const caution = "_caution_cjbra_45";
12
+ const success = "_success_cjbra_49";
13
+ const info = "_info_cjbra_53";
14
+ const brand = "_brand_cjbra_57";
15
+ const sale = "_sale_cjbra_61";
16
16
  const styles = {
17
17
  badge: badge$1,
18
18
  md,
@@ -1,5 +1,5 @@
1
1
  import { default as React } from 'react';
2
- import { BackgroundVariants } from '../../utils/backgroundColour/backgroundColour';
2
+ import { BackgroundVariants } from '../../utils/backgroundColor/backgroundColor';
3
3
  import { FlexVariants } from '../../utils/flex/flex';
4
4
  import { BorderVariants } from '../../utils/border/border';
5
5
  import { PaddingVariants } from '../../utils/padding/padding';
@@ -24,6 +24,25 @@ export interface BoxProps extends BackgroundVariants, FlexVariants, BorderVarian
24
24
  * Accepts any valid CSS unit.
25
25
  */
26
26
  minWidth?: string;
27
+ /**
28
+ * The height of the Box.
29
+ * Accepts any valid CSS unit.
30
+ */
31
+ height?: string;
32
+ /**
33
+ * The maximum height of the Box.
34
+ * Accepts any valid CSS unit.
35
+ */
36
+ maxHeight?: string;
37
+ /**
38
+ * The minimum height of the Box.
39
+ * Accepts any valid CSS unit.
40
+ */
41
+ minHeight?: string;
42
+ /**
43
+ * @deprecated Use `backgroundColor` instead.
44
+ */
45
+ backgroundColour?: BackgroundVariants['backgroundColor'];
27
46
  }
28
- export declare const Box: ({ children, as: Component, width, maxWidth, minWidth, ...props }: BoxProps) => import("react/jsx-runtime").JSX.Element;
47
+ export declare const Box: ({ children, as: Component, backgroundColour, width, maxWidth, minWidth, height, maxHeight, minHeight, ...props }: BoxProps) => import("react/jsx-runtime").JSX.Element;
29
48
  export default Box;
@@ -1,21 +1,32 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import { backgroundColorVariants } from "../../utils/backgroundColour/backgroundColour.js";
2
+ import { backgroundColorVariants } from "../../utils/backgroundColor/backgroundColor.js";
3
3
  import { flexVariants } from "../../utils/flex/flex.js";
4
4
  import { borderVariants } from "../../utils/border/border.js";
5
5
  import { paddingVariants } from "../../utils/padding/padding.js";
6
6
  const Box = ({
7
7
  children,
8
8
  as: Component = "div",
9
+ backgroundColour,
9
10
  width,
10
11
  maxWidth,
11
12
  minWidth,
13
+ height,
14
+ maxHeight,
15
+ minHeight,
12
16
  ...props
13
17
  }) => {
18
+ if (backgroundColour && !props.backgroundColor) {
19
+ console.warn("Warning: `backgroundColour` is deprecated and will be removed in a future release. Please use `backgroundColor` instead.");
20
+ }
21
+ const resolvedBackgroundColor = props.backgroundColor ?? backgroundColour;
14
22
  const borderWidth = !(props == null ? void 0 : props.borderWidth) && props.borderColour !== "none" ? "sm" : props.borderWidth;
15
- const styles = {
23
+ const stylesProp = {
16
24
  width: width === "full" ? "100%" : width,
25
+ height: height === "full" ? "100%" : height,
17
26
  maxWidth,
18
- minWidth
27
+ minWidth,
28
+ maxHeight,
29
+ minHeight
19
30
  };
20
31
  return /* @__PURE__ */ jsx(Component, { className: `${borderVariants({
21
32
  ...props,
@@ -25,8 +36,9 @@ const Box = ({
25
36
  })} ${paddingVariants({
26
37
  ...props
27
38
  })} ${backgroundColorVariants({
39
+ backgroundColor: resolvedBackgroundColor,
28
40
  ...props
29
- })}`, style: styles, children });
41
+ })}`, style: stylesProp, children });
30
42
  };
31
43
  export {
32
44
  Box,
@@ -1 +1 @@
1
- {"version":3,"file":"Box.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Box.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,18 +1,27 @@
1
- import { default as React } from 'react';
2
- import { PressEvent } from 'react-aria';
1
+ import { default as React, ComponentType, ElementType, ReactNode } from 'react';
2
+ import { AriaButtonOptions } from '@react-aria/button';
3
+ import { HoverProps } from '@react-aria/interactions';
4
+ import { IconProps } from '../Icon/Icon';
3
5
  export type ButtonSize = 'lg' | 'md' | 'sm';
4
- /**
5
- * Primary UI component for user interaction
6
- */
7
- export interface ButtonProps {
6
+ export type ButtonTextAlignement = 'left' | 'center' | 'right';
7
+ export type DefaultButtonProps = ButtonProps<'button'>;
8
+ export type ButtonProps<T extends ElementType = 'button'> = AriaButtonOptions<T> & HoverProps & {
8
9
  /**
9
- * What the base style of button is
10
+ * The HTML element to be rendered as the button.
10
11
  */
12
+ as?: T;
13
+ elementType?: 'a' | 'button';
11
14
  /**
12
15
  * What the base style of button is
13
16
  * @default 'accent'
17
+ * @deprecated use styleVariant instead
14
18
  */
15
19
  styleType?: 'accent' | 'critical' | 'neutral' | 'white';
20
+ /**
21
+ * What the base style of button is
22
+ * @default 'accent'
23
+ */
24
+ styleVariant?: 'accent' | 'critical' | 'neutral' | 'white';
16
25
  /**
17
26
  * What the purpose is for the button
18
27
  * @default 'primary'
@@ -24,81 +33,164 @@ export interface ButtonProps {
24
33
  */
25
34
  size?: ButtonSize;
26
35
  /**
27
- * Whether the button is loading
36
+ * Whether an icon should display at the end of Button and icon properties
37
+ * @default
28
38
  */
29
- isLoading?: boolean;
39
+ iconEndProps?: IconProps;
40
+ /**
41
+ * Whether an icon should display at the start of the Button and icon properties
42
+ */
43
+ iconStartProps?: IconProps;
30
44
  /**
31
45
  * Whether the button leading has an icon
46
+ * @deprecated use iconStartProps instead
32
47
  */
33
48
  hasLeadingIcon?: boolean;
34
49
  /**
35
50
  * Leading icon name
51
+ * @deprecated use iconStartProps instead
36
52
  */
37
53
  leadingIconName?: string;
38
54
  /**
39
55
  * Whether the button trailing has an icon
56
+ * @deprecated use iconEndProps instead
40
57
  */
41
58
  hasTrailingIcon?: boolean;
42
59
  /**
43
60
  * Trailing icon name
61
+ * @deprecated use iconEndProps instead
44
62
  */
45
63
  trailingIconName?: string;
64
+ /**
65
+ * isLoading is a boolean that will show a spinner in the button
66
+ */
67
+ isLoading?: boolean;
68
+ /**
69
+ * The text alignment of the button
70
+ */
71
+ textAlign?: ButtonTextAlignement;
72
+ /**
73
+ * The content for the button.
74
+ */
75
+ children?: ReactNode;
46
76
  /**
47
77
  * Whether the element should receive focus on render.
48
78
  */
49
79
  type?: 'button' | 'submit' | 'reset';
50
80
  /**
51
- * Handler to be called when the button is clicked.
81
+ * Whether the button should be full width.
52
82
  */
53
- onClick?: (e: PressEvent) => void;
83
+ fullWidth?: boolean;
54
84
  /**
55
- * The <form> element to associate the button with. The value of this attribute must be the id of a <form> in the same document
85
+ * @deprecated onPress should be preferred
86
+ * Handler to be called when the button is clicked.
56
87
  */
57
- form?: string;
88
+ onClick?: React.MouseEventHandler;
58
89
  /**
59
- * The URL that processes the information submitted by the button. Overrides the action attribute of the button's form owner.
90
+ * The target of the link (if `as` is set to 'a').
60
91
  */
61
- formAction?: string;
92
+ target?: '_blank' | '_self' | '_parent' | '_top';
62
93
  /**
63
- * Indicates how to encode the form data that is submitted.
94
+ * What type of focus style to apply to the button.
64
95
  */
65
- formEncType?: string;
96
+ focusStyle?: 'default' | 'white';
66
97
  /**
67
- * Indicates the HTTP method used to submit the form
98
+ * Passthrough props for the button element.
68
99
  */
69
- formMethod?: string;
100
+ passthroughProps?: Partial<T extends ComponentType<infer P> ? P : T extends keyof JSX.IntrinsicElements ? JSX.IntrinsicElements[T] : never>;
101
+ };
102
+ export declare const Button: React.ForwardRefExoticComponent<AriaButtonOptions<React.ElementType> & HoverProps & {
70
103
  /**
71
- * Indicates that the form is not to be validated when it is submitted.
104
+ * The HTML element to be rendered as the button.
72
105
  */
73
- formNoValidate?: boolean;
106
+ as?: React.ElementType | undefined;
107
+ elementType?: "a" | "button";
74
108
  /**
75
- * Overrides the target attribute of the button's form owner.
109
+ * What the base style of button is
110
+ * @default 'accent'
111
+ * @deprecated use styleVariant instead
76
112
  */
77
- formTarget?: string;
113
+ styleType?: "accent" | "critical" | "neutral" | "white";
78
114
  /**
79
- * Submitted as a pair with the button's value as part of the form data.
115
+ * What the base style of button is
116
+ * @default 'accent'
80
117
  */
81
- name?: string;
118
+ styleVariant?: "accent" | "critical" | "neutral" | "white";
82
119
  /**
83
- * The value associated with the button's name when it's submitted with the form data.
120
+ * What the purpose is for the button
121
+ * @default 'primary'
84
122
  */
85
- value?: string;
123
+ emphasis?: "primary" | "secondary" | "tertiary" | "quaternary";
86
124
  /**
87
- * Whether the button is disabled.
125
+ * How large should the button be?
126
+ * @default 'md'
127
+ */
128
+ size?: ButtonSize;
129
+ /**
130
+ * Whether an icon should display at the end of Button and icon properties
131
+ * @default
88
132
  */
89
- isDisabled?: boolean;
133
+ iconEndProps?: IconProps;
134
+ /**
135
+ * Whether an icon should display at the start of the Button and icon properties
136
+ */
137
+ iconStartProps?: IconProps;
138
+ /**
139
+ * Whether the button leading has an icon
140
+ * @deprecated use iconStartProps instead
141
+ */
142
+ hasLeadingIcon?: boolean;
143
+ /**
144
+ * Leading icon name
145
+ * @deprecated use iconStartProps instead
146
+ */
147
+ leadingIconName?: string;
148
+ /**
149
+ * Whether the button trailing has an icon
150
+ * @deprecated use iconEndProps instead
151
+ */
152
+ hasTrailingIcon?: boolean;
153
+ /**
154
+ * Trailing icon name
155
+ * @deprecated use iconEndProps instead
156
+ */
157
+ trailingIconName?: string;
158
+ /**
159
+ * isLoading is a boolean that will show a spinner in the button
160
+ */
161
+ isLoading?: boolean;
162
+ /**
163
+ * The text alignment of the button
164
+ */
165
+ textAlign?: ButtonTextAlignement;
166
+ /**
167
+ * The content for the button.
168
+ */
169
+ children?: ReactNode;
90
170
  /**
91
171
  * Whether the element should receive focus on render.
92
172
  */
93
- autoFocus?: boolean;
173
+ type?: "button" | "submit" | "reset";
94
174
  /**
95
- * The content for the button
175
+ * Whether the button should be full width.
96
176
  */
97
- children?: React.ReactNode;
177
+ fullWidth?: boolean;
98
178
  /**
99
- * The focus style of the button
179
+ * @deprecated onPress should be preferred
180
+ * Handler to be called when the button is clicked.
100
181
  */
101
- focusStyle?: 'default' | 'white';
102
- }
103
- export declare const Button: ({ styleType, emphasis, size, isLoading, focusStyle, children, form, formAction, formEncType, formMethod, formNoValidate, formTarget, name, value, isDisabled, autoFocus, type, onClick, hasLeadingIcon, leadingIconName, hasTrailingIcon, trailingIconName, ...props }: ButtonProps) => import("react/jsx-runtime").JSX.Element;
182
+ onClick?: React.MouseEventHandler;
183
+ /**
184
+ * The target of the link (if `as` is set to 'a').
185
+ */
186
+ target?: "_blank" | "_self" | "_parent" | "_top";
187
+ /**
188
+ * What type of focus style to apply to the button.
189
+ */
190
+ focusStyle?: "default" | "white";
191
+ /**
192
+ * Passthrough props for the button element.
193
+ */
194
+ passthroughProps?: Partial<any> | undefined;
195
+ } & React.RefAttributes<any>>;
104
196
  export default Button;
@@ -1,37 +1,57 @@
1
- import { jsxs, jsx, Fragment } from "react/jsx-runtime";
1
+ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import { c as cva } from "../../index-Bi3v_EjJ.js";
3
- import { useRef, useState, useEffect } from "react";
4
- import { Button as Button$1 } from "react-aria-components";
3
+ import { forwardRef } from "react";
4
+ import { useButton } from "@react-aria/button";
5
+ import { useObjectRef, mergeProps } from "@react-aria/utils";
6
+ import { useHover } from "@react-aria/interactions";
7
+ import { useFocusRing } from "@react-aria/focus";
5
8
  import { Icon } from "../Icon/Icon.js";
6
9
  import LoadingSpinner from "../LoadingSpinner/LoadingSpinner.js";
7
10
  import { focusStyleVariants } from "../../utils/focus/focusStyles.js";
8
- import '../../assets/Button.css';const button$1 = "_button_fkkc6_1";
9
- const sm = "_sm_fkkc6_25";
10
- const md = "_md_fkkc6_30";
11
- const lg = "_lg_fkkc6_35";
12
- const accentPrimary = "_accentPrimary_fkkc6_44";
13
- const accentSecondary = "_accentSecondary_fkkc6_67";
14
- const accentTertiary = "_accentTertiary_fkkc6_100";
15
- const accentQuaternary = "_accentQuaternary_fkkc6_129";
16
- const criticalPrimary = "_criticalPrimary_fkkc6_157";
17
- const criticalSecondary = "_criticalSecondary_fkkc6_185";
18
- const criticalTertiary = "_criticalTertiary_fkkc6_218";
19
- const criticalQuaternary = "_criticalQuaternary_fkkc6_247";
20
- const neutralPrimary = "_neutralPrimary_fkkc6_276";
21
- const neutralSecondary = "_neutralSecondary_fkkc6_304";
22
- const neutralTertiary = "_neutralTertiary_fkkc6_335";
23
- const neutralQuaternary = "_neutralQuaternary_fkkc6_364";
24
- const whitePrimary = "_whitePrimary_fkkc6_394";
25
- const whiteSecondary = "_whiteSecondary_fkkc6_423";
26
- const whiteTertiary = "_whiteTertiary_fkkc6_454";
27
- const whiteQuaternary = "_whiteQuaternary_fkkc6_483";
11
+ import '../../assets/Button.css';const button$1 = "_button_1t97g_1";
12
+ const content = "_content_1t97g_22";
13
+ const isNotLoading = "_isNotLoading_1t97g_31";
14
+ const loadingSpinner = "_loadingSpinner_1t97g_31";
15
+ const isLoading = "_isLoading_1t97g_40";
16
+ const focusWhite = "_focusWhite_1t97g_52";
17
+ const sm = "_sm_1t97g_59";
18
+ const md = "_md_1t97g_64";
19
+ const lg = "_lg_1t97g_69";
20
+ const fullWidth = "_fullWidth_1t97g_74";
21
+ const textAlignLeft = "_textAlignLeft_1t97g_81";
22
+ const textAlignCenter = "_textAlignCenter_1t97g_85";
23
+ const textAlignRight = "_textAlignRight_1t97g_89";
24
+ const accentPrimary = "_accentPrimary_1t97g_97";
25
+ const accentSecondary = "_accentSecondary_1t97g_117";
26
+ const accentTertiary = "_accentTertiary_1t97g_147";
27
+ const accentQuaternary = "_accentQuaternary_1t97g_173";
28
+ const criticalPrimary = "_criticalPrimary_1t97g_199";
29
+ const criticalSecondary = "_criticalSecondary_1t97g_224";
30
+ const criticalTertiary = "_criticalTertiary_1t97g_254";
31
+ const criticalQuaternary = "_criticalQuaternary_1t97g_280";
32
+ const neutralPrimary = "_neutralPrimary_1t97g_307";
33
+ const neutralSecondary = "_neutralSecondary_1t97g_332";
34
+ const neutralTertiary = "_neutralTertiary_1t97g_361";
35
+ const neutralQuaternary = "_neutralQuaternary_1t97g_387";
36
+ const whitePrimary = "_whitePrimary_1t97g_414";
37
+ const whiteSecondary = "_whiteSecondary_1t97g_440";
38
+ const whiteTertiary = "_whiteTertiary_1t97g_473";
39
+ const whiteQuaternary = "_whiteQuaternary_1t97g_503";
28
40
  const styles = {
29
41
  button: button$1,
42
+ content,
43
+ isNotLoading,
44
+ loadingSpinner,
45
+ isLoading,
46
+ focusWhite,
30
47
  sm,
31
48
  md,
32
49
  lg,
50
+ fullWidth,
51
+ textAlignLeft,
52
+ textAlignCenter,
53
+ textAlignRight,
33
54
  accentPrimary,
34
- "local-class": "_local-class_fkkc6_61",
35
55
  accentSecondary,
36
56
  accentTertiary,
37
57
  accentQuaternary,
@@ -47,8 +67,8 @@ const styles = {
47
67
  whiteSecondary,
48
68
  whiteTertiary,
49
69
  whiteQuaternary,
50
- "fa-spinner-third": "_fa-spinner-third_fkkc6_514",
51
- "icon-wrapper": "_icon-wrapper_fkkc6_519"
70
+ "fa-spinner-third": "_fa-spinner-third_1t97g_535",
71
+ "icon-wrapper": "_icon-wrapper_1t97g_540"
52
72
  };
53
73
  const button = cva(styles.button, {
54
74
  variants: {
@@ -80,62 +100,105 @@ const button = cva(styles.button, {
80
100
  secondary: styles.whiteSecondary,
81
101
  tertiary: styles.whiteTertiary,
82
102
  quaternary: styles.whiteQuaternary
103
+ },
104
+ fullWidth: {
105
+ true: styles.fullWidth
106
+ },
107
+ focusStyle: {
108
+ default: void 0,
109
+ white: styles.focusWhite
110
+ },
111
+ isLoading: {
112
+ false: styles.isNotLoading,
113
+ true: styles.isLoading
114
+ },
115
+ textAlign: {
116
+ left: styles.textAlignLeft,
117
+ center: styles.textAlignCenter,
118
+ right: styles.textAlignRight
83
119
  }
84
120
  },
121
+ compoundVariants: [{
122
+ size: "md",
123
+ accent: "primary",
124
+ className: styles.accentPrimary
125
+ }],
85
126
  defaultVariants: {
86
127
  size: "md"
87
128
  }
88
129
  });
89
- const Button = ({
90
- // Custom Props
91
- styleType = "accent",
130
+ const Button = forwardRef(function Button2({
131
+ as,
132
+ elementType,
133
+ styleType,
134
+ styleVariant,
92
135
  emphasis = "primary",
93
136
  size = "md",
94
- isLoading = false,
95
- focusStyle = "default",
96
- children,
97
- // react-aria props
98
- form,
99
- formAction,
100
- formEncType,
101
- formMethod,
102
- formNoValidate,
103
- formTarget,
104
- name,
105
- value,
106
- isDisabled,
107
- autoFocus,
108
- type,
109
- onClick,
110
- hasLeadingIcon,
137
+ iconStartProps,
138
+ iconEndProps,
111
139
  leadingIconName,
112
- hasTrailingIcon,
113
140
  trailingIconName,
141
+ children,
142
+ fullWidth: fullWidth2,
143
+ textAlign = "center",
144
+ focusStyle = "default",
145
+ passthroughProps,
146
+ isLoading: isLoading2 = false,
114
147
  ...props
115
- }) => {
116
- const buttonRef = useRef(null);
117
- const [buttonWidth, setButtonWidth] = useState(null);
118
- useEffect(() => {
119
- if (buttonRef.current) {
120
- setButtonWidth(buttonRef.current.offsetWidth);
148
+ }, forwardedRef) {
149
+ const ref = useObjectRef(forwardedRef);
150
+ const {
151
+ buttonProps,
152
+ isPressed
153
+ } = useButton({
154
+ ...props,
155
+ elementType: elementType ?? as
156
+ }, ref);
157
+ const {
158
+ hoverProps,
159
+ isHovered
160
+ } = useHover(props);
161
+ const {
162
+ isFocusVisible,
163
+ focusProps
164
+ } = useFocusRing(props);
165
+ const getAriaLabel = () => {
166
+ if (isLoading2) {
167
+ return "Loading Spinner";
168
+ }
169
+ const label = buttonProps["aria-label"] || (typeof children === "string" ? children : void 0);
170
+ if (props.isDisabled && label) {
171
+ return `${label}, unavailable`;
121
172
  }
122
- }, [isLoading]);
123
- return /* @__PURE__ */ jsxs(Button$1, { className: `${button({
173
+ return label;
174
+ };
175
+ const resolvedStyleVariant = styleVariant ?? styleType ?? "accent";
176
+ const className = button({
124
177
  size,
125
- [styleType]: emphasis
126
- })} ${focusStyleVariants({
178
+ fullWidth: fullWidth2,
179
+ focusStyle,
180
+ isLoading: isLoading2,
181
+ textAlign,
182
+ [resolvedStyleVariant]: emphasis
183
+ });
184
+ const Component = elementType ?? as ?? "button";
185
+ const resolvedIconStartProps = leadingIconName ? {
186
+ iconName: leadingIconName
187
+ } : iconStartProps;
188
+ const resolvedIconEndProps = trailingIconName ? {
189
+ iconName: trailingIconName
190
+ } : iconEndProps;
191
+ return /* @__PURE__ */ jsx(Component, { className: `${className} ${focusStyleVariants({
127
192
  focusStyle
128
- })}`, ref: buttonRef, form, formAction, formEncType, formMethod, formNoValidate, formTarget, name, value, isDisabled, autoFocus, type, onPress: onClick, "aria-label": isLoading ? "Loading Spinner" : void 0, style: {
129
- width: isLoading && buttonWidth ? `${buttonWidth}px` : "auto"
130
- }, ...props, children: [
131
- isLoading && /* @__PURE__ */ jsx(LoadingSpinner, { buttonSize: size }),
132
- !isLoading && /* @__PURE__ */ jsxs(Fragment, { children: [
133
- hasLeadingIcon && leadingIconName ? /* @__PURE__ */ jsx(Icon, { iconName: leadingIconName || "" }) : null,
193
+ })}`, ref, "data-focused": isFocusVisible ? true : void 0, "data-hovered": isHovered ? true : void 0, "data-pressed": isPressed ? true : void 0, "aria-label": getAriaLabel(), "aria-disabled": props.isDisabled ? true : void 0, ...mergeProps(buttonProps, hoverProps, focusProps), ...passthroughProps, children: /* @__PURE__ */ jsxs(Fragment, { children: [
194
+ isLoading2 && /* @__PURE__ */ jsx(LoadingSpinner, { className: styles.loadingSpinner, size: size === "lg" ? "lg" : "1x", "aria-hidden": "true" }),
195
+ /* @__PURE__ */ jsxs("span", { className: styles.content, children: [
196
+ resolvedIconStartProps && /* @__PURE__ */ jsx(Icon, { ...resolvedIconStartProps, "aria-hidden": "true" }),
134
197
  children,
135
- hasTrailingIcon && trailingIconName ? /* @__PURE__ */ jsx(Icon, { iconName: trailingIconName || "" }) : null
198
+ resolvedIconEndProps && /* @__PURE__ */ jsx(Icon, { ...resolvedIconEndProps, "aria-hidden": "true" })
136
199
  ] })
137
- ] });
138
- };
200
+ ] }) });
201
+ });
139
202
  export {
140
203
  Button,
141
204
  Button as default
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Button.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -14,10 +14,16 @@ interface CardSectionComponent extends React.ForwardRefExoticComponent<CardSecti
14
14
  Media: typeof Media;
15
15
  }
16
16
  declare const CardSection: CardSectionComponent;
17
- declare const Content: ({ children }: {
18
- children: React.ReactNode;
19
- }) => import("react/jsx-runtime").JSX.Element;
20
- declare const Media: ({ children }: {
21
- children: React.ReactNode;
22
- }) => import("react/jsx-runtime").JSX.Element;
17
+ declare const Content: {
18
+ ({ children }: {
19
+ children: React.ReactNode;
20
+ }): import("react/jsx-runtime").JSX.Element;
21
+ displayName: string;
22
+ };
23
+ declare const Media: {
24
+ ({ children }: {
25
+ children: React.ReactNode;
26
+ }): import("react/jsx-runtime").JSX.Element;
27
+ displayName: string;
28
+ };
23
29
  export default CardSection;
@@ -1,13 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c as cva } from "../../index-Bi3v_EjJ.js";
3
3
  import { forwardRef } from "react";
4
- import '../../assets/CardSection.css';const cardSection$1 = "_cardSection_1qtaq_1";
5
- const cardContainer = "_cardContainer_1qtaq_12";
6
- const cardGrid = "_cardGrid_1qtaq_24";
7
- const contentCell = "_contentCell_1qtaq_33";
8
- const contentBox = "_contentBox_1qtaq_40";
9
- const mediaCell = "_mediaCell_1qtaq_51";
10
- const isReversed = "_isReversed_1qtaq_65";
4
+ import '../../assets/CardSection.css';const cardSection$1 = "_cardSection_1uwwa_1";
5
+ const cardContainer = "_cardContainer_1uwwa_12";
6
+ const cardGrid = "_cardGrid_1uwwa_24";
7
+ const contentCell = "_contentCell_1uwwa_33";
8
+ const contentBox = "_contentBox_1uwwa_40";
9
+ const mediaCell = "_mediaCell_1uwwa_51";
10
+ const isReversed = "_isReversed_1uwwa_65";
11
11
  const styles = {
12
12
  cardSection: cardSection$1,
13
13
  cardContainer,
@@ -35,9 +35,11 @@ CardSection.displayName = "CardSection";
35
35
  const Content = ({
36
36
  children
37
37
  }) => /* @__PURE__ */ jsx("div", { className: styles.contentCell, children: /* @__PURE__ */ jsx("article", { className: styles.contentBox, children }) });
38
+ Content.displayName = "CardSection.Content";
38
39
  const Media = ({
39
40
  children
40
41
  }) => /* @__PURE__ */ jsx("figure", { className: styles.mediaCell, children });
42
+ Media.displayName = "CardSection.Media";
41
43
  CardSection.Content = Content;
42
44
  CardSection.Media = Media;
43
45
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"CardSection.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"CardSection.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}