@aws-amplify/ui-react 6.15.2 → 6.15.4

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.
@@ -670,10 +670,10 @@ const defaultViewBox = { minX: 0, minY: 0, width: 24, height: 24 };
670
670
  const IconPrimitive = ({ className,
671
671
  // as can be used to render other icon react components too
672
672
  as = 'svg', fill = 'currentColor', pathData, viewBox = defaultViewBox, children, paths, ...rest }, ref) => {
673
- const minX = viewBox.minX ? viewBox.minX : defaultViewBox.minX;
674
- const minY = viewBox.minY ? viewBox.minY : defaultViewBox.minY;
675
- const width = viewBox.width ? viewBox.width : defaultViewBox.width;
676
- const height = viewBox.height ? viewBox.height : defaultViewBox.height;
673
+ const minX = viewBox.minX ?? defaultViewBox.minX;
674
+ const minY = viewBox.minY ?? defaultViewBox.minY;
675
+ const width = viewBox.width ?? defaultViewBox.width;
676
+ const height = viewBox.height ?? defaultViewBox.height;
677
677
  // An icon can be drawn in 3 ways:
678
678
  // 1. Pass it children which should be valid SVG elements
679
679
  // 2. Pass an array of path-like objects to `paths` prop
@@ -1065,7 +1065,15 @@ const FieldsetContext = React__namespace.createContext({
1065
1065
  * fieldsets and input controls. `useFieldset` passes the disabled state down
1066
1066
  * via context.
1067
1067
  */
1068
- const useFieldset = () => React__namespace.useContext(FieldsetContext);
1068
+ const useFieldset = (fallback) => {
1069
+ const ctx = React__namespace.useContext(FieldsetContext);
1070
+ let value = ctx.isFieldsetDisabled;
1071
+ // cannot use nullish `??` since isFieldsetDisabled can be `false`
1072
+ if (value === undefined || value === false) {
1073
+ value = fallback;
1074
+ }
1075
+ return { isFieldsetDisabled: value };
1076
+ };
1069
1077
 
1070
1078
  const FlexPrimitive = ({ className, children, ...rest }, ref) => (React__namespace.createElement(View, { className: ui.classNames(ui.ComponentClassName.Flex, className), ref: ref, ...rest }, children));
1071
1079
  /**
@@ -1133,10 +1141,7 @@ const ButtonPrimitive = ({ className, children, colorTheme, isFullWidth = false,
1133
1141
  const colorThemeModifier = supportedVariations.includes(variation) && colorTheme
1134
1142
  ? `${variation ?? 'outlined'}--${colorTheme}`
1135
1143
  : undefined;
1136
- const { isFieldsetDisabled } = useFieldset();
1137
- const shouldBeDisabled = isFieldsetDisabled
1138
- ? isFieldsetDisabled
1139
- : isDisabled ?? isLoading ?? rest['disabled'];
1144
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isDisabled ?? isLoading ?? rest['disabled']);
1140
1145
  const componentClasses = ui.classNames(ui.ComponentClassName.Button, ui.ComponentClassName.FieldGroupControl, ui.classNameModifier(ui.ComponentClassName.Button, variation), ui.classNameModifier(ui.ComponentClassName.Button, colorThemeModifier), ui.classNameModifier(ui.ComponentClassName.Button, size), ui.classNameModifierByFlag(ui.ComponentClassName.Button, 'disabled', shouldBeDisabled), ui.classNameModifierByFlag(ui.ComponentClassName.Button, 'loading', isLoading), ui.classNameModifierByFlag(ui.ComponentClassName.Button, 'fullwidth', isFullWidth), className);
1141
1146
  return (React__namespace.createElement(View, { ref: ref, as: "button", className: componentClasses, isDisabled: shouldBeDisabled, type: type, ...rest }, isLoading ? (React__namespace.createElement(Flex, { as: "span", className: ui.ComponentClassName.ButtonLoaderWrapper },
1142
1147
  React__namespace.createElement(Loader, { size: size }),
@@ -7,13 +7,19 @@ import { isOtpChallenge } from '../utils.mjs';
7
7
 
8
8
  const { getConfirmText, getConfirmingText, getBackToSignInText, getResendCodeText, } = authenticatorTextUtil;
9
9
  const ConfirmSignInFooter = () => {
10
- const { isPending, toSignIn, challengeName, resendCode } = useAuthenticator((context) => [
10
+ const { isPending, toSignIn, challengeName, resendCode, selectedAuthMethod, availableAuthMethods, } = useAuthenticator((context) => [
11
11
  context.isPending,
12
12
  context.toSignIn,
13
13
  context.challengeName,
14
14
  context.resendCode,
15
+ context.selectedAuthMethod,
16
+ context.availableAuthMethods,
15
17
  ]);
16
- const showResendCode = isOtpChallenge(challengeName) && resendCode;
18
+ // Only show "Resend Code" for passwordless (USER_AUTH) flows.
19
+ // Password-based sign-in does not support resending MFA codes.
20
+ const hasPasswordlessMethod = (!!selectedAuthMethod && selectedAuthMethod !== 'PASSWORD') ||
21
+ !!availableAuthMethods?.some((m) => m !== 'PASSWORD');
22
+ const showResendCode = isOtpChallenge(challengeName) && hasPasswordlessMethod && resendCode;
17
23
  return (React__default.createElement(Flex, { direction: "column" },
18
24
  React__default.createElement(Button, { isDisabled: isPending, type: "submit", variation: "primary", isLoading: isPending, loadingText: getConfirmingText() }, getConfirmText()),
19
25
  showResendCode && (React__default.createElement(Button, { onClick: resendCode, type: "button" }, getResendCodeText())),
@@ -15,10 +15,7 @@ const ButtonPrimitive = ({ className, children, colorTheme, isFullWidth = false,
15
15
  const colorThemeModifier = supportedVariations.includes(variation) && colorTheme
16
16
  ? `${variation ?? 'outlined'}--${colorTheme}`
17
17
  : undefined;
18
- const { isFieldsetDisabled } = useFieldset();
19
- const shouldBeDisabled = isFieldsetDisabled
20
- ? isFieldsetDisabled
21
- : isDisabled ?? isLoading ?? rest['disabled'];
18
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isDisabled ?? isLoading ?? rest['disabled']);
22
19
  const componentClasses = classNames(ComponentClassName.Button, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Button, variation), classNameModifier(ComponentClassName.Button, colorThemeModifier), classNameModifier(ComponentClassName.Button, size), classNameModifierByFlag(ComponentClassName.Button, 'disabled', shouldBeDisabled), classNameModifierByFlag(ComponentClassName.Button, 'loading', isLoading), classNameModifierByFlag(ComponentClassName.Button, 'fullwidth', isFullWidth), className);
23
20
  return (React.createElement(View, { ref: ref, as: "button", className: componentClasses, isDisabled: shouldBeDisabled, type: type, ...rest }, isLoading ? (React.createElement(Flex, { as: "span", className: ComponentClassName.ButtonLoaderWrapper },
24
21
  React.createElement(Loader, { size: size }),
@@ -20,8 +20,7 @@ const CheckboxPrimitive = ({ checked: controlledChecked, className, defaultCheck
20
20
  const { styleProps, rest } = splitPrimitiveProps(_rest);
21
21
  const [focused, setFocused] = React.useState(false);
22
22
  const icons = useIcons('checkbox');
23
- const { isFieldsetDisabled } = useFieldset();
24
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
23
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isDisabled);
25
24
  const isControlled = controlledChecked !== undefined;
26
25
  const [localChecked, setLocalChecked] = React.useState(() =>
27
26
  // if controlled, initialize to `controlledChecked` else `defaultChecked`
@@ -7,10 +7,9 @@ import { VisuallyHidden } from '../VisuallyHidden/VisuallyHidden.mjs';
7
7
  import { useFieldset, FieldsetContext } from './useFieldset.mjs';
8
8
 
9
9
  const FieldsetPrimitive = ({ children, className, isDisabled, legend, legendHidden, size, testId, variation = 'plain', ...rest }, ref) => {
10
- const { isFieldsetDisabled } = useFieldset();
10
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isDisabled);
11
11
  // Fieldsets that are nested within a disabled Fieldset should
12
12
  // also be disabled.
13
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
14
13
  const value = React.useMemo(() => ({
15
14
  isFieldsetDisabled: shouldBeDisabled,
16
15
  }), [shouldBeDisabled]);
@@ -8,6 +8,14 @@ const FieldsetContext = React.createContext({
8
8
  * fieldsets and input controls. `useFieldset` passes the disabled state down
9
9
  * via context.
10
10
  */
11
- const useFieldset = () => React.useContext(FieldsetContext);
11
+ const useFieldset = (fallback) => {
12
+ const ctx = React.useContext(FieldsetContext);
13
+ let value = ctx.isFieldsetDisabled;
14
+ // cannot use nullish `??` since isFieldsetDisabled can be `false`
15
+ if (value === undefined || value === false) {
16
+ value = fallback;
17
+ }
18
+ return { isFieldsetDisabled: value };
19
+ };
12
20
 
13
21
  export { FieldsetContext, useFieldset };
@@ -7,10 +7,10 @@ const defaultViewBox = { minX: 0, minY: 0, width: 24, height: 24 };
7
7
  const IconPrimitive = ({ className,
8
8
  // as can be used to render other icon react components too
9
9
  as = 'svg', fill = 'currentColor', pathData, viewBox = defaultViewBox, children, paths, ...rest }, ref) => {
10
- const minX = viewBox.minX ? viewBox.minX : defaultViewBox.minX;
11
- const minY = viewBox.minY ? viewBox.minY : defaultViewBox.minY;
12
- const width = viewBox.width ? viewBox.width : defaultViewBox.width;
13
- const height = viewBox.height ? viewBox.height : defaultViewBox.height;
10
+ const minX = viewBox.minX ?? defaultViewBox.minX;
11
+ const minY = viewBox.minY ?? defaultViewBox.minY;
12
+ const width = viewBox.width ?? defaultViewBox.width;
13
+ const height = viewBox.height ?? defaultViewBox.height;
14
14
  // An icon can be drawn in 3 ways:
15
15
  // 1. Pass it children which should be valid SVG elements
16
16
  // 2. Pass an array of path-like objects to `paths` prop
@@ -6,8 +6,8 @@ import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
6
6
 
7
7
  const InputPrimitive = ({ autoComplete, checked, className, defaultChecked, defaultValue, id, isDisabled, isReadOnly, isRequired, size, type = 'text', hasError = false, value, variation, ...rest }, ref) => {
8
8
  const componentClasses = classNames(ComponentClassName.Input, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Input, variation), classNameModifierByFlag(ComponentClassName.Input, 'error', hasError), classNameModifier(ComponentClassName.Input, size), className);
9
- const { isFieldsetDisabled } = useFieldset();
10
- return (React.createElement(View, { "aria-invalid": hasError, as: "input", autoComplete: autoComplete, checked: checked, className: componentClasses, defaultChecked: defaultChecked, defaultValue: defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, id: id, readOnly: isReadOnly, ref: ref, required: isRequired, type: type, value: value, ...rest }));
9
+ const { isFieldsetDisabled } = useFieldset(isDisabled);
10
+ return (React.createElement(View, { "aria-invalid": hasError, as: "input", autoComplete: autoComplete, checked: checked, className: componentClasses, defaultChecked: defaultChecked, defaultValue: defaultValue, isDisabled: isFieldsetDisabled, id: id, readOnly: isReadOnly, ref: ref, required: isRequired, type: type, value: value, ...rest }));
11
11
  };
12
12
  const Input = primitiveWithForwardRef(InputPrimitive);
13
13
  Input.displayName = 'Input';
@@ -20,7 +20,7 @@ const MessageDismissPrimitive = ({ onDismiss, dismissLabel, hasIcon = true, chil
20
20
  }, [setDismissed, onDismiss]);
21
21
  return (React.createElement(Button, { variation: "link", colorTheme: "overlay", className: classNames(ComponentClassName.MessageDismiss, className), ref: ref, onClick: dismissMessage, ...rest },
22
22
  hasIcon ? icons?.close ?? React.createElement(IconClose, { "aria-hidden": "true" }) : null,
23
- children ? (children) : (React.createElement(VisuallyHidden, null, dismissLabel ? dismissLabel : ComponentText.Message.dismissLabel))));
23
+ children ?? (React.createElement(VisuallyHidden, null, dismissLabel ?? ComponentText.Message.dismissLabel))));
24
24
  };
