@alto-avios/alto-ui 3.0.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 (150) hide show
  1. package/dist/assets/Button.css +1 -1
  2. package/dist/assets/CreditCardNumberField.css +1 -0
  3. package/dist/assets/DetailsDisclosure.css +1 -0
  4. package/dist/assets/Dialog.css +1 -0
  5. package/dist/assets/FieldsetHeader.css +1 -1
  6. package/dist/assets/Icon.css +1 -0
  7. package/dist/assets/IconBackdrop.css +1 -0
  8. package/dist/assets/IconButton.css +1 -1
  9. package/dist/assets/PasswordField.css +1 -0
  10. package/dist/assets/PhoneNumberField.css +1 -0
  11. package/dist/assets/Popover.css +1 -0
  12. package/dist/assets/SelectNative.css +1 -0
  13. package/dist/assets/Slider.css +1 -0
  14. package/dist/assets/Switch.css +1 -0
  15. package/dist/assets/ToggleButton.css +1 -1
  16. package/dist/assets/ToggleIconButton.css +1 -1
  17. package/dist/assets/backgroundColor.css +1 -0
  18. package/dist/assets/flex.css +1 -1
  19. package/dist/assets/foregroundColor.css +1 -0
  20. package/dist/components/Box/Box.d.ts +6 -2
  21. package/dist/components/Box/Box.js +7 -1
  22. package/dist/components/Box/Box.js.map +1 -1
  23. package/dist/components/Button/Button.js +31 -31
  24. package/dist/components/CreditCardNumberField/CreditCardNumberField.d.ts +29 -0
  25. package/dist/components/CreditCardNumberField/CreditCardNumberField.js +45 -0
  26. package/dist/components/CreditCardNumberField/CreditCardNumberField.js.map +1 -0
  27. package/dist/components/CreditCardNumberField/index.d.ts +1 -0
  28. package/dist/components/CreditCardNumberField/index.js +5 -0
  29. package/dist/components/CreditCardNumberField/index.js.map +1 -0
  30. package/dist/components/DetailsDisclosure/DetailsDisclosure.d.ts +33 -0
  31. package/dist/components/DetailsDisclosure/DetailsDisclosure.js +39 -0
  32. package/dist/components/DetailsDisclosure/DetailsDisclosure.js.map +1 -0
  33. package/dist/components/DetailsDisclosure/index.d.ts +2 -0
  34. package/dist/components/DetailsDisclosure/index.js +5 -0
  35. package/dist/components/DetailsDisclosure/index.js.map +1 -0
  36. package/dist/components/Dialog/Dialog.d.ts +46 -0
  37. package/dist/components/Dialog/Dialog.js +117 -0
  38. package/dist/components/Dialog/Dialog.js.map +1 -0
  39. package/dist/components/Dialog/index.d.ts +1 -0
  40. package/dist/components/Dialog/index.js +5 -0
  41. package/dist/components/Dialog/index.js.map +1 -0
  42. package/dist/components/FieldError/FieldError.js +1 -1
  43. package/dist/components/FieldsetHeader/FieldsetHeader.js +3 -3
  44. package/dist/components/Heading/Heading.d.ts +24 -5
  45. package/dist/components/Heading/Heading.js +9 -4
  46. package/dist/components/Heading/Heading.js.map +1 -1
  47. package/dist/components/Icon/Icon.d.ts +30 -4
  48. package/dist/components/Icon/Icon.js +98 -5
  49. package/dist/components/Icon/Icon.js.map +1 -1
  50. package/dist/components/IconBackdrop/IconBackdrop.d.ts +24 -0
  51. package/dist/components/IconBackdrop/IconBackdrop.js +34 -0
  52. package/dist/components/IconBackdrop/IconBackdrop.js.map +1 -0
  53. package/dist/components/IconBackdrop/index.d.ts +1 -0
  54. package/dist/components/IconBackdrop/index.js +5 -0
  55. package/dist/components/IconBackdrop/index.js.map +1 -0
  56. package/dist/components/IconButton/IconButton.d.ts +1 -1
  57. package/dist/components/IconButton/IconButton.js +28 -28
  58. package/dist/components/Image/Image.d.ts +2 -1
  59. package/dist/components/Image/Image.js +7 -2
  60. package/dist/components/Image/Image.js.map +1 -1
  61. package/dist/components/Link/Link.d.ts +3 -3
  62. package/dist/components/Link/Link.js +2 -2
  63. package/dist/components/Paragraph/Paragraph.d.ts +8 -4
  64. package/dist/components/Paragraph/Paragraph.js +9 -4
  65. package/dist/components/Paragraph/Paragraph.js.map +1 -1
  66. package/dist/components/PasswordField/PasswordField.d.ts +30 -0
  67. package/dist/components/PasswordField/PasswordField.js +104 -0
  68. package/dist/components/PasswordField/PasswordField.js.map +1 -0
  69. package/dist/components/PasswordField/index.d.ts +1 -0
  70. package/dist/components/PasswordField/index.js +5 -0
  71. package/dist/components/PasswordField/index.js.map +1 -0
  72. package/dist/components/PhoneNumberField/PhoneNumberField.d.ts +53 -0
  73. package/dist/components/PhoneNumberField/PhoneNumberField.js +91 -0
  74. package/dist/components/PhoneNumberField/PhoneNumberField.js.map +1 -0
  75. package/dist/components/PhoneNumberField/index.d.ts +3 -0
  76. package/dist/components/PhoneNumberField/index.js +7 -0
  77. package/dist/components/PhoneNumberField/index.js.map +1 -0
  78. package/dist/components/Popover/Popover.d.ts +16 -0
  79. package/dist/components/Popover/Popover.js +68 -0
  80. package/dist/components/Popover/Popover.js.map +1 -0
  81. package/dist/components/Popover/index.d.ts +1 -0
  82. package/dist/components/Popover/index.js +5 -0
  83. package/dist/components/Popover/index.js.map +1 -0
  84. package/dist/components/Section/Section.d.ts +2 -1
  85. package/dist/components/Section/Section.js +7 -2
  86. package/dist/components/Section/Section.js.map +1 -1
  87. package/dist/components/SelectNative/SelectNative.d.ts +56 -0
  88. package/dist/components/SelectNative/SelectNative.js +40 -0
  89. package/dist/components/SelectNative/SelectNative.js.map +1 -0
  90. package/dist/components/SelectNative/index.d.ts +1 -0
  91. package/dist/components/SelectNative/index.js +5 -0
  92. package/dist/components/SelectNative/index.js.map +1 -0
  93. package/dist/components/Slider/Slider.d.ts +33 -0
  94. package/dist/components/Slider/Slider.js +113 -0
  95. package/dist/components/Slider/Slider.js.map +1 -0
  96. package/dist/components/Slider/index.d.ts +1 -0
  97. package/dist/components/Slider/index.js +5 -0
  98. package/dist/components/Slider/index.js.map +1 -0
  99. package/dist/components/SubHeading/SubHeading.d.ts +25 -4
  100. package/dist/components/SubHeading/SubHeading.js +9 -4
  101. package/dist/components/SubHeading/SubHeading.js.map +1 -1
  102. package/dist/components/Switch/Switch.d.ts +7 -0
  103. package/dist/components/Switch/Switch.js +18 -0
  104. package/dist/components/Switch/Switch.js.map +1 -0
  105. package/dist/components/Switch/index.d.ts +1 -0
  106. package/dist/components/Switch/index.js +5 -0
  107. package/dist/components/Switch/index.js.map +1 -0
  108. package/dist/components/ToggleButton/ToggleButton.js +6 -6
  109. package/dist/components/ToggleIconButton/ToggleIconButton.js +6 -6
  110. package/dist/components/Tooltip/Tooltip.d.ts +5 -1
  111. package/dist/components/Tooltip/Tooltip.js +2 -1
  112. package/dist/components/Tooltip/Tooltip.js.map +1 -1
  113. package/dist/components/_base/Field/Field.d.ts +2 -2
  114. package/dist/components/_base/Field/Field.js +2 -5
  115. package/dist/components/_base/Field/Field.js.map +1 -1
  116. package/dist/components/index.d.ts +10 -0
  117. package/dist/components/index.js +33 -14
  118. package/dist/components/index.js.map +1 -1
  119. package/dist/index.js +33 -14
  120. package/dist/index.js.map +1 -1
  121. package/dist/react-number-format.es-DMLgWFZX.js +760 -0
  122. package/dist/react-number-format.es-DMLgWFZX.js.map +1 -0
  123. package/dist/utils/backgroundColor/backgroundColor.d.ts +8 -0
  124. package/dist/utils/backgroundColor/backgroundColor.js +102 -0
  125. package/dist/utils/backgroundColor/backgroundColor.js.map +1 -0
  126. package/dist/utils/border/border.d.ts +2 -2
  127. package/dist/utils/creditCard/creditCard.d.ts +7 -0
  128. package/dist/utils/creditCard/creditCard.js +25 -0
  129. package/dist/utils/creditCard/creditCard.js.map +1 -0
  130. package/dist/utils/flex/flex.d.ts +3 -3
  131. package/dist/utils/flex/flex.js +47 -35
  132. package/dist/utils/flex/flex.js.map +1 -1
  133. package/dist/utils/foregroundColour/foregroundColor.d.ts +8 -0
  134. package/dist/utils/foregroundColour/foregroundColor.js +125 -0
  135. package/dist/utils/foregroundColour/foregroundColor.js.map +1 -0
  136. package/dist/utils/padding/padding.d.ts +7 -7
  137. package/dist/utils/phoneNumber/phoneNumber.d.ts +24 -0
  138. package/dist/utils/phoneNumber/phoneNumber.js +566 -0
  139. package/dist/utils/phoneNumber/phoneNumber.js.map +1 -0
  140. package/dist/utils/stories/iconPropsArgTypes.js +37 -1
  141. package/dist/utils/stories/iconPropsArgTypes.js.map +1 -1
  142. package/package.json +2 -1
  143. package/dist/assets/backgroundColour.css +0 -1
  144. package/dist/assets/fgColor.css +0 -1
  145. package/dist/utils/backgroundColour/backgroundColour.d.ts +0 -8
  146. package/dist/utils/backgroundColour/backgroundColour.js +0 -102
  147. package/dist/utils/backgroundColour/backgroundColour.js.map +0 -1
  148. package/dist/utils/fgColour/fgColor.d.ts +0 -5
  149. package/dist/utils/fgColour/fgColor.js +0 -84
  150. package/dist/utils/fgColour/fgColor.js.map +0 -1
