@thecb/components 6.0.9 → 6.1.0-beta.3
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.cjs.js +19 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +19 -1
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/.DS_Store +0 -0
- package/src/components/atoms/form-layouts/FormInput.js +8 -0
- package/src/util/focusFirstInvalidInputHook.js +17 -0
- package/src/util/index.js +2 -1
package/dist/index.esm.js
CHANGED
|
@@ -22685,6 +22685,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22685
22685
|
}, formatter ? /*#__PURE__*/React.createElement(FormattedInputField, _extends({
|
|
22686
22686
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22687
22687
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22688
|
+
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22688
22689
|
onChange: function onChange(e) {
|
|
22689
22690
|
return fieldActions.set(e);
|
|
22690
22691
|
},
|
|
@@ -22702,6 +22703,7 @@ var FormInput = function FormInput(_ref15) {
|
|
|
22702
22703
|
}, props)) : /*#__PURE__*/React.createElement(InputField, _extends({
|
|
22703
22704
|
"aria-labelledby": createIdFromString(labelTextWhenNoError),
|
|
22704
22705
|
"aria-describedby": createIdFromString(labelTextWhenNoError, "error message"),
|
|
22706
|
+
"aria-invalid": field.dirty && field.hasErrors || field.hasErrors && showErrors,
|
|
22705
22707
|
onChange: function onChange(e) {
|
|
22706
22708
|
return fieldActions.set(e.target.value);
|
|
22707
22709
|
},
|
|
@@ -43645,13 +43647,29 @@ var index$4 = /*#__PURE__*/Object.freeze({
|
|
|
43645
43647
|
fontWeights: style_constants
|
|
43646
43648
|
});
|
|
43647
43649
|
|
|
43650
|
+
var useFocusInvalidInput = function useFocusInvalidInput() {
|
|
43651
|
+
var showErrors = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
|
43652
|
+
// Only move focus when "showErrors" is true
|
|
43653
|
+
// "showErrors" is managed by container page of form
|
|
43654
|
+
// typically set to "true" on attempted form submission, if errors exist
|
|
43655
|
+
useEffect$1(function () {
|
|
43656
|
+
if (showErrors) {
|
|
43657
|
+
var _inputsWithErrors$;
|
|
43658
|
+
|
|
43659
|
+
var inputsWithErrors = document.querySelectorAll("input[aria-invalid=true]");
|
|
43660
|
+
inputsWithErrors === null || inputsWithErrors === void 0 ? void 0 : (_inputsWithErrors$ = inputsWithErrors[0]) === null || _inputsWithErrors$ === void 0 ? void 0 : _inputsWithErrors$.focus();
|
|
43661
|
+
}
|
|
43662
|
+
}, [showErrors]);
|
|
43663
|
+
};
|
|
43664
|
+
|
|
43648
43665
|
|
|
43649
43666
|
|
|
43650
43667
|
var index$5 = /*#__PURE__*/Object.freeze({
|
|
43651
43668
|
__proto__: null,
|
|
43652
43669
|
formats: formats,
|
|
43653
43670
|
general: general,
|
|
43654
|
-
theme: themeUtils
|
|
43671
|
+
theme: themeUtils,
|
|
43672
|
+
useFocusInvalidInput: useFocusInvalidInput
|
|
43655
43673
|
});
|
|
43656
43674
|
|
|
43657
43675
|
export { AccountNumberImage, AccountsAddIcon$1 as AccountsAddIcon, AccountsIcon$1 as AccountsIcon, AccountsIconSmall$1 as AccountsIconSmall, AchReturnIcon, AddObligation$1 as AddObligation, AddressForm, Alert$1 as Alert, AllocatedIcon, AmountCallout$1 as AmountCallout, AutopayOnIcon, BankIcon, Box, BoxWithShadow$1 as BoxWithShadow, Breadcrumbs as Breadcrumb, ButtonWithAction, ButtonWithLink, CalendarIcon, CarrotIcon$1 as CarrotIcon, CashIcon, Center, CenterSingle$1 as CenterSingle, CenterStack$1 as CenterStack, ChangePasswordForm, ChargebackIcon, ChargebackReversalIcon, CheckIcon, Checkbox$1 as Checkbox, CheckboxList$1 as CheckboxList, CheckmarkIcon, ChevronIcon$1 as ChevronIcon, Cluster, CollapsibleSection$1 as CollapsibleSection, CountryDropdown, Cover, CustomerSearchIcon, DefaultPageTemplate, Detail$1 as Detail, DisplayBox$1 as DisplayBox, DisplayCard, Dropdown$1 as Dropdown, DuplicateIcon, EditNameForm, EditableList, EditableTable, EmailForm, EmptyCartIcon$1 as EmptyCartIcon, ErroredIcon, ExternalLink, FailedIcon, ForgotPasswordForm, ForgotPasswordIcon$1 as ForgotPasswordIcon, FormContainer$1 as FormContainer, FormFooterPanel$1 as FormFooterPanel, FormInput$1 as FormInput, FormInputColumn, FormInputRow, FormSelect$1 as FormSelect, FormattedAddress$1 as FormattedAddress, FormattedCreditCard$1 as FormattedCreditCard, Frame, GenericCard, GenericCardLarge, GoToEmailIcon$1 as GoToEmailIcon, Grid, HamburgerButton, Heading$1 as Heading, HighlightTabRow$1 as HighlightTabRow, IconAdd, IconQuitLarge, Imposter, InternalLink, InternalUserInfoForm, Jumbo$1 as Jumbo, LabeledAmount$1 as LabeledAmount, LineItem$1 as LineItem, Loading, LoginForm, Modal$1 as Modal, Module$1 as Module, Motion, NavFooter, NavHeader, NavMenuDesktop$1 as NavMenuDesktop, NavMenuMobile$1 as NavMenuMobile, NoCustomerResultsIcon, NoPaymentResultsIcon, NotFoundIcon, Obligation, iconsMap as ObligationIcons, Pagination, Paragraph$1 as Paragraph, PartialAmountForm, PasswordRequirements, PaymentButtonBar, PaymentDetails$1 as PaymentDetails, PaymentFormACH, PaymentFormCard$1 as PaymentFormCard, PaymentIcon, PaymentMethodAddIcon$1 as PaymentMethodAddIcon, PaymentMethodIcon$1 as PaymentMethodIcon, PaymentSearchIcon, PaymentsIconSmall$1 as PaymentsIconSmall, PendingIcon, PeriscopeDashboardIframe, PeriscopeFailedIcon, PhoneForm, Placeholder$1 as Placeholder, ProcessingFee$1 as ProcessingFee, ProfileIcon$1 as ProfileIcon, ProfileIconSmall$1 as ProfileIconSmall, PropertiesAddIcon$1 as PropertiesAddIcon, PropertiesIconSmall$1 as PropertiesIconSmall, RadioButton$2 as RadioButton, RadioSection$1 as RadioSection, Reel, RefundIcon, RegistrationForm, RejectedIcon, RejectedVelocityIcon, ResetConfirmationForm$1 as ResetConfirmationForm, ResetPasswordForm, ResetPasswordIcon, ResetPasswordSuccess, RoutingNumberImage, SearchIcon, SearchableSelect$1 as SearchableSelect, SettingsIconSmall$1 as SettingsIconSmall, ShoppingCartIcon, Sidebar, SidebarSingleContent$1 as SidebarSingleContent, SidebarStackContent$1 as SidebarStackContent, SolidDivider$1 as SolidDivider, Spinner$2 as Spinner, Stack, FormStateDropdown as StateProvinceDropdown, StatusUnknownIcon, SuccessfulIcon, Switcher, TabSidebar$1 as TabSidebar, TableListItem, Tabs$1 as Tabs, TermsAndConditions, TermsAndConditionsModal$1 as TermsAndConditionsModal, Text$1 as Text, Timeout$1 as Timeout, TimeoutImage, Title$1 as Title, ToggleSwitch$1 as ToggleSwitch, TrashIcon$1 as TrashIcon, TypeaheadInput, VerifiedEmailIcon$1 as VerifiedEmailIcon, VoidedIcon, WalletIcon$1 as WalletIcon, WarningIconXS, WelcomeModule$1 as WelcomeModule, WorkflowTile, cardRegistry, index$4 as constants, createPartialAmountFormState, index$5 as util, withWindowSize };
|