@arc-ui/components 10.0.3 → 10.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.
- package/dist/Align/index.d.ts +25 -0
- package/dist/Align/index.js +25 -0
- package/dist/Base/index.d.ts +16 -0
- package/dist/Base/index.js +12 -0
- package/dist/BrandLogo/index.d.ts +1 -0
- package/dist/BrandLogo/index.js +6 -0
- package/dist/Breadcrumbs/index.d.ts +57 -0
- package/dist/Breadcrumbs/index.js +17294 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +8 -0
- package/dist/Card/index.d.ts +126 -0
- package/dist/Card/index.js +118 -0
- package/dist/Checkbox/index.d.ts +59 -0
- package/dist/Checkbox/index.js +46 -0
- package/dist/Clock/index.d.ts +15 -0
- package/dist/Clock/index.js +34 -0
- package/dist/Columns/index.d.ts +76 -0
- package/dist/Columns/index.js +51 -0
- package/dist/Curve/index.d.ts +1 -0
- package/dist/Curve/index.js +5 -0
- package/dist/Disclosure/index.d.ts +31 -0
- package/dist/Disclosure/index.js +25 -0
- package/dist/Elevation/index.d.ts +16 -0
- package/dist/Elevation/index.js +17 -0
- package/dist/FormControl/index.d.ts +1 -0
- package/dist/FormControl/index.js +5 -0
- package/dist/Group/index.d.ts +46 -0
- package/dist/Group/index.js +42 -0
- package/dist/Heading/index.d.ts +1 -0
- package/dist/Heading/index.js +6 -0
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js +7 -0
- package/dist/Image/index.d.ts +1 -0
- package/dist/Image/index.js +5 -0
- package/dist/Markup/index.d.ts +16 -0
- package/dist/Markup/index.js +19 -0
- package/dist/Poster/index.d.ts +76 -0
- package/dist/Poster/index.js +44 -0
- package/dist/RadioGroup/index.d.ts +85 -0
- package/dist/RadioGroup/index.js +64 -0
- package/dist/Rule/index.d.ts +8 -0
- package/dist/Rule/index.js +17 -0
- package/dist/Section/index.d.ts +1 -0
- package/dist/Section/index.js +4 -0
- package/dist/SiteFooter/index.d.ts +64 -0
- package/dist/SiteFooter/index.js +88 -0
- package/dist/SiteHeader/index.d.ts +252 -0
- package/dist/SiteHeader/index.js +638 -0
- package/dist/Surface/index.d.ts +1 -0
- package/dist/Surface/index.js +4 -0
- package/dist/Text/index.d.ts +1 -0
- package/dist/Text/index.js +6 -0
- package/dist/TextInput/index.d.ts +71 -0
- package/dist/TextInput/index.js +56 -0
- package/dist/UniversalHeader/index.d.ts +26 -0
- package/dist/UniversalHeader/index.js +30 -0
- package/dist/VerticalSpace/index.d.ts +18 -0
- package/dist/VerticalSpace/index.js +19 -0
- package/dist/_shared/BrandLogo-6cc8202e.d.ts +26 -0
- package/dist/_shared/BrandLogo-6cc8202e.js +25 -0
- package/dist/_shared/Button-abfb12d4.d.ts +98 -0
- package/dist/_shared/Button-abfb12d4.js +51 -0
- package/dist/_shared/Curve-5f476d0b.d.ts +32 -0
- package/dist/_shared/Curve-5f476d0b.js +24 -0
- package/dist/_shared/FormControl-9dc9ecc3.d.ts +70 -0
- package/dist/_shared/FormControl-9dc9ecc3.js +74 -0
- package/dist/_shared/Heading-8c640dd1.d.ts +46 -0
- package/dist/_shared/Heading-8c640dd1.js +35 -0
- package/dist/_shared/Icon-4d523b46.d.ts +34 -0
- package/dist/_shared/Icon-4d523b46.js +27 -0
- package/dist/_shared/Image-a3225049.d.ts +94 -0
- package/dist/_shared/Image-a3225049.js +39 -0
- package/dist/_shared/Section-927988cb.d.ts +21 -0
- package/dist/_shared/Section-927988cb.js +17 -0
- package/dist/_shared/Surface-3fe44a2a.d.ts +50 -0
- package/dist/_shared/Surface-3fe44a2a.js +49 -0
- package/dist/_shared/Text-1c43d82b.d.ts +34 -0
- package/dist/_shared/Text-1c43d82b.js +26 -0
- package/dist/_shared/handle-link-click-35e09d0c.d.ts +7 -0
- package/dist/_shared/handle-link-click-35e09d0c.js +13 -0
- package/dist/_shared/index-56d9df62.js +61 -0
- package/dist/_shared/index-9483ad5f.d.ts +14 -0
- package/dist/_shared/index-c81c9401.d.ts +4 -0
- package/dist/_shared/index-e3c83626.d.ts +2 -0
- package/dist/_shared/index-e3c83626.js +208 -0
- package/dist/_shared/index.es-f5886c3a.js +284 -0
- package/dist/_shared/suffix-modifier-2a93822c.d.ts +10 -0
- package/dist/_shared/suffix-modifier-2a93822c.js +17 -0
- package/dist/_shared/use-media-query-f11805d4.d.ts +19 -0
- package/dist/_shared/use-media-query-f11805d4.js +39 -0
- package/dist/index.es.js +17493 -178
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +17492 -176
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Align/Align.d.ts +1 -2
- package/dist/types/components/Align/index.d.ts +1 -1
- package/dist/types/components/Base/Base.d.ts +1 -2
- package/dist/types/components/Base/index.d.ts +1 -1
- package/dist/types/components/BrandLogo/BrandLogo.d.ts +1 -2
- package/dist/types/components/BrandLogo/index.d.ts +1 -1
- package/dist/types/components/Breadcrumbs/Breadcrumbs.d.ts +18 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsItem/BreadcrumbsItem.d.ts +17 -0
- package/dist/types/components/Breadcrumbs/BreadcrumbsLink/BreadcrumbsLink.d.ts +25 -0
- package/dist/types/components/Breadcrumbs/index.d.ts +1 -0
- package/dist/types/components/Button/Button.d.ts +2 -2
- package/dist/types/components/Button/index.d.ts +1 -1
- package/dist/types/components/Card/Card.d.ts +6 -2
- package/dist/types/components/Card/index.d.ts +1 -1
- package/dist/types/components/Checkbox/Checkbox.d.ts +2 -2
- package/dist/types/components/Checkbox/index.d.ts +1 -1
- package/dist/types/components/Clock/Clock.d.ts +1 -2
- package/dist/types/components/Clock/index.d.ts +1 -1
- package/dist/types/components/Columns/Columns.d.ts +2 -2
- package/dist/types/components/Columns/index.d.ts +1 -1
- package/dist/types/components/Curve/Curve.d.ts +1 -2
- package/dist/types/components/Curve/index.d.ts +1 -1
- package/dist/types/components/Disclosure/Disclosure.d.ts +1 -2
- package/dist/types/components/Disclosure/index.d.ts +1 -1
- package/dist/types/components/Elevation/Elevation.d.ts +1 -2
- package/dist/types/components/Elevation/index.d.ts +1 -1
- package/dist/types/components/FormControl/FormControl.d.ts +1 -2
- package/dist/types/components/FormControl/index.d.ts +1 -1
- package/dist/types/components/Group/Group.d.ts +1 -2
- package/dist/types/components/Group/index.d.ts +1 -1
- package/dist/types/components/Heading/Heading.d.ts +1 -2
- package/dist/types/components/Heading/index.d.ts +1 -1
- package/dist/types/components/Icon/Icon.d.ts +1 -2
- package/dist/types/components/Icon/index.d.ts +1 -1
- package/dist/types/components/Image/Image.d.ts +1 -2
- package/dist/types/components/Image/index.d.ts +1 -1
- package/dist/types/components/Markup/Markup.d.ts +1 -2
- package/dist/types/components/Markup/index.d.ts +1 -1
- package/dist/types/components/Poster/Poster.d.ts +3 -4
- package/dist/types/components/Poster/PosterImage.d.ts +0 -1
- package/dist/types/components/Poster/PosterVideo.d.ts +1 -2
- package/dist/types/components/Poster/index.d.ts +1 -1
- package/dist/types/components/RadioGroup/RadioButton/RadioButton.d.ts +1 -2
- package/dist/types/components/RadioGroup/RadioButton/index.d.ts +1 -1
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +7 -3
- package/dist/types/components/RadioGroup/index.d.ts +1 -1
- package/dist/types/components/Rule/Rule.d.ts +1 -2
- package/dist/types/components/Rule/index.d.ts +1 -1
- package/dist/types/components/Section/Section.d.ts +1 -2
- package/dist/types/components/Section/index.d.ts +1 -1
- package/dist/types/components/SiteFooter/SiteFooter.d.ts +5 -2
- package/dist/types/components/SiteFooter/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/SiteHeader.d.ts +15 -8
- package/dist/types/components/SiteHeader/components/BackButton/BackButton.d.ts +0 -1
- package/dist/types/components/SiteHeader/components/BackButton/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/Column/Column.d.ts +1 -2
- package/dist/types/components/SiteHeader/components/Column/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/Item/Item.d.ts +5 -2
- package/dist/types/components/SiteHeader/components/Item/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/ItemGroup/ItemGroup.d.ts +5 -2
- package/dist/types/components/SiteHeader/components/ItemGroup/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/MenuButton/MenuButton.d.ts +1 -2
- package/dist/types/components/SiteHeader/components/MenuButton/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/NavItem/NavItem.d.ts +4 -1
- package/dist/types/components/SiteHeader/components/NavItem/NavItemWithSubNav.d.ts +5 -2
- package/dist/types/components/SiteHeader/components/NavItem/index.d.ts +2 -2
- package/dist/types/components/SiteHeader/components/Panel/Panel.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/Panel/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/components/SubNavItem/SubNavItem.d.ts +5 -2
- package/dist/types/components/SiteHeader/components/SubNavItem/index.d.ts +1 -1
- package/dist/types/components/SiteHeader/index.d.ts +1 -1
- package/dist/types/components/Surface/Surface.d.ts +1 -2
- package/dist/types/components/Surface/index.d.ts +1 -1
- package/dist/types/components/Text/Text.d.ts +1 -2
- package/dist/types/components/Text/index.d.ts +1 -1
- package/dist/types/components/TextInput/TextInput.d.ts +2 -2
- package/dist/types/components/TextInput/index.d.ts +1 -1
- package/dist/types/components/UniversalHeader/UniversalHeader.d.ts +1 -2
- package/dist/types/components/UniversalHeader/index.d.ts +1 -1
- package/dist/types/components/VerticalSpace/VerticalSpace.d.ts +1 -2
- package/dist/types/components/VerticalSpace/index.d.ts +1 -1
- package/dist/types/components/index.d.ts +29 -28
- package/dist/types/helpers/handle-link-click.d.ts +7 -0
- package/dist/types/styles.d.ts +2 -0
- package/package.json +7 -7
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
import { FormControlProps } from "../_shared/FormControl-9dc9ecc3";
|
|
5
|
+
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
|
+
/**
|
|
7
|
+
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
8
|
+
*/
|
|
9
|
+
declare const TextInput: FC<TextInputProps>;
|
|
10
|
+
interface TextInputProps extends Omit<FormControlProps, "children" | "elementType" | "htmlFor" | "requirementStatus"> {
|
|
11
|
+
/**
|
|
12
|
+
* Uncontrolled default value of the TextInput. If the TextInput is controlled
|
|
13
|
+
* via `value`/`onChange`, `defaultValue` will be ignored.
|
|
14
|
+
*/
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/**
|
|
17
|
+
* ID for the TextInput.
|
|
18
|
+
*/
|
|
19
|
+
id: string;
|
|
20
|
+
/**
|
|
21
|
+
* Mode for the input. If not defined, inferred by type.
|
|
22
|
+
*/
|
|
23
|
+
inputMode?: "email" | "numeric" | "tel" | "url";
|
|
24
|
+
/**
|
|
25
|
+
* Should the control be disabled?
|
|
26
|
+
*/
|
|
27
|
+
isDisabled?: boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Should the control be read-only?
|
|
30
|
+
*/
|
|
31
|
+
isReadOnly?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Should the control be required?
|
|
34
|
+
*/
|
|
35
|
+
isRequired?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Maximum number of characters.
|
|
38
|
+
*/
|
|
39
|
+
maxLength?: number;
|
|
40
|
+
/**
|
|
41
|
+
* Minimum number of characters.
|
|
42
|
+
*/
|
|
43
|
+
minLength?: number;
|
|
44
|
+
/**
|
|
45
|
+
* Name of the input.
|
|
46
|
+
*/
|
|
47
|
+
name?: string;
|
|
48
|
+
/**
|
|
49
|
+
* Function to call when the TextInput loses focus.
|
|
50
|
+
*/
|
|
51
|
+
onBlur?: (e: EventType) => void;
|
|
52
|
+
/**
|
|
53
|
+
* Callback function commonly used to update the TextInput's controlled
|
|
54
|
+
* `value`, for example `e => setValue(e.target.value)`.
|
|
55
|
+
*/
|
|
56
|
+
onChange?: (e: EventType) => void;
|
|
57
|
+
/**
|
|
58
|
+
* Validation regex pattern.
|
|
59
|
+
*/
|
|
60
|
+
pattern?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Type for the input. `number` will be changed to `text` and set the `numeric` inputMode.
|
|
63
|
+
*/
|
|
64
|
+
type?: "email" | "number" | "password" | "tel" | "text" | "url";
|
|
65
|
+
/**
|
|
66
|
+
* Current value of the TextInput. Must be controlled via an
|
|
67
|
+
* `onChange` callback function. Otherwise, use `defaultValue` (or `isReadOnly`).
|
|
68
|
+
*/
|
|
69
|
+
value?: string;
|
|
70
|
+
}
|
|
71
|
+
export { TextInput };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from '../_shared/index-56d9df62.js';
|
|
3
|
+
import React, { forwardRef, useContext } from 'react';
|
|
4
|
+
import { u as useAriaDescribedby, F as FormControl } from '../_shared/FormControl-9dc9ecc3.js';
|
|
5
|
+
import { C as Context } from '../_shared/Surface-3fe44a2a.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Infer the correct inputMode, pattern and type if specifying a `number` type.
|
|
9
|
+
*/
|
|
10
|
+
var useNumericInput = function (props) {
|
|
11
|
+
var type = props.type === "number" ? "text" : props.type;
|
|
12
|
+
var inputMode = props.inputMode;
|
|
13
|
+
if (!props.inputMode) {
|
|
14
|
+
if (props.type === "email") {
|
|
15
|
+
inputMode = "email";
|
|
16
|
+
}
|
|
17
|
+
else if (props.type === "number") {
|
|
18
|
+
inputMode = "numeric";
|
|
19
|
+
}
|
|
20
|
+
else if (props.type === "tel") {
|
|
21
|
+
inputMode = "tel";
|
|
22
|
+
}
|
|
23
|
+
else if (props.type === "url") {
|
|
24
|
+
inputMode = "url";
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
var pattern = props.pattern;
|
|
28
|
+
if (!props.pattern && props.type === "number") {
|
|
29
|
+
pattern = "[0-9]*";
|
|
30
|
+
}
|
|
31
|
+
return { inputMode: inputMode, pattern: pattern, type: type };
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
36
|
+
*/
|
|
37
|
+
var TextInput = forwardRef(function (_a, ref) {
|
|
38
|
+
var _b = _a.defaultValue, defaultValue = _b === void 0 ? "" : _b, errorMessage = _a.errorMessage, helper = _a.helper, id = _a.id, inputMode = _a.inputMode, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isReadOnly, isReadOnly = _d === void 0 ? false : _d, _e = _a.isRequired, isRequired = _e === void 0 ? false : _e, label = _a.label, _f = _a.labelSize, labelSize = _f === void 0 ? "l" : _f, maxLength = _a.maxLength, minLength = _a.minLength, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, pattern = _a.pattern, _g = _a.type, type = _g === void 0 ? "text" : _g, value = _a.value, props = __rest(_a, ["defaultValue", "errorMessage", "helper", "id", "inputMode", "isDisabled", "isReadOnly", "isRequired", "label", "labelSize", "maxLength", "minLength", "name", "onBlur", "onChange", "pattern", "type", "value"]);
|
|
39
|
+
var surface = useContext(Context).surface;
|
|
40
|
+
var inferredInputProps = useNumericInput({ inputMode: inputMode, pattern: pattern, type: type });
|
|
41
|
+
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
42
|
+
var ariaDescribedby = useAriaDescribedby({
|
|
43
|
+
errorMessage: errorMessage,
|
|
44
|
+
id: id,
|
|
45
|
+
helper: helper
|
|
46
|
+
}).ariaDescribedby;
|
|
47
|
+
return (React.createElement("div", __assign({ className: classNames({
|
|
48
|
+
"arc-TextInput": true,
|
|
49
|
+
"arc-TextInput--invalid": errorMessage,
|
|
50
|
+
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
51
|
+
}) }, filterDataAttrs(props)),
|
|
52
|
+
React.createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional" },
|
|
53
|
+
React.createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-invalid": errorMessage ? "true" : "false", className: "arc-TextInput-input", defaultValue: typeof value !== "undefined" ? undefined : defaultValue, disabled: isDisabled, id: id, maxLength: maxLength, minLength: minLength, name: name, onChange: onChange, onBlur: onBlur, readOnly: isReadOnly, ref: ref, required: isRequired, value: typeof value !== "undefined" ? value : undefined }, inferredInputProps)))));
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export { TextInput };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Use `UniversalHeader` to display a group-level page header.
|
|
4
|
+
*/
|
|
5
|
+
declare const UniversalHeader: FC<UniversalHeaderProps> & {
|
|
6
|
+
Item: typeof UniversalHeaderItem;
|
|
7
|
+
};
|
|
8
|
+
declare const UniversalHeaderItem: FC<UniversalHeaderItemProps>;
|
|
9
|
+
interface UniversalHeaderItemProps {
|
|
10
|
+
/**
|
|
11
|
+
* Contents of the UniversalHeaderItem.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* A URL to link to when the Item is clicked or touched.
|
|
16
|
+
*/
|
|
17
|
+
href: string;
|
|
18
|
+
}
|
|
19
|
+
interface UniversalHeaderProps {
|
|
20
|
+
/**
|
|
21
|
+
* Contents of the UniversalHeader. Must be
|
|
22
|
+
* UniversalHeader.Item components.
|
|
23
|
+
*/
|
|
24
|
+
children: ReactNode;
|
|
25
|
+
}
|
|
26
|
+
export { UniversalHeader };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/index-e3c83626.js';
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
|
+
import { S as Surface } from '../_shared/Surface-3fe44a2a.js';
|
|
4
|
+
import '../_shared/index-56d9df62.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Use `UniversalHeader` to display a group-level page header.
|
|
8
|
+
*/
|
|
9
|
+
var UniversalHeader = function (_a) {
|
|
10
|
+
var children = _a.children, props = __rest(_a, ["children"]);
|
|
11
|
+
useEffect(function () {
|
|
12
|
+
React.Children.map(children, function (item) {
|
|
13
|
+
if (item && item.type !== UniversalHeaderItem) {
|
|
14
|
+
throw new Error("Illegal child passed to <UniversalHeader />. Ensure to only use <UniversalHeader.Item />.");
|
|
15
|
+
}
|
|
16
|
+
});
|
|
17
|
+
}, [children]);
|
|
18
|
+
return (React.createElement("nav", __assign({ className: "arc-UniversalHeader" }, filterDataAttrs(props)),
|
|
19
|
+
React.createElement(Surface, { background: "light" },
|
|
20
|
+
React.createElement("ul", { className: "arc-UniversalHeader-items" }, children))));
|
|
21
|
+
};
|
|
22
|
+
var UniversalHeaderItem = function (_a) {
|
|
23
|
+
var children = _a.children, href = _a.href, props = __rest(_a, ["children", "href"]);
|
|
24
|
+
return (React.createElement("li", __assign({}, filterDataAttrs(props)),
|
|
25
|
+
React.createElement("a", { className: "arc-UniversalHeader-link", href: href }, children)));
|
|
26
|
+
};
|
|
27
|
+
UniversalHeaderItem.displayName = "UniversalHeader.Item";
|
|
28
|
+
UniversalHeader.Item = UniversalHeaderItem;
|
|
29
|
+
|
|
30
|
+
export { UniversalHeader };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Use `VerticalSpace` to create vertical space between components.
|
|
4
|
+
*/
|
|
5
|
+
declare const VerticalSpace: FC<VerticalSpaceProps>;
|
|
6
|
+
type VerticalSpaceSize = "4" | "8" | "12" | "16" | "24" | "32" | "48" | "64" | "96" | "128";
|
|
7
|
+
interface VerticalSpaceProps {
|
|
8
|
+
/**
|
|
9
|
+
* Should the VerticalSpace be visible for debugging and documentation
|
|
10
|
+
* purposes?
|
|
11
|
+
*/
|
|
12
|
+
isDebugVisible?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Size of the VerticalSpace.
|
|
15
|
+
*/
|
|
16
|
+
size?: VerticalSpaceSize;
|
|
17
|
+
}
|
|
18
|
+
export { VerticalSpace };
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from '../_shared/index-56d9df62.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Use `VerticalSpace` to create vertical space between components.
|
|
7
|
+
*/
|
|
8
|
+
var VerticalSpace = function (_a) {
|
|
9
|
+
var _b;
|
|
10
|
+
var _c = _a.isDebugVisible, isDebugVisible = _c === void 0 ? false : _c, _d = _a.size, size = _d === void 0 ? "24" : _d, props = __rest(_a, ["isDebugVisible", "size"]);
|
|
11
|
+
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
12
|
+
"arc-VerticalSpace": true
|
|
13
|
+
},
|
|
14
|
+
_b["arc-VerticalSpace--size".concat(size)] = size && size !== "24",
|
|
15
|
+
_b["arc-VerticalSpace--debugVisible"] = isDebugVisible,
|
|
16
|
+
_b)) }, filterDataAttrs(props))));
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export { VerticalSpace };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Use `BrandLogo` to display the brand logo.
|
|
4
|
+
*/
|
|
5
|
+
declare const BrandLogo: FC<BrandLogoProps>;
|
|
6
|
+
declare const colors: readonly ["auto", "brand"];
|
|
7
|
+
declare const subBrands: readonly ["redcare", "wholesale"];
|
|
8
|
+
interface BrandLogoProps {
|
|
9
|
+
/**
|
|
10
|
+
* Color of the BrandLogo. The `brand` color only shows on light surfaces.
|
|
11
|
+
*/
|
|
12
|
+
color?: typeof colors[number];
|
|
13
|
+
/**
|
|
14
|
+
* Accessible text for the BrandLogo.
|
|
15
|
+
*/
|
|
16
|
+
label?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Size of the BrandLogo, in pixels.
|
|
19
|
+
*/
|
|
20
|
+
size?: number;
|
|
21
|
+
/**
|
|
22
|
+
* Optional sub-brand variant. Only applies to BT.
|
|
23
|
+
*/
|
|
24
|
+
subBrand?: typeof subBrands[number];
|
|
25
|
+
}
|
|
26
|
+
export { BrandLogo, colors, subBrands, BrandLogoProps };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from './index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from './index-56d9df62.js';
|
|
3
|
+
import React, { useContext } from 'react';
|
|
4
|
+
import { s as suffixModifier } from './suffix-modifier-2a93822c.js';
|
|
5
|
+
import { C as Context } from './Surface-3fe44a2a.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Use `BrandLogo` to display the brand logo.
|
|
9
|
+
*/
|
|
10
|
+
var BrandLogo = function (_a) {
|
|
11
|
+
var _b;
|
|
12
|
+
var _c = _a.color, color = _c === void 0 ? "auto" : _c, label = _a.label, _d = _a.size, size = _d === void 0 ? 34 : _d, subBrand = _a.subBrand, props = __rest(_a, ["color", "label", "size", "subBrand"]);
|
|
13
|
+
var surface = useContext(Context).surface;
|
|
14
|
+
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
15
|
+
"arc-BrandLogo": true,
|
|
16
|
+
"arc-BrandLogo--colorBrand": color === "brand",
|
|
17
|
+
"arc-BrandLogo--onDarkSurface": surface === "dark"
|
|
18
|
+
},
|
|
19
|
+
_b[suffixModifier("arc-BrandLogo--subBrand", subBrand || "")] = subBrand,
|
|
20
|
+
_b)), style: {
|
|
21
|
+
width: size !== 34 ? size : undefined
|
|
22
|
+
} }, filterDataAttrs(props)), label ? React.createElement("span", { className: "arc-BrandLogo-text" }, label) : null));
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export { BrandLogo as B };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { icons } from "@arc-ui/tokens";
|
|
3
|
+
import React from "react";
|
|
4
|
+
import { FC } from "react";
|
|
5
|
+
type ElementUnion = HTMLButtonElement | HTMLAnchorElement;
|
|
6
|
+
type Ref = React.Ref<ElementUnion> | null;
|
|
7
|
+
/**
|
|
8
|
+
* Use `Button` to allow users to take actions with clicks and taps.
|
|
9
|
+
*/
|
|
10
|
+
declare const Button: FC<ButtonProps>;
|
|
11
|
+
interface ButtonIconProps {
|
|
12
|
+
/**
|
|
13
|
+
* Icon variant.
|
|
14
|
+
*/
|
|
15
|
+
icon?: typeof icons[number];
|
|
16
|
+
/**
|
|
17
|
+
* Should the icon be a default chevron?
|
|
18
|
+
*/
|
|
19
|
+
isChevron?: boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Should the icon be positioned before button text?
|
|
22
|
+
*/
|
|
23
|
+
isBeforeText?: boolean;
|
|
24
|
+
}
|
|
25
|
+
interface ButtonElementProps {
|
|
26
|
+
/**
|
|
27
|
+
* Default behavior of the Button element. If not provided, 'submit' will
|
|
28
|
+
* be inferred. Type 'reset' deliberately excluded.
|
|
29
|
+
*/
|
|
30
|
+
type?: "button" | "submit";
|
|
31
|
+
}
|
|
32
|
+
interface LinkElementProps {
|
|
33
|
+
/**
|
|
34
|
+
* URL to link to if Button elementType is 'a'.
|
|
35
|
+
*/
|
|
36
|
+
href?: string;
|
|
37
|
+
/**
|
|
38
|
+
* Target window for the Button href URL.
|
|
39
|
+
*/
|
|
40
|
+
target?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Relationship between the Button href URL and the current page. See
|
|
43
|
+
* [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/rel).
|
|
44
|
+
*/
|
|
45
|
+
rel?: string;
|
|
46
|
+
}
|
|
47
|
+
interface ButtonProps extends ButtonElementProps, LinkElementProps {
|
|
48
|
+
/**
|
|
49
|
+
* Text to override `label` with additional, more precise information
|
|
50
|
+
* specifically for screen reader users.
|
|
51
|
+
*/
|
|
52
|
+
ariaLabel?: string;
|
|
53
|
+
/**
|
|
54
|
+
* Button fill.
|
|
55
|
+
*/
|
|
56
|
+
fill?: "solid" | "outlined" | "flat";
|
|
57
|
+
/**
|
|
58
|
+
* Button icon variant.
|
|
59
|
+
*/
|
|
60
|
+
icon?: typeof icons[number];
|
|
61
|
+
/**
|
|
62
|
+
* How should a Button icon be displayed?
|
|
63
|
+
*/
|
|
64
|
+
iconPosition?: "afterText" | "beforeText" | "iconOnly";
|
|
65
|
+
/**
|
|
66
|
+
* HTML ID for the Button
|
|
67
|
+
*/
|
|
68
|
+
id?: string;
|
|
69
|
+
/**
|
|
70
|
+
* Should the Button be disabled?
|
|
71
|
+
*/
|
|
72
|
+
isDisabled?: boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Should the Button’s CSS display property be set to block?
|
|
75
|
+
*/
|
|
76
|
+
isDisplayBlock?: boolean;
|
|
77
|
+
/**
|
|
78
|
+
* Should the Button take up the full width of its container?
|
|
79
|
+
*/
|
|
80
|
+
isFullWidth?: boolean;
|
|
81
|
+
/**
|
|
82
|
+
* Button text.
|
|
83
|
+
*/
|
|
84
|
+
label: string;
|
|
85
|
+
/**
|
|
86
|
+
* Optional click handler for the Button.
|
|
87
|
+
*/
|
|
88
|
+
onClick?: () => void;
|
|
89
|
+
/**
|
|
90
|
+
* Optional property to provide component Ref
|
|
91
|
+
*/
|
|
92
|
+
ref?: Ref;
|
|
93
|
+
/**
|
|
94
|
+
* Optional supporting text for the Button.
|
|
95
|
+
*/
|
|
96
|
+
supportingText?: string;
|
|
97
|
+
}
|
|
98
|
+
export { ElementUnion, Ref, Button, ButtonIconProps, ButtonProps };
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from './index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from './index-56d9df62.js';
|
|
3
|
+
import React, { forwardRef, useContext } from 'react';
|
|
4
|
+
import { s as suffixModifier } from './suffix-modifier-2a93822c.js';
|
|
5
|
+
import { I as Icon } from './Icon-4d523b46.js';
|
|
6
|
+
import { C as Context } from './Surface-3fe44a2a.js';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Use `Button` to allow users to take actions with clicks and taps.
|
|
10
|
+
*/
|
|
11
|
+
var Button = forwardRef(function (_a, ref) {
|
|
12
|
+
var _b;
|
|
13
|
+
var ariaLabel = _a.ariaLabel, _c = _a.fill, fill = _c === void 0 ? "solid" : _c, href = _a.href, icon = _a.icon, _d = _a.iconPosition, iconPosition = _d === void 0 ? "afterText" : _d, id = _a.id, _e = _a.isDisabled, isDisabled = _e === void 0 ? false : _e, _f = _a.isDisplayBlock, isDisplayBlock = _f === void 0 ? false : _f, _g = _a.isFullWidth, isFullWidth = _g === void 0 ? false : _g, label = _a.label, onClick = _a.onClick, rel = _a.rel, supportingText = _a.supportingText, target = _a.target, type = _a.type, props = __rest(_a, ["ariaLabel", "fill", "href", "icon", "iconPosition", "id", "isDisabled", "isDisplayBlock", "isFullWidth", "label", "onClick", "rel", "supportingText", "target", "type"]);
|
|
14
|
+
var surface = useContext(Context).surface;
|
|
15
|
+
var buttonClasses = classNames((_b = {
|
|
16
|
+
"arc-Button": true,
|
|
17
|
+
"arc-Button--displayBlock": isDisplayBlock
|
|
18
|
+
},
|
|
19
|
+
_b[suffixModifier("arc-Button--fill", fill)] = fill !== "solid",
|
|
20
|
+
_b["arc-Button--fullWidth"] = isFullWidth,
|
|
21
|
+
_b[suffixModifier("arc-Button--icon", iconPosition.replace("icon", ""))] = (icon || fill === "flat") &&
|
|
22
|
+
iconPosition &&
|
|
23
|
+
iconPosition !== "afterText",
|
|
24
|
+
_b["arc-Button--hasSupportingText"] = supportingText,
|
|
25
|
+
_b["arc-Button--onDarkSurface"] = surface === "dark",
|
|
26
|
+
_b));
|
|
27
|
+
var commonProps = __assign({ id: id, onClick: onClick, ref: ref }, filterDataAttrs(props));
|
|
28
|
+
var buttonText = supportingText ? (React.createElement("span", null,
|
|
29
|
+
React.createElement("span", { className: "arc-Button-text" }, label),
|
|
30
|
+
React.createElement("span", { className: "arc-Button-supportingText" }, supportingText))) : (React.createElement("span", { className: "arc-Button-text" }, label));
|
|
31
|
+
var buttonIcon = icon || fill === "flat" ? (React.createElement(ButtonIcon, { icon: icon, isChevron: !icon && fill === "flat", isBeforeText: iconPosition === "beforeText" })) : null;
|
|
32
|
+
if (href && !isDisabled) {
|
|
33
|
+
return (React.createElement("a", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, href: href, rel: rel, target: target }),
|
|
34
|
+
React.createElement("span", { className: "arc-Button-inner" },
|
|
35
|
+
buttonText,
|
|
36
|
+
buttonIcon)));
|
|
37
|
+
}
|
|
38
|
+
return (React.createElement("button", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, disabled: isDisabled, type: type }),
|
|
39
|
+
React.createElement("span", { className: "arc-Button-inner" },
|
|
40
|
+
buttonText,
|
|
41
|
+
buttonIcon)));
|
|
42
|
+
});
|
|
43
|
+
var ButtonIcon = function (_a) {
|
|
44
|
+
var icon = _a.icon, isChevron = _a.isChevron, isBeforeText = _a.isBeforeText;
|
|
45
|
+
return (React.createElement("span", { className: classNames({
|
|
46
|
+
"arc-Button-icon": true,
|
|
47
|
+
"arc-Button-icon--chevron": isChevron
|
|
48
|
+
}) }, isChevron ? (React.createElement(Icon, { icon: "btChevron".concat(isBeforeText ? "Left" : "Right", "2px") })) : (React.createElement(Icon, { icon: icon }))));
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
export { Button as B };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { backgroundsBT } from "../Surface/index";
|
|
3
|
+
/**
|
|
4
|
+
* Use `Curve` sparingly to soften edges and create a more natural, less rigid
|
|
5
|
+
* look and feel.
|
|
6
|
+
*/
|
|
7
|
+
declare const Curve: FC<CurveProps>;
|
|
8
|
+
declare const sizes: readonly ["s", "m", "l"];
|
|
9
|
+
declare const positions: readonly ["bottom", "bottomLeft", "bottomRight", "top", "topLeft", "topRight"];
|
|
10
|
+
interface CurveProps {
|
|
11
|
+
/**
|
|
12
|
+
* Bottom color of the Curve. Shares values with Surface.
|
|
13
|
+
*/
|
|
14
|
+
bottomColor?: typeof backgroundsBT[number];
|
|
15
|
+
/**
|
|
16
|
+
* Positional variants of the Curve.
|
|
17
|
+
*/
|
|
18
|
+
from?: typeof positions[number];
|
|
19
|
+
/**
|
|
20
|
+
* Should the Curve colors be flipped? Normally used at the top of Poster.
|
|
21
|
+
*/
|
|
22
|
+
isInverted?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Size of the Curve.
|
|
25
|
+
*/
|
|
26
|
+
size?: typeof sizes[number];
|
|
27
|
+
/**
|
|
28
|
+
* Top color of the Curve. Shares values with Surface.
|
|
29
|
+
*/
|
|
30
|
+
topColor?: typeof backgroundsBT[number];
|
|
31
|
+
}
|
|
32
|
+
export { Curve, sizes, positions, CurveProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from './index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from './index-56d9df62.js';
|
|
3
|
+
import React from 'react';
|
|
4
|
+
import { s as suffixModifier } from './suffix-modifier-2a93822c.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Use `Curve` sparingly to soften edges and create a more natural, less rigid
|
|
8
|
+
* look and feel.
|
|
9
|
+
*/
|
|
10
|
+
var Curve = function (_a) {
|
|
11
|
+
var _b;
|
|
12
|
+
var bottomColor = _a.bottomColor, _c = _a.from, from = _c === void 0 ? "top" : _c, _d = _a.isInverted, isInverted = _d === void 0 ? false : _d, _e = _a.size, size = _e === void 0 ? "m" : _e, topColor = _a.topColor, props = __rest(_a, ["bottomColor", "from", "isInverted", "size", "topColor"]);
|
|
13
|
+
return (React.createElement("div", __assign({ className: classNames((_b = {
|
|
14
|
+
"arc-Curve": true
|
|
15
|
+
},
|
|
16
|
+
_b[suffixModifier("arc-Curve--from", from)] = from && from !== "top",
|
|
17
|
+
_b["arc-Curve--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
18
|
+
_b[suffixModifier("arc-Curve--bottomColor", bottomColor || "")] = bottomColor,
|
|
19
|
+
_b[suffixModifier("arc-Curve--topColor", topColor || "")] = topColor,
|
|
20
|
+
_b["arc-Curve--inverted"] = isInverted,
|
|
21
|
+
_b)) }, filterDataAttrs(props))));
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export { Curve as C };
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Optionally define ariaDescribedBy if errorMessage or helper exist.
|
|
6
|
+
*/
|
|
7
|
+
declare const useAriaDescribedby: ({ id, idError, idHelper, errorMessage, helper }: {
|
|
8
|
+
id?: string | undefined;
|
|
9
|
+
idError?: string | undefined;
|
|
10
|
+
idHelper?: string | undefined;
|
|
11
|
+
errorMessage?: any;
|
|
12
|
+
helper?: any;
|
|
13
|
+
}) => {
|
|
14
|
+
ariaDescribedby: undefined;
|
|
15
|
+
idHelper: undefined;
|
|
16
|
+
idError: undefined;
|
|
17
|
+
} | {
|
|
18
|
+
ariaDescribedby: string | undefined;
|
|
19
|
+
idError: string;
|
|
20
|
+
idHelper: string;
|
|
21
|
+
};
|
|
22
|
+
type RequirementStatus = "required" | "optional" | "not-applicable";
|
|
23
|
+
declare const Context: React.Context<{
|
|
24
|
+
requirementStatus: RequirementStatus | null;
|
|
25
|
+
}>;
|
|
26
|
+
/**
|
|
27
|
+
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
28
|
+
*/
|
|
29
|
+
declare const FormControl: FC<FormControlProps>;
|
|
30
|
+
interface FormControlProps {
|
|
31
|
+
/**
|
|
32
|
+
* Render the input or series of inputs
|
|
33
|
+
*/
|
|
34
|
+
children: React.ReactNode;
|
|
35
|
+
/**
|
|
36
|
+
* HTML Element type for the FormControl.
|
|
37
|
+
* @default 'div'
|
|
38
|
+
*/
|
|
39
|
+
elementType?: "div" | "fieldset";
|
|
40
|
+
/**
|
|
41
|
+
* Error message for the FormControl.
|
|
42
|
+
*/
|
|
43
|
+
errorMessage?: string;
|
|
44
|
+
/**
|
|
45
|
+
* Helper text for the FormControl, shown below the label.
|
|
46
|
+
*/
|
|
47
|
+
helper?: React.ReactNode;
|
|
48
|
+
/**
|
|
49
|
+
* ID for the input that the FormControl points towards.
|
|
50
|
+
*/
|
|
51
|
+
htmlFor?: string;
|
|
52
|
+
/**
|
|
53
|
+
* ID for the FormControl. Used for helper and errorMessage if `htmlFor` is undefined.
|
|
54
|
+
*/
|
|
55
|
+
id?: string;
|
|
56
|
+
/**
|
|
57
|
+
* Are all of the inputs in the FormControl required, optional, or is a
|
|
58
|
+
* uniform requirement status for all inputs not applicable?
|
|
59
|
+
*/
|
|
60
|
+
requirementStatus?: RequirementStatus;
|
|
61
|
+
/**
|
|
62
|
+
* Label for the FormControl.
|
|
63
|
+
*/
|
|
64
|
+
label: string;
|
|
65
|
+
/**
|
|
66
|
+
* Label size.
|
|
67
|
+
*/
|
|
68
|
+
labelSize?: "s" | "l";
|
|
69
|
+
}
|
|
70
|
+
export { useAriaDescribedby, FormControl, FormControlProps, Context as FormControlContext };
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { _ as __rest, a as __assign, f as filterDataAttrs } from './index-e3c83626.js';
|
|
2
|
+
import { c as classNames } from './index-56d9df62.js';
|
|
3
|
+
import React, { createContext, useContext } from 'react';
|
|
4
|
+
import { C as Context$1 } from './Surface-3fe44a2a.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
|
+
var defaultContext = {
|
|
30
|
+
requirementStatus: null
|
|
31
|
+
};
|
|
32
|
+
var Context = createContext(defaultContext);
|
|
33
|
+
var Provider = Context.Provider;
|
|
34
|
+
/**
|
|
35
|
+
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
36
|
+
*/
|
|
37
|
+
var FormControl = function (_a) {
|
|
38
|
+
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"]);
|
|
39
|
+
var surface = useContext(Context$1).surface;
|
|
40
|
+
var _e = useAriaDescribedby({
|
|
41
|
+
errorMessage: errorMessage,
|
|
42
|
+
helper: helper,
|
|
43
|
+
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
44
|
+
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
45
|
+
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
46
|
+
var elementProps = {};
|
|
47
|
+
var labelProps = {};
|
|
48
|
+
if (LabelType === "label") {
|
|
49
|
+
labelProps["htmlFor"] = htmlFor;
|
|
50
|
+
if (htmlFor) {
|
|
51
|
+
labelProps["id"] = "".concat(htmlFor, "-label");
|
|
52
|
+
}
|
|
53
|
+
else if (id) {
|
|
54
|
+
labelProps["id"] = "".concat(id, "-label");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
elementProps["aria-describedby"] = ariaDescribedby;
|
|
59
|
+
}
|
|
60
|
+
return (React.createElement(Provider, { value: { requirementStatus: requirementStatus } },
|
|
61
|
+
React.createElement(ElementType, __assign({ className: classNames({
|
|
62
|
+
"arc-FormControl": true,
|
|
63
|
+
"arc-FormControl--smallLabel": labelSize === "s",
|
|
64
|
+
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
65
|
+
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
66
|
+
React.createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
67
|
+
label,
|
|
68
|
+
requirementStatus === "optional" && (React.createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
69
|
+
helper && (React.createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
70
|
+
children,
|
|
71
|
+
errorMessage && (React.createElement("div", { className: "arc-FormControl-error", id: idError }, errorMessage)))));
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { Context as C, FormControl as F, useAriaDescribedby as u };
|