@@ -0,0 +1,46 @@
1
+ import { default as React } from 'react';
2
+ import { AriaDialogProps } from 'react-aria';
3
+ export type DialogSize = 'dialogSmall' | 'dialogMedium' | 'dialogLarge';
4
+ export type DialogRole = 'alertdialog' | 'dialog';
5
+ export interface DialogProps extends AriaDialogProps {
6
+ /** Whether the dialog is currently visible */
7
+ isOpen?: boolean;
8
+ /** Callback function when dialog is requested to close */
9
+ onClose?: () => void;
10
+ /** Width variant of the dialog - affects max-width */
11
+ size?: DialogSize;
12
+ /** Whether clicking outside or escape key should be blocked */
13
+ modal?: boolean;
14
+ /** Shows/hides the close (X) button in header */
15
+ hasDismissButton?: boolean;
16
+ /** ARIA role - use 'alertdialog' for important messages */
17
+ role?: DialogRole;
18
+ /** Required unique ID for the dialog */
19
+ id?: string;
20
+ /** ID of element labeling the dialog (required for a11y) */
21
+ 'aria-describedby'?: string;
22
+ /** ID of element describing the dialog (optional but recommended) */
23
+ 'aria-labelledby'?: string;
24
+ }
25
+ export interface DialogComposition {
26
+ Header: typeof DialogHeader;
27
+ Content: typeof DialogContent;
28
+ }
29
+ declare const DialogHeader: ({ id, children, }: {
30
+ children: React.ReactNode;
31
+ id?: string;
32
+ }) => import("react/jsx-runtime").JSX.Element;
33
+ export declare function Dialog(props: React.PropsWithChildren<DialogProps>): import("react/jsx-runtime").JSX.Element | null;
34
+ export declare namespace Dialog {
35
+ var Header: ({ id, children, }: {
36
+ children: React.ReactNode;
37
+ id?: string;
38
+ }) => import("react/jsx-runtime").JSX.Element;
39
+ var Content: ({ children }: {
40
+ children: React.ReactNode;
41
+ }) => import("react/jsx-runtime").JSX.Element;
42
+ }
43
+ export declare const DialogContent: ({ children }: {
44
+ children: React.ReactNode;
45
+ }) => import("react/jsx-runtime").JSX.Element;
46
+ export default Dialog;
@@ -0,0 +1,117 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import React, { useRef } from "react";
3
+ import { IconButton } from "../IconButton/IconButton.js";
4
+ import { OverlayContainer, useOverlay, usePreventScroll, useModal } from "@react-aria/overlays";
5
+ import { useDialog } from "@react-aria/dialog";
6
+ import { FocusScope } from "@react-aria/focus";
7
+ import '../../assets/Dialog.css';const dialogWrapper = "_dialogWrapper_o29gm_1";
8
+ const overlay = "_overlay_o29gm_10";
9
+ const dialog = "_dialog_o29gm_1";
10
+ const dialogContent = "_dialogContent_o29gm_47";
11
+ const dialogHeading = "_dialogHeading_o29gm_54";
12
+ const dialogContentInner = "_dialogContentInner_o29gm_58";
13
+ const noHeader = "_noHeader_o29gm_64";
14
+ const closeButton = "_closeButton_o29gm_68";
15
+ const dialogSmall = "_dialogSmall_o29gm_94";
16
+ const dialogMedium = "_dialogMedium_o29gm_98";
17
+ const dialogLarge = "_dialogLarge_o29gm_102";
18
+ const styles = {
19
+ dialogWrapper,
20
+ overlay,
21
+ dialog,
22
+ dialogContent,
23
+ dialogHeading,
24
+ dialogContentInner,
25
+ noHeader,
26
+ closeButton,
27
+ dialogSmall,
28
+ dialogMedium,
29
+ dialogLarge
30
+ };
31
+ const DialogHeader = ({
32
+ /** ID used to reference this header for aria-labelledby */
33
+ id,
34
+ /** Content of the header section */
35
+ children
36
+ }) => {
37
+ return /* @__PURE__ */ jsx("div", { className: styles.dialogHeading, id, children });
38
+ };
39
+ function DialogWrapper({
40
+ children,
41
+ ...props
42
+ }) {
43
+ const {
44
+ onClose,
45
+ size = "medium",
46
+ modal = false,
47
+ hasDismissButton = true,
48
+ role = "dialog",
49
+ id
50
+ } = props;
51
+ const ref = useRef(null);
52
+ const {
53
+ dialogProps
54
+ } = useDialog({
55
+ ...props,
56
+ role
57
+ }, ref);
58
+ const {
59
+ overlayProps,
60
+ underlayProps
61
+ } = useOverlay({
62
+ isOpen: true,
63
+ onClose,
64
+ isDismissable: true,
65
+ ...props
66
+ }, ref);
67
+ usePreventScroll();
68
+ const {
69
+ modalProps
70
+ } = useModal();
71
+ const headerChild = React.Children.toArray(children).find((child) => React.isValidElement(child) && child.type === DialogHeader);
72
+ const otherChildren = React.Children.toArray(children).filter((child) => !React.isValidElement(child) || child.type !== DialogHeader);
73
+ const hasHeader = Boolean(headerChild) || hasDismissButton;
74
+ const headerId = props["aria-labelledby"] || `${id}-header`;
75
+ const contentId = props["aria-describedby"] || `${id}-content`;
76
+ return /* @__PURE__ */ jsxs("div", { className: `${styles.dialogWrapper} ${modal ? styles.modal : ""}`, children: [
77
+ modal && /* @__PURE__ */ jsx("div", { className: styles.overlay, ...underlayProps, onClick: onClose, onKeyDown: (e) => {
78
+ if (e.key === "Enter" || e.key === "Space") {
79
+ onClose == null ? void 0 : onClose();
80
+ }
81
+ }, role: "button", tabIndex: 0 }),
82
+ /* @__PURE__ */ jsx(FocusScope, { contain: true, restoreFocus: true, autoFocus: false, children: /* @__PURE__ */ jsxs("div", { ...overlayProps, ...dialogProps, ...modalProps, ref, className: `${styles.dialog} ${styles[size]}`, "data-size": size, id, role, "aria-labelledby": headerId, "aria-describedby": contentId, children: [
83
+ /* @__PURE__ */ jsxs("div", { className: `${styles.dialogContent} ${!hasHeader ? styles.noHeader : ""}`, children: [
84
+ hasHeader && /* @__PURE__ */ jsx("div", { className: styles.dialogHeader, id: headerId, children: headerChild }),
85
+ /* @__PURE__ */ jsx("div", { id: contentId, children: otherChildren })
86
+ ] }),
87
+ hasDismissButton && /* @__PURE__ */ jsx("div", { className: styles.closeButton, children: /* @__PURE__ */ jsx(IconButton, { onClick: onClose, styleVariant: "white", emphasis: "primary", size: "sm", iconProps: {
88
+ iconName: "close",
89
+ iconPrefix: "far",
90
+ iconSize: "1x"
91
+ }, tooltipLabel: "Close dialog", "aria-label": "Close dialog" }) })
92
+ ] }) })
93
+ ] });
94
+ }
95
+ function Dialog(props) {
96
+ const {
97
+ isOpen,
98
+ children
99
+ } = props;
100
+ if (!isOpen) {
101
+ return null;
102
+ }
103
+ return /* @__PURE__ */ jsx(OverlayContainer, { children: /* @__PURE__ */ jsx(DialogWrapper, { ...props, children }) });
104
+ }
105
+ const DialogContent = ({
106
+ children
107
+ }) => {
108
+ return /* @__PURE__ */ jsx("div", { className: styles.dialogContentInner, children });
109
+ };
110
+ Dialog.Header = DialogHeader;
111
+ Dialog.Content = DialogContent;
112
+ export {
113
+ Dialog,
114
+ DialogContent,
115
+ Dialog as default
116
+ };
117
+ //# sourceMappingURL=Dialog.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Dialog.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export { default } from './Dialog';
@@ -0,0 +1,5 @@
1
+ import { Dialog } from "./Dialog.js";
2
+ export {
3
+ Dialog as default
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -15,7 +15,7 @@ const FieldError = ({
15
15
  const errorMessage = children || (validationErrors == null ? void 0 : validationErrors[0]);
16
16
  if (!errorMessage) return null;
17
17
  return /* @__PURE__ */ jsxs(Fragment, { children: [
18
- /* @__PURE__ */ jsx(Icon, { iconName: "triangle-exclamation", "aria-label": "error-icon" }),
18
+ /* @__PURE__ */ jsx(Icon, { iconName: "triangle-exclamation", iconPrefix: "fas", "aria-label": "error-icon" }),
19
19
  errorMessage
20
20
  ] });
21
21
  } });