25
25
  const MessageDismiss = primitiveWithForwardRef(MessageDismissPrimitive);
26
26
  MessageDismiss.displayName = 'MessageContent';
@@ -9,17 +9,12 @@ import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
9
9
 
10
10
  const RadioPrimitive = ({ children, className, id, isDisabled = false, testId, value, labelPosition: radioLabelPosition, ...rest }, ref) => {
11
11
  const { currentValue, defaultValue, name, hasError, isGroupDisabled = false, isRequired, isReadOnly, onChange, size, labelPosition: groupLabelPosition, } = useRadioGroupContext();
12
- const { isFieldsetDisabled } = useFieldset();
13
- const shouldBeDisabled = isFieldsetDisabled
14
- ? isFieldsetDisabled
15
- : isGroupDisabled || isDisabled || (isReadOnly && defaultValue !== value);
12
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isGroupDisabled || isDisabled || (isReadOnly && defaultValue !== value));
16
13
  // for controlled component
17
14
  const checked = currentValue !== undefined ? value === currentValue : undefined;
18
15
  // for uncontrolled component
19
16
  const defaultChecked = defaultValue !== undefined ? value === defaultValue : undefined;
20
- const labelPosition = radioLabelPosition
21
- ? radioLabelPosition
22
- : groupLabelPosition;
17
+ const labelPosition = radioLabelPosition ?? groupLabelPosition;
23
18
  return (React.createElement(Flex, { as: "label", className: classNames(ComponentClassName.Radio, classNameModifierByFlag(ComponentClassName.Radio, `disabled`, shouldBeDisabled), labelPosition ? `amplify-label-${labelPosition}` : null, className) },
24
19
  children && (React.createElement(Text, { as: "span", className: classNames(ComponentClassName.RadioLabel, classNameModifierByFlag(ComponentClassName.RadioLabel, `disabled`, shouldBeDisabled)) }, children)),
25
20
  React.createElement(Input, { checked: checked, className: classNames(ComponentClassName.VisuallyHidden, ComponentClassName.RadioInput), defaultChecked: defaultChecked, hasError: hasError, id: id, isDisabled: shouldBeDisabled, isReadOnly: isReadOnly, isRequired: isRequired, onChange: onChange, ref: ref, type: "radio", name: name, value: value, ...rest }),
@@ -16,11 +16,11 @@ const SelectPrimitive = ({ autoComplete, className, size, variation, value, defa
16
16
  const isExpanded = isMultiple || selectSize > 1;
17
17
  const componentClasses = classNames(ComponentClassName.Select, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Select, size), classNameModifier(ComponentClassName.Select, variation), classNameModifierByFlag(ComponentClassName.Select, 'error', hasError), classNameModifierByFlag(ComponentClassName.Select, 'expanded', isExpanded), className);
18
18
  const icons = useIcons('select');
19
- const { isFieldsetDisabled } = useFieldset();
19
+ const { isFieldsetDisabled } = useFieldset(isDisabled);
20
20
  return (React.createElement(View, { className: ComponentClassName.SelectWrapper },
21
21
  React.createElement(View, { "aria-invalid": hasError, as: "select", autoComplete: autoComplete, value: value, defaultValue: shouldSetDefaultPlaceholderValue
22
22
  ? DEFAULT_PLACEHOLDER_VALUE
23
- : defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
23
+ : defaultValue, isDisabled: isFieldsetDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
24
24
  placeholder && React.createElement("option", { value: "" }, placeholder),
25
25
  children),
26
26
  isExpanded ? null : (React.createElement(Flex, { className: classNames(ComponentClassName.SelectIcon, classNameModifier(ComponentClassName.SelectIcon, size)), color: iconColor, "aria-hidden": "true" }, icon ?? icons?.expand ?? React.createElement(IconExpandMore, null)))));
@@ -22,7 +22,7 @@ const SLIDER_ROOT_TEST_ID = 'slider-root';
22
22
  const SLIDER_TRACK_TEST_ID = 'slider-track';
23
23
  const SLIDER_RANGE_TEST_ID = 'slider-range';
24
24
  const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, descriptiveText, emptyTrackColor, errorMessage, filledTrackColor, formatValue, hasError = false, id, isDisabled, isValueHidden = false, label, labelHidden = false, onChange, orientation = 'horizontal', outerEndComponent, outerStartComponent, testId, thumbColor, trackSize, value, size, ..._rest }, ref) => {
25
- const { isFieldsetDisabled } = useFieldset();
25
+ const { isFieldsetDisabled: disabled } = useFieldset(isDisabled);
26
26
  const fieldId = useStableId(id);
27
27
  const stableId = useStableId();
28
28
  const descriptionId = descriptiveText
@@ -32,7 +32,6 @@ const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, desc
32
32
  ? getUniqueComponentId(stableId, ERROR_SUFFIX)
33
33
  : undefined;
34
34
  const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
35
- const disabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
36
35
  const { styleProps, rest } = splitPrimitiveProps(_rest);
37
36
  const isControlled = value !== undefined;
38
37
  const [currentValue, setCurrentValue] = React.useState(isControlled ? value : defaultValue);
@@ -21,8 +21,7 @@ const SwitchFieldPrimitive = ({ className, defaultChecked, id, isChecked, isDisa
21
21
  defaultChecked,
22
22
  isDisabled,
23
23
  });
24
- const { isFieldsetDisabled } = useFieldset();
25
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
24
+ const { isFieldsetDisabled: shouldBeDisabled } = useFieldset(isDisabled);
26
25
  const fieldId = useStableId(id);
27
26
  const wrapperClasses = classNames(ComponentClassName.SwitchTrack, classNameModifierByFlag(ComponentClassName.SwitchTrack, 'checked', isOn), classNameModifierByFlag(ComponentClassName.SwitchTrack, 'disabled', shouldBeDisabled), classNameModifierByFlag(ComponentClassName.SwitchTrack, 'focused', isFocused), classNameModifierByFlag(ComponentClassName.SwitchTrack, 'error', hasError));
28
27
  const componentClasses = classNames(ComponentClassName.SwitchThumb, classNameModifierByFlag(ComponentClassName.SwitchThumb, 'checked', isOn), classNameModifierByFlag(ComponentClassName.SwitchThumb, 'disabled', shouldBeDisabled));
@@ -6,8 +6,8 @@ import { primitiveWithForwardRef } from '../utils/primitiveWithForwardRef.mjs';
6
6
 
7
7
  const TextAreaPrimitive = ({ className, isDisabled, isReadOnly, isRequired, size, hasError = false, variation, ...rest }, ref) => {
8
8
  const componentClasses = classNames(ComponentClassName.Textarea, ComponentClassName.FieldGroupControl, classNameModifier(ComponentClassName.Textarea, variation), classNameModifier(ComponentClassName.Textarea, size), classNameModifierByFlag(ComponentClassName.Textarea, 'error', hasError), className);
9
- const { isFieldsetDisabled } = useFieldset();
10
- return (React.createElement(View, { "aria-invalid": hasError, as: "textarea", className: componentClasses, disabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, readOnly: isReadOnly, ref: ref, required: isRequired, ...rest }));
9
+ const { isFieldsetDisabled } = useFieldset(isDisabled);
10
+ return (React.createElement(View, { "aria-invalid": hasError, as: "textarea", className: componentClasses, disabled: isFieldsetDisabled, readOnly: isReadOnly, ref: ref, required: isRequired, ...rest }));
11
11
  };
12
12
  const TextArea = primitiveWithForwardRef(TextAreaPrimitive);
13
13
  TextArea.displayName = 'TextArea';
@@ -1,3 +1,3 @@
1
- const VERSION = '6.15.2';
1
+ const VERSION = '6.15.4';
2
2
 
3
3
  export { VERSION };
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ var React = require('react');
6
6
  var isEqual = require('lodash/isEqual.js');
7
7
  var uiReactCore = require('@aws-amplify/ui-react-core');
8
8
  var ui = require('@aws-amplify/ui');
9
- var Field = require('./Field-Cq088Vbv.js');
9
+ var Field = require('./Field-B8Bw-DBK.js');
10
10
  require('aws-amplify/storage');
11
11
  var debounce = require('lodash/debounce.js');
12
12
  var reactDropdownMenu = require('@radix-ui/react-dropdown-menu');
@@ -401,8 +401,8 @@ FieldGroup.displayName = 'FieldGroup';
401
401
 
402
402
  const InputPrimitive = ({ autoComplete, checked, className, defaultChecked, defaultValue, id, isDisabled, isReadOnly, isRequired, size, type = 'text', hasError = false, value, variation, ...rest }, ref) => {
403
403
  const componentClasses = ui.classNames(ui.ComponentClassName.Input, ui.ComponentClassName.FieldGroupControl, ui.classNameModifier(ui.ComponentClassName.Input, variation), ui.classNameModifierByFlag(ui.ComponentClassName.Input, 'error', hasError), ui.classNameModifier(ui.ComponentClassName.Input, size), className);
404
- const { isFieldsetDisabled } = Field.useFieldset();
405
- return (React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "input", autoComplete: autoComplete, checked: checked, className: componentClasses, defaultChecked: defaultChecked, defaultValue: defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, id: id, readOnly: isReadOnly, ref: ref, required: isRequired, type: type, value: value, ...rest }));
404
+ const { isFieldsetDisabled } = Field.useFieldset(isDisabled);
405
+ return (React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "input", autoComplete: autoComplete, checked: checked, className: componentClasses, defaultChecked: defaultChecked, defaultValue: defaultValue, isDisabled: isFieldsetDisabled, id: id, readOnly: isReadOnly, ref: ref, required: isRequired, type: type, value: value, ...rest }));
406
406
  };
