@openedx/paragon 23.14.1 → 23.14.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +80 -14
- package/dist/ActionRow/index.d.ts +18 -0
- package/dist/ActionRow/index.js +6 -24
- package/dist/ActionRow/index.js.map +1 -1
- package/dist/Alert/index.js +21 -24
- package/dist/Alert/index.js.map +1 -1
- package/dist/Annotation/index.d.ts +13 -0
- package/dist/Annotation/index.js +11 -30
- package/dist/Annotation/index.js.map +1 -1
- package/dist/Avatar/index.d.ts +11 -0
- package/dist/Avatar/index.js +7 -21
- package/dist/Avatar/index.js.map +1 -1
- package/dist/AvatarButton/index.d.ts +17 -0
- package/dist/AvatarButton/index.js +11 -33
- package/dist/AvatarButton/index.js.map +1 -1
- package/dist/Breadcrumb/BreadcrumbLink.js +5 -6
- package/dist/Breadcrumb/BreadcrumbLink.js.map +1 -1
- package/dist/Breadcrumb/index.js +11 -12
- package/dist/Breadcrumb/index.js.map +1 -1
- package/dist/Bubble/index.d.ts +6 -2
- package/dist/Bubble/index.js +14 -39
- package/dist/Bubble/index.js.map +1 -1
- package/dist/Button/index.d.ts +42 -7
- package/dist/Button/index.js +43 -115
- package/dist/Button/index.js.map +1 -1
- package/dist/Card/BaseCard.js +11 -12
- package/dist/Card/BaseCard.js.map +1 -1
- package/dist/Card/CardBody.js +9 -12
- package/dist/Card/CardBody.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarousel.js +13 -14
- package/dist/Card/CardCarousel/CardCarousel.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselHeader.js +4 -5
- package/dist/Card/CardCarousel/CardCarouselHeader.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselItems.js +3 -4
- package/dist/Card/CardCarousel/CardCarouselItems.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselProvider.js +7 -8
- package/dist/Card/CardCarousel/CardCarouselProvider.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselSubtitle.js.map +1 -1
- package/dist/Card/CardCarousel/CardCarouselTitle.js +5 -6
- package/dist/Card/CardCarousel/CardCarouselTitle.js.map +1 -1
- package/dist/Card/CardCarousel/messages.d.ts +13 -0
- package/dist/Card/CardCarousel/messages.js +4 -5
- package/dist/Card/CardCarousel/messages.js.map +1 -0
- package/dist/Card/CardContext.js +6 -7
- package/dist/Card/CardContext.js.map +1 -1
- package/dist/Card/CardDeck.js +9 -10
- package/dist/Card/CardDeck.js.map +1 -1
- package/dist/Card/CardDivider.js +8 -11
- package/dist/Card/CardDivider.js.map +1 -1
- package/dist/Card/CardFooter.js +9 -10
- package/dist/Card/CardFooter.js.map +1 -1
- package/dist/Card/CardGrid.js +6 -7
- package/dist/Card/CardGrid.js.map +1 -1
- package/dist/Card/CardHeader.js +9 -10
- package/dist/Card/CardHeader.js.map +1 -1
- package/dist/Card/CardImageCap.js +15 -16
- package/dist/Card/CardImageCap.js.map +1 -1
- package/dist/Card/CardSection.js +9 -10
- package/dist/Card/CardSection.js.map +1 -1
- package/dist/Card/CardStatus.js +9 -10
- package/dist/Card/CardStatus.js.map +1 -1
- package/dist/Card/index.js +9 -10
- package/dist/Card/index.js.map +1 -1
- package/dist/Chip/ChipIcon.js +8 -9
- package/dist/Chip/ChipIcon.js.map +1 -1
- package/dist/Chip/index.d.ts +22 -0
- package/dist/Chip/index.js +15 -70
- package/dist/Chip/index.js.map +1 -1
- package/dist/ChipCarousel/index.js +49 -53
- package/dist/ChipCarousel/index.js.map +1 -1
- package/dist/ChipCarousel/messages.d.ts +13 -0
- package/dist/ChipCarousel/messages.js +4 -5
- package/dist/ChipCarousel/messages.js.map +1 -0
- package/dist/CloseButton/index.js.map +1 -1
- package/dist/Collapse/index.js.map +1 -1
- package/dist/Collapsible/CollapsibleBody.js +6 -7
- package/dist/Collapsible/CollapsibleBody.js.map +1 -1
- package/dist/Collapsible/CollapsibleTrigger.js +9 -10
- package/dist/Collapsible/CollapsibleTrigger.js.map +1 -1
- package/dist/Collapsible/CollapsibleVisible.js +5 -6
- package/dist/Collapsible/CollapsibleVisible.js.map +1 -1
- package/dist/ColorPicker/index.js +6 -7
- package/dist/ColorPicker/index.js.map +1 -1
- package/dist/Container/index.js +9 -12
- package/dist/Container/index.js.map +1 -1
- package/dist/DataTable/BulkActions.js +4 -5
- package/dist/DataTable/BulkActions.js.map +1 -1
- package/dist/DataTable/CardView.js +16 -18
- package/dist/DataTable/CardView.js.map +1 -1
- package/dist/DataTable/CollapsibleButtonGroup.js +5 -6
- package/dist/DataTable/CollapsibleButtonGroup.js.map +1 -1
- package/dist/DataTable/DataTableLayout.js +5 -6
- package/dist/DataTable/DataTableLayout.js.map +1 -1
- package/dist/DataTable/DropdownFilters.js +7 -2
- package/dist/DataTable/DropdownFilters.js.map +1 -1
- package/dist/DataTable/EmptyTable.js +5 -6
- package/dist/DataTable/EmptyTable.js.map +1 -1
- package/dist/DataTable/ExpandAll.js +4 -5
- package/dist/DataTable/ExpandAll.js.map +1 -1
- package/dist/DataTable/ExpandRow.js +3 -4
- package/dist/DataTable/ExpandRow.js.map +1 -1
- package/dist/DataTable/FilterStatus.js +8 -9
- package/dist/DataTable/FilterStatus.js.map +1 -1
- package/dist/DataTable/RowStatus.js +4 -5
- package/dist/DataTable/RowStatus.js.map +1 -1
- package/dist/DataTable/SidebarFilters.js +3 -4
- package/dist/DataTable/SidebarFilters.js.map +1 -1
- package/dist/DataTable/Table.js +3 -4
- package/dist/DataTable/Table.js.map +1 -1
- package/dist/DataTable/TableActions.js +3 -4
- package/dist/DataTable/TableActions.js.map +1 -1
- package/dist/DataTable/TableCell.js +5 -6
- package/dist/DataTable/TableCell.js.map +1 -1
- package/dist/DataTable/TableControlBar.js +3 -4
- package/dist/DataTable/TableControlBar.js.map +1 -1
- package/dist/DataTable/TableFilters.js +6 -7
- package/dist/DataTable/TableFilters.js.map +1 -1
- package/dist/DataTable/TableFooter.js +4 -5
- package/dist/DataTable/TableFooter.js.map +1 -1
- package/dist/DataTable/TableHeaderCell.js +13 -15
- package/dist/DataTable/TableHeaderCell.js.map +1 -1
- package/dist/DataTable/TableHeaderRow.js +3 -4
- package/dist/DataTable/TableHeaderRow.js.map +1 -1
- package/dist/DataTable/TableRow.js +3 -4
- package/dist/DataTable/TableRow.js.map +1 -1
- package/dist/DataTable/filters/CheckboxFilter.js +25 -29
- package/dist/DataTable/filters/CheckboxFilter.js.map +1 -1
- package/dist/DataTable/filters/DropdownFilter.js +16 -20
- package/dist/DataTable/filters/DropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js +25 -29
- package/dist/DataTable/filters/MultiSelectDropdownFilter.js.map +1 -1
- package/dist/DataTable/filters/TextFilter.js +8 -9
- package/dist/DataTable/filters/TextFilter.js.map +1 -1
- package/dist/DataTable/hooks.js +11 -13
- package/dist/DataTable/hooks.js.map +1 -1
- package/dist/DataTable/index.js +42 -36
- package/dist/DataTable/index.js.map +1 -1
- package/dist/DataTable/messages.d.ts +13 -0
- package/dist/DataTable/messages.js +7 -3
- package/dist/DataTable/messages.js.map +1 -0
- package/dist/DataTable/selection/BaseSelectionStatus.js +11 -12
- package/dist/DataTable/selection/BaseSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelect.js +3 -4
- package/dist/DataTable/selection/ControlledSelect.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectHeader.js +3 -4
- package/dist/DataTable/selection/ControlledSelectHeader.js.map +1 -1
- package/dist/DataTable/selection/ControlledSelectionStatus.js +4 -5
- package/dist/DataTable/selection/ControlledSelectionStatus.js.map +1 -1
- package/dist/DataTable/selection/SelectionStatus.js +4 -5
- package/dist/DataTable/selection/SelectionStatus.js.map +1 -1
- package/dist/DataTable/utils/getVisibleColumns.js +9 -13
- package/dist/DataTable/utils/getVisibleColumns.js.map +1 -1
- package/dist/Dropdown/index.js +17 -20
- package/dist/Dropdown/index.js.map +1 -1
- package/dist/Dropzone/DefaultContent.js +5 -6
- package/dist/Dropzone/DefaultContent.js.map +1 -1
- package/dist/Dropzone/DragError.js +3 -4
- package/dist/Dropzone/DragError.js.map +1 -1
- package/dist/Dropzone/GenericError.js +4 -5
- package/dist/Dropzone/GenericError.js.map +1 -1
- package/dist/Dropzone/UploadProgress.js +6 -7
- package/dist/Dropzone/UploadProgress.js.map +1 -1
- package/dist/Dropzone/index.js +14 -15
- package/dist/Dropzone/index.js.map +1 -1
- package/dist/Dropzone/messages.d.ts +53 -0
- package/dist/Dropzone/messages.js +12 -13
- package/dist/Dropzone/messages.js.map +1 -0
- package/dist/Fade/index.js.map +1 -1
- package/dist/Form/FormAutosuggest.js +18 -20
- package/dist/Form/FormAutosuggest.js.map +1 -1
- package/dist/Form/FormAutosuggestOption.js +6 -7
- package/dist/Form/FormAutosuggestOption.js.map +1 -1
- package/dist/Form/FormCheckbox.js +16 -18
- package/dist/Form/FormCheckbox.js.map +1 -1
- package/dist/Form/FormCheckboxSet.js +11 -12
- package/dist/Form/FormCheckboxSet.js.map +1 -1
- package/dist/Form/FormCheckboxSetContext.js +9 -10
- package/dist/Form/FormCheckboxSetContext.js.map +1 -1
- package/dist/Form/FormControl.js +12 -13
- package/dist/Form/FormControl.js.map +1 -1
- package/dist/Form/FormControlDecorator.js +4 -5
- package/dist/Form/FormControlDecorator.js.map +1 -1
- package/dist/Form/FormControlDecoratorGroup.js +8 -9
- package/dist/Form/FormControlDecoratorGroup.js.map +1 -1
- package/dist/Form/FormControlFeedback.js +4 -5
- package/dist/Form/FormControlFeedback.js.map +1 -1
- package/dist/Form/FormControlFloatingLabel.js +3 -4
- package/dist/Form/FormControlFloatingLabel.js.map +1 -1
- package/dist/Form/FormControlSet.js +7 -8
- package/dist/Form/FormControlSet.js.map +1 -1
- package/dist/Form/FormGroup.js +9 -10
- package/dist/Form/FormGroup.js.map +1 -1
- package/dist/Form/FormGroupContext.js +7 -8
- package/dist/Form/FormGroupContext.js.map +1 -1
- package/dist/Form/FormLabel.d.ts +2 -11
- package/dist/Form/FormLabel.js +5 -15
- package/dist/Form/FormLabel.js.map +1 -1
- package/dist/Form/FormRadio.js +28 -31
- package/dist/Form/FormRadio.js.map +1 -1
- package/dist/Form/FormRadioSet.js +11 -12
- package/dist/Form/FormRadioSet.js.map +1 -1
- package/dist/Form/FormRadioSetContext.js +9 -10
- package/dist/Form/FormRadioSetContext.js.map +1 -1
- package/dist/Form/FormSwitch.js +25 -29
- package/dist/Form/FormSwitch.js.map +1 -1
- package/dist/Form/FormText.js +16 -19
- package/dist/Form/FormText.js.map +1 -1
- package/dist/Form/fieldUtils.js +11 -22
- package/dist/Form/fieldUtils.js.map +1 -1
- package/dist/Form/useCheckboxSetValues.js +1 -2
- package/dist/Form/useCheckboxSetValues.js.map +1 -1
- package/dist/Hyperlink/index.js +17 -21
- package/dist/Hyperlink/index.js.map +1 -1
- package/dist/Icon/index.js +10 -11
- package/dist/Icon/index.js.map +1 -1
- package/dist/IconButton/index.d.ts +8 -304
- package/dist/IconButton/index.js +21 -84
- package/dist/IconButton/index.js.map +1 -1
- package/dist/IconButtonToggle/index.js +5 -6
- package/dist/IconButtonToggle/index.js.map +1 -1
- package/dist/Image/index.js.map +1 -1
- package/dist/Layout/index.js +4 -5
- package/dist/Layout/index.js.map +1 -1
- package/dist/Media/index.js.map +1 -1
- package/dist/Menu/MenuItem.js +8 -9
- package/dist/Menu/MenuItem.js.map +1 -1
- package/dist/Menu/SelectMenu.js +8 -9
- package/dist/Menu/SelectMenu.js.map +1 -1
- package/dist/Menu/index.js +6 -7
- package/dist/Menu/index.js.map +1 -1
- package/dist/Modal/AlertModal.js +6 -7
- package/dist/Modal/AlertModal.js.map +1 -1
- package/dist/Modal/FullscreenModal.js +7 -8
- package/dist/Modal/FullscreenModal.js.map +1 -1
- package/dist/Modal/MarketingModal.js +9 -10
- package/dist/Modal/MarketingModal.js.map +1 -1
- package/dist/Modal/ModalCloseButton.js +5 -6
- package/dist/Modal/ModalCloseButton.js.map +1 -1
- package/dist/Modal/ModalContext.js +6 -7
- package/dist/Modal/ModalContext.js.map +1 -1
- package/dist/Modal/ModalDialog.d.ts +6 -65
- package/dist/Modal/ModalDialog.js +16 -81
- package/dist/Modal/ModalDialog.js.map +1 -1
- package/dist/Modal/ModalDialogBody.js +5 -6
- package/dist/Modal/ModalDialogBody.js.map +1 -1
- package/dist/Modal/ModalDialogFooter.js +5 -6
- package/dist/Modal/ModalDialogFooter.js.map +1 -1
- package/dist/Modal/ModalDialogHeader.js +9 -12
- package/dist/Modal/ModalDialogHeader.js.map +1 -1
- package/dist/Modal/ModalDialogHero.js +5 -6
- package/dist/Modal/ModalDialogHero.js.map +1 -1
- package/dist/Modal/ModalDialogHeroBackground.js +6 -7
- package/dist/Modal/ModalDialogHeroBackground.js.map +1 -1
- package/dist/Modal/ModalDialogHeroContent.js +5 -6
- package/dist/Modal/ModalDialogHeroContent.js.map +1 -1
- package/dist/Modal/ModalDialogTitle.js +5 -6
- package/dist/Modal/ModalDialogTitle.js.map +1 -1
- package/dist/Modal/ModalLayer.d.ts +0 -25
- package/dist/Modal/ModalLayer.js +13 -35
- package/dist/Modal/ModalLayer.js.map +1 -1
- package/dist/Modal/ModalPopup.js +11 -12
- package/dist/Modal/ModalPopup.js.map +1 -1
- package/dist/Modal/PopperElement.js +7 -8
- package/dist/Modal/PopperElement.js.map +1 -1
- package/dist/Modal/StandardModal.js +7 -8
- package/dist/Modal/StandardModal.js.map +1 -1
- package/dist/OverflowScroll/OverflowScroll.js +12 -13
- package/dist/OverflowScroll/OverflowScroll.js.map +1 -1
- package/dist/OverflowScroll/OverflowScrollItems.js +3 -4
- package/dist/OverflowScroll/OverflowScrollItems.js.map +1 -1
- package/dist/Overlay/index.d.ts +2 -2
- package/dist/PageBanner/index.js +9 -10
- package/dist/PageBanner/index.js.map +1 -1
- package/dist/Pagination/PaginationContext.js +12 -13
- package/dist/Pagination/PaginationContext.js.map +1 -1
- package/dist/Pagination/subcomponents/PageButton.js +3 -4
- package/dist/Pagination/subcomponents/PageButton.js.map +1 -1
- package/dist/Popover/index.js +11 -14
- package/dist/Popover/index.js.map +1 -1
- package/dist/ProductTour/Checkpoint.js +12 -13
- package/dist/ProductTour/Checkpoint.js.map +1 -1
- package/dist/ProductTour/CheckpointActionRow.js +10 -11
- package/dist/ProductTour/CheckpointActionRow.js.map +1 -1
- package/dist/ProductTour/CheckpointBody.js +3 -4
- package/dist/ProductTour/CheckpointBody.js.map +1 -1
- package/dist/ProductTour/CheckpointHeader.js +7 -8
- package/dist/ProductTour/CheckpointHeader.js.map +1 -1
- package/dist/ProductTour/CheckpointTitle.js +6 -9
- package/dist/ProductTour/CheckpointTitle.js.map +1 -1
- package/dist/ProductTour/index.js +3 -4
- package/dist/ProductTour/index.js.map +1 -1
- package/dist/ProductTour/messages.d.ts +23 -0
- package/dist/ProductTour/messages.js +6 -7
- package/dist/ProductTour/messages.js.map +1 -0
- package/dist/ProgressBar/index.js +11 -12
- package/dist/ProgressBar/index.js.map +1 -1
- package/dist/ResponsiveEmbed/index.js.map +1 -1
- package/dist/Scrollable/index.js +4 -5
- package/dist/Scrollable/index.js.map +1 -1
- package/dist/SearchField/SearchFieldLabel.js +4 -5
- package/dist/SearchField/SearchFieldLabel.js.map +1 -1
- package/dist/SelectableBox/SelectableBoxSet.js +13 -14
- package/dist/SelectableBox/SelectableBoxSet.js.map +1 -1
- package/dist/SelectableBox/index.js +14 -15
- package/dist/SelectableBox/index.js.map +1 -1
- package/dist/Skeleton/index.js.map +1 -1
- package/dist/Spinner/index.d.ts +11 -0
- package/dist/Spinner/index.js +6 -17
- package/dist/Spinner/index.js.map +1 -1
- package/dist/Stack/index.js +12 -15
- package/dist/Stack/index.js.map +1 -1
- package/dist/StatefulButton/index.js +9 -10
- package/dist/StatefulButton/index.js.map +1 -1
- package/dist/Stepper/Stepper.js +4 -5
- package/dist/Stepper/Stepper.js.map +1 -1
- package/dist/Stepper/StepperActionRow.js +6 -7
- package/dist/Stepper/StepperActionRow.js.map +1 -1
- package/dist/Stepper/StepperContext.js +4 -5
- package/dist/Stepper/StepperContext.js.map +1 -1
- package/dist/Stepper/StepperHeader.js +23 -31
- package/dist/Stepper/StepperHeader.js.map +1 -1
- package/dist/Stepper/StepperHeaderStep.js +8 -9
- package/dist/Stepper/StepperHeaderStep.js.map +1 -1
- package/dist/Stepper/StepperStep.js +10 -11
- package/dist/Stepper/StepperStep.js.map +1 -1
- package/dist/Sticky/index.js +8 -12
- package/dist/Sticky/index.js.map +1 -1
- package/dist/Tabs/index.js +8 -9
- package/dist/Tabs/index.js.map +1 -1
- package/dist/Toast/ToastContainer.js +3 -4
- package/dist/Toast/ToastContainer.js.map +1 -1
- package/dist/Toast/index.d.ts +20 -41
- package/dist/Toast/index.js +11 -48
- package/dist/Toast/index.js.map +1 -1
- package/dist/ToggleButton/index.js.map +1 -1
- package/dist/Tooltip/index.js +11 -14
- package/dist/Tooltip/index.js.map +1 -1
- package/dist/Truncate/index.js +9 -10
- package/dist/Truncate/index.js.map +1 -1
- package/dist/asInput/index.js +9 -13
- package/dist/asInput/index.js.map +1 -1
- package/dist/hooks/useArrowKeyNavigationHook.js +17 -21
- package/dist/hooks/useArrowKeyNavigationHook.js.map +1 -1
- package/dist/hooks/useIsVisibleHook.js +4 -6
- package/dist/hooks/useIsVisibleHook.js.map +1 -1
- package/dist/hooks/useToggleHook.js +1 -3
- package/dist/hooks/useToggleHook.js.map +1 -1
- package/dist/index.d.ts +5 -5
- package/dist/index.js +5 -10
- package/dist/index.js.map +1 -1
- package/dist/theme-urls.json +6 -6
- package/dist/utils/newId.js +1 -2
- package/dist/utils/newId.js.map +1 -1
- package/package.json +2 -2
- package/src/ActionRow/{index.jsx → index.tsx} +14 -22
- package/src/Annotation/{index.jsx → index.tsx} +15 -22
- package/src/Avatar/{index.jsx → index.tsx} +13 -19
- package/src/AvatarButton/{index.jsx → index.tsx} +23 -31
- package/src/Bubble/index.tsx +12 -32
- package/src/Button/index.tsx +68 -93
- package/src/Chip/index.tsx +26 -59
- package/src/CloseButton/index.tsx +1 -0
- package/src/Collapse/index.tsx +1 -0
- package/src/DataTable/DropdownFilters.jsx +9 -2
- package/src/DataTable/README.md +19 -18
- package/src/DataTable/index.jsx +6 -1
- package/src/DataTable/{messages.js → messages.ts} +5 -0
- package/src/DataTable/tests/DataTable.test.jsx +51 -1
- package/src/DataTable/tests/DropdownFilters.test.jsx +11 -7
- package/src/Fade/index.tsx +1 -0
- package/src/Form/FormLabel.tsx +2 -10
- package/src/IconButton/index.tsx +17 -81
- package/src/Image/index.tsx +2 -0
- package/src/Media/index.tsx +1 -0
- package/src/Modal/ModalDialog.tsx +6 -66
- package/src/Modal/ModalLayer.tsx +0 -22
- package/src/Modal/modal-popup.mdx +1 -1
- package/src/ProductTour/ProductTour.test.jsx +0 -1
- package/src/ResponsiveEmbed/index.tsx +1 -0
- package/src/Skeleton/index.tsx +1 -0
- package/src/Spinner/{index.jsx → index.tsx} +10 -15
- package/src/Toast/index.tsx +21 -40
- package/src/ToggleButton/index.tsx +2 -0
- package/src/index.ts +5 -10
- /package/{src/CloseButton/index.jsx → dist/CloseButton/index.d.ts} +0 -0
- /package/{src/Collapse/index.jsx → dist/Collapse/index.d.ts} +0 -0
- /package/{src/Fade/index.jsx → dist/Fade/index.d.ts} +0 -0
- /package/{src/Image/index.jsx → dist/Image/index.d.ts} +0 -0
- /package/{src/Media/index.jsx → dist/Media/index.d.ts} +0 -0
- /package/{src/ResponsiveEmbed/index.jsx → dist/ResponsiveEmbed/index.d.ts} +0 -0
- /package/{src/Skeleton/index.jsx → dist/Skeleton/index.d.ts} +0 -0
- /package/{src/ToggleButton/index.jsx → dist/ToggleButton/index.d.ts} +0 -0
- /package/src/Card/CardCarousel/{messages.js → messages.ts} +0 -0
- /package/src/ChipCarousel/{messages.js → messages.ts} +0 -0
- /package/src/Dropzone/{messages.js → messages.ts} +0 -0
- /package/src/ProductTour/{messages.js → messages.ts} +0 -0
- /package/src/Spinner/{Spinner.test.jsx → Spinner.test.tsx} +0 -0
- /package/src/Spinner/__snapshots__/{Spinner.test.jsx.snap → Spinner.test.tsx.snap} +0 -0
|
@@ -12,24 +12,23 @@ import IconButton from '../IconButton';
|
|
|
12
12
|
import Spinner from '../Spinner';
|
|
13
13
|
import useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';
|
|
14
14
|
import messages from './messages';
|
|
15
|
-
const FormAutosuggest = /*#__PURE__*/forwardRef((
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
} = _ref;
|
|
15
|
+
const FormAutosuggest = /*#__PURE__*/forwardRef(({
|
|
16
|
+
children,
|
|
17
|
+
arrowKeyNavigationSelector,
|
|
18
|
+
ignoredArrowKeysNames,
|
|
19
|
+
screenReaderText,
|
|
20
|
+
value,
|
|
21
|
+
isLoading,
|
|
22
|
+
isValueRequired,
|
|
23
|
+
valueRequiredErrorMessageText,
|
|
24
|
+
isSelectionRequired,
|
|
25
|
+
selectionRequiredErrorMessageText,
|
|
26
|
+
hasCustomError,
|
|
27
|
+
customErrorMessageText,
|
|
28
|
+
onChange,
|
|
29
|
+
helpMessage,
|
|
30
|
+
...props
|
|
31
|
+
}, ref) => {
|
|
33
32
|
const intl = useIntl();
|
|
34
33
|
const formControlRef = useRef();
|
|
35
34
|
const parentRef = useArrowKeyNavigation({
|
|
@@ -71,8 +70,7 @@ const FormAutosuggest = /*#__PURE__*/forwardRef((_ref, ref) => {
|
|
|
71
70
|
onClick(e);
|
|
72
71
|
}
|
|
73
72
|
};
|
|
74
|
-
function getItems() {
|
|
75
|
-
let strToFind = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '';
|
|
73
|
+
function getItems(strToFind = '') {
|
|
76
74
|
let childrenOpt = React.Children.map(children, child => {
|
|
77
75
|
const {
|
|
78
76
|
children: childChildren,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutosuggest.js","names":["React","useEffect","useState","useRef","forwardRef","useImperativeHandle","PropTypes","v4","uuidv4","useIntl","requiredWhen","KeyboardArrowUp","KeyboardArrowDown","Icon","FormGroupContextProvider","useFormGroupContext","FormControl","FormControlFeedback","IconButton","Spinner","useArrowKeyNavigation","messages","FormAutosuggest","_ref","ref","children","arrowKeyNavigationSelector","ignoredArrowKeysNames","screenReaderText","value","isLoading","isValueRequired","valueRequiredErrorMessageText","isSelectionRequired","selectionRequiredErrorMessageText","hasCustomError","customErrorMessageText","onChange","helpMessage","props","intl","formControlRef","parentRef","selectors","ignoredKeys","isDropdownExpanded","setIsDropdownExpanded","isActive","setIsActive","hasValue","setHasValue","hasSelection","setHasSelection","displayValue","setDisplayValue","userProvidedText","dropdownItems","setDropdownItems","activeMenuItemId","setActiveMenuItemId","isValid","setIsValid","errorMessage","setErrorMessage","handleMenuItemFocus","menuItemId","collapseDropdown","handleItemSelect","e","onClick","selectedValue","currentTarget","getAttribute","selectedId","id","selectionValue","selectionId","getItems","strToFind","arguments","length","undefined","childrenOpt","Children","map","child","childChildren","rest","cloneElement","onFocus","filter","opt","toLowerCase","includes","expandDropdown","toggleDropdown","iconToggle","createElement","className","tabIndex","src","iconAs","size","variant","alt","formatMessage","iconButtonClosed","iconButtonOpened","enterControl","updateErrorStateAndErrorMessage","leaveControl","keyDownHandler","key","preventDefault","current","focus","handleDocumentClick","contains","target","document","addEventListener","removeEventListener","handleTextboxClick","handleTextInput","filteredItems","matchingDropdownItem","find","o","getControlProps","controlProps","controlId","isInvalid","toString","role","autoComplete","trailingElement","type","name","animation","defaultProps","floatingLabel","placeholder","readOnly","propTypes","string","arrayOf","bool","func","shape","node"],"sources":["../../src/Form/FormAutosuggest.jsx"],"sourcesContent":["import React, {\n useEffect, useState, useRef, forwardRef, useImperativeHandle,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useIntl } from 'react-intl';\nimport { requiredWhen } from '../utils/propTypes';\nimport { KeyboardArrowUp, KeyboardArrowDown } from '../../icons';\nimport Icon from '../Icon';\nimport { FormGroupContextProvider, useFormGroupContext } from './FormGroupContext';\nimport FormControl from './FormControl';\nimport FormControlFeedback from './FormControlFeedback';\nimport IconButton from '../IconButton';\nimport Spinner from '../Spinner';\nimport useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';\nimport messages from './messages';\n\nconst FormAutosuggest = forwardRef(\n (\n {\n children,\n arrowKeyNavigationSelector,\n ignoredArrowKeysNames,\n screenReaderText,\n value,\n isLoading,\n isValueRequired,\n valueRequiredErrorMessageText,\n isSelectionRequired,\n selectionRequiredErrorMessageText,\n hasCustomError,\n customErrorMessageText,\n onChange,\n helpMessage,\n ...props\n },\n ref,\n ) => {\n const intl = useIntl();\n const formControlRef = useRef();\n const parentRef = useArrowKeyNavigation({\n selectors: arrowKeyNavigationSelector,\n ignoredKeys: ignoredArrowKeysNames,\n });\n const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);\n const [isActive, setIsActive] = useState(false);\n const [hasValue, setHasValue] = useState(false);\n const [hasSelection, setHasSelection] = useState(false);\n const [displayValue, setDisplayValue] = useState(value?.userProvidedText || '');\n const [dropdownItems, setDropdownItems] = useState([]);\n const [activeMenuItemId, setActiveMenuItemId] = useState(null);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n\n const handleMenuItemFocus = (menuItemId) => {\n setActiveMenuItemId(menuItemId);\n };\n\n const collapseDropdown = () => {\n setDropdownItems([]);\n setIsDropdownExpanded(false);\n setActiveMenuItemId(null);\n };\n\n const handleItemSelect = (e, onClick) => {\n const selectedValue = e.currentTarget.getAttribute('data-value');\n const selectedId = e.currentTarget.id;\n\n setHasValue(true);\n setHasSelection(true);\n setDisplayValue(selectedValue);\n\n if (onChange && (!value || (value && selectedValue !== value.selectionValue))) {\n onChange({\n userProvidedText: selectedValue,\n selectionValue: selectedValue,\n selectionId: selectedId,\n });\n }\n\n collapseDropdown();\n\n if (onClick) {\n onClick(e);\n }\n };\n\n function getItems(strToFind = '') {\n let childrenOpt = React.Children.map(children, (child) => {\n const { children: childChildren, onClick, ...rest } = child.props;\n const menuItemId = child.props.id ?? uuidv4();\n\n return React.cloneElement(child, {\n ...rest,\n children: childChildren,\n 'data-value': childChildren,\n onClick: (e) => handleItemSelect(e, onClick),\n id: menuItemId,\n onFocus: () => handleMenuItemFocus(menuItemId),\n });\n });\n\n if (strToFind.length > 0) {\n childrenOpt = childrenOpt\n .filter((opt) => (opt.props.children.toLowerCase().includes(strToFind.toLowerCase())));\n }\n\n return childrenOpt;\n }\n\n const expandDropdown = () => {\n setDropdownItems(getItems(displayValue));\n setIsValid(true);\n setErrorMessage('');\n setIsDropdownExpanded(true);\n };\n\n const toggleDropdown = () => {\n if (isDropdownExpanded) {\n collapseDropdown();\n } else {\n expandDropdown();\n }\n };\n\n const iconToggle = (\n <IconButton\n className=\"pgn__form-autosuggest__icon-button\"\n data-testid=\"autosuggest-iconbutton\"\n tabIndex=\"-1\"\n src={isDropdownExpanded ? KeyboardArrowUp : KeyboardArrowDown}\n iconAs={Icon}\n size=\"sm\"\n variant=\"secondary\"\n alt={isDropdownExpanded\n ? intl.formatMessage(messages.iconButtonClosed)\n : intl.formatMessage(messages.iconButtonOpened)}\n onClick={toggleDropdown}\n />\n );\n\n const enterControl = () => {\n setIsActive(true);\n };\n\n const updateErrorStateAndErrorMessage = () => {\n if (hasCustomError) {\n setIsValid(false);\n setErrorMessage(customErrorMessageText);\n return;\n }\n\n if (isValueRequired && !hasValue) {\n setIsValid(false);\n setErrorMessage(valueRequiredErrorMessageText);\n return;\n }\n\n if (hasValue && isSelectionRequired && !hasSelection) {\n setIsValid(false);\n setErrorMessage(selectionRequiredErrorMessageText);\n return;\n }\n\n setIsValid(true);\n setErrorMessage('');\n };\n\n useImperativeHandle(ref, () => ({\n // expose updateErrorStateAndErrorMessage so consumers can trigger validation\n // when changing the value of the control externally\n updateErrorStateAndErrorMessage,\n }));\n\n const leaveControl = () => {\n setIsActive(false);\n collapseDropdown();\n updateErrorStateAndErrorMessage();\n };\n\n const keyDownHandler = e => {\n if (!isActive) {\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n\n if (formControlRef) {\n formControlRef.current.focus();\n }\n\n collapseDropdown();\n return;\n }\n\n if (e.key === 'Tab') {\n leaveControl();\n }\n };\n\n const handleDocumentClick = (e) => {\n if (parentRef.current && !parentRef.current.contains(e.target) && isActive) {\n leaveControl();\n }\n };\n\n useEffect(() => {\n document.addEventListener('keydown', keyDownHandler);\n document.addEventListener('click', handleDocumentClick, true);\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n document.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n useEffect(() => {\n setDisplayValue(value ? value.userProvidedText ?? '' : '');\n setHasValue(!!value && !!value.userProvidedText);\n setHasSelection(!!value && !!value.selectionValue);\n }, [value]);\n\n const handleTextboxClick = () => {\n expandDropdown();\n };\n\n const handleTextInput = (e) => {\n const userProvidedText = e.target.value;\n\n // If the user has removed all text from the textbox\n if (!userProvidedText.length) {\n // reset to a \"no text, nothing selected\" state\n setDisplayValue('');\n setHasValue(false);\n setHasSelection(false);\n\n // clear and close the dropdown\n setDropdownItems([]);\n collapseDropdown();\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send a default empty object\n onChange({\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n });\n }\n return;\n }\n\n // the user has entered text, we have a value\n setHasValue(true);\n\n // filter dropdown based on entered text\n const filteredItems = getItems(userProvidedText);\n setDropdownItems(filteredItems);\n\n // check for matches in the dropdown\n const matchingDropdownItem = filteredItems.find((o) => (\n o.props.children.toLowerCase() === userProvidedText.toLowerCase()\n ));\n\n // if we didn't find a match\n if (!matchingDropdownItem) {\n // no match means no selection\n setHasSelection(false);\n\n // set the text in the state\n setDisplayValue(userProvidedText);\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send an object with the user provided text only\n onChange({\n userProvidedText,\n selectionValue: '',\n selectionId: '',\n });\n }\n return;\n }\n\n // we found a match, we have a selection!\n setHasSelection(true);\n\n // set the display value based on the item in the dropdown\n // this matters because we match case insensitively\n setDisplayValue(matchingDropdownItem.props.children);\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send an object with the selected item values\n onChange({\n userProvidedText: matchingDropdownItem.props.children,\n selectionValue: matchingDropdownItem.props.children,\n selectionId: matchingDropdownItem.props.id,\n });\n }\n };\n\n const { getControlProps } = useFormGroupContext();\n const controlProps = getControlProps(props);\n\n return (\n <div className=\"pgn__form-autosuggest__wrapper\" ref={parentRef} onFocus={enterControl}>\n <div aria-live=\"assertive\" className=\"sr-only\" data-testid=\"autosuggest-screen-reader-options-count\">\n {`${dropdownItems.length} options found`}\n </div>\n <FormGroupContextProvider\n controlId={controlProps.id}\n isInvalid={!isValid}\n >\n <FormControl\n ref={formControlRef}\n aria-expanded={(dropdownItems.length > 0).toString()}\n aria-owns=\"pgn__form-autosuggest__dropdown-box\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autoComplete=\"off\"\n value={displayValue}\n aria-invalid={errorMessage}\n aria-activedescendant={activeMenuItemId}\n onChange={handleTextInput}\n onClick={handleTextboxClick}\n trailingElement={iconToggle}\n data-testid=\"autosuggest-textbox-input\"\n {...controlProps}\n />\n\n {helpMessage && isValid && (\n <FormControlFeedback type=\"default\">\n {helpMessage}\n </FormControlFeedback>\n )}\n\n {!isValid && (\n <FormControlFeedback type=\"invalid\" feedback-for={controlProps.name}>\n {errorMessage}\n </FormControlFeedback>\n )}\n </FormGroupContextProvider>\n <ul\n id=\"pgn__form-autosuggest__dropdown-box\"\n className=\"pgn__form-autosuggest__dropdown\"\n role=\"listbox\"\n >\n {isLoading ? (\n <div className=\"pgn__form-autosuggest__dropdown-loading\">\n <Spinner\n animation=\"border\"\n variant=\"dark\"\n screenReaderText={screenReaderText}\n data-testid=\"autosuggest-loading-spinner\"\n />\n </div>\n ) : dropdownItems.length > 0 && dropdownItems}\n </ul>\n </div>\n );\n },\n);\n\nFormAutosuggest.defaultProps = {\n arrowKeyNavigationSelector: 'a:not(:disabled),li:not(:disabled, .btn-icon),input:not(:disabled)',\n ignoredArrowKeysNames: ['ArrowRight', 'ArrowLeft'],\n isLoading: false,\n className: null,\n floatingLabel: null,\n onChange: null,\n helpMessage: '',\n placeholder: '',\n value: null,\n isValueRequired: false,\n valueRequiredErrorMessageText: null,\n isSelectionRequired: false,\n selectionRequiredErrorMessageText: null,\n hasCustomError: false,\n customErrorMessageText: null,\n readOnly: false,\n children: null,\n name: 'form-autosuggest',\n screenReaderText: 'loading',\n};\n\nFormAutosuggest.propTypes = {\n /**\n * Specifies the CSS selector string that indicates to which elements\n * the user can navigate using the arrow keys\n */\n arrowKeyNavigationSelector: PropTypes.string,\n /** Specifies ignored hook keys. */\n ignoredArrowKeysNames: PropTypes.arrayOf(PropTypes.string),\n /** Specifies loading state. */\n isLoading: PropTypes.bool,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies floating label to display for the input component. */\n floatingLabel: PropTypes.string,\n /** Specifies onChange event handler. */\n onChange: PropTypes.func,\n /** Specifies help information for the user. */\n helpMessage: PropTypes.string,\n /** Specifies the placeholder text for the input. */\n placeholder: PropTypes.string,\n /** Specifies values for the input. */\n value: PropTypes.shape({\n userProvidedText: PropTypes.string,\n selectionValue: PropTypes.string,\n selectionId: PropTypes.string,\n }),\n /** Specifies if empty values trigger an error state */\n isValueRequired: PropTypes.bool,\n /** Informs user they must input a value. */\n valueRequiredErrorMessageText: requiredWhen(PropTypes.string, 'isValueRequired'),\n /** Specifies if freeform values trigger an error state */\n isSelectionRequired: PropTypes.bool,\n /** Informs user they must make a selection. */\n selectionRequiredErrorMessageText: requiredWhen(PropTypes.string, 'isSelectionRequired'),\n /** Specifies the control is in a consumer provided error state */\n hasCustomError: PropTypes.bool,\n /** Informs user of other errors. */\n customErrorMessageText: requiredWhen(PropTypes.string, 'hasCustomError'),\n /** Specifies the name of the base input element. */\n name: PropTypes.string,\n /** Selected list item is read-only. */\n readOnly: PropTypes.bool,\n /** Specifies the content of the `FormAutosuggest`. */\n children: PropTypes.node,\n /** Specifies the screen reader text */\n screenReaderText: PropTypes.string,\n};\n\nexport default FormAutosuggest;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,mBAAmB,QACvD,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,EAAE,IAAIC,MAAM,QAAQ,MAAM;AACnC,SAASC,OAAO,QAAQ,YAAY;AACpC,SAASC,YAAY,QAAQ,oBAAoB;AACjD,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,aAAa;AAChE,OAAOC,IAAI,MAAM,SAAS;AAC1B,SAASC,wBAAwB,EAAEC,mBAAmB,QAAQ,oBAAoB;AAClF,OAAOC,WAAW,MAAM,eAAe;AACvC,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAOC,UAAU,MAAM,eAAe;AACtC,OAAOC,OAAO,MAAM,YAAY;AAChC,OAAOC,qBAAqB,MAAM,oCAAoC;AACtE,OAAOC,QAAQ,MAAM,YAAY;AAEjC,MAAMC,eAAe,gBAAGlB,UAAU,CAChC,CAAAmB,IAAA,EAkBEC,GAAG,KACA;EAAA,IAlBH;IACEC,QAAQ;IACRC,0BAA0B;IAC1BC,qBAAqB;IACrBC,gBAAgB;IAChBC,KAAK;IACLC,SAAS;IACTC,eAAe;IACfC,6BAA6B;IAC7BC,mBAAmB;IACnBC,iCAAiC;IACjCC,cAAc;IACdC,sBAAsB;IACtBC,QAAQ;IACRC,WAAW;IACX,GAAGC;EACL,CAAC,GAAAhB,IAAA;EAGD,MAAMiB,IAAI,GAAG/B,OAAO,CAAC,CAAC;EACtB,MAAMgC,cAAc,GAAGtC,MAAM,C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,SAAS,CAAC0I,MAAM;EAC7B;EACAH,WAAW,EAAEvI,SAAS,CAAC0I,MAAM;EAC7B;EACAnH,KAAK,EAAEvB,SAAS,CAAC8I,KAAK,CAAC;IACrB7F,gBAAgB,EAAEjD,SAAS,CAAC0I,MAAM;IAClCrE,cAAc,EAAErE,SAAS,CAAC0I,MAAM;IAChCpE,WAAW,EAAEtE,SAAS,CAAC0I;EACzB,CAAC,CAAC;EACF;EACAjH,eAAe,EAAEzB,SAAS,CAAC4I,IAAI;EAC/B;EACAlH,6BAA6B,EAAEtB,YAAY,CAACJ,SAAS,CAAC0I,MAAM,EAAE,iBAAiB,CAAC;EAChF;EACA/G,mBAAmB,EAAE3B,SAAS,CAAC4I,IAAI;EACnC;EACAhH,iCAAiC,EAAExB,YAAY,CAACJ,SAAS,CAAC0I,MAAM,EAAE,qBAAqB,CAAC;EACxF;EACA7G,cAAc,EAAE7B,SAAS,CAAC4I,IAAI;EAC9B;EACA9G,sBAAsB,EAAE1B,YAAY,CAACJ,SAAS,CAAC0I,MAAM,EAAE,gBAAgB,CAAC;EACxE;EACAP,IAAI,EAAEnI,SAAS,CAAC0I,MAAM;EACtB;EACAF,QAAQ,EAAExI,SAAS,CAAC4I,IAAI;EACxB;EACAzH,QAAQ,EAAEnB,SAAS,CAAC+I,IAAI;EACxB;EACAzH,gBAAgB,EAAEtB,SAAS,CAAC0I;AAC9B,CAAC;AAED,eAAe1H,eAAe","ignoreList":[]}
|
|
1
|
+
{"version":3,"file":"FormAutosuggest.js","names":["React","useEffect","useState","useRef","forwardRef","useImperativeHandle","PropTypes","v4","uuidv4","useIntl","requiredWhen","KeyboardArrowUp","KeyboardArrowDown","Icon","FormGroupContextProvider","useFormGroupContext","FormControl","FormControlFeedback","IconButton","Spinner","useArrowKeyNavigation","messages","FormAutosuggest","children","arrowKeyNavigationSelector","ignoredArrowKeysNames","screenReaderText","value","isLoading","isValueRequired","valueRequiredErrorMessageText","isSelectionRequired","selectionRequiredErrorMessageText","hasCustomError","customErrorMessageText","onChange","helpMessage","props","ref","intl","formControlRef","parentRef","selectors","ignoredKeys","isDropdownExpanded","setIsDropdownExpanded","isActive","setIsActive","hasValue","setHasValue","hasSelection","setHasSelection","displayValue","setDisplayValue","userProvidedText","dropdownItems","setDropdownItems","activeMenuItemId","setActiveMenuItemId","isValid","setIsValid","errorMessage","setErrorMessage","handleMenuItemFocus","menuItemId","collapseDropdown","handleItemSelect","e","onClick","selectedValue","currentTarget","getAttribute","selectedId","id","selectionValue","selectionId","getItems","strToFind","childrenOpt","Children","map","child","childChildren","rest","cloneElement","onFocus","length","filter","opt","toLowerCase","includes","expandDropdown","toggleDropdown","iconToggle","createElement","className","tabIndex","src","iconAs","size","variant","alt","formatMessage","iconButtonClosed","iconButtonOpened","enterControl","updateErrorStateAndErrorMessage","leaveControl","keyDownHandler","key","preventDefault","current","focus","handleDocumentClick","contains","target","document","addEventListener","removeEventListener","handleTextboxClick","handleTextInput","filteredItems","matchingDropdownItem","find","o","getControlProps","controlProps","controlId","isInvalid","toString","role","autoComplete","trailingElement","type","name","animation","defaultProps","floatingLabel","placeholder","readOnly","propTypes","string","arrayOf","bool","func","shape","node"],"sources":["../../src/Form/FormAutosuggest.jsx"],"sourcesContent":["import React, {\n useEffect, useState, useRef, forwardRef, useImperativeHandle,\n} from 'react';\nimport PropTypes from 'prop-types';\nimport { v4 as uuidv4 } from 'uuid';\nimport { useIntl } from 'react-intl';\nimport { requiredWhen } from '../utils/propTypes';\nimport { KeyboardArrowUp, KeyboardArrowDown } from '../../icons';\nimport Icon from '../Icon';\nimport { FormGroupContextProvider, useFormGroupContext } from './FormGroupContext';\nimport FormControl from './FormControl';\nimport FormControlFeedback from './FormControlFeedback';\nimport IconButton from '../IconButton';\nimport Spinner from '../Spinner';\nimport useArrowKeyNavigation from '../hooks/useArrowKeyNavigationHook';\nimport messages from './messages';\n\nconst FormAutosuggest = forwardRef(\n (\n {\n children,\n arrowKeyNavigationSelector,\n ignoredArrowKeysNames,\n screenReaderText,\n value,\n isLoading,\n isValueRequired,\n valueRequiredErrorMessageText,\n isSelectionRequired,\n selectionRequiredErrorMessageText,\n hasCustomError,\n customErrorMessageText,\n onChange,\n helpMessage,\n ...props\n },\n ref,\n ) => {\n const intl = useIntl();\n const formControlRef = useRef();\n const parentRef = useArrowKeyNavigation({\n selectors: arrowKeyNavigationSelector,\n ignoredKeys: ignoredArrowKeysNames,\n });\n const [isDropdownExpanded, setIsDropdownExpanded] = useState(false);\n const [isActive, setIsActive] = useState(false);\n const [hasValue, setHasValue] = useState(false);\n const [hasSelection, setHasSelection] = useState(false);\n const [displayValue, setDisplayValue] = useState(value?.userProvidedText || '');\n const [dropdownItems, setDropdownItems] = useState([]);\n const [activeMenuItemId, setActiveMenuItemId] = useState(null);\n const [isValid, setIsValid] = useState(true);\n const [errorMessage, setErrorMessage] = useState('');\n\n const handleMenuItemFocus = (menuItemId) => {\n setActiveMenuItemId(menuItemId);\n };\n\n const collapseDropdown = () => {\n setDropdownItems([]);\n setIsDropdownExpanded(false);\n setActiveMenuItemId(null);\n };\n\n const handleItemSelect = (e, onClick) => {\n const selectedValue = e.currentTarget.getAttribute('data-value');\n const selectedId = e.currentTarget.id;\n\n setHasValue(true);\n setHasSelection(true);\n setDisplayValue(selectedValue);\n\n if (onChange && (!value || (value && selectedValue !== value.selectionValue))) {\n onChange({\n userProvidedText: selectedValue,\n selectionValue: selectedValue,\n selectionId: selectedId,\n });\n }\n\n collapseDropdown();\n\n if (onClick) {\n onClick(e);\n }\n };\n\n function getItems(strToFind = '') {\n let childrenOpt = React.Children.map(children, (child) => {\n const { children: childChildren, onClick, ...rest } = child.props;\n const menuItemId = child.props.id ?? uuidv4();\n\n return React.cloneElement(child, {\n ...rest,\n children: childChildren,\n 'data-value': childChildren,\n onClick: (e) => handleItemSelect(e, onClick),\n id: menuItemId,\n onFocus: () => handleMenuItemFocus(menuItemId),\n });\n });\n\n if (strToFind.length > 0) {\n childrenOpt = childrenOpt\n .filter((opt) => (opt.props.children.toLowerCase().includes(strToFind.toLowerCase())));\n }\n\n return childrenOpt;\n }\n\n const expandDropdown = () => {\n setDropdownItems(getItems(displayValue));\n setIsValid(true);\n setErrorMessage('');\n setIsDropdownExpanded(true);\n };\n\n const toggleDropdown = () => {\n if (isDropdownExpanded) {\n collapseDropdown();\n } else {\n expandDropdown();\n }\n };\n\n const iconToggle = (\n <IconButton\n className=\"pgn__form-autosuggest__icon-button\"\n data-testid=\"autosuggest-iconbutton\"\n tabIndex=\"-1\"\n src={isDropdownExpanded ? KeyboardArrowUp : KeyboardArrowDown}\n iconAs={Icon}\n size=\"sm\"\n variant=\"secondary\"\n alt={isDropdownExpanded\n ? intl.formatMessage(messages.iconButtonClosed)\n : intl.formatMessage(messages.iconButtonOpened)}\n onClick={toggleDropdown}\n />\n );\n\n const enterControl = () => {\n setIsActive(true);\n };\n\n const updateErrorStateAndErrorMessage = () => {\n if (hasCustomError) {\n setIsValid(false);\n setErrorMessage(customErrorMessageText);\n return;\n }\n\n if (isValueRequired && !hasValue) {\n setIsValid(false);\n setErrorMessage(valueRequiredErrorMessageText);\n return;\n }\n\n if (hasValue && isSelectionRequired && !hasSelection) {\n setIsValid(false);\n setErrorMessage(selectionRequiredErrorMessageText);\n return;\n }\n\n setIsValid(true);\n setErrorMessage('');\n };\n\n useImperativeHandle(ref, () => ({\n // expose updateErrorStateAndErrorMessage so consumers can trigger validation\n // when changing the value of the control externally\n updateErrorStateAndErrorMessage,\n }));\n\n const leaveControl = () => {\n setIsActive(false);\n collapseDropdown();\n updateErrorStateAndErrorMessage();\n };\n\n const keyDownHandler = e => {\n if (!isActive) {\n return;\n }\n\n if (e.key === 'Escape') {\n e.preventDefault();\n\n if (formControlRef) {\n formControlRef.current.focus();\n }\n\n collapseDropdown();\n return;\n }\n\n if (e.key === 'Tab') {\n leaveControl();\n }\n };\n\n const handleDocumentClick = (e) => {\n if (parentRef.current && !parentRef.current.contains(e.target) && isActive) {\n leaveControl();\n }\n };\n\n useEffect(() => {\n document.addEventListener('keydown', keyDownHandler);\n document.addEventListener('click', handleDocumentClick, true);\n\n return () => {\n document.removeEventListener('click', handleDocumentClick, true);\n document.removeEventListener('keydown', keyDownHandler);\n };\n });\n\n useEffect(() => {\n setDisplayValue(value ? value.userProvidedText ?? '' : '');\n setHasValue(!!value && !!value.userProvidedText);\n setHasSelection(!!value && !!value.selectionValue);\n }, [value]);\n\n const handleTextboxClick = () => {\n expandDropdown();\n };\n\n const handleTextInput = (e) => {\n const userProvidedText = e.target.value;\n\n // If the user has removed all text from the textbox\n if (!userProvidedText.length) {\n // reset to a \"no text, nothing selected\" state\n setDisplayValue('');\n setHasValue(false);\n setHasSelection(false);\n\n // clear and close the dropdown\n setDropdownItems([]);\n collapseDropdown();\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send a default empty object\n onChange({\n userProvidedText: '',\n selectionValue: '',\n selectionId: '',\n });\n }\n return;\n }\n\n // the user has entered text, we have a value\n setHasValue(true);\n\n // filter dropdown based on entered text\n const filteredItems = getItems(userProvidedText);\n setDropdownItems(filteredItems);\n\n // check for matches in the dropdown\n const matchingDropdownItem = filteredItems.find((o) => (\n o.props.children.toLowerCase() === userProvidedText.toLowerCase()\n ));\n\n // if we didn't find a match\n if (!matchingDropdownItem) {\n // no match means no selection\n setHasSelection(false);\n\n // set the text in the state\n setDisplayValue(userProvidedText);\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send an object with the user provided text only\n onChange({\n userProvidedText,\n selectionValue: '',\n selectionId: '',\n });\n }\n return;\n }\n\n // we found a match, we have a selection!\n setHasSelection(true);\n\n // set the display value based on the item in the dropdown\n // this matters because we match case insensitively\n setDisplayValue(matchingDropdownItem.props.children);\n\n // if the consumer has provided an onChange handler\n if (onChange) {\n // send an object with the selected item values\n onChange({\n userProvidedText: matchingDropdownItem.props.children,\n selectionValue: matchingDropdownItem.props.children,\n selectionId: matchingDropdownItem.props.id,\n });\n }\n };\n\n const { getControlProps } = useFormGroupContext();\n const controlProps = getControlProps(props);\n\n return (\n <div className=\"pgn__form-autosuggest__wrapper\" ref={parentRef} onFocus={enterControl}>\n <div aria-live=\"assertive\" className=\"sr-only\" data-testid=\"autosuggest-screen-reader-options-count\">\n {`${dropdownItems.length} options found`}\n </div>\n <FormGroupContextProvider\n controlId={controlProps.id}\n isInvalid={!isValid}\n >\n <FormControl\n ref={formControlRef}\n aria-expanded={(dropdownItems.length > 0).toString()}\n aria-owns=\"pgn__form-autosuggest__dropdown-box\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n autoComplete=\"off\"\n value={displayValue}\n aria-invalid={errorMessage}\n aria-activedescendant={activeMenuItemId}\n onChange={handleTextInput}\n onClick={handleTextboxClick}\n trailingElement={iconToggle}\n data-testid=\"autosuggest-textbox-input\"\n {...controlProps}\n />\n\n {helpMessage && isValid && (\n <FormControlFeedback type=\"default\">\n {helpMessage}\n </FormControlFeedback>\n )}\n\n {!isValid && (\n <FormControlFeedback type=\"invalid\" feedback-for={controlProps.name}>\n {errorMessage}\n </FormControlFeedback>\n )}\n </FormGroupContextProvider>\n <ul\n id=\"pgn__form-autosuggest__dropdown-box\"\n className=\"pgn__form-autosuggest__dropdown\"\n role=\"listbox\"\n >\n {isLoading ? (\n <div className=\"pgn__form-autosuggest__dropdown-loading\">\n <Spinner\n animation=\"border\"\n variant=\"dark\"\n screenReaderText={screenReaderText}\n data-testid=\"autosuggest-loading-spinner\"\n />\n </div>\n ) : dropdownItems.length > 0 && dropdownItems}\n </ul>\n </div>\n );\n },\n);\n\nFormAutosuggest.defaultProps = {\n arrowKeyNavigationSelector: 'a:not(:disabled),li:not(:disabled, .btn-icon),input:not(:disabled)',\n ignoredArrowKeysNames: ['ArrowRight', 'ArrowLeft'],\n isLoading: false,\n className: null,\n floatingLabel: null,\n onChange: null,\n helpMessage: '',\n placeholder: '',\n value: null,\n isValueRequired: false,\n valueRequiredErrorMessageText: null,\n isSelectionRequired: false,\n selectionRequiredErrorMessageText: null,\n hasCustomError: false,\n customErrorMessageText: null,\n readOnly: false,\n children: null,\n name: 'form-autosuggest',\n screenReaderText: 'loading',\n};\n\nFormAutosuggest.propTypes = {\n /**\n * Specifies the CSS selector string that indicates to which elements\n * the user can navigate using the arrow keys\n */\n arrowKeyNavigationSelector: PropTypes.string,\n /** Specifies ignored hook keys. */\n ignoredArrowKeysNames: PropTypes.arrayOf(PropTypes.string),\n /** Specifies loading state. */\n isLoading: PropTypes.bool,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies floating label to display for the input component. */\n floatingLabel: PropTypes.string,\n /** Specifies onChange event handler. */\n onChange: PropTypes.func,\n /** Specifies help information for the user. */\n helpMessage: PropTypes.string,\n /** Specifies the placeholder text for the input. */\n placeholder: PropTypes.string,\n /** Specifies values for the input. */\n value: PropTypes.shape({\n userProvidedText: PropTypes.string,\n selectionValue: PropTypes.string,\n selectionId: PropTypes.string,\n }),\n /** Specifies if empty values trigger an error state */\n isValueRequired: PropTypes.bool,\n /** Informs user they must input a value. */\n valueRequiredErrorMessageText: requiredWhen(PropTypes.string, 'isValueRequired'),\n /** Specifies if freeform values trigger an error state */\n isSelectionRequired: PropTypes.bool,\n /** Informs user they must make a selection. */\n selectionRequiredErrorMessageText: requiredWhen(PropTypes.string, 'isSelectionRequired'),\n /** Specifies the control is in a consumer provided error state */\n hasCustomError: PropTypes.bool,\n /** Informs user of other errors. */\n customErrorMessageText: requiredWhen(PropTypes.string, 'hasCustomError'),\n /** Specifies the name of the base input element. */\n name: PropTypes.string,\n /** Selected list item is read-only. */\n readOnly: PropTypes.bool,\n /** Specifies the content of the `FormAutosuggest`. */\n children: PropTypes.node,\n /** Specifies the screen reader text */\n screenReaderText: PropTypes.string,\n};\n\nexport default FormAutosuggest;\n"],"mappings":"AAAA,OAAOA,KAAK,IACVC,SAAS,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,UAAU,EAAEC,mBAAmB,QACvD,OAAO;AACd,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,EAAE,IAA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EAAE3B,SAAS,CAACyI,IAAI;EAC9B;EACA7G,sBAAsB,EAAExB,YAAY,CAACJ,SAAS,CAACuI,MAAM,EAAE,gBAAgB,CAAC;EACxE;EACAP,IAAI,EAAEhI,SAAS,CAACuI,MAAM;EACtB;EACAF,QAAQ,EAAErI,SAAS,CAACyI,IAAI;EACxB;EACAxH,QAAQ,EAAEjB,SAAS,CAAC4I,IAAI;EACxB;EACAxH,gBAAgB,EAAEpB,SAAS,CAACuI;AAC9B,CAAC;AAED,eAAevH,eAAe","ignoreList":[]}
|
|
@@ -2,13 +2,12 @@ import React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import MenuItem from '../Menu/MenuItem';
|
|
5
|
-
function FormAutosuggestOption(
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
} = _ref;
|
|
5
|
+
function FormAutosuggestOption({
|
|
6
|
+
children,
|
|
7
|
+
className,
|
|
8
|
+
onClick,
|
|
9
|
+
...props
|
|
10
|
+
}) {
|
|
12
11
|
return /*#__PURE__*/React.createElement(MenuItem, {
|
|
13
12
|
as: "li",
|
|
14
13
|
"data-testid": "autosuggest-optionitem",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormAutosuggestOption.js","names":["React","PropTypes","classNames","MenuItem","FormAutosuggestOption","
|
|
1
|
+
{"version":3,"file":"FormAutosuggestOption.js","names":["React","PropTypes","classNames","MenuItem","FormAutosuggestOption","children","className","onClick","props","createElement","as","role","tabIndex","defaultProps","propTypes","string","func"],"sources":["../../src/Form/FormAutosuggestOption.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport MenuItem from '../Menu/MenuItem';\n\nfunction FormAutosuggestOption({\n children,\n className,\n onClick,\n ...props\n}) {\n return (\n <MenuItem\n as=\"li\"\n data-testid=\"autosuggest-optionitem\"\n role=\"option\"\n tabIndex=\"-1\"\n onClick={onClick}\n className={classNames(className, 'dropdown-item')}\n {...props}\n >\n {children}\n </MenuItem>\n );\n}\n\nFormAutosuggestOption.defaultProps = {\n className: null,\n children: null,\n onClick: null,\n};\n\nFormAutosuggestOption.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies the text-content of the `FormAutosuggestOption`. */\n children: PropTypes.string,\n /** A click handler for the `FormAutosuggestOption` */\n onClick: PropTypes.func,\n};\n\nexport default FormAutosuggestOption;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,QAAQ,MAAM,kBAAkB;AAEvC,SAASC,qBAAqBA,CAAC;EAC7BC,QAAQ;EACRC,SAAS;EACTC,OAAO;EACP,GAAGC;AACL,CAAC,EAAE;EACD,oBACER,KAAA,CAAAS,aAAA,CAACN,QAAQ;IACPO,EAAE,EAAC,IAAI;IACP,eAAY,wBAAwB;IACpCC,IAAI,EAAC,QAAQ;IACbC,QAAQ,EAAC,IAAI;IACbL,OAAO,EAAEA,OAAQ;IACjBD,SAAS,EAAEJ,UAAU,CAACI,SAAS,EAAE,eAAe,CAAE;IAAA,GAC9CE;EAAK,GAERH,QACO,CAAC;AAEf;AAEAD,qBAAqB,CAACS,YAAY,GAAG;EACnCP,SAAS,EAAE,IAAI;EACfD,QAAQ,EAAE,IAAI;EACdE,OAAO,EAAE;AACX,CAAC;AAEDH,qBAAqB,CAACU,SAAS,GAAG;EAChC;EACAR,SAAS,EAAEL,SAAS,CAACc,MAAM;EAC3B;EACAV,QAAQ,EAAEJ,SAAS,CAACc,MAAM;EAC1B;EACAR,OAAO,EAAEN,SAAS,CAACe;AACrB,CAAC;AAED,eAAeZ,qBAAqB","ignoreList":[]}
|
|
@@ -5,11 +5,10 @@ import { useCheckboxSetContext } from './FormCheckboxSetContext';
|
|
|
5
5
|
import { FormGroupContextProvider, useFormGroupContext } from './FormGroupContext';
|
|
6
6
|
import FormLabel from './FormLabel';
|
|
7
7
|
import FormControlFeedback from './FormControlFeedback';
|
|
8
|
-
const CheckboxControl = /*#__PURE__*/React.forwardRef((
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
} = _ref;
|
|
8
|
+
const CheckboxControl = /*#__PURE__*/React.forwardRef(({
|
|
9
|
+
isIndeterminate,
|
|
10
|
+
...props
|
|
11
|
+
}, ref) => {
|
|
13
12
|
const {
|
|
14
13
|
getCheckboxControlProps,
|
|
15
14
|
hasCheckboxSetProvider
|
|
@@ -48,19 +47,18 @@ CheckboxControl.defaultProps = {
|
|
|
48
47
|
isIndeterminate: false,
|
|
49
48
|
className: undefined
|
|
50
49
|
};
|
|
51
|
-
const FormCheckbox = /*#__PURE__*/React.forwardRef((
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
} = _ref2;
|
|
50
|
+
const FormCheckbox = /*#__PURE__*/React.forwardRef(({
|
|
51
|
+
children,
|
|
52
|
+
className,
|
|
53
|
+
controlClassName,
|
|
54
|
+
labelClassName,
|
|
55
|
+
description,
|
|
56
|
+
isInvalid,
|
|
57
|
+
isValid,
|
|
58
|
+
controlAs,
|
|
59
|
+
floatLabelLeft,
|
|
60
|
+
...props
|
|
61
|
+
}, ref) => {
|
|
64
62
|
const {
|
|
65
63
|
hasCheckboxSetProvider
|
|
66
64
|
} = useCheckboxSetContext();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckbox.js","names":["React","PropTypes","classNames","useCheckboxSetContext","FormGroupContextProvider","useFormGroupContext","FormLabel","FormControlFeedback","CheckboxControl","forwardRef","
|
|
1
|
+
{"version":3,"file":"FormCheckbox.js","names":["React","PropTypes","classNames","useCheckboxSetContext","FormGroupContextProvider","useFormGroupContext","FormLabel","FormControlFeedback","CheckboxControl","forwardRef","isIndeterminate","props","ref","getCheckboxControlProps","hasCheckboxSetProvider","defaultRef","useRef","resolvedRef","getControlProps","checkboxProps","className","useEffect","current","indeterminate","createElement","type","propTypes","bool","string","defaultProps","undefined","FormCheckbox","children","controlClassName","labelClassName","description","isInvalid","isValid","controlAs","floatLabelLeft","hasFormGroupProvider","useSetIsControlGroupEffect","shouldActAsGroup","groupProps","role","control","controlId","id","disabled","hasIcon","node","isRequired","elementType"],"sources":["../../src/Form/FormCheckbox.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { useCheckboxSetContext } from './FormCheckboxSetContext';\nimport { FormGroupContextProvider, useFormGroupContext } from './FormGroupContext';\nimport FormLabel from './FormLabel';\nimport FormControlFeedback from './FormControlFeedback';\n\nconst CheckboxControl = React.forwardRef(\n ({ isIndeterminate, ...props }, ref) => {\n const { getCheckboxControlProps, hasCheckboxSetProvider } = useCheckboxSetContext();\n const defaultRef = React.useRef();\n const resolvedRef = ref || defaultRef;\n const { getControlProps } = useFormGroupContext();\n let checkboxProps = getControlProps({\n ...props,\n className: classNames('pgn__form-checkbox-input', props.className),\n });\n\n if (hasCheckboxSetProvider) {\n checkboxProps = getCheckboxControlProps(checkboxProps);\n }\n\n React.useEffect(() => {\n // this if(resolvedRef.current) prevents console errors in testing\n if (resolvedRef.current) {\n resolvedRef.current.indeterminate = isIndeterminate;\n }\n }, [resolvedRef, isIndeterminate]);\n\n return (\n <input\n type=\"checkbox\"\n {...checkboxProps}\n ref={resolvedRef}\n />\n );\n },\n);\n\nCheckboxControl.propTypes = {\n /** Specifies whether the checkbox should be rendered in indeterminate state. */\n isIndeterminate: PropTypes.bool,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n};\n\nCheckboxControl.defaultProps = {\n isIndeterminate: false,\n className: undefined,\n};\n\nconst FormCheckbox = React.forwardRef(({\n children,\n className,\n controlClassName,\n labelClassName,\n description,\n isInvalid,\n isValid,\n controlAs,\n floatLabelLeft,\n ...props\n}, ref) => {\n const { hasCheckboxSetProvider } = useCheckboxSetContext();\n const { hasFormGroupProvider, useSetIsControlGroupEffect, getControlProps } = useFormGroupContext();\n useSetIsControlGroupEffect(true);\n const shouldActAsGroup = hasFormGroupProvider && !hasCheckboxSetProvider;\n const groupProps = shouldActAsGroup ? {\n ...getControlProps({}),\n role: 'group',\n } : {};\n\n const control = React.createElement(controlAs, { ...props, className: controlClassName, ref });\n return (\n <FormGroupContextProvider\n controlId={props.id}\n isInvalid={isInvalid}\n isValid={isValid}\n >\n <div\n className={classNames('pgn__form-checkbox', className, {\n 'pgn__form-control-valid': isValid,\n 'pgn__form-control-invalid': isInvalid,\n 'pgn__form-control-disabled': props.disabled,\n 'pgn__form-control-label-left': !!floatLabelLeft,\n })}\n {...groupProps}\n >\n {control}\n <div>\n <FormLabel className={labelClassName}>\n {children}\n </FormLabel>\n {description && (\n <FormControlFeedback hasIcon={false}>\n {description}\n </FormControlFeedback>\n )}\n </div>\n </div>\n </FormGroupContextProvider>\n );\n});\n\nFormCheckbox.propTypes = {\n /** Specifies id of the FormCheckbox component. */\n id: PropTypes.string,\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies class name for control component. */\n controlClassName: PropTypes.string,\n /** Specifies class name for label component. */\n labelClassName: PropTypes.string,\n /** Specifies description to show under the checkbox. */\n description: PropTypes.node,\n /** Specifies whether to display checkbox in invalid state, this affects styling. */\n isInvalid: PropTypes.bool,\n /** Specifies whether to display checkbox in valid state, this affects styling. */\n isValid: PropTypes.bool,\n /** Specifies control element. */\n controlAs: PropTypes.elementType,\n /** Specifies whether the floating label should be aligned to the left. */\n floatLabelLeft: PropTypes.bool,\n /** Specifies whether the `FormCheckbox` is disabled. */\n disabled: PropTypes.bool,\n};\n\nFormCheckbox.defaultProps = {\n id: undefined,\n className: undefined,\n controlClassName: undefined,\n labelClassName: undefined,\n description: undefined,\n isInvalid: false,\n isValid: false,\n controlAs: CheckboxControl,\n floatLabelLeft: false,\n disabled: false,\n};\n\nexport { CheckboxControl };\nexport default FormCheckbox;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,SAASC,qBAAqB,QAAQ,0BAA0B;AAChE,SAASC,wBAAwB,EAAEC,mBAAmB,QAAQ,oBAAoB;AAClF,OAAOC,SAAS,MAAM,aAAa;AACnC,OAAOC,mBAAmB,MAAM,uBAAuB;AAEvD,MAAMC,eAAe,gBAAGR,KAAK,CAACS,UAAU,CACtC,CAAC;EAAEC,eAAe;EAAE,GAAGC;AAAM,CAAC,EAAEC,GAAG,KAAK;EACtC,MAAM;IAAEC,uBAAuB;IAAEC;EAAuB,CAAC,GAAGX,qBAAqB,CAAC,CAAC;EACnF,MAAMY,UAAU,GAAGf,KAAK,CAACgB,MAAM,CAAC,CAAC;EACjC,MAAMC,WAAW,GAAGL,GAAG,IAAIG,UAAU;EACrC,MAAM;IAAEG;EAAgB,CAAC,GAAGb,mBAAmB,CAAC,CAAC;EACjD,IAAIc,aAAa,GAAGD,eAAe,CAAC;IAClC,GAAGP,KAAK;IACRS,SAAS,EAAElB,UAAU,CAAC,0BAA0B,EAAES,KAAK,CAACS,SAAS;EACnE,CAAC,CAAC;EAEF,IAAIN,sBAAsB,EAAE;IAC1BK,aAAa,GAAGN,uBAAuB,CAACM,aAAa,CAAC;EACxD;EAEAnB,KAAK,CAACqB,SAAS,CAAC,MAAM;IACpB;IACA,IAAIJ,WAAW,CAACK,OAAO,EAAE;MACvBL,WAAW,CAACK,OAAO,CAACC,aAAa,GAAGb,eAAe;IACrD;EACF,CAAC,EAAE,CAACO,WAAW,EAAEP,eAAe,CAAC,CAAC;EAElC,oBACEV,KAAA,CAAAwB,aAAA;IACEC,IAAI,EAAC,UAAU;IAAA,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AS,EAAE,KAAK;EAChBC,OAAO,EAAE,KAAK;EACdC,SAAS,EAAE9B,eAAe;EAC1B+B,cAAc,EAAE,KAAK;EACrBS,QAAQ,EAAE;AACZ,CAAC;AAED,SAASxC,eAAe;AACxB,eAAeuB,YAAY","ignoreList":[]}
|
|
@@ -3,18 +3,17 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { useFormGroupContext } from './FormGroupContext';
|
|
4
4
|
import { FormCheckboxSetContextProvider } from './FormCheckboxSetContext';
|
|
5
5
|
import FormControlSet from './FormControlSet';
|
|
6
|
-
function FormCheckboxSet(
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
} = _ref;
|
|
6
|
+
function FormCheckboxSet({
|
|
7
|
+
children,
|
|
8
|
+
name,
|
|
9
|
+
value,
|
|
10
|
+
defaultValue,
|
|
11
|
+
isInline,
|
|
12
|
+
onChange,
|
|
13
|
+
onFocus,
|
|
14
|
+
onBlur,
|
|
15
|
+
...props
|
|
16
|
+
}) {
|
|
18
17
|
const {
|
|
19
18
|
getControlProps,
|
|
20
19
|
useSetIsControlGroupEffect
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckboxSet.js","names":["React","PropTypes","useFormGroupContext","FormCheckboxSetContextProvider","FormControlSet","FormCheckboxSet","
|
|
1
|
+
{"version":3,"file":"FormCheckboxSet.js","names":["React","PropTypes","useFormGroupContext","FormCheckboxSetContextProvider","FormControlSet","FormCheckboxSet","children","name","value","defaultValue","isInline","onChange","onFocus","onBlur","props","getControlProps","useSetIsControlGroupEffect","controlProps","createElement","role","propTypes","node","isRequired","className","string","arrayOf","bool","func","defaultProps","undefined"],"sources":["../../src/Form/FormCheckboxSet.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useFormGroupContext } from './FormGroupContext';\nimport { FormCheckboxSetContextProvider } from './FormCheckboxSetContext';\nimport FormControlSet from './FormControlSet';\n\nfunction FormCheckboxSet({\n children,\n name,\n value,\n defaultValue,\n isInline,\n onChange,\n onFocus,\n onBlur,\n ...props\n}) {\n const { getControlProps, useSetIsControlGroupEffect } = useFormGroupContext();\n useSetIsControlGroupEffect(true);\n const controlProps = getControlProps(props);\n return (\n <FormCheckboxSetContextProvider\n name={name}\n value={value}\n defaultValue={defaultValue}\n onFocus={onFocus}\n onBlur={onBlur}\n onChange={onChange}\n >\n <FormControlSet role=\"group\" isInline={isInline} {...controlProps}>\n {children}\n </FormControlSet>\n </FormCheckboxSetContextProvider>\n );\n}\n\nFormCheckboxSet.propTypes = {\n /** Specifies contents of the component. */\n children: PropTypes.node.isRequired,\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies name for the component. */\n name: PropTypes.string.isRequired,\n /** Specifies values for the checkboxes. */\n value: PropTypes.arrayOf(PropTypes.string),\n /** Specifies default values for the checkboxes. */\n defaultValue: PropTypes.arrayOf(PropTypes.string),\n /** Specifies whether to display components with inline styling. */\n isInline: PropTypes.bool,\n /** Specifies onChange event handler. */\n onChange: PropTypes.func,\n /** Specifies onFocus event handler. */\n onFocus: PropTypes.func,\n /** Specifies onBlur event handler. */\n onBlur: PropTypes.func,\n};\n\nFormCheckboxSet.defaultProps = {\n className: undefined,\n value: undefined,\n defaultValue: undefined,\n isInline: false,\n onChange: undefined,\n onFocus: undefined,\n onBlur: undefined,\n};\n\nexport default FormCheckboxSet;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,SAASC,8BAA8B,QAAQ,0BAA0B;AACzE,OAAOC,cAAc,MAAM,kBAAkB;AAE7C,SAASC,eAAeA,CAAC;EACvBC,QAAQ;EACRC,IAAI;EACJC,KAAK;EACLC,YAAY;EACZC,QAAQ;EACRC,QAAQ;EAC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,EAAE,KAAK;EACfC,QAAQ,EAAEkB,SAAS;EACnBjB,OAAO,EAAEiB,SAAS;EAClBhB,MAAM,EAAEgB;AACV,CAAC;AAED,eAAexB,eAAe","ignoreList":[]}
|
|
@@ -7,16 +7,15 @@ const FormCheckboxSetContext = /*#__PURE__*/React.createContext({
|
|
|
7
7
|
hasCheckboxSetProvider: false
|
|
8
8
|
});
|
|
9
9
|
const useCheckboxSetContext = () => useContext(FormCheckboxSetContext);
|
|
10
|
-
function FormCheckboxSetContextProvider(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} = _ref;
|
|
10
|
+
function FormCheckboxSetContextProvider({
|
|
11
|
+
children,
|
|
12
|
+
name,
|
|
13
|
+
onBlur,
|
|
14
|
+
onFocus,
|
|
15
|
+
onChange,
|
|
16
|
+
value,
|
|
17
|
+
defaultValue
|
|
18
|
+
}) {
|
|
20
19
|
const isControlled = !defaultValue && Array.isArray(value);
|
|
21
20
|
const getCheckboxControlProps = checkboxProps => ({
|
|
22
21
|
...checkboxProps,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormCheckboxSetContext.js","names":["React","useContext","PropTypes","callAllHandlers","identityFn","props","FormCheckboxSetContext","createContext","getCheckboxControlProps","hasCheckboxSetProvider","useCheckboxSetContext","FormCheckboxSetContextProvider","
|
|
1
|
+
{"version":3,"file":"FormCheckboxSetContext.js","names":["React","useContext","PropTypes","callAllHandlers","identityFn","props","FormCheckboxSetContext","createContext","getCheckboxControlProps","hasCheckboxSetProvider","useCheckboxSetContext","FormCheckboxSetContextProvider","children","name","onBlur","onFocus","onChange","value","defaultValue","isControlled","Array","isArray","checkboxProps","checked","includes","undefined","defaultChecked","contextValue","createElement","Provider","propTypes","node","isRequired","string","func","arrayOf","defaultProps"],"sources":["../../src/Form/FormCheckboxSetContext.jsx"],"sourcesContent":["import React, { useContext } from 'react';\nimport PropTypes from 'prop-types';\nimport { callAllHandlers } from './fieldUtils';\n\nconst identityFn = props => props;\n\nconst FormCheckboxSetContext = React.createContext({\n getCheckboxControlProps: identityFn,\n hasCheckboxSetProvider: false,\n});\n\nconst useCheckboxSetContext = () => useContext(FormCheckboxSetContext);\n\nfunction FormCheckboxSetContextProvider({\n children,\n name,\n onBlur,\n onFocus,\n onChange,\n value,\n defaultValue,\n}) {\n const isControlled = !defaultValue && Array.isArray(value);\n const getCheckboxControlProps = (checkboxProps) => ({\n ...checkboxProps,\n name,\n /* istanbul ignore next */\n onBlur: checkboxProps.onBlur ? callAllHandlers(onBlur, checkboxProps.onBlur) : onBlur,\n /* istanbul ignore next */\n onFocus: checkboxProps.onFocus ? callAllHandlers(onFocus, checkboxProps.onFocus) : onFocus,\n /* istanbul ignore next */\n onChange: checkboxProps.onChange ? callAllHandlers(onChange, checkboxProps.onChange) : onChange,\n checked: isControlled ? value.includes(checkboxProps.value) : undefined,\n defaultChecked: isControlled ? undefined : (defaultValue && defaultValue.includes(checkboxProps.value)),\n });\n const contextValue = {\n name,\n value,\n defaultValue,\n getCheckboxControlProps,\n onBlur,\n onFocus,\n onChange,\n hasCheckboxSetProvider: true,\n };\n return (\n <FormCheckboxSetContext.Provider value={contextValue}>\n {children}\n </FormCheckboxSetContext.Provider>\n );\n}\n\nFormCheckboxSetContextProvider.propTypes = {\n children: PropTypes.node.isRequired,\n name: PropTypes.string,\n onBlur: PropTypes.func,\n onFocus: PropTypes.func,\n onChange: PropTypes.func,\n value: PropTypes.arrayOf(PropTypes.string),\n defaultValue: PropTypes.arrayOf(PropTypes.string),\n};\n\nFormCheckboxSetContextProvider.defaultProps = {\n onBlur: undefined,\n name: undefined,\n onFocus: undefined,\n onChange: undefined,\n value: undefined,\n defaultValue: undefined,\n};\n\nexport default FormCheckboxSetContext;\nexport {\n useCheckboxSetContext,\n FormCheckboxSetContextProvider,\n};\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,UAAU,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;IACZV,uBAAuB;IACvBM,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRP,sBAAsB,EAAE;EAC1B,CAAC;EACD,oBACET,KAAA,CAAA4B,aAAA,CAACtB,sBAAsB,CAACuB,QAAQ;IAACZ,KAAK,EAAEU;EAAa,GAClDf,QAC8B,CAAC;AAEtC;AAEAD,8BAA8B,CAACmB,SAAS,GAAG;EACzClB,QAAQ,EAAEV,SAAS,CAAC6B,IAAI,CAACC,UAAU;EACnCnB,IAAI,EAAEX,SAAS,CAAC+B,MAAM;EACtBnB,MAAM,EAAEZ,SAAS,CAACgC,IAAI;EACtBnB,OAAO,EAAEb,SAAS,CAACgC,IAAI;EACvBlB,QAAQ,EAAEd,SAAS,CAACgC,IAAI;EACxBjB,KAAK,EAAEf,SAAS,CAACiC,OAAO,CAACjC,SAAS,CAAC+B,MAAM,CAAC;EAC1Cf,YAAY,EAAEhB,SAAS,CAACiC,OAAO,CAACjC,SAAS,CAAC+B,MAAM;AAClD,CAAC;AAEDtB,8BAA8B,CAACyB,YAAY,GAAG;EAC5CtB,MAAM,EAAEW,SAAS;EACjBZ,IAAI,EAAEY,SAAS;EACfV,OAAO,EAAEU,SAAS;EAClBT,QAAQ,EAAES,SAAS;EACnBR,KAAK,EAAEQ,SAAS;EAChBP,YAAY,EAAEO;AAChB,CAAC;AAED,eAAenB,sBAAsB;AACrC,SACEI,qBAAqB,EACrBC,8BAA8B","ignoreList":[]}
|
package/dist/Form/FormControl.js
CHANGED
|
@@ -7,19 +7,18 @@ import { useFormGroupContext } from './FormGroupContext';
|
|
|
7
7
|
import FormControlFeedback from './FormControlFeedback';
|
|
8
8
|
import FormControlDecoratorGroup from './FormControlDecoratorGroup';
|
|
9
9
|
import { callAllHandlers, useHasValue } from './fieldUtils';
|
|
10
|
-
const FormControl = /*#__PURE__*/React.forwardRef((
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
} = _ref;
|
|
10
|
+
const FormControl = /*#__PURE__*/React.forwardRef(({
|
|
11
|
+
as,
|
|
12
|
+
className,
|
|
13
|
+
controlClassName,
|
|
14
|
+
leadingElement,
|
|
15
|
+
trailingElement,
|
|
16
|
+
floatingLabel,
|
|
17
|
+
autoResize,
|
|
18
|
+
onChange,
|
|
19
|
+
inputMask,
|
|
20
|
+
...props
|
|
21
|
+
}, ref) => {
|
|
23
22
|
const {
|
|
24
23
|
isInvalid,
|
|
25
24
|
isValid,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.js","names":["React","useCallback","useEffect","PropTypes","classNames","RBFormControl","IMaskInput","useFormGroupContext","FormControlFeedback","FormControlDecoratorGroup","callAllHandlers","useHasValue","FormControl","forwardRef","
|
|
1
|
+
{"version":3,"file":"FormControl.js","names":["React","useCallback","useEffect","PropTypes","classNames","RBFormControl","IMaskInput","useFormGroupContext","FormControlFeedback","FormControlDecoratorGroup","callAllHandlers","useHasValue","FormControl","forwardRef","as","className","controlClassName","leadingElement","trailingElement","floatingLabel","autoResize","onChange","inputMask","props","ref","isInvalid","isValid","getControlProps","formGroupContext","inputRef","useRef","resolvedRef","size","hasValue","checkInputEventValue","defaultValue","value","handleResize","current","initialHeight","offsets","offsetHeight","clientHeight","style","height","scrollHeight","controlProps","onBlur","handleOnChange","e","createElement","mask","SIZE_CHOICES","Feedback","Description","propTypes","string","elementType","func","oneOfType","number","id","oneOf","node","plaintext","bool","defaultProps","undefined"],"sources":["../../src/Form/FormControl.jsx"],"sourcesContent":["import React, { useCallback, useEffect } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport RBFormControl from 'react-bootstrap/FormControl';\nimport { IMaskInput } from 'react-imask';\nimport { useFormGroupContext } from './FormGroupContext';\nimport FormControlFeedback from './FormControlFeedback';\nimport FormControlDecoratorGroup from './FormControlDecoratorGroup';\n\nimport { callAllHandlers, useHasValue } from './fieldUtils';\n\nconst FormControl = React.forwardRef(({\n as,\n className,\n controlClassName,\n leadingElement,\n trailingElement,\n floatingLabel,\n autoResize,\n onChange,\n inputMask,\n ...props\n}, ref) => {\n const {\n isInvalid,\n isValid,\n getControlProps,\n ...formGroupContext\n } = useFormGroupContext();\n const inputRef = React.useRef();\n const resolvedRef = ref || inputRef;\n const size = props.size || formGroupContext.size;\n\n const [hasValue, checkInputEventValue] = useHasValue({\n defaultValue: props.defaultValue,\n value: props.value,\n });\n\n const handleResize = useCallback(() => {\n if (as === 'textarea' && autoResize) {\n if (!resolvedRef.current.initialHeight && !resolvedRef.current.offsets) {\n resolvedRef.current.initialHeight = resolvedRef.current.offsetHeight;\n resolvedRef.current.offsets = resolvedRef.current.offsetHeight - resolvedRef.current.clientHeight;\n }\n resolvedRef.current.style.height = `${resolvedRef.current.initialHeight}px`;\n resolvedRef.current.style.height = `${resolvedRef.current.scrollHeight + resolvedRef.current.offsets}px`;\n }\n }, [as, autoResize, resolvedRef]);\n\n useEffect(() => {\n handleResize();\n }, [handleResize]);\n\n const controlProps = getControlProps({\n ...props,\n // eslint-disable-next-line react/prop-types\n onBlur: callAllHandlers(checkInputEventValue, props.onBlur),\n });\n\n const handleOnChange = (e) => {\n handleResize();\n if (onChange) {\n onChange(e);\n }\n };\n\n return (\n <FormControlDecoratorGroup\n size={size}\n leadingElement={leadingElement}\n trailingElement={trailingElement}\n floatingLabel={floatingLabel}\n className={className}\n >\n <RBFormControl\n as={inputMask ? IMaskInput : as}\n ref={resolvedRef}\n size={size}\n isInvalid={isInvalid}\n isValid={isValid}\n className={classNames(controlClassName, {\n 'has-value': hasValue,\n })}\n onChange={handleOnChange}\n mask={inputMask}\n {...controlProps}\n />\n </FormControlDecoratorGroup>\n );\n});\n\nconst SIZE_CHOICES = ['sm', 'lg'];\n\nFormControl.Feedback = FormControlFeedback;\nFormControl.Description = FormControlFeedback;\n\nFormControl.propTypes = {\n /** Specifies class name to append to the base element. */\n className: PropTypes.string,\n /** Specifies base element for the control component. */\n as: PropTypes.elementType,\n /** Specifies function that is triggered on input value change. */\n onChange: PropTypes.func,\n /** Specifies default value of the input component. */\n defaultValue: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies current value of the input component. */\n value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),\n /** Specifies id of the control component. */\n id: PropTypes.string,\n /** Specifies class name for the control component. */\n controlClassName: PropTypes.string,\n /** Specifies size for the control component. */\n size: PropTypes.oneOf(SIZE_CHOICES),\n /** Specifies leading element to display for the input component. */\n leadingElement: PropTypes.node,\n /** Specifies trailing element to display for the input component. */\n trailingElement: PropTypes.node,\n /** Specifies floating label to display for the input component. */\n floatingLabel: PropTypes.node,\n /** Specifies whether to render input as plain text. */\n plaintext: PropTypes.bool,\n /** Specifies whether to display control in valid state, this affects styling. */\n isValid: PropTypes.bool,\n /** Specifies whether to display control in invalid state, this affects styling. */\n isInvalid: PropTypes.bool,\n /** Only for `as=\"textarea\"`. Specifies whether the input can be resized according to the height of content. */\n autoResize: PropTypes.bool,\n /** Specifies what format to use for the input mask. */\n inputMask: PropTypes.string,\n};\n\nFormControl.defaultProps = {\n as: 'input',\n className: undefined,\n id: undefined,\n controlClassName: undefined,\n onChange: undefined,\n defaultValue: undefined,\n value: undefined,\n size: undefined,\n leadingElement: undefined,\n trailingElement: undefined,\n floatingLabel: undefined,\n plaintext: false,\n isValid: undefined,\n isInvalid: undefined,\n autoResize: false,\n inputMask: undefined,\n};\n\nexport default FormControl;\n"],"mappings":"AAAA,OAAOA,KAAK,IAAIC,WAAW,EAAEC,SAAS,QAAQ,OAAO;AACrD,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,aAAa,MAAM,6BAA6B;AACvD,SAASC,UAAU,QAAQ,aAAa;AACxC,SAASC,mBAAmB,QAAQ,oBAAoB;AACxD,OAAOC,mBAAmB,MAAM,uBAAuB;AACvD,OAAO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AY,EAAEgC,SAAS;EACvB/B,KAAK,EAAE+B,SAAS;EAChBnC,IAAI,EAAEmC,SAAS;EACflD,cAAc,EAAEkD,SAAS;EACzBjD,eAAe,EAAEiD,SAAS;EAC1BhD,aAAa,EAAEgD,SAAS;EACxBH,SAAS,EAAE,KAAK;EAChBtC,OAAO,EAAEyC,SAAS;EAClB1C,SAAS,EAAE0C,SAAS;EACpB/C,UAAU,EAAE,KAAK;EACjBE,SAAS,EAAE6C;AACb,CAAC;AAED,eAAevD,WAAW","ignoreList":[]}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
function FormControlDecorator(
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
} = _ref;
|
|
3
|
+
function FormControlDecorator({
|
|
4
|
+
children,
|
|
5
|
+
location
|
|
6
|
+
}) {
|
|
8
7
|
return /*#__PURE__*/React.createElement("div", {
|
|
9
8
|
className: `pgn__form-control-decorator pgn__form-control-decorator-${location}`
|
|
10
9
|
}, children);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControlDecorator.js","names":["React","PropTypes","FormControlDecorator","
|
|
1
|
+
{"version":3,"file":"FormControlDecorator.js","names":["React","PropTypes","FormControlDecorator","children","location","createElement","className","propTypes","node","isRequired","oneOf","defaultProps"],"sources":["../../src/Form/FormControlDecorator.jsx"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nfunction FormControlDecorator({ children, location }) {\n return (\n <div className={`pgn__form-control-decorator pgn__form-control-decorator-${location}`}>\n {children}\n </div>\n );\n}\n\nFormControlDecorator.propTypes = {\n children: PropTypes.node.isRequired,\n location: PropTypes.oneOf(['leading', 'trailing']),\n};\n\nFormControlDecorator.defaultProps = {\n location: 'leading',\n};\n\nexport default FormControlDecorator;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,SAASC,oBAAoBA,CAAC;EAAEC,QAAQ;EAAEC;AAAS,CAAC,EAAE;EACpD,oBACEJ,KAAA,CAAAK,aAAA;IAAKC,SAAS,EAAE,2DAA2DF,QAAQ;EAAG,GACnFD,QACE,CAAC;AAEV;AAEAD,oBAAoB,CAACK,SAAS,GAAG;EAC/BJ,QAAQ,EAAEF,SAAS,CAACO,IAAI,CAACC,UAAU;EACnCL,QAAQ,EAAEH,SAAS,CAACS,KAAK,CAAC,CAAC,SAAS,EAAE,UAAU,CAAC;AACnD,CAAC;AAEDR,oBAAoB,CAACS,YAAY,GAAG;EAClCP,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeF,oBAAoB","ignoreList":[]}
|
|
@@ -9,15 +9,14 @@ import FormControlDecorator from './FormControlDecorator';
|
|
|
9
9
|
/**
|
|
10
10
|
* Decorates a textual input.
|
|
11
11
|
*/
|
|
12
|
-
function FormControlDecoratorGroup(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
} = _ref;
|
|
12
|
+
function FormControlDecoratorGroup({
|
|
13
|
+
children,
|
|
14
|
+
leadingElement,
|
|
15
|
+
trailingElement,
|
|
16
|
+
floatingLabel,
|
|
17
|
+
className,
|
|
18
|
+
...props
|
|
19
|
+
}) {
|
|
21
20
|
const formGroupContext = useFormGroupContext(props);
|
|
22
21
|
const size = props.size || formGroupContext.size;
|
|
23
22
|
return /*#__PURE__*/React.createElement("div", {
|