@arc-ui/components 11.0.0 → 11.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.
- package/dist/Align/Align.esm.js +4 -4
- package/dist/Badge/Badge.cjs.d.ts +26 -0
- package/dist/Badge/Badge.cjs.js +37 -0
- package/dist/Badge/Badge.esm.d.ts +26 -0
- package/dist/Badge/Badge.esm.js +29 -0
- package/dist/Badge/package.json +7 -0
- package/dist/Base/Base.cjs.d.ts +1 -16
- package/dist/Base/Base.cjs.js +4 -16
- package/dist/Base/Base.esm.d.ts +1 -16
- package/dist/Base/Base.esm.js +3 -15
- package/dist/BrandLogo/BrandLogo.esm.d.ts +1 -1
- package/dist/BrandLogo/BrandLogo.esm.js +2 -2
- package/dist/Breadcrumbs/Breadcrumbs.esm.js +27 -27
- package/dist/Button/Button.esm.d.ts +1 -1
- package/dist/Button/Button.esm.js +4 -4
- package/dist/Card/Card.esm.js +27 -27
- package/dist/Checkbox/Checkbox.cjs.js +4 -1
- package/dist/Checkbox/Checkbox.esm.js +18 -15
- package/dist/Clock/Clock.esm.js +3 -3
- package/dist/Columns/Columns.esm.js +5 -5
- package/dist/Curve/Curve.esm.d.ts +1 -1
- package/dist/Curve/Curve.esm.js +1 -1
- package/dist/Disclosure/Disclosure.esm.d.ts +1 -1
- package/dist/Disclosure/Disclosure.esm.js +10 -10
- package/dist/Elevation/Elevation.esm.js +2 -2
- package/dist/FormControl/FormControl.cjs.d.ts +1 -1
- package/dist/FormControl/FormControl.cjs.js +4 -1
- package/dist/FormControl/FormControl.esm.d.ts +1 -1
- package/dist/FormControl/FormControl.esm.js +5 -2
- package/dist/Group/Group.esm.js +6 -6
- package/dist/Heading/Heading.esm.d.ts +1 -1
- package/dist/Heading/Heading.esm.js +2 -2
- package/dist/Icon/Icon.esm.d.ts +1 -1
- package/dist/Icon/Icon.esm.js +2 -2
- package/dist/Image/Image.esm.d.ts +1 -1
- package/dist/Image/Image.esm.js +1 -1
- package/dist/Markup/Markup.esm.js +3 -3
- package/dist/Poster/Poster.esm.d.ts +1 -1
- package/dist/Poster/Poster.esm.js +9 -9
- package/dist/RadioGroup/RadioGroup.cjs.d.ts +1 -1
- package/dist/RadioGroup/RadioGroup.cjs.js +4 -1
- package/dist/RadioGroup/RadioGroup.esm.d.ts +1 -1
- package/dist/RadioGroup/RadioGroup.esm.js +15 -12
- package/dist/Rule/Rule.esm.js +3 -3
- package/dist/Section/Section.esm.d.ts +1 -1
- package/dist/Section/Section.esm.js +1 -1
- package/dist/Select/Select.cjs.d.ts +25 -0
- package/dist/Select/Select.cjs.js +3010 -0
- package/dist/Select/Select.esm.d.ts +25 -0
- package/dist/Select/Select.esm.js +2983 -0
- package/dist/Select/package.json +7 -0
- package/dist/SiteFooter/SiteFooter.esm.js +33 -33
- package/dist/SiteHeader/SiteHeader.esm.d.ts +1 -1
- package/dist/SiteHeader/SiteHeader.esm.js +98 -98
- package/dist/Surface/Surface.esm.d.ts +1 -1
- package/dist/Surface/Surface.esm.js +1 -1
- package/dist/Text/Text.esm.d.ts +1 -1
- package/dist/Text/Text.esm.js +2 -2
- package/dist/TextInput/TextInput.cjs.d.ts +5 -1
- package/dist/TextInput/TextInput.cjs.js +25 -6
- package/dist/TextInput/TextInput.esm.d.ts +5 -1
- package/dist/TextInput/TextInput.esm.js +28 -9
- package/dist/Truncate/Truncate.cjs.d.ts +18 -0
- package/dist/Truncate/Truncate.cjs.js +17 -0
- package/dist/Truncate/Truncate.esm.d.ts +18 -0
- package/dist/Truncate/Truncate.esm.js +9 -0
- package/dist/Truncate/package.json +7 -0
- package/dist/UniversalHeader/UniversalHeader.esm.js +8 -8
- package/dist/VerticalSpace/VerticalSpace.esm.js +2 -2
- package/dist/VisuallyHidden/VisuallyHidden.cjs.d.ts +1 -12
- package/dist/VisuallyHidden/VisuallyHidden.cjs.js +3 -12
- package/dist/VisuallyHidden/VisuallyHidden.esm.d.ts +1 -12
- package/dist/VisuallyHidden/VisuallyHidden.esm.js +2 -11
- package/dist/_shared/cjs/Base-e2b846fe.d.ts +19 -0
- package/dist/_shared/cjs/Base-e2b846fe.js +22 -0
- package/dist/_shared/cjs/{FormControl-a1b7421b.d.ts → FormControl-e6b7d7c5.d.ts} +51 -3
- package/dist/_shared/cjs/{FormControl-a1b7421b.js → FormControl-e6b7d7c5.js} +40 -8
- package/dist/_shared/cjs/VisuallyHidden-e2c8b291.d.ts +12 -0
- package/dist/_shared/cjs/VisuallyHidden-e2c8b291.js +17 -0
- package/dist/_shared/cjs/index-c81c9401.d.ts +1 -1
- package/dist/_shared/esm/Base-c235dc45.d.ts +19 -0
- package/dist/_shared/esm/Base-c235dc45.js +15 -0
- package/dist/_shared/esm/{BrandLogo-ea3dd0e6.js → BrandLogo-4f13fe85.js} +4 -4
- package/dist/_shared/esm/{BtIconChevronDown2Px-4abd079b.js → BtIconChevronDown2Px-782876e2.js} +2 -2
- package/dist/_shared/esm/{BtIconChevronRight2Px-a5cc1d05.js → BtIconChevronRight2Px-b8e7b4ad.js} +3 -3
- package/dist/_shared/esm/{BtIconChevronRightMid-386cf272.js → BtIconChevronRightMid-d9b11761.js} +2 -2
- package/dist/_shared/esm/{Button-5ff56a7b.js → Button-69439f8f.js} +15 -15
- package/dist/_shared/esm/{Curve-cfdca379.js → Curve-50697f7e.js} +2 -2
- package/dist/_shared/esm/{FormControl-feedc495.d.ts → FormControl-84c9ace6.d.ts} +51 -3
- package/dist/_shared/esm/FormControl-84c9ace6.js +138 -0
- package/dist/_shared/esm/{Heading-183be76c.js → Heading-eb1e42db.js} +4 -4
- package/dist/_shared/esm/{Icon-76d0d8c0.js → Icon-61f7237a.js} +5 -5
- package/dist/_shared/esm/{Image-7e4948f6.js → Image-c0f3d42f.js} +7 -7
- package/dist/_shared/esm/{Section-f1256c87.js → Section-7bc71e26.js} +2 -2
- package/dist/_shared/esm/{Surface-d515d212.js → Surface-bf201530.js} +3 -3
- package/dist/_shared/esm/{Text-d8988620.js → Text-6b958ad8.js} +3 -3
- package/dist/_shared/esm/VisuallyHidden-b9eebf71.d.ts +12 -0
- package/dist/_shared/esm/VisuallyHidden-b9eebf71.js +11 -0
- package/dist/_shared/esm/index-c81c9401.d.ts +1 -1
- package/dist/index.es.js +34424 -522
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +34329 -406
- package/dist/index.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/types/components/Badge/Badge.d.ts +25 -0
- package/dist/types/components/Badge/index.d.ts +1 -0
- package/dist/types/components/FormControl/FormControl.d.ts +17 -0
- package/dist/types/components/FormControl/FormControlDisclosure/FormControlDisclosure.d.ts +28 -0
- package/dist/types/components/FormControl/FormControlDisclosure/index.d.ts +1 -0
- package/dist/types/components/Select/Select.d.ts +2 -1
- package/dist/types/components/TextInput/TextInput.d.ts +4 -0
- package/dist/types/components/Truncate/Truncate.d.ts +17 -0
- package/dist/types/components/Truncate/index.d.ts +1 -0
- package/dist/types/components/index.d.ts +3 -0
- package/dist/types/hooks/use-aria-describedby.d.ts +5 -1
- package/dist/types/styles.d.ts +4 -0
- package/package.json +4 -4
- package/dist/_shared/esm/FormControl-feedc495.js +0 -106
- /package/dist/_shared/esm/{BrandLogo-ea3dd0e6.d.ts → BrandLogo-4f13fe85.d.ts} +0 -0
- /package/dist/_shared/esm/{Button-5ff56a7b.d.ts → Button-69439f8f.d.ts} +0 -0
- /package/dist/_shared/esm/{Curve-cfdca379.d.ts → Curve-50697f7e.d.ts} +0 -0
- /package/dist/_shared/esm/{Heading-183be76c.d.ts → Heading-eb1e42db.d.ts} +0 -0
- /package/dist/_shared/esm/{Icon-76d0d8c0.d.ts → Icon-61f7237a.d.ts} +0 -0
- /package/dist/_shared/esm/{Image-7e4948f6.d.ts → Image-c0f3d42f.d.ts} +0 -0
- /package/dist/_shared/esm/{Section-f1256c87.d.ts → Section-7bc71e26.d.ts} +0 -0
- /package/dist/_shared/esm/{Surface-d515d212.d.ts → Surface-bf201530.d.ts} +0 -0
- /package/dist/_shared/esm/{Text-d8988620.d.ts → Text-6b958ad8.d.ts} +0 -0
|
@@ -5,8 +5,12 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var index = require('../_shared/cjs/index-78b35bc1.js');
|
|
6
6
|
var index$1 = require('../_shared/cjs/index-45bfb67b.js');
|
|
7
7
|
var React = require('react');
|
|
8
|
-
var FormControl = require('../_shared/cjs/FormControl-
|
|
8
|
+
var FormControl = require('../_shared/cjs/FormControl-e6b7d7c5.js');
|
|
9
9
|
var Surface = require('../_shared/cjs/Surface-d6b8010e.js');
|
|
10
|
+
var VisuallyHidden = require('../_shared/cjs/VisuallyHidden-e2c8b291.js');
|
|
11
|
+
require('../_shared/cjs/Text-1d3844be.js');
|
|
12
|
+
require('../_shared/cjs/suffix-modifier-edf7851e.js');
|
|
13
|
+
require('../_shared/cjs/BtIconChevronRightMid-5a38d855.js');
|
|
10
14
|
|
|
11
15
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
12
16
|
|
|
@@ -43,22 +47,37 @@ var useNumericInput = function (props) {
|
|
|
43
47
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
44
48
|
*/
|
|
45
49
|
var TextInput = React.forwardRef(function (_a, ref) {
|
|
46
|
-
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 = index.__rest(_a, ["defaultValue", "errorMessage", "helper", "id", "inputMode", "isDisabled", "isReadOnly", "isRequired", "label", "labelSize", "maxLength", "minLength", "name", "onBlur", "onChange", "pattern", "type", "value"]);
|
|
50
|
+
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, onClickDisclosure = _a.onClickDisclosure, pattern = _a.pattern, _g = _a.type, type = _g === void 0 ? "text" : _g, _h = _a.showPassword, showPassword = _h === void 0 ? false : _h, value = _a.value, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, props = index.__rest(_a, ["defaultValue", "errorMessage", "helper", "id", "inputMode", "isDisabled", "isReadOnly", "isRequired", "label", "labelSize", "maxLength", "minLength", "name", "onBlur", "onChange", "onClickDisclosure", "pattern", "type", "showPassword", "value", "disclosureTitle", "disclosureText"]);
|
|
47
51
|
var surface = React.useContext(Surface.Context).surface;
|
|
48
|
-
var
|
|
52
|
+
var _j = React.useState(false), showPasswordToggle = _j[0], setShowPasswordToggle = _j[1];
|
|
53
|
+
var inferredInputProps = useNumericInput({
|
|
54
|
+
inputMode: inputMode,
|
|
55
|
+
pattern: pattern,
|
|
56
|
+
type: showPasswordToggle ? "text" : type
|
|
57
|
+
});
|
|
49
58
|
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
50
59
|
var ariaDescribedby = FormControl.useAriaDescribedby({
|
|
51
60
|
errorMessage: errorMessage,
|
|
52
61
|
id: id,
|
|
53
|
-
helper: helper
|
|
62
|
+
helper: helper,
|
|
63
|
+
disclosureText: disclosureText
|
|
54
64
|
}).ariaDescribedby;
|
|
55
65
|
return (React__default["default"].createElement("div", index.__assign({ className: index$1.classNames({
|
|
56
66
|
"arc-TextInput": true,
|
|
67
|
+
"arc-TextInput--withPasswordToggle": showPassword,
|
|
57
68
|
"arc-TextInput--invalid": errorMessage,
|
|
58
69
|
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
59
70
|
}) }, index.filterDataAttrs(props)),
|
|
60
|
-
React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional" },
|
|
61
|
-
React__default["default"].createElement("
|
|
71
|
+
React__default["default"].createElement(FormControl.FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, isDisabled: isDisabled, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", disclosureTitle: disclosureTitle, disclosureText: disclosureText, onClickDisclosure: onClickDisclosure },
|
|
72
|
+
React__default["default"].createElement("div", { className: "arc-TextInput-inputWrapper" },
|
|
73
|
+
React__default["default"].createElement("input", index.__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)),
|
|
74
|
+
showPassword && (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
75
|
+
React__default["default"].createElement("button", { className: "arc-TextInput-passwordToggle", onClick: function () { return setShowPasswordToggle(function (p) { return !p; }); }, type: "button" }, showPasswordToggle ? "Hide" : "Show"),
|
|
76
|
+
React__default["default"].createElement(VisuallyHidden.VisuallyHidden, null,
|
|
77
|
+
React__default["default"].createElement("div", { "aria-live": "polite" },
|
|
78
|
+
React__default["default"].createElement("p", null, showPasswordToggle
|
|
79
|
+
? "Your password is shown"
|
|
80
|
+
: "Your password is hidden")))))))));
|
|
62
81
|
});
|
|
63
82
|
|
|
64
83
|
exports.TextInput = TextInput;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { FC } from "react";
|
|
4
|
-
import { FormControlProps } from "../_shared/esm/FormControl-
|
|
4
|
+
import { FormControlProps } from "../_shared/esm/FormControl-84c9ace6";
|
|
5
5
|
type EventType = React.ChangeEvent<HTMLInputElement>;
|
|
6
6
|
/**
|
|
7
7
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
@@ -58,6 +58,10 @@ interface TextInputProps extends Omit<FormControlProps, "children" | "elementTyp
|
|
|
58
58
|
* Validation regex pattern.
|
|
59
59
|
*/
|
|
60
60
|
pattern?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Enable button to toggle TextInput type from `Selected Type` to `Text`
|
|
63
|
+
*/
|
|
64
|
+
showPassword?: boolean;
|
|
61
65
|
/**
|
|
62
66
|
* Type for the input. `number` will be changed to `text` and set the `numeric` inputMode.
|
|
63
67
|
*/
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/index-229fc864.js';
|
|
2
2
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
3
|
-
import
|
|
4
|
-
import { u as useAriaDescribedby, F as FormControl } from '../_shared/esm/FormControl-
|
|
5
|
-
import { C as Context } from '../_shared/esm/Surface-
|
|
3
|
+
import React__default, { forwardRef, useContext, useState } from 'react';
|
|
4
|
+
import { u as useAriaDescribedby, F as FormControl } from '../_shared/esm/FormControl-84c9ace6.js';
|
|
5
|
+
import { C as Context } from '../_shared/esm/Surface-bf201530.js';
|
|
6
|
+
import { V as VisuallyHidden } from '../_shared/esm/VisuallyHidden-b9eebf71.js';
|
|
7
|
+
import '../_shared/esm/Text-6b958ad8.js';
|
|
8
|
+
import '../_shared/esm/suffix-modifier-f5e28822.js';
|
|
9
|
+
import '../_shared/esm/BtIconChevronRightMid-d9b11761.js';
|
|
6
10
|
|
|
7
11
|
/**
|
|
8
12
|
* Infer the correct inputMode, pattern and type if specifying a `number` type.
|
|
@@ -35,22 +39,37 @@ var useNumericInput = function (props) {
|
|
|
35
39
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
36
40
|
*/
|
|
37
41
|
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"]);
|
|
42
|
+
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, onClickDisclosure = _a.onClickDisclosure, pattern = _a.pattern, _g = _a.type, type = _g === void 0 ? "text" : _g, _h = _a.showPassword, showPassword = _h === void 0 ? false : _h, value = _a.value, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, props = __rest(_a, ["defaultValue", "errorMessage", "helper", "id", "inputMode", "isDisabled", "isReadOnly", "isRequired", "label", "labelSize", "maxLength", "minLength", "name", "onBlur", "onChange", "onClickDisclosure", "pattern", "type", "showPassword", "value", "disclosureTitle", "disclosureText"]);
|
|
39
43
|
var surface = useContext(Context).surface;
|
|
40
|
-
var
|
|
44
|
+
var _j = useState(false), showPasswordToggle = _j[0], setShowPasswordToggle = _j[1];
|
|
45
|
+
var inferredInputProps = useNumericInput({
|
|
46
|
+
inputMode: inputMode,
|
|
47
|
+
pattern: pattern,
|
|
48
|
+
type: showPasswordToggle ? "text" : type
|
|
49
|
+
});
|
|
41
50
|
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
42
51
|
var ariaDescribedby = useAriaDescribedby({
|
|
43
52
|
errorMessage: errorMessage,
|
|
44
53
|
id: id,
|
|
45
|
-
helper: helper
|
|
54
|
+
helper: helper,
|
|
55
|
+
disclosureText: disclosureText
|
|
46
56
|
}).ariaDescribedby;
|
|
47
|
-
return (
|
|
57
|
+
return (React__default.createElement("div", __assign({ className: classNames({
|
|
48
58
|
"arc-TextInput": true,
|
|
59
|
+
"arc-TextInput--withPasswordToggle": showPassword,
|
|
49
60
|
"arc-TextInput--invalid": errorMessage,
|
|
50
61
|
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
51
62
|
}) }, filterDataAttrs(props)),
|
|
52
|
-
|
|
53
|
-
|
|
63
|
+
React__default.createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, isDisabled: isDisabled, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional", disclosureTitle: disclosureTitle, disclosureText: disclosureText, onClickDisclosure: onClickDisclosure },
|
|
64
|
+
React__default.createElement("div", { className: "arc-TextInput-inputWrapper" },
|
|
65
|
+
React__default.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)),
|
|
66
|
+
showPassword && (React__default.createElement(React__default.Fragment, null,
|
|
67
|
+
React__default.createElement("button", { className: "arc-TextInput-passwordToggle", onClick: function () { return setShowPasswordToggle(function (p) { return !p; }); }, type: "button" }, showPasswordToggle ? "Hide" : "Show"),
|
|
68
|
+
React__default.createElement(VisuallyHidden, null,
|
|
69
|
+
React__default.createElement("div", { "aria-live": "polite" },
|
|
70
|
+
React__default.createElement("p", null, showPasswordToggle
|
|
71
|
+
? "Your password is shown"
|
|
72
|
+
: "Your password is hidden")))))))));
|
|
54
73
|
});
|
|
55
74
|
|
|
56
75
|
export { TextInput };
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
declare const Truncate: FC<TruncateProps>;
|
|
4
|
+
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
|
+
}
|
|
18
|
+
export { Truncate };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
+
|
|
5
|
+
var React = require('react');
|
|
6
|
+
|
|
7
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
|
+
|
|
9
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
|
+
|
|
11
|
+
/** Use `Truncate` component to shorten text with an ellipsis. Add a `title` attribute to the truncated element so the full text remains accessible. */
|
|
12
|
+
var Truncate = function (_a) {
|
|
13
|
+
var _b = _a.maxWidth, maxWidth = _b === void 0 ? 100 : _b, title = _a.title, children = _a.children;
|
|
14
|
+
return (React__default["default"].createElement("div", { className: "arc-Truncate", style: { maxWidth: "".concat(maxWidth, "%") }, title: title }, children));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.Truncate = Truncate;
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
declare const Truncate: FC<TruncateProps>;
|
|
4
|
+
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
|
+
}
|
|
18
|
+
export { Truncate };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React__default from 'react';
|
|
2
|
+
|
|
3
|
+
/** Use `Truncate` component to shorten text with an ellipsis. Add a `title` attribute to the truncated element so the full text remains accessible. */
|
|
4
|
+
var Truncate = function (_a) {
|
|
5
|
+
var _b = _a.maxWidth, maxWidth = _b === void 0 ? 100 : _b, title = _a.title, children = _a.children;
|
|
6
|
+
return (React__default.createElement("div", { className: "arc-Truncate", style: { maxWidth: "".concat(maxWidth, "%") }, title: title }, children));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export { Truncate };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/index-229fc864.js';
|
|
2
|
-
import
|
|
3
|
-
import { S as Surface } from '../_shared/esm/Surface-
|
|
2
|
+
import React__default, { useEffect } from 'react';
|
|
3
|
+
import { S as Surface } from '../_shared/esm/Surface-bf201530.js';
|
|
4
4
|
import '../_shared/esm/index-2ae58626.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -9,20 +9,20 @@ import '../_shared/esm/index-2ae58626.js';
|
|
|
9
9
|
var UniversalHeader = function (_a) {
|
|
10
10
|
var children = _a.children, props = __rest(_a, ["children"]);
|
|
11
11
|
useEffect(function () {
|
|
12
|
-
|
|
12
|
+
React__default.Children.map(children, function (item) {
|
|
13
13
|
if (item && item.type !== UniversalHeaderItem) {
|
|
14
14
|
throw new Error("Illegal child passed to <UniversalHeader />. Ensure to only use <UniversalHeader.Item />.");
|
|
15
15
|
}
|
|
16
16
|
});
|
|
17
17
|
}, [children]);
|
|
18
|
-
return (
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
return (React__default.createElement("nav", __assign({ className: "arc-UniversalHeader" }, filterDataAttrs(props)),
|
|
19
|
+
React__default.createElement(Surface, { background: "light" },
|
|
20
|
+
React__default.createElement("ul", { className: "arc-UniversalHeader-items" }, children))));
|
|
21
21
|
};
|
|
22
22
|
var UniversalHeaderItem = function (_a) {
|
|
23
23
|
var children = _a.children, href = _a.href, props = __rest(_a, ["children", "href"]);
|
|
24
|
-
return (
|
|
25
|
-
|
|
24
|
+
return (React__default.createElement("li", __assign({}, filterDataAttrs(props)),
|
|
25
|
+
React__default.createElement("a", { className: "arc-UniversalHeader-link", href: href }, children)));
|
|
26
26
|
};
|
|
27
27
|
UniversalHeaderItem.displayName = "UniversalHeader.Item";
|
|
28
28
|
UniversalHeader.Item = UniversalHeaderItem;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { _ as __rest, a as __assign, f as filterDataAttrs } from '../_shared/esm/index-229fc864.js';
|
|
2
2
|
import { c as classNames } from '../_shared/esm/index-2ae58626.js';
|
|
3
|
-
import
|
|
3
|
+
import React__default from 'react';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* Use `VerticalSpace` to create vertical space between components.
|
|
@@ -8,7 +8,7 @@ import React from 'react';
|
|
|
8
8
|
var VerticalSpace = function (_a) {
|
|
9
9
|
var _b;
|
|
10
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 (
|
|
11
|
+
return (React__default.createElement("div", __assign({ className: classNames((_b = {
|
|
12
12
|
"arc-VerticalSpace": true
|
|
13
13
|
},
|
|
14
14
|
_b["arc-VerticalSpace--size".concat(size)] = size && size !== "24",
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Provides text for screen readers that is visually hidden.
|
|
4
|
-
*/
|
|
5
|
-
declare const VisuallyHidden: FC<VisuallyHiddenProps>;
|
|
6
|
-
interface VisuallyHiddenProps {
|
|
7
|
-
/**
|
|
8
|
-
* Content to be Visually Hidden.
|
|
9
|
-
*/
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export { VisuallyHidden };
|
|
1
|
+
export { VisuallyHidden } from "../_shared/cjs/VisuallyHidden-e2c8b291";
|
|
@@ -2,18 +2,9 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var VisuallyHidden = require('../_shared/cjs/VisuallyHidden-e2c8b291.js');
|
|
6
|
+
require('react');
|
|
6
7
|
|
|
7
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
8
8
|
|
|
9
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
10
9
|
|
|
11
|
-
|
|
12
|
-
* Provides text for screen readers that is visually hidden.
|
|
13
|
-
*/
|
|
14
|
-
var VisuallyHidden = function (_a) {
|
|
15
|
-
var children = _a.children;
|
|
16
|
-
return (React__default["default"].createElement("div", { "data-testid": "visually-hidden", className: "arc-VisuallyHidden" }, children));
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
exports.VisuallyHidden = VisuallyHidden;
|
|
10
|
+
exports.VisuallyHidden = VisuallyHidden.VisuallyHidden;
|
|
@@ -1,12 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/**
|
|
3
|
-
* Provides text for screen readers that is visually hidden.
|
|
4
|
-
*/
|
|
5
|
-
declare const VisuallyHidden: FC<VisuallyHiddenProps>;
|
|
6
|
-
interface VisuallyHiddenProps {
|
|
7
|
-
/**
|
|
8
|
-
* Content to be Visually Hidden.
|
|
9
|
-
*/
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
}
|
|
12
|
-
export { VisuallyHidden };
|
|
1
|
+
export { VisuallyHidden } from "../_shared/esm/VisuallyHidden-b9eebf71";
|
|
@@ -1,11 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Provides text for screen readers that is visually hidden.
|
|
5
|
-
*/
|
|
6
|
-
var VisuallyHidden = function (_a) {
|
|
7
|
-
var children = _a.children;
|
|
8
|
-
return (React.createElement("div", { "data-testid": "visually-hidden", className: "arc-VisuallyHidden" }, children));
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export { VisuallyHidden };
|
|
1
|
+
export { V as VisuallyHidden } from '../_shared/esm/VisuallyHidden-b9eebf71.js';
|
|
2
|
+
import 'react';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { FC } from "react";
|
|
4
|
+
declare const ArcRootElementContext: React.Context<HTMLElement | null>;
|
|
5
|
+
/**
|
|
6
|
+
* Use `Base` as the root component of the arc system.
|
|
7
|
+
*/
|
|
8
|
+
declare const Base: FC<BaseProps>;
|
|
9
|
+
interface BaseProps {
|
|
10
|
+
/**
|
|
11
|
+
* Brand theme to apply to Base.
|
|
12
|
+
*/
|
|
13
|
+
brand?: "bt" | null;
|
|
14
|
+
/**
|
|
15
|
+
* Content to display inside Base.
|
|
16
|
+
*/
|
|
17
|
+
children: any;
|
|
18
|
+
}
|
|
19
|
+
export { ArcRootElementContext, Base, BaseProps };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-78b35bc1.js');
|
|
4
|
+
var React = require('react');
|
|
5
|
+
|
|
6
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
7
|
+
|
|
8
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
9
|
+
|
|
10
|
+
var ArcRootElementContext = React.createContext(null);
|
|
11
|
+
/**
|
|
12
|
+
* Use `Base` as the root component of the arc system.
|
|
13
|
+
*/
|
|
14
|
+
var Base = function (_a) {
|
|
15
|
+
var _b = _a.brand, brand = _b === void 0 ? "bt" : _b, children = _a.children, props = index.__rest(_a, ["brand", "children"]);
|
|
16
|
+
var _c = React__default["default"].useState(null), arcRoot = _c[0], setArcRoot = _c[1];
|
|
17
|
+
return (React__default["default"].createElement("div", index.__assign({ id: "arc-root", ref: setArcRoot, className: "arc".concat(brand ? " arc-".concat(brand) : "") }, index.filterDataAttrs(props)),
|
|
18
|
+
React__default["default"].createElement(ArcRootElementContext.Provider, { value: arcRoot }, children)));
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
exports.ArcRootElementContext = ArcRootElementContext;
|
|
22
|
+
exports.Base = Base;
|
|
@@ -1,23 +1,54 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import React from "react";
|
|
3
|
-
import { FC } from "react";
|
|
3
|
+
import { FC, ReactNode } from "react";
|
|
4
|
+
/**
|
|
5
|
+
* Use `FormControlDisclosure` to display content that is only visible when toggled into
|
|
6
|
+
* an "open" state.
|
|
7
|
+
*/
|
|
8
|
+
declare const FormControlDisclosure: FC<FormControlDisclosureProps>;
|
|
9
|
+
interface FormControlDisclosureProps {
|
|
10
|
+
/**
|
|
11
|
+
* Content to display in the FormControlDisclosure.
|
|
12
|
+
*/
|
|
13
|
+
children: ReactNode;
|
|
14
|
+
/**
|
|
15
|
+
* FormControlDisclosure ID.
|
|
16
|
+
*/
|
|
17
|
+
id?: string;
|
|
18
|
+
/**
|
|
19
|
+
* The FormControlDisclosure summary text.
|
|
20
|
+
*/
|
|
21
|
+
summary: string;
|
|
22
|
+
/**
|
|
23
|
+
* On Click handler for FormControlDisclosure summary disclosure.
|
|
24
|
+
*/
|
|
25
|
+
onClick?: () => void;
|
|
26
|
+
/**
|
|
27
|
+
* Disclosure size.
|
|
28
|
+
*/
|
|
29
|
+
size?: "s" | "l";
|
|
30
|
+
}
|
|
4
31
|
/**
|
|
5
32
|
* Optionally define ariaDescribedBy if errorMessage or helper exist.
|
|
6
33
|
*/
|
|
7
|
-
declare const useAriaDescribedby: ({ id, idError, idHelper, errorMessage, helper }: {
|
|
34
|
+
declare const useAriaDescribedby: ({ id, idError, idHelper, idDisclosure, errorMessage, helper, disclosureText }: {
|
|
8
35
|
id?: string | undefined;
|
|
9
36
|
idError?: string | undefined;
|
|
37
|
+
idDisclosure?: string | undefined;
|
|
10
38
|
idHelper?: string | undefined;
|
|
11
39
|
errorMessage?: any;
|
|
12
40
|
helper?: any;
|
|
41
|
+
disclosureText?: string | undefined;
|
|
13
42
|
}) => {
|
|
14
43
|
ariaDescribedby: undefined;
|
|
15
44
|
idHelper: undefined;
|
|
16
45
|
idError: undefined;
|
|
46
|
+
idDisclosure: undefined;
|
|
17
47
|
} | {
|
|
18
48
|
ariaDescribedby: string | undefined;
|
|
19
49
|
idError: string;
|
|
20
50
|
idHelper: string;
|
|
51
|
+
idDisclosure: string;
|
|
21
52
|
};
|
|
22
53
|
type RequirementStatus = "required" | "optional" | "not-applicable";
|
|
23
54
|
declare const Context: React.Context<{
|
|
@@ -62,9 +93,26 @@ interface FormControlProps {
|
|
|
62
93
|
* Label for the FormControl.
|
|
63
94
|
*/
|
|
64
95
|
label: string;
|
|
96
|
+
/**
|
|
97
|
+
* Determins if the Label should be in a disabled state
|
|
98
|
+
*/
|
|
99
|
+
isDisabled?: boolean;
|
|
65
100
|
/**
|
|
66
101
|
* Label size.
|
|
67
102
|
*/
|
|
68
103
|
labelSize?: "s" | "l";
|
|
104
|
+
/**
|
|
105
|
+
* Use `DisclosureTitle` to display content that is only visible when toggled into
|
|
106
|
+
* an "open" state. This overrides helper text.
|
|
107
|
+
*/
|
|
108
|
+
disclosureTitle?: string;
|
|
109
|
+
/**
|
|
110
|
+
* Text to display within the disclosure
|
|
111
|
+
*/
|
|
112
|
+
disclosureText?: string;
|
|
113
|
+
/**
|
|
114
|
+
* onClick handler for FormControlDisclosure
|
|
115
|
+
*/
|
|
116
|
+
onClickDisclosure?: () => void;
|
|
69
117
|
}
|
|
70
|
-
export { useAriaDescribedby, FormControl, FormControlProps, Context as FormControlContext };
|
|
118
|
+
export { FormControlDisclosure, FormControlDisclosureProps, useAriaDescribedby, FormControl, FormControlProps, Context as FormControlContext };
|
|
@@ -4,6 +4,8 @@ var index = require('./index-78b35bc1.js');
|
|
|
4
4
|
var index$1 = require('./index-45bfb67b.js');
|
|
5
5
|
var React$1 = require('react');
|
|
6
6
|
var Surface = require('./Surface-d6b8010e.js');
|
|
7
|
+
var Text = require('./Text-1d3844be.js');
|
|
8
|
+
var BtIconChevronRightMid = require('./BtIconChevronRightMid-5a38d855.js');
|
|
7
9
|
|
|
8
10
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
9
11
|
|
|
@@ -13,12 +15,13 @@ var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1);
|
|
|
13
15
|
* Optionally define ariaDescribedBy if errorMessage or helper exist.
|
|
14
16
|
*/
|
|
15
17
|
var useAriaDescribedby = function (_a) {
|
|
16
|
-
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;
|
|
18
|
+
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, _d = _a.idDisclosure, idDisclosure = _d === void 0 ? "".concat(id, "-disclosure") : _d, errorMessage = _a.errorMessage, helper = _a.helper, disclosureText = _a.disclosureText;
|
|
17
19
|
if (!id) {
|
|
18
20
|
return {
|
|
19
21
|
ariaDescribedby: undefined,
|
|
20
22
|
idHelper: undefined,
|
|
21
|
-
idError: undefined
|
|
23
|
+
idError: undefined,
|
|
24
|
+
idDisclosure: undefined
|
|
22
25
|
};
|
|
23
26
|
}
|
|
24
27
|
var ariaDescribedbyArr = [];
|
|
@@ -28,8 +31,11 @@ var useAriaDescribedby = function (_a) {
|
|
|
28
31
|
if (helper) {
|
|
29
32
|
ariaDescribedbyArr.push(idHelper);
|
|
30
33
|
}
|
|
34
|
+
if (disclosureText) {
|
|
35
|
+
ariaDescribedbyArr.push(idDisclosure);
|
|
36
|
+
}
|
|
31
37
|
var ariaDescribedby = ariaDescribedbyArr.length > 0 ? ariaDescribedbyArr.join(" ") : undefined;
|
|
32
|
-
return { ariaDescribedby: ariaDescribedby, idError: idError, idHelper: idHelper };
|
|
38
|
+
return { ariaDescribedby: ariaDescribedby, idError: idError, idHelper: idHelper, idDisclosure: idDisclosure };
|
|
33
39
|
};
|
|
34
40
|
|
|
35
41
|
const React = React__default["default"];
|
|
@@ -61,6 +67,31 @@ const BtIconAlert = props =>
|
|
|
61
67
|
);
|
|
62
68
|
var BtIconAlert_2 = BtIconAlert;
|
|
63
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Use `FormControlDisclosure` to display content that is only visible when toggled into
|
|
72
|
+
* an "open" state.
|
|
73
|
+
*/
|
|
74
|
+
var FormControlDisclosure = function (_a) {
|
|
75
|
+
var children = _a.children, summary = _a.summary, onClick = _a.onClick, _b = _a.size, size = _b === void 0 ? "l" : _b, id = _a.id, props = index.__rest(_a, ["children", "summary", "onClick", "size", "id"]);
|
|
76
|
+
var surface = React$1.useContext(Surface.Context).surface;
|
|
77
|
+
var _c = React$1.useState(false), disclousreState = _c[0], setDisclosureState = _c[1];
|
|
78
|
+
var handleOnClick = function () {
|
|
79
|
+
onClick && onClick();
|
|
80
|
+
setDisclosureState(function (prevState) { return !prevState; });
|
|
81
|
+
};
|
|
82
|
+
return (React__default["default"].createElement("details", index.__assign({ className: index$1.classNames({
|
|
83
|
+
"arc-FormControlDisclosure": true,
|
|
84
|
+
"arc-FormControlDisclosure--onDarkSurface": surface === "dark"
|
|
85
|
+
}) }, index.filterDataAttrs(props), { "data-testid": "FormControlDisclosure" }),
|
|
86
|
+
React__default["default"].createElement("summary", { className: "arc-FormControlDisclosure-summary", onClick: handleOnClick, "aria-expanded": disclousreState },
|
|
87
|
+
React__default["default"].createElement("span", { className: "arc-FormControlDisclosure-summary-icon" },
|
|
88
|
+
React__default["default"].createElement(BtIconChevronRightMid.BtIconChevronRightMid_2, null)),
|
|
89
|
+
React__default["default"].createElement(Text.Text, { size: size === "l" ? "m" : "s" }, summary)),
|
|
90
|
+
React__default["default"].createElement("div", { className: "arc-FormControlDisclosure-details" },
|
|
91
|
+
React__default["default"].createElement(Text.Text, { size: size === "l" ? "m" : "s" },
|
|
92
|
+
React__default["default"].createElement("span", { id: id }, children)))));
|
|
93
|
+
};
|
|
94
|
+
|
|
64
95
|
var defaultContext = {
|
|
65
96
|
requirementStatus: null
|
|
66
97
|
};
|
|
@@ -70,13 +101,14 @@ var Provider = Context.Provider;
|
|
|
70
101
|
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
71
102
|
*/
|
|
72
103
|
var FormControl = function (_a) {
|
|
73
|
-
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 = index.__rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus"]);
|
|
104
|
+
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, isDisabled = _a.isDisabled, disclosureTitle = _a.disclosureTitle, disclosureText = _a.disclosureText, onClickDisclosure = _a.onClickDisclosure, props = index.__rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "label", "labelSize", "requirementStatus", "isDisabled", "disclosureTitle", "disclosureText", "onClickDisclosure"]);
|
|
74
105
|
var surface = React$1.useContext(Surface.Context).surface;
|
|
75
106
|
var _e = useAriaDescribedby({
|
|
107
|
+
disclosureText: disclosureText,
|
|
76
108
|
errorMessage: errorMessage,
|
|
77
109
|
helper: helper,
|
|
78
110
|
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
79
|
-
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
111
|
+
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper, idDisclosure = _e.idDisclosure;
|
|
80
112
|
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
81
113
|
var elementProps = {};
|
|
82
114
|
var labelProps = {};
|
|
@@ -95,18 +127,18 @@ var FormControl = function (_a) {
|
|
|
95
127
|
return (React__default["default"].createElement(Provider, { value: { requirementStatus: requirementStatus } },
|
|
96
128
|
React__default["default"].createElement(ElementType, index.__assign({ className: index$1.classNames({
|
|
97
129
|
"arc-FormControl": true,
|
|
130
|
+
"arc-FormControl--isDisabled": isDisabled,
|
|
98
131
|
"arc-FormControl--smallLabel": labelSize === "s",
|
|
99
132
|
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
100
133
|
}), id: id }, elementProps, index.filterDataAttrs(props)),
|
|
101
134
|
React__default["default"].createElement(LabelType, index.__assign({ className: "arc-FormControl-label" }, labelProps),
|
|
102
135
|
label,
|
|
103
136
|
requirementStatus === "optional" && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
104
|
-
helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
105
137
|
children,
|
|
106
|
-
errorMessage
|
|
138
|
+
errorMessage ? (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError },
|
|
107
139
|
React__default["default"].createElement("span", { className: "arc-FormControl-error--icon" },
|
|
108
140
|
React__default["default"].createElement(BtIconAlert_2, null)),
|
|
109
|
-
errorMessage)))));
|
|
141
|
+
errorMessage)) : disclosureTitle ? (React__default["default"].createElement(FormControlDisclosure, { onClick: onClickDisclosure, summary: disclosureTitle, size: labelSize, id: idDisclosure }, disclosureText)) : (helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper))))));
|
|
110
142
|
};
|
|
111
143
|
|
|
112
144
|
exports.BtIconAlert_2 = BtIconAlert_2;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { FC, ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Provides text for screen readers that is visually hidden.
|
|
4
|
+
*/
|
|
5
|
+
declare const VisuallyHidden: FC<VisuallyHiddenProps>;
|
|
6
|
+
interface VisuallyHiddenProps {
|
|
7
|
+
/**
|
|
8
|
+
* Content to be Visually Hidden.
|
|
9
|
+
*/
|
|
10
|
+
children?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export { VisuallyHidden, VisuallyHiddenProps };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var React = require('react');
|
|
4
|
+
|
|
5
|
+
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
6
|
+
|
|
7
|
+
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Provides text for screen readers that is visually hidden.
|
|
11
|
+
*/
|
|
12
|
+
var VisuallyHidden = function (_a) {
|
|
13
|
+
var children = _a.children;
|
|
14
|
+
return (React__default["default"].createElement("span", { "data-testid": "visually-hidden", className: "arc-VisuallyHidden" }, children));
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
exports.VisuallyHidden = VisuallyHidden;
|