@arc-ui/components 11.0.0 → 11.2.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 (142) hide show
  1. package/dist/Align/Align.esm.js +4 -4
  2. package/dist/Badge/Badge.cjs.d.ts +26 -0
  3. package/dist/Badge/Badge.cjs.js +37 -0
  4. package/dist/Badge/Badge.esm.d.ts +26 -0
  5. package/dist/Badge/Badge.esm.js +29 -0
  6. package/dist/Badge/package.json +7 -0
  7. package/dist/Base/Base.cjs.d.ts +1 -16
  8. package/dist/Base/Base.cjs.js +4 -16
  9. package/dist/Base/Base.esm.d.ts +1 -16
  10. package/dist/Base/Base.esm.js +3 -15
  11. package/dist/BrandLogo/BrandLogo.esm.d.ts +1 -1
  12. package/dist/BrandLogo/BrandLogo.esm.js +2 -2
  13. package/dist/Breadcrumbs/Breadcrumbs.esm.js +27 -27
  14. package/dist/Button/Button.esm.d.ts +1 -1
  15. package/dist/Button/Button.esm.js +4 -4
  16. package/dist/Card/Card.esm.js +27 -27
  17. package/dist/Checkbox/Checkbox.cjs.js +4 -1
  18. package/dist/Checkbox/Checkbox.esm.js +18 -15
  19. package/dist/Clock/Clock.esm.js +3 -3
  20. package/dist/Columns/Columns.esm.js +5 -5
  21. package/dist/Curve/Curve.esm.d.ts +1 -1
  22. package/dist/Curve/Curve.esm.js +1 -1
  23. package/dist/Disclosure/Disclosure.esm.d.ts +1 -1
  24. package/dist/Disclosure/Disclosure.esm.js +10 -10
  25. package/dist/Elevation/Elevation.esm.js +2 -2
  26. package/dist/FormControl/FormControl.cjs.d.ts +1 -1
  27. package/dist/FormControl/FormControl.cjs.js +4 -1
  28. package/dist/FormControl/FormControl.esm.d.ts +1 -1
  29. package/dist/FormControl/FormControl.esm.js +5 -2
  30. package/dist/Group/Group.esm.js +6 -6
  31. package/dist/Heading/Heading.esm.d.ts +1 -1
  32. package/dist/Heading/Heading.esm.js +2 -2
  33. package/dist/Icon/Icon.esm.d.ts +1 -1
  34. package/dist/Icon/Icon.esm.js +2 -2
  35. package/dist/Image/Image.esm.d.ts +1 -1
  36. package/dist/Image/Image.esm.js +1 -1
  37. package/dist/Markup/Markup.esm.js +3 -3
  38. package/dist/Poster/Poster.esm.d.ts +1 -1
  39. package/dist/Poster/Poster.esm.js +9 -9
  40. package/dist/RadioGroup/RadioGroup.cjs.d.ts +1 -1
  41. package/dist/RadioGroup/RadioGroup.cjs.js +4 -1
  42. package/dist/RadioGroup/RadioGroup.esm.d.ts +1 -1
  43. package/dist/RadioGroup/RadioGroup.esm.js +15 -12
  44. package/dist/Rule/Rule.esm.js +3 -3
  45. package/dist/Section/Section.esm.d.ts +1 -1
  46. package/dist/Section/Section.esm.js +1 -1
  47. package/dist/Select/Select.cjs.d.ts +25 -0
  48. package/dist/Select/Select.cjs.js +2611 -0
  49. package/dist/Select/Select.esm.d.ts +25 -0
  50. package/dist/Select/Select.esm.js +2584 -0
  51. package/dist/Select/package.json +7 -0
  52. package/dist/SiteFooter/SiteFooter.esm.js +33 -33
  53. package/dist/SiteHeader/SiteHeader.esm.d.ts +1 -1
  54. package/dist/SiteHeader/SiteHeader.esm.js +98 -98
  55. package/dist/Surface/Surface.esm.d.ts +1 -1
  56. package/dist/Surface/Surface.esm.js +1 -1
  57. package/dist/Switch/Switch.cjs.d.ts +40 -0
  58. package/dist/Switch/Switch.cjs.js +210 -0
  59. package/dist/Switch/Switch.esm.d.ts +40 -0
  60. package/dist/Switch/Switch.esm.js +202 -0
  61. package/dist/Switch/package.json +7 -0
  62. package/dist/Text/Text.esm.d.ts +1 -1
  63. package/dist/Text/Text.esm.js +2 -2
  64. package/dist/TextInput/TextInput.cjs.d.ts +5 -1
  65. package/dist/TextInput/TextInput.cjs.js +25 -6
  66. package/dist/TextInput/TextInput.esm.d.ts +5 -1
  67. package/dist/TextInput/TextInput.esm.js +28 -9
  68. package/dist/Truncate/Truncate.cjs.d.ts +18 -0
  69. package/dist/Truncate/Truncate.cjs.js +17 -0
  70. package/dist/Truncate/Truncate.esm.d.ts +18 -0
  71. package/dist/Truncate/Truncate.esm.js +9 -0
  72. package/dist/Truncate/package.json +7 -0
  73. package/dist/UniversalHeader/UniversalHeader.esm.js +8 -8
  74. package/dist/VerticalSpace/VerticalSpace.cjs.d.ts +1 -18
  75. package/dist/VerticalSpace/VerticalSpace.cjs.js +5 -20
  76. package/dist/VerticalSpace/VerticalSpace.esm.d.ts +1 -18
  77. package/dist/VerticalSpace/VerticalSpace.esm.js +4 -19
  78. package/dist/VisuallyHidden/VisuallyHidden.cjs.d.ts +1 -12
  79. package/dist/VisuallyHidden/VisuallyHidden.cjs.js +3 -12
  80. package/dist/VisuallyHidden/VisuallyHidden.esm.d.ts +1 -12
  81. package/dist/VisuallyHidden/VisuallyHidden.esm.js +2 -11
  82. package/dist/_shared/cjs/Base-e2b846fe.d.ts +19 -0
  83. package/dist/_shared/cjs/Base-e2b846fe.js +22 -0
  84. package/dist/_shared/cjs/BtIconTickAlt2Px-b12ecc78.js +425 -0
  85. package/dist/_shared/cjs/{FormControl-a1b7421b.d.ts → FormControl-e6b7d7c5.d.ts} +51 -3
  86. package/dist/_shared/cjs/{FormControl-a1b7421b.js → FormControl-e6b7d7c5.js} +40 -8
  87. package/dist/_shared/cjs/VerticalSpace-65ad083c.d.ts +18 -0
  88. package/dist/_shared/cjs/VerticalSpace-65ad083c.js +25 -0
  89. package/dist/_shared/cjs/VisuallyHidden-e2c8b291.d.ts +12 -0
  90. package/dist/_shared/cjs/VisuallyHidden-e2c8b291.js +17 -0
  91. package/dist/_shared/cjs/index-c81c9401.d.ts +1 -1
  92. package/dist/_shared/esm/Base-c235dc45.d.ts +19 -0
  93. package/dist/_shared/esm/Base-c235dc45.js +15 -0
  94. package/dist/_shared/esm/{BrandLogo-ea3dd0e6.js → BrandLogo-4f13fe85.js} +4 -4
  95. package/dist/_shared/esm/{BtIconChevronDown2Px-4abd079b.js → BtIconChevronDown2Px-782876e2.js} +2 -2
  96. package/dist/_shared/esm/{BtIconChevronRight2Px-a5cc1d05.js → BtIconChevronRight2Px-b8e7b4ad.js} +3 -3
  97. package/dist/_shared/esm/{BtIconChevronRightMid-386cf272.js → BtIconChevronRightMid-d9b11761.js} +2 -2
  98. package/dist/_shared/esm/BtIconTickAlt2Px-2c4ec3be.js +408 -0
  99. package/dist/_shared/esm/{Button-5ff56a7b.js → Button-69439f8f.js} +15 -15
  100. package/dist/_shared/esm/{Curve-cfdca379.js → Curve-50697f7e.js} +2 -2
  101. package/dist/_shared/esm/{FormControl-feedc495.d.ts → FormControl-84c9ace6.d.ts} +51 -3
  102. package/dist/_shared/esm/FormControl-84c9ace6.js +138 -0
  103. package/dist/_shared/esm/{Heading-183be76c.js → Heading-eb1e42db.js} +4 -4
  104. package/dist/_shared/esm/{Icon-76d0d8c0.js → Icon-61f7237a.js} +5 -5
  105. package/dist/_shared/esm/{Image-7e4948f6.js → Image-c0f3d42f.js} +7 -7
  106. package/dist/_shared/esm/{Section-f1256c87.js → Section-7bc71e26.js} +2 -2
  107. package/dist/_shared/esm/{Surface-d515d212.js → Surface-bf201530.js} +3 -3
  108. package/dist/_shared/esm/{Text-d8988620.js → Text-6b958ad8.js} +3 -3
  109. package/dist/_shared/esm/VerticalSpace-6b4f5e50.d.ts +18 -0
  110. package/dist/_shared/esm/VerticalSpace-6b4f5e50.js +19 -0
  111. package/dist/_shared/esm/VisuallyHidden-b9eebf71.d.ts +12 -0
  112. package/dist/_shared/esm/VisuallyHidden-b9eebf71.js +11 -0
  113. package/dist/_shared/esm/index-c81c9401.d.ts +1 -1
  114. package/dist/index.es.js +34623 -529
  115. package/dist/index.es.js.map +1 -1
  116. package/dist/index.js +34527 -411
  117. package/dist/index.js.map +1 -1
  118. package/dist/styles.css +1 -1
  119. package/dist/types/components/Badge/Badge.d.ts +25 -0
  120. package/dist/types/components/Badge/index.d.ts +1 -0
  121. package/dist/types/components/FormControl/FormControl.d.ts +17 -0
  122. package/dist/types/components/FormControl/FormControlDisclosure/FormControlDisclosure.d.ts +28 -0
  123. package/dist/types/components/FormControl/FormControlDisclosure/index.d.ts +1 -0
  124. package/dist/types/components/Select/Select.d.ts +2 -1
  125. package/dist/types/components/Switch/Switch.d.ts +13 -8
  126. package/dist/types/components/TextInput/TextInput.d.ts +4 -0
  127. package/dist/types/components/Truncate/Truncate.d.ts +17 -0
  128. package/dist/types/components/Truncate/index.d.ts +1 -0
  129. package/dist/types/components/index.d.ts +4 -0
  130. package/dist/types/hooks/use-aria-describedby.d.ts +5 -1
  131. package/dist/types/styles.d.ts +4 -0
  132. package/package.json +4 -4
  133. package/dist/_shared/esm/FormControl-feedc495.js +0 -106
  134. /package/dist/_shared/esm/{BrandLogo-ea3dd0e6.d.ts → BrandLogo-4f13fe85.d.ts} +0 -0
  135. /package/dist/_shared/esm/{Button-5ff56a7b.d.ts → Button-69439f8f.d.ts} +0 -0
  136. /package/dist/_shared/esm/{Curve-cfdca379.d.ts → Curve-50697f7e.d.ts} +0 -0
  137. /package/dist/_shared/esm/{Heading-183be76c.d.ts → Heading-eb1e42db.d.ts} +0 -0
  138. /package/dist/_shared/esm/{Icon-76d0d8c0.d.ts → Icon-61f7237a.d.ts} +0 -0
  139. /package/dist/_shared/esm/{Image-7e4948f6.d.ts → Image-c0f3d42f.d.ts} +0 -0
  140. /package/dist/_shared/esm/{Section-f1256c87.d.ts → Section-7bc71e26.d.ts} +0 -0
  141. /package/dist/_shared/esm/{Surface-d515d212.d.ts → Surface-bf201530.d.ts} +0 -0
  142. /package/dist/_shared/esm/{Text-d8988620.d.ts → Text-6b958ad8.d.ts} +0 -0
