@aws-amplify/ui-react 6.1.14 → 6.2.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/{Field-1f747369.js → Field-d47a49dc.js} +12 -23
- package/dist/ThemeStyle-b2dce96a.js +91 -0
- package/dist/esm/components/ThemeProvider/ThemeProvider.mjs +3 -5
- package/dist/esm/components/ThemeProvider/ThemeStyle.mjs +69 -0
- package/dist/esm/helpers/constants.mjs +9 -0
- package/dist/esm/primitives/Checkbox/Checkbox.mjs +4 -4
- package/dist/esm/primitives/CheckboxField/CheckboxField.mjs +2 -2
- package/dist/esm/primitives/HighlightMatch/HighlightMatch.mjs +2 -2
- package/dist/esm/primitives/RadioGroupField/RadioGroupField.mjs +13 -5
- package/dist/esm/primitives/SelectField/SelectField.mjs +12 -3
- package/dist/esm/primitives/SliderField/SliderField.mjs +14 -6
- package/dist/esm/primitives/StepperField/StepperField.mjs +12 -3
- package/dist/esm/primitives/Tabs/TabsContainer.mjs +4 -1
- package/dist/esm/primitives/Tabs/TabsContext.mjs +1 -0
- package/dist/esm/primitives/Tabs/TabsItem.mjs +7 -2
- package/dist/esm/primitives/Tabs/TabsPanel.mjs +7 -2
- package/dist/esm/primitives/Tabs/constants.mjs +4 -0
- package/dist/esm/primitives/TextAreaField/TextAreaField.mjs +12 -3
- package/dist/esm/primitives/TextField/TextField.mjs +12 -3
- package/dist/esm/primitives/utils/createSpaceSeparatedIds.mjs +13 -0
- package/dist/esm/primitives/utils/getUniqueComponentId.mjs +3 -0
- package/dist/esm/server.mjs +2 -0
- package/dist/esm/version.mjs +1 -1
- package/dist/index.js +180 -114
- package/dist/internal.js +2 -1
- package/dist/primitiveWithForwardRef-7e929242.js +36 -0
- package/dist/server.js +32 -0
- package/dist/types/components/ThemeProvider/ThemeStyle.d.ts +18 -0
- package/dist/types/helpers/constants.d.ts +2 -0
- package/dist/types/primitives/Tabs/TabsContext.d.ts +1 -0
- package/dist/types/primitives/Tabs/constants.d.ts +1 -0
- package/dist/types/primitives/shared/responsive/utils.d.ts +1 -1
- package/dist/types/primitives/utils/createSpaceSeparatedIds.d.ts +8 -0
- package/dist/types/primitives/utils/getUniqueComponentId.d.ts +1 -0
- package/dist/types/server.d.ts +2 -0
- package/dist/types/version.d.ts +1 -1
- package/package.json +10 -5
- package/dist/esm/primitives/utils/getTestId.mjs +0 -3
- package/dist/types/primitives/utils/getTestId.d.ts +0 -1
package/dist/index.js
CHANGED
|
@@ -6,14 +6,16 @@ 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-
|
|
9
|
+
var Field = require('./Field-d47a49dc.js');
|
|
10
10
|
require('aws-amplify/storage');
|
|
11
|
+
var primitiveWithForwardRef = require('./primitiveWithForwardRef-7e929242.js');
|
|
11
12
|
var debounce = require('lodash/debounce.js');
|
|
12
13
|
var Dropdown = require('@radix-ui/react-dropdown-menu');
|
|
13
14
|
var RadixSlider = require('@radix-ui/react-slider');
|
|
14
15
|
var QRCode = require('qrcode');
|
|
15
16
|
var utils = require('aws-amplify/utils');
|
|
16
17
|
var RadixDirection = require('@radix-ui/react-direction');
|
|
18
|
+
var ThemeStyle = require('./ThemeStyle-b2dce96a.js');
|
|
17
19
|
require('@aws-amplify/core');
|
|
18
20
|
require('aws-amplify/auth');
|
|
19
21
|
|
|
@@ -91,20 +93,20 @@ const AlertPrimitive = ({ buttonRef, children, className, dismissButtonLabel = F
|
|
|
91
93
|
/**
|
|
92
94
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/alert)
|
|
93
95
|
*/
|
|
94
|
-
const Alert =
|
|
96
|
+
const Alert = primitiveWithForwardRef.primitiveWithForwardRef(AlertPrimitive);
|
|
95
97
|
Alert.displayName = 'Alert';
|
|
96
98
|
|
|
97
99
|
const AutocompleteOptionPrimitive = ({ children, className, isActive, ...rest }, ref) => {
|
|
98
100
|
return (React__namespace.createElement(Field.View, { "aria-selected": isActive, as: "li", role: "option", className: ui.classNames(ui.ComponentClassName.AutocompleteMenuOption, ui.classNameModifierByFlag(ui.ComponentClassName.AutocompleteMenuOption, 'active', isActive), className), ref: ref, ...rest }, children));
|
|
99
101
|
};
|
|
100
|
-
const AutocompleteOption =
|
|
102
|
+
const AutocompleteOption = primitiveWithForwardRef.primitiveWithForwardRef(AutocompleteOptionPrimitive);
|
|
101
103
|
AutocompleteOption.displayName = 'AutocompleteOption';
|
|
102
104
|
|
|
103
105
|
const ScrollViewPrimitive = ({ children, className, orientation, ...rest }, ref) => (React__namespace.createElement(Field.View, { className: ui.classNames(ui.ComponentClassName.ScrollView, ui.classNameModifier(ui.ComponentClassName.ScrollView, orientation), className), ref: ref, ...rest }, children));
|
|
104
106
|
/**
|
|
105
107
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/scrollview)
|
|
106
108
|
*/
|
|
107
|
-
const ScrollView =
|
|
109
|
+
const ScrollView = primitiveWithForwardRef.primitiveWithForwardRef(ScrollViewPrimitive);
|
|
108
110
|
ScrollView.displayName = 'ScrollView';
|
|
109
111
|
|
|
110
112
|
const MenuHeader = ({ children }) => {
|
|
@@ -131,7 +133,7 @@ const AutocompleteMenuPrimitive = ({ ariaLabel, children, Header = null, Footer
|
|
|
131
133
|
children.length > 0 ? (React__namespace.createElement(ScrollView, { as: "ul", ariaLabel: ariaLabel, className: ui.ComponentClassName.AutocompleteMenuOptions, id: listboxId, role: "listbox" }, children)) : (React__namespace.createElement(MenuEmpty, null, Empty)),
|
|
132
134
|
React__namespace.createElement(MenuFooter, null, Footer)))));
|
|
133
135
|
};
|
|
134
|
-
const AutocompleteMenu =
|
|
136
|
+
const AutocompleteMenu = primitiveWithForwardRef.primitiveWithForwardRef(AutocompleteMenuPrimitive);
|
|
135
137
|
AutocompleteMenu.displayName = 'AutocompleteMenu';
|
|
136
138
|
|
|
137
139
|
// Source: https://github.com/radix-ui/primitives/blob/7ae63b6cce6ea53ea5d65b6d411894c004b38f47/packages/react/use-layout-effect/src/useLayoutEffect.tsx
|
|
@@ -355,10 +357,10 @@ const useAutocomplete = ({ defaultValue = '', value, options, optionFilter, onBl
|
|
|
355
357
|
};
|
|
356
358
|
};
|
|
357
359
|
|
|
358
|
-
const
|
|
360
|
+
const getUniqueComponentId = (id, suffix) => (id && suffix ? `${id}-${suffix}` : undefined);
|
|
359
361
|
|
|
360
362
|
const HighlightMatchPrimitive = ({ children, className, query, testId, ...rest }, ref) => {
|
|
361
|
-
const matchTestId =
|
|
363
|
+
const matchTestId = getUniqueComponentId(testId, 'match');
|
|
362
364
|
const startIndex = children
|
|
363
365
|
?.toLocaleLowerCase()
|
|
364
366
|
.indexOf(query?.toLocaleLowerCase());
|
|
@@ -374,7 +376,7 @@ const HighlightMatchPrimitive = ({ children, className, query, testId, ...rest }
|
|
|
374
376
|
/**
|
|
375
377
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/highlightmatch)
|
|
376
378
|
*/
|
|
377
|
-
const HighlightMatch =
|
|
379
|
+
const HighlightMatch = primitiveWithForwardRef.primitiveWithForwardRef(HighlightMatchPrimitive);
|
|
378
380
|
HighlightMatch.displayName = 'HighlightMatch';
|
|
379
381
|
|
|
380
382
|
const ariaLabelText = Field.ComponentText.SearchField.searchButtonLabel;
|
|
@@ -382,7 +384,7 @@ const SearchFieldButtonPrimitive = ({ size, ...props }, ref) => {
|
|
|
382
384
|
const icons = Field.useIcons('searchField');
|
|
383
385
|
return (React__namespace.createElement(Field.FieldGroupIconButton, { ariaLabel: ariaLabelText, className: ui.ComponentClassName.SearchFieldSearch, size: size, ref: ref, type: "submit", ...props }, icons?.search ?? React__namespace.createElement(Field.IconSearch, null)));
|
|
384
386
|
};
|
|
385
|
-
const SearchFieldButton =
|
|
387
|
+
const SearchFieldButton = primitiveWithForwardRef.primitiveWithForwardRef(SearchFieldButtonPrimitive);
|
|
386
388
|
SearchFieldButton.displayName = 'SearchFieldButton';
|
|
387
389
|
|
|
388
390
|
const FieldGroupPrimitive = ({ children, className, innerEndComponent, innerStartComponent, orientation = 'horizontal', outerEndComponent, outerStartComponent, variation, ...rest }, ref) => {
|
|
@@ -404,7 +406,7 @@ const FieldGroupPrimitive = ({ children, className, innerEndComponent, innerStar
|
|
|
404
406
|
innerEndComponent && (React__namespace.createElement(Field.View, { className: ui.ComponentClassName.FieldGroupInnerEnd }, innerEndComponent))),
|
|
405
407
|
outerEndComponent && (React__namespace.createElement(Field.View, { className: ui.classNames(ui.ComponentClassName.FieldGroupOuterEnd, ui.classNameModifier(ui.ComponentClassName.FieldGroupOuterEnd, variation)) }, outerEndComponent))));
|
|
406
408
|
};
|
|
407
|
-
const FieldGroup =
|
|
409
|
+
const FieldGroup = primitiveWithForwardRef.primitiveWithForwardRef(FieldGroupPrimitive);
|
|
408
410
|
FieldGroup.displayName = 'FieldGroup';
|
|
409
411
|
|
|
410
412
|
const InputPrimitive = ({ autoComplete, checked, className, defaultChecked, defaultValue, id, isDisabled, isReadOnly, isRequired, size, type = 'text', hasError = false, value, variation, ...rest }, ref) => {
|
|
@@ -412,7 +414,7 @@ const InputPrimitive = ({ autoComplete, checked, className, defaultChecked, defa
|
|
|
412
414
|
const { isFieldsetDisabled } = Field.useFieldset();
|
|
413
415
|
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 }));
|
|
414
416
|
};
|
|
415
|
-
const Input =
|
|
417
|
+
const Input = primitiveWithForwardRef.primitiveWithForwardRef(InputPrimitive);
|
|
416
418
|
Input.displayName = 'Input';
|
|
417
419
|
|
|
418
420
|
const isStyleKey = (prop) => {
|
|
@@ -448,23 +450,47 @@ const splitPrimitiveProps = (props) => {
|
|
|
448
450
|
return splitProps;
|
|
449
451
|
};
|
|
450
452
|
|
|
453
|
+
/**
|
|
454
|
+
* Joins an array of strings and undefined values into a single string with spaces as separators.
|
|
455
|
+
* If all elements are undefined, returns undefined.
|
|
456
|
+
*
|
|
457
|
+
* @param {(string | undefined)[]} ids - An array of strings or undefined values.
|
|
458
|
+
* @returns {string | undefined} A single string with space-separated IDs, or undefined if all elements are undefined.
|
|
459
|
+
*/
|
|
460
|
+
const createSpaceSeparatedIds = (ids) => {
|
|
461
|
+
const joinedIds = ids.filter((id) => id !== undefined).join(' ');
|
|
462
|
+
return joinedIds.length > 0 ? joinedIds : undefined;
|
|
463
|
+
};
|
|
464
|
+
|
|
465
|
+
(typeof Symbol !== 'undefined' && ui.isFunction(Symbol.for)
|
|
466
|
+
? Symbol.for('amplify_default')
|
|
467
|
+
: '@@amplify_default');
|
|
468
|
+
const ERROR_SUFFIX = 'error';
|
|
469
|
+
const DESCRIPTION_SUFFIX = 'description';
|
|
470
|
+
|
|
451
471
|
const TextFieldPrimitive = (props, ref) => {
|
|
452
472
|
const { className, descriptiveText, errorMessage, hasError = false, id, innerEndComponent, innerStartComponent, label, labelHidden = false, outerEndComponent, outerStartComponent, size, testId, variation, inputStyles, ..._rest } = props;
|
|
453
473
|
const fieldId = useStableId(id);
|
|
454
|
-
const
|
|
455
|
-
const
|
|
474
|
+
const stableId = useStableId();
|
|
475
|
+
const descriptionId = descriptiveText
|
|
476
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
477
|
+
: undefined;
|
|
478
|
+
const errorId = hasError
|
|
479
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
480
|
+
: undefined;
|
|
481
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
456
482
|
const { styleProps, rest } = splitPrimitiveProps(_rest);
|
|
457
483
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.Field, ui.classNameModifier(ui.ComponentClassName.Field, size), ui.ComponentClassName.TextField, className), testId: testId, ...styleProps },
|
|
458
484
|
React__namespace.createElement(Field.Label, { htmlFor: fieldId, visuallyHidden: labelHidden }, label),
|
|
459
485
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),
|
|
460
486
|
React__namespace.createElement(FieldGroup, { outerStartComponent: outerStartComponent, outerEndComponent: outerEndComponent, innerStartComponent: innerStartComponent, innerEndComponent: innerEndComponent, variation: variation },
|
|
461
487
|
React__namespace.createElement(Input, { "aria-describedby": ariaDescribedBy, hasError: hasError, id: fieldId, ref: ref, size: size, variation: variation, ...inputStyles, ...rest })),
|
|
462
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
488
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
463
489
|
};
|
|
464
490
|
/**
|
|
465
491
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/textfield)
|
|
466
492
|
*/
|
|
467
|
-
const TextField =
|
|
493
|
+
const TextField = primitiveWithForwardRef.primitiveWithForwardRef(TextFieldPrimitive);
|
|
468
494
|
TextField.displayName = 'TextField';
|
|
469
495
|
|
|
470
496
|
/**
|
|
@@ -558,7 +584,7 @@ const SearchFieldPrimitive = ({ autoComplete = 'off', className, isDisabled, cle
|
|
|
558
584
|
/**
|
|
559
585
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/searchfield)
|
|
560
586
|
*/
|
|
561
|
-
const SearchField =
|
|
587
|
+
const SearchField = primitiveWithForwardRef.primitiveWithForwardRef(SearchFieldPrimitive);
|
|
562
588
|
SearchField.displayName = 'SearchField';
|
|
563
589
|
|
|
564
590
|
const AutocompletePrimitive = ({ className, defaultValue, value, isLoading = false, menuSlots = {}, options, optionFilter, onBlur, onChange, onClear, onClick, onSelect, onSubmit, renderOption, testId, ...rest }, ref) => {
|
|
@@ -614,7 +640,7 @@ const AutocompletePrimitive = ({ className, defaultValue, value, isLoading = fal
|
|
|
614
640
|
/**
|
|
615
641
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/autocomplete)
|
|
616
642
|
*/
|
|
617
|
-
const Autocomplete =
|
|
643
|
+
const Autocomplete = primitiveWithForwardRef.primitiveWithForwardRef(AutocompletePrimitive);
|
|
618
644
|
Autocomplete.displayName = 'Autocomplete';
|
|
619
645
|
|
|
620
646
|
const BadgePrimitive = ({ className, children, variation, size, ...rest }, ref) => {
|
|
@@ -624,7 +650,7 @@ const BadgePrimitive = ({ className, children, variation, size, ...rest }, ref)
|
|
|
624
650
|
/**
|
|
625
651
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/badge)
|
|
626
652
|
*/
|
|
627
|
-
const Badge =
|
|
653
|
+
const Badge = primitiveWithForwardRef.primitiveWithForwardRef(BadgePrimitive);
|
|
628
654
|
Badge.displayName = 'Badge';
|
|
629
655
|
|
|
630
656
|
const BreadcrumbItemPrimitive = ({ className, children, as = 'li', ...rest }, ref) => {
|
|
@@ -634,7 +660,7 @@ const BreadcrumbItemPrimitive = ({ className, children, as = 'li', ...rest }, re
|
|
|
634
660
|
/**
|
|
635
661
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
636
662
|
*/
|
|
637
|
-
const BreadcrumbItem =
|
|
663
|
+
const BreadcrumbItem = primitiveWithForwardRef.primitiveWithForwardRef(BreadcrumbItemPrimitive);
|
|
638
664
|
BreadcrumbItem.displayName = 'Breadcrumbs.Item';
|
|
639
665
|
|
|
640
666
|
const LinkPrimitive = ({ as = 'a', children, className, isExternal, ...rest }, ref) => {
|
|
@@ -643,7 +669,7 @@ const LinkPrimitive = ({ as = 'a', children, className, isExternal, ...rest }, r
|
|
|
643
669
|
/**
|
|
644
670
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/link)
|
|
645
671
|
*/
|
|
646
|
-
const Link =
|
|
672
|
+
const Link = primitiveWithForwardRef.primitiveWithForwardRef(LinkPrimitive);
|
|
647
673
|
Link.displayName = 'Link';
|
|
648
674
|
|
|
649
675
|
const BreadcrumbLinkPrimitive = ({ className, children, href, isCurrent, ...rest }, ref) => {
|
|
@@ -660,7 +686,7 @@ const BreadcrumbLinkPrimitive = ({ className, children, href, isCurrent, ...rest
|
|
|
660
686
|
/**
|
|
661
687
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
662
688
|
*/
|
|
663
|
-
const BreadcrumbLink =
|
|
689
|
+
const BreadcrumbLink = primitiveWithForwardRef.primitiveWithForwardRef(BreadcrumbLinkPrimitive);
|
|
664
690
|
BreadcrumbLink.displayName = 'Breadcrumbs.Link';
|
|
665
691
|
|
|
666
692
|
const BreadcrumbSeparatorPrimitive = ({ className, children = '/', as = 'span', ...rest }, ref) => {
|
|
@@ -670,7 +696,7 @@ const BreadcrumbSeparatorPrimitive = ({ className, children = '/', as = 'span',
|
|
|
670
696
|
/**
|
|
671
697
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
672
698
|
*/
|
|
673
|
-
const BreadcrumbSeparator =
|
|
699
|
+
const BreadcrumbSeparator = primitiveWithForwardRef.primitiveWithForwardRef(BreadcrumbSeparatorPrimitive);
|
|
674
700
|
BreadcrumbSeparator.displayName = 'Breadcrumbs.Separator';
|
|
675
701
|
|
|
676
702
|
const BreadcrumbContainerPrimitive = ({ className, children, ...rest }, ref) => {
|
|
@@ -682,7 +708,7 @@ const BreadcrumbContainerPrimitive = ({ className, children, ...rest }, ref) =>
|
|
|
682
708
|
/**
|
|
683
709
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
684
710
|
*/
|
|
685
|
-
const BreadcrumbContainer =
|
|
711
|
+
const BreadcrumbContainer = primitiveWithForwardRef.primitiveWithForwardRef(BreadcrumbContainerPrimitive);
|
|
686
712
|
BreadcrumbContainer.displayName = 'Breadcrumbs.Container';
|
|
687
713
|
|
|
688
714
|
const BreadcrumbsPrimitive = ({ className, items, separator = React__namespace.createElement(BreadcrumbSeparator, null), ...rest }, ref) => {
|
|
@@ -697,7 +723,7 @@ const BreadcrumbsPrimitive = ({ className, items, separator = React__namespace.c
|
|
|
697
723
|
/**
|
|
698
724
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/breadcrumbs)
|
|
699
725
|
*/
|
|
700
|
-
const Breadcrumbs = Object.assign(
|
|
726
|
+
const Breadcrumbs = Object.assign(primitiveWithForwardRef.primitiveWithForwardRef(BreadcrumbsPrimitive), {
|
|
701
727
|
Item: BreadcrumbItem,
|
|
702
728
|
Link: BreadcrumbLink,
|
|
703
729
|
Separator: BreadcrumbSeparator,
|
|
@@ -715,7 +741,7 @@ const ButtonGroupPrimitive = ({ className, children, isDisabled: _isDisabled = f
|
|
|
715
741
|
/**
|
|
716
742
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/button#buttongroup)
|
|
717
743
|
*/
|
|
718
|
-
const ButtonGroup =
|
|
744
|
+
const ButtonGroup = primitiveWithForwardRef.primitiveWithForwardRef(ButtonGroupPrimitive);
|
|
719
745
|
ButtonGroup.displayName = 'ButtonGroup';
|
|
720
746
|
|
|
721
747
|
const CardPrimitive = ({ className, children, variation, ...rest }, ref) => {
|
|
@@ -724,14 +750,14 @@ const CardPrimitive = ({ className, children, variation, ...rest }, ref) => {
|
|
|
724
750
|
/**
|
|
725
751
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/card)
|
|
726
752
|
*/
|
|
727
|
-
const Card =
|
|
753
|
+
const Card = primitiveWithForwardRef.primitiveWithForwardRef(CardPrimitive);
|
|
728
754
|
Card.displayName = 'Card';
|
|
729
755
|
|
|
730
756
|
const VisuallyHiddenPrimitive = ({ as = 'span', children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: as, className: ui.classNames(ui.ComponentClassName.VisuallyHidden, className), ref: ref, ...rest }, children));
|
|
731
757
|
/**
|
|
732
758
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/visuallyhidden)
|
|
733
759
|
*/
|
|
734
|
-
const VisuallyHidden =
|
|
760
|
+
const VisuallyHidden = primitiveWithForwardRef.primitiveWithForwardRef(VisuallyHiddenPrimitive);
|
|
735
761
|
VisuallyHidden.displayName = 'VisuallyHidden';
|
|
736
762
|
|
|
737
763
|
const CheckboxPrimitive = ({ checked: controlledChecked, className, defaultChecked, hasError, isDisabled, isIndeterminate, label, labelHidden, labelPosition, onBlur: _onBlur, onFocus: _onFocus, onChange: _onChange, testId, inputStyles, ..._rest }, ref) => {
|
|
@@ -775,9 +801,9 @@ const CheckboxPrimitive = ({ checked: controlledChecked, className, defaultCheck
|
|
|
775
801
|
isIndeterminate;
|
|
776
802
|
}
|
|
777
803
|
}, [dataId, isIndeterminate]);
|
|
778
|
-
const buttonTestId =
|
|
779
|
-
const iconTestId =
|
|
780
|
-
const labelTestId =
|
|
804
|
+
const buttonTestId = getUniqueComponentId(testId, ui.ComponentClassName.CheckboxButton);
|
|
805
|
+
const iconTestId = getUniqueComponentId(testId, ui.ComponentClassName.CheckboxIcon);
|
|
806
|
+
const labelTestId = getUniqueComponentId(testId, ui.ComponentClassName.CheckboxLabel);
|
|
781
807
|
const flexClasses = ui.classNames(ui.ComponentClassName.CheckboxButton, ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxButton, 'disabled', shouldBeDisabled), ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxButton, 'error', hasError), ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxButton, 'focused', focused));
|
|
782
808
|
const iconClasses = ui.classNames(ui.ComponentClassName.CheckboxIcon, ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxIcon, 'checked', checked), ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxIcon, 'disabled', shouldBeDisabled), ui.classNameModifierByFlag(ui.ComponentClassName.CheckboxIcon, 'indeterminate', isIndeterminate));
|
|
783
809
|
const iconProps = {
|
|
@@ -796,11 +822,11 @@ const CheckboxPrimitive = ({ checked: controlledChecked, className, defaultCheck
|
|
|
796
822
|
}), "data-disabled": shouldBeDisabled, testId: labelTestId }, label)),
|
|
797
823
|
React__namespace.createElement(Field.Flex, { "aria-hidden": "true", as: "span", className: flexClasses, "data-checked": checked, "data-disabled": shouldBeDisabled, "data-focus": focused, "data-error": hasError, testId: buttonTestId, ...inputStyles }, isIndeterminate ? indeterminateIcon : checkedIcon)));
|
|
798
824
|
};
|
|
799
|
-
const Checkbox =
|
|
825
|
+
const Checkbox = primitiveWithForwardRef.primitiveWithForwardRef(CheckboxPrimitive);
|
|
800
826
|
Checkbox.displayName = 'Checkbox';
|
|
801
827
|
|
|
802
828
|
const CheckboxFieldPrimitive = ({ className, errorMessage, hasError = false, labelHidden = false, labelPosition, testId, size, ...rest }, ref) => {
|
|
803
|
-
const checkboxTestId =
|
|
829
|
+
const checkboxTestId = getUniqueComponentId(testId, ui.ComponentClassName.Checkbox);
|
|
804
830
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.Field, ui.ComponentClassName.CheckboxField, ui.classNameModifier(ui.ComponentClassName.Field, size), className), testId: testId },
|
|
805
831
|
React__namespace.createElement(Checkbox, { hasError: hasError, labelHidden: labelHidden, testId: checkboxTestId, labelPosition: labelPosition, ref: ref, ...rest }),
|
|
806
832
|
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
@@ -808,14 +834,14 @@ const CheckboxFieldPrimitive = ({ className, errorMessage, hasError = false, lab
|
|
|
808
834
|
/**
|
|
809
835
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/checkboxfield)
|
|
810
836
|
*/
|
|
811
|
-
const CheckboxField =
|
|
837
|
+
const CheckboxField = primitiveWithForwardRef.primitiveWithForwardRef(CheckboxFieldPrimitive);
|
|
812
838
|
CheckboxField.displayName = 'CheckboxField';
|
|
813
839
|
|
|
814
840
|
const GridPrimitive = ({ className, children, ...rest }, ref) => (React__namespace.createElement(Field.View, { className: ui.classNames(ui.ComponentClassName.Grid, className), ref: ref, ...rest }, children));
|
|
815
841
|
/**
|
|
816
842
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/grid)
|
|
817
843
|
*/
|
|
818
|
-
const Grid =
|
|
844
|
+
const Grid = primitiveWithForwardRef.primitiveWithForwardRef(GridPrimitive);
|
|
819
845
|
Grid.displayName = 'Grid';
|
|
820
846
|
|
|
821
847
|
const ELLIPSIS = '...';
|
|
@@ -973,7 +999,7 @@ const PaginationPrimitive = ({ className, currentPage = 1, totalPages, hasMorePa
|
|
|
973
999
|
/**
|
|
974
1000
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/pagination)
|
|
975
1001
|
*/
|
|
976
|
-
const Pagination =
|
|
1002
|
+
const Pagination = primitiveWithForwardRef.primitiveWithForwardRef(PaginationPrimitive);
|
|
977
1003
|
Pagination.displayName = 'Pagination';
|
|
978
1004
|
|
|
979
1005
|
const usePagination = (props) => {
|
|
@@ -1092,7 +1118,7 @@ const DividerPrimitive = ({ className, orientation = 'horizontal', size, label,
|
|
|
1092
1118
|
/**
|
|
1093
1119
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/divider)
|
|
1094
1120
|
*/
|
|
1095
|
-
const Divider =
|
|
1121
|
+
const Divider = primitiveWithForwardRef.primitiveWithForwardRef(DividerPrimitive);
|
|
1096
1122
|
Divider.displayName = 'Divider';
|
|
1097
1123
|
|
|
1098
1124
|
const DropZoneContext = React__namespace.createContext('inactive');
|
|
@@ -1108,7 +1134,7 @@ const Container = ({ className, children, testId, isDisabled, onDragEnter, onDra
|
|
|
1108
1134
|
: { onDragEnter, onDragLeave, onDragOver, onDragStart, onDrop };
|
|
1109
1135
|
return (React__default["default"].createElement(Field.View, { ...rest, ...dragProps, isDisabled: isDisabled, className: ui.classNames(className, ui.classNameModifierByFlag(ui.ComponentClassName.DropZone, 'rejected', dragState === 'reject'), ui.classNameModifierByFlag(ui.ComponentClassName.DropZone, 'accepted', dragState === 'accept'), ui.classNameModifierByFlag(ui.ComponentClassName.DropZone, 'disabled', isDisabled), ui.ComponentClassName.DropZone), "data-testid": testId, ref: ref }, children));
|
|
1110
1136
|
};
|
|
1111
|
-
const DropZoneContainer =
|
|
1137
|
+
const DropZoneContainer = primitiveWithForwardRef.primitiveWithForwardRef(Container);
|
|
1112
1138
|
DropZoneContainer.displayName = 'DropZoneContainer';
|
|
1113
1139
|
|
|
1114
1140
|
/**
|
|
@@ -1158,7 +1184,7 @@ const DropZonePrimitive = ({ children, testId, isDisabled, acceptedFileTypes, on
|
|
|
1158
1184
|
/**
|
|
1159
1185
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/dropzone)
|
|
1160
1186
|
*/
|
|
1161
|
-
const DropZone = Object.assign(
|
|
1187
|
+
const DropZone = Object.assign(primitiveWithForwardRef.primitiveWithForwardRef(DropZonePrimitive), {
|
|
1162
1188
|
Accepted,
|
|
1163
1189
|
Rejected,
|
|
1164
1190
|
Default,
|
|
@@ -1177,7 +1203,7 @@ const AccordionItemPrimitive = ({ children, className, value, as = 'details', ..
|
|
|
1177
1203
|
/**
|
|
1178
1204
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1179
1205
|
*/
|
|
1180
|
-
const AccordionItem =
|
|
1206
|
+
const AccordionItem = primitiveWithForwardRef.primitiveWithForwardRef(AccordionItemPrimitive);
|
|
1181
1207
|
AccordionItem.displayName = 'AccordionItem';
|
|
1182
1208
|
|
|
1183
1209
|
const AccordionContentPrimitive = ({ className, children, ...rest }, ref) => {
|
|
@@ -1186,7 +1212,7 @@ const AccordionContentPrimitive = ({ className, children, ...rest }, ref) => {
|
|
|
1186
1212
|
/**
|
|
1187
1213
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1188
1214
|
*/
|
|
1189
|
-
const AccordionContent =
|
|
1215
|
+
const AccordionContent = primitiveWithForwardRef.primitiveWithForwardRef(AccordionContentPrimitive);
|
|
1190
1216
|
AccordionContent.displayName = 'Accordion.Content';
|
|
1191
1217
|
|
|
1192
1218
|
const AccordionTriggerPrimitive = ({ children, className, ...rest }, ref) => {
|
|
@@ -1206,7 +1232,7 @@ const AccordionTriggerPrimitive = ({ children, className, ...rest }, ref) => {
|
|
|
1206
1232
|
/**
|
|
1207
1233
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1208
1234
|
*/
|
|
1209
|
-
const AccordionTrigger =
|
|
1235
|
+
const AccordionTrigger = primitiveWithForwardRef.primitiveWithForwardRef(AccordionTriggerPrimitive);
|
|
1210
1236
|
AccordionTrigger.displayName = 'Accordion.Trigger';
|
|
1211
1237
|
|
|
1212
1238
|
const AccordionIconPrimitive = ({ className, as = 'span', ...rest }, ref) => {
|
|
@@ -1216,7 +1242,7 @@ const AccordionIconPrimitive = ({ className, as = 'span', ...rest }, ref) => {
|
|
|
1216
1242
|
/**
|
|
1217
1243
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1218
1244
|
*/
|
|
1219
|
-
const AccordionIcon =
|
|
1245
|
+
const AccordionIcon = primitiveWithForwardRef.primitiveWithForwardRef(AccordionIconPrimitive);
|
|
1220
1246
|
AccordionIcon.displayName = 'Accordion.Icon';
|
|
1221
1247
|
|
|
1222
1248
|
const AccordionContainerPrimitive = ({ children, className, defaultValue, allowMultiple, preventCollapse, onValueChange, testId, value: controlledValue, ...rest }, ref) => {
|
|
@@ -1258,7 +1284,7 @@ const AccordionContainerPrimitive = ({ children, className, defaultValue, allowM
|
|
|
1258
1284
|
/**
|
|
1259
1285
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1260
1286
|
*/
|
|
1261
|
-
const AccordionContainer =
|
|
1287
|
+
const AccordionContainer = primitiveWithForwardRef.primitiveWithForwardRef(AccordionContainerPrimitive);
|
|
1262
1288
|
AccordionContainer.displayName = 'Accordion.Container';
|
|
1263
1289
|
|
|
1264
1290
|
const AccordionPrimitive = ({ items, ...rest }, ref) => {
|
|
@@ -1271,7 +1297,7 @@ const AccordionPrimitive = ({ items, ...rest }, ref) => {
|
|
|
1271
1297
|
/**
|
|
1272
1298
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/accordion)
|
|
1273
1299
|
*/
|
|
1274
|
-
const Accordion = Object.assign(
|
|
1300
|
+
const Accordion = Object.assign(primitiveWithForwardRef.primitiveWithForwardRef(AccordionPrimitive), {
|
|
1275
1301
|
Container: AccordionContainer,
|
|
1276
1302
|
Content: AccordionContent,
|
|
1277
1303
|
Icon: AccordionIcon,
|
|
@@ -1301,7 +1327,7 @@ const FieldsetPrimitive = ({ children, className, isDisabled, legend, legendHidd
|
|
|
1301
1327
|
/**
|
|
1302
1328
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/fieldset)
|
|
1303
1329
|
*/
|
|
1304
|
-
const Fieldset =
|
|
1330
|
+
const Fieldset = primitiveWithForwardRef.primitiveWithForwardRef(FieldsetPrimitive);
|
|
1305
1331
|
Fieldset.displayName = 'Fieldset';
|
|
1306
1332
|
|
|
1307
1333
|
const headingLevels = {
|
|
@@ -1316,14 +1342,14 @@ const HeadingPrimitive = ({ className, children, isTruncated, level = 6, ...rest
|
|
|
1316
1342
|
/**
|
|
1317
1343
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/heading)
|
|
1318
1344
|
*/
|
|
1319
|
-
const Heading =
|
|
1345
|
+
const Heading = primitiveWithForwardRef.primitiveWithForwardRef(HeadingPrimitive);
|
|
1320
1346
|
Heading.displayName = 'Heading';
|
|
1321
1347
|
|
|
1322
1348
|
const ImagePrimitive = ({ className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "img", ref: ref, className: ui.classNames(ui.ComponentClassName.Image, className), ...rest }));
|
|
1323
1349
|
/**
|
|
1324
1350
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/image)
|
|
1325
1351
|
*/
|
|
1326
|
-
const Image =
|
|
1352
|
+
const Image = primitiveWithForwardRef.primitiveWithForwardRef(ImagePrimitive);
|
|
1327
1353
|
Image.displayName = 'Image';
|
|
1328
1354
|
|
|
1329
1355
|
/**
|
|
@@ -1334,7 +1360,7 @@ const MenuButtonPrimitive = ({ ariaLabel, className, children, isDisabled = fals
|
|
|
1334
1360
|
const componentClasses = ui.classNames(ui.ComponentClassName.Button, ui.classNameModifier(ui.ComponentClassName.Button, size), ui.classNameModifier(ui.ComponentClassName.Button, variation), className);
|
|
1335
1361
|
return (React__namespace.createElement(Field.Button, { ref: ref, className: componentClasses, disabled: isDisabled || isLoading, isDisabled: isDisabled || isLoading, type: type, testId: testId, "aria-label": ariaLabel, style: propStyles, ...nonStyleProps }, children));
|
|
1336
1362
|
};
|
|
1337
|
-
const MenuButton =
|
|
1363
|
+
const MenuButton = primitiveWithForwardRef.primitiveWithForwardRef(MenuButtonPrimitive);
|
|
1338
1364
|
MenuButton.displayName = 'MenuButton';
|
|
1339
1365
|
|
|
1340
1366
|
// Radix packages don't support ESM in Node, in some scenarios(e.g. SSR)
|
|
@@ -1352,7 +1378,7 @@ const MenuPrimitive = ({ menuAlign = 'start', children, className, isOpen, size,
|
|
|
1352
1378
|
/**
|
|
1353
1379
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/menu)
|
|
1354
1380
|
*/
|
|
1355
|
-
const Menu =
|
|
1381
|
+
const Menu = primitiveWithForwardRef.primitiveWithForwardRef(MenuPrimitive);
|
|
1356
1382
|
Menu.displayName = 'Menu';
|
|
1357
1383
|
|
|
1358
1384
|
// Radix packages don't support ESM in Node, in some scenarios(e.g. SSR)
|
|
@@ -1367,13 +1393,13 @@ const MenuItemPrimitive = ({ children, className, ...rest }, ref) => {
|
|
|
1367
1393
|
React__namespace.createElement(MenuButton, { className: ui.classNames(ui.ComponentClassName.MenuItem, className), testId: MENU_ITEM_TEST_ID, ...rest, variation: "menu" // ensures `menu` variation is not overwritten
|
|
1368
1394
|
}, children)));
|
|
1369
1395
|
};
|
|
1370
|
-
const MenuItem =
|
|
1396
|
+
const MenuItem = primitiveWithForwardRef.primitiveWithForwardRef(MenuItemPrimitive);
|
|
1371
1397
|
MenuItem.displayName = 'MenuItem';
|
|
1372
1398
|
|
|
1373
1399
|
const MessageHeadingPrimitive = ({ children, className, ...rest }, ref) => {
|
|
1374
1400
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.MessageHeading, className), ref: ref, ...rest }, children));
|
|
1375
1401
|
};
|
|
1376
|
-
const MessageHeading =
|
|
1402
|
+
const MessageHeading = primitiveWithForwardRef.primitiveWithForwardRef(MessageHeadingPrimitive);
|
|
1377
1403
|
MessageHeading.displayName = 'MessageHeading';
|
|
1378
1404
|
|
|
1379
1405
|
const MessageContext = React__namespace.createContext({
|
|
@@ -1402,7 +1428,7 @@ const MessageIconPrimitive = ({ className, ...rest }, ref) => {
|
|
|
1402
1428
|
}
|
|
1403
1429
|
return icon ? (React__namespace.createElement(Field.View, { className: ui.classNames(ui.ComponentClassName.MessageIcon, className), "aria-hidden": "true", ref: ref, ...rest }, icon)) : null;
|
|
1404
1430
|
};
|
|
1405
|
-
const MessageIcon =
|
|
1431
|
+
const MessageIcon = primitiveWithForwardRef.primitiveWithForwardRef(MessageIconPrimitive);
|
|
1406
1432
|
MessageIcon.displayName = 'MessageIcon';
|
|
1407
1433
|
|
|
1408
1434
|
const MessageDismissPrimitive = ({ onDismiss, dismissLabel, hasIcon = true, children, className, ...rest }, ref) => {
|
|
@@ -1418,13 +1444,13 @@ const MessageDismissPrimitive = ({ onDismiss, dismissLabel, hasIcon = true, chil
|
|
|
1418
1444
|
hasIcon ? icons?.close ?? React__namespace.createElement(Field.IconClose, { "aria-hidden": "true" }) : null,
|
|
1419
1445
|
children ? (children) : (React__namespace.createElement(VisuallyHidden, null, dismissLabel ? dismissLabel : Field.ComponentText.Message.dismissLabel))));
|
|
1420
1446
|
};
|
|
1421
|
-
const MessageDismiss =
|
|
1447
|
+
const MessageDismiss = primitiveWithForwardRef.primitiveWithForwardRef(MessageDismissPrimitive);
|
|
1422
1448
|
MessageDismiss.displayName = 'MessageContent';
|
|
1423
1449
|
|
|
1424
1450
|
const MessageContentPrimitive = ({ children, className, ...rest }, ref) => {
|
|
1425
1451
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.MessageContent, className), ref: ref, ...rest }, children));
|
|
1426
1452
|
};
|
|
1427
|
-
const MessageContent =
|
|
1453
|
+
const MessageContent = primitiveWithForwardRef.primitiveWithForwardRef(MessageContentPrimitive);
|
|
1428
1454
|
MessageContent.displayName = 'MessageContent';
|
|
1429
1455
|
|
|
1430
1456
|
const MessageContainerPrimitive = ({ children, className, colorTheme = 'neutral', variation = 'filled', ...rest }, ref) => {
|
|
@@ -1436,7 +1462,7 @@ const MessageContainerPrimitive = ({ children, className, colorTheme = 'neutral'
|
|
|
1436
1462
|
}), [colorTheme, dismissed]);
|
|
1437
1463
|
return (React__namespace.createElement(MessageContext.Provider, { value: value }, !dismissed ? (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.Message, ui.classNameModifier(ui.ComponentClassName.Message, variation), ui.classNameModifier(ui.ComponentClassName.Message, colorTheme), className), ref: ref, ...rest }, children)) : null));
|
|
1438
1464
|
};
|
|
1439
|
-
const MessageContainer =
|
|
1465
|
+
const MessageContainer = primitiveWithForwardRef.primitiveWithForwardRef(MessageContainerPrimitive);
|
|
1440
1466
|
MessageContainer.displayName = 'MessageContainer';
|
|
1441
1467
|
|
|
1442
1468
|
const MessagePrimitive = ({ children, heading, dismissLabel, isDismissible, onDismiss, hasIcon = true, colorTheme = 'neutral', variation = 'filled', ...rest }, ref) => {
|
|
@@ -1450,7 +1476,7 @@ const MessagePrimitive = ({ children, heading, dismissLabel, isDismissible, onDi
|
|
|
1450
1476
|
/**
|
|
1451
1477
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/message)
|
|
1452
1478
|
*/
|
|
1453
|
-
const Message =
|
|
1479
|
+
const Message = primitiveWithForwardRef.primitiveWithForwardRef(MessagePrimitive);
|
|
1454
1480
|
Message.displayName = 'Message';
|
|
1455
1481
|
|
|
1456
1482
|
const { passwordIsHidden, passwordIsShown, showPassword } = Field.ComponentText.PasswordField;
|
|
@@ -1466,7 +1492,7 @@ const ShowPasswordButtonPrimitive = ({ fieldType, passwordIsHiddenLabel = passwo
|
|
|
1466
1492
|
: passwordIsShownLabel),
|
|
1467
1493
|
icon));
|
|
1468
1494
|
};
|
|
1469
|
-
const ShowPasswordButton =
|
|
1495
|
+
const ShowPasswordButton = primitiveWithForwardRef.primitiveWithForwardRef(ShowPasswordButtonPrimitive);
|
|
1470
1496
|
ShowPasswordButton.displayName = 'ShowPasswordButton';
|
|
1471
1497
|
|
|
1472
1498
|
const PasswordFieldPrimitive = ({ autoComplete = 'current-password', label, className, hideShowPassword = false, passwordIsHiddenLabel, passwordIsShownLabel, showPasswordButtonLabel, showPasswordButtonRef, size, hasError, ...rest }, ref) => {
|
|
@@ -1484,7 +1510,7 @@ const PasswordFieldPrimitive = ({ autoComplete = 'current-password', label, clas
|
|
|
1484
1510
|
/**
|
|
1485
1511
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/passwordfield)
|
|
1486
1512
|
*/
|
|
1487
|
-
const PasswordField =
|
|
1513
|
+
const PasswordField = primitiveWithForwardRef.primitiveWithForwardRef(PasswordFieldPrimitive);
|
|
1488
1514
|
PasswordField.displayName = 'PasswordField';
|
|
1489
1515
|
|
|
1490
1516
|
const SelectPrimitive = ({ autoComplete, className, size, variation, value, defaultValue, hasError, icon, iconColor, children, placeholder, isDisabled, isRequired, isMultiple = false, selectSize = 1, ...rest }, ref) => {
|
|
@@ -1503,7 +1529,7 @@ const SelectPrimitive = ({ autoComplete, className, size, variation, value, defa
|
|
|
1503
1529
|
children),
|
|
1504
1530
|
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)))));
|
|
1505
1531
|
};
|
|
1506
|
-
const Select =
|
|
1532
|
+
const Select = primitiveWithForwardRef.primitiveWithForwardRef(SelectPrimitive);
|
|
1507
1533
|
Select.displayName = 'Select';
|
|
1508
1534
|
|
|
1509
1535
|
const selectFieldChildren = ({ children, options, }) => {
|
|
@@ -1519,19 +1545,25 @@ const selectFieldChildren = ({ children, options, }) => {
|
|
|
1519
1545
|
const SelectFieldPrimitive = (props, ref) => {
|
|
1520
1546
|
const { children, className, descriptiveText, errorMessage, hasError = false, id, label, labelHidden = false, options, size, testId, inputStyles, ..._rest } = props;
|
|
1521
1547
|
const fieldId = useStableId(id);
|
|
1522
|
-
const
|
|
1523
|
-
const
|
|
1548
|
+
const stableId = useStableId();
|
|
1549
|
+
const descriptionId = descriptiveText
|
|
1550
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
1551
|
+
: undefined;
|
|
1552
|
+
const errorId = hasError
|
|
1553
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
1554
|
+
: undefined;
|
|
1555
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
1524
1556
|
const { styleProps, rest } = splitPrimitiveProps(_rest);
|
|
1525
1557
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.Field, ui.classNameModifier(ui.ComponentClassName.Field, size), ui.ComponentClassName.SelectField, className), testId: testId, ...styleProps },
|
|
1526
1558
|
React__namespace.createElement(Field.Label, { htmlFor: fieldId, visuallyHidden: labelHidden }, label),
|
|
1527
1559
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),
|
|
1528
1560
|
React__namespace.createElement(Select, { "aria-describedby": ariaDescribedBy, hasError: hasError, id: fieldId, ref: ref, size: size, ...rest, ...inputStyles }, selectFieldChildren({ children, options })),
|
|
1529
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
1561
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
1530
1562
|
};
|
|
1531
1563
|
/**
|
|
1532
1564
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/selectfield)
|
|
1533
1565
|
*/
|
|
1534
|
-
const SelectField =
|
|
1566
|
+
const SelectField = primitiveWithForwardRef.primitiveWithForwardRef(SelectFieldPrimitive);
|
|
1535
1567
|
SelectField.displayName = 'SelectField';
|
|
1536
1568
|
|
|
1537
1569
|
const DialCodeSelectPrimitive = ({ className, dialCodeList, isReadOnly, ...props }, ref) => {
|
|
@@ -1546,7 +1578,7 @@ const DialCodeSelectPrimitive = ({ className, dialCodeList, isReadOnly, ...props
|
|
|
1546
1578
|
*/
|
|
1547
1579
|
, { "aria-disabled": isReadOnly, autoComplete: "tel-country-code", className: ui.classNames(ui.ComponentClassName.CountryCodeSelect, ui.ComponentClassName.DialCodeSelect, className), labelHidden: true, ref: ref, ...props }, dialCodeOptions));
|
|
1548
1580
|
};
|
|
1549
|
-
const DialCodeSelect =
|
|
1581
|
+
const DialCodeSelect = primitiveWithForwardRef.primitiveWithForwardRef(DialCodeSelectPrimitive);
|
|
1550
1582
|
DialCodeSelect.displayName = 'DialCodeSelect';
|
|
1551
1583
|
|
|
1552
1584
|
const PhoneNumberFieldPrimitive = ({ autoComplete = 'tel-national', className, defaultDialCode, dialCodeLabel = Field.ComponentText.PhoneNumberField.countryCodeLabel, dialCodeList, dialCodeName, dialCodeRef, hasError, isDisabled, isReadOnly, onDialCodeChange, onInput, size, variation, ...rest }, ref) => {
|
|
@@ -1555,7 +1587,7 @@ const PhoneNumberFieldPrimitive = ({ autoComplete = 'tel-national', className, d
|
|
|
1555
1587
|
/**
|
|
1556
1588
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/phonenumberfield)
|
|
1557
1589
|
*/
|
|
1558
|
-
const PhoneNumberField =
|
|
1590
|
+
const PhoneNumberField = primitiveWithForwardRef.primitiveWithForwardRef(PhoneNumberFieldPrimitive);
|
|
1559
1591
|
PhoneNumberField.displayName = 'PhoneNumberField';
|
|
1560
1592
|
|
|
1561
1593
|
const PlaceholderPrimitive = ({ className, children, isLoaded, size, ...rest }, ref) => {
|
|
@@ -1567,7 +1599,7 @@ const PlaceholderPrimitive = ({ className, children, isLoaded, size, ...rest },
|
|
|
1567
1599
|
/**
|
|
1568
1600
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/placeholder)
|
|
1569
1601
|
*/
|
|
1570
|
-
const Placeholder =
|
|
1602
|
+
const Placeholder = primitiveWithForwardRef.primitiveWithForwardRef(PlaceholderPrimitive);
|
|
1571
1603
|
Placeholder.displayName = 'Placeholder';
|
|
1572
1604
|
|
|
1573
1605
|
const defaultValue = { name: 'default' };
|
|
@@ -1594,14 +1626,20 @@ const RadioPrimitive = ({ children, className, id, isDisabled = false, testId, v
|
|
|
1594
1626
|
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 }),
|
|
1595
1627
|
React__namespace.createElement(Field.Flex, { "aria-hidden": "true", as: "span", className: ui.classNames(ui.ComponentClassName.RadioButton, ui.classNameModifier(ui.ComponentClassName.RadioButton, size)), testId: testId })));
|
|
1596
1628
|
};
|
|
1597
|
-
const Radio =
|
|
1629
|
+
const Radio = primitiveWithForwardRef.primitiveWithForwardRef(RadioPrimitive);
|
|
1598
1630
|
Radio.displayName = 'Radio';
|
|
1599
1631
|
|
|
1600
1632
|
const RadioGroupFieldPrimitive = ({ children, className, defaultValue, descriptiveText, errorMessage, hasError = false, id, isDisabled, isRequired, isReadOnly, legend, legendHidden = false, labelPosition, onChange, name, size, testId, value, variation, ...rest }, ref) => {
|
|
1601
1633
|
const fieldId = useStableId(id);
|
|
1602
|
-
const
|
|
1603
|
-
const
|
|
1604
|
-
|
|
1634
|
+
const stableId = useStableId();
|
|
1635
|
+
const descriptionId = descriptiveText
|
|
1636
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
1637
|
+
: undefined;
|
|
1638
|
+
const errorId = hasError
|
|
1639
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
1640
|
+
: undefined;
|
|
1641
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
1642
|
+
const radioGroupTestId = getUniqueComponentId(testId, ui.ComponentClassName.RadioGroup);
|
|
1605
1643
|
const radioGroupContextValue = React__namespace.useMemo(() => ({
|
|
1606
1644
|
currentValue: value,
|
|
1607
1645
|
defaultValue,
|
|
@@ -1629,12 +1667,12 @@ const RadioGroupFieldPrimitive = ({ children, className, defaultValue, descripti
|
|
|
1629
1667
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: legendHidden, descriptiveText: descriptiveText }),
|
|
1630
1668
|
React__namespace.createElement(Field.Flex, { "aria-describedby": ariaDescribedBy, className: ui.ComponentClassName.RadioGroup, id: fieldId, testId: radioGroupTestId },
|
|
1631
1669
|
React__namespace.createElement(RadioGroupContext.Provider, { value: radioGroupContextValue }, children)),
|
|
1632
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
1670
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
1633
1671
|
};
|
|
1634
1672
|
/**
|
|
1635
1673
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/radiogroupfield)
|
|
1636
1674
|
*/
|
|
1637
|
-
const RadioGroupField =
|
|
1675
|
+
const RadioGroupField = primitiveWithForwardRef.primitiveWithForwardRef(RadioGroupFieldPrimitive);
|
|
1638
1676
|
RadioGroupField.displayName = 'RadioGroupField';
|
|
1639
1677
|
|
|
1640
1678
|
const isIconFilled = (currentIconIndex, ratingValue) => {
|
|
@@ -1694,7 +1732,7 @@ const RatingPrimitive = ({ className, emptyColor, emptyIcon, fillColor, icon, ma
|
|
|
1694
1732
|
/**
|
|
1695
1733
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/rating)
|
|
1696
1734
|
*/
|
|
1697
|
-
const Rating =
|
|
1735
|
+
const Rating = primitiveWithForwardRef.primitiveWithForwardRef(RatingPrimitive);
|
|
1698
1736
|
Rating.displayName = 'Rating';
|
|
1699
1737
|
|
|
1700
1738
|
// Radix packages don't support ESM in Node, in some scenarios(e.g. SSR)
|
|
@@ -1707,9 +1745,14 @@ const SLIDER_RANGE_TEST_ID = 'slider-range';
|
|
|
1707
1745
|
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) => {
|
|
1708
1746
|
const { isFieldsetDisabled } = Field.useFieldset();
|
|
1709
1747
|
const fieldId = useStableId(id);
|
|
1710
|
-
const
|
|
1711
|
-
const descriptionId =
|
|
1712
|
-
|
|
1748
|
+
const stableId = useStableId();
|
|
1749
|
+
const descriptionId = descriptiveText
|
|
1750
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
1751
|
+
: undefined;
|
|
1752
|
+
const errorId = hasError
|
|
1753
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
1754
|
+
: undefined;
|
|
1755
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
1713
1756
|
const disabled = isFieldsetDisabled ? isFieldsetDisabled : isDisabled;
|
|
1714
1757
|
const { styleProps, rest } = splitPrimitiveProps(_rest);
|
|
1715
1758
|
const isControlled = value !== undefined;
|
|
@@ -1737,7 +1780,7 @@ const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, desc
|
|
|
1737
1780
|
, {
|
|
1738
1781
|
// Custom classnames will be added to Root below
|
|
1739
1782
|
className: ui.classNames(ui.ComponentClassName.Field, ui.classNameModifier(ui.ComponentClassName.Field, size), ui.ComponentClassName.SliderField), testId: testId, ...styleProps },
|
|
1740
|
-
React__namespace.createElement(Field.Label, { className: ui.ComponentClassName.SliderFieldLabel, id:
|
|
1783
|
+
React__namespace.createElement(Field.Label, { className: ui.ComponentClassName.SliderFieldLabel, id: stableId, testId: SLIDER_LABEL_TEST_ID, visuallyHidden: labelHidden },
|
|
1741
1784
|
React__namespace.createElement(Field.View, { as: "span" }, label),
|
|
1742
1785
|
!isValueHidden ? renderedValue : null),
|
|
1743
1786
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),
|
|
@@ -1748,13 +1791,13 @@ const SliderFieldPrimitive = ({ ariaValuetext, className, defaultValue = 0, desc
|
|
|
1748
1791
|
[`${isVertical ? 'width' : 'height'}`]: trackSize,
|
|
1749
1792
|
} },
|
|
1750
1793
|
React__namespace.createElement(Range, { className: ui.classNames(ui.ComponentClassName.SliderFieldRange, ui.classNameModifier(ui.ComponentClassName.SliderFieldRange, orientation), ui.classNameModifierByFlag(ui.ComponentClassName.SliderFieldRange, 'disabled', disabled)), "data-testid": SLIDER_RANGE_TEST_ID, style: { backgroundColor: String(filledTrackColor) } })),
|
|
1751
|
-
React__namespace.createElement(Thumb, { "aria-describedby": ariaDescribedBy, "aria-labelledby":
|
|
1752
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
1794
|
+
React__namespace.createElement(Thumb, { "aria-describedby": ariaDescribedBy, "aria-labelledby": stableId, "aria-valuetext": ariaValuetext, className: ui.classNames(ui.ComponentClassName.SliderFieldThumb, ui.classNameModifier(ui.ComponentClassName.SliderFieldThumb, size), ui.classNameModifierByFlag(ui.ComponentClassName.SliderFieldThumb, 'disabled', disabled)), style: { backgroundColor: String(thumbColor) } }))),
|
|
1795
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
1753
1796
|
};
|
|
1754
1797
|
/**
|
|
1755
1798
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/sliderfield)
|
|
1756
1799
|
*/
|
|
1757
|
-
const SliderField =
|
|
1800
|
+
const SliderField = primitiveWithForwardRef.primitiveWithForwardRef(SliderFieldPrimitive);
|
|
1758
1801
|
SliderField.displayName = 'SliderField';
|
|
1759
1802
|
|
|
1760
1803
|
const getCorrectSteppingValue = ({ max, min, step, value, }) => {
|
|
@@ -1877,8 +1920,14 @@ const StepperFieldPrimitive = (props, ref) => {
|
|
|
1877
1920
|
// this is only required in useStepper hook but deconstruct here to remove its existence in rest
|
|
1878
1921
|
value: controlledValue, variation, ..._rest } = props;
|
|
1879
1922
|
const fieldId = useStableId(id);
|
|
1880
|
-
const
|
|
1881
|
-
const
|
|
1923
|
+
const stableId = useStableId();
|
|
1924
|
+
const descriptionId = descriptiveText
|
|
1925
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
1926
|
+
: undefined;
|
|
1927
|
+
const errorId = hasError
|
|
1928
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
1929
|
+
: undefined;
|
|
1930
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
1882
1931
|
const { styleProps, rest } = splitPrimitiveProps(_rest);
|
|
1883
1932
|
const icons = Field.useIcons('stepperField');
|
|
1884
1933
|
const { step, value, inputValue, handleDecrease, handleIncrease, handleOnBlur, handleOnChange, handleOnWheel, setInputValue, shouldDisableDecreaseButton, shouldDisableIncreaseButton, } = useStepper({ ...props, defaultValue, onStepChange });
|
|
@@ -1893,12 +1942,12 @@ const StepperFieldPrimitive = (props, ref) => {
|
|
|
1893
1942
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),
|
|
1894
1943
|
React__namespace.createElement(FieldGroup, { outerStartComponent: React__namespace.createElement(Field.FieldGroupIconButton, { "aria-controls": fieldId, ariaLabel: `${decreaseButtonLabel} ${value - step}`, className: ui.classNames(ui.ComponentClassName.StepperFieldButtonDecrease, ui.classNameModifier(ui.ComponentClassName.StepperFieldButtonDecrease, variation), ui.classNameModifierByFlag(ui.ComponentClassName.StepperFieldButtonDecrease, 'disabled', shouldDisableDecreaseButton)), "data-invalid": hasError, isDisabled: shouldDisableDecreaseButton, onClick: handleDecrease, size: size }, icons?.remove ?? React__namespace.createElement(Field.IconRemove, { "data-testid": DECREASE_ICON })), outerEndComponent: React__namespace.createElement(Field.FieldGroupIconButton, { "aria-controls": fieldId, ariaLabel: `${increaseButtonLabel} ${value + step}`, className: ui.classNames(ui.ComponentClassName.StepperFieldButtonIncrease, ui.classNameModifier(ui.ComponentClassName.StepperFieldButtonIncrease, variation), ui.classNameModifierByFlag(ui.ComponentClassName.StepperFieldButtonIncrease, 'disabled', shouldDisableIncreaseButton)), "data-invalid": hasError, isDisabled: shouldDisableIncreaseButton, onClick: handleIncrease, size: size }, icons?.add ?? React__namespace.createElement(Field.IconAdd, { "data-testid": INCREASE_ICON })) },
|
|
1895
1944
|
React__namespace.createElement(Input, { "aria-describedby": ariaDescribedBy, className: ui.ComponentClassName.StepperFieldInput, hasError: hasError, id: fieldId, isDisabled: isDisabled, isReadOnly: isReadOnly, isRequired: isRequired, onBlur: handleOnBlur, onChange: handleOnChange, onWheel: handleOnWheel, ref: ref, size: size, variation: variation, type: "number", value: inputValue, ...inputStyles, ...rest })),
|
|
1896
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
1945
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
1897
1946
|
};
|
|
1898
1947
|
/**
|
|
1899
1948
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/stepperfield)
|
|
1900
1949
|
*/
|
|
1901
|
-
const StepperField =
|
|
1950
|
+
const StepperField = primitiveWithForwardRef.primitiveWithForwardRef(StepperFieldPrimitive);
|
|
1902
1951
|
StepperField.displayName = 'StepperField';
|
|
1903
1952
|
|
|
1904
1953
|
const useSwitch = (props) => {
|
|
@@ -1955,7 +2004,7 @@ const SwitchFieldPrimitive = ({ className, defaultChecked, id, isChecked, isDisa
|
|
|
1955
2004
|
/**
|
|
1956
2005
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/switchfield)
|
|
1957
2006
|
*/
|
|
1958
|
-
const SwitchField =
|
|
2007
|
+
const SwitchField = primitiveWithForwardRef.primitiveWithForwardRef(SwitchFieldPrimitive);
|
|
1959
2008
|
SwitchField.displayName = 'SwitchField';
|
|
1960
2009
|
|
|
1961
2010
|
const TablePrimitive = ({ caption, children, className, highlightOnHover = false, size, variation, ...rest }, ref) => {
|
|
@@ -1967,38 +2016,46 @@ const TablePrimitive = ({ caption, children, className, highlightOnHover = false
|
|
|
1967
2016
|
/**
|
|
1968
2017
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/table)
|
|
1969
2018
|
*/
|
|
1970
|
-
const Table =
|
|
2019
|
+
const Table = primitiveWithForwardRef.primitiveWithForwardRef(TablePrimitive);
|
|
1971
2020
|
Table.displayName = 'Table';
|
|
1972
2021
|
|
|
1973
2022
|
const TableBodyPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tbody", className: ui.classNames(ui.ComponentClassName.TableBody, className), ref: ref, ...rest }, children));
|
|
1974
|
-
const TableBody =
|
|
2023
|
+
const TableBody = primitiveWithForwardRef.primitiveWithForwardRef(TableBodyPrimitive);
|
|
1975
2024
|
TableBody.displayName = 'TableBody';
|
|
1976
2025
|
|
|
1977
2026
|
const TableCellPrimitive = ({ as: asElementTag = 'td', children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: asElementTag, className: ui.classNames(asElementTag === 'td'
|
|
1978
2027
|
? ui.ComponentClassName.TableTd
|
|
1979
2028
|
: ui.ComponentClassName.TableTh, className), ref: ref, ...rest }, children));
|
|
1980
|
-
const TableCell =
|
|
2029
|
+
const TableCell = primitiveWithForwardRef.primitiveWithForwardRef(TableCellPrimitive);
|
|
1981
2030
|
TableCell.displayName = 'TableCell';
|
|
1982
2031
|
|
|
1983
2032
|
const TableFootPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tfoot", className: ui.classNames(ui.ComponentClassName.TableFoot, className), ref: ref, ...rest }, children));
|
|
1984
|
-
const TableFoot =
|
|
2033
|
+
const TableFoot = primitiveWithForwardRef.primitiveWithForwardRef(TableFootPrimitive);
|
|
1985
2034
|
TableFoot.displayName = 'TableFoot';
|
|
1986
2035
|
|
|
1987
2036
|
const TableHeadPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "thead", className: ui.classNames(ui.ComponentClassName.TableHead, className), ref: ref, ...rest }, children));
|
|
1988
|
-
const TableHead =
|
|
2037
|
+
const TableHead = primitiveWithForwardRef.primitiveWithForwardRef(TableHeadPrimitive);
|
|
1989
2038
|
TableHead.displayName = 'TableHead';
|
|
1990
2039
|
|
|
1991
2040
|
const TableRowPrimitive = ({ children, className, ...rest }, ref) => (React__namespace.createElement(Field.View, { as: "tr", className: ui.classNames(ui.ComponentClassName.TableRow, className), ref: ref, ...rest }, children));
|
|
1992
|
-
const TableRow =
|
|
2041
|
+
const TableRow = primitiveWithForwardRef.primitiveWithForwardRef(TableRowPrimitive);
|
|
1993
2042
|
TableRow.displayName = 'TableRow';
|
|
1994
2043
|
|
|
1995
2044
|
const TabsContext = React__namespace.createContext({
|
|
2045
|
+
groupId: '',
|
|
1996
2046
|
activeTab: '',
|
|
1997
2047
|
setActiveTab: () => { },
|
|
1998
2048
|
});
|
|
1999
2049
|
|
|
2050
|
+
/* WHITESPACE_VALUE is used to fill whitespace present in user-inputed `value` when creating id for TabsItem and TabsPanel */
|
|
2051
|
+
const WHITESPACE_VALUE = '-';
|
|
2052
|
+
|
|
2000
2053
|
const TabsItemPrimitive = ({ className, value, children, onClick, as = 'button', role = 'tab', ...rest }, ref) => {
|
|
2001
|
-
const { activeTab, setActiveTab } = React__namespace.useContext(TabsContext);
|
|
2054
|
+
const { activeTab, setActiveTab, groupId } = React__namespace.useContext(TabsContext);
|
|
2055
|
+
let idValue = value;
|
|
2056
|
+
if (typeof idValue === 'string') {
|
|
2057
|
+
idValue = idValue.replace(' ', WHITESPACE_VALUE);
|
|
2058
|
+
}
|
|
2002
2059
|
const isActive = activeTab === value;
|
|
2003
2060
|
const handleOnClick = (e) => {
|
|
2004
2061
|
if (ui.isTypedFunction(onClick)) {
|
|
@@ -2006,12 +2063,12 @@ const TabsItemPrimitive = ({ className, value, children, onClick, as = 'button',
|
|
|
2006
2063
|
}
|
|
2007
2064
|
setActiveTab(value);
|
|
2008
2065
|
};
|
|
2009
|
-
return (React__namespace.createElement(Field.View, { ...rest, role: role, as: as, id: `${
|
|
2066
|
+
return (React__namespace.createElement(Field.View, { ...rest, role: role, as: as, id: `${groupId}-tab-${idValue}`, "aria-selected": isActive, "aria-controls": `${groupId}-panel-${idValue}`, tabIndex: !isActive ? -1 : undefined, className: ui.classNames(ui.ComponentClassName.TabsItem, ui.classNameModifierByFlag(ui.ComponentClassName.TabsItem, 'active', activeTab === value), className), ref: ref, onClick: handleOnClick }, children));
|
|
2010
2067
|
};
|
|
2011
2068
|
/**
|
|
2012
2069
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/tabs)
|
|
2013
2070
|
*/
|
|
2014
|
-
const TabsItem =
|
|
2071
|
+
const TabsItem = primitiveWithForwardRef.primitiveWithForwardRef(TabsItemPrimitive);
|
|
2015
2072
|
TabsItem.displayName = 'Tabs.Item';
|
|
2016
2073
|
|
|
2017
2074
|
const isValidTab = (child) => React__namespace.isValidElement(child);
|
|
@@ -2089,22 +2146,27 @@ const TabListPrimitive = ({ className, children, indicatorPosition, spacing, rol
|
|
|
2089
2146
|
/**
|
|
2090
2147
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/tabs)
|
|
2091
2148
|
*/
|
|
2092
|
-
const TabList =
|
|
2149
|
+
const TabList = primitiveWithForwardRef.primitiveWithForwardRef(TabListPrimitive);
|
|
2093
2150
|
TabList.displayName = 'Tabs.List';
|
|
2094
2151
|
|
|
2095
2152
|
const TabPanelPrimitive = ({ className, value, children, role = 'tabpanel', ...rest }, ref) => {
|
|
2096
|
-
const { activeTab, isLazy } = React__namespace.useContext(TabsContext);
|
|
2153
|
+
const { activeTab, isLazy, groupId } = React__namespace.useContext(TabsContext);
|
|
2097
2154
|
if (isLazy && activeTab !== value)
|
|
2098
2155
|
return null;
|
|
2099
|
-
|
|
2156
|
+
let idValue = value;
|
|
2157
|
+
if (typeof idValue === 'string') {
|
|
2158
|
+
idValue = idValue.replace(' ', WHITESPACE_VALUE);
|
|
2159
|
+
}
|
|
2160
|
+
return (React__namespace.createElement(Field.View, { ...rest, role: role, id: `${groupId}-panel-${idValue}`, "aria-labelledby": `${groupId}-tab-${idValue}`, className: ui.classNames(ui.ComponentClassName.TabsPanel, ui.classNameModifierByFlag(ui.ComponentClassName.TabsPanel, 'active', activeTab === value), className), ref: ref }, children));
|
|
2100
2161
|
};
|
|
2101
2162
|
/**
|
|
2102
2163
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/tabs)
|
|
2103
2164
|
*/
|
|
2104
|
-
const TabPanel =
|
|
2165
|
+
const TabPanel = primitiveWithForwardRef.primitiveWithForwardRef(TabPanelPrimitive);
|
|
2105
2166
|
TabPanel.displayName = 'Tabs.Panel';
|
|
2106
2167
|
|
|
2107
2168
|
const TabsContainerPrimitive = ({ children, defaultValue, className, value: controlledValue, onValueChange, isLazy, ...rest }, ref) => {
|
|
2169
|
+
const groupId = useStableId(); // groupId is used to ensure uniqueness between Tab Groups in IDs
|
|
2108
2170
|
const isControlled = controlledValue !== undefined;
|
|
2109
2171
|
const [localValue, setLocalValue] = React__namespace.useState(() => isControlled ? controlledValue : defaultValue);
|
|
2110
2172
|
const activeTab = isControlled ? controlledValue : localValue ?? '';
|
|
@@ -2121,15 +2183,16 @@ const TabsContainerPrimitive = ({ children, defaultValue, className, value: cont
|
|
|
2121
2183
|
activeTab,
|
|
2122
2184
|
isLazy,
|
|
2123
2185
|
setActiveTab,
|
|
2186
|
+
groupId,
|
|
2124
2187
|
};
|
|
2125
|
-
}, [activeTab, setActiveTab, isLazy]);
|
|
2188
|
+
}, [activeTab, setActiveTab, isLazy, groupId]);
|
|
2126
2189
|
return (React__namespace.createElement(TabsContext.Provider, { value: _value },
|
|
2127
2190
|
React__namespace.createElement(Field.View, { ...rest, ref: ref, className: ui.classNames(className, ui.ComponentClassName.Tabs) }, children)));
|
|
2128
2191
|
};
|
|
2129
2192
|
/**
|
|
2130
2193
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/tabs)
|
|
2131
2194
|
*/
|
|
2132
|
-
const TabsContainer =
|
|
2195
|
+
const TabsContainer = primitiveWithForwardRef.primitiveWithForwardRef(TabsContainerPrimitive);
|
|
2133
2196
|
TabsContainer.displayName = 'Tabs.Container';
|
|
2134
2197
|
|
|
2135
2198
|
const TabsPrimitive = ({ items, indicatorPosition, justifyContent, spacing, ...rest }, ref) => {
|
|
@@ -2140,7 +2203,7 @@ const TabsPrimitive = ({ items, indicatorPosition, justifyContent, spacing, ...r
|
|
|
2140
2203
|
/**
|
|
2141
2204
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/tabs)
|
|
2142
2205
|
*/
|
|
2143
|
-
const Tabs = Object.assign(
|
|
2206
|
+
const Tabs = Object.assign(primitiveWithForwardRef.primitiveWithForwardRef(TabsPrimitive), {
|
|
2144
2207
|
Item: TabsItem,
|
|
2145
2208
|
List: TabList,
|
|
2146
2209
|
Panel: TabPanel,
|
|
@@ -2153,7 +2216,7 @@ const TextAreaPrimitive = ({ className, isDisabled, isReadOnly, isRequired, size
|
|
|
2153
2216
|
const { isFieldsetDisabled } = Field.useFieldset();
|
|
2154
2217
|
return (React__namespace.createElement(Field.View, { "aria-invalid": hasError, as: "textarea", className: componentClasses, disabled: isFieldsetDisabled ? isFieldsetDisabled : isDisabled, readOnly: isReadOnly, ref: ref, required: isRequired, ...rest }));
|
|
2155
2218
|
};
|
|
2156
|
-
const TextArea =
|
|
2219
|
+
const TextArea = primitiveWithForwardRef.primitiveWithForwardRef(TextAreaPrimitive);
|
|
2157
2220
|
TextArea.displayName = 'TextArea';
|
|
2158
2221
|
|
|
2159
2222
|
const DEFAULT_ROW_COUNT = 3;
|
|
@@ -2163,19 +2226,25 @@ const TextAreaFieldPrimitive = (props, ref) => {
|
|
|
2163
2226
|
// it should go on the textarea element and not the wrapper div.
|
|
2164
2227
|
resize, ..._rest } = props;
|
|
2165
2228
|
const fieldId = useStableId(id);
|
|
2166
|
-
const
|
|
2167
|
-
const
|
|
2229
|
+
const stableId = useStableId();
|
|
2230
|
+
const descriptionId = descriptiveText
|
|
2231
|
+
? getUniqueComponentId(stableId, DESCRIPTION_SUFFIX)
|
|
2232
|
+
: undefined;
|
|
2233
|
+
const errorId = hasError
|
|
2234
|
+
? getUniqueComponentId(stableId, ERROR_SUFFIX)
|
|
2235
|
+
: undefined;
|
|
2236
|
+
const ariaDescribedBy = createSpaceSeparatedIds([errorId, descriptionId]);
|
|
2168
2237
|
const { styleProps, rest } = splitPrimitiveProps(_rest);
|
|
2169
2238
|
return (React__namespace.createElement(Field.Flex, { className: ui.classNames(ui.ComponentClassName.Field, ui.classNameModifier(ui.ComponentClassName.Field, size), ui.ComponentClassName.TextAreaField, className), testId: testId, ...styleProps },
|
|
2170
2239
|
React__namespace.createElement(Field.Label, { htmlFor: fieldId, visuallyHidden: labelHidden }, label),
|
|
2171
2240
|
React__namespace.createElement(Field.FieldDescription, { id: descriptionId, labelHidden: labelHidden, descriptiveText: descriptiveText }),
|
|
2172
2241
|
React__namespace.createElement(TextArea, { "aria-describedby": ariaDescribedBy, hasError: hasError, id: fieldId, ref: ref, rows: rows ?? DEFAULT_ROW_COUNT, size: size, resize: resize, ...rest, ...inputStyles }),
|
|
2173
|
-
React__namespace.createElement(Field.FieldErrorMessage, { hasError: hasError, errorMessage: errorMessage })));
|
|
2242
|
+
React__namespace.createElement(Field.FieldErrorMessage, { id: errorId, hasError: hasError, errorMessage: errorMessage })));
|
|
2174
2243
|
};
|
|
2175
2244
|
/**
|
|
2176
2245
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/textareafield)
|
|
2177
2246
|
*/
|
|
2178
|
-
const TextAreaField =
|
|
2247
|
+
const TextAreaField = primitiveWithForwardRef.primitiveWithForwardRef(TextAreaFieldPrimitive);
|
|
2179
2248
|
TextAreaField.displayName = 'TextAreaField';
|
|
2180
2249
|
|
|
2181
2250
|
const useToggleButton = ({ isPressed, defaultPressed, onClick, onChange, value, }) => {
|
|
@@ -2211,7 +2280,7 @@ const ToggleButtonPrimitive = ({ className, children, defaultPressed = false, is
|
|
|
2211
2280
|
/**
|
|
2212
2281
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/togglebutton)
|
|
2213
2282
|
*/
|
|
2214
|
-
const ToggleButton =
|
|
2283
|
+
const ToggleButton = primitiveWithForwardRef.primitiveWithForwardRef(ToggleButtonPrimitive);
|
|
2215
2284
|
ToggleButton.displayName = 'ToggleButton';
|
|
2216
2285
|
|
|
2217
2286
|
const useToggleButtonGroup = ({ onChange, value, isExclusive = false, isSelectionRequired = false, }) => {
|
|
@@ -2271,7 +2340,7 @@ const ToggleButtonGroupPrimitive = ({ children, className, isExclusive, isSelect
|
|
|
2271
2340
|
/**
|
|
2272
2341
|
* [📖 Docs](https://ui.docs.amplify.aws/react/components/togglebutton#togglebuttongroup)
|
|
2273
2342
|
*/
|
|
2274
|
-
const ToggleButtonGroup =
|
|
2343
|
+
const ToggleButtonGroup = primitiveWithForwardRef.primitiveWithForwardRef(ToggleButtonGroupPrimitive);
|
|
2275
2344
|
ToggleButtonGroup.displayName = 'ToggleButtonGroup';
|
|
2276
2345
|
|
|
2277
2346
|
var index$1 = /*#__PURE__*/Object.freeze({
|
|
@@ -2383,7 +2452,7 @@ const defaultDeleteUserDisplayText = {
|
|
|
2383
2452
|
warningText: 'Deleting your account is not reversible. You will lose access to your account and all data associated with it.',
|
|
2384
2453
|
};
|
|
2385
2454
|
|
|
2386
|
-
const VERSION = '6.
|
|
2455
|
+
const VERSION = '6.2.0';
|
|
2387
2456
|
|
|
2388
2457
|
const logger$2 = ui.getLogger('AccountSettings');
|
|
2389
2458
|
const getIsDisabled = (formValues, validationError) => {
|
|
@@ -3360,13 +3429,10 @@ const { DirectionProvider } = ui.sanitizeNamespaceImport(RadixDirection__namespa
|
|
|
3360
3429
|
*/
|
|
3361
3430
|
function ThemeProvider({ children, colorMode, direction = 'ltr', nonce, theme, }) {
|
|
3362
3431
|
const value = React__namespace.useMemo(() => ({ theme: ui.createTheme(theme), colorMode }), [theme, colorMode]);
|
|
3363
|
-
const { theme: { name, cssText }, } = value;
|
|
3364
3432
|
return (React__namespace.createElement(Field.ThemeContext.Provider, { value: value },
|
|
3365
3433
|
React__namespace.createElement(DirectionProvider, { dir: direction },
|
|
3366
|
-
React__namespace.createElement("div", { "data-amplify-theme": name, "data-amplify-color-mode": colorMode, dir: direction }, children),
|
|
3367
|
-
|
|
3368
|
-
// eslint-disable-next-line react/no-danger
|
|
3369
|
-
dangerouslySetInnerHTML: { __html: cssText }, nonce: nonce })))));
|
|
3434
|
+
React__namespace.createElement("div", { "data-amplify-theme": value.theme.name, "data-amplify-color-mode": colorMode, dir: direction }, children),
|
|
3435
|
+
theme ? React__namespace.createElement(ThemeStyle.ThemeStyle, { theme: value.theme, nonce: nonce }) : null)));
|
|
3370
3436
|
}
|
|
3371
3437
|
|
|
3372
3438
|
var index = /*#__PURE__*/Object.freeze({
|