@arc-ui/components 3.0.0 → 5.0.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 +251 -187
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +251 -187
- package/dist/index.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/Base/Base.d.ts +1 -1
- package/dist/types/components/BrandLogo/BrandLogo.d.ts +5 -0
- package/dist/types/components/Button/Button.d.ts +4 -0
- package/dist/types/components/Card/Card.d.ts +2 -2
- package/dist/types/components/Checkbox/Checkbox.d.ts +15 -6
- package/dist/types/components/FormControl/FormControl.d.ts +8 -2
- package/dist/types/components/FormControl/index.d.ts +1 -1
- package/dist/types/components/Icon/Icon.d.ts +0 -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 +4 -5
- package/dist/types/components/SiteHeader/SiteHeader.d.ts +5 -0
- package/dist/types/components/SiteHeader/components/ItemGroup/ItemGroup.d.ts +10 -0
- package/dist/types/components/TextInput/TextInput.d.ts +15 -9
- package/package.json +8 -5
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
|
},
|
|
@@ -363,15 +363,17 @@ __spreadArray([], backgroundsShared, true);
|
|
|
363
363
|
* Use `BrandLogo` to display the brand logo.
|
|
364
364
|
*/
|
|
365
365
|
var BrandLogo = function (_a) {
|
|
366
|
-
var _b
|
|
367
|
-
var
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
366
|
+
var _b;
|
|
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$3).surface;
|
|
369
|
+
return (React__default["default"].createElement("div", __assign({ className: classNames((_b = {
|
|
370
|
+
"arc-BrandLogo": true,
|
|
371
|
+
"arc-BrandLogo--colorBrand": color === "brand",
|
|
372
|
+
"arc-BrandLogo--onDarkSurface": surface === "dark"
|
|
373
|
+
},
|
|
374
|
+
_b[suffixModifier("arc-BrandLogo--subBrand", subBrand || "")] = subBrand,
|
|
375
|
+
_b)), style: {
|
|
376
|
+
width: size !== 34 ? size : undefined
|
|
375
377
|
} }, filterDataAttrs(props)), label ? React__default["default"].createElement("span", { className: "arc-BrandLogo-text" }, label) : null));
|
|
376
378
|
};
|
|
377
379
|
|
|
@@ -398,6 +400,8 @@ const iconsSelected = [
|
|
|
398
400
|
"btArrowLeftRightFill",
|
|
399
401
|
"btArrowRightFill",
|
|
400
402
|
"btArrowUpFill",
|
|
403
|
+
"btAttachmentAltFill",
|
|
404
|
+
"btAttachmentFill",
|
|
401
405
|
"btBagFill",
|
|
402
406
|
"btBasketFill",
|
|
403
407
|
"btBinFill",
|
|
@@ -418,6 +422,8 @@ const iconsSelected = [
|
|
|
418
422
|
"btChatFill",
|
|
419
423
|
"btChatMessageFill",
|
|
420
424
|
"btChatTypingFill",
|
|
425
|
+
"btClipboardFill",
|
|
426
|
+
"btClipboardTickFill",
|
|
421
427
|
"btClockFill",
|
|
422
428
|
"btCloudAlertFill",
|
|
423
429
|
"btCloudDesktopFill",
|
|
@@ -470,6 +476,7 @@ const iconsSelected = [
|
|
|
470
476
|
"btFaceVeryHappyFill",
|
|
471
477
|
"btFolderFill",
|
|
472
478
|
"btGamingFill",
|
|
479
|
+
"btGenderFemaleAndMaleFill",
|
|
473
480
|
"btGenderFemaleFill",
|
|
474
481
|
"btGenderMaleFill",
|
|
475
482
|
"btGenderNeutralFill",
|
|
@@ -477,6 +484,7 @@ const iconsSelected = [
|
|
|
477
484
|
"btGlobalConnectivityFill",
|
|
478
485
|
"btGlobeFill",
|
|
479
486
|
"btGlossaryFill",
|
|
487
|
+
"btGraphBarAndPlotFill",
|
|
480
488
|
"btGraphBarChartFill",
|
|
481
489
|
"btGraphDownFill",
|
|
482
490
|
"btGraphUpAndDownFill",
|
|
@@ -501,6 +509,7 @@ const iconsSelected = [
|
|
|
501
509
|
"btLanFill",
|
|
502
510
|
"btLaptopAndMobileFill",
|
|
503
511
|
"btLaptopConnectAndShareFill",
|
|
512
|
+
"btLaptopDetectionFill",
|
|
504
513
|
"btLaptopFill",
|
|
505
514
|
"btLaptopSecureFill",
|
|
506
515
|
"btLaptopVideoConferenceFill",
|
|
@@ -528,6 +537,7 @@ const iconsSelected = [
|
|
|
528
537
|
"btMoneyFill",
|
|
529
538
|
"btMonitorFill",
|
|
530
539
|
"btMonitorTickFill",
|
|
540
|
+
"btMoonFill",
|
|
531
541
|
"btMouseFill",
|
|
532
542
|
"btNamingFill",
|
|
533
543
|
"btNewWindowFill",
|
|
@@ -536,12 +546,16 @@ const iconsSelected = [
|
|
|
536
546
|
"btNoSpeechFill",
|
|
537
547
|
"btNoViewFill",
|
|
538
548
|
"btNotificationFill",
|
|
549
|
+
"btPasswordFIll",
|
|
539
550
|
"btPaymentMethodFill",
|
|
540
551
|
"btPayphoneFill",
|
|
541
552
|
"btPhoneBarredFill",
|
|
542
553
|
"btPhoneFill",
|
|
543
554
|
"btPictureFill",
|
|
555
|
+
"btPinAltFill",
|
|
556
|
+
"btPinFill",
|
|
544
557
|
"btPlaneFill",
|
|
558
|
+
"btPlanningFill",
|
|
545
559
|
"btPlantFill",
|
|
546
560
|
"btPlayFill",
|
|
547
561
|
"btPodcastFill",
|
|
@@ -555,15 +569,18 @@ const iconsSelected = [
|
|
|
555
569
|
"btRecyclingFill",
|
|
556
570
|
"btRefreshFill",
|
|
557
571
|
"btRefundFill",
|
|
572
|
+
"btReleaseFill",
|
|
558
573
|
"btResolution4KFill",
|
|
559
574
|
"btResolutionHdFill",
|
|
560
575
|
"btResolutionSdFill",
|
|
561
576
|
"btScaleFill",
|
|
562
577
|
"btSearchFill",
|
|
563
578
|
"btServerFill",
|
|
579
|
+
"btSettingsAltFill",
|
|
564
580
|
"btSettingsFill",
|
|
565
581
|
"btShieldAddFill",
|
|
566
582
|
"btShieldFill",
|
|
583
|
+
"btShieldQuestionMarkFIll",
|
|
567
584
|
"btShieldSecurityFill",
|
|
568
585
|
"btShieldTickFill",
|
|
569
586
|
"btShipFill",
|
|
@@ -592,6 +609,7 @@ const iconsSelected = [
|
|
|
592
609
|
"btTvAndHubAndPhoneFill",
|
|
593
610
|
"btTabletFill",
|
|
594
611
|
"btTabletWithKeyboardFill",
|
|
612
|
+
"btTagFill",
|
|
595
613
|
"btTaxonomyFill",
|
|
596
614
|
"btTechBarFill",
|
|
597
615
|
"btThumbsDownFill",
|
|
@@ -625,13 +643,13 @@ const iconsSelected = [
|
|
|
625
643
|
var Icon = function (_a) {
|
|
626
644
|
var _b;
|
|
627
645
|
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"]);
|
|
628
|
-
var surface = React.useContext(Context$
|
|
646
|
+
var surface = React.useContext(Context$3).surface;
|
|
629
647
|
return (React__default["default"].createElement("span", __assign({ "aria-label": label, className: classNames((_b = {},
|
|
630
648
|
_b["arc-Icon"] = true,
|
|
631
|
-
_b[suffixModifier("arc-Icon--color", color
|
|
649
|
+
_b[suffixModifier("arc-Icon--color", color)] = color !== "auto",
|
|
632
650
|
_b["arc-Icon--".concat(icon).concat(isSelected && iconsSelected.includes("".concat(icon, "Fill")) ? "Fill" : "")] = icon,
|
|
633
651
|
_b["arc-Icon--inline"] = isInline,
|
|
634
|
-
_b["arc-Icon--
|
|
652
|
+
_b["arc-Icon--onDarkSurface"] = surface === "dark",
|
|
635
653
|
_b)), role: label ? "img" : undefined, style: {
|
|
636
654
|
height: size,
|
|
637
655
|
width: size
|
|
@@ -643,31 +661,34 @@ var Icon = function (_a) {
|
|
|
643
661
|
*/
|
|
644
662
|
var Button = React.forwardRef(function (_a, ref) {
|
|
645
663
|
var _b;
|
|
646
|
-
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"]);
|
|
647
|
-
var surface = React.useContext(Context$
|
|
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, 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"]);
|
|
665
|
+
var surface = React.useContext(Context$3).surface;
|
|
648
666
|
var buttonClasses = classNames((_b = {
|
|
649
667
|
"arc-Button": true,
|
|
650
|
-
"arc-Button--displayBlock": isDisplayBlock
|
|
651
|
-
"arc-Button--fillFlat": fill === "flat",
|
|
652
|
-
"arc-Button--fillOutlined": fill === "outlined",
|
|
653
|
-
"arc-Button--fullWidth": isFullWidth
|
|
668
|
+
"arc-Button--displayBlock": isDisplayBlock
|
|
654
669
|
},
|
|
670
|
+
_b[suffixModifier("arc-Button--fill", fill)] = fill !== "solid",
|
|
671
|
+
_b["arc-Button--fullWidth"] = isFullWidth,
|
|
655
672
|
_b[suffixModifier("arc-Button--icon", iconPosition.replace("icon", ""))] = (icon || fill === "flat") &&
|
|
656
673
|
iconPosition &&
|
|
657
674
|
iconPosition !== "afterText",
|
|
675
|
+
_b["arc-Button--hasSupportingText"] = supportingText,
|
|
658
676
|
_b["arc-Button--onDarkSurface"] = surface === "dark",
|
|
659
677
|
_b));
|
|
660
678
|
var commonProps = __assign({ id: id, onClick: onClick, ref: ref }, filterDataAttrs(props));
|
|
679
|
+
var buttonText = supportingText ? (React__default["default"].createElement("span", null,
|
|
680
|
+
React__default["default"].createElement("span", { className: "arc-Button-text" }, label),
|
|
681
|
+
React__default["default"].createElement("span", { className: "arc-Button-supportingText" }, supportingText))) : (React__default["default"].createElement("span", { className: "arc-Button-text" }, label));
|
|
661
682
|
var buttonIcon = icon || fill === "flat" ? (React__default["default"].createElement(ButtonIcon, { icon: icon, isChevron: !icon && fill === "flat", isBeforeText: iconPosition === "beforeText" })) : null;
|
|
662
683
|
if (href && !isDisabled) {
|
|
663
684
|
return (React__default["default"].createElement("a", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, href: href, rel: rel, target: target }),
|
|
664
685
|
React__default["default"].createElement("span", { className: "arc-Button-inner" },
|
|
665
|
-
|
|
686
|
+
buttonText,
|
|
666
687
|
buttonIcon)));
|
|
667
688
|
}
|
|
668
689
|
return (React__default["default"].createElement("button", __assign({}, commonProps, { "aria-label": ariaLabel, className: buttonClasses, disabled: isDisabled, type: type }),
|
|
669
690
|
React__default["default"].createElement("span", { className: "arc-Button-inner" },
|
|
670
|
-
|
|
691
|
+
buttonText,
|
|
671
692
|
buttonIcon)));
|
|
672
693
|
});
|
|
673
694
|
var ButtonIcon = function (_a) {
|
|
@@ -700,7 +721,7 @@ var Image = function (_a) {
|
|
|
700
721
|
var Heading = function (_a) {
|
|
701
722
|
var _b;
|
|
702
723
|
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"]);
|
|
703
|
-
var surface = React.useContext(Context$
|
|
724
|
+
var surface = React.useContext(Context$3).surface;
|
|
704
725
|
var Element = "span";
|
|
705
726
|
if (level) {
|
|
706
727
|
Element = "h".concat(level);
|
|
@@ -708,7 +729,7 @@ var Heading = function (_a) {
|
|
|
708
729
|
return (React__default["default"].createElement(Element, __assign({ className: classNames((_b = {
|
|
709
730
|
"arc-Heading": true
|
|
710
731
|
},
|
|
711
|
-
_b[suffixModifier("arc-Heading--align", align
|
|
732
|
+
_b[suffixModifier("arc-Heading--align", align)] = align && align !== "left",
|
|
712
733
|
_b["arc-Heading--size".concat(size && size.toUpperCase())] = size,
|
|
713
734
|
_b["arc-Heading--casingNone"] = casing === "none",
|
|
714
735
|
_b["arc-Heading--colorBrand"] = color === "brand",
|
|
@@ -838,25 +859,24 @@ var useNumericInput = function (props) {
|
|
|
838
859
|
return { inputMode: inputMode, pattern: pattern, type: type };
|
|
839
860
|
};
|
|
840
861
|
|
|
841
|
-
var defaultActionLabel = "Read more";
|
|
842
862
|
/**
|
|
843
863
|
* Use `Card` to contain content and actions about a single subject.
|
|
844
864
|
*/
|
|
845
865
|
var Card = function (_a) {
|
|
846
866
|
var _b;
|
|
847
|
-
var actionId = _a.actionId, _c = _a.actionLabel, actionLabel = _c === void 0 ?
|
|
848
|
-
var surface = React.useContext(Context$
|
|
867
|
+
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"]);
|
|
868
|
+
var surface = React.useContext(Context$3).surface;
|
|
849
869
|
var interactionMode = useInteractionMode().interactionMode;
|
|
850
870
|
var Wrapper = function (_a) {
|
|
851
871
|
var children = _a.children;
|
|
852
|
-
return fill === "outlined" ? (React__default["default"].createElement("div", null, children)) : (React__default["default"].createElement(Surface, { background: surface === "dark" ? "white" : "darker" }, children));
|
|
872
|
+
return fill === "outlined" || fill === "neutral" ? (React__default["default"].createElement("div", null, children)) : (React__default["default"].createElement(Surface, { background: surface === "dark" ? "white" : "darker" }, children));
|
|
853
873
|
};
|
|
854
874
|
var coverImage = imageSrc && (React__default["default"].createElement(CardImage, { alt: imageAlt, src: imageSrc, srcSet: imageSrcSet, height: imageHeight }));
|
|
855
875
|
return (React__default["default"].createElement("div", __assign({ className: classNames((_b = {
|
|
856
876
|
"arc-Card": true,
|
|
857
|
-
"arc-Card--onDarkSurface": surface === "dark"
|
|
858
|
-
"arc-Card--fillOutlined": fill === "outlined"
|
|
877
|
+
"arc-Card--onDarkSurface": surface === "dark"
|
|
859
878
|
},
|
|
879
|
+
_b[suffixModifier("arc-Card--fill", fill)] = fill !== "solid",
|
|
860
880
|
_b["arc-is-".concat(interactionMode, "InteractionMode")] = interactionMode,
|
|
861
881
|
_b)) }, filterDataAttrs(props)),
|
|
862
882
|
React__default["default"].createElement(Wrapper, null,
|
|
@@ -864,12 +884,12 @@ var Card = function (_a) {
|
|
|
864
884
|
React__default["default"].createElement("div", { className: "arc-Card-header" },
|
|
865
885
|
React__default["default"].createElement("div", { className: "arc-Card-title" },
|
|
866
886
|
React__default["default"].createElement(Heading, { size: titleSize },
|
|
867
|
-
React__default["default"].createElement(CardLink, { actionId: actionId, href: href, stretch: true, target: target }, title))),
|
|
887
|
+
React__default["default"].createElement(CardLink, { actionId: actionId, fill: fill, href: href, stretch: true, target: target }, title))),
|
|
868
888
|
coverImage),
|
|
869
889
|
React__default["default"].createElement("div", { className: "arc-Card-children" },
|
|
870
890
|
React__default["default"].createElement(Card.Block, null, children)),
|
|
871
891
|
href && (React__default["default"].createElement(CardBlock, null,
|
|
872
|
-
React__default["default"].createElement(CardLink, { href: href, actionId: actionId, isButton: true }, actionLabel
|
|
892
|
+
React__default["default"].createElement(CardLink, { href: href, fill: fill, actionId: actionId, isButton: true }, actionLabel)))))));
|
|
873
893
|
};
|
|
874
894
|
/**
|
|
875
895
|
* Internal `Card.Block` component to section blocks of content within a Card.
|
|
@@ -903,12 +923,12 @@ Card.Image = CardImage;
|
|
|
903
923
|
* Internal `CardLink` component.
|
|
904
924
|
*/
|
|
905
925
|
var CardLink = function (_a) {
|
|
906
|
-
var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, href = _a.href, stretch = _a.stretch, target = _a.target;
|
|
907
|
-
var surface = React.useContext(Context$
|
|
926
|
+
var actionId = _a.actionId, isButton = _a.isButton, children = _a.children, fill = _a.fill, href = _a.href, stretch = _a.stretch, target = _a.target;
|
|
927
|
+
var surface = React.useContext(Context$3).surface;
|
|
908
928
|
return (React__default["default"].createElement("a", { "aria-describedby": actionId, className: classNames({
|
|
909
929
|
"arc-CardLink": true,
|
|
910
930
|
"arc-CardLink--button": isButton,
|
|
911
|
-
"arc-CardLink--onDarkSurface": surface === "dark",
|
|
931
|
+
"arc-CardLink--onDarkSurface": surface === "dark" && fill !== "neutral",
|
|
912
932
|
"arc-CardLink--stretch": stretch
|
|
913
933
|
}), href: href, rel: target === "_blank" ? "noopener noreferrer" : undefined, tabIndex: isButton ? -1 : undefined, target: target },
|
|
914
934
|
React__default["default"].createElement("span", { className: "arc-CardLink-text" }, children),
|
|
@@ -916,38 +936,89 @@ var CardLink = function (_a) {
|
|
|
916
936
|
React__default["default"].createElement(Icon, { icon: "btChevronRight2px", size: 8 })))));
|
|
917
937
|
};
|
|
918
938
|
|
|
939
|
+
var defaultContext$2 = {
|
|
940
|
+
requirementStatus: null
|
|
941
|
+
};
|
|
942
|
+
var Context$2 = React.createContext(defaultContext$2);
|
|
943
|
+
var Provider$3 = Context$2.Provider;
|
|
944
|
+
/**
|
|
945
|
+
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
946
|
+
*/
|
|
947
|
+
var FormControl = function (_a) {
|
|
948
|
+
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"]);
|
|
949
|
+
var surface = React.useContext(Context$3).surface;
|
|
950
|
+
var _e = useAriaDescribedby({
|
|
951
|
+
errorMessage: errorMessage,
|
|
952
|
+
helper: helper,
|
|
953
|
+
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
954
|
+
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
955
|
+
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
956
|
+
var elementProps = {};
|
|
957
|
+
var labelProps = {};
|
|
958
|
+
if (LabelType === "label") {
|
|
959
|
+
labelProps["htmlFor"] = htmlFor;
|
|
960
|
+
if (htmlFor) {
|
|
961
|
+
labelProps["id"] = "".concat(htmlFor, "-label");
|
|
962
|
+
}
|
|
963
|
+
else if (id) {
|
|
964
|
+
labelProps["id"] = "".concat(id, "-label");
|
|
965
|
+
}
|
|
966
|
+
}
|
|
967
|
+
else {
|
|
968
|
+
elementProps["aria-describedby"] = ariaDescribedby;
|
|
969
|
+
}
|
|
970
|
+
return (React__default["default"].createElement(Provider$3, { value: { requirementStatus: requirementStatus } },
|
|
971
|
+
React__default["default"].createElement(ElementType, __assign({ className: classNames({
|
|
972
|
+
"arc-FormControl": true,
|
|
973
|
+
"arc-FormControl--smallLabel": labelSize === "s",
|
|
974
|
+
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
975
|
+
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
976
|
+
React__default["default"].createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
977
|
+
label,
|
|
978
|
+
" ",
|
|
979
|
+
requirementStatus === "optional" && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(optional)"))),
|
|
980
|
+
helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
981
|
+
children,
|
|
982
|
+
errorMessage && (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError }, errorMessage)))));
|
|
983
|
+
};
|
|
984
|
+
|
|
919
985
|
/**
|
|
920
986
|
* Use `Checkbox` to allow users to select individual options.
|
|
921
987
|
*/
|
|
922
988
|
var Checkbox = React.forwardRef(function (_a, ref) {
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
var
|
|
989
|
+
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"]);
|
|
990
|
+
var requirementStatus = React.useContext(Context$2).requirementStatus;
|
|
991
|
+
var surface = React.useContext(Context$3).surface;
|
|
992
|
+
var _f = useAriaDescribedby({
|
|
926
993
|
id: id,
|
|
927
|
-
errorMessage: errorMessage
|
|
928
|
-
|
|
929
|
-
}), ariaDescribedby = _e.ariaDescribedby, idHelper = _e.idHelper, idError = _e.idError;
|
|
994
|
+
errorMessage: errorMessage
|
|
995
|
+
}), ariaDescribedby = _f.ariaDescribedby, idError = _f.idError;
|
|
930
996
|
var idLabel = "".concat(id, "-label");
|
|
931
997
|
var checkedProps = {};
|
|
932
998
|
if (typeof onChange === "function") {
|
|
933
|
-
checkedProps.checked =
|
|
999
|
+
checkedProps.checked = checked;
|
|
934
1000
|
}
|
|
935
|
-
else if (
|
|
1001
|
+
else if (checked && !onChange) {
|
|
936
1002
|
checkedProps.defaultChecked = true;
|
|
937
1003
|
}
|
|
1004
|
+
if (requirementStatus === "required") {
|
|
1005
|
+
isRequired = true;
|
|
1006
|
+
}
|
|
938
1007
|
return (React__default["default"].createElement("div", { className: classNames({
|
|
939
1008
|
"arc-Checkbox": true,
|
|
940
1009
|
"arc-Checkbox--disabled": isDisabled,
|
|
941
1010
|
"arc-Checkbox--invalid": errorMessage,
|
|
1011
|
+
"arc-Checkbox--small": size === "s",
|
|
942
1012
|
"arc-Checkbox--onDarkSurface": surface === "dark"
|
|
943
1013
|
}) },
|
|
944
1014
|
React__default["default"].createElement("label", { id: idLabel, htmlFor: id, className: "arc-Checkbox-label" },
|
|
945
|
-
React__default["default"].createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-
|
|
1015
|
+
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))),
|
|
946
1016
|
React__default["default"].createElement("span", { className: "arc-Checkbox-box" }),
|
|
947
1017
|
React__default["default"].createElement("span", null,
|
|
948
1018
|
label,
|
|
949
|
-
|
|
950
|
-
|
|
1019
|
+
" ",
|
|
1020
|
+
!isRequired && requirementStatus !== "optional" ? (React__default["default"].createElement("span", { className: "arc-Checkbox-labelOptional" }, "(optional)")) : null,
|
|
1021
|
+
helper && React__default["default"].createElement("span", { className: "arc-Checkbox-helper" }, helper))),
|
|
951
1022
|
errorMessage && (React__default["default"].createElement("div", { id: idError, className: "arc-Checkbox-error" }, errorMessage))));
|
|
952
1023
|
});
|
|
953
1024
|
|
|
@@ -1004,9 +1075,7 @@ var Col = function (_a) {
|
|
|
1004
1075
|
var align = _a.align, children = _a.children, _c = _a.isDebugVisible, isDebugVisible = _c === void 0 ? false : _c, offset = _a.offset, offsetS = _a.offsetS, offsetM = _a.offsetM, offsetL = _a.offsetL, offsetXL = _a.offsetXL, span = _a.span, spanS = _a.spanS, spanM = _a.spanM, spanL = _a.spanL, spanXL = _a.spanXL, props = __rest(_a, ["align", "children", "isDebugVisible", "offset", "offsetS", "offsetM", "offsetL", "offsetXL", "span", "spanS", "spanM", "spanL", "spanXL"]);
|
|
1005
1076
|
return (React__default["default"].createElement("div", __assign({ className: classNames((_b = {},
|
|
1006
1077
|
_b["arc-Col"] = true,
|
|
1007
|
-
_b["arc-Col--
|
|
1008
|
-
_b["arc-Col--alignCenter"] = align === "center",
|
|
1009
|
-
_b["arc-Col--alignTop"] = align === "top",
|
|
1078
|
+
_b[suffixModifier("arc-Col--align", align || "")] = align,
|
|
1010
1079
|
_b["arc-Col--".concat(span)] = typeof span !== "undefined",
|
|
1011
1080
|
_b["arc-Col--S".concat(spanS)] = typeof spanS !== "undefined",
|
|
1012
1081
|
_b["arc-Col--M".concat(spanM)] = typeof spanM !== "undefined",
|
|
@@ -1038,7 +1107,7 @@ var Curve = function (_a) {
|
|
|
1038
1107
|
return (React__default["default"].createElement("div", __assign({ className: classNames((_b = {
|
|
1039
1108
|
"arc-Curve": true
|
|
1040
1109
|
},
|
|
1041
|
-
_b[suffixModifier("arc-Curve--from", from
|
|
1110
|
+
_b[suffixModifier("arc-Curve--from", from)] = from && from !== "top",
|
|
1042
1111
|
_b["arc-Curve--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1043
1112
|
_b[suffixModifier("arc-Curve--bottomColor", bottomColor || "")] = bottomColor,
|
|
1044
1113
|
_b[suffixModifier("arc-Curve--topColor", topColor || "")] = topColor,
|
|
@@ -1052,7 +1121,7 @@ var Curve = function (_a) {
|
|
|
1052
1121
|
*/
|
|
1053
1122
|
var Disclosure = function (_a) {
|
|
1054
1123
|
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"]);
|
|
1055
|
-
var surface = React.useContext(Context$
|
|
1124
|
+
var surface = React.useContext(Context$3).surface;
|
|
1056
1125
|
return (React__default["default"].createElement("details", __assign({ className: classNames({
|
|
1057
1126
|
"arc-Disclosure": true,
|
|
1058
1127
|
"arc-Disclosure--indentDetails": indentDetails,
|
|
@@ -1075,53 +1144,13 @@ var Elevation = function (_a) {
|
|
|
1075
1144
|
_b)) }, filterDataAttrs(props)), children));
|
|
1076
1145
|
};
|
|
1077
1146
|
|
|
1078
|
-
/**
|
|
1079
|
-
* Use `FormControl` to provide inputs with labels, helper text and error messages
|
|
1080
|
-
*/
|
|
1081
|
-
var FormControl = function (_a) {
|
|
1082
|
-
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"]);
|
|
1083
|
-
var surface = React.useContext(Context$2).surface;
|
|
1084
|
-
var _e = useAriaDescribedby({
|
|
1085
|
-
errorMessage: errorMessage,
|
|
1086
|
-
helper: helper,
|
|
1087
|
-
id: htmlFor || id // `htmlFor` is preference to keep this deterministic with TextInput
|
|
1088
|
-
}), ariaDescribedby = _e.ariaDescribedby, idError = _e.idError, idHelper = _e.idHelper;
|
|
1089
|
-
var LabelType = ElementType === "div" ? "label" : "legend";
|
|
1090
|
-
var elementProps = {};
|
|
1091
|
-
var labelProps = {};
|
|
1092
|
-
if (LabelType === "label") {
|
|
1093
|
-
labelProps["htmlFor"] = htmlFor;
|
|
1094
|
-
if (htmlFor) {
|
|
1095
|
-
labelProps["id"] = "".concat(htmlFor, "-label");
|
|
1096
|
-
}
|
|
1097
|
-
else if (id) {
|
|
1098
|
-
labelProps["id"] = "".concat(id, "-label");
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
else {
|
|
1102
|
-
elementProps["aria-describedby"] = ariaDescribedby;
|
|
1103
|
-
}
|
|
1104
|
-
return (React__default["default"].createElement(ElementType, __assign({ className: classNames({
|
|
1105
|
-
"arc-FormControl": true,
|
|
1106
|
-
"arc-FormControl--smallLabel": labelSize === "s",
|
|
1107
|
-
"arc-FormControl--onDarkSurface": surface === "dark"
|
|
1108
|
-
}), id: id }, elementProps, filterDataAttrs(props)),
|
|
1109
|
-
React__default["default"].createElement(LabelType, __assign({ className: "arc-FormControl-label" }, labelProps),
|
|
1110
|
-
label,
|
|
1111
|
-
" ",
|
|
1112
|
-
!isRequired && (React__default["default"].createElement("span", { className: "arc-FormControl-labelOptional" }, "(Optional)"))),
|
|
1113
|
-
helper && (React__default["default"].createElement("div", { className: "arc-FormControl-helper", id: idHelper }, helper)),
|
|
1114
|
-
children,
|
|
1115
|
-
errorMessage && (React__default["default"].createElement("div", { className: "arc-FormControl-error", id: idError }, errorMessage))));
|
|
1116
|
-
};
|
|
1117
|
-
|
|
1118
1147
|
/**
|
|
1119
1148
|
* Use `Group` to arrange flexible items in a row.
|
|
1120
1149
|
*/
|
|
1121
1150
|
var Group = function (_a) {
|
|
1122
1151
|
var _b;
|
|
1123
1152
|
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"]);
|
|
1124
|
-
var surface = React.useContext(Context$
|
|
1153
|
+
var surface = React.useContext(Context$3).surface;
|
|
1125
1154
|
React.useEffect(function () {
|
|
1126
1155
|
React__default["default"].Children.map(children, function (item) {
|
|
1127
1156
|
if (item && item.type !== GroupItem) {
|
|
@@ -1156,7 +1185,7 @@ Group.Item = GroupItem;
|
|
|
1156
1185
|
*/
|
|
1157
1186
|
var Markup = function (_a) {
|
|
1158
1187
|
var children = _a.children, _b = _a.isMeasured, isMeasured = _b === void 0 ? false : _b, props = __rest(_a, ["children", "isMeasured"]);
|
|
1159
|
-
var surface = React.useContext(Context$
|
|
1188
|
+
var surface = React.useContext(Context$3).surface;
|
|
1160
1189
|
return (React__default["default"].createElement("div", __assign({ className: classNames({
|
|
1161
1190
|
"arc-Markup": true,
|
|
1162
1191
|
"arc-Markup--measured": isMeasured,
|
|
@@ -1238,60 +1267,50 @@ var useRadioContext = function () {
|
|
|
1238
1267
|
* Radio Button component.
|
|
1239
1268
|
*/
|
|
1240
1269
|
var RadioButton = React.forwardRef(function (_a, ref) {
|
|
1241
|
-
var helper = _a.helper, id = _a.id, label = _a.label, value = _a.value, props = __rest(_a, ["helper", "id", "label", "value"]);
|
|
1242
|
-
var _b = useRadioContext(),
|
|
1243
|
-
var surface = React.useContext(Context$
|
|
1244
|
-
var _c = useAriaDescribedby({
|
|
1245
|
-
id: id,
|
|
1246
|
-
idError: "".concat(errorId, "-error"),
|
|
1247
|
-
helper: helper,
|
|
1248
|
-
errorMessage: errorMessage
|
|
1249
|
-
}), ariaDescribedby = _c.ariaDescribedby, idHelper = _c.idHelper;
|
|
1270
|
+
var helper = _a.helper, id = _a.id, isDisabled = _a.isDisabled, label = _a.label, value = _a.value, props = __rest(_a, ["helper", "id", "isDisabled", "label", "value"]);
|
|
1271
|
+
var _b = useRadioContext(), blurEvent = _b.blurEvent, changeEvent = _b.changeEvent, groupDisabled = _b.groupDisabled, isChecked = _b.isChecked, labelSize = _b.labelSize, name = _b.name, size = _b.size;
|
|
1272
|
+
var surface = React.useContext(Context$3).surface;
|
|
1250
1273
|
var idLabel = "".concat(id, "-label");
|
|
1251
1274
|
var checked = isChecked === value ? true : false;
|
|
1252
|
-
var disabled = isDisabled ? isDisabled : false;
|
|
1253
1275
|
return (React__default["default"].createElement("div", __assign({ className: classNames({
|
|
1254
1276
|
"arc-RadioButton": true,
|
|
1255
|
-
"arc-RadioButton--
|
|
1256
|
-
"arc-RadioButton--
|
|
1257
|
-
"arc-RadioButton--
|
|
1258
|
-
"arc-RadioButton--required": isRequired,
|
|
1277
|
+
"arc-RadioButton--disabled": isDisabled || groupDisabled,
|
|
1278
|
+
"arc-RadioButton--small": size === "s",
|
|
1279
|
+
"arc-RadioButton--smallLabel": labelSize === "s",
|
|
1259
1280
|
"arc-RadioButton--onDarkSurface": surface === "dark"
|
|
1260
1281
|
}) }, filterDataAttrs(props)),
|
|
1261
|
-
React__default["default"].createElement("
|
|
1262
|
-
|
|
1263
|
-
|
|
1282
|
+
React__default["default"].createElement("label", { className: "arc-RadioButton-label", htmlFor: id, id: idLabel },
|
|
1283
|
+
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 }),
|
|
1284
|
+
React__default["default"].createElement("span", null,
|
|
1285
|
+
label,
|
|
1286
|
+
helper && React__default["default"].createElement("span", { className: "arc-RadioButton-helper" }, helper)))));
|
|
1264
1287
|
});
|
|
1265
1288
|
|
|
1266
1289
|
/**
|
|
1267
1290
|
* Use `RadioGroup` to wrap and control radio buttons and apply default values
|
|
1268
1291
|
*/
|
|
1269
1292
|
var RadioGroup = function (_a) {
|
|
1270
|
-
var children = _a.children, defaultValue = _a.defaultValue, _b = _a.isDisabled, isDisabled = _b === void 0 ? false : _b, _c = _a.
|
|
1293
|
+
var children = _a.children, defaultValue = _a.defaultValue, _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", "defaultValue", "isDisabled", "id", "helper", "label", "labelSize", "name", "onBlur", "onChange", "size"]);
|
|
1271
1294
|
return (React__default["default"].createElement(Provider$2, { value: {
|
|
1295
|
+
blurEvent: onBlur,
|
|
1296
|
+
changeEvent: onChange,
|
|
1297
|
+
groupDisabled: isDisabled,
|
|
1272
1298
|
isChecked: defaultValue,
|
|
1273
|
-
|
|
1274
|
-
isDisabled: isDisabled,
|
|
1275
|
-
isInvalid: errorMessage ? true : false,
|
|
1276
|
-
errorId: id,
|
|
1277
|
-
errorMessage: errorMessage,
|
|
1299
|
+
labelSize: labelSize,
|
|
1278
1300
|
name: name,
|
|
1279
|
-
|
|
1301
|
+
size: size
|
|
1280
1302
|
} },
|
|
1281
|
-
React__default["default"].createElement(
|
|
1282
|
-
React__default["default"].createElement("
|
|
1283
|
-
"arc-RadioGroup": true,
|
|
1284
|
-
"arc-RadioGroup--invalid": errorMessage,
|
|
1285
|
-
"arc-RadioGroup--disabled": isDisabled
|
|
1286
|
-
}) }, filterDataAttrs(props)), children))));
|
|
1303
|
+
React__default["default"].createElement("div", __assign({ className: "arc-RadioGroup" }, filterDataAttrs(props)),
|
|
1304
|
+
React__default["default"].createElement(FormControl, { elementType: "fieldset", label: label, labelSize: labelSize, helper: helper, id: id, requirementStatus: "not-applicable" }, children))));
|
|
1287
1305
|
};
|
|
1306
|
+
RadioButton.displayName = "RadioGroup.RadioButton";
|
|
1288
1307
|
RadioGroup.RadioButton = RadioButton;
|
|
1289
1308
|
|
|
1290
1309
|
/**
|
|
1291
1310
|
* Use `Rule` to display a horizontal rule.
|
|
1292
1311
|
*/
|
|
1293
1312
|
var Rule = function (props) {
|
|
1294
|
-
var surface = React.useContext(Context$
|
|
1313
|
+
var surface = React.useContext(Context$3).surface;
|
|
1295
1314
|
return (React__default["default"].createElement("hr", __assign({ className: classNames({
|
|
1296
1315
|
"arc-Rule": true,
|
|
1297
1316
|
"arc-Rule--onDarkSurface": surface === "dark"
|
|
@@ -1336,10 +1355,8 @@ var SiteFooter = function (_a) {
|
|
|
1336
1355
|
children && (React__default["default"].createElement("ul", { className: "arc-SiteFooter-secondaryItems" }, children)),
|
|
1337
1356
|
React__default["default"].createElement("div", { className: "arc-SiteFooter-brand" },
|
|
1338
1357
|
React__default["default"].createElement("div", { className: "arc-SiteFooter-copyright" },
|
|
1339
|
-
React__default["default"].createElement("span", { className: "arc-SiteFooter-copyrightSymbol" }, "\u00A9"),
|
|
1340
|
-
|
|
1341
|
-
currentYear || new Date().getFullYear()),
|
|
1342
|
-
React__default["default"].createElement(BrandLogo, { label: logoLabel, size: 32 }))))))));
|
|
1358
|
+
React__default["default"].createElement("span", { className: "arc-SiteFooter-copyrightSymbol" }, "\u00A9"), " ".concat(currentYear || new Date().getFullYear())),
|
|
1359
|
+
React__default["default"].createElement(BrandLogo, { label: logoLabel }))))))));
|
|
1343
1360
|
};
|
|
1344
1361
|
var SiteFooterItemGroup = function (_a) {
|
|
1345
1362
|
var children = _a.children, title = _a.title;
|
|
@@ -1367,16 +1384,20 @@ SiteFooterItemGroup.displayName = "SiteFooter.ItemGroup";
|
|
|
1367
1384
|
SiteFooter.ItemGroup = SiteFooterItemGroup;
|
|
1368
1385
|
|
|
1369
1386
|
var SiteFooter_rehydrator = (function (el, rehydrateChildren) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1370
|
-
var children, props;
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
switch (_b.label) {
|
|
1387
|
+
var children, titleElement, title, props;
|
|
1388
|
+
return __generator(this, function (_a) {
|
|
1389
|
+
switch (_a.label) {
|
|
1374
1390
|
case 0: return [4 /*yield*/, rehydrateChildren(el.querySelector(".arc-SiteFooter-mainItems"))];
|
|
1375
1391
|
case 1:
|
|
1376
|
-
children =
|
|
1392
|
+
children = _a.sent();
|
|
1393
|
+
titleElement = el.querySelector(".arc-SiteFooter-title");
|
|
1394
|
+
title = "";
|
|
1395
|
+
if (titleElement) {
|
|
1396
|
+
title = titleElement.textContent || /* istanbul ignore next */ "";
|
|
1397
|
+
}
|
|
1377
1398
|
props = {
|
|
1378
1399
|
children: children,
|
|
1379
|
-
title:
|
|
1400
|
+
title: title
|
|
1380
1401
|
};
|
|
1381
1402
|
return [2 /*return*/, React__default["default"].createElement(SiteFooter.ItemGroup, __assign({}, props), children)];
|
|
1382
1403
|
}
|
|
@@ -1394,7 +1415,8 @@ var Item = function (_a) {
|
|
|
1394
1415
|
};
|
|
1395
1416
|
|
|
1396
1417
|
var ItemGroup = function (_a) {
|
|
1397
|
-
var children = _a.children, title = _a.title, props = __rest(_a, ["children", "title"]);
|
|
1418
|
+
var children = _a.children, href = _a.href, title = _a.title, viewAllTitle = _a.viewAllTitle, props = __rest(_a, ["children", "href", "title", "viewAllTitle"]);
|
|
1419
|
+
var _b = React.useState(false), hasClientSideJavaScript = _b[0], setHasClientSideJavaScript = _b[1];
|
|
1398
1420
|
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
1399
1421
|
React.useEffect(function () {
|
|
1400
1422
|
React__default["default"].Children.map(children, function (item) {
|
|
@@ -1403,24 +1425,43 @@ var ItemGroup = function (_a) {
|
|
|
1403
1425
|
}
|
|
1404
1426
|
});
|
|
1405
1427
|
}, [children]);
|
|
1428
|
+
React.useEffect(function () {
|
|
1429
|
+
// useEffect does not run in ReactDomServer renders
|
|
1430
|
+
setHasClientSideJavaScript(true);
|
|
1431
|
+
}, [setHasClientSideJavaScript]);
|
|
1406
1432
|
return (React__default["default"].createElement("li", { className: "arc-SiteHeaderItemGroup" },
|
|
1407
1433
|
React__default["default"].createElement("details", __assign({ className: "arc-SiteHeaderItemGroup-details", open: isMinWidthArcBreakpointL }, filterDataAttrs(props)),
|
|
1408
|
-
React__default["default"].createElement("summary", { className: "arc-SiteHeaderItemGroup-summary", tabIndex: isMinWidthArcBreakpointL ? -1 : 0 },
|
|
1409
|
-
|
|
1410
|
-
|
|
1434
|
+
React__default["default"].createElement("summary", { className: "arc-SiteHeaderItemGroup-summary", tabIndex: isMinWidthArcBreakpointL ? -1 : 0 }, href ? (React__default["default"].createElement("a", { className: "arc-SiteHeaderItemGroup-title", href: href, tabIndex: !hasClientSideJavaScript || isMinWidthArcBreakpointL ? 0 : -1 }, title)) : (React__default["default"].createElement("div", { className: "arc-SiteHeaderItemGroup-title" }, title))),
|
|
1435
|
+
React__default["default"].createElement("ul", { className: "arc-SiteHeaderItemGroup-items" },
|
|
1436
|
+
children,
|
|
1437
|
+
href ? (React__default["default"].createElement("li", { className: "arc-SiteHeaderItem arc-SiteHeaderItem--viewAll" },
|
|
1438
|
+
React__default["default"].createElement("a", { className: "arc-SiteHeaderItem-link", href: href }, viewAllTitle || "View all ".concat(title.toLowerCase())))) : null))));
|
|
1411
1439
|
};
|
|
1412
1440
|
|
|
1413
1441
|
var ItemGroupRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1414
|
-
var children, props;
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
switch (_b.label) {
|
|
1442
|
+
var children, titleElement, viewAllElement, title, href, viewAllTitle, props;
|
|
1443
|
+
return __generator(this, function (_a) {
|
|
1444
|
+
switch (_a.label) {
|
|
1418
1445
|
case 0: return [4 /*yield*/, hydrate(el.querySelector(".arc-SiteHeaderItemGroup-items"))];
|
|
1419
1446
|
case 1:
|
|
1420
|
-
children =
|
|
1447
|
+
children = _a.sent();
|
|
1448
|
+
titleElement = el.querySelector(".arc-SiteHeaderItemGroup-title");
|
|
1449
|
+
viewAllElement = el.querySelector(".arc-SiteHeaderItem--viewAll");
|
|
1450
|
+
title = "";
|
|
1451
|
+
href = "";
|
|
1452
|
+
viewAllTitle = "";
|
|
1453
|
+
if (titleElement) {
|
|
1454
|
+
title = titleElement.textContent || /* istanbul ignore next */ "";
|
|
1455
|
+
href = titleElement.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1456
|
+
}
|
|
1457
|
+
if (viewAllElement) {
|
|
1458
|
+
viewAllTitle = viewAllElement.textContent || /* istanbul ignore next */ "";
|
|
1459
|
+
}
|
|
1421
1460
|
props = {
|
|
1422
1461
|
children: children,
|
|
1423
|
-
|
|
1462
|
+
href: href,
|
|
1463
|
+
title: title,
|
|
1464
|
+
viewAllTitle: viewAllTitle
|
|
1424
1465
|
};
|
|
1425
1466
|
return [2 /*return*/, React__default["default"].createElement(ItemGroup, __assign({}, props), children)];
|
|
1426
1467
|
}
|
|
@@ -1450,7 +1491,7 @@ var BackButton = function (_a) {
|
|
|
1450
1491
|
|
|
1451
1492
|
var Panel = function (_a) {
|
|
1452
1493
|
var _b;
|
|
1453
|
-
var children = _a.children, navItemRef = _a.navItemRef,
|
|
1494
|
+
var children = _a.children, navItemRef = _a.navItemRef, open = _a.open, promo = _a.promo, setOpen = _a.setOpen, subNavItemRef = _a.subNavItemRef, _c = _a.subNavLink, subNavLink = _c === void 0 ? "" : _c, title = _a.title, viewAll = _a.viewAll, withSubNav = _a.withSubNav, props = __rest(_a, ["children", "navItemRef", "open", "promo", "setOpen", "subNavItemRef", "subNavLink", "title", "viewAll", "withSubNav"]);
|
|
1454
1495
|
var transparent = React.useContext(Context).transparent;
|
|
1455
1496
|
React.useEffect(function () {
|
|
1456
1497
|
// Where appropriate, close the Panel when clicking outside of it,
|
|
@@ -1560,7 +1601,7 @@ var NavItem = function (_a) {
|
|
|
1560
1601
|
};
|
|
1561
1602
|
|
|
1562
1603
|
var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1563
|
-
var children, promo, link, viewAll, props;
|
|
1604
|
+
var children, promo, link, viewAll, href, title, props;
|
|
1564
1605
|
return __generator(this, function (_a) {
|
|
1565
1606
|
switch (_a.label) {
|
|
1566
1607
|
case 0:
|
|
@@ -1580,11 +1621,20 @@ var NavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void
|
|
|
1580
1621
|
case 4:
|
|
1581
1622
|
link = el.querySelector(".arc-SiteHeaderNavItem-link");
|
|
1582
1623
|
viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
|
|
1624
|
+
href = "";
|
|
1625
|
+
title = "";
|
|
1626
|
+
if (link) {
|
|
1627
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1628
|
+
href = link.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1629
|
+
}
|
|
1630
|
+
if (viewAll) {
|
|
1631
|
+
href = viewAll.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1632
|
+
}
|
|
1583
1633
|
props = {
|
|
1584
|
-
href:
|
|
1634
|
+
href: href,
|
|
1585
1635
|
isCurrent: el.classList.contains("arc-SiteHeaderNavItem--linkSelected") || undefined,
|
|
1586
1636
|
promo: promo || undefined,
|
|
1587
|
-
title:
|
|
1637
|
+
title: title,
|
|
1588
1638
|
viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
|
|
1589
1639
|
};
|
|
1590
1640
|
return [2 /*return*/, React__default["default"].createElement(NavItem, __assign({}, props), children)];
|
|
@@ -1633,7 +1683,7 @@ var SubNavItem = function (_a) {
|
|
|
1633
1683
|
};
|
|
1634
1684
|
|
|
1635
1685
|
var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1636
|
-
var children, promo, link, props;
|
|
1686
|
+
var children, promo, link, href, title, props;
|
|
1637
1687
|
return __generator(this, function (_a) {
|
|
1638
1688
|
switch (_a.label) {
|
|
1639
1689
|
case 0:
|
|
@@ -1652,11 +1702,17 @@ var SubNavItemRehydrator = (function (el, hydrate) { return __awaiter(void 0, vo
|
|
|
1652
1702
|
_a.label = 4;
|
|
1653
1703
|
case 4:
|
|
1654
1704
|
link = el.querySelector(".arc-SiteHeaderSubNavItem-link");
|
|
1705
|
+
href = "";
|
|
1706
|
+
title = "";
|
|
1707
|
+
if (link) {
|
|
1708
|
+
href = link.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1709
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1710
|
+
}
|
|
1655
1711
|
props = {
|
|
1656
|
-
href:
|
|
1712
|
+
href: href,
|
|
1657
1713
|
isDefaultItem: Boolean(el.dataset.defaultItem),
|
|
1658
1714
|
promo: promo || undefined,
|
|
1659
|
-
title:
|
|
1715
|
+
title: title
|
|
1660
1716
|
};
|
|
1661
1717
|
return [2 /*return*/, React__default["default"].createElement(SubNavItem, __assign({}, props), children)];
|
|
1662
1718
|
}
|
|
@@ -1677,7 +1733,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1677
1733
|
if (item && item.type !== SubNavItem && item.type !== React.Fragment) {
|
|
1678
1734
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot1` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1679
1735
|
}
|
|
1680
|
-
if (item
|
|
1736
|
+
if (item.props.isDefaultItem) {
|
|
1681
1737
|
setDefaultItem(false);
|
|
1682
1738
|
}
|
|
1683
1739
|
});
|
|
@@ -1685,7 +1741,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1685
1741
|
if (item && item.type !== SubNavItem && item.type !== React.Fragment) {
|
|
1686
1742
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot2` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1687
1743
|
}
|
|
1688
|
-
if (item
|
|
1744
|
+
if (item.props.isDefaultItem) {
|
|
1689
1745
|
setDefaultItem(false);
|
|
1690
1746
|
}
|
|
1691
1747
|
});
|
|
@@ -1693,7 +1749,7 @@ var NavItemWithSubNav = function (_a) {
|
|
|
1693
1749
|
if (item && item.type !== SubNavItem && item.type !== React.Fragment) {
|
|
1694
1750
|
throw new Error("Illegal child passed to <SiteHeader.NavItemWithSubNav /> `slot3` prop. Ensure to only use <SiteHeader.SubNavItem />.");
|
|
1695
1751
|
}
|
|
1696
|
-
if (item
|
|
1752
|
+
if (item.props.isDefaultItem) {
|
|
1697
1753
|
setDefaultItem(false);
|
|
1698
1754
|
}
|
|
1699
1755
|
});
|
|
@@ -1723,7 +1779,7 @@ function wrap(el, wrapper) {
|
|
|
1723
1779
|
wrapper.appendChild(el);
|
|
1724
1780
|
}
|
|
1725
1781
|
var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1726
|
-
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, props;
|
|
1782
|
+
var subNavItem1, subNavItem2, subNavItem3, div1, div2, slot1, slot2, slot3, div3, link, subTitle, viewAll, title, props;
|
|
1727
1783
|
return __generator(this, function (_a) {
|
|
1728
1784
|
switch (_a.label) {
|
|
1729
1785
|
case 0:
|
|
@@ -1754,13 +1810,17 @@ var NavItemWithSubNavRehydrator = (function (el, hydrate) { return __awaiter(voi
|
|
|
1754
1810
|
link = el.querySelector(".arc-SiteHeaderNavItem-link");
|
|
1755
1811
|
subTitle = el.querySelector(".arc-SiteHeaderPanel-title");
|
|
1756
1812
|
viewAll = el.querySelector(".arc-SiteHeaderPanel-viewAll");
|
|
1813
|
+
title = "";
|
|
1814
|
+
if (link) {
|
|
1815
|
+
title = link.textContent || /* istanbul ignore next */ "";
|
|
1816
|
+
}
|
|
1757
1817
|
props = {
|
|
1758
1818
|
href: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.getAttribute("href")) || undefined,
|
|
1759
|
-
slot1: slot1 || undefined,
|
|
1760
|
-
slot2: slot2 || undefined,
|
|
1819
|
+
slot1: slot1 || /* istanbul ignore next */ undefined,
|
|
1820
|
+
slot2: slot2 || /* istanbul ignore next */ undefined,
|
|
1761
1821
|
slot3: slot3 || undefined,
|
|
1762
1822
|
subTitle: (subTitle === null || subTitle === void 0 ? void 0 : subTitle.textContent) || undefined,
|
|
1763
|
-
title:
|
|
1823
|
+
title: title,
|
|
1764
1824
|
viewAllTitle: (viewAll === null || viewAll === void 0 ? void 0 : viewAll.textContent) || undefined
|
|
1765
1825
|
};
|
|
1766
1826
|
return [2 /*return*/, React__default["default"].createElement(NavItemWithSubNav, __assign({}, props))];
|
|
@@ -1790,7 +1850,7 @@ var Provider = Context.Provider;
|
|
|
1790
1850
|
*/
|
|
1791
1851
|
var SiteHeader = function (_a) {
|
|
1792
1852
|
var _b;
|
|
1793
|
-
var children = _a.children, _c = _a.basketHref, basketHref = _c === void 0 ? "/basket" : _c, _d = _a.hasBasket, hasBasket = _d === void 0 ? false : _d, _e = _a.hasLogin, hasLogin = _e === void 0 ? true : _e, _f = _a.isTransparent, isTransparent = _f === void 0 ? false : _f, _g = _a.loginHref, loginHref = _g === void 0 ? "/login" : _g, _h = _a.loginTitle, loginTitle = _h === void 0 ? "Login / Register" : _h, _j = _a.logoHref, logoHref = _j === void 0 ? "/" : _j, _k = _a.logoLabel, logoLabel = _k === void 0 ? "Home" : _k, search = _a.search, props = __rest(_a, ["children", "basketHref", "hasBasket", "hasLogin", "isTransparent", "loginHref", "loginTitle", "logoHref", "logoLabel", "search"]);
|
|
1853
|
+
var children = _a.children, _c = _a.basketHref, basketHref = _c === void 0 ? "/basket" : _c, _d = _a.hasBasket, hasBasket = _d === void 0 ? false : _d, _e = _a.hasLogin, hasLogin = _e === void 0 ? true : _e, _f = _a.isTransparent, isTransparent = _f === void 0 ? false : _f, _g = _a.loginHref, loginHref = _g === void 0 ? "/login" : _g, _h = _a.loginTitle, loginTitle = _h === void 0 ? "Login / Register" : _h, _j = _a.logoHref, logoHref = _j === void 0 ? "/" : _j, _k = _a.logoLabel, logoLabel = _k === void 0 ? "Home" : _k, search = _a.search, subBrand = _a.subBrand, props = __rest(_a, ["children", "basketHref", "hasBasket", "hasLogin", "isTransparent", "loginHref", "loginTitle", "logoHref", "logoLabel", "search", "subBrand"]);
|
|
1794
1854
|
var _l = React.useState(false), hasClientSideJavaScript = _l[0], setHasClientSideJavaScript = _l[1];
|
|
1795
1855
|
var _m = React.useState(false), menuOpen = _m[0], setMenuOpen = _m[1];
|
|
1796
1856
|
var isMinWidthArcBreakpointL = useMediaQuery("(min-width: ".concat(ArcBreakpointL, "px)"));
|
|
@@ -1841,15 +1901,15 @@ var SiteHeader = function (_a) {
|
|
|
1841
1901
|
: undefined },
|
|
1842
1902
|
React__default["default"].createElement("div", { className: "arc-SiteHeader-inner" },
|
|
1843
1903
|
React__default["default"].createElement("a", { className: "arc-SiteHeader-brand", href: logoHref },
|
|
1844
|
-
React__default["default"].createElement(BrandLogo, { label: logoLabel,
|
|
1845
|
-
React__default["default"].createElement("nav", { className: "arc-SiteHeader-nav" },
|
|
1904
|
+
React__default["default"].createElement(BrandLogo, { label: logoLabel, subBrand: subBrand })),
|
|
1905
|
+
children && (React__default["default"].createElement("nav", { className: "arc-SiteHeader-nav" },
|
|
1846
1906
|
React__default["default"].createElement("div", { className: "arc-SiteHeader-menuButton" },
|
|
1847
1907
|
React__default["default"].createElement(MenuButton, { menuOpen: menuOpen, setMenuOpen: setMenuOpen })),
|
|
1848
1908
|
React__default["default"].createElement("div", { className: "arc-SiteHeader-main" },
|
|
1849
1909
|
React__default["default"].createElement("ul", { className: "arc-SiteHeader-navItems" }, children),
|
|
1850
1910
|
hasLogin && (React__default["default"].createElement("div", { className: "arc-SiteHeader-loginButton" },
|
|
1851
|
-
React__default["default"].createElement(Button, { href: loginHref, isFullWidth: true, label: loginTitle }))))))
|
|
1852
|
-
(
|
|
1911
|
+
React__default["default"].createElement(Button, { href: loginHref, isFullWidth: true, label: loginTitle })))))),
|
|
1912
|
+
(hasBasket || hasLogin || search) && (React__default["default"].createElement("div", { className: "arc-SiteHeader-secondary" },
|
|
1853
1913
|
search ? (React__default["default"].createElement("div", { className: "arc-SiteHeader-search" }, search)) : null,
|
|
1854
1914
|
hasBasket ? (React__default["default"].createElement("a", { className: "arc-SiteHeader-basket", href: basketHref },
|
|
1855
1915
|
React__default["default"].createElement(Icon, { icon: "btBasket", label: "Basket", size: 24 }))) : null,
|
|
@@ -1869,27 +1929,33 @@ SiteHeader.NavItemWithSubNav = NavItemWithSubNav;
|
|
|
1869
1929
|
SiteHeader.SubNavItem = SubNavItem;
|
|
1870
1930
|
|
|
1871
1931
|
var SiteHeaderRehydrator = function (el, hydrate) { return __awaiter(void 0, void 0, void 0, function () {
|
|
1872
|
-
var children, search, basket, login, props;
|
|
1873
|
-
|
|
1874
|
-
|
|
1875
|
-
switch (_c.label) {
|
|
1932
|
+
var children, search, basket, brand, login, logoHref, logoLabel, props;
|
|
1933
|
+
return __generator(this, function (_a) {
|
|
1934
|
+
switch (_a.label) {
|
|
1876
1935
|
case 0:
|
|
1877
1936
|
children = el.querySelector(".arc-SiteHeader-navItems");
|
|
1878
1937
|
search = el.querySelector(".arc-SiteHeader-search");
|
|
1879
1938
|
if (!children) return [3 /*break*/, 2];
|
|
1880
1939
|
return [4 /*yield*/, hydrate(children)];
|
|
1881
1940
|
case 1:
|
|
1882
|
-
children =
|
|
1883
|
-
|
|
1941
|
+
children = _a.sent();
|
|
1942
|
+
_a.label = 2;
|
|
1884
1943
|
case 2:
|
|
1885
1944
|
if (!search) return [3 /*break*/, 4];
|
|
1886
1945
|
return [4 /*yield*/, hydrate(search)];
|
|
1887
1946
|
case 3:
|
|
1888
|
-
search =
|
|
1889
|
-
|
|
1947
|
+
search = _a.sent();
|
|
1948
|
+
_a.label = 4;
|
|
1890
1949
|
case 4:
|
|
1891
1950
|
basket = el.querySelector(".arc-SiteHeader-basket");
|
|
1951
|
+
brand = el.querySelector(".arc-SiteHeader-brand");
|
|
1892
1952
|
login = el.querySelector(".arc-SiteHeader-loginLink");
|
|
1953
|
+
logoHref = "";
|
|
1954
|
+
logoLabel = "";
|
|
1955
|
+
if (brand) {
|
|
1956
|
+
logoHref = brand.getAttribute("href") || /* istanbul ignore next */ "";
|
|
1957
|
+
logoLabel = brand.textContent || /* istanbul ignore next */ "";
|
|
1958
|
+
}
|
|
1893
1959
|
props = {
|
|
1894
1960
|
basketHref: (basket === null || basket === void 0 ? void 0 : basket.getAttribute("href")) || undefined,
|
|
1895
1961
|
hasBasket: Boolean(basket),
|
|
@@ -1897,9 +1963,8 @@ var SiteHeaderRehydrator = function (el, hydrate) { return __awaiter(void 0, voi
|
|
|
1897
1963
|
isTransparent: Boolean(el.dataset.transparent),
|
|
1898
1964
|
loginHref: (login === null || login === void 0 ? void 0 : login.getAttribute("href")) || undefined,
|
|
1899
1965
|
loginTitle: (login === null || login === void 0 ? void 0 : login.textContent) || undefined,
|
|
1900
|
-
logoHref:
|
|
1901
|
-
|
|
1902
|
-
logoLabel: ((_b = el.querySelector("arc-BrandLogo-text")) === null || _b === void 0 ? void 0 : _b.textContent) || undefined,
|
|
1966
|
+
logoHref: logoHref,
|
|
1967
|
+
logoLabel: logoLabel,
|
|
1903
1968
|
search: search
|
|
1904
1969
|
};
|
|
1905
1970
|
return [2 /*return*/, React__default["default"].createElement(SiteHeader, __assign({}, props), children)];
|
|
@@ -1917,14 +1982,13 @@ SiteHeaderRehydrator.SubNavItemRehydrator = SubNavItemRehydrator;
|
|
|
1917
1982
|
var Text = function (_a) {
|
|
1918
1983
|
var _b;
|
|
1919
1984
|
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"]);
|
|
1920
|
-
var surface = React.useContext(Context$
|
|
1985
|
+
var surface = React.useContext(Context$3).surface;
|
|
1921
1986
|
return (React__default["default"].createElement("span", __assign({ className: classNames((_b = {
|
|
1922
|
-
"arc-Text": true
|
|
1923
|
-
"arc-Text--alignCenter": align === "center",
|
|
1924
|
-
"arc-Text--alignRight": align === "right",
|
|
1925
|
-
"arc-Text--inline": isInline,
|
|
1926
|
-
"arc-Text--measured": isMeasured
|
|
1987
|
+
"arc-Text": true
|
|
1927
1988
|
},
|
|
1989
|
+
_b[suffixModifier("arc-Text--align", align)] = align !== "left",
|
|
1990
|
+
_b["arc-Text--inline"] = isInline,
|
|
1991
|
+
_b["arc-Text--measured"] = isMeasured,
|
|
1928
1992
|
_b["arc-Text--size".concat(size && size.toUpperCase())] = size && size !== "m",
|
|
1929
1993
|
_b["arc-Text--".concat(tone)] = tone !== "default",
|
|
1930
1994
|
_b["arc-Text--onDarkSurface"] = surface === "dark",
|
|
@@ -1935,8 +1999,8 @@ var Text = function (_a) {
|
|
|
1935
1999
|
* Use `TextInput` to allow custom user text entry with a keyboard.
|
|
1936
2000
|
*/
|
|
1937
2001
|
var TextInput = React.forwardRef(function (_a, ref) {
|
|
1938
|
-
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"]);
|
|
1939
|
-
var surface = React.useContext(Context$
|
|
2002
|
+
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"]);
|
|
2003
|
+
var surface = React.useContext(Context$3).surface;
|
|
1940
2004
|
var inferredInputProps = useNumericInput({ inputMode: inputMode, pattern: pattern, type: type });
|
|
1941
2005
|
// Although this is used within FormControlWrapper, it's deterministic so we can call it here too
|
|
1942
2006
|
var ariaDescribedby = useAriaDescribedby({
|
|
@@ -1949,8 +2013,8 @@ var TextInput = React.forwardRef(function (_a, ref) {
|
|
|
1949
2013
|
"arc-TextInput--invalid": errorMessage,
|
|
1950
2014
|
"arc-TextInput--onDarkSurface": surface === "dark"
|
|
1951
2015
|
}) }, filterDataAttrs(props)),
|
|
1952
|
-
React__default["default"].createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id,
|
|
1953
|
-
React__default["default"].createElement("input", __assign({ "aria-describedby": ariaDescribedby, "aria-invalid": errorMessage ? "true" : "false",
|
|
2016
|
+
React__default["default"].createElement(FormControl, { errorMessage: errorMessage, helper: helper, htmlFor: id, label: label, labelSize: labelSize, requirementStatus: isRequired ? "required" : "optional" },
|
|
2017
|
+
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)))));
|
|
1954
2018
|
});
|
|
1955
2019
|
|
|
1956
2020
|
/**
|
|
@@ -1994,7 +2058,7 @@ exports.SiteFooterRehydrator = SiteFooter_rehydrator;
|
|
|
1994
2058
|
exports.SiteHeader = SiteHeader;
|
|
1995
2059
|
exports.SiteHeaderRehydrator = SiteHeaderRehydrator;
|
|
1996
2060
|
exports.Surface = Surface;
|
|
1997
|
-
exports.SurfaceContext = Context$
|
|
2061
|
+
exports.SurfaceContext = Context$3;
|
|
1998
2062
|
exports.Text = Text;
|
|
1999
2063
|
exports.TextInput = TextInput;
|
|
2000
2064
|
exports.UniversalHeader = UniversalHeader;
|