@@ -0,0 +1,25 @@
1
+ import { FC, ReactNode } from "react";
2
+ /** Use `Badge` component to visually display a small amount of information, such as notification counts or status indicators. */
3
+ export declare const Badge: FC<BadgeProps>;
4
+ export interface BadgeProps {
5
+ /**
6
+ * Text to display within Badge
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * Badge Size
11
+ */
12
+ size?: "default" | "large";
13
+ /**
14
+ * Badge has outline
15
+ */
16
+ fill?: "solid" | "outlined";
17
+ /**
18
+ * State of the Badge
19
+ */
20
+ state?: "default" | "error" | "warning" | "success";
21
+ /**
22
+ * Aria label for accessibility
23
+ */
24
+ ariaLabel?: string;
25
+ }
@@ -0,0 +1 @@
1
+ export { Badge } from "./Badge";
@@ -42,9 +42,26 @@ export interface FormControlProps {
42
42
  * Label for the FormControl.
43
43
  */
44
44
  label: string;
45
+ /**
46
+ * Determins if the Label should be in a disabled state
47
+ */
48
+ isDisabled?: boolean;
45
49
  /**
46
50
  * Label size.
47
51
  */
48
52
  labelSize?: "s" | "l";
53
+ /**
54
+ * Use `DisclosureTitle` to display content that is only visible when toggled into
55
+ * an "open" state. This overrides helper text.
56
+ */
57
+ disclosureTitle?: string;
58
+ /**
59
+ * Text to display within the disclosure
60
+ */
61
+ disclosureText?: string;
62
+ /**
63
+ * onClick handler for FormControlDisclosure
64
+ */
65
+ onClickDisclosure?: () => void;
49
66
  }
