@arc-ui/components 4.0.1 → 6.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/index.es.js +184 -147
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +184 -147
- package/dist/index.js.map +1 -1
- package/dist/polyfills.js +3331 -17
- package/dist/polyfills.js.map +1 -1
- package/dist/styles.bt.css +1 -1
- package/dist/styles.css +1 -1
- package/dist/styles.ee.css +1 -1
- package/dist/types/components/Button/Button.d.ts +4 -0
- package/dist/types/components/Checkbox/Checkbox.d.ts +13 -9
- package/dist/types/components/FormControl/FormControl.d.ts +8 -2
- package/dist/types/components/FormControl/index.d.ts +1 -1
- package/dist/types/components/RadioGroup/RadioButton/RadioButton.d.ts +4 -0
- package/dist/types/components/RadioGroup/RadioGroup.d.ts +17 -12
- package/dist/types/components/RadioGroup/context.d.ts +5 -6
- package/dist/types/components/SiteHeader/components/SubNavItem/SubNavItem.d.ts +16 -1
- package/dist/types/components/TextInput/TextInput.d.ts +15 -9
- package/package.json +6 -4
package/dist/index.js
CHANGED
|
@@ -316,9 +316,9 @@ var Base = function (_a) {
|
|
|
316
316
|
return (React__default["default"].createElement("div", __assign({ className: "arc".concat(brand ? " arc-".concat(brand) : "") }, filterDataAttrs(props)), children));
|
|
317
317
|
};
|
|
318
318
|
|
|
319
|
-
var defaultContext$
|
|
320
|
-
var Context$
|
|
321
|
-
var Provider$
|
|
319
|
+
var defaultContext$3 = { surface: "light" };
|
|
320
|
+
var Context$3 = React.createContext(defaultContext$3);
|
|
321
|
+
var Provider$4 = Context$3.Provider;
|
|
322
322
|
/**
|
|
323
323
|
* Use `Surface` to compose content using the Arc system.
|
|
324
324
|
*/
|
|
@@ -333,7 +333,7 @@ var Surface = function (_a) {
|
|
|
333
333
|
background === "darker") {
|
|
334
334
|
surface = "dark";
|
|
335
335
|
}
|
|
336
|
-
return (React__default["default"].createElement(Provider$
|
|
336
|
+
return (React__default["default"].createElement(Provider$4, { value: { surface: surface } },
|
|
337
337
|
React__default["default"].createElement("div", __assign({ className: classNames((_b = {
|
|
338
338
|
"arc-Surface": true
|
|
339
339
|
},
|
|
@@ -365,7 +365,7 @@ __spreadArray([], backgroundsShared, true);
|
|
|
365
365
|
var BrandLogo = function (_a) {
|
|
366
366
|
var _b;
|
|
367
367
|
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"]);
|
|
368
|
-
var surface = React.useContext(Context$
|
|
368
|
+
var surface = React.useContext(Context$3).surface;
|
|
369
369
|
return (React__default["default"].createElement("div", __assign({ className: classNames((_b = {
|
|
370
370
|
"arc-BrandLogo": true,
|
|
371
371
|
"arc-BrandLogo--colorBrand": color === "brand",
|
|
@@ -377,6 +377,10 @@ var BrandLogo = function (_a) {
|
|
|
377
377
|
} }, filterDataAttrs(props)), label ? React__default["default"].createElement("span", { className: "arc-BrandLogo-text" }, label) : null));
|
|
378
378
|
};
|
|
379
379
|
|
|
380
|
+
/**
|
|
381
|
+
* Do not edit directly
|
|
382
|
+
* Generated file
|
|
383
|
+
*/
|
|
380
384
|
const ArcBreakpointM = 768;
|
|
381
385
|
const ArcBreakpointL = 1024;
|
|
382
386
|
const iconsSelected = [
|
|
@@ -643,7 +647,7 @@ const iconsSelected = [
|
|
|
643
647
|
var Icon = function (_a) {
|
|
644
648
|
var _b;
|
|
645
649
|
var _c = _a.color, color = _c === void 0 ? "auto" : _c, icon = _a.icon, _d = _a.isInline, isInline = _d === void 0 ? false : _d, _e = _a.isSelected, isSelected = _e === void 0 ? false : _e, label = _a.label, size = _a.size, props = __rest(_a, ["color", "icon", "isInline", "isSelected", "label", "size"]);
|
|
646
|
-
var surface = React.useContext(Context$
|
|
650
|
+
var surface = React.useContext(Context$3).surface;
|
|
647
651
|
return (React__default["default"].createElement("span", __assign({ "aria-label": label, className: classNames((_b = {},
|
|
648
652
|
_b["arc-Icon"] = true,
|
|
649
653
|
_b[suffixModifier("arc-Icon--color", color)] = color !== "auto",
|
|
@@ -661,8 +665,8 @@ var Icon = function (_a) {
|
|
|
661
665
|
*/
|
|
662
666
|
var Button = React.forwardRef(function (_a, ref) {
|
|
663
667
|
var _b;
|
|
664
|
-
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, target = _a.target, type = _a.type, props = __rest(_a, ["ariaLabel", "fill", "href", "icon", "iconPosition", "id", "isDisabled", "isDisplayBlock", "isFullWidth", "label", "onClick", "rel", "target", "type"]);
|
|
665
|
-
var surface = React.useContext(Context$
|
|
668
|
+
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"]);
|
|
669
|
+
var surface = React.useContext(Context$3).surface;
|
|
666
670
|
var buttonClasses = classNames((_b = {
|
|
667
671
|
"arc-Button": true,
|
|
668
672
|
"arc-Button--displayBlock": isDisplayBlock
|
|
@@ -672,19 +676,23 @@ var Button = React.forwardRef(function (_a, ref) {
|
|
|
672
676
|
_b[suffixModifier("arc-Button--icon", iconPosition.replace("icon", ""))] = (icon || fill === "flat") &&
|
|
673
677
|
iconPosition &&
|
|
674
678
|
iconPosition !== "afterText",
|
|
679
|
+
_b["arc-Button--hasSupportingText"] = supportingText,
|
|
675
680
|
_b["arc-Button--onDarkSurface"] = surface === "dark",
|
|
676
681
|
_b));
|
|
677
682
|
var commonProps = __assign({ id: id, onClick: onClick, ref: ref }, filterDataAttrs(props));
|
|
683
|
+
var buttonText = supportingText ? (React__default["default"].createElement("span", null,
|
|
684
|
+
React__default["default"].createElement("span", { className: "arc-Button-text" }, label),
|
|
685
|
+
React__default["default"].createElement("span", { className: "arc-Button-supportingText" }, supportingText))) : (React__default["default"].createElement("span", { className: "arc-Button-text" }, label));
|
|
678
686
|
var buttonIcon = icon || fill === "flat" ? (React__default["default"].createElement(ButtonIcon, { icon: icon, isChevron: !icon && fill === "flat", isBeforeText: iconPosition === "beforeText" })) : null;
|
|
679
687
|
if (href && !isDisabled) {
|
|
680
688
|
return (React__default["default"].createElement("a", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, href: href, rel: rel, target: target }),
|
|
681
689
|
React__default["default"].createElement("span", { className: "arc-Button-inner" },
|
|
682
|
-
|
|
690
|
+
buttonText,
|
|
683
691
|
buttonIcon)));
|
|
684
692
|
}
|
|
685
693
|
return (React__default["default"].createElement("button", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, disabled: isDisabled, type: type }),
|
|
686
694
|
React__default["default"].createElement("span", { className: "arc-Button-inner" },
|
|
687
|
-
|
|
695
|
+
buttonText,
|
|
688
696
|
buttonIcon)));
|
|
689
697
|
});
|
|
690
698
|
var ButtonIcon = function (_a) {
|
|
@@ -717,7 +725,7 @@ var Image = function (_a) {
|
|
|
717
725
|
var Heading = function (_a) {
|
|
718
726
|
var _b;
|
|
719
727
|
var _c = _a.align, align = _c === void 0 ? "left" : _c, _d = _a.casing, casing = _d === void 0 ? "auto" : _d, children = _a.children, _e = _a.color, color = _e === void 0 ? "auto" : _e, level = _a.level, size = _a.size, _f = _a.typeface, typeface = _f === void 0 ? "default" : _f, props = __rest(_a, ["align", "casing", "children", "color", "level", "size", "typeface"]);
|
|
720
|
-
var surface = React.useContext(Context$
|
|
728
|
+
var surface = React.useContext(Context$3).surface;
|
|
721
729
|
var Element = "span";
|
|
722
730
|
if (level) {
|
|
723
731
|
Element = "h".concat(level);
|
|
@@ -861,7 +869,7 @@ var useNumericInput = function (props) {
|
|
|
861
869
|
var Card = function (_a) {
|
|
862
870
|
var _b;
|
|
863
871
|
var actionId = _a.actionId, _c = _a.actionLabel, actionLabel = _c === void 0 ? "Read more" : _c, children = _a.children, _d = _a.fill, fill = _d === void 0 ? "solid" : _d, href = _a.href, imageAlt = _a.imageAlt, imageSrc = _a.imageSrc, imageSrcSet = _a.imageSrcSet, imageHeight = _a.imageHeight, minHeight = _a.minHeight, target = _a.target, title = _a.title, _e = _a.titleSize, titleSize = _e === void 0 ? "s" : _e, props = __rest(_a, ["actionId", "actionLabel", "children", "fill", "href", "imageAlt", "imageSrc", "imageSrcSet", "imageHeight", "minHeight", "target", "title", "titleSize"]);
|
|
864
|
-
var surface = React.useContext(Context$
|
|
872
|
+
var surface = React.useContext(Context$3).surface;
|
|
865
873
|
var interactionMode = useInteractionMode().interactionMode;
|
|
866
874
|
var Wrapper = function (_a) {
|
|
867
875
|
var children = _a.children;
|
|
@@ -920,7 +928,7 @@ Card.Image = CardImage;
|
|
|
920
928
|
*/
|
|
921
929
|
var CardLink = function (_a) {
|
|
922
930
|
var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, stretch = _a.stretch, target = _a.target;
|
|
923
|
-
var surface = React.useContext(Context$
|
|
931
|
+
var surface = React.useContext(Context$3).surface;
|
|
924
932
|
return (React__default["default"].createElement("a", { "aria-describedby": actionId, className: classNames({
|
|
925
933
|
"arc-CardLink": true,
|
|
926
934
|
"arc-CardLink--button": isButton,
|
|
@@ -932,38 +940,87 @@ var CardLink = function (_a) {
|
|
|
932
940
|
React__default["default"].createElement(Icon, { icon: "btChevronRight2px", size: 8 })))));
|
|
933
941
|
};
|
|
934
942
|
|
|
943
|
+
var defaultContext$2 = {
|
|
944
|
+
requirementStatus: null
|
|
945
|
+
};
|
|
946
|
+
var Context$2 = React.createContext(defaultContext$2);
|
|
947
|
+
var Provider$3 = Context$2.Provider;
|
|
948
|
+
/**
|
|
949
|
+
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
950
|
+
*/
|
|
951
|
+
var FormControl = function (_a) {
|
|
952
|
+
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"]);
|
|
953
|
+
var surface = React.useContext(Context$3).surface;
|
|
954
|
+
var _e = useAriaDescribedby({
|
|
955
|
+
errorMessage: errorMessage,
|
|
956
|
+
helper: helper,
|
|
957
|
+
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
958
|
+
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
959
|
+
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
960
|
+
var elementProps = {};
|
|
961
|
+
var labelProps = {};
|
|
962
|
+
if (LabelType === "label") {
|
|
963
|
+
labelProps["htmlFor"] = htmlFor;
|
|
964
|
+
if (htmlFor) {
|
|
965
|
+
labelProps["id"] = "".concat(htmlFor, "-label");
|
|
966
|
+
}
|
|
967
|
+
else if (id) {
|
|
968
|
+
labelProps["id"] = "".concat(id, "-label");
|
|
969
|
+
}
|
|
970
|
+
}
|
|
971
|
+
else {
|
|
972
|
+
elementProps["aria-describedby"] = ariaDescribedby;
|
|
973
|
+
}
|
|
974
|
+
return (React__default["default"].createElement(Provider$3, { value: { requirementStatus: requirementStatus } },
|
|
975
|
+
React__default["default"].createElement(ElementType, __assign({ className: classNames({
|
|
976
|
+
"arc-FormControl": true,
|
|
977
|
+
"arc-FormControl--smallLabel": labelSize === "s",
|
|
978
|
+
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
979
|
+
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
980
|
+
React__default["default"].createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
981
|
+
label,
|
|
982
|
+
requirementStatus === "optional" && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
983
|
+
helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
984
|
+
children,
|
|
985
|
+
errorMessage && (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError }, errorMessage)))));
|
|
986
|
+
};
|
|
987
|
+
|
|
935
988
|
/**
|
|
936
989
|
* Use `Checkbox` to allow users to select individual options.
|
|
937
990
|
*/
|
|
938
991
|
var Checkbox = React.forwardRef(function (_a, ref) {
|
|
939
|
-
var
|
|
940
|
-
var
|
|
941
|
-
var
|
|
992
|
+
var _b = _a.checked, checked = _b === void 0 ? false : _b, errorMessage = _a.errorMessage, helper = _a.helper, id = _a.id, _c = _a.isDisabled, isDisabled = _c === void 0 ? false : _c, _d = _a.isRequired, isRequired = _d === void 0 ? false : _d, label = _a.label, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, _e = _a.size, size = _e === void 0 ? "l" : _e, value = _a.value, props = __rest(_a, ["checked", "errorMessage", "helper", "id", "isDisabled", "isRequired", "label", "name", "onBlur", "onChange", "size", "value"]);
|
|
993
|
+
var requirementStatus = React.useContext(Context$2).requirementStatus;
|
|
994
|
+
var surface = React.useContext(Context$3).surface;
|
|
995
|
+
var _f = useAriaDescribedby({
|
|
942
996
|
id: id,
|
|
943
|
-
errorMessage: errorMessage
|
|
944
|
-
|
|
945
|
-
}), ariaDescribedby = _e.ariaDescribedby, idHelper = _e.idHelper, idError = _e.idError;
|
|
997
|
+
errorMessage: errorMessage
|
|
998
|
+
}), ariaDescribedby = _f.ariaDescribedby, idError = _f.idError;
|
|
946
999
|
var idLabel = "".concat(id, "-label");
|
|
947
1000
|
var checkedProps = {};
|
|
948
1001
|
if (typeof onChange === "function") {
|
|
949
|
-
checkedProps.checked =
|
|
1002
|
+
checkedProps.checked = checked;
|
|
950
1003
|
}
|
|
951
|
-
else if (
|
|
1004
|
+
else if (checked && !onChange) {
|
|
952
1005
|
checkedProps.defaultChecked = true;
|
|
953
1006
|
}
|
|
1007
|
+
if (requirementStatus === "required") {
|
|
1008
|
+
isRequired = true;
|
|
1009
|
+
}
|
|
954
1010
|
return (React__default["default"].createElement("div", { className: classNames({
|
|
955
1011
|
"arc-Checkbox": true,
|
|
956
1012
|
"arc-Checkbox--disabled": isDisabled,
|
|
957
1013
|
"arc-Checkbox--invalid": errorMessage,
|
|
1014
|
+
"arc-Checkbox--small": size === "s",
|
|
958
1015
|
"arc-Checkbox--onDarkSurface": surface === "dark"
|
|
959
1016
|
}) },
|
|
960
1017
|
React__default["default"].createElement("label", { id: idLabel, htmlFor: id, className: "arc-Checkbox-label" },
|
|
961
|
-
React__default["default"].createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-
|
|
1018
|
+
React__default["default"].createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-invalid": errorMessage ? "true" : "false", className: "arc-Checkbox-input" }, checkedProps, { disabled: isDisabled, id: id, name: name, onBlur: onBlur, onChange: onChange, ref: ref, required: isRequired, type: "checkbox", value: value }, filterDataAttrs(props))),
|
|
962
1019
|
React__default["default"].createElement("span", { className: "arc-Checkbox-box" }),
|
|
963
1020
|
React__default["default"].createElement("span", null,
|
|
964
1021
|
label,
|
|
965
|
-
!isRequired && " (
|
|
966
|
-
|
|
1022
|
+
!isRequired && requirementStatus !== "optional" ? (React__default["default"].createElement("span", { className: "arc-Checkbox-labelOptional" }, "(optional)")) : null,
|
|
1023
|
+
helper && React__default["default"].createElement("span", { className: "arc-Checkbox-helper" }, helper))),
|
|
967
1024
|
errorMessage && (React__default["default"].createElement("div", { id: idError, className: "arc-Checkbox-error" }, errorMessage))));
|
|
968
1025
|
});
|
|
969
1026
|
|
|
@@ -1066,7 +1123,7 @@ var Curve = function (_a) {
|
|
|
1066
1123
|
*/
|
|
1067
1124
|
var Disclosure = function (_a) {
|
|
1068
1125
|
var children = _a.children, headingLevel = _a.headingLevel, _b = _a.indentDetails, indentDetails = _b === void 0 ? false : _b, _c = _a.isOpen, isOpen = _c === void 0 ? false : _c, summary = _a.summary, props = __rest(_a, ["children", "headingLevel", "indentDetails", "isOpen", "summary"]);
|
|
1069
|
-
var surface = React.useContext(Context$
|
|
1126
|
+
var surface = React.useContext(Context$3).surface;
|
|
1070
1127
|
return (React__default["default"].createElement("details", __assign({ className: classNames({
|
|
1071
1128
|
"arc-Disclosure": true,
|
|
1072
1129
|
"arc-Disclosure--indentDetails": indentDetails,
|
|
@@ -1089,53 +1146,13 @@ var Elevation = function (_a) {
|
|
|
1089
1146
|
_b)) }, filterDataAttrs(props)), children));
|
|
1090
1147
|
};
|
|
1091
1148
|
|
|
1092
|
-
/**
|
|
1093
|
-
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
1094
|
-
*/
|
|
1095
|
-
var FormControl = function (_a) {
|
|
1096
|
-
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, _c = _a.isRequired, isRequired = _c === void 0 ? false : _c, label = _a.label, _d = _a.labelSize, labelSize = _d === void 0 ? "l" : _d, props = __rest(_a, ["children", "elementType", "errorMessage", "helper", "htmlFor", "id", "isRequired", "label", "labelSize"]);
|
|
1097
|
-
var surface = React.useContext(Context$2).surface;
|
|
1098
|
-
var _e = useAriaDescribedby({
|
|
1099
|
-
errorMessage: errorMessage,
|
|
1100
|
-
helper: helper,
|
|
1101
|
-
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
1102
|
-
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
1103
|
-
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
1104
|
-
var elementProps = {};
|
|
1105
|
-
var labelProps = {};
|
|
1106
|
-
if (LabelType === "label") {
|
|
1107
|
-
labelProps["htmlFor"] = htmlFor;
|
|
1108
|
-
if (htmlFor) {
|
|
1109
|
-
labelProps["id"] = "".concat(htmlFor, "-label");
|
|
1110
|
-
}
|
|
1111
|
-
else if (id) {
|
|
1112
|
-
labelProps["id"] = "".concat(id, "-label");
|
|
1113
|
-
}
|
|
1114
|
-
}
|
|
1115
|
-
else {
|
|
1116
|
-
elementProps["aria-describedby"] = ariaDescribedby;
|
|
1117
|
-
}
|
|
1118
|
-
return (React__default["default"].createElement(ElementType, __assign({ className: classNames({
|
|
1119
|
-
"arc-FormControl": true,
|
|
1120
|
-
"arc-FormControl--smallLabel": labelSize === "s",
|
|
1121
|
-
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
1122
|
-
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
1123
|
-
React__default["default"].createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
1124
|
-
label,
|
|
1125
|
-
" ",
|
|
1126
|
-
!isRequired && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(Optional)"))),
|
|
1127
|
-
helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
1128
|
-
children,
|
|
1129
|
-
errorMessage && (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError }, errorMessage))));
|
|
1130
|
-
};
|
|
1131
|
-
|
|
1132
1149
|
/**
|
|
1133
1150
|
* Use `Group` to arrange flexible items in a row.
|
|
1134
1151
|
*/
|
|
1135
1152
|
var Group = function (_a) {
|
|
1136
1153
|
var _b;
|
|
1137
1154
|
var children = _a.children, _c = _a.grow, grow = _c === void 0 ? false : _c, _d = _a.growEqual, growEqual = _d === void 0 ? false : _d, _e = _a.gutterBorder, gutterBorder = _e === void 0 ? false : _e, _f = _a.noWrap, noWrap = _f === void 0 ? false : _f, props = __rest(_a, ["children", "grow", "growEqual", "gutterBorder", "noWrap"]);
|
|
1138
|
-
var surface = React.useContext(Context$
|
|
1155
|
+
var surface = React.useContext(Context$3).surface;
|
|
1139
1156
|
React.useEffect(function () {
|
|
1140
1157
|
React__default["default"].Children.map(children, function (item) {
|
|
1141
1158
|
if (item && item.type !== GroupItem) {
|
|
@@ -1170,7 +1187,7 @@ Group.Item = GroupItem;
|
|
|
1170
1187
|
*/
|
|
1171
1188
|
var Markup = function (_a) {
|
|
1172
1189
|
var children = _a.children, _b = _a.isMeasured, isMeasured = _b === void 0 ? false : _b, props = __rest(_a, ["children", "isMeasured"]);
|
|
1173
|
-
var surface = React.useContext(Context$
|
|
1190
|
+
var surface = React.useContext(Context$3).surface;
|
|
1174
1191
|
return (React__default["default"].createElement("div", __assign({ className: classNames({
|
|
1175
1192
|
"arc-Markup": true,
|
|
1176
1193
|
"arc-Markup--measured": isMeasured,
|
|
@@ -1242,9 +1259,6 @@ var RadioContext = React.createContext({});
|
|
|
1242
1259
|
var Provider$2 = RadioContext.Provider;
|
|
1243
1260
|
var useRadioContext = function () {
|
|
1244
1261
|
var context = React.useContext(RadioContext);
|
|
1245
|
-
if (!context) {
|
|
1246
|
-
console.warn("Ensure to use <RadioGroup.RadioButton /> within the <RadioGroup /> or its branded version.");
|
|
1247
|
-
}
|
|
1248
1262
|
return context;
|
|
1249
1263
|
};
|
|
1250
1264
|
|
|
@@ -1252,60 +1266,57 @@ var useRadioContext = function () {
|
|
|
1252
1266
|
* Radio Button component.
|
|
1253
1267
|
*/
|
|
1254
1268
|
var RadioButton = React.forwardRef(function (_a, ref) {
|
|
1255
|
-
var helper = _a.helper, id = _a.id, label = _a.label, value = _a.value, props = __rest(_a, ["helper", "id", "label", "value"]);
|
|
1256
|
-
var _b = useRadioContext(),
|
|
1257
|
-
var surface = React.useContext(Context$
|
|
1258
|
-
var _c = useAriaDescribedby({
|
|
1259
|
-
id: id,
|
|
1260
|
-
idError: "".concat(errorId, "-error"),
|
|
1261
|
-
helper: helper,
|
|
1262
|
-
errorMessage: errorMessage
|
|
1263
|
-
}), ariaDescribedby = _c.ariaDescribedby, idHelper = _c.idHelper;
|
|
1269
|
+
var helper = _a.helper, id = _a.id, isDisabled = _a.isDisabled, label = _a.label, value = _a.value, props = __rest(_a, ["helper", "id", "isDisabled", "label", "value"]);
|
|
1270
|
+
var _b = useRadioContext(), blurEvent = _b.blurEvent, changeEvent = _b.changeEvent, groupDisabled = _b.groupDisabled, checkedValue = _b.checkedValue, labelSize = _b.labelSize, name = _b.name, size = _b.size;
|
|
1271
|
+
var surface = React.useContext(Context$3).surface;
|
|
1264
1272
|
var idLabel = "".concat(id, "-label");
|
|
1265
|
-
var checked =
|
|
1266
|
-
var disabled = isDisabled ? isDisabled : false;
|
|
1273
|
+
var checked = checkedValue === value ? true : false;
|
|
1267
1274
|
return (React__default["default"].createElement("div", __assign({ className: classNames({
|
|
1268
1275
|
"arc-RadioButton": true,
|
|
1269
|
-
"arc-RadioButton--
|
|
1270
|
-
"arc-RadioButton--
|
|
1271
|
-
"arc-RadioButton--
|
|
1272
|
-
"arc-RadioButton--required": isRequired,
|
|
1276
|
+
"arc-RadioButton--disabled": isDisabled || groupDisabled,
|
|
1277
|
+
"arc-RadioButton--small": size === "s",
|
|
1278
|
+
"arc-RadioButton--smallLabel": labelSize === "s",
|
|
1273
1279
|
"arc-RadioButton--onDarkSurface": surface === "dark"
|
|
1274
1280
|
}) }, filterDataAttrs(props)),
|
|
1275
|
-
React__default["default"].createElement("
|
|
1276
|
-
|
|
1277
|
-
|
|
1281
|
+
React__default["default"].createElement("label", { className: "arc-RadioButton-label", htmlFor: id, id: idLabel },
|
|
1282
|
+
React__default["default"].createElement("input", { className: "arc-RadioButton-input", checked: typeof changeEvent !== "function" ? undefined : checked, defaultChecked: typeof changeEvent !== "function" ? checked : undefined, disabled: isDisabled || groupDisabled, id: id, name: name, onBlur: blurEvent, onChange: changeEvent, ref: ref, type: "radio", value: value }),
|
|
1283
|
+
React__default["default"].createElement("span", null,
|
|
1284
|
+
label,
|
|
1285
|
+
helper && React__default["default"].createElement("span", { className: "arc-RadioButton-helper" }, helper)))));
|
|
1278
1286
|
});
|
|
1279
1287
|
|
|
1280
1288
|
/**
|
|
1281
1289
|
* Use `RadioGroup` to wrap and control radio buttons and apply default values
|
|
1282
1290
|
*/
|
|
1283
1291
|
var RadioGroup = function (_a) {
|
|
1284
|
-
var children = _a.children,
|
|
1292
|
+
var children = _a.children, checkedValue = _a.checkedValue, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, id = _a.id, helper = _a.helper, label = _a.label, _c = _a.labelSize, labelSize = _c === void 0 ? "l" : _c, name = _a.name, onBlur = _a.onBlur, onChange = _a.onChange, _d = _a.size, size = _d === void 0 ? "l" : _d, props = __rest(_a, ["children", "checkedValue", "isDisabled", "id", "helper", "label", "labelSize", "name", "onBlur", "onChange", "size"]);
|
|
1293
|
+
React.useEffect(function () {
|
|
1294
|
+
React__default["default"].Children.map(children, function (item) {
|
|
1295
|
+
if (item && item.type !== RadioButton) {
|
|
1296
|
+
throw new Error("Illegal child passed to <RadioGroup />. Ensure to only use <RadioGroup.RadioButton />.");
|
|
1297
|
+
}
|
|
1298
|
+
});
|
|
1299
|
+
}, [children]);
|
|
1285
1300
|
return (React__default["default"].createElement(Provider$2, { value: {
|
|
1286
|
-
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1291
|
-
errorMessage: errorMessage,
|
|
1301
|
+
blurEvent: onBlur,
|
|
1302
|
+
changeEvent: onChange,
|
|
1303
|
+
groupDisabled: isDisabled,
|
|
1304
|
+
checkedValue: checkedValue,
|
|
1305
|
+
labelSize: labelSize,
|
|
1292
1306
|
name: name,
|
|
1293
|
-
|
|
1307
|
+
size: size
|
|
1294
1308
|
} },
|
|
1295
|
-
React__default["default"].createElement(
|
|
1296
|
-
React__default["default"].createElement("
|
|
1297
|
-
"arc-RadioGroup": true,
|
|
1298
|
-
"arc-RadioGroup--invalid": errorMessage,
|
|
1299
|
-
"arc-RadioGroup--disabled": isDisabled
|
|
1300
|
-
}) }, filterDataAttrs(props)), children))));
|
|
1309
|
+
React__default["default"].createElement("div", __assign({ className: "arc-RadioGroup" }, filterDataAttrs(props)),
|
|
1310
|
+
React__default["default"].createElement(FormControl, { elementType: "fieldset", label: label, labelSize: labelSize, helper: helper, id: id, requirementStatus: "not-applicable" }, children))));
|
|
1301
1311
|
};
|
|
1312
|
+
RadioButton.displayName = "RadioGroup.RadioButton";
|
|
1302
1313
|
RadioGroup.RadioButton = RadioButton;
|
|
1303
1314
|
|
|
1304
1315
|
/**
|
|
1305
1316
|
* Use `Rule` to display a horizontal rule.
|
|
1306
1317
|
*/
|
|
1307
1318
|
var Rule = function (props) {
|
|
1308
|
-
var surface = React.useContext(Context$
|
|
1319
|
+
var surface = React.useContext(Context$3).surface;
|
|
1309
1320
|
return (React__default["default"].createElement("hr", __assign({ className: classNames({
|
|
1310
1321
|
"arc-Rule": true,
|
|
1311
1322
|
"arc-Rule--onDarkSurface": surface === "dark"
|
|
@@ -1509,7 +1520,9 @@ var Panel = function (_a) {
|
|
|
1509
1520
|
// and the click is not on a SubNavItem-link.
|
|
1510
1521
|
// This ensures that one SubNavItem Panel per NavItem always remains open.
|
|
1511
1522
|
(subNavItemRef &&
|
|
1512
|
-
!e.target.classList.contains(subNavLink)
|
|
1523
|
+
!e.target.classList.contains(subNavLink) &&
|
|
1524
|
+
!e.target.classList.contains("".concat(subNavLink, "Title")) &&
|
|
1525
|
+
!e.target.classList.contains("".concat(subNavLink, "SubTitle"))) ||
|
|
1513
1526
|
// Panel is inside a SubNavItem
|
|
1514
1527
|
// and the click is not inside the Panel's NavItem parent.
|
|
1515
1528
|
// This prevents SubNavItem Panels in sibling NavItems from being closed.
|
|
@@ -1637,12 +1650,31 @@ var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void
|
|
|
1637
1650
|
});
|
|
1638
1651
|
}); });
|
|
1639
1652
|
|
|
1653
|
+
/**
|
|
1654
|
+
* Use `Text` to display text.
|
|
1655
|
+
*/
|
|
1656
|
+
var Text = function (_a) {
|
|
1657
|
+
var _b;
|
|
1658
|
+
var _c = _a.align, align = _c === void 0 ? "left" : _c, children = _a.children, _d = _a.isInline, isInline = _d === void 0 ? false : _d, _e = _a.isMeasured, isMeasured = _e === void 0 ? false : _e, _f = _a.size, size = _f === void 0 ? "m" : _f, _g = _a.tone, tone = _g === void 0 ? "default" : _g, props = __rest(_a, ["align", "children", "isInline", "isMeasured", "size", "tone"]);
|
|
1659
|
+
var surface = React.useContext(Context$3).surface;
|
|
1660
|
+
return (React__default["default"].createElement("span", __assign({ className: classNames((_b = {
|
|
1661
|
+
"arc-Text": true
|
|
1662
|
+
},
|
|
1663
|
+
_b[suffixModifier("arc-Text--align", align)] = align !== "left",
|
|
1664
|
+
_b["arc-Text--inline"] = isInline,
|
|
1665
|
+
_b["arc-Text--measured"] = isMeasured,
|
|
1666
|
+
_b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1667
|
+
_b["arc-Text--".concat(tone)] = tone !== "default",
|
|
1668
|
+
_b["arc-Text--onDarkSurface"] = surface === "dark",
|
|
1669
|
+
_b)) }, filterDataAttrs(props)), children));
|
|
1670
|
+
};
|
|
1671
|
+
|
|
1640
1672
|
var SubNavItem = function (_a) {
|
|
1641
1673
|
var _b, _c;
|
|
1642
|
-
var children = _a.children, _d = _a.isDefaultItem, isDefaultItem = _d === void 0 ? false : _d, href = _a.href, promo = _a.promo, title = _a.title, props = __rest(_a, ["children", "isDefaultItem", "href", "promo", "title"]);
|
|
1643
|
-
var
|
|
1674
|
+
var children = _a.children, _d = _a.isDefaultItem, isDefaultItem = _d === void 0 ? false : _d, href = _a.href, offsetXL = _a.offsetXL, promo = _a.promo, subTitle = _a.subTitle, title = _a.title, viewAllTitle = _a.viewAllTitle, props = __rest(_a, ["children", "isDefaultItem", "href", "offsetXL", "promo", "subTitle", "title", "viewAllTitle"]);
|
|
1675
|
+
var navItem = React.useContext(Context$1).navItem;
|
|
1644
1676
|
var subNavItem = React.useRef();
|
|
1645
|
-
var
|
|
1677
|
+
var _e = React.useState(false), panelOpen = _e[0], setPanelOpen = _e[1];
|
|
1646
1678
|
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
1647
1679
|
React.useEffect(function () {
|
|
1648
1680
|
React__default["default"].Children.map(children, function (item) {
|
|
@@ -1662,52 +1694,75 @@ var SubNavItem = function (_a) {
|
|
|
1662
1694
|
setPanelOpen(false);
|
|
1663
1695
|
}
|
|
1664
1696
|
}, [isDefaultItem, isMinWidthArcBreakpointL]);
|
|
1697
|
+
var linkTitle = (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1698
|
+
React__default["default"].createElement("span", { className: "arc-SiteHeaderSubNavItem-linkTitle" }, title),
|
|
1699
|
+
subTitle ? (React__default["default"].createElement("span", { className: "arc-SiteHeaderSubNavItem-linkSubTitle" }, subTitle)) : null));
|
|
1665
1700
|
return (React__default["default"].createElement("li", __assign({ className: classNames((_b = {},
|
|
1666
1701
|
_b["arc-SiteHeaderSubNavItem"] = true,
|
|
1667
1702
|
_b["arc-SiteHeaderSubNavItem--linkSelected"] = children && panelOpen,
|
|
1668
|
-
_b
|
|
1703
|
+
_b[suffixModifier("arc-SiteHeaderSubNavItem--offsetXL", offsetXL || "")] = offsetXL,
|
|
1704
|
+
_b)), ref: subNavItem }, filterDataAttrs(props), { "data-default-item": isDefaultItem || null }), !children ? (href ? (React__default["default"].createElement("a", { className: "arc-SiteHeaderSubNavItem-link", href: href }, linkTitle)) : null) : (React__default["default"].createElement(React__default["default"].Fragment, null,
|
|
1669
1705
|
React__default["default"].createElement("button", { "aria-expanded": panelOpen, className: classNames((_c = {},
|
|
1670
1706
|
_c["arc-SiteHeaderSubNavItem-link"] = true,
|
|
1671
1707
|
_c["arc-SiteHeaderSubNavItem-link--itemHasChildren"] = children,
|
|
1672
1708
|
_c)), onClick: function () {
|
|
1673
1709
|
setPanelOpen(true);
|
|
1674
|
-
} },
|
|
1675
|
-
React__default["default"].createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, subNavItemRef: subNavItem, subNavLink: "arc-SiteHeaderSubNavItem-link", promo: promo, title: React__default["default"].createElement(
|
|
1676
|
-
|
|
1677
|
-
React__default["default"].createElement("
|
|
1710
|
+
} }, linkTitle),
|
|
1711
|
+
React__default["default"].createElement(Panel, { navItemRef: navItem, open: panelOpen, setOpen: setPanelOpen, subNavItemRef: subNavItem, subNavLink: "arc-SiteHeaderSubNavItem-link", promo: promo, title: React__default["default"].createElement("span", null,
|
|
1712
|
+
title,
|
|
1713
|
+
subTitle && (React__default["default"].createElement(Text, { size: "xs", tone: "supporting" }, subTitle))), viewAll: href ? (React__default["default"].createElement(Panel.ViewAll, { href: href, title: viewAllTitle || "View all ".concat(title.toLowerCase()) })) : (undefined) }, children)))));
|
|
1678
1714
|
};
|
|
1679
1715
|
|
|
1680
1716
|
var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1681
|
-
var children, promo, link, href, title, props;
|
|
1682
|
-
|
|
1683
|
-
|
|
1717
|
+
var children, promo, link, linkTitle, viewAll, href, title, offsetXL, props;
|
|
1718
|
+
var _a;
|
|
1719
|
+
return __generator(this, function (_b) {
|
|
1720
|
+
switch (_b.label) {
|
|
1684
1721
|
case 0:
|
|
1685
1722
|
children = el.querySelector(".arc-SiteHeaderPanel-items");
|
|
1686
1723
|
promo = el.querySelector(".arc-SiteHeaderPanel-promo");
|
|
1687
1724
|
if (!children) return [3 /*break*/, 2];
|
|
1688
1725
|
return [4 /*yield*/, hydrate(children)];
|
|
1689
1726
|
case 1:
|
|
1690
|
-
children =
|
|
1691
|
-
|
|
1727
|
+
children = _b.sent();
|
|
1728
|
+
_b.label = 2;
|
|
1692
1729
|
case 2:
|
|
1693
1730
|
if (!promo) return [3 /*break*/, 4];
|
|
1694
1731
|
return [4 /*yield*/, hydrate(promo)];
|
|
1695
1732
|
case 3:
|
|
1696
|
-
promo =
|
|
1697
|
-
|
|
1733
|
+
promo = _b.sent();
|
|
1734
|
+
_b.label = 4;
|
|
1698
1735
|
case 4:
|
|
1699
1736
|
link = el.querySelector(".arc-SiteHeaderSubNavItem-link");
|
|
1737
|
+
linkTitle = el.querySelector(".arc-SiteHeaderSubNavItem-linkTitle");
|
|
1738
|
+
viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
|
|
1700
1739
|
href = "";
|
|
1701
1740
|
title = "";
|
|
1702
1741
|
if (link) {
|
|
1703
1742
|
href = link.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1704
|
-
|
|
1743
|
+
}
|
|
1744
|
+
if (linkTitle) {
|
|
1745
|
+
title = linkTitle.textContent || /* istanbul ignore next */ "";
|
|
1746
|
+
}
|
|
1747
|
+
if (viewAll) {
|
|
1748
|
+
href = viewAll.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1749
|
+
}
|
|
1750
|
+
offsetXL = undefined;
|
|
1751
|
+
if (el.classList.contains("arc-SiteHeaderSubNavItem--offsetXL24")) {
|
|
1752
|
+
offsetXL = "24";
|
|
1753
|
+
}
|
|
1754
|
+
if (el.classList.contains("arc-SiteHeaderSubNavItem--offsetXL48")) {
|
|
1755
|
+
offsetXL = "48";
|
|
1705
1756
|
}
|
|
1706
1757
|
props = {
|
|
1707
1758
|
href: href,
|
|
1708
1759
|
isDefaultItem: Boolean(el.dataset.defaultItem),
|
|
1760
|
+
offsetXL: offsetXL,
|
|
1709
1761
|
promo: promo || undefined,
|
|
1710
|
-
|
|
1762
|
+
subTitle: ((_a = el.querySelector(".arc-SiteHeaderSubNavItem-linkSubTitle")) === null || _a === void 0 ? void 0 : _a.textContent) ||
|
|
1763
|
+
undefined,
|
|
1764
|
+
title: title,
|
|
1765
|
+
viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
|
|
1711
1766
|
};
|
|
1712
1767
|
return [2 /*return*/, React__default["default"].createElement(SubNavItem, __assign({}, props), children)];
|
|
1713
1768
|
}
|
|
@@ -1774,7 +1829,7 @@ function wrap(el, wrapper) {
|
|
|
1774
1829
|
wrapper.appendChild(el);
|
|
1775
1830
|
}
|
|
1776
1831
|
var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1777
|
-
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, title, props;
|
|
1832
|
+
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAllNodes, viewAll, title, props;
|
|
1778
1833
|
return __generator(this, function (_a) {
|
|
1779
1834
|
switch (_a.label) {
|
|
1780
1835
|
case 0:
|
|
@@ -1804,7 +1859,8 @@ var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(voi
|
|
|
1804
1859
|
case 4:
|
|
1805
1860
|
link = el.querySelector(".arc-SiteHeaderNavItem-link");
|
|
1806
1861
|
subTitle = el.querySelector(".arc-SiteHeaderPanel-title");
|
|
1807
|
-
|
|
1862
|
+
viewAllNodes = el.querySelectorAll(".arc-SiteHeaderPanel-viewAll");
|
|
1863
|
+
viewAll = viewAllNodes[viewAllNodes.length - 1];
|
|
1808
1864
|
title = "";
|
|
1809
1865
|
if (link) {
|
|
1810
1866
|
title = link.textContent || /* istanbul ignore next */ "";
|
|
@@ -1971,31 +2027,12 @@ SiteHeaderRehydrator.NavItemRehydrator = NavItemRehydrator;
|
|
|
1971
2027
|
SiteHeaderRehydrator.NavItemWithSubNavRehydrator = NavItemWithSubNavRehydrator;
|
|
1972
2028
|
SiteHeaderRehydrator.SubNavItemRehydrator = SubNavItemRehydrator;
|
|
1973
2029
|
|
|
1974
|
-
/**
|
|
1975
|
-
* Use `Text` to display text.
|
|
1976
|
-
*/
|
|
1977
|
-
var Text = function (_a) {
|
|
1978
|
-
var _b;
|
|
1979
|
-
var _c = _a.align, align = _c === void 0 ? "left" : _c, children = _a.children, _d = _a.isInline, isInline = _d === void 0 ? false : _d, _e = _a.isMeasured, isMeasured = _e === void 0 ? false : _e, _f = _a.size, size = _f === void 0 ? "m" : _f, _g = _a.tone, tone = _g === void 0 ? "default" : _g, props = __rest(_a, ["align", "children", "isInline", "isMeasured", "size", "tone"]);
|
|
1980
|
-
var surface = React.useContext(Context$2).surface;
|
|
1981
|
-
return (React__default["default"].createElement("span", __assign({ className: classNames((_b = {
|
|
1982
|
-
"arc-Text": true
|
|
1983
|
-
},
|
|
1984
|
-
_b[suffixModifier("arc-Text--align", align)] = align !== "left",
|
|
1985
|
-
_b["arc-Text--inline"] = isInline,
|
|
1986
|
-
_b["arc-Text--measured"] = isMeasured,
|
|
1987
|
-
_b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1988
|
-
_b["arc-Text--".concat(tone)] = tone !== "default",
|
|
1989
|
-
_b["arc-Text--onDarkSurface"] = surface === "dark",
|
|
1990
|
-
_b)) }, filterDataAttrs(props)), children));
|
|
1991
|
-
};
|
|
1992
|
-
|
|
1993
2030
|
/**
|
|
1994
2031
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
1995
2032
|
*/
|
|
1996
2033
|
var TextInput = React.forwardRef(function (_a, ref) {
|
|
1997
|
-
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, 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", "onChange", "pattern", "type", "value"]);
|
|
1998
|
-
var surface = React.useContext(Context$
|
|
2034
|
+
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"]);
|
|
2035
|
+
var surface = React.useContext(Context$3).surface;
|
|
1999
2036
|
var inferredInputProps = useNumericInput({ inputMode: inputMode, pattern: pattern, type: type });
|
|
2000
2037
|
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
2001
2038
|
var ariaDescribedby = useAriaDescribedby({
|
|
@@ -2008,8 +2045,8 @@ var TextInput = React.forwardRef(function (_a, ref) {
|
|
|
2008
2045
|
"arc-TextInput--invalid": errorMessage,
|
|
2009
2046
|
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
2010
2047
|
}) }, filterDataAttrs(props)),
|
|
2011
|
-
React__default["default"].createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id,
|
|
2012
|
-
React__default["default"].createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-invalid": errorMessage ? "true" : "false",
|
|
2048
|
+
React__default["default"].createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional" },
|
|
2049
|
+
React__default["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)))));
|
|
2013
2050
|
});
|
|
2014
2051
|
|
|
2015
2052
|
/**
|
|
@@ -2053,7 +2090,7 @@ exports.SiteFooterRehydrator = SiteFooter_rehydrator;
|
|
|
2053
2090
|
exports.SiteHeader = SiteHeader;
|
|
2054
2091
|
exports.SiteHeaderRehydrator = SiteHeaderRehydrator;
|
|
2055
2092
|
exports.Surface = Surface;
|
|
2056
|
-
exports.SurfaceContext = Context$
|
|
2093
|
+
exports.SurfaceContext = Context$3;
|
|
2057
2094
|
exports.Text = Text;
|
|
2058
2095
|
exports.TextInput = TextInput;
|
|
2059
2096
|
exports.UniversalHeader = UniversalHeader;
|