407
407
  const Input = Field.primitiveWithForwardRef(InputPrimitive);
408
408
  Input.displayName = 'Input';
@@ -759,8 +759,7 @@ const CheckboxPrimitive = ({ checked: controlledChecked, className, defaultCheck
759
759
  const { styleProps, rest } = splitPrimitiveProps(_rest);
760
760
  const [focused, setFocused] = React__namespace.useState(false);
761
761
  const icons = Field.useIcons('checkbox');
762
- const { isFieldsetDisabled } = Field.useFieldset();
763
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
762
+ const { isFieldsetDisabled: shouldBeDisabled } = Field.useFieldset(isDisabled);
764
763
  const isControlled = controlledChecked !== undefined;
765
764
  const [localChecked, setLocalChecked] = React__namespace.useState(() =>
766
765
  // if controlled, initialize to `controlledChecked` else `defaultChecked`
@@ -1335,10 +1334,9 @@ const Accordion = Object.assign(Field.primitiveWithForwardRef(AccordionPrimitive
1335
1334
  Accordion.displayName = 'Accordion';
1336
1335
 
1337
1336
  const FieldsetPrimitive = ({ children, className, isDisabled, legend, legendHidden, size, testId, variation = 'plain', ...rest }, ref) => {
1338
- const { isFieldsetDisabled } = Field.useFieldset();
1337
+ const { isFieldsetDisabled: shouldBeDisabled } = Field.useFieldset(isDisabled);
1339
1338
  // Fieldsets that are nested within a disabled Fieldset should
1340
1339
  // also be disabled.
1341
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
1342
1340
  const value = React__namespace.useMemo(() => ({
1343
1341
  isFieldsetDisabled: shouldBeDisabled,
1344
1342
  }), [shouldBeDisabled]);
@@ -1457,7 +1455,7 @@ const MessageDismissPrimitive = ({ onDismiss, dismissLabel, hasIcon = true, chil
1457
1455
  }, [setDismissed, onDismiss]);
1458
1456
  return (React__namespace.createElement(Field.Button, { variation: "link", colorTheme: "overlay", className: ui.classNames(ui.ComponentClassName.MessageDismiss, className), ref: ref, onClick: dismissMessage, ...rest },
1459
1457
  hasIcon ? icons?.close ?? React__namespace.createElement(Field.IconClose, { "aria-hidden": "true" }) : null,
1460
- children ? (children) : (React__namespace.createElement(VisuallyHidden, null, dismissLabel ? dismissLabel : Field.ComponentText.Message.dismissLabel))));
1458
+ children ?? (React__namespace.createElement(VisuallyHidden, null, dismissLabel ?? Field.ComponentText.Message.dismissLabel))));
1461
1459
  };
1462
1460
  const MessageDismiss = Field.primitiveWithForwardRef(MessageDismissPrimitive);
1463
1461
  MessageDismiss.displayName = 'MessageContent';
@@ -1535,11 +1533,11 @@ const SelectPrimitive = ({ autoComplete, className, size, variation, value, defa
1535
1533
  const isExpanded = isMultiple || selectSize > 1;
1536
1534
  const componentClasses = ui.classNames(ui.ComponentClassName.Select, ui.ComponentClassName.FieldGroupControl, ui.classNameModifier(ui.ComponentClassName.Select, size), ui.classNameModifier(ui.ComponentClassName.Select, variation), ui.classNameModifierByFlag(ui.ComponentClassName.Select, 'error', hasError), ui.classNameModifierByFlag(ui.ComponentClassName.Select, 'expanded', isExpanded), className);
1537
1535
  const icons = Field.useIcons('select');
1538
- const { isFieldsetDisabled } = Field.useFieldset();
1536
+ const { isFieldsetDisabled } = Field.useFieldset(isDisabled);
1539
1537
  return (React__namespace.createElement(Field.View, { className: ui.ComponentClassName.SelectWrapper },
1540
1538
  React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "select", autoComplete: autoComplete, value: value, defaultValue: shouldSetDefaultPlaceholderValue
1541
1539
  ? DEFAULT_PLACEHOLDER_VALUE
1542
- : defaultValue, isDisabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
1540
+ : defaultValue, isDisabled: isFieldsetDisabled, multiple: isMultiple, size: selectSize, required: isRequired, className: componentClasses, ref: ref, ...rest },
1543
1541
  placeholder && React__namespace.createElement("option", { value: "" }, placeholder),
1544
1542
  children),
1545
1543
  isExpanded ? null : (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.SelectIcon, ui.classNameModifier(ui.ComponentClassName.SelectIcon, size)), color: iconColor, "aria-hidden": "true" }, icon ?? icons?.expand ?? React__namespace.createElement(Field.IconExpandMore, null)))));
