@woovi/ui 4.0.942
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/.eslintrc.js +1 -0
- package/README.md +1 -0
- package/babel.config.js +3 -0
- package/babel.rollup.config.js +20 -0
- package/jest-eslint.config.js +7 -0
- package/jest.config.js +17 -0
- package/lib/index.cjs.js +1 -0
- package/package.json +107 -0
- package/rollup.config.js +96 -0
- package/src/BackButton.tsx +25 -0
- package/src/Badge.tsx +17 -0
- package/src/Banner.stories.tsx +108 -0
- package/src/Banner.tsx +44 -0
- package/src/CashbackTagStatus.tsx +31 -0
- package/src/Circle.tsx +10 -0
- package/src/CircleButton.tsx +51 -0
- package/src/ClockIcon.tsx +41 -0
- package/src/Column.tsx +6 -0
- package/src/CopyInput.tsx +40 -0
- package/src/EmptyMessage.stories.tsx +19 -0
- package/src/EmptyMessage.tsx +23 -0
- package/src/EncryptedText.tsx +23 -0
- package/src/FloatingMenu.tsx +88 -0
- package/src/LayoutRoot.tsx +14 -0
- package/src/LinearProgress.tsx +79 -0
- package/src/Link.tsx +9 -0
- package/src/Loading.stories.tsx +29 -0
- package/src/Loading.tsx +44 -0
- package/src/Logo.tsx +8 -0
- package/src/LoremIpsum.tsx +4 -0
- package/src/Modal/Modal.stories.tsx +38 -0
- package/src/Modal/Modal.tsx +93 -0
- package/src/OverflowDiv.tsx +25 -0
- package/src/ProgressBar.tsx +58 -0
- package/src/ProgressBarText.tsx +34 -0
- package/src/QuestionTooltip.tsx +40 -0
- package/src/RadioCard/RadioCard.tsx +101 -0
- package/src/RadioCard/__stories__/RadioCard.stories.tsx +235 -0
- package/src/Row.tsx +8 -0
- package/src/SafeTextTooltip.tsx +35 -0
- package/src/SearchField.tsx +71 -0
- package/src/Step.tsx +32 -0
- package/src/TagWebhookStatus.tsx +20 -0
- package/src/ToggleButtonGroup.stories.tsx +65 -0
- package/src/ToggleButtonGroup.tsx +114 -0
- package/src/ToggleButtonGroupMobile.tsx +56 -0
- package/src/TransactionTagEntryTypes.tsx +18 -0
- package/src/TransactionTagStatus.tsx +27 -0
- package/src/UnsupportedBrowserWarning.tsx +76 -0
- package/src/__visual__/CopyInput.spec.tsx +12 -0
- package/src/__visual__/__image_snapshots__/copy-input-spec-tsx-match-image-snapshot-copy-input-1-snap.png +0 -0
- package/src/auth/LoginWrapper.tsx +21 -0
- package/src/avatar/Avatar.tsx +66 -0
- package/src/avatar/AvatarGroup.tsx +103 -0
- package/src/avatar/AvatarGroupArray.tsx +67 -0
- package/src/avatar/AvatarGroupSelectedAll.tsx +76 -0
- package/src/avatar/stories/Avatar.stories.tsx +24 -0
- package/src/buttons/ActionButton.tsx +111 -0
- package/src/buttons/DangerButton.tsx +35 -0
- package/src/buttons/PayWithPixButton.tsx +75 -0
- package/src/buttons/SplitButton.tsx +112 -0
- package/src/buttons/__stories__/PayWithPixButton.stories.tsx +19 -0
- package/src/buttons/__visual__/ActionButton.spec.tsx +12 -0
- package/src/buttons/__visual__/PayWithPixButton.spec.tsx +12 -0
- package/src/buttons/__visual__/__image_snapshots__/action-button-spec-tsx-match-image-snapshot-action-button-1-snap.png +0 -0
- package/src/buttons/__visual__/__image_snapshots__/pay-with-pix-button-spec-tsx-match-image-snapshot-pay-with-pix-button-1-snap.png +0 -0
- package/src/buttons/getLoadingIconProp.tsx +7 -0
- package/src/buttons/stories/ActionButton.stories.tsx +196 -0
- package/src/buttons/stories/SplitButton.stories.tsx +28 -0
- package/src/card/Card.tsx +91 -0
- package/src/card/CardActions.tsx +13 -0
- package/src/card/CardContent.tsx +26 -0
- package/src/card/CardForm.tsx +80 -0
- package/src/card/CardList.tsx +67 -0
- package/src/card/CardRadio.tsx +0 -0
- package/src/card/CardSkeleton.tsx +25 -0
- package/src/card/CardWithLink.tsx +49 -0
- package/src/card/CardWithLinkSkeleton.tsx +14 -0
- package/src/card/basicContext/CardBasicContext.tsx +190 -0
- package/src/card/cardWithActions/CardFooter.tsx +13 -0
- package/src/card/cardWithActions/CardHeader.tsx +15 -0
- package/src/card/cardWithActions/CardWithActions.stories.tsx +53 -0
- package/src/card/cardWithActions/CardWithActions.tsx +161 -0
- package/src/card/stories/Card.stories.tsx +91 -0
- package/src/card/stories/CardContent.stories.tsx +28 -0
- package/src/card/stories/CardForm.stories.tsx +49 -0
- package/src/card/stories/CardWithLink.stories.tsx +64 -0
- package/src/cardAnalytics/CardAnalytics.stories.tsx +83 -0
- package/src/cardAnalytics/CardAnalytics.tsx +78 -0
- package/src/cardAnalytics/CardAnalyticsSkeleton.tsx +26 -0
- package/src/cardGrid/CardField.tsx +44 -0
- package/src/cardGrid/CardFieldCentered.tsx +28 -0
- package/src/cardGrid/CardGrid.stories.tsx +102 -0
- package/src/cardGrid/CardGrid.tsx +38 -0
- package/src/cardGrid/Grid.tsx +27 -0
- package/src/cardWithImage/CardWithImage.tsx +66 -0
- package/src/cardWithImage/__stories__/CardWithImage.stories.tsx +25 -0
- package/src/cardWithImage/__stories__/__assets__/WooviCashback.png +0 -0
- package/src/code/Code.stories.tsx +25 -0
- package/src/code/Code.tsx +20 -0
- package/src/collapsible/Collapse.tsx +73 -0
- package/src/collapsible/Collapsible.tsx +214 -0
- package/src/collapsible/CollapsibleActions.tsx +162 -0
- package/src/collapsible/CollapsibleDetails.tsx +37 -0
- package/src/collapsible/CollapsibleFillWrapper.tsx +6 -0
- package/src/collapsible/CollapsibleGroup.tsx +6 -0
- package/src/collapsible/CollapsibleInfinityActions.tsx +238 -0
- package/src/collapsible/CollapsiblePanelActions.tsx +57 -0
- package/src/collapsible/CollapsibleStep.tsx +118 -0
- package/src/collapsible/CollapsibleStepHeader.tsx +90 -0
- package/src/collapsible/CollapsibleSummary.tsx +54 -0
- package/src/collapsible/CollapsibleTree.tsx +236 -0
- package/src/collapsible/ExpandMoreIcon.tsx +12 -0
- package/src/collapsible/LeafCollapsible.tsx +17 -0
- package/src/collapsible/TransparencyCollapsibleWrapper.tsx +28 -0
- package/src/collapsible/stories/CollapisbleStep.stories.tsx +121 -0
- package/src/collapsible/stories/Collapse.stories.tsx +50 -0
- package/src/collapsible/stories/Collapsible.stories.tsx +121 -0
- package/src/collapsible/stories/CollapsibleGroup.stories.tsx +110 -0
- package/src/collapsible/stories/CollapsibleOld.stories.tsx +582 -0
- package/src/collapsible/stories/CollapsibleStepHeader.stories.tsx +37 -0
- package/src/company/CompanyLogo.tsx +38 -0
- package/src/company/stories/CompanyLogo.stories.tsx +18 -0
- package/src/content/ActionMargin.stories.tsx +21 -0
- package/src/content/ActionMargin.tsx +40 -0
- package/src/content/ActionMarginText.tsx +8 -0
- package/src/content/Content.tsx +18 -0
- package/src/content/IntroText.tsx +23 -0
- package/src/countdown/Countdown.stories.tsx +32 -0
- package/src/countdown/Countdown.tsx +41 -0
- package/src/countdown/ShowCounter.tsx +36 -0
- package/src/countdown/useCountdown.tsx +34 -0
- package/src/datagrid/DataGrid.stories.tsx +146 -0
- package/src/datagrid/DataGrid.tsx +263 -0
- package/src/datagrid/DataGridDetailContainer.tsx +23 -0
- package/src/datagrid/DataGridRow.tsx +30 -0
- package/src/datagrid/__tests__/DataGrid.spec.tsx +33 -0
- package/src/datagrid/cellTypeBasisToPercentage.tsx +18 -0
- package/src/datagrid/cellTypeBoolean.tsx +21 -0
- package/src/datagrid/cellTypeCurrency.ts +18 -0
- package/src/datagrid/cellTypeDate.ts +8 -0
- package/src/datagrid/cellTypeDatetime.ts +8 -0
- package/src/datagrid/cellTypeDatetimeSeconds.ts +8 -0
- package/src/datagrid/cellTypeExpand.tsx +77 -0
- package/src/datagrid/cellTypeLink.tsx +22 -0
- package/src/datagrid/cellTypePhone.tsx +22 -0
- package/src/datagrid/cellTypeTag.tsx +28 -0
- package/src/datagrid/cellTypeTaxID.tsx +12 -0
- package/src/datagrid/cellTypeTime.ts +8 -0
- package/src/datagrid/columnTypes.ts +21 -0
- package/src/datagrid/useTableView.tsx +26 -0
- package/src/deprecated/VirtualizedMobileList.tsx +71 -0
- package/src/deprecated/VirtualizedTable.tsx +165 -0
- package/src/deprecated/VirtualizedTableHeader.tsx +103 -0
- package/src/device/Phone.stories.tsx +34 -0
- package/src/device/Phone.tsx +62 -0
- package/src/dialog/DialogContext.tsx +22 -0
- package/src/dialog/DialogProvider.tsx +141 -0
- package/src/dialog/__tests__/useDialog.spec.tsx +73 -0
- package/src/dialog/index.tsx +6 -0
- package/src/dialog/useDialog.tsx +14 -0
- package/src/drawer/DrawerCard.tsx +70 -0
- package/src/drawer/DrawerResponsiveWrapper.tsx +12 -0
- package/src/drawer/swipable/SwipeableDrawer.stories.tsx +35 -0
- package/src/drawer/swipable/SwipeableDrawer.tsx +40 -0
- package/src/error/ErrorBoundaryWithRetry.tsx +50 -0
- package/src/error/ErrorView.tsx +61 -0
- package/src/file/FileDrop.tsx +73 -0
- package/src/file/IconButton.tsx +57 -0
- package/src/file/MaterialIcon.tsx +35 -0
- package/src/filter/Filter.tsx +108 -0
- package/src/filter/FilterRelayFormik.tsx +53 -0
- package/src/filter/FormikFilter.tsx +39 -0
- package/src/filter/__tests__/FieldDecoding.spec.tsx +68 -0
- package/src/filter/__tests__/FieldEncoding.spec.tsx +68 -0
- package/src/filter/__tests__/Filter.spec.tsx +35 -0
- package/src/filter/__tests__/FilterRelayFormik.spec.tsx +43 -0
- package/src/filter/decodeQueryParamsFromLocation.tsx +19 -0
- package/src/filter/fieldToParamConfigMap.tsx +31 -0
- package/src/filter/formatFilterValue.tsx +36 -0
- package/src/filter/formatFilters.tsx +27 -0
- package/src/filter/isValidDatetime.tsx +4 -0
- package/src/filter/orderBy/OrderBySelect.tsx +81 -0
- package/src/filter/stringToBoolean.ts +15 -0
- package/src/filter/useFilterFormik.tsx +372 -0
- package/src/form/FieldRow.tsx +28 -0
- package/src/form/__stories__/FieldRow.stories.tsx +27 -0
- package/src/heading/SectionHeading.tsx +18 -0
- package/src/heading/__stories__/SectionHeading.stories.tsx +23 -0
- package/src/helpers/Divider.tsx +27 -0
- package/src/helpers/HorizontalStack.tsx +12 -0
- package/src/helpers/HoverPopper.tsx +57 -0
- package/src/helpers/stories/HorizontalStack.stories.tsx +82 -0
- package/src/helpers.ts +133 -0
- package/src/icons/AssineOnlineIcon.tsx +123 -0
- package/src/icons/BotConversaIcon.tsx +39 -0
- package/src/icons/CheckIconLabel.tsx +34 -0
- package/src/icons/CheckboxChecked.tsx +34 -0
- package/src/icons/CheckboxIndeterminate.tsx +27 -0
- package/src/icons/CheckboxUnchecked.tsx +36 -0
- package/src/icons/Icon.tsx +8 -0
- package/src/icons/N8nIcon.tsx +40 -0
- package/src/icons/NuvemshopIcon.tsx +25 -0
- package/src/icons/RightTopDiagonalVector.tsx +22 -0
- package/src/icons/SVG.tsx +9 -0
- package/src/icons/SocPanelIcon.tsx +48 -0
- package/src/icons/WabizIcon.tsx +42 -0
- package/src/icons/WakeIcon.tsx +45 -0
- package/src/import/Dropzone.tsx +13 -0
- package/src/import/DropzoneFile.tsx +278 -0
- package/src/import/xlsx/Import.tsx +161 -0
- package/src/import/xlsx/ImportDropzone.tsx +120 -0
- package/src/import/xlsx/ImportProcessData.tsx +92 -0
- package/src/import/xlsx/ImportProcessQueue.tsx +176 -0
- package/src/import/xlsx/ImportStepper.tsx +247 -0
- package/src/import/xlsx/ImportTable.tsx +72 -0
- package/src/import/xlsx/ImportUtils.tsx +726 -0
- package/src/index.tsx +328 -0
- package/src/layoutWrapper/LayoutWrapper.tsx +48 -0
- package/src/layoutWrapper/LayoutWrapperFluid.tsx +38 -0
- package/src/logo/OpenPixLogoColor.tsx +137 -0
- package/src/logo/WooviLogo.tsx +46 -0
- package/src/mui/BoxFlex.tsx +27 -0
- package/src/mui/Typography.tsx +8 -0
- package/src/mui/__stories__/Typography.stories.tsx +14 -0
- package/src/mui/__stories__/TypographyExample.tsx +29 -0
- package/src/multifactor/MultiFactorConfirmModal.tsx +67 -0
- package/src/multifactor/__stories__/MultiFactorConfirmModal.stories.tsx +30 -0
- package/src/openpix/charge/ChargeTagStatus.tsx +21 -0
- package/src/openpix/images/GiftbackEnvelopeSvg.tsx +152 -0
- package/src/openpix/images/WooviLogoInMobile.tsx +35 -0
- package/src/openpix/order/CheckIcon.tsx +20 -0
- package/src/openpix/order/ConfirmedIcon.tsx +189 -0
- package/src/openpix/order/EarnCashback.tsx +39 -0
- package/src/openpix/order/EarnCashbackExclusive.tsx +42 -0
- package/src/openpix/order/GiftbackRedeem.tsx +38 -0
- package/src/openpix/order/PayPixValueCompany.tsx +85 -0
- package/src/openpix/order/PixPaymentWoovi.tsx +82 -0
- package/src/openpix/order/RedeemCashbackExclusiveScheduled.tsx +52 -0
- package/src/openpix/order/ShopperSeeMyGiftback.tsx +51 -0
- package/src/openpix/order/__generated__/RedeemCashbackExclusiveScheduled_charge.graphql.ts +55 -0
- package/src/openpix/order/discount/EarnDiscount.tsx +34 -0
- package/src/openpix/order/giftback/EarnGiftback.tsx +53 -0
- package/src/openpix/order/giftback/GiftbackRule.tsx +32 -0
- package/src/openpix/paymentLink/AdditionalInfo.tsx +60 -0
- package/src/openpix/paymentLink/BrCodeInput.tsx +48 -0
- package/src/openpix/paymentLink/ChargeInfo.tsx +76 -0
- package/src/openpix/paymentLink/CopyQRCode.stories.tsx +21 -0
- package/src/openpix/paymentLink/CopyQRCode.tsx +75 -0
- package/src/openpix/paymentLink/ErrorIcon.tsx +18 -0
- package/src/openpix/paymentLink/InfoSide.tsx +174 -0
- package/src/openpix/paymentLink/InterestsInfo.tsx +60 -0
- package/src/openpix/paymentLink/NotFound.tsx +16 -0
- package/src/openpix/paymentLink/PaymentDeleted.tsx +172 -0
- package/src/openpix/paymentLink/PaymentExpired.tsx +170 -0
- package/src/openpix/paymentLink/PaymentFooter.tsx +13 -0
- package/src/openpix/paymentLink/PaymentLink.stories.tsx +57 -0
- package/src/openpix/paymentLink/PaymentLink.tsx +97 -0
- package/src/openpix/paymentLink/PaymentLinkActive.tsx +36 -0
- package/src/openpix/paymentLink/PaymentLinkTestAccountBanner.tsx +47 -0
- package/src/openpix/paymentLink/PaymentLinkWrapper.tsx +60 -0
- package/src/openpix/paymentLink/PaymentLogo.tsx +56 -0
- package/src/openpix/paymentLink/QrCodeResponsive.tsx +77 -0
- package/src/openpix/paymentLink/QrCodeSectionHeaderInfo.tsx +45 -0
- package/src/openpix/paymentLink/QrCodeShowButton.tsx +44 -0
- package/src/openpix/paymentLink/QrCodeSide.tsx +200 -0
- package/src/openpix/paymentLink/ShareButton.tsx +133 -0
- package/src/openpix/paymentLink/__generated__/PaymentLinkActive_charge.graphql.ts +40 -0
- package/src/openpix/paymentLink/__generated__/PaymentLink_charge.graphql.ts +45 -0
- package/src/openpix/paymentLink/__generated__/QrCodeSide_charge.graphql.ts +40 -0
- package/src/openpix/paymentLink/types/ChargeDataType.tsx +119 -0
- package/src/openpix/paymentSuccess/PaymentSuccess.tsx +213 -0
- package/src/openpix/paymentSuccess/PaymentSuccessRewards.tsx +229 -0
- package/src/openpix/paymentSuccess/__generated__/PaymentSuccessRewards_charge.graphql.ts +195 -0
- package/src/openpix/paymentSuccess/__generated__/PaymentSuccess_charge.graphql.ts +40 -0
- package/src/openpix/shopper/WooviAuthForm.tsx +225 -0
- package/src/openpix/transaction/PixTransactionTypeTag.tsx +22 -0
- package/src/paymentLinkRow/PaymentLinkRow.tsx +37 -0
- package/src/paymentLinkRow/__stories__/PaymentLinkRow.stories.tsx +40 -0
- package/src/pinInput/PinInput.stories.tsx +48 -0
- package/src/pinInput/PinInput.tsx +246 -0
- package/src/pinInput/PinInputFormik.tsx +18 -0
- package/src/pinInput/createPinArray.ts +17 -0
- package/src/pinInput/pinInputRegex.ts +4 -0
- package/src/relay/RefreshButtonRelay.tsx +45 -0
- package/src/relay/RefreshIconButton.tsx +15 -0
- package/src/relay/SearchInputRelay.tsx +101 -0
- package/src/relay/TopPagination.tsx +68 -0
- package/src/rewardTicket/RewardTicket.tsx +68 -0
- package/src/rewardTicket/__stories__/RewardTicket.stories.tsx +40 -0
- package/src/ribbon/Ribbon.tsx +31 -0
- package/src/ribbon/__stories__/Ribbon.stories.tsx +34 -0
- package/src/ribbon/__visual__/Ribbon.spec.tsx +23 -0
- package/src/ribbon/__visual__/__image_snapshots__/ribbon-spec-tsx-match-image-snapshot-ribbon-1-snap.png +0 -0
- package/src/root/ContentBoundary.tsx +45 -0
- package/src/routed/RoutedTabs.tsx +166 -0
- package/src/routed/TabbedContent.tsx +41 -0
- package/src/routed/__tests__/RoutedTabs.spec.tsx +50 -0
- package/src/screenHeader/ScreenHeader.stories.tsx +106 -0
- package/src/screenHeader/ScreenHeaderUI.tsx +149 -0
- package/src/screenHeader/components/ScreenHeaderSubtitle.tsx +10 -0
- package/src/screenHeader/components/ScreenHeaderTitle.tsx +32 -0
- package/src/screenHeaderCard/ScreenHeaderCard.stories.tsx +49 -0
- package/src/screenHeaderCard/ScreenHeaderCard.tsx +93 -0
- package/src/search/GlobalSearchField.tsx +148 -0
- package/src/select/Select.tsx +22 -0
- package/src/select/SelectAll.tsx +64 -0
- package/src/select/__stories__/Select.stories.tsx +40 -0
- package/src/sidebar/Group.tsx +135 -0
- package/src/sidebar/Item.tsx +52 -0
- package/src/sidebar/MenuList.tsx +95 -0
- package/src/sidebar/Sidebar.stories.tsx +148 -0
- package/src/sidebar/Sidebar.tsx +58 -0
- package/src/sidebar/SidebarContext.tsx +32 -0
- package/src/sidebar/index.tsx +7 -0
- package/src/sidebar/useSidebar.tsx +28 -0
- package/src/sidebar/utils.ts +6 -0
- package/src/snackbar/Snackbar.tsx +117 -0
- package/src/snackbar/SnackbarContext.tsx +22 -0
- package/src/snackbar/__tests__/Snackbar.spec.tsx +19 -0
- package/src/snackbar/fixtures/ShowSnackbar.tsx +38 -0
- package/src/snackbar/index.tsx +6 -0
- package/src/snackbar/useSnackbar.tsx +16 -0
- package/src/statement/TransactionTypeText.tsx +7 -0
- package/src/statement/statementColors.ts +6 -0
- package/src/stepper/Stepper.stories.tsx +25 -0
- package/src/stepper/Stepper.tsx +74 -0
- package/src/swipeableModal/SwipeableModal.stories.tsx +47 -0
- package/src/swipeableModal/SwipeableModal.tsx +68 -0
- package/src/swipeableModal/SwipeableModalTransition.tsx +33 -0
- package/src/table/CardColumn.tsx +34 -0
- package/src/table/CardListVirtualized.tsx +217 -0
- package/src/table/TableToggleViewModel.tsx +49 -0
- package/src/table/cells/ActionCellNode.tsx +80 -0
- package/src/table/cells/Cell.tsx +26 -0
- package/src/table/cells/CheckboxCellNode.tsx +47 -0
- package/src/table/cells/IconCellNode.tsx +53 -0
- package/src/table/cells/LinkCellNode.tsx +76 -0
- package/src/table/cells/RenderCell.tsx +17 -0
- package/src/table/cells/__tests__/LinkCellNode.spec.tsx +40 -0
- package/src/table/cells/cellTypes.ts +16 -0
- package/src/table/cells/getCellCurrency.tsx +17 -0
- package/src/table/cells/getCellDate.tsx +29 -0
- package/src/table/cells/getCellLink.tsx +20 -0
- package/src/table/cells/getCellValue.tsx +79 -0
- package/src/table/cells/index.ts +1 -0
- package/src/table/stories/TableToggleViewModel.stories.tsx +10 -0
- package/src/tag/Tag.tsx +62 -0
- package/src/tag/TagsContainer.tsx +19 -0
- package/src/tag/stories/Tag.stories.tsx +148 -0
- package/src/term/Terms.tsx +8 -0
- package/src/term/TermsLink.tsx +7 -0
- package/src/term/TermsModal.stories.tsx +19 -0
- package/src/term/TermsModal.tsx +40 -0
- package/src/term/useTerms.tsx +57 -0
- package/src/text/TextMultiline.tsx +24 -0
- package/src/textDialog/TextDialog.tsx +86 -0
- package/src/theme/Themes.tsx +223 -0
- package/src/theme/stories/Theme.stories.tsx +13 -0
- package/src/theme/stories/ThemeExample.tsx +193 -0
- package/src/timeline/Timeline.tsx +23 -0
- package/src/timeline/TimelineAppEventDomainIcon.tsx +21 -0
- package/src/timeline/TimelineAppEventItem.tsx +70 -0
- package/src/timeline/TimelineAppEventTypeColor.tsx +33 -0
- package/src/timeline/TimelineItem.tsx +57 -0
- package/src/timeline/__stories__/Timeline.stories.tsx +39 -0
- package/src/timeline/__stories__/TimelineAppEvent.stories.tsx +43 -0
- package/src/unSupportedBrowser/UnsupportedBrowserWarning.tsx +78 -0
- package/src/unSupportedBrowser/index.tsx +2 -0
- package/src/unSupportedBrowser/isUnSupportedBrowser.tsx +15 -0
- package/src/user/chip/UserChip.tsx +25 -0
- package/src/user/chip/stories/UserChip.stories.tsx +26 -0
- package/src/utils/BrowserOnly.tsx +21 -0
- package/src/utils/DesktopOnly.tsx +27 -0
- package/src/utils/MobileOnly.tsx +27 -0
- package/src/windowPopper/WindowPopper.stories.tsx +52 -0
- package/src/windowPopper/WindowPopper.tsx +109 -0
- package/src/windowPopper/WindowPopperTransition.tsx +22 -0
- package/test/ImageReporter.js +41 -0
- package/test/babel-transformer.js +7 -0
- package/test/convertHtmlToImage.tsx +25 -0
- package/test/jest.setup.js +31 -0
- package/test/testUtils.tsx +37 -0
- package/tsconfig.build.json +25 -0
- package/tsconfig.json +4 -0
- package/types/form/test/i18n.d.ts +1 -0
- package/types/ui/src/BackButton.d.ts +5 -0
- package/types/ui/src/Badge.d.ts +2 -0
- package/types/ui/src/Banner.d.ts +10 -0
- package/types/ui/src/Banner.stories.d.ts +6 -0
- package/types/ui/src/CashbackTagStatus.d.ts +5 -0
- package/types/ui/src/Circle.d.ts +5 -0
- package/types/ui/src/CircleButton.d.ts +8 -0
- package/types/ui/src/ClockIcon.d.ts +5 -0
- package/types/ui/src/Column.d.ts +2 -0
- package/types/ui/src/CopyInput.d.ts +5 -0
- package/types/ui/src/EmptyMessage.d.ts +6 -0
- package/types/ui/src/EmptyMessage.stories.d.ts +3 -0
- package/types/ui/src/EncryptedText.d.ts +2 -0
- package/types/ui/src/FloatingMenu.d.ts +13 -0
- package/types/ui/src/LayoutRoot.d.ts +1 -0
- package/types/ui/src/LinearProgress.d.ts +7 -0
- package/types/ui/src/Link.d.ts +3 -0
- package/types/ui/src/Loading.d.ts +8 -0
- package/types/ui/src/Loading.stories.d.ts +5 -0
- package/types/ui/src/Logo.d.ts +1 -0
- package/types/ui/src/LoremIpsum.d.ts +2 -0
- package/types/ui/src/Modal/Modal.d.ts +19 -0
- package/types/ui/src/Modal/Modal.stories.d.ts +6 -0
- package/types/ui/src/OverflowDiv.d.ts +2 -0
- package/types/ui/src/ProgressBar.d.ts +9 -0
- package/types/ui/src/ProgressBarText.d.ts +6 -0
- package/types/ui/src/QuestionTooltip.d.ts +11 -0
- package/types/ui/src/RadioCard/RadioCard.d.ts +11 -0
- package/types/ui/src/RadioCard/__stories__/RadioCard.stories.d.ts +8 -0
- package/types/ui/src/Row.d.ts +2 -0
- package/types/ui/src/SafeTextTooltip.d.ts +8 -0
- package/types/ui/src/SearchField.d.ts +13 -0
- package/types/ui/src/Step.d.ts +9 -0
- package/types/ui/src/TagWebhookStatus.d.ts +7 -0
- package/types/ui/src/ToggleButtonGroup.d.ts +23 -0
- package/types/ui/src/ToggleButtonGroup.stories.d.ts +7 -0
- package/types/ui/src/ToggleButtonGroupMobile.d.ts +7 -0
- package/types/ui/src/TransactionTagEntryTypes.d.ts +4 -0
- package/types/ui/src/TransactionTagStatus.d.ts +8 -0
- package/types/ui/src/UnsupportedBrowserWarning.d.ts +2 -0
- package/types/ui/src/auth/LoginWrapper.d.ts +8 -0
- package/types/ui/src/avatar/Avatar.d.ts +11 -0
- package/types/ui/src/avatar/AvatarGroup.d.ts +12 -0
- package/types/ui/src/avatar/AvatarGroupArray.d.ts +7 -0
- package/types/ui/src/avatar/AvatarGroupSelectedAll.d.ts +8 -0
- package/types/ui/src/avatar/stories/Avatar.stories.d.ts +6 -0
- package/types/ui/src/buttons/ActionButton.d.ts +13 -0
- package/types/ui/src/buttons/DangerButton.d.ts +2 -0
- package/types/ui/src/buttons/PayWithPixButton.d.ts +12 -0
- package/types/ui/src/buttons/SplitButton.d.ts +18 -0
- package/types/ui/src/buttons/__stories__/PayWithPixButton.stories.d.ts +5 -0
- package/types/ui/src/buttons/getLoadingIconProp.d.ts +3 -0
- package/types/ui/src/buttons/stories/ActionButton.stories.d.ts +12 -0
- package/types/ui/src/buttons/stories/SplitButton.stories.d.ts +3 -0
- package/types/ui/src/card/Card.d.ts +16 -0
- package/types/ui/src/card/CardActions.d.ts +3 -0
- package/types/ui/src/card/CardContent.d.ts +6 -0
- package/types/ui/src/card/CardForm.d.ts +9 -0
- package/types/ui/src/card/CardList.d.ts +13 -0
- package/types/ui/src/card/CardRadio.d.ts +0 -0
- package/types/ui/src/card/CardSkeleton.d.ts +2 -0
- package/types/ui/src/card/CardWithLink.d.ts +8 -0
- package/types/ui/src/card/CardWithLinkSkeleton.d.ts +2 -0
- package/types/ui/src/card/basicContext/CardBasicContext.d.ts +35 -0
- package/types/ui/src/card/cardWithActions/CardFooter.d.ts +3 -0
- package/types/ui/src/card/cardWithActions/CardHeader.d.ts +6 -0
- package/types/ui/src/card/cardWithActions/CardWithActions.d.ts +27 -0
- package/types/ui/src/card/cardWithActions/CardWithActions.stories.d.ts +6 -0
- package/types/ui/src/card/stories/Card.stories.d.ts +9 -0
- package/types/ui/src/card/stories/CardContent.stories.d.ts +4 -0
- package/types/ui/src/card/stories/CardForm.stories.d.ts +5 -0
- package/types/ui/src/card/stories/CardWithLink.stories.d.ts +5 -0
- package/types/ui/src/cardAnalytics/CardAnalytics.d.ts +11 -0
- package/types/ui/src/cardAnalytics/CardAnalytics.stories.d.ts +5 -0
- package/types/ui/src/cardAnalytics/CardAnalyticsSkeleton.d.ts +2 -0
- package/types/ui/src/cardGrid/CardField.d.ts +9 -0
- package/types/ui/src/cardGrid/CardFieldCentered.d.ts +8 -0
- package/types/ui/src/cardGrid/CardGrid.d.ts +12 -0
- package/types/ui/src/cardGrid/CardGrid.stories.d.ts +8 -0
- package/types/ui/src/cardGrid/Grid.d.ts +12 -0
- package/types/ui/src/cardWithImage/CardWithImage.d.ts +9 -0
- package/types/ui/src/cardWithImage/__stories__/CardWithImage.stories.d.ts +4 -0
- package/types/ui/src/code/Code.d.ts +7 -0
- package/types/ui/src/code/Code.stories.d.ts +3 -0
- package/types/ui/src/collapsible/Collapse.d.ts +7 -0
- package/types/ui/src/collapsible/Collapsible.d.ts +59 -0
- package/types/ui/src/collapsible/CollapsibleActions.d.ts +6 -0
- package/types/ui/src/collapsible/CollapsibleDetails.d.ts +7 -0
- package/types/ui/src/collapsible/CollapsibleFillWrapper.d.ts +1 -0
- package/types/ui/src/collapsible/CollapsibleGroup.d.ts +2 -0
- package/types/ui/src/collapsible/CollapsibleInfinityActions.d.ts +57 -0
- package/types/ui/src/collapsible/CollapsiblePanelActions.d.ts +3 -0
- package/types/ui/src/collapsible/CollapsibleStep.d.ts +15 -0
- package/types/ui/src/collapsible/CollapsibleStepHeader.d.ts +11 -0
- package/types/ui/src/collapsible/CollapsibleSummary.d.ts +9 -0
- package/types/ui/src/collapsible/CollapsibleTree.d.ts +12 -0
- package/types/ui/src/collapsible/ExpandMoreIcon.d.ts +7 -0
- package/types/ui/src/collapsible/LeafCollapsible.d.ts +5 -0
- package/types/ui/src/collapsible/TransparencyCollapsibleWrapper.d.ts +2 -0
- package/types/ui/src/collapsible/stories/CollapisbleStep.stories.d.ts +8 -0
- package/types/ui/src/collapsible/stories/Collapse.stories.d.ts +4 -0
- package/types/ui/src/collapsible/stories/Collapsible.stories.d.ts +13 -0
- package/types/ui/src/collapsible/stories/CollapsibleGroup.stories.d.ts +4 -0
- package/types/ui/src/collapsible/stories/CollapsibleOld.stories.d.ts +50 -0
- package/types/ui/src/collapsible/stories/CollapsibleStepHeader.stories.d.ts +5 -0
- package/types/ui/src/company/CompanyLogo.d.ts +15 -0
- package/types/ui/src/company/stories/CompanyLogo.stories.d.ts +5 -0
- package/types/ui/src/content/ActionMargin.d.ts +7 -0
- package/types/ui/src/content/ActionMargin.stories.d.ts +3 -0
- package/types/ui/src/content/ActionMarginText.d.ts +2 -0
- package/types/ui/src/content/Content.d.ts +6 -0
- package/types/ui/src/content/IntroText.d.ts +6 -0
- package/types/ui/src/countdown/Countdown.d.ts +5 -0
- package/types/ui/src/countdown/Countdown.stories.d.ts +5 -0
- package/types/ui/src/countdown/ShowCounter.d.ts +8 -0
- package/types/ui/src/countdown/useCountdown.d.ts +2 -0
- package/types/ui/src/datagrid/DataGrid.d.ts +14 -0
- package/types/ui/src/datagrid/DataGrid.stories.d.ts +3 -0
- package/types/ui/src/datagrid/DataGridDetailContainer.d.ts +6 -0
- package/types/ui/src/datagrid/DataGridRow.d.ts +10 -0
- package/types/ui/src/datagrid/cellTypeBasisToPercentage.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeBoolean.d.ts +6 -0
- package/types/ui/src/datagrid/cellTypeCurrency.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeDate.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeDatetime.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeDatetimeSeconds.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeExpand.d.ts +45 -0
- package/types/ui/src/datagrid/cellTypeLink.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypePhone.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeTag.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeTaxID.d.ts +2 -0
- package/types/ui/src/datagrid/cellTypeTime.d.ts +2 -0
- package/types/ui/src/datagrid/columnTypes.d.ts +11 -0
- package/types/ui/src/datagrid/useTableView.d.ts +8 -0
- package/types/ui/src/deprecated/VirtualizedMobileList.d.ts +8 -0
- package/types/ui/src/deprecated/VirtualizedTable.d.ts +3 -0
- package/types/ui/src/deprecated/VirtualizedTableHeader.d.ts +8 -0
- package/types/ui/src/device/Phone.d.ts +6 -0
- package/types/ui/src/device/Phone.stories.d.ts +4 -0
- package/types/ui/src/dialog/DialogContext.d.ts +18 -0
- package/types/ui/src/dialog/DialogProvider.d.ts +7 -0
- package/types/ui/src/dialog/index.d.ts +5 -0
- package/types/ui/src/dialog/useDialog.d.ts +5 -0
- package/types/ui/src/drawer/DrawerCard.d.ts +11 -0
- package/types/ui/src/drawer/DrawerResponsiveWrapper.d.ts +1 -0
- package/types/ui/src/drawer/swipable/SwipeableDrawer.d.ts +8 -0
- package/types/ui/src/drawer/swipable/SwipeableDrawer.stories.d.ts +3 -0
- package/types/ui/src/error/ErrorBoundaryWithRetry.d.ts +26 -0
- package/types/ui/src/error/ErrorView.d.ts +9 -0
- package/types/ui/src/file/FileDrop.d.ts +12 -0
- package/types/ui/src/file/MaterialIcon.d.ts +14 -0
- package/types/ui/src/filter/Filter.d.ts +15 -0
- package/types/ui/src/filter/FilterRelayFormik.d.ts +26 -0
- package/types/ui/src/filter/FormikFilter.d.ts +9 -0
- package/types/ui/src/filter/decodeQueryParamsFromLocation.d.ts +2 -0
- package/types/ui/src/filter/fieldToParamConfigMap.d.ts +2 -0
- package/types/ui/src/filter/formatFilterValue.d.ts +1 -0
- package/types/ui/src/filter/formatFilters.d.ts +1 -0
- package/types/ui/src/filter/isValidDatetime.d.ts +1 -0
- package/types/ui/src/filter/orderBy/OrderBySelect.d.ts +15 -0
- package/types/ui/src/filter/stringToBoolean.d.ts +1 -0
- package/types/ui/src/filter/useFilterFormik.d.ts +91 -0
- package/types/ui/src/form/FieldRow.d.ts +6 -0
- package/types/ui/src/form/__stories__/FieldRow.stories.d.ts +3 -0
- package/types/ui/src/heading/SectionHeading.d.ts +6 -0
- package/types/ui/src/heading/__stories__/SectionHeading.stories.d.ts +4 -0
- package/types/ui/src/helpers/Divider.d.ts +8 -0
- package/types/ui/src/helpers/HorizontalStack.d.ts +3 -0
- package/types/ui/src/helpers/HoverPopper.d.ts +10 -0
- package/types/ui/src/helpers/stories/HorizontalStack.stories.d.ts +5 -0
- package/types/ui/src/helpers.d.ts +10 -0
- package/types/ui/src/icons/AssineOnlineIcon.d.ts +14 -0
- package/types/ui/src/icons/BotConversaIcon.d.ts +14 -0
- package/types/ui/src/icons/CheckIconLabel.d.ts +5 -0
- package/types/ui/src/icons/CheckboxChecked.d.ts +7 -0
- package/types/ui/src/icons/CheckboxIndeterminate.d.ts +14 -0
- package/types/ui/src/icons/CheckboxUnchecked.d.ts +14 -0
- package/types/ui/src/icons/Icon.d.ts +3 -0
- package/types/ui/src/icons/N8nIcon.d.ts +13 -0
- package/types/ui/src/icons/NuvemshopIcon.d.ts +14 -0
- package/types/ui/src/icons/RightTopDiagonalVector.d.ts +4 -0
- package/types/ui/src/icons/SVG.d.ts +32 -0
- package/types/ui/src/icons/SocPanelIcon.d.ts +12 -0
- package/types/ui/src/icons/WabizIcon.d.ts +13 -0
- package/types/ui/src/icons/WakeIcon.d.ts +14 -0
- package/types/ui/src/import/Dropzone.d.ts +2 -0
- package/types/ui/src/import/DropzoneFile.d.ts +19 -0
- package/types/ui/src/import/xlsx/Import.d.ts +19 -0
- package/types/ui/src/import/xlsx/ImportDropzone.d.ts +15 -0
- package/types/ui/src/import/xlsx/ImportProcessData.d.ts +7 -0
- package/types/ui/src/import/xlsx/ImportProcessQueue.d.ts +20 -0
- package/types/ui/src/import/xlsx/ImportStepper.d.ts +23 -0
- package/types/ui/src/import/xlsx/ImportTable.d.ts +7 -0
- package/types/ui/src/import/xlsx/ImportUtils.d.ts +89 -0
- package/types/ui/src/index.d.ts +212 -0
- package/types/ui/src/layoutWrapper/LayoutWrapper.d.ts +8 -0
- package/types/ui/src/layoutWrapper/LayoutWrapperFluid.d.ts +8 -0
- package/types/ui/src/logo/OpenPixLogoColor.d.ts +7 -0
- package/types/ui/src/logo/WooviLogo.d.ts +7 -0
- package/types/ui/src/mui/BoxFlex.d.ts +10 -0
- package/types/ui/src/mui/Typography.d.ts +3 -0
- package/types/ui/src/mui/__stories__/Typography.stories.d.ts +3 -0
- package/types/ui/src/mui/__stories__/TypographyExample.d.ts +2 -0
- package/types/ui/src/multifactor/MultiFactorConfirmModal.d.ts +11 -0
- package/types/ui/src/multifactor/__stories__/MultiFactorConfirmModal.stories.d.ts +5 -0
- package/types/ui/src/openpix/charge/ChargeTagStatus.d.ts +11 -0
- package/types/ui/src/openpix/images/GiftbackEnvelopeSvg.d.ts +6 -0
- package/types/ui/src/openpix/images/WooviLogoInMobile.d.ts +4 -0
- package/types/ui/src/openpix/order/CheckIcon.d.ts +2 -0
- package/types/ui/src/openpix/order/ConfirmedIcon.d.ts +2 -0
- package/types/ui/src/openpix/order/EarnCashback.d.ts +6 -0
- package/types/ui/src/openpix/order/EarnCashbackExclusive.d.ts +6 -0
- package/types/ui/src/openpix/order/GiftbackRedeem.d.ts +5 -0
- package/types/ui/src/openpix/order/PayPixValueCompany.d.ts +7 -0
- package/types/ui/src/openpix/order/PixPaymentWoovi.d.ts +6 -0
- package/types/ui/src/openpix/order/RedeemCashbackExclusiveScheduled.d.ts +6 -0
- package/types/ui/src/openpix/order/ShopperSeeMyGiftback.d.ts +8 -0
- package/types/ui/src/openpix/order/__generated__/RedeemCashbackExclusiveScheduled_charge.graphql.d.ts +19 -0
- package/types/ui/src/openpix/order/discount/EarnDiscount.d.ts +6 -0
- package/types/ui/src/openpix/order/giftback/EarnGiftback.d.ts +6 -0
- package/types/ui/src/openpix/order/giftback/GiftbackRule.d.ts +6 -0
- package/types/ui/src/openpix/paymentLink/AdditionalInfo.d.ts +12 -0
- package/types/ui/src/openpix/paymentLink/BrCodeInput.d.ts +5 -0
- package/types/ui/src/openpix/paymentLink/ChargeInfo.d.ts +7 -0
- package/types/ui/src/openpix/paymentLink/CopyQRCode.d.ts +6 -0
- package/types/ui/src/openpix/paymentLink/CopyQRCode.stories.d.ts +3 -0
- package/types/ui/src/openpix/paymentLink/ErrorIcon.d.ts +2 -0
- package/types/ui/src/openpix/paymentLink/InfoSide.d.ts +7 -0
- package/types/ui/src/openpix/paymentLink/InterestsInfo.d.ts +11 -0
- package/types/ui/src/openpix/paymentLink/NotFound.d.ts +2 -0
- package/types/ui/src/openpix/paymentLink/PaymentDeleted.d.ts +30 -0
- package/types/ui/src/openpix/paymentLink/PaymentExpired.d.ts +35 -0
- package/types/ui/src/openpix/paymentLink/PaymentFooter.d.ts +5 -0
- package/types/ui/src/openpix/paymentLink/PaymentLink.d.ts +15 -0
- package/types/ui/src/openpix/paymentLink/PaymentLink.stories.d.ts +4 -0
- package/types/ui/src/openpix/paymentLink/PaymentLinkActive.d.ts +8 -0
- package/types/ui/src/openpix/paymentLink/PaymentLinkTestAccountBanner.d.ts +6 -0
- package/types/ui/src/openpix/paymentLink/PaymentLinkWrapper.d.ts +8 -0
- package/types/ui/src/openpix/paymentLink/PaymentLogo.d.ts +7 -0
- package/types/ui/src/openpix/paymentLink/QrCodeResponsive.d.ts +12 -0
- package/types/ui/src/openpix/paymentLink/QrCodeSectionHeaderInfo.d.ts +2 -0
- package/types/ui/src/openpix/paymentLink/QrCodeShowButton.d.ts +6 -0
- package/types/ui/src/openpix/paymentLink/QrCodeSide.d.ts +10 -0
- package/types/ui/src/openpix/paymentLink/ShareButton.d.ts +9 -0
- package/types/ui/src/openpix/paymentLink/__generated__/PaymentLinkActive_charge.graphql.d.ts +17 -0
- package/types/ui/src/openpix/paymentLink/__generated__/PaymentLink_charge.graphql.d.ts +17 -0
- package/types/ui/src/openpix/paymentLink/__generated__/QrCodeSide_charge.graphql.d.ts +17 -0
- package/types/ui/src/openpix/paymentLink/types/ChargeDataType.d.ts +106 -0
- package/types/ui/src/openpix/paymentSuccess/PaymentSuccess.d.ts +17 -0
- package/types/ui/src/openpix/paymentSuccess/PaymentSuccessRewards.d.ts +8 -0
- package/types/ui/src/openpix/paymentSuccess/__generated__/PaymentSuccessRewards_charge.graphql.d.ts +55 -0
- package/types/ui/src/openpix/paymentSuccess/__generated__/PaymentSuccess_charge.graphql.d.ts +17 -0
- package/types/ui/src/openpix/shopper/WooviAuthForm.d.ts +21 -0
- package/types/ui/src/openpix/transaction/PixTransactionTypeTag.d.ts +6 -0
- package/types/ui/src/paymentLinkRow/PaymentLinkRow.d.ts +9 -0
- package/types/ui/src/paymentLinkRow/__stories__/PaymentLinkRow.stories.d.ts +7 -0
- package/types/ui/src/pinInput/PinInput.d.ts +62 -0
- package/types/ui/src/pinInput/PinInput.stories.d.ts +6 -0
- package/types/ui/src/pinInput/PinInputFormik.d.ts +6 -0
- package/types/ui/src/pinInput/createPinArray.d.ts +1 -0
- package/types/ui/src/pinInput/pinInputRegex.d.ts +4 -0
- package/types/ui/src/relay/RefreshButtonRelay.d.ts +8 -0
- package/types/ui/src/relay/RefreshIconButton.d.ts +5 -0
- package/types/ui/src/relay/SearchInputRelay.d.ts +17 -0
- package/types/ui/src/relay/TopPagination.d.ts +9 -0
- package/types/ui/src/rewardTicket/RewardTicket.d.ts +8 -0
- package/types/ui/src/rewardTicket/__stories__/RewardTicket.stories.d.ts +5 -0
- package/types/ui/src/ribbon/Ribbon.d.ts +7 -0
- package/types/ui/src/ribbon/__stories__/Ribbon.stories.d.ts +4 -0
- package/types/ui/src/root/ContentBoundary.d.ts +4 -0
- package/types/ui/src/routed/RoutedTabs.d.ts +19 -0
- package/types/ui/src/routed/TabbedContent.d.ts +8 -0
- package/types/ui/src/screenHeader/ScreenHeader.stories.d.ts +9 -0
- package/types/ui/src/screenHeader/ScreenHeaderUI.d.ts +14 -0
- package/types/ui/src/screenHeader/components/ScreenHeaderSubtitle.d.ts +2 -0
- package/types/ui/src/screenHeader/components/ScreenHeaderTitle.d.ts +6 -0
- package/types/ui/src/screenHeaderCard/ScreenHeaderCard.d.ts +12 -0
- package/types/ui/src/screenHeaderCard/ScreenHeaderCard.stories.d.ts +5 -0
- package/types/ui/src/search/GlobalSearchField.d.ts +12 -0
- package/types/ui/src/select/Select.d.ts +7 -0
- package/types/ui/src/select/SelectAll.d.ts +13 -0
- package/types/ui/src/select/__stories__/Select.stories.d.ts +7 -0
- package/types/ui/src/sidebar/Group.d.ts +7 -0
- package/types/ui/src/sidebar/Item.d.ts +7 -0
- package/types/ui/src/sidebar/MenuList.d.ts +13 -0
- package/types/ui/src/sidebar/Sidebar.d.ts +14 -0
- package/types/ui/src/sidebar/Sidebar.stories.d.ts +5 -0
- package/types/ui/src/sidebar/SidebarContext.d.ts +9 -0
- package/types/ui/src/sidebar/index.d.ts +6 -0
- package/types/ui/src/sidebar/useSidebar.d.ts +7 -0
- package/types/ui/src/sidebar/utils.d.ts +2 -0
- package/types/ui/src/snackbar/Snackbar.d.ts +6 -0
- package/types/ui/src/snackbar/SnackbarContext.d.ts +15 -0
- package/types/ui/src/snackbar/fixtures/ShowSnackbar.d.ts +2 -0
- package/types/ui/src/snackbar/index.d.ts +5 -0
- package/types/ui/src/snackbar/useSnackbar.d.ts +6 -0
- package/types/ui/src/statement/TransactionTypeText.d.ts +2 -0
- package/types/ui/src/statement/statementColors.d.ts +3 -0
- package/types/ui/src/stepper/Stepper.d.ts +9 -0
- package/types/ui/src/stepper/Stepper.stories.d.ts +3 -0
- package/types/ui/src/swipeableModal/SwipeableModal.d.ts +12 -0
- package/types/ui/src/swipeableModal/SwipeableModal.stories.d.ts +3 -0
- package/types/ui/src/swipeableModal/SwipeableModalTransition.d.ts +7 -0
- package/types/ui/src/table/CardColumn.d.ts +9 -0
- package/types/ui/src/table/CardListVirtualized.d.ts +20 -0
- package/types/ui/src/table/TableToggleViewModel.d.ts +6 -0
- package/types/ui/src/table/cells/ActionCellNode.d.ts +5 -0
- package/types/ui/src/table/cells/Cell.d.ts +9 -0
- package/types/ui/src/table/cells/CheckboxCellNode.d.ts +15 -0
- package/types/ui/src/table/cells/IconCellNode.d.ts +5 -0
- package/types/ui/src/table/cells/LinkCellNode.d.ts +7 -0
- package/types/ui/src/table/cells/cellTypes.d.ts +15 -0
- package/types/ui/src/table/cells/getCellCurrency.d.ts +3 -0
- package/types/ui/src/table/cells/getCellDate.d.ts +8 -0
- package/types/ui/src/table/cells/getCellLink.d.ts +3 -0
- package/types/ui/src/table/cells/getCellValue.d.ts +1 -0
- package/types/ui/src/table/cells/index.d.ts +1 -0
- package/types/ui/src/table/stories/TableToggleViewModel.stories.d.ts +3 -0
- package/types/ui/src/tag/Tag.d.ts +9 -0
- package/types/ui/src/tag/TagsContainer.d.ts +6 -0
- package/types/ui/src/tag/stories/Tag.stories.d.ts +10 -0
- package/types/ui/src/term/Terms.d.ts +1 -0
- package/types/ui/src/term/TermsLink.d.ts +1 -0
- package/types/ui/src/term/TermsModal.d.ts +12 -0
- package/types/ui/src/term/TermsModal.stories.d.ts +3 -0
- package/types/ui/src/term/useTerms.d.ts +5 -0
- package/types/ui/src/text/TextMultiline.d.ts +6 -0
- package/types/ui/src/textDialog/TextDialog.d.ts +8 -0
- package/types/ui/src/theme/Themes.d.ts +22 -0
- package/types/ui/src/theme/stories/Theme.stories.d.ts +3 -0
- package/types/ui/src/theme/stories/ThemeExample.d.ts +2 -0
- package/types/ui/src/timeline/Timeline.d.ts +6 -0
- package/types/ui/src/timeline/TimelineAppEventDomainIcon.d.ts +3 -0
- package/types/ui/src/timeline/TimelineAppEventItem.d.ts +9 -0
- package/types/ui/src/timeline/TimelineAppEventTypeColor.d.ts +3 -0
- package/types/ui/src/timeline/TimelineItem.d.ts +11 -0
- package/types/ui/src/timeline/__stories__/Timeline.stories.d.ts +3 -0
- package/types/ui/src/timeline/__stories__/TimelineAppEvent.stories.d.ts +3 -0
- package/types/ui/src/unSupportedBrowser/UnsupportedBrowserWarning.d.ts +2 -0
- package/types/ui/src/unSupportedBrowser/index.d.ts +2 -0
- package/types/ui/src/unSupportedBrowser/isUnSupportedBrowser.d.ts +4 -0
- package/types/ui/src/user/chip/UserChip.d.ts +6 -0
- package/types/ui/src/user/chip/stories/UserChip.stories.d.ts +4 -0
- package/types/ui/src/utils/BrowserOnly.d.ts +7 -0
- package/types/ui/src/utils/DesktopOnly.d.ts +8 -0
- package/types/ui/src/utils/MobileOnly.d.ts +8 -0
- package/types/ui/src/windowPopper/WindowPopper.d.ts +16 -0
- package/types/ui/src/windowPopper/WindowPopper.stories.d.ts +3 -0
- package/types/ui/src/windowPopper/WindowPopperTransition.d.ts +7 -0
- package/types/ui/test/convertHtmlToImage.d.ts +1 -0
- package/types/ui/test/testUtils.d.ts +9 -0
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
import moment from 'moment';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { v4 as uuidv4 } from 'uuid';
|
|
4
|
+
|
|
5
|
+
import { formatAnyDateToMongoDate, isValidAnyDate } from '@woovi/dates';
|
|
6
|
+
import {
|
|
7
|
+
IMPORT_STATUS,
|
|
8
|
+
InputCell,
|
|
9
|
+
InputDateCell,
|
|
10
|
+
InputMoneyCell,
|
|
11
|
+
InputPhoneCell,
|
|
12
|
+
InputTaxIDCell,
|
|
13
|
+
} from '@woovi/table';
|
|
14
|
+
import {
|
|
15
|
+
convertToCents,
|
|
16
|
+
convertToMoney,
|
|
17
|
+
isSafeCNPJ,
|
|
18
|
+
isSafeCPF,
|
|
19
|
+
} from '@woovi/utils';
|
|
20
|
+
|
|
21
|
+
export const EMAIL_REGEX =
|
|
22
|
+
// eslint-disable-next-line
|
|
23
|
+
/^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
|
|
24
|
+
|
|
25
|
+
export const formatValue = (value: string | boolean): string => {
|
|
26
|
+
if (typeof value === 'boolean') {
|
|
27
|
+
return value.toString().toLowerCase();
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return typeof value === 'string' ? value?.trim()?.toLowerCase() : value;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const getDateFormat = (value: string | boolean): string => {
|
|
34
|
+
if (typeof value === 'boolean') {
|
|
35
|
+
return value.toString().toLowerCase();
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
const splittedValue = value.split('/');
|
|
39
|
+
const year = splittedValue.at(2);
|
|
40
|
+
|
|
41
|
+
if (!year) {
|
|
42
|
+
return 'DD/MM/YY';
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
if (year.length === 4) {
|
|
46
|
+
return 'DD/MM/YYYY';
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
return 'DD/MM/YY';
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
export const formatDate = (value: string | boolean | Date): string => {
|
|
53
|
+
if (moment.isDate(value)) {
|
|
54
|
+
return moment(value).format('DD/MM/YYYY');
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
if (typeof value === 'boolean') {
|
|
58
|
+
return value.toString().toLowerCase();
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const dateFormat = getDateFormat(value);
|
|
62
|
+
|
|
63
|
+
return moment(value, dateFormat).format('DD/MM/YYYY');
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
export const formatTaxID = (value: string | number | null): string | null => {
|
|
67
|
+
if (typeof value === 'number') {
|
|
68
|
+
return value.toString();
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if (!value) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
return value?.trim()?.replace(/\D+/g, '');
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export const formatCurrency = (value: string | number): string | null => {
|
|
79
|
+
if (typeof value === 'number') {
|
|
80
|
+
const valueString = value.toString();
|
|
81
|
+
|
|
82
|
+
return convertToMoney(
|
|
83
|
+
convertToCents(valueString, {
|
|
84
|
+
decimalSeparator: '.',
|
|
85
|
+
thousandSeparator: ',',
|
|
86
|
+
}),
|
|
87
|
+
);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
if (!value) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
return convertToMoney(
|
|
95
|
+
convertToCents(value, {
|
|
96
|
+
decimalSeparator: '.',
|
|
97
|
+
thousandSeparator: ',',
|
|
98
|
+
}),
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
export const COLUMN_TYPE = {
|
|
103
|
+
TAX_ID: 'taxID',
|
|
104
|
+
ACTIVE: 'active',
|
|
105
|
+
EMAIL: 'email',
|
|
106
|
+
GENDER: 'gender',
|
|
107
|
+
DATE: 'date',
|
|
108
|
+
TEXT: 'text',
|
|
109
|
+
PHONE: 'phone',
|
|
110
|
+
SING_PHONE: 'phone',
|
|
111
|
+
TAG: 'tag',
|
|
112
|
+
VALUE: 'currency',
|
|
113
|
+
};
|
|
114
|
+
|
|
115
|
+
const ACTIVE_VALUES = {
|
|
116
|
+
YES: ['sim', 'true', 'ativo', 'átivo', 'si'],
|
|
117
|
+
NO: ['não', 'false', 'inativo', 'nao', 'no'],
|
|
118
|
+
};
|
|
119
|
+
|
|
120
|
+
export const TRUTH_VALUES = ['sim', 'true', 'ativo', 'átivo', 'si'];
|
|
121
|
+
|
|
122
|
+
export const getActiveValue = (value: string): boolean =>
|
|
123
|
+
TRUTH_VALUES.includes(formatValue(value));
|
|
124
|
+
|
|
125
|
+
export const isActiveValid = (value: string): boolean => {
|
|
126
|
+
const formattedValue = formatValue(value);
|
|
127
|
+
|
|
128
|
+
if (
|
|
129
|
+
ACTIVE_VALUES.YES.includes(formattedValue) ||
|
|
130
|
+
ACTIVE_VALUES.NO.includes(formattedValue)
|
|
131
|
+
) {
|
|
132
|
+
return true;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
return false;
|
|
136
|
+
};
|
|
137
|
+
|
|
138
|
+
export const getDateValue = (value: string): string | null => {
|
|
139
|
+
const formattedDate = formatAnyDateToMongoDate(value);
|
|
140
|
+
|
|
141
|
+
if (formattedDate) {
|
|
142
|
+
return formattedDate;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return null;
|
|
146
|
+
};
|
|
147
|
+
|
|
148
|
+
export const getPhoneNumbersValue = (value: string): string[] | null => {
|
|
149
|
+
if (!value) {
|
|
150
|
+
return null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
const phones = value.toString().split(';');
|
|
154
|
+
|
|
155
|
+
const phonesFormatted = phones.map((phone) => {
|
|
156
|
+
if (phone.substring(0, 3) === '+55') {
|
|
157
|
+
return phone.slice(1);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (phone.substring(0, 2) === '55') {
|
|
161
|
+
return phone;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
return `55${phone}`;
|
|
165
|
+
});
|
|
166
|
+
|
|
167
|
+
return phonesFormatted;
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
export const getSingPhoneNumberValue = (value: string): string | null => {
|
|
171
|
+
if (!value) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
const phone = value.toString();
|
|
176
|
+
|
|
177
|
+
if (phone.substring(0, 3) === '+55') {
|
|
178
|
+
return phone.slice(1);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
if (phone.substring(0, 2) === '55') {
|
|
182
|
+
return phone;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return `55${phone}`;
|
|
186
|
+
};
|
|
187
|
+
|
|
188
|
+
export const getTagsValue = (value: string): string[] | null => {
|
|
189
|
+
if (!value) {
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
const tags = value.toString().split(';');
|
|
194
|
+
|
|
195
|
+
const tagsFormatted = tags.map((tag) => {
|
|
196
|
+
return tag.trim().toLowerCase();
|
|
197
|
+
});
|
|
198
|
+
|
|
199
|
+
return tagsFormatted;
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
/* const optionsActive = [
|
|
203
|
+
{
|
|
204
|
+
value: 'true',
|
|
205
|
+
label: 'Yes',
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
value: 'false',
|
|
209
|
+
label: 'No',
|
|
210
|
+
},
|
|
211
|
+
];
|
|
212
|
+
|
|
213
|
+
const optionsGender = [
|
|
214
|
+
{
|
|
215
|
+
value: 'female',
|
|
216
|
+
label: 'Feminino',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
value: 'male',
|
|
220
|
+
label: 'Masculino',
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
value: 'other',
|
|
224
|
+
label: 'Outro',
|
|
225
|
+
},
|
|
226
|
+
]; */
|
|
227
|
+
|
|
228
|
+
export const getCellProps = (
|
|
229
|
+
type,
|
|
230
|
+
value,
|
|
231
|
+
onChange,
|
|
232
|
+
onBlur,
|
|
233
|
+
onChangeRadioGroup,
|
|
234
|
+
isValid,
|
|
235
|
+
isProcessing,
|
|
236
|
+
) => {
|
|
237
|
+
/* const CELL_COMPONENT_PROPS = {
|
|
238
|
+
[COLUMN_TYPE.ACTIVE]: {
|
|
239
|
+
options: optionsActive,
|
|
240
|
+
value,
|
|
241
|
+
onChangeRadioGroup,
|
|
242
|
+
isValid,
|
|
243
|
+
},
|
|
244
|
+
[COLUMN_TYPE.GENDER]: {
|
|
245
|
+
options: optionsGender,
|
|
246
|
+
value,
|
|
247
|
+
onChangeRadioGroup,
|
|
248
|
+
isValid,
|
|
249
|
+
},
|
|
250
|
+
[COLUMN_TYPE.DATE]: {
|
|
251
|
+
value,
|
|
252
|
+
onChange,
|
|
253
|
+
isValid,
|
|
254
|
+
},
|
|
255
|
+
}; */
|
|
256
|
+
|
|
257
|
+
return {
|
|
258
|
+
value,
|
|
259
|
+
onChange,
|
|
260
|
+
onBlur,
|
|
261
|
+
isValid,
|
|
262
|
+
isProcessing,
|
|
263
|
+
};
|
|
264
|
+
};
|
|
265
|
+
|
|
266
|
+
const COLUMN_TYPE_MAP = {
|
|
267
|
+
TAX_ID: ['CPF Colaborador', 'CPF Gestor', 'CPF/CNPJ do Cliente'],
|
|
268
|
+
ACTIVE: ['Ativo'],
|
|
269
|
+
EMAIL: ['E-mail Colaborador', 'E-mail Gestor'],
|
|
270
|
+
GENDER: ['Gênero Colaborador'],
|
|
271
|
+
DATE: [
|
|
272
|
+
'Nascimento Colaborador',
|
|
273
|
+
'Admissão Colaborador',
|
|
274
|
+
'Demissão Colaborador',
|
|
275
|
+
'Data de Vencimento',
|
|
276
|
+
],
|
|
277
|
+
PHONE: ['Celulares'],
|
|
278
|
+
SING_PHONE: ['Celular do Cliente'],
|
|
279
|
+
TAG: ['Tags'],
|
|
280
|
+
VALUE: ['Valor', 'Valor em Reais'],
|
|
281
|
+
};
|
|
282
|
+
|
|
283
|
+
export const getColumnType = (name: string): string => {
|
|
284
|
+
if (COLUMN_TYPE_MAP.TAX_ID.includes(name)) {
|
|
285
|
+
return COLUMN_TYPE.TAX_ID;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
if (COLUMN_TYPE_MAP.ACTIVE.includes(name)) {
|
|
289
|
+
return COLUMN_TYPE.ACTIVE;
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
if (COLUMN_TYPE_MAP.EMAIL.includes(name)) {
|
|
293
|
+
return COLUMN_TYPE.EMAIL;
|
|
294
|
+
}
|
|
295
|
+
|
|
296
|
+
if (COLUMN_TYPE_MAP.GENDER.includes(name)) {
|
|
297
|
+
return COLUMN_TYPE.GENDER;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
if (COLUMN_TYPE_MAP.DATE.includes(name)) {
|
|
301
|
+
return COLUMN_TYPE.DATE;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
if (COLUMN_TYPE_MAP.PHONE.includes(name)) {
|
|
305
|
+
return COLUMN_TYPE.PHONE;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
if (COLUMN_TYPE_MAP.SING_PHONE.includes(name)) {
|
|
309
|
+
return COLUMN_TYPE.SING_PHONE;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
if (COLUMN_TYPE_MAP.TAG.includes(name)) {
|
|
313
|
+
return COLUMN_TYPE.TAG;
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
if (COLUMN_TYPE_MAP.VALUE.includes(name)) {
|
|
317
|
+
return COLUMN_TYPE.VALUE;
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
return COLUMN_TYPE.TEXT;
|
|
321
|
+
};
|
|
322
|
+
|
|
323
|
+
const getFormattedValue = (value: string, type: string) => {
|
|
324
|
+
const FORMATTED_VALUE = {
|
|
325
|
+
[COLUMN_TYPE.TAX_ID]: () => formatTaxID(value),
|
|
326
|
+
[COLUMN_TYPE.EMAIL]: () => formatValue(value),
|
|
327
|
+
[COLUMN_TYPE.DATE]: () => formatDate(value),
|
|
328
|
+
[COLUMN_TYPE.VALUE]: () => formatCurrency(value),
|
|
329
|
+
};
|
|
330
|
+
|
|
331
|
+
return type && FORMATTED_VALUE[type]
|
|
332
|
+
? FORMATTED_VALUE[type]() ?? value
|
|
333
|
+
: value;
|
|
334
|
+
};
|
|
335
|
+
|
|
336
|
+
const fieldsToFormat = [
|
|
337
|
+
COLUMN_TYPE.TAX_ID,
|
|
338
|
+
COLUMN_TYPE.EMAIL,
|
|
339
|
+
COLUMN_TYPE.VALUE,
|
|
340
|
+
COLUMN_TYPE.DATE,
|
|
341
|
+
];
|
|
342
|
+
|
|
343
|
+
const getItemsRow = (row, dataImportTable, header) =>
|
|
344
|
+
dataImportTable.reduce((acc, { name }) => {
|
|
345
|
+
const correctIndex = header
|
|
346
|
+
?.map((item) => item?.trim().replace(/\.+$/, ''))
|
|
347
|
+
.indexOf(name?.trim());
|
|
348
|
+
|
|
349
|
+
const columnType = getColumnType(name);
|
|
350
|
+
const value = row[correctIndex];
|
|
351
|
+
|
|
352
|
+
const formattedValue =
|
|
353
|
+
value && fieldsToFormat.includes(columnType)
|
|
354
|
+
? getFormattedValue(value, columnType)
|
|
355
|
+
: value;
|
|
356
|
+
|
|
357
|
+
return {
|
|
358
|
+
...acc,
|
|
359
|
+
[name]: {
|
|
360
|
+
value: formattedValue,
|
|
361
|
+
isValid: true,
|
|
362
|
+
columnType,
|
|
363
|
+
},
|
|
364
|
+
};
|
|
365
|
+
}, {});
|
|
366
|
+
|
|
367
|
+
export const getData = ({ excelData, dataImportTable, header, t }) => {
|
|
368
|
+
let newData = [];
|
|
369
|
+
|
|
370
|
+
for (const [i, row] of excelData.entries()) {
|
|
371
|
+
if (row.length === 0) {
|
|
372
|
+
continue;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const itemsRow = getItemsRow(row, dataImportTable, header);
|
|
376
|
+
|
|
377
|
+
const rowId = {
|
|
378
|
+
field: 'rowId',
|
|
379
|
+
value: uuidv4(),
|
|
380
|
+
};
|
|
381
|
+
|
|
382
|
+
const index = {
|
|
383
|
+
field: 'index',
|
|
384
|
+
value: i,
|
|
385
|
+
};
|
|
386
|
+
|
|
387
|
+
const importStatus = {
|
|
388
|
+
field: 'importStatus',
|
|
389
|
+
value: {
|
|
390
|
+
status: IMPORT_STATUS.PROCESSING,
|
|
391
|
+
message: [
|
|
392
|
+
t(
|
|
393
|
+
'We are processing your data, after that you will be able to edit and import',
|
|
394
|
+
),
|
|
395
|
+
],
|
|
396
|
+
},
|
|
397
|
+
};
|
|
398
|
+
|
|
399
|
+
const processed = {
|
|
400
|
+
...itemsRow,
|
|
401
|
+
rowId,
|
|
402
|
+
importStatus,
|
|
403
|
+
index,
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
newData = [...newData, processed];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
return newData;
|
|
410
|
+
};
|
|
411
|
+
|
|
412
|
+
export const isGenderValid = (value: string): boolean => {
|
|
413
|
+
const formattedValue = formatValue(value);
|
|
414
|
+
|
|
415
|
+
const isValid =
|
|
416
|
+
GENDER_VALUES.MALE.includes(formattedValue) ||
|
|
417
|
+
GENDER_VALUES.FEMALE.includes(formattedValue) ||
|
|
418
|
+
GENDER_VALUES.OTHER.includes(formattedValue);
|
|
419
|
+
|
|
420
|
+
return isValid;
|
|
421
|
+
};
|
|
422
|
+
|
|
423
|
+
type customColumnValidation = {
|
|
424
|
+
[key: string]: (value: string) => boolean;
|
|
425
|
+
};
|
|
426
|
+
type validateCellInput = {
|
|
427
|
+
type: string;
|
|
428
|
+
value: string;
|
|
429
|
+
requiredMessage: 'Não obrigatório' | 'Obrigatório';
|
|
430
|
+
customColumnValidation?: customColumnValidation;
|
|
431
|
+
columnName?: string;
|
|
432
|
+
};
|
|
433
|
+
export const validateCell = ({
|
|
434
|
+
type,
|
|
435
|
+
value,
|
|
436
|
+
requiredMessage,
|
|
437
|
+
customColumnValidation,
|
|
438
|
+
columnName = '',
|
|
439
|
+
}: validateCellInput): boolean => {
|
|
440
|
+
const requiredValidateMapper = {
|
|
441
|
+
'Não obrigatório': true,
|
|
442
|
+
Obrigatório: false,
|
|
443
|
+
};
|
|
444
|
+
|
|
445
|
+
if (!value) {
|
|
446
|
+
return requiredValidateMapper[requiredMessage];
|
|
447
|
+
}
|
|
448
|
+
|
|
449
|
+
const COLUMN_VALIDATION_TYPE = {
|
|
450
|
+
[COLUMN_TYPE.TAX_ID]: () => isSafeCPF(value) || isSafeCNPJ(value),
|
|
451
|
+
[COLUMN_TYPE.ACTIVE]: () => isActiveValid(value),
|
|
452
|
+
[COLUMN_TYPE.GENDER]: () => isGenderValid(value),
|
|
453
|
+
[COLUMN_TYPE.EMAIL]: () => EMAIL_REGEX.test(value),
|
|
454
|
+
[COLUMN_TYPE.DATE]: () => isValidAnyDate(value),
|
|
455
|
+
};
|
|
456
|
+
|
|
457
|
+
const customValidationFn = customColumnValidation?.[columnName];
|
|
458
|
+
const isCustomValid = customValidationFn ? customValidationFn(value) : true;
|
|
459
|
+
|
|
460
|
+
if (!isCustomValid) {
|
|
461
|
+
return false;
|
|
462
|
+
}
|
|
463
|
+
|
|
464
|
+
return value && COLUMN_VALIDATION_TYPE[type]
|
|
465
|
+
? COLUMN_VALIDATION_TYPE[type]() ?? true
|
|
466
|
+
: true;
|
|
467
|
+
};
|
|
468
|
+
|
|
469
|
+
export const getCellComponent = (field: string): React.ReactNode => {
|
|
470
|
+
const CELL_COMPONENTS = {
|
|
471
|
+
[COLUMN_TYPE.ACTIVE]: InputCell,
|
|
472
|
+
[COLUMN_TYPE.GENDER]: InputCell,
|
|
473
|
+
[COLUMN_TYPE.DATE]: InputDateCell,
|
|
474
|
+
[COLUMN_TYPE.VALUE]: InputMoneyCell,
|
|
475
|
+
[COLUMN_TYPE.TAX_ID]: InputTaxIDCell,
|
|
476
|
+
[COLUMN_TYPE.SING_PHONE]: InputPhoneCell,
|
|
477
|
+
};
|
|
478
|
+
|
|
479
|
+
return CELL_COMPONENTS[field] || InputCell;
|
|
480
|
+
};
|
|
481
|
+
|
|
482
|
+
export const EditableCell = ({
|
|
483
|
+
value: initialState,
|
|
484
|
+
row: { index },
|
|
485
|
+
column: { id, columnType, customColumnValidation, requiredMessage },
|
|
486
|
+
updateMyData, // This is a custom function that we supplied to our table instance
|
|
487
|
+
isProcessing,
|
|
488
|
+
}): React.ReactNode => {
|
|
489
|
+
// We need to keep and update the state of the cell normally
|
|
490
|
+
const [cell, setCell] = useState({
|
|
491
|
+
value: initialState?.value,
|
|
492
|
+
isValid: initialState?.isValid,
|
|
493
|
+
});
|
|
494
|
+
|
|
495
|
+
const onChange = (e) => {
|
|
496
|
+
setCell({ ...cell, value: e?.target?.value });
|
|
497
|
+
|
|
498
|
+
if (columnType === COLUMN_TYPE.DATE) {
|
|
499
|
+
const newCell = {
|
|
500
|
+
...initialState,
|
|
501
|
+
...cell,
|
|
502
|
+
value: e?.target?.value,
|
|
503
|
+
isValid: validateCell({
|
|
504
|
+
type: columnType,
|
|
505
|
+
value: e?.target?.value,
|
|
506
|
+
columnName: id,
|
|
507
|
+
customColumnValidation,
|
|
508
|
+
requiredMessage,
|
|
509
|
+
}),
|
|
510
|
+
};
|
|
511
|
+
|
|
512
|
+
updateMyData(index, id, newCell);
|
|
513
|
+
}
|
|
514
|
+
};
|
|
515
|
+
|
|
516
|
+
// We'll only update and validate the external data when the input is blurred
|
|
517
|
+
const onBlur = () => {
|
|
518
|
+
const newCell = {
|
|
519
|
+
...initialState,
|
|
520
|
+
...cell,
|
|
521
|
+
isValid: validateCell({
|
|
522
|
+
type: columnType,
|
|
523
|
+
value: cell.value,
|
|
524
|
+
columnName: id,
|
|
525
|
+
customColumnValidation,
|
|
526
|
+
requiredMessage,
|
|
527
|
+
}),
|
|
528
|
+
};
|
|
529
|
+
|
|
530
|
+
updateMyData(index, id, newCell);
|
|
531
|
+
};
|
|
532
|
+
|
|
533
|
+
const onChangeRadioGroup = (value) => {
|
|
534
|
+
setCell({ ...cell, value });
|
|
535
|
+
const newCell = {
|
|
536
|
+
value,
|
|
537
|
+
isValid: validateCell({
|
|
538
|
+
type: columnType,
|
|
539
|
+
value,
|
|
540
|
+
columnName: id,
|
|
541
|
+
customColumnValidation,
|
|
542
|
+
requiredMessage,
|
|
543
|
+
}),
|
|
544
|
+
};
|
|
545
|
+
|
|
546
|
+
updateMyData(index, id, newCell);
|
|
547
|
+
};
|
|
548
|
+
|
|
549
|
+
// If the initialState.value is changed external, sync it up with our state
|
|
550
|
+
useEffect(() => {
|
|
551
|
+
setCell({
|
|
552
|
+
value: initialState?.value,
|
|
553
|
+
isValid: initialState?.isValid,
|
|
554
|
+
});
|
|
555
|
+
}, [initialState]);
|
|
556
|
+
|
|
557
|
+
const renderField = () => {
|
|
558
|
+
const Comp = getCellComponent(columnType);
|
|
559
|
+
|
|
560
|
+
if (!Comp) {
|
|
561
|
+
return null;
|
|
562
|
+
}
|
|
563
|
+
|
|
564
|
+
const itemProps = getCellProps(
|
|
565
|
+
columnType,
|
|
566
|
+
cell.value,
|
|
567
|
+
onChange,
|
|
568
|
+
onBlur,
|
|
569
|
+
onChangeRadioGroup,
|
|
570
|
+
cell.isValid,
|
|
571
|
+
isProcessing,
|
|
572
|
+
);
|
|
573
|
+
|
|
574
|
+
return (
|
|
575
|
+
<Comp
|
|
576
|
+
{...itemProps}
|
|
577
|
+
inputProps={{
|
|
578
|
+
'data-testid': `${columnType}-${index}-${id}`
|
|
579
|
+
.replaceAll(' ', '')
|
|
580
|
+
.toLocaleLowerCase(),
|
|
581
|
+
}}
|
|
582
|
+
/>
|
|
583
|
+
);
|
|
584
|
+
};
|
|
585
|
+
|
|
586
|
+
return <>{renderField()}</>;
|
|
587
|
+
};
|
|
588
|
+
|
|
589
|
+
export const DEFAULT_QUEUE_ACTIONS = {
|
|
590
|
+
ADD: 'add',
|
|
591
|
+
REMOVE: 'remove',
|
|
592
|
+
UPDATE: 'update',
|
|
593
|
+
};
|
|
594
|
+
export const TAXID_TYPE = {
|
|
595
|
+
BR_CPF: 'BR:CPF',
|
|
596
|
+
BR_CNPJ: 'BR:CNPJ',
|
|
597
|
+
US_SOCIALSECURITY: 'US:SOCIALSECURITY',
|
|
598
|
+
};
|
|
599
|
+
|
|
600
|
+
const GENDER_VALUES = {
|
|
601
|
+
MALE: ['masculino', 'male'],
|
|
602
|
+
FEMALE: ['feminino', 'female', 'femenino'],
|
|
603
|
+
OTHER: ['outro', 'other', 'otro'],
|
|
604
|
+
};
|
|
605
|
+
|
|
606
|
+
export const getGenderValue = (value: string): string => {
|
|
607
|
+
const formattedValue = formatValue(value);
|
|
608
|
+
|
|
609
|
+
if (GENDER_VALUES.MALE.includes(formattedValue)) {
|
|
610
|
+
return 'male';
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
if (GENDER_VALUES.FEMALE.includes(formattedValue)) {
|
|
614
|
+
return 'female';
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
if (GENDER_VALUES.OTHER.includes(formattedValue)) {
|
|
618
|
+
return 'other';
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
return value;
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
const getFieldValue = (value: string, type: string) => {
|
|
625
|
+
const FORMATTED_VALUE = {
|
|
626
|
+
[COLUMN_TYPE.ACTIVE]: () => getActiveValue(value),
|
|
627
|
+
[COLUMN_TYPE.GENDER]: () => getGenderValue(value),
|
|
628
|
+
[COLUMN_TYPE.TAX_ID]: () => ({
|
|
629
|
+
type: TAXID_TYPE.BR_CPF,
|
|
630
|
+
taxID: value,
|
|
631
|
+
}),
|
|
632
|
+
[COLUMN_TYPE.DATE]: () => getDateValue(value),
|
|
633
|
+
[COLUMN_TYPE.PHONE]: () => getPhoneNumbersValue(value),
|
|
634
|
+
[COLUMN_TYPE.SING_PHONE]: () => getSingPhoneNumberValue(value),
|
|
635
|
+
[COLUMN_TYPE.EMAIL]: () => formatValue(value),
|
|
636
|
+
[COLUMN_TYPE.TAG]: () => getTagsValue(value),
|
|
637
|
+
};
|
|
638
|
+
|
|
639
|
+
return type && FORMATTED_VALUE[type]
|
|
640
|
+
? FORMATTED_VALUE[type]() ?? value
|
|
641
|
+
: value;
|
|
642
|
+
};
|
|
643
|
+
|
|
644
|
+
export const getFields = (item) => {
|
|
645
|
+
const fields = Object.entries(item).reduce((acc, [, obj]) => {
|
|
646
|
+
if (obj.field && obj.value) {
|
|
647
|
+
const value = getFieldValue(obj.value, obj.columnType);
|
|
648
|
+
|
|
649
|
+
return { ...acc, [obj.field]: value };
|
|
650
|
+
}
|
|
651
|
+
|
|
652
|
+
return acc;
|
|
653
|
+
}, {});
|
|
654
|
+
|
|
655
|
+
return fields;
|
|
656
|
+
};
|
|
657
|
+
|
|
658
|
+
export const importFn = (selected, dispatch) => {
|
|
659
|
+
const items = selected.map((d) => {
|
|
660
|
+
return {
|
|
661
|
+
...d?.original,
|
|
662
|
+
rowIndex: {
|
|
663
|
+
field: 'rowIndex',
|
|
664
|
+
value: d?.id,
|
|
665
|
+
},
|
|
666
|
+
};
|
|
667
|
+
});
|
|
668
|
+
|
|
669
|
+
for (const item of items) {
|
|
670
|
+
const fields = getFields(item);
|
|
671
|
+
|
|
672
|
+
if (Object.keys(fields).length <= 1) {
|
|
673
|
+
continue;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
dispatch({ type: DEFAULT_QUEUE_ACTIONS.ADD, fields });
|
|
677
|
+
}
|
|
678
|
+
};
|
|
679
|
+
|
|
680
|
+
const isRequiredMapper = {
|
|
681
|
+
Obrigatório: true,
|
|
682
|
+
'Não obrigatório': false,
|
|
683
|
+
};
|
|
684
|
+
|
|
685
|
+
type DefaultHeader = {
|
|
686
|
+
name: string;
|
|
687
|
+
requiredMessage: string;
|
|
688
|
+
description: string;
|
|
689
|
+
};
|
|
690
|
+
|
|
691
|
+
type ValidateHeaderProps = {
|
|
692
|
+
header: string[];
|
|
693
|
+
defaultHeader: DefaultHeader[];
|
|
694
|
+
};
|
|
695
|
+
|
|
696
|
+
export const validateHeader = ({
|
|
697
|
+
header,
|
|
698
|
+
defaultHeader,
|
|
699
|
+
}: ValidateHeaderProps): boolean => {
|
|
700
|
+
const hasSameLength = header.length === defaultHeader.length;
|
|
701
|
+
|
|
702
|
+
if (!hasSameLength) {
|
|
703
|
+
const missingColumns = defaultHeader.filter(
|
|
704
|
+
(column) => !header.includes(column.name),
|
|
705
|
+
);
|
|
706
|
+
|
|
707
|
+
const missingRequiredColumns = missingColumns.filter(
|
|
708
|
+
(column) => isRequiredMapper[column?.requiredMessage] ?? false,
|
|
709
|
+
);
|
|
710
|
+
|
|
711
|
+
return missingRequiredColumns.length > 0 ? false : true;
|
|
712
|
+
}
|
|
713
|
+
|
|
714
|
+
const isSame = defaultHeader.every((column) => {
|
|
715
|
+
const isRequired = isRequiredMapper[column?.requiredMessage] ?? false;
|
|
716
|
+
const headerHasName = header.includes(column?.name);
|
|
717
|
+
|
|
718
|
+
if (!headerHasName && !isRequired) {
|
|
719
|
+
return true;
|
|
720
|
+
}
|
|
721
|
+
|
|
722
|
+
return headerHasName;
|
|
723
|
+
});
|
|
724
|
+
|
|
725
|
+
return isSame;
|
|
726
|
+
};
|