@@ -1,16 +1,16 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { Heading } from "../Heading/Heading.js";
3
- import '../../assets/FieldsetHeader.css';const fieldsetHeader = "_fieldsetHeader_abhm4_1";
3
+ import '../../assets/FieldsetHeader.css';const fieldsetHeader = "_fieldsetHeader_6pt1c_1";
4
4
  const styles = {
5
5
  fieldsetHeader,
6
- "fieldsetHeader-description": "_fieldsetHeader-description_abhm4_12"
6
+ "fieldsetHeader-description": "_fieldsetHeader-description_6pt1c_12"
7
7
  };
8
8
  const FieldsetHeader = ({
9
9
  children,
10
10
  description
11
11
  }) => {
12
12
  return /* @__PURE__ */ jsxs("div", { className: styles["fieldsetHeader"], children: [
13
- /* @__PURE__ */ jsx(Heading, { as: "legend", size: "sm", fgColor: "accentSecondary", children }),
13
+ /* @__PURE__ */ jsx(Heading, { as: "legend", size: "sm", foregroundColor: "accentSecondary", children }),
14
14
  description && /* @__PURE__ */ jsx("span", { className: styles["fieldsetHeader-description"], children: description })
15
15
  ] });
16
16
  };
@@ -1,20 +1,39 @@
1
1
  import { default as React } from 'react';