50
67
  export { Context as FormControlContext };
@@ -0,0 +1,28 @@
1
+ import { FC, ReactNode } from "react";
2
+ /**
3
+ * Use `FormControlDisclosure` to display content that is only visible when toggled into
4
+ * an "open" state.
5
+ */
6
+ export declare const FormControlDisclosure: FC<FormControlDisclosureProps>;
7
+ export interface FormControlDisclosureProps {
8
+ /**
9
+ * Content to display in the FormControlDisclosure.
10
+ */
11
+ children: ReactNode;
12
+ /**
13
+ * FormControlDisclosure ID.
14
+ */
15
+ id?: string;
16
+ /**
17
+ * The FormControlDisclosure summary text.
18
+ */
19
+ summary: string;
20
+ /**
21
+ * On Click handler for FormControlDisclosure summary disclosure.
22
+ */
23
+ onClick?: () => void;
24
+ /**
25
+ * Disclosure size.
26
+ */
27
+ size?: "s" | "l";
28
+ }
@@ -0,0 +1 @@
1
+ export { FormControlDisclosure } from "./FormControlDisclosure";
@@ -1,5 +1,7 @@
1
1
  import React, { FocusEvent } from "react";
2
2
  import { FormControlProps } from "../FormControl/FormControl";
3
+ /** Use `Select` to choose from a dropdown list of options. */
4
+ export declare const Select: React.FC<SelectProps>;
3
5
  export interface SelectProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus" | "id"> {