@@ -1630,17 +1628,12 @@ const useRadioGroupContext = () => {
1630
1628
 
1631
1629
  const RadioPrimitive = ({ children, className, id, isDisabled = false, testId, value, labelPosition: radioLabelPosition, ...rest }, ref) => {
1632
1630
  const { currentValue, defaultValue, name, hasError, isGroupDisabled = false, isRequired, isReadOnly, onChange, size, labelPosition: groupLabelPosition, } = useRadioGroupContext();
1633
- const { isFieldsetDisabled } = Field.useFieldset();
1634
- const shouldBeDisabled = isFieldsetDisabled
1635
- ? isFieldsetDisabled
1636
- : isGroupDisabled || isDisabled || (isReadOnly && defaultValue !== value);
1631
+ const { isFieldsetDisabled: shouldBeDisabled } = Field.useFieldset(isGroupDisabled || isDisabled || (isReadOnly && defaultValue !== value));
1637
1632
  // for controlled component
1638
1633
  const checked = currentValue !== undefined ? value === currentValue : undefined;
1639
1634
  // for uncontrolled component
1640
1635
  const defaultChecked = defaultValue !== undefined ? value === defaultValue : undefined;
1641
- const labelPosition = radioLabelPosition
1642
- ? radioLabelPosition
1643
- : groupLabelPosition;
1636
+ const labelPosition = radioLabelPosition ?? groupLabelPosition;
1644
1637
  return (React__namespace.createElement(Field.Flex, { as: "label", className: ui.classNames(ui.ComponentClassName.Radio, ui.classNameModifierByFlag(ui.ComponentClassName.Radio, `disabled`, shouldBeDisabled), labelPosition ? `amplify-label-${labelPosition}` : null, className) },
1645
1638
  children && (React__namespace.createElement(Field.Text, { as: "span", className: ui.classNames(ui.ComponentClassName.RadioLabel, ui.classNameModifierByFlag(ui.ComponentClassName.RadioLabel, `disabled`, shouldBeDisabled)) }, children)),
1646
1639
  React__namespace.createElement(Input, { checked: checked, className: ui.classNames(ui.ComponentClassName.VisuallyHidden, ui.ComponentClassName.RadioInput), defaultChecked: defaultChecked, hasError: hasError, id: id, isDisabled: shouldBeDisabled, isReadOnly: isReadOnly, isRequired: isRequired, onChange: onChange, ref: ref, type: "radio", name: name, value: value, ...rest }),
@@ -1760,7 +1753,7 @@ const SLIDER_ROOT_TEST_ID = 'slider-root';
1760
1753
  const SLIDER_TRACK_TEST_ID = 'slider-track';
1761
1754
  const SLIDER_RANGE_TEST_ID = 'slider-range';
1762
1755
  const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, descriptiveText, emptyTrackColor, errorMessage, filledTrackColor, formatValue, hasError = false, id, isDisabled, isValueHidden = false, label, labelHidden = false, onChange, orientation = 'horizontal', outerEndComponent, outerStartComponent, testId, thumbColor, trackSize, value, size, ..._rest }, ref) => {
1763
- const { isFieldsetDisabled } = Field.useFieldset();
1756
+ const { isFieldsetDisabled: disabled } = Field.useFieldset(isDisabled);
1764
1757
  const fieldId = Field.useStableId(id);
1765
1758
  const stableId = Field.useStableId();
1766
1759
  const descriptionId = descriptiveText
@@ -1770,7 +1763,6 @@ const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, desc
1770
1763
  ? getUniqueComponentId(stableId, ERROR_SUFFIX)
1771
1764
  : undefined;
1772
1765
  const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
1773
- const disabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
1774
1766
  const { styleProps, rest } = splitPrimitiveProps(_rest);
1775
1767
  const isControlled = value !== undefined;
1776
1768
  const [currentValue, setCurrentValue] = React__namespace.useState(isControlled ? value : defaultValue);
@@ -1998,8 +1990,7 @@ const SwitchFieldPrimitive = ({ className, defaultChecked, id, isChecked, isDisa
1998
1990
  defaultChecked,
1999
1991
  isDisabled,
2000
1992
  });
2001
- const { isFieldsetDisabled } = Field.useFieldset();
2002
- const shouldBeDisabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
1993
+ const { isFieldsetDisabled: shouldBeDisabled } = Field.useFieldset(isDisabled);
2003
1994
  const fieldId = Field.useStableId(id);
2004
1995
  const wrapperClasses = ui.classNames(ui.ComponentClassName.SwitchTrack, ui.classNameModifierByFlag(ui.ComponentClassName.SwitchTrack, 'checked', isOn), ui.classNameModifierByFlag(ui.ComponentClassName.SwitchTrack, 'disabled', shouldBeDisabled), ui.classNameModifierByFlag(ui.ComponentClassName.SwitchTrack, 'focused', isFocused), ui.classNameModifierByFlag(ui.ComponentClassName.SwitchTrack, 'error', hasError));
2005
1996
  const componentClasses = ui.classNames(ui.ComponentClassName.SwitchThumb, ui.classNameModifierByFlag(ui.ComponentClassName.SwitchThumb, 'checked', isOn), ui.classNameModifierByFlag(ui.ComponentClassName.SwitchThumb, 'disabled', shouldBeDisabled));
@@ -2194,8 +2185,8 @@ Tabs.displayName = 'Tabs';
2194
2185
 
2195
2186
  const TextAreaPrimitive = ({ className, isDisabled, isReadOnly, isRequired, size, hasError = false, variation, ...rest }, ref) => {
2196
2187
  const componentClasses = ui.classNames(ui.ComponentClassName.Textarea, ui.ComponentClassName.FieldGroupControl, ui.classNameModifier(ui.ComponentClassName.Textarea, variation), ui.classNameModifier(ui.ComponentClassName.Textarea, size), ui.classNameModifierByFlag(ui.ComponentClassName.Textarea, 'error', hasError), className);
2197
- const { isFieldsetDisabled } = Field.useFieldset();
2198
- return (React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "textarea", className: componentClasses, disabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, readOnly: isReadOnly, ref: ref, required: isRequired, ...rest }));
2188
+ const { isFieldsetDisabled } = Field.useFieldset(isDisabled);
2189
+ return (React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "textarea", className: componentClasses, disabled: isFieldsetDisabled, readOnly: isReadOnly, ref: ref, required: isRequired, ...rest }));
2199
2190
  };