2
2
  import { VariantProps } from 'class-variance-authority';
3
- import { fgColorVariants } from '../../utils/fgColour/fgColor';
3
+ import { ForegroundVariants } from '../../utils/foregroundColour/foregroundColor';
4
4
  declare const heading: (props?: ({
5
- size?: "lg" | "sm" | "xs" | "md" | "xl" | "xxs" | null | undefined;
5
+ size?: "lg" | "sm" | "xs" | "xl" | "md" | "xxs" | null | undefined;
6
6
  textAlign?: "end" | "start" | "center" | null | undefined;
7
7
  } & import('class-variance-authority/types').ClassProp) | undefined) => string;
8
8
  type HeadingVariants = VariantProps<typeof heading>;
9
- type FgColorVariants = VariantProps<typeof fgColorVariants>;
10
9
  type HeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'span' | 'legend';
11
10
  type HeadingSize = 'xxs' | 'xs' | 'sm' | 'md' | 'lg' | 'xl';
12
11
  export interface HeadingProps extends HeadingVariants {
12
+ /**
13
+ * children
14
+ */
13
15
  children: React.ReactNode;
16
+ /**
17
+ * The heading element to render
18
+ */
14
19
  as?: HeadingLevel;
20
+ /**
21
+ * The size of the heading
22
+ */
15
23
  size?: HeadingSize;
16
- fgColor?: FgColorVariants['fgColor'];
24
+ /**
25
+ * The foreground color of the heading
26
+ */
27
+ foregroundColor?: ForegroundVariants['foregroundColor'];
28
+ /**
29
+ * The foreground color of the heading
30
+ * @deprecated Use `foregroundColor` instead
31
+ */
32
+ fgColor?: ForegroundVariants['foregroundColor'];
33
+ /**
34
+ * The text alignment of the heading
35
+ */
17
36
  textAlign?: 'start' | 'center' | 'end';
18
37
  }