4
6
  name: string;
5
7
  label: string;
@@ -18,4 +20,3 @@ export interface SelectProps extends Omit<FormControlProps, "children" | "elemen
18
20
  isDefaultOpen?: boolean;
19
21
  isRequired?: boolean;
20
22
  }
21
- export declare const Select: React.FC<SelectProps>;
@@ -1,20 +1,25 @@
1
1
  import { FC } from "react";
2
2
  import { SwitchProps as RadixSwitchProps } from "@radix-ui/react-switch";
3
- /** `WIP`: Use `Switch` to toggle between checked and not checked. */
3
+ import { FormControlProps } from "../FormControl/FormControl";
4
+ /** Use `Switch` to toggle between checked and not checked. */
4
5
  export declare const Switch: FC<SwitchProps>;
5
- export interface SwitchProps {
6
+ export interface SwitchProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus" | "disclosureText" | "disclosureTitle" | "onClickDisclosure" | "helper"> {
6
7
  /**
7
- * label for screen readers to announce
8
+ * Hide Label above toggle?
8
9
  */
9
- label: string;
10
+ hideLabel?: boolean;
10
11
  /**
11
- * handler for blur
12
+ * Text to display next to `Switch`
12
13
  */
13
- onBlur?: RadixSwitchProps["onBlur"];
14
+ statusText?: string;
15
+ /**
16
+ * Should the `Switch` be disabled?
17
+ */
18
+ isDisabled?: FormControlProps["isDisabled"];
14
19
  /**
15
- * show rendered label above input, useful for forms
20
+ * handler for blur
16
21
  */
17
- showLabel?: boolean;
22
+ onBlur?: RadixSwitchProps["onBlur"];
18
23
  /**
19
24
  * set the switch to be checked by default
20
25
  */
@@ -56,6 +56,10 @@ export interface TextInputProps extends Omit<FormControlProps, "children" | "ele
56
56
  * Validation regex pattern.
57
57
  */
58
58
  pattern?: string;
59
+ /**
60
+ * Enable button to toggle TextInput type from `Selected Type` to `Text`
61
+ */
62
+ showPassword?: boolean;
59
63
  /**
60
64
  * Type for the input. `number` will be changed to `text` and set the `numeric` inputMode.
61
65
  */
@@ -0,0 +1,17 @@
1
+ import { FC, ReactNode } from "react";
2
+ /** Use `Truncate` component to shorten text with an ellipsis. Add a `title` attribute to the truncated element so the full text remains accessible. */
3
+ export declare const Truncate: FC<TruncateProps>;
4
+ export interface TruncateProps {
5
+ /**
6
+ * Content to truncate.
7
+ */
8
+ children: ReactNode;
9
+ /**
10
+ * Use title to provide extra information about text that is truncated.
11
+ */
12
+ title: string;
13
+ /**
14
+ * Set max width of visible content within `Truncate`. Default is `100%`.
15
+ */
16
+ maxWidth?: number;
17
+ }
@@ -0,0 +1 @@
1
+ export { Truncate } from "./Truncate";
@@ -21,10 +21,14 @@ export { Poster } from "./Poster";
21
21
  export { RadioGroup } from "./RadioGroup";
22
22
  export { Rule } from "./Rule";
23
23
  export { Section } from "./Section";
24
+ export { Select } from "./Select";
24
25
  export { SiteFooter, SiteFooterRehydrator } from "./SiteFooter";
25
26
  export { SiteHeader, SiteHeaderRehydrator } from "./SiteHeader";
26
27
  export { Surface, SurfaceContext } from "./Surface";
28
+ export { Switch } from "./Switch";
29
+ export { Badge } from "./Badge";
27
30
  export { Text } from "./Text";
28
31
  export { TextInput } from "./TextInput";
32
+ export { Truncate } from "./Truncate";
29
33
  export { VerticalSpace } from "./VerticalSpace";
30
34
  export { VisuallyHidden } from "./VisuallyHidden";
@@ -1,18 +1,22 @@
1
1
  /**
2
2
  * Optionally define ariaDescribedBy if errorMessage or helper exist.
3
3
  */
4
- export declare const useAriaDescribedby: ({ id, idError, idHelper, errorMessage, helper }: {
4
+ export declare const useAriaDescribedby: ({ id, idError, idHelper, idDisclosure, errorMessage, helper, disclosureText }: {
5
5
  id?: string | undefined;
6
6
  idError?: string | undefined;
7
+ idDisclosure?: string | undefined;
7
8
  idHelper?: string | undefined;
8
9
  errorMessage?: any;
9
10
  helper?: any;
11
+ disclosureText?: string | undefined;
10
12
  }) => {
11
13
  ariaDescribedby: undefined;
12
14
  idHelper: undefined;
13
15
  idError: undefined;
16
+ idDisclosure: undefined;
14
17
  } | {
15
18
  ariaDescribedby: string | undefined;
16
19
  idError: string;
17
20
  idHelper: string;
21
+ idDisclosure: string;
18
22
  };
@@ -1,4 +1,5 @@
1
1
  import "./components/Align/Align.css";
2
+ import "./components/Badge/Badge.css";
2
3
  import "./components/Base/Base.css";
3
4
  import "./components/BrandLogo/BrandLogo.css";
4
5
  import "./components/Breadcrumbs/Breadcrumbs.css";
@@ -11,6 +12,7 @@ import "./components/Columns/Columns.offsets.css";
11
12
  import "./components/Disclosure/Disclosure.css";
12
13
  import "./components/Elevation/Elevation.css";
13
14
  import "./components/FormControl/FormControl.css";
15
+ import "./components/FormControl/FormControlDisclosure/FormControlDisclosure.css";
14
16
  import "./components/Group/Group.css";
15
17
  import "./components/Heading/Heading.css";
16
18
  import "./components/Icon/Icon.css";
@@ -26,6 +28,7 @@ import "./components/SiteHeader/SiteHeader.css";
26
28
  import "./components/Surface/Surface.css";
27
29
  import "./components/Text/Text.css";
28
30
  import "./components/TextInput/TextInput.css";
31
+ import "./components/Truncate/Truncate.css";
29
32
  import "./components/UniversalHeader/UniversalHeader.css";
30
33
  import "./components/VerticalSpace/VerticalSpace.css";
31
34
  import "./components/VisuallyHidden/VisuallyHidden.css";
@@ -39,6 +42,7 @@ import "./components/Curve/Curve.bt.css";
39
42
  import "./components/Disclosure/Disclosure.bt.css";
40
43
  import "./components/Elevation/Elevation.bt.css";
41
44
  import "./components/FormControl/FormControl.bt.css";
45
+ import "./components/FormControl/FormControlDisclosure/FormControlDisclosure.bt.css";
42
46
  import "./components/Group/Group.bt.css";
43
47
  import "./components/Heading/Heading.bt.css";
44
48
  import "./components/Icon/Icon.bt.css";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@arc-ui/components",
3
- "version": "11.0.0",
3
+ "version": "11.2.0",
4
4
  "homepage": "https://ui.digital-ent-int.bt.com",
5
5
  "author": "BT Enterprise Digital UI Team <ui-digital-ent-int@bt.com>",
6
6
  "main": "./dist/index.js",
@@ -32,9 +32,9 @@
32
32
  "@radix-ui/react-switch": "^1.0.1"
33
33
  },
34
34
  "devDependencies": {
35
- "@arc-ui/fonts": "^11.0.0",
36
- "@arc-ui/icons": "^11.0.0",
37
- "@arc-ui/tokens": "^11.0.0",
35
+ "@arc-ui/fonts": "^11.2.0",
36
+ "@arc-ui/icons": "^11.2.0",
37
+ "@arc-ui/tokens": "^11.2.0",
38
38
  "@babel/core": "^7.14.3",
39
39
  "@babel/helper-define-map": "^7.14.3",
40
40
  "@storybook/addon-essentials": "^6.3.6",
@@ -1,106 +0,0 @@
1
- import { _ as __rest, a as __assign, f as filterDataAttrs } from './index-229fc864.js';
2
- import { c as classNames } from './index-2ae58626.js';
3
- import React$1, { createContext, useContext } from 'react';
4
- import { C as Context$1 } from './Surface-d515d212.js';
5
-
6
- /**
7
- * Optionally define ariaDescribedBy if errorMessage or helper exist.
8
- */
9
- var useAriaDescribedby = function (_a) {
10
- var id = _a.id, _b = _a.idError, idError = _b === void 0 ? "".concat(id, "-error") : _b, _c = _a.idHelper, idHelper = _c === void 0 ? "".concat(id, "-helper") : _c, errorMessage = _a.errorMessage, helper = _a.helper;
11
- if (!id) {
12
- return {
13
- ariaDescribedby: undefined,
14
- idHelper: undefined,
15
- idError: undefined
16
- };
17
- }
18
- var ariaDescribedbyArr = [];
19
- if (errorMessage) {
20
- ariaDescribedbyArr.push(idError);
21
- }
22
- if (helper) {
23
- ariaDescribedbyArr.push(idHelper);
24
- }
25
- var ariaDescribedby = ariaDescribedbyArr.length > 0 ? ariaDescribedbyArr.join(" ") : undefined;
26
- return { ariaDescribedby: ariaDescribedby, idError: idError, idHelper: idHelper };
27
- };
28
-
29
- const React = React$1;
30
- const BtIconAlert = props =>
31
- /*#__PURE__*/ React.createElement(
32
- "svg",
33
- Object.assign(
34
- {
35
- xmlns: "http://www.w3.org/2000/svg",
36
- viewBox: "0 0 32 32"
37
- },
38
- props
39
- ),
40
- /*#__PURE__*/ React.createElement("defs", null),
41
- /*#__PURE__*/ React.createElement("path", {
42
- d:
43
- "M16,2A14,14,0,1,0,30,16,14,14,0,0,0,16,2Zm0,27A13,13,0,1,1,29,16,13.01474,13.01474,0,0,1,16,29Z",
44
- fill: "currentColor"
45
- }),
46
- /*#__PURE__*/ React.createElement("path", {
47
- fill: "currentColor",
48
- d: "M16 20.99335A1 1 0 1 0 16 22.99335 1 1 0 1 0 16 20.99335z"
49
- }),
50
- /*#__PURE__*/ React.createElement("path", {
51
- d:
52
- "M16.00488,19.00977a.49972.49972,0,0,0,.5-.5L16.50684,9.5a.5.5,0,0,0-1,0l-.002,9.00977A.5.5,0,0,0,16.00488,19.00977Z",
53
- fill: "currentColor"
54
- })
55
- );
56
- var BtIconAlert_2 = BtIconAlert;
57
-
58
- var defaultContext = {
59
- requirementStatus: null
60
- };
61
- var Context = createContext(defaultContext);
62
- var Provider = Context.Provider;
63
- /**
64
- * Use `FormControl` to provide inputs with labels, helper text and error messages
65
- */
66
- var FormControl = function (_a) {
67
- var children = _a.children, _b = _a.elementType, ElementType = _b === void 0 ? "div" : _b, errorMessage = _a.errorMessage, helper = _a.helper, htmlFor = _a.htmlFor, id = _a.id, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, _d = _a.requirementStatus, requirementStatus = _d === void 0 ? "optional" : _d, props = __rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus"]);
68
- var surface = useContext(Context$1).surface;
69
- var _e = useAriaDescribedby({
70
- errorMessage: errorMessage,
71
- helper: helper,
72
- id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
73
- }), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
74
- var LabelType = ElementType === "div" ? "label" : "legend";
75
- var elementProps = {};
76
- var labelProps = {};
77
- if (LabelType === "label") {
78
- labelProps["htmlFor"] = htmlFor;
79
- if (htmlFor) {
80
- labelProps["id"] = "".concat(htmlFor, "-label");
81
- }
82
- else if (id) {
83
- labelProps["id"] = "".concat(id, "-label");
84
- }
85
- }
86
- else {
87
- elementProps["aria-describedby"] = ariaDescribedby;
88
- }
89
- return (React$1.createElement(Provider, { value: { requirementStatus: requirementStatus } },
90
- React$1.createElement(ElementType, __assign({ className: classNames({
91
- "arc-FormControl": true,
92
- "arc-FormControl--smallLabel": labelSize === "s",
93
- "arc-FormControl--onDarkSurface": surface === "dark"
94
- }), id: id }, elementProps, filterDataAttrs(props)),
95
- React$1.createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
96
- label,
97
- requirementStatus === "optional" && (React$1.createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
98
- helper && (React$1.createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
99
- children,
100
- errorMessage && (React$1.createElement("div", { className: "arc-FormControl-error", id: idError },
101
- React$1.createElement("span", { className: "arc-FormControl-error--icon" },
102
- React$1.createElement(BtIconAlert_2, null)),
103
- errorMessage)))));
104
- };
105
-
106
- export { BtIconAlert_2 as B, Context as C, FormControl as F, useAriaDescribedby as u };