2200
2191
  const TextArea = Field.primitiveWithForwardRef(TextAreaPrimitive);
2201
2192
  TextArea.displayName = 'TextArea';
@@ -2472,7 +2463,7 @@ const defaultDeleteUserDisplayText = {
2472
2463
  warningText: 'Deleting your account is not reversible. You will lose access to your account and all data associated with it.',
2473
2464
  };
2474
2465
 
2475
- const VERSION = '6.15.2';
2466
+ const VERSION = '6.15.4';
2476
2467
 
2477
2468
  const logger$2 = ui.getLogger('AccountSettings');
2478
2469
  const getIsDisabled = (formValues, validationError) => {
@@ -2895,13 +2886,19 @@ const isOtpChallenge = (challengeName) => !!challengeName &&
2895
2886
 
2896
2887
  const { getConfirmText, getConfirmingText, getBackToSignInText: getBackToSignInText$2, getResendCodeText: getResendCodeText$1, } = ui.authenticatorTextUtil;
2897
2888
  const ConfirmSignInFooter = () => {
2898
- const { isPending, toSignIn, challengeName, resendCode } = uiReactCore.useAuthenticator((context) => [
2889
+ const { isPending, toSignIn, challengeName, resendCode, selectedAuthMethod, availableAuthMethods, } = uiReactCore.useAuthenticator((context) => [
2899
2890
  context.isPending,
2900
2891
  context.toSignIn,
2901
2892
  context.challengeName,
2902
2893
  context.resendCode,
2894
+ context.selectedAuthMethod,
2895
+ context.availableAuthMethods,
2903
2896
  ]);
2904
- const showResendCode = isOtpChallenge(challengeName) && resendCode;
2897
+ // Only show "Resend Code" for passwordless (USER_AUTH) flows.
2898
+ // Password-based sign-in does not support resending MFA codes.
2899
+ const hasPasswordlessMethod = (!!selectedAuthMethod && selectedAuthMethod !== 'PASSWORD') ||
2900
+ !!availableAuthMethods?.some((m) => m !== 'PASSWORD');
2901
+ const showResendCode = isOtpChallenge(challengeName) && hasPasswordlessMethod && resendCode;
2905
2902
  return (React__namespace["default"].createElement(Field.Flex, { direction: "column" },
2906
2903
  React__namespace["default"].createElement(Field.Button, { isDisabled: isPending, type: "submit", variation: "primary", isLoading: isPending, loadingText: getConfirmingText() }, getConfirmText()),
2907
2904
  showResendCode && (React__namespace["default"].createElement(Field.Button, { onClick: resendCode, type: "button" }, getResendCodeText$1())),
package/dist/internal.js CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var Field = require('./Field-Cq088Vbv.js');
5
+ var Field = require('./Field-B8Bw-DBK.js');
6
6
  var React = require('react');
7
7
  var Storage = require('aws-amplify/storage');
8
8
  var ui = require('@aws-amplify/ui');
@@ -73,9 +73,12 @@
73
73
  overflow-y: auto;
74
74
  box-sizing: border-box;
75
75
  list-style: disc;
76
+ display: flex;
77
+ flex-direction: column;
78
+ gap: var(--amplify-space-xxs);
76
79
  }
77
80
 
78
81
  .amplify-modal__list-item.amplify-modal__list-item {
82
+ display: list-item;
79
83
  margin-bottom: var(--amplify-space-xxs);
80
- box-sizing: border-box;
81
84
  }
@@ -74,10 +74,13 @@
74
74
  overflow-y: auto;
75
75
  box-sizing: border-box;
76
76
  list-style: disc;
77
+ display: flex;
78
+ flex-direction: column;
79
+ gap: var(--amplify-space-xxs);
77
80
  }
78
81
 
79
82
  .amplify-modal__list-item.amplify-modal__list-item {
83
+ display: list-item;
80
84
  margin-bottom: var(--amplify-space-xxs);
81
- box-sizing: border-box;
82
85
  }
83
86
  }
package/dist/styles.css CHANGED
@@ -4891,11 +4891,14 @@ html[dir=rtl] .amplify-field-group__inner-start {
4891
4891
  overflow-y: auto;
4892
4892
  box-sizing: border-box;
4893
4893
  list-style: disc;
4894
+ display: flex;
4895
+ flex-direction: column;
4896
+ gap: var(--amplify-space-xxs);
4894
4897
  }
4895
4898
 
4896
4899
  .amplify-modal__list-item.amplify-modal__list-item {
4900
+ display: list-item;
4897
4901
  margin-bottom: var(--amplify-space-xxs);
4898
- box-sizing: border-box;
4899
4902
  }
4900
4903
 
4901
4904
  .amplify-pagination {
@@ -4892,11 +4892,14 @@ html[dir=rtl] .amplify-field-group__inner-start {
4892
4892
  overflow-y: auto;
4893
4893
  box-sizing: border-box;
4894
4894
  list-style: disc;
4895
+ display: flex;
4896
+ flex-direction: column;
4897
+ gap: var(--amplify-space-xxs);
4895
4898
  }
4896
4899
 
4897
4900
  .amplify-modal__list-item.amplify-modal__list-item {
4901
+ display: list-item;
4898
4902
  margin-bottom: var(--amplify-space-xxs);
4899
- box-sizing: border-box;
4900
4903
  }
4901
4904
 
4902
4905
  .amplify-pagination {
@@ -1,3 +1,3 @@
1
- export declare const AMPLIFY_SYMBOL: Symbol;
1
+ export declare const AMPLIFY_SYMBOL: symbol;
2
2
  export declare const ERROR_SUFFIX = "error";
3
3
  export declare const DESCRIPTION_SUFFIX = "description";
@@ -8,5 +8,5 @@ export declare const FieldsetContext: React.Context<FieldsetContextType>;
8
8
  * fieldsets and input controls. `useFieldset` passes the disabled state down
9
9
  * via context.
10
10
  */
11
- export declare const useFieldset: () => FieldsetContextType;
11
+ export declare const useFieldset: (fallback?: boolean) => FieldsetContextType;
12
12
  export {};
@@ -1,50 +1,50 @@
1
- export * from './autocomplete';
2
- export * from './alert';
3
- export * from './badge';
4
- export * from './base';
5
- export * from './breadcrumbs';
6
- export * from './button';
7
- export * from './buttonGroup';
8
- export * from './card';
9
- export * from './checkboxField';
10
- export * from './collection';
11
- export * from './divider';
12
- export * from './field';
13
- export * from './fieldGroup';
14
- export * from './fieldGroupIcon';
15
- export * from './fieldset';
16
- export * from './flex';
17
- export * from './heading';
18
- export * from './highlightMatch';
19
- export * from './icon';
20
- export * from './input';
21
- export * from './image';
22
- export * from './label';
23
- export * from './link';
24
- export * from './loader';
25
- export * from './menu';
26
- export * from './message';
27
- export * from './pagination';
28
- export * from './passwordField';
29
- export * from './phoneNumberField';
30
- export * from './placeholder';
31
- export * from './radio';
32
- export * from './radioGroupField';
33
- export * from './rating';
34
- export * from './scrollView';
35
- export * from './searchField';
36
- export * from './selectField';
37
- export * from './sliderField';
38
- export * from './stepperField';
1
+ export type * from './autocomplete';
2
+ export type * from './alert';
3
+ export type * from './badge';
4
+ export type * from './base';
5
+ export type * from './breadcrumbs';
6
+ export type * from './button';
7
+ export type * from './buttonGroup';
8
+ export type * from './card';
9
+ export type * from './checkboxField';
10
+ export type * from './collection';
11
+ export type * from './divider';
12
+ export type * from './field';
13
+ export type * from './fieldGroup';
14
+ export type * from './fieldGroupIcon';
15
+ export type * from './fieldset';
16
+ export type * from './flex';
17
+ export type * from './heading';
18
+ export type * from './highlightMatch';
19
+ export type * from './icon';
20
+ export type * from './input';
21
+ export type * from './image';
22
+ export type * from './label';
23
+ export type * from './link';
24
+ export type * from './loader';
25
+ export type * from './menu';
26
+ export type * from './message';
27
+ export type * from './pagination';
28
+ export type * from './passwordField';
29
+ export type * from './phoneNumberField';
30
+ export type * from './placeholder';
31
+ export type * from './radio';
32
+ export type * from './radioGroupField';
33
+ export type * from './rating';
34
+ export type * from './scrollView';
35
+ export type * from './searchField';
36
+ export type * from './selectField';
37
+ export type * from './sliderField';
38
+ export type * from './stepperField';
39
39
  export * from './style';
40
- export * from './switchField';
41
- export * from './table';
42
- export * from './text';
43
- export * from './textArea';
44
- export * from './textAreaField';
45
- export * from './textField';
46
- export * from './toggleButton';
47
- export * from './toggleButtonGroup';
48
- export * from './view';
49
- export * from './visuallyHidden';
50
- export * from './grid';
40
+ export type * from './switchField';
41
+ export type * from './table';
42
+ export type * from './text';
43
+ export type * from './textArea';
44
+ export type * from './textAreaField';
45
+ export type * from './textField';
46
+ export type * from './toggleButton';
47
+ export type * from './toggleButtonGroup';
48
+ export type * from './view';
49
+ export type * from './visuallyHidden';
50
+ export type * from './grid';
@@ -1 +1 @@
1
- export declare const VERSION = "6.15.2";
1
+ export declare const VERSION = "6.15.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aws-amplify/ui-react",
3
- "version": "6.15.2",
3
+ "version": "6.15.4",
4
4
  "main": "dist/index.js",
5
5
  "module": "dist/esm/index.mjs",
6
6
  "exports": {
@@ -56,13 +56,13 @@
56
56
  "typecheck": "tsc --noEmit"
57
57
  },
58
58
  "dependencies": {
59
- "@aws-amplify/ui": "6.15.2",
60
- "@aws-amplify/ui-react-core": "3.6.2",
59
+ "@aws-amplify/ui": "6.15.4",
60
+ "@aws-amplify/ui-react-core": "3.6.4",
61
61
  "@radix-ui/react-direction": "^1.1.0",
62
62
  "@radix-ui/react-dropdown-menu": "^2.1.10",
63
63
  "@radix-ui/react-slider": "^1.3.2",
64
64
  "@xstate/react": "^3.2.2",
65
- "lodash": "4.17.23",
65
+ "lodash": "4.18.1",
66
66
  "qrcode": "1.5.0",
67
67
  "tslib": "^2.5.2"
68
68
  },