19
- export declare const Heading: ({ children, as: Component, size, fgColor, textAlign, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
38
+ export declare const Heading: ({ children, as: Component, size, foregroundColor, fgColor, textAlign, ...props }: HeadingProps) => import("react/jsx-runtime").JSX.Element;
20
39
  export default Heading;
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { c as cva } from "../../index-Bi3v_EjJ.js";
3
- import { fgColorVariants } from "../../utils/fgColour/fgColor.js";
3
+ import { foregroundColorVariants } from "../../utils/foregroundColour/foregroundColor.js";
4
4
  import '../../assets/Heading.css';const heading$1 = "_heading_15puj_1";
5
5
  const xxs = "_xxs_15puj_8";
6
6
  const xs = "_xs_15puj_15";
@@ -60,16 +60,21 @@ const Heading = ({
60
60
  children,
61
61
  as: Component = "h1",
62
62
  size,
63
- fgColor = "accentPrimary",
63
+ foregroundColor = "accentSecondary",
64
+ fgColor,
64
65
  textAlign = "start",
65
66
  ...props
66
67
  }) => {
67
68
  const effectiveSize = size || DEFAULT_HEADING_SIZE_MAP[Component];
69
+ if (fgColor) {
70
+ console.warn("The `fgColor` prop has been deprecated. Please use `foregroundColor` instead.");
71
+ }
72
+ const resolvedFontColor = fgColor ?? foregroundColor ?? "accentSecondary";
68
73
  return /* @__PURE__ */ jsx(Component, { className: `${heading({
69
74
  size: effectiveSize,
70
75
  textAlign
71
- })} ${fgColorVariants({
72
- fgColor
76
+ })} ${foregroundColorVariants({
77
+ foregroundColor: resolvedFontColor
73
78
  })}`, ...props, children });
74
79
  };
75
80
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"Heading.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Heading.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,4 +1,11 @@
1
- export type IconSize = 'lg' | 'sm' | '1x' | 'xs' | '2x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x';
1
+ import { ForegroundVariants } from '../../utils/foregroundColour/foregroundColor';
2
+ import { BackgroundVariants } from '../../utils/backgroundColor/backgroundColor';
3
+ export type IconSize = '0.5x' | '0.75x' | '1x' | '1.25x' | '1.5x' | '2x' | '2.5x' | '3x' | '4x' | '5x' | '6x' | '7x' | '8x' | '9x' | '10x';
4
+ /**
5
+ * @deprecated These sizes will be removed in the next major version. Use 1x instead.
6
+ * @ignore
7
+ */
8
+ export type DeprecatedIconSize = 'lg' | 'sm' | 'xs' | '2xs' | 'xl' | '2xl';
2
9
  export interface IconProps {
3
10
  /**
4
11
  * What Icon to load from fontAwesome
@@ -8,11 +15,25 @@ export interface IconProps {
8
15
  * The prefix of the icon to load.
9
16
  * @default 'fas'
10
17
  */
11
- iconPrefix?: 'fas' | 'far' | 'fal' | 'fab' | 'fad';
18
+ iconPrefix?: 'fas' | 'far' | 'fal' | 'fab' | 'fad' | 'fak';
19
+ /**
20
+ * The icon pack to load.
21
+ * Example: 'brands'
22
+ */
23
+ iconPack?: string;
12
24
  /**
13
25
  * The size of the icon.
14
26
  */
15
- iconSize?: IconSize;
27
+ iconSize?: IconSize | DeprecatedIconSize;
28
+ /**
29
+ * The color of the icon.
30
+ */
31
+ color?: ForegroundVariants['foregroundColor'];
32
+ /**
33
+ * The padding of the icon.
34
+ * @default 'none'
35
+ */
36
+ padding?: 'none' | 'fixedWidth' | 'square' | 'roomy';
16
37
  /**
17
38
  * Flip the icon horizontally, vertically, or both.
18
39
  */
@@ -54,6 +75,11 @@ export interface IconProps {
54
75
  * Accessible text for the icon. If the icon is decorative, this can be omitted.
55
76
  */
56
77
  ariaLabel?: string;
78
+ /**
79
+ * Background color class for the icon used solely in iconBackdrop component
80
+ * @ignore
81
+ */
82
+ privateBgColorVariant?: BackgroundVariants['backgroundColor'];
57
83
  }
58
- export declare const Icon: ({ iconName, iconPrefix, iconSize: size, flip, fixedWidth, listItem, border, rotation, pull, spin, className, ariaLabel, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
84
+ export declare const Icon: ({ iconName, iconPrefix, iconSize, iconPack, color, padding, flip, fixedWidth, listItem, border, rotation, pull, spin, className, ariaLabel, privateBgColorVariant, ...props }: IconProps) => import("react/jsx-runtime").JSX.Element;
59
85
  export default Icon;
@@ -1,11 +1,92 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
+ import { c as cva } from "../../index-Bi3v_EjJ.js";
2
3
  import { useState, useEffect } from "react";
4
+ import { foregroundColorVariants } from "../../utils/foregroundColour/foregroundColor.js";
5
+ import { backgroundColorVariants } from "../../utils/backgroundColor/backgroundColor.js";
6
+ import '../../assets/Icon.css';const iconSize0_5x = "_iconSize0_5x_h11q1_8";
7
+ const iconSize0_75x = "_iconSize0_75x_h11q1_12";
8
+ const iconSize1_25x = "_iconSize1_25x_h11q1_16";
9
+ const iconSize1_5x = "_iconSize1_5x_h11q1_20";
10
+ const iconSize2_5x = "_iconSize2_5x_h11q1_24";
11
+ const iconSize1x = "_iconSize1x_h11q1_39";
12
+ const iconSize2x = "_iconSize2x_h11q1_54";
13
+ const iconSize3x = "_iconSize3x_h11q1_64";
14
+ const iconSize4x = "_iconSize4x_h11q1_69";
15
+ const iconSize5x = "_iconSize5x_h11q1_74";
16
+ const iconSize6x = "_iconSize6x_h11q1_79";
17
+ const iconSize7x = "_iconSize7x_h11q1_84";
18
+ const iconSize8x = "_iconSize8x_h11q1_89";
19
+ const iconSize9x = "_iconSize9x_h11q1_94";
20
+ const iconSize10x = "_iconSize10x_h11q1_99";
21
+ const icon$1 = "_icon_h11q1_1";
22
+ const fixedWidth = "_fixedWidth_h11q1_105";
23
+ const square = "_square_h11q1_109";
24
+ const roomy = "_roomy_h11q1_113";
25
+ const styles = {
26
+ "icon-wrapper": "_icon-wrapper_h11q1_1",
27
+ iconSize0_5x,
28
+ iconSize0_75x,
29
+ iconSize1_25x,
30
+ iconSize1_5x,
31
+ iconSize2_5x,
32
+ iconSize1x,
33
+ iconSize2x,
34
+ iconSize3x,
35
+ iconSize4x,
36
+ iconSize5x,
37
+ iconSize6x,
38
+ iconSize7x,
39
+ iconSize8x,
40
+ iconSize9x,
41
+ iconSize10x,
42
+ icon: icon$1,
43
+ fixedWidth,
44
+ square,
45
+ roomy
46
+ };
47
+ const icon = cva(styles.icon, {
48
+ variants: {
49
+ padding: {
50
+ none: "",
51
+ fixedWidth: styles.fixedWidth,
52
+ square: styles.square,
53
+ roomy: styles.roomy
54
+ },
55
+ iconSize: {
56
+ default: styles.iconSize1x,
57
+ "0.5x": styles.iconSize0_5x,
58
+ "0.75x": styles.iconSize0_75x,
59
+ "1x": styles.iconSize1x,
60
+ "1.25x": styles.iconSize1_25x,
61
+ "1.5x": styles.iconSize1_5x,
62
+ "2x": styles.iconSize2x,
63
+ "2.5x": styles.iconSize2_5x,
64
+ "3x": styles.iconSize3x,
65
+ "4x": styles.iconSize4x,
66
+ "5x": styles.iconSize5x,
67
+ "6x": styles.iconSize6x,
68
+ "7x": styles.iconSize7x,
69
+ "8x": styles.iconSize8x,
70
+ "9x": styles.iconSize9x,
71
+ "10x": styles.iconSize10x,
72
+ lg: styles.iconSize1_25x,
73
+ sm: styles.iconSize1x,
74
+ xs: styles.iconSize1x,
75
+ "2xs": styles.iconSize0_75x,
76
+ xl: styles.iconSize2x,
77
+ "2xl": styles.iconSize3x
78
+ }
79
+ }
80
+ });
3
81
  const Icon = ({
4
82
  iconName,
5
83
  iconPrefix = "far",
6
- iconSize: size,
84
+ iconSize = "1x",
85
+ iconPack,
86
+ color,
87
+ padding = "none",
7
88
  flip,
8
- fixedWidth,
89
+ fixedWidth: fixedWidth2 = true,
9
90
  listItem,
10
91
  border,
11
92
  rotation,
@@ -14,19 +95,31 @@ const Icon = ({
14
95
  spin,
15
96
  className,
16
97
  ariaLabel,
98
+ privateBgColorVariant,
17
99
  ...props
18
100
  }) => {
19
101
  const [key, setKey] = useState(0);
20
102
  useEffect(() => {
21
103
  setKey((prevKey) => prevKey + 1);
22
- }, [iconName, iconPrefix, size, flip, fixedWidth, listItem, border, rotation, pull, spin, ariaLabel]);
104
+ }, [iconName, iconPrefix, iconSize, iconPack, color, padding, flip, fixedWidth2, listItem, border, rotation, pull, spin, ariaLabel, privateBgColorVariant]);
105
+ const fontAwesomeSize = ["2x", "3x", "4x", "5x", "6x", "7x", "8x", "9x", "10x"].includes(iconSize || "") ? `fa-${iconSize}` : "";
106
+ const formatSize = (iconSize2) => `iconSize${iconSize2.replace(".", "_")}`;
107
+ const customSizeClass = iconSize && styles[formatSize(iconSize)];
23
108
  const accessibilityProps = ariaLabel ? {
24
109
  "aria-label": ariaLabel
25
110
  } : {
26
111
  "aria-label": iconName
27
112
  };
28
- const classNames = [iconPrefix, `fa-${iconName}`, size ? `fa-${size}` : "", flip ? `fa-flip-${flip}` : "", fixedWidth ? "fa-fw" : "", listItem ? "fa-li" : "", border ? "fa-border" : "", rotation ? `fa-rotate-${rotation}` : "", pull ? `fa-pull-${pull}` : "", spin ? "fa-spin" : ""].filter(Boolean).join(" ");
29
- return /* @__PURE__ */ jsx("span", { className: `icon-wrapper ${className || ""}`, children: /* @__PURE__ */ jsx("i", { className: classNames, ...accessibilityProps, ...props, role: "img" }) }, key);
113
+ const classNames = [iconPrefix, `fa-${iconName}`, fontAwesomeSize, iconPack ? `fa-${iconPack}` : "", flip ? `fa-flip-${flip}` : "", fixedWidth2 ? "fa-fw" : "", listItem ? "fa-li" : "", border ? "fa-border" : "", rotation ? `fa-rotate-${rotation}` : "", pull ? `fa-pull-${pull}` : "", spin ? "fa-spin" : "", customSizeClass].filter(Boolean).join(" ");
114
+ return /* @__PURE__ */ jsx("span", { className: `icon-wrapper ${styles["icon-wrapper"]} ${className || ""} ${icon({
115
+ iconSize
116
+ })}`, children: /* @__PURE__ */ jsx("i", { className: `${classNames} ${icon({
117
+ padding
118
+ })} ${foregroundColorVariants({
119
+ foregroundColor: color
120
+ })} ${backgroundColorVariants({
121
+ backgroundColor: privateBgColorVariant ?? "transparent"
122
+ })}`, ...accessibilityProps, ...props, role: "img" }) }, key);
30
123
  };
31
124
  export {
32
125
  Icon,
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"Icon.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,24 @@
1
+ import { BackgroundVariants } from '../../utils/backgroundColor/backgroundColor';
2
+ import { IconProps } from '../Icon/Icon';
3
+ export interface IconBackdropProps {
4
+ /**
5
+ * The shape of the backdrop
6
+ * @default 'squircle'
7
+ */
8
+ backdropShape?: 'circle' | 'squircle';
9
+ /**
10
+ * The colour of the backdrop
11
+ * @default 'accentSubtle'
12
+ */
13
+ backdropColor?: BackgroundVariants['backgroundColor'];
14
+ /**
15
+ * The size of the backdrop
16
+ */
17
+ iconSize?: IconProps['iconSize'];
18
+ /**
19
+ * The icon properties
20
+ */
21
+ iconProps?: Omit<IconProps, 'iconSize' | 'padding'>;
22
+ }
23
+ export declare const IconBackdrop: ({ backdropShape, backdropColor, iconSize, iconProps, }: IconBackdropProps) => import("react/jsx-runtime").JSX.Element;
24
+ export default IconBackdrop;
@@ -0,0 +1,34 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { c as cva } from "../../index-Bi3v_EjJ.js";
3
+ import { Icon } from "../Icon/Icon.js";
4
+ import '../../assets/IconBackdrop.css';const iconBackdrop$1 = "_iconBackdrop_1e7m2_1";
5
+ const squircle = "_squircle_1e7m2_7";
6
+ const circle = "_circle_1e7m2_11";
7
+ const styles = {
8
+ iconBackdrop: iconBackdrop$1,
9
+ squircle,
10
+ circle
11
+ };
12
+ const iconBackdrop = cva(styles.iconBackdrop, {
13
+ variants: {
14
+ backdropShape: {
15
+ circle: styles.circle,
16
+ squircle: styles.squircle
17
+ }
18
+ }
19
+ });
20
+ const IconBackdrop = ({
21
+ backdropShape = "squircle",
22
+ backdropColor = "accentSubtle",
23
+ iconSize = "2x",
24
+ iconProps = {}
25
+ }) => {
26
+ return /* @__PURE__ */ jsx("span", { className: `${iconBackdrop({
27
+ backdropShape
28
+ })}`, children: /* @__PURE__ */ jsx(Icon, { padding: "roomy", iconName: iconProps.iconName ?? "plane-up", ...iconProps, iconSize, privateBgColorVariant: backdropColor }) });
29
+ };
30
+ export {
31
+ IconBackdrop,
32
+ IconBackdrop as default
33
+ };
34
+ //# sourceMappingURL=IconBackdrop.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"IconBackdrop.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1 @@
1
+ export { default } from './IconBackdrop';
@@ -0,0 +1,5 @@
1
+ import { IconBackdrop } from "./IconBackdrop.js";
2
+ export {
3
+ IconBackdrop as default
4
+ };
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
@@ -28,5 +28,5 @@ export interface IconButtonProps extends Omit<ButtonProps<'button'>, 'onClick'>,
28
28
  */
29
29
  tooltipPlacement?: 'top' | 'bottom' | 'left' | 'right';
30
30
  }
31
- export declare const IconButton: ({ styleType, styleVariant, emphasis, size, isLoading, iconProps, onClick, form, formAction, formEncType, formMethod, formNoValidate, formTarget, name, value, isDisabled, autoFocus, type, focusStyle, slot, tooltipLabel, tooltipPlacement, ...props }: IconButtonProps) => import("react/jsx-runtime").JSX.Element;
31
+ export declare const IconButton: import('react').ForwardRefExoticComponent<IconButtonProps & import('react').RefAttributes<HTMLButtonElement>>;
32
32
  export default IconButton;