@juspay/blend-design-system 0.0.37-beta.2 → 0.0.37-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Badge/Badge.d.ts +3 -0
- package/dist/components/Badge/Badge.types.d.ts +34 -0
- package/dist/components/Badge/badge.dark.tokens.d.ts +3 -0
- package/dist/components/Badge/badge.light.tokens.d.ts +3 -0
- package/dist/components/Badge/badge.tokens.d.ts +55 -0
- package/dist/components/Badge/badge.utils.d.ts +11 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/ChartsV2/chartV2Options.d.ts +3 -0
- package/dist/components/ChatInput/ChatInput.d.ts +1 -1
- package/dist/components/CodeEditorV2/codeEditorV2.tokens.d.ts +2 -2
- package/dist/components/CodeEditorV2/utils.d.ts +9 -0
- package/dist/components/DataTable/DataTablePagination.d.ts +2 -1
- package/dist/components/DataTable/TableBody/types.d.ts +5 -1
- package/dist/components/DataTable/TableFooter/types.d.ts +1 -0
- package/dist/components/DataTable/TableHeader/FilterComponents.d.ts +7 -2
- package/dist/components/DataTable/TableHeader/handlers.d.ts +1 -1
- package/dist/components/DataTable/types.d.ts +5 -0
- package/dist/components/DataTable/utils.d.ts +8 -0
- package/dist/components/DateRangePicker/types.d.ts +6 -0
- package/dist/components/Directory/directory.tokens.d.ts +6 -0
- package/dist/components/DrawerV2/DrawerV2.d.ts +15 -0
- package/dist/components/InputsV2/ChatInputV2/AttachmentDropdown.d.ts +11 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputTagV2.d.ts +13 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2.d.ts +19 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2.dark.tokens.d.ts +4 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2.tokens.d.ts +125 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2.types.d.ts +54 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2AttachmentRow.d.ts +13 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2Mobile.dark.tokens.d.ts +4 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2Mobile.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/ChatInputV2/ChatInputV2Mobile.tokens.d.ts +60 -0
- package/dist/components/InputsV2/ChatInputV2/MobileChatInputV2.d.ts +17 -0
- package/dist/components/InputsV2/ChatInputV2/index.d.ts +4 -0
- package/dist/components/InputsV2/ChatInputV2/utils.d.ts +43 -0
- package/dist/components/InputsV2/MultiValueInputV2/MultiValueInputV2.d.ts +1 -1
- package/dist/components/InputsV2/NumberInputV2/NumberInputV2.d.ts +32 -0
- package/dist/components/InputsV2/NumberInputV2/NumberInputV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/NumberInputV2/NumberInputV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/NumberInputV2/NumberInputV2Stepper.d.ts +14 -0
- package/dist/components/InputsV2/NumberInputV2/NumberInputV2Unit.d.ts +12 -0
- package/dist/components/InputsV2/NumberInputV2/StepperArrow.d.ts +2 -0
- package/dist/components/InputsV2/NumberInputV2/index.d.ts +3 -0
- package/dist/components/InputsV2/NumberInputV2/numberInputV2.tokens.d.ts +135 -0
- package/dist/components/InputsV2/NumberInputV2/numberInputV2.types.d.ts +41 -0
- package/dist/components/InputsV2/NumberInputV2/utils.d.ts +52 -0
- package/dist/components/InputsV2/OTPInputV2/OTPInputV2.d.ts +14 -0
- package/dist/components/InputsV2/OTPInputV2/OTPInputV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/OTPInputV2/OTPInputV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/OTPInputV2/OTPInputV2.tokens.d.ts +34 -0
- package/dist/components/InputsV2/OTPInputV2/OTPInputV2.types.d.ts +13 -0
- package/dist/components/InputsV2/OTPInputV2/index.d.ts +3 -0
- package/dist/components/InputsV2/OTPInputV2/otpInputV2Utils.d.ts +47 -0
- package/dist/components/InputsV2/SearchInputV2/SearchInputV2.d.ts +14 -0
- package/dist/components/InputsV2/SearchInputV2/SearchInputV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/SearchInputV2/SearchInputV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/SearchInputV2/SearchInputV2.tokens.d.ts +92 -0
- package/dist/components/InputsV2/SearchInputV2/SearchInputV2.types.d.ts +13 -0
- package/dist/components/InputsV2/SearchInputV2/index.d.ts +3 -0
- package/dist/components/InputsV2/TextAreaV2/TextAreaV2.d.ts +23 -0
- package/dist/components/InputsV2/TextAreaV2/TextAreaV2.dark.tokens.d.ts +3 -0
- package/dist/components/InputsV2/TextAreaV2/TextAreaV2.light.tokens.d.ts +3 -0
- package/dist/components/InputsV2/TextAreaV2/TextAreaV2.tokens.d.ts +63 -0
- package/dist/components/InputsV2/TextAreaV2/TextAreaV2.types.d.ts +22 -0
- package/dist/components/InputsV2/TextAreaV2/index.d.ts +3 -0
- package/dist/components/InputsV2/TextAreaV2/utils.d.ts +47 -0
- package/dist/components/InputsV2/TextInputV2/TextInputV2.d.ts +3 -1
- package/dist/components/InputsV2/TextInputV2/TextInputV2.types.d.ts +24 -1
- package/dist/components/InputsV2/TextInputV2/utils.d.ts +5 -3
- package/dist/components/InputsV2/utils/FloatingLabelsV2/FloatingLabelsV2.d.ts +3 -1
- package/dist/components/InputsV2/utils/utils.d.ts +10 -0
- package/dist/components/Primitives/Block/Block.d.ts +1 -1
- package/dist/components/ProgressBarV2/utils.d.ts +40 -0
- package/dist/components/SidebarV2/SecondarySidebar.d.ts +9 -0
- package/dist/components/SidebarV2/SidebarV2.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2Footer.d.ts +10 -0
- package/dist/components/SidebarV2/SidebarV2Header.d.ts +24 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/MobileNavigationItem.d.ts +4 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/MoreButton.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/PrimaryActionButton.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/hooks.d.ts +6 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/index.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/mobile.dark.tokens.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/mobile.light.tokens.d.ts +3 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/mobile.tokens.d.ts +87 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/types.d.ts +28 -0
- package/dist/components/SidebarV2/SidebarV2MobileNavigation/utils.d.ts +25 -0
- package/dist/components/SidebarV2/SidebarV2Panel.d.ts +34 -0
- package/dist/components/SidebarV2/index.d.ts +5 -0
- package/dist/components/SidebarV2/sidebarV2.dark.tokens.d.ts +3 -0
- package/dist/components/SidebarV2/sidebarV2.light.tokens.d.ts +3 -0
- package/dist/components/SidebarV2/sidebarV2.tokens.d.ts +106 -0
- package/dist/components/SidebarV2/sidebarV2.types.d.ts +1 -0
- package/dist/components/SidebarV2/types.d.ts +51 -0
- package/dist/components/SidebarV2/utils.d.ts +8 -0
- package/dist/components/StepperV2/Stepper/StepStatusCircle.d.ts +11 -0
- package/dist/components/StepperV2/Stepper/StepperComponent.d.ts +9 -0
- package/dist/components/StepperV2/Stepper/Steps.d.ts +7 -0
- package/dist/components/StepperV2/Stepper/StepsHorizontalBody.d.ts +15 -0
- package/dist/components/StepperV2/Stepper/StepsSubstepList.d.ts +18 -0
- package/dist/components/StepperV2/Stepper/StepsVerticalSubstepRails.d.ts +12 -0
- package/dist/components/StepperV2/Stepper/VerticalLineV2.d.ts +5 -0
- package/dist/components/StepperV2/Stepper/stepsHelpers.d.ts +10 -0
- package/dist/components/StepperV2/StepperV2.d.ts +9 -0
- package/dist/components/StepperV2/index.d.ts +4 -0
- package/dist/components/StepperV2/stepperV2.dark.tokens.d.ts +3 -0
- package/dist/components/StepperV2/stepperV2.light.tokens.d.ts +3 -0
- package/dist/components/StepperV2/stepperV2.tokens.d.ts +99 -0
- package/dist/components/StepperV2/stepperV2.types.d.ts +61 -0
- package/dist/components/StepperV2/utils.d.ts +4 -0
- package/dist/components/Tabs/tabs.token.d.ts +1 -1
- package/dist/components/Tabs/types.d.ts +1 -0
- package/dist/components/TabsV2/tabsV2.types.d.ts +1 -0
- package/dist/components/TagV2/TagV2.d.ts +1 -1
- package/dist/components/TopbarV2/TopbarV2.d.ts +3 -0
- package/dist/components/TopbarV2/index.d.ts +3 -0
- package/dist/components/TopbarV2/topbarV2.dark.tokens.d.ts +3 -0
- package/dist/components/TopbarV2/topbarV2.light.tokens.d.ts +3 -0
- package/dist/components/TopbarV2/topbarV2.tokens.d.ts +83 -0
- package/dist/components/TopbarV2/types.d.ts +50 -0
- package/dist/components/common/TruncatedTextWithTooltipV2/TruncatedTextWithTooltipV2.d.ts +2 -0
- package/dist/components/common/TruncatedTextWithTooltipV2/index.d.ts +2 -0
- package/dist/components/common/TruncatedTextWithTooltipV2/types.d.ts +16 -0
- package/dist/components/common/TruncatedTextWithTooltipV2/utils.d.ts +1 -0
- package/dist/components/common/index.d.ts +1 -0
- package/dist/context/ThemeContext.d.ts +22 -0
- package/dist/context/useComponentToken.d.ts +12 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/useResizeObserver.d.ts +1 -1
- package/dist/hooks/useSectionScroll.d.ts +24 -0
- package/dist/hooks/useTruncationDetection.d.ts +1 -1
- package/dist/main.d.ts +107 -33
- package/dist/main.js +118076 -108882
- package/dist/node-CRWdZOVN.js +14736 -0
- package/dist/node.d.ts +35 -0
- package/dist/node.js +31 -0
- package/dist/style.css +1 -0
- package/dist/token-engine-server.d.ts +9 -0
- package/dist/token-engine.d.ts +10 -0
- package/dist/tokens/unit.tokens.d.ts +3 -0
- package/dist/tokens-server.d.ts +2 -0
- package/dist/tokens-server.js +779 -0
- package/dist/tokens.d.ts +2 -0
- package/dist/tokens.js +233 -0
- package/lib/breakpoints/breakPoints.ts +8 -0
- package/lib/components/Accordion/Accordion.tsx +109 -0
- package/lib/components/Accordion/AccordionItem.tsx +612 -0
- package/lib/components/Accordion/accessibility/AccordionAccessibility.tsx +547 -0
- package/lib/components/Accordion/accessibility/AccordionAccessibilityReport.ts +373 -0
- package/lib/components/Accordion/accessibility/index.ts +2 -0
- package/lib/components/Accordion/accordion.tokens.ts +299 -0
- package/lib/components/Accordion/index.ts +4 -0
- package/lib/components/Accordion/types.ts +43 -0
- package/lib/components/AccordionV2/AccordionV2.tsx +129 -0
- package/lib/components/AccordionV2/AccordionV2Chevron.tsx +67 -0
- package/lib/components/AccordionV2/AccordionV2Item.tsx +288 -0
- package/lib/components/AccordionV2/AccordionV2TriggerContent.tsx +227 -0
- package/lib/components/AccordionV2/accordionV2.animations.ts +26 -0
- package/lib/components/AccordionV2/accordionV2.dark.tokens.ts +208 -0
- package/lib/components/AccordionV2/accordionV2.light.tokens.ts +208 -0
- package/lib/components/AccordionV2/accordionV2.tokens.ts +89 -0
- package/lib/components/AccordionV2/accordionV2.types.ts +39 -0
- package/lib/components/AccordionV2/index.ts +4 -0
- package/lib/components/Alert/Alert.tsx +383 -0
- package/lib/components/Alert/accessibility/AlertAccessibility.tsx +425 -0
- package/lib/components/Alert/accessibility/AlertAccessibilityReport.ts +549 -0
- package/lib/components/Alert/accessibility/index.ts +2 -0
- package/lib/components/Alert/alert.tokens.ts +385 -0
- package/lib/components/Alert/index.ts +3 -0
- package/lib/components/Alert/types.ts +41 -0
- package/lib/components/AlertV2/AlertV2.tsx +366 -0
- package/lib/components/AlertV2/alertV2.dark.tokens.ts +335 -0
- package/lib/components/AlertV2/alertV2.light.tokens.ts +335 -0
- package/lib/components/AlertV2/alertV2.tokens.ts +94 -0
- package/lib/components/AlertV2/alertV2.types.ts +63 -0
- package/lib/components/AlertV2/index.ts +3 -0
- package/lib/components/Avatar/Avatar.tsx +385 -0
- package/lib/components/Avatar/StyledAvatar.tsx +8 -0
- package/lib/components/Avatar/accessibility/AvatarAccessibility.tsx +784 -0
- package/lib/components/Avatar/accessibility/AvatarAccessibilityReport.ts +512 -0
- package/lib/components/Avatar/accessibility/index.ts +2 -0
- package/lib/components/Avatar/avatar.tokens.ts +450 -0
- package/lib/components/Avatar/avatarUtils.ts +102 -0
- package/lib/components/Avatar/index.ts +3 -0
- package/lib/components/Avatar/types.ts +46 -0
- package/lib/components/AvatarGroup/AvatarGroup.tsx +178 -0
- package/lib/components/AvatarGroup/StyledAvatarGroup.tsx +122 -0
- package/lib/components/AvatarGroup/accessibility/AvatarGroupAccessibility.tsx +517 -0
- package/lib/components/AvatarGroup/accessibility/AvatarGroupAccessibilityReport.ts +416 -0
- package/lib/components/AvatarGroup/accessibility/index.ts +2 -0
- package/lib/components/AvatarGroup/avatarGroup.tokens.ts +233 -0
- package/lib/components/AvatarGroup/avatarGroupUtils.tsx +68 -0
- package/lib/components/AvatarGroup/index.ts +3 -0
- package/lib/components/AvatarGroup/types.ts +39 -0
- package/lib/components/AvatarV2/AvatarV2.tsx +361 -0
- package/lib/components/AvatarV2/avatarV2.dark.tokens.ts +333 -0
- package/lib/components/AvatarV2/avatarV2.light.tokens.ts +333 -0
- package/lib/components/AvatarV2/avatarV2.tokens.ts +93 -0
- package/lib/components/AvatarV2/avatarV2.types.ts +96 -0
- package/lib/components/AvatarV2/avatarV2.utils.ts +223 -0
- package/lib/components/AvatarV2/index.ts +15 -0
- package/lib/components/Badge/Badge.tsx +169 -0
- package/lib/components/Badge/Badge.types.ts +47 -0
- package/lib/components/Badge/badge.dark.tokens.ts +149 -0
- package/lib/components/Badge/badge.light.tokens.ts +149 -0
- package/lib/components/Badge/badge.tokens.ts +71 -0
- package/lib/components/Badge/badge.utils.ts +113 -0
- package/lib/components/Badge/index.ts +2 -0
- package/lib/components/Breadcrumb/Breadcrumb.tsx +229 -0
- package/lib/components/Breadcrumb/BreadcrumbSkeleton.tsx +37 -0
- package/lib/components/Breadcrumb/accessibility/BreadcrumbAccessibility.tsx +629 -0
- package/lib/components/Breadcrumb/accessibility/BreadcrumbAccessibilityReport.ts +552 -0
- package/lib/components/Breadcrumb/accessibility/index.ts +6 -0
- package/lib/components/Breadcrumb/breadcrumb.tokens.ts +104 -0
- package/lib/components/Breadcrumb/index.ts +3 -0
- package/lib/components/Breadcrumb/types.ts +20 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2.tsx +93 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2Icon.tsx +18 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2Item.tsx +67 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2List.tsx +102 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2OverflowMenu.tsx +106 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2Page.tsx +27 -0
- package/lib/components/BreadcrumbV2/BreadcrumbV2Separator.tsx +24 -0
- package/lib/components/BreadcrumbV2/breadcrumbV2.dark.tokens.ts +61 -0
- package/lib/components/BreadcrumbV2/breadcrumbV2.light.tokens.ts +61 -0
- package/lib/components/BreadcrumbV2/breadcrumbV2.tokens.ts +47 -0
- package/lib/components/BreadcrumbV2/breadcrumbV2.types.ts +53 -0
- package/lib/components/BreadcrumbV2/index.ts +3 -0
- package/lib/components/BreadcrumbV2/utils.ts +196 -0
- package/lib/components/Button/ACCESSIBILITY_REPORT.md +740 -0
- package/lib/components/Button/Button.tsx +109 -0
- package/lib/components/Button/ButtonBase.tsx +329 -0
- package/lib/components/Button/accessibility/ButtonAccessibility.tsx +1043 -0
- package/lib/components/Button/accessibility/ButtonAccessibilityReport.ts +578 -0
- package/lib/components/Button/accessibility/index.ts +7 -0
- package/lib/components/Button/button.tokens.ts +1846 -0
- package/lib/components/Button/index.ts +3 -0
- package/lib/components/Button/types.ts +48 -0
- package/lib/components/ButtonGroup/ButtonGroup.tsx +53 -0
- package/lib/components/ButtonGroup/accessibility/ButtonGroupAccessibility.tsx +483 -0
- package/lib/components/ButtonGroup/accessibility/ButtonGroupAccessibilityReport.ts +159 -0
- package/lib/components/ButtonGroup/accessibility/index.ts +7 -0
- package/lib/components/ButtonGroup/index.ts +2 -0
- package/lib/components/ButtonGroup/types.ts +7 -0
- package/lib/components/ButtonV2/ButtonGroupV2/ButtonGroupV2.tsx +32 -0
- package/lib/components/ButtonV2/ButtonGroupV2/buttonGroupV2.types.ts +15 -0
- package/lib/components/ButtonV2/ButtonGroupV2/index.ts +6 -0
- package/lib/components/ButtonV2/ButtonGroupV2/utils.ts +19 -0
- package/lib/components/ButtonV2/ButtonV2.tsx +335 -0
- package/lib/components/ButtonV2/IconButton.tsx +38 -0
- package/lib/components/ButtonV2/LinkButton.tsx +179 -0
- package/lib/components/ButtonV2/VisuallyHidden.tsx +13 -0
- package/lib/components/ButtonV2/buttonV2.dark.tokens.ts +1407 -0
- package/lib/components/ButtonV2/buttonV2.light.tokens.ts +1493 -0
- package/lib/components/ButtonV2/buttonV2.tokens.ts +87 -0
- package/lib/components/ButtonV2/buttonV2.types.ts +86 -0
- package/lib/components/ButtonV2/index.ts +8 -0
- package/lib/components/ButtonV2/utils.ts +348 -0
- package/lib/components/Card/Card.tsx +141 -0
- package/lib/components/Card/CardComponents.tsx +627 -0
- package/lib/components/Card/CardSkeleton.tsx +27 -0
- package/lib/components/Card/accessibility/CardAccessibility.tsx +912 -0
- package/lib/components/Card/accessibility/CardAccessibilityReport.ts +351 -0
- package/lib/components/Card/card.tokens.ts +360 -0
- package/lib/components/Card/index.ts +3 -0
- package/lib/components/Card/types.ts +74 -0
- package/lib/components/Card/utils.ts +217 -0
- package/lib/components/Charts/BlendChart.tsx +167 -0
- package/lib/components/Charts/BlendChart.types.ts +39 -0
- package/lib/components/Charts/BlendChartContainer.tsx +23 -0
- package/lib/components/Charts/BlendChartHeader.tsx +26 -0
- package/lib/components/Charts/ChartContainer.tsx +30 -0
- package/lib/components/Charts/ChartHeader.tsx +190 -0
- package/lib/components/Charts/ChartLegend.tsx +756 -0
- package/lib/components/Charts/ChartUtils.tsx +530 -0
- package/lib/components/Charts/Charts.tsx +1002 -0
- package/lib/components/Charts/ChartsSkeleton.tsx +31 -0
- package/lib/components/Charts/CoreChart.tsx +73 -0
- package/lib/components/Charts/CustomTooltip.tsx +876 -0
- package/lib/components/Charts/DateTimeFormatter.ts +769 -0
- package/lib/components/Charts/SankeyChartWrapper.tsx +345 -0
- package/lib/components/Charts/SankeyLink.tsx +95 -0
- package/lib/components/Charts/SankeyNode.tsx +113 -0
- package/lib/components/Charts/accessibility/ChartsAccessibility.tsx +827 -0
- package/lib/components/Charts/accessibility/ChartsAccessibilityReport.ts +370 -0
- package/lib/components/Charts/chart.tokens.ts +144 -0
- package/lib/components/Charts/index.ts +15 -0
- package/lib/components/Charts/renderChart.tsx +1385 -0
- package/lib/components/Charts/types.tsx +309 -0
- package/lib/components/Charts/utils.tsx +60 -0
- package/lib/components/ChartsV2/ChartContainerV2.tsx +30 -0
- package/lib/components/ChartsV2/ChartHeaderV2.tsx +27 -0
- package/lib/components/ChartsV2/ChartV2.tsx +94 -0
- package/lib/components/ChartsV2/ChartV2Fullscreen.tsx +157 -0
- package/lib/components/ChartsV2/ChartV2Legend.tsx +174 -0
- package/lib/components/ChartsV2/ChartV2NoData.tsx +48 -0
- package/lib/components/ChartsV2/ChartV2Skeleton.tsx +37 -0
- package/lib/components/ChartsV2/chartV2.dark.tokens.ts +200 -0
- package/lib/components/ChartsV2/chartV2.light.tokens.ts +197 -0
- package/lib/components/ChartsV2/chartV2.sankey.ts +13 -0
- package/lib/components/ChartsV2/chartV2.tokens.ts +117 -0
- package/lib/components/ChartsV2/chartV2.types.ts +84 -0
- package/lib/components/ChartsV2/chartV2Options.ts +119 -0
- package/lib/components/ChartsV2/index.ts +9 -0
- package/lib/components/ChartsV2/useChartLegend.ts +25 -0
- package/lib/components/ChartsV2/useChartLegendHover.ts +116 -0
- package/lib/components/ChartsV2/useChartRefs.ts +29 -0
- package/lib/components/ChartsV2/utils.ts +92 -0
- package/lib/components/ChatInput/AttachmentFile.tsx +266 -0
- package/lib/components/ChatInput/ChatInput.tsx +577 -0
- package/lib/components/ChatInput/MobileChatInput.tsx +240 -0
- package/lib/components/ChatInput/accessibility/ChatInputAccessibility.tsx +597 -0
- package/lib/components/ChatInput/accessibility/ChatInputAccessibilityReport.ts +314 -0
- package/lib/components/ChatInput/accessibility/index.ts +7 -0
- package/lib/components/ChatInput/chatInput.tokens.ts +575 -0
- package/lib/components/ChatInput/index.tsx +3 -0
- package/lib/components/ChatInput/types.ts +121 -0
- package/lib/components/ChatInput/utils.ts +151 -0
- package/lib/components/Checkbox/Checkbox.tsx +308 -0
- package/lib/components/Checkbox/StyledCheckbox.tsx +100 -0
- package/lib/components/Checkbox/accessibility/CheckboxAccessibility.tsx +1080 -0
- package/lib/components/Checkbox/accessibility/CheckboxAccessibilityReport.ts +580 -0
- package/lib/components/Checkbox/accessibility/index.ts +6 -0
- package/lib/components/Checkbox/checkbox.animations.ts +85 -0
- package/lib/components/Checkbox/checkbox.token.ts +366 -0
- package/lib/components/Checkbox/checkboxUtils.ts +144 -0
- package/lib/components/Checkbox/index.ts +2 -0
- package/lib/components/Checkbox/types.ts +39 -0
- package/lib/components/CodeBlock/CodeBlock.tsx +358 -0
- package/lib/components/CodeBlock/CodeBlockDiffView/CodeBlockDiffView.tsx +488 -0
- package/lib/components/CodeBlock/CodeBlockDiffView/types.ts +18 -0
- package/lib/components/CodeBlock/CodeBlockDiffView/utils.ts +26 -0
- package/lib/components/CodeBlock/CodeBlockLineParts.tsx +300 -0
- package/lib/components/CodeBlock/accessibility/CodeBlockAccessibility.tsx +697 -0
- package/lib/components/CodeBlock/accessibility/CodeBlockAccessibilityReport.ts +350 -0
- package/lib/components/CodeBlock/codeBlock.token.ts +322 -0
- package/lib/components/CodeBlock/index.ts +2 -0
- package/lib/components/CodeBlock/types.ts +72 -0
- package/lib/components/CodeBlock/utils.ts +712 -0
- package/lib/components/CodeEditor/CodeEditor.tsx +101 -0
- package/lib/components/CodeEditor/CodeEditorHeader.tsx +125 -0
- package/lib/components/CodeEditor/MonacoEditorWrapper.tsx +621 -0
- package/lib/components/CodeEditor/index.ts +2 -0
- package/lib/components/CodeEditor/monaco-editor.css +1 -0
- package/lib/components/CodeEditor/types.ts +49 -0
- package/lib/components/CodeEditor/utils.ts +27 -0
- package/lib/components/CodeEditorV2/CodeEditorV2.tsx +156 -0
- package/lib/components/CodeEditorV2/CodeEditorV2Header.tsx +123 -0
- package/lib/components/CodeEditorV2/MonacoEditor/MonacoEditorWrapper.tsx +395 -0
- package/lib/components/CodeEditorV2/MonacoEditor/monaco-editor.css +1 -0
- package/lib/components/CodeEditorV2/MonacoEditor/monacoTheme.ts +133 -0
- package/lib/components/CodeEditorV2/codeEditorV2.dark.tokens.ts +168 -0
- package/lib/components/CodeEditorV2/codeEditorV2.light.token.ts +170 -0
- package/lib/components/CodeEditorV2/codeEditorV2.tokens.ts +99 -0
- package/lib/components/CodeEditorV2/codeEditorV2.types.ts +132 -0
- package/lib/components/CodeEditorV2/index.ts +3 -0
- package/lib/components/CodeEditorV2/utils.ts +504 -0
- package/lib/components/DataTable/ColumnFilter/index.tsx +284 -0
- package/lib/components/DataTable/ColumnManager.tsx +322 -0
- package/lib/components/DataTable/DataTable.tsx +2052 -0
- package/lib/components/DataTable/DataTableHeader/index.tsx +775 -0
- package/lib/components/DataTable/DataTableHeader/types.ts +31 -0
- package/lib/components/DataTable/DataTablePagination.tsx +602 -0
- package/lib/components/DataTable/MobileColumnDrawer/index.tsx +407 -0
- package/lib/components/DataTable/MobileColumnManagerDrawer/index.tsx +164 -0
- package/lib/components/DataTable/TableBody/BulkActionBar.tsx +309 -0
- package/lib/components/DataTable/TableBody/index.tsx +1619 -0
- package/lib/components/DataTable/TableBody/types.ts +57 -0
- package/lib/components/DataTable/TableCell/index.tsx +590 -0
- package/lib/components/DataTable/TableCell/types.ts +24 -0
- package/lib/components/DataTable/TableFooter/index.tsx +63 -0
- package/lib/components/DataTable/TableFooter/types.ts +15 -0
- package/lib/components/DataTable/TableHeader/DraggableColumnHeader.tsx +71 -0
- package/lib/components/DataTable/TableHeader/FilterComponents.tsx +1549 -0
- package/lib/components/DataTable/TableHeader/MobileFilterDrawer.tsx +772 -0
- package/lib/components/DataTable/TableHeader/handlers.ts +232 -0
- package/lib/components/DataTable/TableHeader/index.tsx +2143 -0
- package/lib/components/DataTable/TableHeader/types.ts +84 -0
- package/lib/components/DataTable/TableHeader/utils.ts +302 -0
- package/lib/components/DataTable/accessibility/DataTableAccessibility.tsx +579 -0
- package/lib/components/DataTable/accessibility/DataTableAccessibilityReport.ts +250 -0
- package/lib/components/DataTable/accessibility/index.ts +7 -0
- package/lib/components/DataTable/columnTypes.ts +359 -0
- package/lib/components/DataTable/dataTable.tokens.ts +802 -0
- package/lib/components/DataTable/hooks/index.ts +2 -0
- package/lib/components/DataTable/hooks/useMobileDataTable.ts +35 -0
- package/lib/components/DataTable/index.ts +23 -0
- package/lib/components/DataTable/types.ts +447 -0
- package/lib/components/DataTable/utils.ts +1358 -0
- package/lib/components/DateRangePicker/CalendarGrid.tsx +1012 -0
- package/lib/components/DateRangePicker/DateRangePicker.tsx +1278 -0
- package/lib/components/DateRangePicker/MobileDrawerPresets.tsx +174 -0
- package/lib/components/DateRangePicker/QuickRangeSelector.tsx +241 -0
- package/lib/components/DateRangePicker/TimeSelector.tsx +446 -0
- package/lib/components/DateRangePicker/accessibility/DateRangePickerAccessibility.tsx +488 -0
- package/lib/components/DateRangePicker/accessibility/DateRangePickerAccessibilityReport.ts +547 -0
- package/lib/components/DateRangePicker/accessibility/index.ts +4 -0
- package/lib/components/DateRangePicker/components/ActionButtons.tsx +76 -0
- package/lib/components/DateRangePicker/components/DatePickerComponent.tsx +291 -0
- package/lib/components/DateRangePicker/components/PresetItem.tsx +139 -0
- package/lib/components/DateRangePicker/components/ScrollablePicker.tsx +618 -0
- package/lib/components/DateRangePicker/components/mobile.tokens.ts +167 -0
- package/lib/components/DateRangePicker/constants.ts +42 -0
- package/lib/components/DateRangePicker/dateRangePicker.tokens.ts +492 -0
- package/lib/components/DateRangePicker/index.ts +4 -0
- package/lib/components/DateRangePicker/types.ts +420 -0
- package/lib/components/DateRangePicker/utils.ts +4391 -0
- package/lib/components/Directory/Directory.tsx +75 -0
- package/lib/components/Directory/NavItem.tsx +517 -0
- package/lib/components/Directory/Section.tsx +270 -0
- package/lib/components/Directory/directory.tokens.ts +283 -0
- package/lib/components/Directory/index.ts +3 -0
- package/lib/components/Directory/types.ts +52 -0
- package/lib/components/Directory/utils.ts +77 -0
- package/lib/components/Drawer/Drawer.tsx +31 -0
- package/lib/components/Drawer/accessibility/DrawerAccessibility.tsx +749 -0
- package/lib/components/Drawer/accessibility/DrawerAccessibilityReport.ts +394 -0
- package/lib/components/Drawer/components/Drawer.css +21 -0
- package/lib/components/Drawer/components/DrawerBase.tsx +738 -0
- package/lib/components/Drawer/components/NestedSelectDrawer.tsx +843 -0
- package/lib/components/Drawer/components/SelectDrawer.tsx +701 -0
- package/lib/components/Drawer/components/StatusDrawer.tsx +127 -0
- package/lib/components/Drawer/drawer.tokens.ts +141 -0
- package/lib/components/Drawer/index.ts +20 -0
- package/lib/components/Drawer/types.ts +424 -0
- package/lib/components/DrawerV2/DrawerV2.tsx +131 -0
- package/lib/components/DrawerV2/index.ts +16 -0
- package/lib/components/DrawerV2/types.ts +58 -0
- package/lib/components/GradientBlur/GradientBlur.css +107 -0
- package/lib/components/GradientBlur/GradientBlur.tsx +16 -0
- package/lib/components/Inputs/AutofillStyles/AutofillStyles.ts +23 -0
- package/lib/components/Inputs/DropdownInput/DropdownInput.tsx +419 -0
- package/lib/components/Inputs/DropdownInput/accessibility/DropdownInputAccessibility.tsx +674 -0
- package/lib/components/Inputs/DropdownInput/accessibility/DropdownInputAccessibilityReport.ts +444 -0
- package/lib/components/Inputs/DropdownInput/dropdownInput.tokens.ts +304 -0
- package/lib/components/Inputs/DropdownInput/index.ts +3 -0
- package/lib/components/Inputs/DropdownInput/types.ts +51 -0
- package/lib/components/Inputs/MultiValueInput/MultiValueInput.tsx +324 -0
- package/lib/components/Inputs/MultiValueInput/accessibility/MultiValueInputAccessibility.tsx +501 -0
- package/lib/components/Inputs/MultiValueInput/accessibility/MultiValueInputAccessibilityReport.ts +479 -0
- package/lib/components/Inputs/MultiValueInput/index.ts +3 -0
- package/lib/components/Inputs/MultiValueInput/multiValueInput.tokens.ts +302 -0
- package/lib/components/Inputs/MultiValueInput/types.ts +38 -0
- package/lib/components/Inputs/NumberInput/NumberInput.tsx +623 -0
- package/lib/components/Inputs/NumberInput/accessibility/NumberInputAccessibility.tsx +581 -0
- package/lib/components/Inputs/NumberInput/accessibility/NumberInputAccessibilityReport.ts +333 -0
- package/lib/components/Inputs/NumberInput/index.ts +3 -0
- package/lib/components/Inputs/NumberInput/numberInput.tokens.ts +382 -0
- package/lib/components/Inputs/NumberInput/types.ts +23 -0
- package/lib/components/Inputs/NumberInput/utils.ts +329 -0
- package/lib/components/Inputs/OTPInput/OTPInput.tsx +355 -0
- package/lib/components/Inputs/OTPInput/accessibility/OTPInputAccessibility.tsx +456 -0
- package/lib/components/Inputs/OTPInput/accessibility/OTPInputAccessibilityReport.ts +466 -0
- package/lib/components/Inputs/OTPInput/index.ts +3 -0
- package/lib/components/Inputs/OTPInput/otpInput.tokens.ts +255 -0
- package/lib/components/Inputs/OTPInput/types.ts +17 -0
- package/lib/components/Inputs/SearchInput/SearchInput.tsx +299 -0
- package/lib/components/Inputs/SearchInput/accessibility/SearchInputAccessibility.tsx +644 -0
- package/lib/components/Inputs/SearchInput/accessibility/SearchInputAccessibilityReport.ts +428 -0
- package/lib/components/Inputs/SearchInput/index.ts +3 -0
- package/lib/components/Inputs/SearchInput/searchInput.tokens.ts +238 -0
- package/lib/components/Inputs/SearchInput/types.ts +13 -0
- package/lib/components/Inputs/TextArea/TextArea.tsx +227 -0
- package/lib/components/Inputs/TextArea/accessibility/TextAreaAccessibility.tsx +466 -0
- package/lib/components/Inputs/TextArea/accessibility/TextAreaAccessibilityReport.ts +476 -0
- package/lib/components/Inputs/TextArea/index.ts +2 -0
- package/lib/components/Inputs/TextArea/textarea.token.ts +264 -0
- package/lib/components/Inputs/TextArea/types.ts +26 -0
- package/lib/components/Inputs/TextInput/TextInput.tsx +448 -0
- package/lib/components/Inputs/TextInput/accessibility/TextInputAccessibility.tsx +598 -0
- package/lib/components/Inputs/TextInput/accessibility/TextInputAccessibilityReport.ts +576 -0
- package/lib/components/Inputs/TextInput/index.ts +3 -0
- package/lib/components/Inputs/TextInput/textInput.tokens.ts +305 -0
- package/lib/components/Inputs/TextInput/types.ts +41 -0
- package/lib/components/Inputs/TextInput/utils.ts +43 -0
- package/lib/components/Inputs/UnitInput/UnitInput.tsx +379 -0
- package/lib/components/Inputs/UnitInput/accessibility/UnitInputAccessibility.tsx +587 -0
- package/lib/components/Inputs/UnitInput/accessibility/UnitInputAccessibilityReport.ts +322 -0
- package/lib/components/Inputs/UnitInput/index.ts +3 -0
- package/lib/components/Inputs/UnitInput/types.ts +33 -0
- package/lib/components/Inputs/UnitInput/unitInput.tokens.ts +380 -0
- package/lib/components/Inputs/index.ts +8 -0
- package/lib/components/Inputs/utils/FloatingLabels/FloatingLabels.tsx +47 -0
- package/lib/components/Inputs/utils/InputFooter/InputFooter.tsx +92 -0
- package/lib/components/Inputs/utils/InputLabels/InputLabels.tsx +133 -0
- package/lib/components/InputsV2/ChatInputV2/AttachmentDropdown.tsx +64 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputTagV2.tsx +93 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2.dark.tokens.ts +339 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2.light.tokens.ts +317 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2.tokens.ts +133 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2.tsx +466 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2.types.ts +61 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2AttachmentRow.tsx +260 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2Mobile.dark.tokens.ts +87 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2Mobile.light.tokens.ts +79 -0
- package/lib/components/InputsV2/ChatInputV2/ChatInputV2Mobile.tokens.ts +63 -0
- package/lib/components/InputsV2/ChatInputV2/MobileChatInputV2.tsx +346 -0
- package/lib/components/InputsV2/ChatInputV2/index.ts +4 -0
- package/lib/components/InputsV2/ChatInputV2/utils.ts +263 -0
- package/lib/components/InputsV2/MultiValueInputV2/MultiValueInputV2.dark.tokens.ts +409 -0
- package/lib/components/InputsV2/MultiValueInputV2/MultiValueInputV2.light.tokens.ts +409 -0
- package/lib/components/InputsV2/MultiValueInputV2/MultiValueInputV2.tokens.ts +82 -0
- package/lib/components/InputsV2/MultiValueInputV2/MultiValueInputV2.tsx +382 -0
- package/lib/components/InputsV2/MultiValueInputV2/MultiValueV2.types.ts +30 -0
- package/lib/components/InputsV2/MultiValueInputV2/index.ts +3 -0
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2.dark.tokens.ts +404 -0
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2.light.tokens.ts +532 -0
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2.tsx +698 -0
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2Stepper.tsx +135 -0
- package/lib/components/InputsV2/NumberInputV2/NumberInputV2Unit.tsx +75 -0
- package/lib/components/InputsV2/NumberInputV2/StepperArrow.tsx +25 -0
- package/lib/components/InputsV2/NumberInputV2/index.ts +3 -0
- package/lib/components/InputsV2/NumberInputV2/numberInputV2.tokens.ts +133 -0
- package/lib/components/InputsV2/NumberInputV2/numberInputV2.types.ts +47 -0
- package/lib/components/InputsV2/NumberInputV2/utils.ts +411 -0
- package/lib/components/InputsV2/OTPInputV2/OTPInputV2.dark.tokens.ts +299 -0
- package/lib/components/InputsV2/OTPInputV2/OTPInputV2.light.tokens.ts +301 -0
- package/lib/components/InputsV2/OTPInputV2/OTPInputV2.tokens.ts +47 -0
- package/lib/components/InputsV2/OTPInputV2/OTPInputV2.tsx +327 -0
- package/lib/components/InputsV2/OTPInputV2/OTPInputV2.types.ts +16 -0
- package/lib/components/InputsV2/OTPInputV2/index.ts +3 -0
- package/lib/components/InputsV2/OTPInputV2/otpInputV2Utils.ts +177 -0
- package/lib/components/InputsV2/SearchInputV2/SearchInputV2.dark.tokens.ts +257 -0
- package/lib/components/InputsV2/SearchInputV2/SearchInputV2.light.tokens.ts +257 -0
- package/lib/components/InputsV2/SearchInputV2/SearchInputV2.tokens.ts +106 -0
- package/lib/components/InputsV2/SearchInputV2/SearchInputV2.tsx +282 -0
- package/lib/components/InputsV2/SearchInputV2/SearchInputV2.types.ts +16 -0
- package/lib/components/InputsV2/SearchInputV2/index.ts +3 -0
- package/lib/components/InputsV2/SearchInputV2/utils.ts +164 -0
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.dark.tokens.ts +398 -0
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.light.tokens.ts +397 -0
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tokens.ts +76 -0
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.tsx +251 -0
- package/lib/components/InputsV2/TextAreaV2/TextAreaV2.types.ts +26 -0
- package/lib/components/InputsV2/TextAreaV2/index.tsx +3 -0
- package/lib/components/InputsV2/TextAreaV2/utils.ts +140 -0
- package/lib/components/InputsV2/TextInputV2/TextInputV2.dark.tokens.ts +429 -0
- package/lib/components/InputsV2/TextInputV2/TextInputV2.light.tokens.ts +423 -0
- package/lib/components/InputsV2/TextInputV2/TextInputV2.tokens.ts +149 -0
- package/lib/components/InputsV2/TextInputV2/TextInputV2.tsx +433 -0
- package/lib/components/InputsV2/TextInputV2/TextInputV2.types.ts +56 -0
- package/lib/components/InputsV2/TextInputV2/index.ts +3 -0
- package/lib/components/InputsV2/TextInputV2/utils.ts +81 -0
- package/lib/components/InputsV2/inputV2.tokens.ts +93 -0
- package/lib/components/InputsV2/inputV2.types.ts +19 -0
- package/lib/components/InputsV2/utils/FloatingLabelsV2/FloatingLabelsV2.tsx +96 -0
- package/lib/components/InputsV2/utils/InputFooter/InputFooterV2.tsx +70 -0
- package/lib/components/InputsV2/utils/InputLabels/InputLabelsV2.tsx +95 -0
- package/lib/components/InputsV2/utils/InputSlots/InputSlots.tsx +43 -0
- package/lib/components/InputsV2/utils/utils.ts +38 -0
- package/lib/components/KeyValuePair/KeyValuePair.tokens.ts +111 -0
- package/lib/components/KeyValuePair/KeyValuePair.tsx +248 -0
- package/lib/components/KeyValuePair/accessibility/KeyValuePairAccessibility.tsx +514 -0
- package/lib/components/KeyValuePair/accessibility/KeyValuePairAccessibilityReport.ts +317 -0
- package/lib/components/KeyValuePair/accessibility/index.ts +2 -0
- package/lib/components/KeyValuePair/index.ts +3 -0
- package/lib/components/KeyValuePair/types.ts +45 -0
- package/lib/components/KeyValuePair/utils.ts +113 -0
- package/lib/components/KeyValuePairV2/KeyValuePairLayout.tsx +89 -0
- package/lib/components/KeyValuePairV2/KeyValuePairV2.tsx +132 -0
- package/lib/components/KeyValuePairV2/ResponsiveText.tsx +117 -0
- package/lib/components/KeyValuePairV2/index.ts +3 -0
- package/lib/components/KeyValuePairV2/keyValuePairV2.dark.tokens.ts +59 -0
- package/lib/components/KeyValuePairV2/keyValuePairV2.light.tokens.ts +59 -0
- package/lib/components/KeyValuePairV2/keyValuePairV2.tokens.ts +42 -0
- package/lib/components/KeyValuePairV2/keyValuePairV2.types.ts +35 -0
- package/lib/components/KeyValuePairV2/responsiveTextStyles.ts +65 -0
- package/lib/components/KeyValuePairV2/utils.ts +51 -0
- package/lib/components/Menu/Menu.tsx +502 -0
- package/lib/components/Menu/MenuGroupLabel.tsx +10 -0
- package/lib/components/Menu/MenuItem.tsx +246 -0
- package/lib/components/Menu/MenuSkeleton.tsx +36 -0
- package/lib/components/Menu/SubMenu.tsx +420 -0
- package/lib/components/Menu/accessibility/MenuAccessibility.tsx +598 -0
- package/lib/components/Menu/accessibility/MenuAccessibilityReport.ts +484 -0
- package/lib/components/Menu/accessibility/index.ts +2 -0
- package/lib/components/Menu/index.ts +3 -0
- package/lib/components/Menu/menu.animations.ts +146 -0
- package/lib/components/Menu/menu.styles.ts +17 -0
- package/lib/components/Menu/menu.tokens.ts +617 -0
- package/lib/components/Menu/types.tsx +101 -0
- package/lib/components/Menu/utils.ts +44 -0
- package/lib/components/MenuV2/MenuV2.tsx +133 -0
- package/lib/components/MenuV2/MenuV2Content.tsx +442 -0
- package/lib/components/MenuV2/MenuV2Item.tsx +194 -0
- package/lib/components/MenuV2/MenuV2SubMenu.tsx +288 -0
- package/lib/components/MenuV2/index.ts +7 -0
- package/lib/components/MenuV2/menuV2.animations.ts +83 -0
- package/lib/components/MenuV2/menuV2.dark.tokens.ts +401 -0
- package/lib/components/MenuV2/menuV2.light.tokens.ts +401 -0
- package/lib/components/MenuV2/menuV2.tokens.ts +126 -0
- package/lib/components/MenuV2/menuV2.types.ts +99 -0
- package/lib/components/MenuV2/menuV2.utils.ts +156 -0
- package/lib/components/Modal/MobileModal.tsx +235 -0
- package/lib/components/Modal/Modal.tsx +400 -0
- package/lib/components/Modal/ModalSkeleton.tsx +110 -0
- package/lib/components/Modal/accessibility/ModalAccessibility.tsx +518 -0
- package/lib/components/Modal/accessibility/ModalAccessibilityReport.ts +350 -0
- package/lib/components/Modal/index.ts +3 -0
- package/lib/components/Modal/modal.animations.ts +19 -0
- package/lib/components/Modal/modal.tokens.ts +207 -0
- package/lib/components/Modal/modal.utils.ts +24 -0
- package/lib/components/Modal/types.ts +42 -0
- package/lib/components/Modal/useModal.ts +66 -0
- package/lib/components/MultiSelect/MobileMultiSelect.tsx +999 -0
- package/lib/components/MultiSelect/MultiSelect.tsx +822 -0
- package/lib/components/MultiSelect/MultiSelectMenu.tsx +903 -0
- package/lib/components/MultiSelect/MultiSelectMenuItem.tsx +79 -0
- package/lib/components/MultiSelect/MultiSelectSkeleton.tsx +37 -0
- package/lib/components/MultiSelect/MultiSelectSubMenu.tsx +142 -0
- package/lib/components/MultiSelect/MultiSelectTrigger.tsx +322 -0
- package/lib/components/MultiSelect/SelectAllItem.tsx +108 -0
- package/lib/components/MultiSelect/accessibility/MultiSelectAccessibility.tsx +751 -0
- package/lib/components/MultiSelect/accessibility/MultiSelectAccessibilityReport.ts +604 -0
- package/lib/components/MultiSelect/accessibility/index.ts +7 -0
- package/lib/components/MultiSelect/index.ts +4 -0
- package/lib/components/MultiSelect/multiSelect.animations.ts +135 -0
- package/lib/components/MultiSelect/multiSelect.tokens.ts +777 -0
- package/lib/components/MultiSelect/types.ts +228 -0
- package/lib/components/MultiSelect/utils.ts +217 -0
- package/lib/components/MultiSelectGroup/MultiSelectGroup.tsx +35 -0
- package/lib/components/MultiSelectGroup/MultiselectGroupProps.types.ts +8 -0
- package/lib/components/MultiSelectGroup/index.tsx +4 -0
- package/lib/components/MultiSelectV2/MobileMultiSelectV2.tsx +1 -0
- package/lib/components/MultiSelectV2/MultiSelectV2.tsx +449 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Menu.tsx +477 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuActions.tsx +87 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuHeader.tsx +91 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuItem.tsx +76 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuItems.tsx +114 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuSearch.tsx +42 -0
- package/lib/components/MultiSelectV2/MultiSelectV2MenuVirtualList.tsx +139 -0
- package/lib/components/MultiSelectV2/MultiSelectV2SelectAllItem.tsx +114 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Skeleton.tsx +48 -0
- package/lib/components/MultiSelectV2/MultiSelectV2SubMenu.tsx +153 -0
- package/lib/components/MultiSelectV2/MultiSelectV2Trigger.tsx +365 -0
- package/lib/components/MultiSelectV2/index.ts +14 -0
- package/lib/components/MultiSelectV2/mobile/MobileMultiSelectV2.tsx +708 -0
- package/lib/components/MultiSelectV2/mobile/mobileMultiSelectV2.utils.ts +72 -0
- package/lib/components/MultiSelectV2/multiSelectV2.dark.tokens.ts +459 -0
- package/lib/components/MultiSelectV2/multiSelectV2.light.tokens.ts +461 -0
- package/lib/components/MultiSelectV2/multiSelectV2.tokens.ts +251 -0
- package/lib/components/MultiSelectV2/multiSelectV2.types.ts +173 -0
- package/lib/components/MultiSelectV2/utils.ts +243 -0
- package/lib/components/Popover/MobilePopover.tsx +226 -0
- package/lib/components/Popover/Popover.tsx +226 -0
- package/lib/components/Popover/PopoverFooter.tsx +58 -0
- package/lib/components/Popover/PopoverHeader.tsx +125 -0
- package/lib/components/Popover/PopoverSkeleton.tsx +92 -0
- package/lib/components/Popover/accessibility/PopoverAccessibility.tsx +550 -0
- package/lib/components/Popover/accessibility/PopoverAccessibilityReport.ts +353 -0
- package/lib/components/Popover/index.ts +3 -0
- package/lib/components/Popover/popover.animations.ts +125 -0
- package/lib/components/Popover/popover.tokens.ts +277 -0
- package/lib/components/Popover/types.ts +54 -0
- package/lib/components/PopoverV2/MobilePopoverV2.tsx +219 -0
- package/lib/components/PopoverV2/PopoverV2.tsx +231 -0
- package/lib/components/PopoverV2/PopoverV2Footer.tsx +55 -0
- package/lib/components/PopoverV2/PopoverV2Header.tsx +133 -0
- package/lib/components/PopoverV2/PopoverV2Skeleton.tsx +89 -0
- package/lib/components/PopoverV2/index.tsx +3 -0
- package/lib/components/PopoverV2/popoverV2.dark.tokens.tsx +228 -0
- package/lib/components/PopoverV2/popoverV2.light.tokens.tsx +228 -0
- package/lib/components/PopoverV2/popoverV2.token.ts +85 -0
- package/lib/components/PopoverV2/popoverV2.types.ts +70 -0
- package/lib/components/Primitives/Block/Block.tsx +460 -0
- package/lib/components/Primitives/Group/Group.tsx +93 -0
- package/lib/components/Primitives/Group/index.ts +3 -0
- package/lib/components/Primitives/Group/types.ts +99 -0
- package/lib/components/Primitives/Group/utils.ts +76 -0
- package/lib/components/Primitives/PrimitiveButton/PrimitiveButton.tsx +376 -0
- package/lib/components/Primitives/PrimitiveInput/PrimitiveInput.tsx +482 -0
- package/lib/components/Primitives/PrimitiveLink.tsx +238 -0
- package/lib/components/Primitives/PrimitiveText/PrimitiveText.tsx +203 -0
- package/lib/components/Primitives/PrimitiveTextArea.tsx +398 -0
- package/lib/components/ProgressBar/ProgressBar.tsx +300 -0
- package/lib/components/ProgressBar/accessibility/ProgressBarAccessibility.tsx +751 -0
- package/lib/components/ProgressBar/accessibility/ProgressBarAccessibilityReport.ts +517 -0
- package/lib/components/ProgressBar/index.ts +3 -0
- package/lib/components/ProgressBar/progressbar.tokens.ts +313 -0
- package/lib/components/ProgressBar/types.ts +26 -0
- package/lib/components/ProgressBar/utils.ts +111 -0
- package/lib/components/ProgressBarV2/CircularProgressBarV2.tsx +118 -0
- package/lib/components/ProgressBarV2/LinearProgressBarV2.tsx +104 -0
- package/lib/components/ProgressBarV2/ProgressBarV2.tsx +85 -0
- package/lib/components/ProgressBarV2/index.ts +3 -0
- package/lib/components/ProgressBarV2/progressBarV2.dark.tokens.ts +203 -0
- package/lib/components/ProgressBarV2/progressBarV2.light.tokens.ts +203 -0
- package/lib/components/ProgressBarV2/progressBarV2.tokens.ts +80 -0
- package/lib/components/ProgressBarV2/progressBarV2.types.ts +50 -0
- package/lib/components/ProgressBarV2/utils.ts +154 -0
- package/lib/components/Radio/Radio.tsx +237 -0
- package/lib/components/Radio/RadioGroup.tsx +248 -0
- package/lib/components/Radio/StyledRadio.tsx +71 -0
- package/lib/components/Radio/accessibility/RadioAccessibility.tsx +1109 -0
- package/lib/components/Radio/accessibility/RadioAccessibilityReport.ts +581 -0
- package/lib/components/Radio/accessibility/index.ts +2 -0
- package/lib/components/Radio/index.ts +4 -0
- package/lib/components/Radio/radio.animations.ts +49 -0
- package/lib/components/Radio/radio.token.ts +287 -0
- package/lib/components/Radio/types.ts +39 -0
- package/lib/components/Radio/utils.ts +125 -0
- package/lib/components/Select/Select.tsx +378 -0
- package/lib/components/Select/SelectItem/SelectItem.tsx +3 -0
- package/lib/components/Select/SelectItem/index.tsx +384 -0
- package/lib/components/Select/SelectItem/types.ts +46 -0
- package/lib/components/Select/SelectItem/utils.ts +62 -0
- package/lib/components/Select/SelectMenu.tsx +518 -0
- package/lib/components/Select/index.ts +2 -0
- package/lib/components/Select/select.token.ts +80 -0
- package/lib/components/Select/selectUtils.ts +74 -0
- package/lib/components/Select/types.tsx +102 -0
- package/lib/components/SelectV2/SelectItemV2.tsx +328 -0
- package/lib/components/SelectV2/index.ts +10 -0
- package/lib/components/SelectV2/selectV2.constants.ts +7 -0
- package/lib/components/SelectV2/selectV2.shared.types.ts +113 -0
- package/lib/components/SelectV2/selectV2.tokenStates.ts +15 -0
- package/lib/components/SelectV2/types.ts +115 -0
- package/lib/components/SelectV2/useSelectV2MenuBehavior.ts +135 -0
- package/lib/components/SelectorV2/CheckboxV2/CheckboxV2.tsx +282 -0
- package/lib/components/SelectorV2/CheckboxV2/StyledCheckboxV2.tsx +100 -0
- package/lib/components/SelectorV2/CheckboxV2/checkboxV2.animations.ts +85 -0
- package/lib/components/SelectorV2/CheckboxV2/checkboxV2.dark.tokens.ts +327 -0
- package/lib/components/SelectorV2/CheckboxV2/checkboxV2.light.tokens.ts +324 -0
- package/lib/components/SelectorV2/CheckboxV2/checkboxV2.tokens.ts +98 -0
- package/lib/components/SelectorV2/CheckboxV2/checkboxV2.types.ts +70 -0
- package/lib/components/SelectorV2/CheckboxV2/index.ts +3 -0
- package/lib/components/SelectorV2/CheckboxV2/utils.ts +171 -0
- package/lib/components/SelectorV2/RadioV2/RadioV2.tsx +158 -0
- package/lib/components/SelectorV2/RadioV2/StyledRadioV2.tsx +72 -0
- package/lib/components/SelectorV2/RadioV2/index.ts +3 -0
- package/lib/components/SelectorV2/RadioV2/radioV2.dark.tokens.ts +278 -0
- package/lib/components/SelectorV2/RadioV2/radioV2.light.tokens.ts +281 -0
- package/lib/components/SelectorV2/RadioV2/radioV2.tokens.ts +90 -0
- package/lib/components/SelectorV2/RadioV2/radioV2.types.ts +45 -0
- package/lib/components/SelectorV2/SwitchV2/SwitchV2.tsx +239 -0
- package/lib/components/SelectorV2/SwitchV2/index.ts +3 -0
- package/lib/components/SelectorV2/SwitchV2/switchV2.dark.tokens.ts +232 -0
- package/lib/components/SelectorV2/SwitchV2/switchV2.light.tokens.ts +230 -0
- package/lib/components/SelectorV2/SwitchV2/switchV2.tokens.ts +80 -0
- package/lib/components/SelectorV2/SwitchV2/switchV2.types.ts +56 -0
- package/lib/components/SelectorV2/selectorV2.types.ts +13 -0
- package/lib/components/SelectorsContent/SelectorsContent.types.ts +55 -0
- package/lib/components/SelectorsContent/SelectorsLabel.tsx +68 -0
- package/lib/components/SelectorsContent/SelectorsSubLabel.tsx +52 -0
- package/lib/components/SelectorsContent/index.ts +3 -0
- package/lib/components/Sidebar/Sidebar.tsx +551 -0
- package/lib/components/Sidebar/SidebarContent.tsx +121 -0
- package/lib/components/Sidebar/SidebarFooter.tsx +46 -0
- package/lib/components/Sidebar/SidebarHeader.tsx +199 -0
- package/lib/components/Sidebar/SidebarMobile/MobileNavigationItem.tsx +99 -0
- package/lib/components/Sidebar/SidebarMobile/MoreButton.tsx +77 -0
- package/lib/components/Sidebar/SidebarMobile/PrimaryActionButton.tsx +60 -0
- package/lib/components/Sidebar/SidebarMobile/hooks.ts +87 -0
- package/lib/components/Sidebar/SidebarMobile/index.tsx +393 -0
- package/lib/components/Sidebar/SidebarMobile/mobile.tokens.ts +159 -0
- package/lib/components/Sidebar/SidebarMobile/utils.ts +167 -0
- package/lib/components/Sidebar/TenantPanel.tsx +255 -0
- package/lib/components/Sidebar/accessibility/SidebarAccessibility.tsx +715 -0
- package/lib/components/Sidebar/accessibility/SidebarAccessibilityReport.ts +446 -0
- package/lib/components/Sidebar/index.ts +3 -0
- package/lib/components/Sidebar/sidebar.tokens.ts +269 -0
- package/lib/components/Sidebar/types.ts +85 -0
- package/lib/components/Sidebar/utils.ts +371 -0
- package/lib/components/SidebarV2/SecondarySidebar.tsx +123 -0
- package/lib/components/SidebarV2/SidebarV2.tsx +474 -0
- package/lib/components/SidebarV2/SidebarV2Footer.tsx +45 -0
- package/lib/components/SidebarV2/SidebarV2Header.tsx +165 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/MobileNavigationItem.tsx +92 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/MoreButton.tsx +74 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/PrimaryActionButton.tsx +72 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/hooks.ts +91 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/index.tsx +385 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/mobile.dark.tokens.ts +85 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/mobile.light.tokens.ts +85 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/mobile.tokens.ts +99 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/types.ts +36 -0
- package/lib/components/SidebarV2/SidebarV2MobileNavigation/utils.ts +174 -0
- package/lib/components/SidebarV2/SidebarV2Panel.tsx +139 -0
- package/lib/components/SidebarV2/index.ts +10 -0
- package/lib/components/SidebarV2/sidebarV2.dark.tokens.ts +223 -0
- package/lib/components/SidebarV2/sidebarV2.light.tokens.ts +223 -0
- package/lib/components/SidebarV2/sidebarV2.tokens.ts +120 -0
- package/lib/components/SidebarV2/sidebarV2.types.ts +6 -0
- package/lib/components/SidebarV2/types.ts +63 -0
- package/lib/components/SidebarV2/utils.ts +121 -0
- package/lib/components/SingleSelect/MobileSingleSelect.tsx +628 -0
- package/lib/components/SingleSelect/SingleSelect.tsx +638 -0
- package/lib/components/SingleSelect/SingleSelectMenu.tsx +831 -0
- package/lib/components/SingleSelect/SingleSelectSkeleton.tsx +37 -0
- package/lib/components/SingleSelect/SingleSelectTrigger.tsx +242 -0
- package/lib/components/SingleSelect/accessibility/SingleSelectAccessibility.tsx +1375 -0
- package/lib/components/SingleSelect/accessibility/SingleSelectAccessibilityReport.ts +602 -0
- package/lib/components/SingleSelect/accessibility/index.ts +2 -0
- package/lib/components/SingleSelect/index.ts +3 -0
- package/lib/components/SingleSelect/singleSelect.animations.ts +149 -0
- package/lib/components/SingleSelect/singleSelect.tokens.ts +686 -0
- package/lib/components/SingleSelect/types.ts +141 -0
- package/lib/components/SingleSelect/utils.ts +236 -0
- package/lib/components/SingleSelectGroup/SingleSelectGroup.tsx +34 -0
- package/lib/components/SingleSelectGroup/SingleSelectGroupProps.types.ts +10 -0
- package/lib/components/SingleSelectGroup/index.ts +4 -0
- package/lib/components/SingleSelectV2/MobileSingleSelectV2.tsx +615 -0
- package/lib/components/SingleSelectV2/SingleSelectV2.tsx +297 -0
- package/lib/components/SingleSelectV2/SingleSelectV2List.tsx +90 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Menu.tsx +355 -0
- package/lib/components/SingleSelectV2/SingleSelectV2MenuItems.tsx +228 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Search.tsx +54 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Skeleton.tsx +48 -0
- package/lib/components/SingleSelectV2/SingleSelectV2Trigger.tsx +308 -0
- package/lib/components/SingleSelectV2/SingleSelectV2VirtualList.tsx +161 -0
- package/lib/components/SingleSelectV2/index.ts +11 -0
- package/lib/components/SingleSelectV2/mobile/SingleSelectV2MobileItem.tsx +127 -0
- package/lib/components/SingleSelectV2/mobile/singleSelectV2.mobile.utils.ts +55 -0
- package/lib/components/SingleSelectV2/singleSelectV2.animations.ts +146 -0
- package/lib/components/SingleSelectV2/singleSelectV2.dark.tokens.ts +367 -0
- package/lib/components/SingleSelectV2/singleSelectV2.light.tokens.ts +367 -0
- package/lib/components/SingleSelectV2/singleSelectV2.tokens.ts +202 -0
- package/lib/components/SingleSelectV2/singleSelectV2.types.ts +203 -0
- package/lib/components/SingleSelectV2/utils.ts +384 -0
- package/lib/components/Skeleton/README.md +279 -0
- package/lib/components/Skeleton/Skeleton.tsx +192 -0
- package/lib/components/Skeleton/SkeletonAvatar.tsx +45 -0
- package/lib/components/Skeleton/SkeletonCard.tsx +137 -0
- package/lib/components/Skeleton/SkeletonCompound.tsx +64 -0
- package/lib/components/Skeleton/hooks/useSkeletonBase.ts +33 -0
- package/lib/components/Skeleton/index.ts +41 -0
- package/lib/components/Skeleton/skeleton.tokens.ts +143 -0
- package/lib/components/Skeleton/types.ts +38 -0
- package/lib/components/Skeleton/utils.ts +32 -0
- package/lib/components/Slider/Slider.tsx +296 -0
- package/lib/components/Slider/accessibility/SliderAccessibility.tsx +631 -0
- package/lib/components/Slider/accessibility/SliderAccessibilityReport.ts +246 -0
- package/lib/components/Slider/accessibility/index.ts +7 -0
- package/lib/components/Slider/index.ts +3 -0
- package/lib/components/Slider/types.ts +35 -0
- package/lib/components/Slider/utils.ts +370 -0
- package/lib/components/Snackbar/Snackbar.tsx +315 -0
- package/lib/components/Snackbar/accessibility/SnackbarAccessibility.tsx +525 -0
- package/lib/components/Snackbar/accessibility/SnackbarAccessibilityReport.ts +360 -0
- package/lib/components/Snackbar/accessibility/index.ts +2 -0
- package/lib/components/Snackbar/index.ts +4 -0
- package/lib/components/Snackbar/snackbar.tokens.ts +263 -0
- package/lib/components/Snackbar/types.ts +51 -0
- package/lib/components/SnackbarV2/SnackbarV2.tsx +474 -0
- package/lib/components/SnackbarV2/index.ts +4 -0
- package/lib/components/SnackbarV2/snackbarV2.dark.tokens.ts +161 -0
- package/lib/components/SnackbarV2/snackbarV2.light.tokens.ts +161 -0
- package/lib/components/SnackbarV2/snackbarV2.tokens.ts +88 -0
- package/lib/components/SnackbarV2/snackbarV2.types.ts +65 -0
- package/lib/components/SplitTag/SplitTag.tsx +85 -0
- package/lib/components/SplitTag/accessibility/SplitTagAccessibility.tsx +972 -0
- package/lib/components/SplitTag/accessibility/SplitTagAccessibilityReport.ts +441 -0
- package/lib/components/SplitTag/index.ts +2 -0
- package/lib/components/SplitTag/types.ts +8 -0
- package/lib/components/StatCard/StatCard.tsx +1620 -0
- package/lib/components/StatCard/StatCardSkeleton.tsx +24 -0
- package/lib/components/StatCard/accessibility/StatCardAccessibility.tsx +612 -0
- package/lib/components/StatCard/accessibility/StatCardAccessibilityReport.ts +400 -0
- package/lib/components/StatCard/index.ts +3 -0
- package/lib/components/StatCard/statcard.tokens.ts +468 -0
- package/lib/components/StatCard/types.ts +82 -0
- package/lib/components/StatCard/utils.ts +78 -0
- package/lib/components/StatCardV2/StatCardV2.chartConfig.ts +47 -0
- package/lib/components/StatCardV2/StatCardV2.tsx +307 -0
- package/lib/components/StatCardV2/StatCardV2Change.tsx +89 -0
- package/lib/components/StatCardV2/StatCardV2NoData.tsx +160 -0
- package/lib/components/StatCardV2/StatCardV2Skeleton.tsx +24 -0
- package/lib/components/StatCardV2/StatCardV2Subtitle.tsx +29 -0
- package/lib/components/StatCardV2/StatCardV2Title.tsx +83 -0
- package/lib/components/StatCardV2/StatCardV2Value.tsx +67 -0
- package/lib/components/StatCardV2/index.ts +3 -0
- package/lib/components/StatCardV2/statcardV2.dark.tokens.ts +184 -0
- package/lib/components/StatCardV2/statcardV2.light.tokens.ts +184 -0
- package/lib/components/StatCardV2/statcardV2.tokens.ts +95 -0
- package/lib/components/StatCardV2/statcardV2.types.ts +90 -0
- package/lib/components/StatCardV2/utils.ts +29 -0
- package/lib/components/Stepper/HorizonatlLine.tsx +23 -0
- package/lib/components/Stepper/HorizontalStepper.tsx +467 -0
- package/lib/components/Stepper/Stepper.tsx +56 -0
- package/lib/components/Stepper/StepperLine.tsx +19 -0
- package/lib/components/Stepper/VerticalLine.tsx +24 -0
- package/lib/components/Stepper/VerticalStepper.tsx +965 -0
- package/lib/components/Stepper/accessibility/StepperAccessibility.tsx +723 -0
- package/lib/components/Stepper/accessibility/StepperAccessibilityReport.ts +337 -0
- package/lib/components/Stepper/index.ts +3 -0
- package/lib/components/Stepper/stepper.tokens.ts +883 -0
- package/lib/components/Stepper/types.ts +55 -0
- package/lib/components/StepperV2/Stepper/StepStatusCircle.tsx +54 -0
- package/lib/components/StepperV2/Stepper/StepperComponent.tsx +177 -0
- package/lib/components/StepperV2/Stepper/Steps.tsx +562 -0
- package/lib/components/StepperV2/Stepper/StepsHorizontalBody.tsx +105 -0
- package/lib/components/StepperV2/Stepper/StepsSubstepList.tsx +198 -0
- package/lib/components/StepperV2/Stepper/StepsVerticalSubstepRails.tsx +72 -0
- package/lib/components/StepperV2/Stepper/VerticalLineV2.tsx +26 -0
- package/lib/components/StepperV2/Stepper/stepsHelpers.ts +59 -0
- package/lib/components/StepperV2/StepperV2.tsx +44 -0
- package/lib/components/StepperV2/index.ts +10 -0
- package/lib/components/StepperV2/stepperV2.dark.tokens.ts +1403 -0
- package/lib/components/StepperV2/stepperV2.light.tokens.ts +1389 -0
- package/lib/components/StepperV2/stepperV2.tokens.ts +116 -0
- package/lib/components/StepperV2/stepperV2.types.ts +72 -0
- package/lib/components/StepperV2/utils.ts +37 -0
- package/lib/components/Switch/StyledSwitch.tsx +97 -0
- package/lib/components/Switch/Switch.tsx +245 -0
- package/lib/components/Switch/SwitchGroup.tsx +115 -0
- package/lib/components/Switch/accessibility/SwitchAccessibility.tsx +819 -0
- package/lib/components/Switch/accessibility/SwitchAccessibilityReport.ts +579 -0
- package/lib/components/Switch/accessibility/index.ts +6 -0
- package/lib/components/Switch/index.ts +4 -0
- package/lib/components/Switch/switch.animations.ts +54 -0
- package/lib/components/Switch/switch.token.ts +363 -0
- package/lib/components/Switch/types.ts +37 -0
- package/lib/components/Switch/utils.ts +158 -0
- package/lib/components/Tabs/StyledTabs.tsx +153 -0
- package/lib/components/Tabs/Tabs.tsx +313 -0
- package/lib/components/Tabs/TabsContent.tsx +33 -0
- package/lib/components/Tabs/TabsList.tsx +590 -0
- package/lib/components/Tabs/TabsTrigger.tsx +271 -0
- package/lib/components/Tabs/accessibility/TabsAccessibility.tsx +735 -0
- package/lib/components/Tabs/accessibility/TabsAccessibilityReport.ts +290 -0
- package/lib/components/Tabs/accessibility/index.ts +2 -0
- package/lib/components/Tabs/index.ts +8 -0
- package/lib/components/Tabs/tabs.token.ts +758 -0
- package/lib/components/Tabs/types.ts +99 -0
- package/lib/components/Tabs/utils.ts +235 -0
- package/lib/components/TabsV2/StyledTabsV2.tsx +166 -0
- package/lib/components/TabsV2/TabsV2.tsx +202 -0
- package/lib/components/TabsV2/TabsV2Content.tsx +34 -0
- package/lib/components/TabsV2/TabsV2List.tsx +403 -0
- package/lib/components/TabsV2/TabsV2Trigger.tsx +260 -0
- package/lib/components/TabsV2/index.ts +12 -0
- package/lib/components/TabsV2/tabsV2.context.tsx +45 -0
- package/lib/components/TabsV2/tabsV2.dark.tokens.ts +680 -0
- package/lib/components/TabsV2/tabsV2.light.tokens.ts +680 -0
- package/lib/components/TabsV2/tabsV2.tokens.ts +111 -0
- package/lib/components/TabsV2/tabsV2.types.ts +85 -0
- package/lib/components/TabsV2/tabsV2.utils.ts +145 -0
- package/lib/components/TagGroupV2/TagGroupV2.tsx +32 -0
- package/lib/components/TagGroupV2/TagGroupV2.types.ts +12 -0
- package/lib/components/TagGroupV2/index.ts +2 -0
- package/lib/components/TagV2/TagSkeleton.tsx +102 -0
- package/lib/components/TagV2/TagV2.tsx +179 -0
- package/lib/components/TagV2/TagV2.types.ts +61 -0
- package/lib/components/TagV2/index.ts +2 -0
- package/lib/components/TagV2/tagV2.dark.tokens.ts +359 -0
- package/lib/components/TagV2/tagV2.light.tokens.ts +352 -0
- package/lib/components/TagV2/tagV2.tokens.ts +85 -0
- package/lib/components/TagV2/utils.ts +71 -0
- package/lib/components/Tags/Tag.tsx +115 -0
- package/lib/components/Tags/TagBase.tsx +227 -0
- package/lib/components/Tags/Tags.tsx +82 -0
- package/lib/components/Tags/accessibility/TagAccessibility.tsx +665 -0
- package/lib/components/Tags/accessibility/TagAccessibilityReport.ts +392 -0
- package/lib/components/Tags/index.ts +3 -0
- package/lib/components/Tags/tag.dark.tokens.ts +297 -0
- package/lib/components/Tags/tag.light.tokens.ts +297 -0
- package/lib/components/Tags/tag.tokens.ts +87 -0
- package/lib/components/Tags/types.ts +49 -0
- package/lib/components/Text/Text.tsx +147 -0
- package/lib/components/TextInputGroup/TextInputGroup.tsx +34 -0
- package/lib/components/TextInputGroup/TextInputGroupProps.types.ts +8 -0
- package/lib/components/TextInputGroup/index.ts +4 -0
- package/lib/components/Timeline/Timeline.tsx +106 -0
- package/lib/components/Timeline/TimelineHeader.tsx +120 -0
- package/lib/components/Timeline/TimelineLabel.tsx +61 -0
- package/lib/components/Timeline/TimelineNode.tsx +225 -0
- package/lib/components/Timeline/TimelineShowMore.tsx +36 -0
- package/lib/components/Timeline/TimelineSubstep.tsx +173 -0
- package/lib/components/Timeline/index.ts +9 -0
- package/lib/components/Timeline/timeline.dark.token.ts +149 -0
- package/lib/components/Timeline/timeline.light.token.ts +149 -0
- package/lib/components/Timeline/timeline.token.ts +152 -0
- package/lib/components/Timeline/types.ts +115 -0
- package/lib/components/Timeline/utils.ts +169 -0
- package/lib/components/Tooltip/Tooltip.tsx +170 -0
- package/lib/components/Tooltip/accessibility/TooltipAccessibility.tsx +592 -0
- package/lib/components/Tooltip/accessibility/TooltipAccessibilityReport.ts +356 -0
- package/lib/components/Tooltip/index.ts +3 -0
- package/lib/components/Tooltip/tooltip.animations.ts +82 -0
- package/lib/components/Tooltip/tooltip.tokens.ts +157 -0
- package/lib/components/Tooltip/types.ts +41 -0
- package/lib/components/TooltipV2/TooltipV2.tsx +214 -0
- package/lib/components/TooltipV2/index.ts +3 -0
- package/lib/components/TooltipV2/tooltipV2.animation.ts +82 -0
- package/lib/components/TooltipV2/tooltipV2.dark.tokens.ts +115 -0
- package/lib/components/TooltipV2/tooltipV2.light.tokens.ts +115 -0
- package/lib/components/TooltipV2/tooltipV2.tokens.ts +62 -0
- package/lib/components/TooltipV2/tooltipV2.types.ts +43 -0
- package/lib/components/Topbar/Topbar.tsx +370 -0
- package/lib/components/Topbar/index.ts +3 -0
- package/lib/components/Topbar/topbar.tokens.ts +304 -0
- package/lib/components/Topbar/types.ts +53 -0
- package/lib/components/TopbarV2/TopbarV2.tsx +363 -0
- package/lib/components/TopbarV2/index.ts +3 -0
- package/lib/components/TopbarV2/topbarV2.dark.tokens.ts +159 -0
- package/lib/components/TopbarV2/topbarV2.light.tokens.ts +159 -0
- package/lib/components/TopbarV2/topbarV2.tokens.ts +84 -0
- package/lib/components/TopbarV2/types.ts +52 -0
- package/lib/components/Upload/Upload.tsx +675 -0
- package/lib/components/Upload/accessibility/UploadAccessibility.tsx +507 -0
- package/lib/components/Upload/accessibility/UploadAccessibilityReport.ts +495 -0
- package/lib/components/Upload/accessibility/index.ts +3 -0
- package/lib/components/Upload/components/DefaultState.tsx +101 -0
- package/lib/components/Upload/components/ErrorState.tsx +124 -0
- package/lib/components/Upload/components/FileListDisplay.tsx +112 -0
- package/lib/components/Upload/components/MixedState.tsx +88 -0
- package/lib/components/Upload/components/SuccessState.tsx +108 -0
- package/lib/components/Upload/components/UploadingState.tsx +108 -0
- package/lib/components/Upload/components/index.ts +6 -0
- package/lib/components/Upload/index.ts +4 -0
- package/lib/components/Upload/types.ts +103 -0
- package/lib/components/Upload/upload.tokens.ts +288 -0
- package/lib/components/Upload/utils.ts +929 -0
- package/lib/components/VirtualList/VirtualList.tsx +269 -0
- package/lib/components/VirtualList/index.ts +7 -0
- package/lib/components/VirtualList/types.ts +31 -0
- package/lib/components/VirtualList/utils.ts +169 -0
- package/lib/components/animations/ChevronAnimation/ChevronAnimation.tsx +128 -0
- package/lib/components/animations/ChevronAnimation/index.ts +3 -0
- package/lib/components/animations/ChevronAnimation/types.ts +32 -0
- package/lib/components/animations/ChevronAnimation/utils.ts +41 -0
- package/lib/components/animations/Ripple/RippleContainer.tsx +70 -0
- package/lib/components/animations/Ripple/index.ts +2 -0
- package/lib/components/common/Seperator.tsx +30 -0
- package/lib/components/common/TruncatedTextWithTooltip.tsx +120 -0
- package/lib/components/common/TruncatedTextWithTooltipV2/TruncatedTextWithTooltipV2.tsx +88 -0
- package/lib/components/common/TruncatedTextWithTooltipV2/index.ts +2 -0
- package/lib/components/common/TruncatedTextWithTooltipV2/types.ts +21 -0
- package/lib/components/common/TruncatedTextWithTooltipV2/utils.ts +6 -0
- package/lib/components/common/error.animations.ts +28 -0
- package/lib/components/common/index.ts +11 -0
- package/lib/components/common/useErrorShake.ts +20 -0
- package/lib/components/common/virtualViewport.ts +23 -0
- package/lib/components/shared/accessibility/AccessibilityDashboard.tsx +348 -0
- package/lib/components/shared/accessibility/LightHouse-components/AccordionLightHouse.tsx +328 -0
- package/lib/components/shared/accessibility/LightHouse-components/AlertLightHouse.tsx +371 -0
- package/lib/components/shared/accessibility/LightHouse-components/AvatarGroupLightHouse.tsx +386 -0
- package/lib/components/shared/accessibility/LightHouse-components/AvatarLightHouse.tsx +248 -0
- package/lib/components/shared/accessibility/LightHouse-components/BreadcrumbLightHouse.tsx +242 -0
- package/lib/components/shared/accessibility/LightHouse-components/ButtonGroupLightHouse.tsx +342 -0
- package/lib/components/shared/accessibility/LightHouse-components/ButtonLightHouse.tsx +185 -0
- package/lib/components/shared/accessibility/LightHouse-components/CardLightHouse.tsx +542 -0
- package/lib/components/shared/accessibility/LightHouse-components/ChartsLightHouse.tsx +349 -0
- package/lib/components/shared/accessibility/LightHouse-components/ChatInputLightHouse.tsx +231 -0
- package/lib/components/shared/accessibility/LightHouse-components/CheckboxLightHouse.tsx +236 -0
- package/lib/components/shared/accessibility/LightHouse-components/CodeBlockLightHouse.tsx +180 -0
- package/lib/components/shared/accessibility/LightHouse-components/DrawerLightHouse.tsx +254 -0
- package/lib/components/shared/accessibility/LightHouse-components/DropdownInputLightHouse.tsx +204 -0
- package/lib/components/shared/accessibility/LightHouse-components/KeyValuePairLightHouse.tsx +220 -0
- package/lib/components/shared/accessibility/LightHouse-components/MenuLightHouse.tsx +441 -0
- package/lib/components/shared/accessibility/LightHouse-components/ModalLightHouse.tsx +93 -0
- package/lib/components/shared/accessibility/LightHouse-components/MultiSelectLightHouse.tsx +308 -0
- package/lib/components/shared/accessibility/LightHouse-components/MultiValueInputLightHouse.tsx +144 -0
- package/lib/components/shared/accessibility/LightHouse-components/NumberInputLightHouse.tsx +106 -0
- package/lib/components/shared/accessibility/LightHouse-components/OTPInputLightHouse.tsx +97 -0
- package/lib/components/shared/accessibility/LightHouse-components/PopoverLightHouse.tsx +97 -0
- package/lib/components/shared/accessibility/LightHouse-components/ProgressBarLightHouse.tsx +280 -0
- package/lib/components/shared/accessibility/LightHouse-components/RadioLightHouse.tsx +322 -0
- package/lib/components/shared/accessibility/LightHouse-components/SearchInputLightHouse.tsx +195 -0
- package/lib/components/shared/accessibility/LightHouse-components/SidebarLightHouse.tsx +403 -0
- package/lib/components/shared/accessibility/LightHouse-components/SingleSelectLightHouse.tsx +278 -0
- package/lib/components/shared/accessibility/LightHouse-components/SliderLightHouse.tsx +284 -0
- package/lib/components/shared/accessibility/LightHouse-components/SnackbarLightHouse.tsx +35 -0
- package/lib/components/shared/accessibility/LightHouse-components/SplitTagLightHouse.tsx +357 -0
- package/lib/components/shared/accessibility/LightHouse-components/StatCardLightHouse.tsx +249 -0
- package/lib/components/shared/accessibility/LightHouse-components/StepperLightHouse.tsx +208 -0
- package/lib/components/shared/accessibility/LightHouse-components/SwitchLightHouse.tsx +355 -0
- package/lib/components/shared/accessibility/LightHouse-components/TabsLightHouse.tsx +339 -0
- package/lib/components/shared/accessibility/LightHouse-components/TagLightHouse.tsx +440 -0
- package/lib/components/shared/accessibility/LightHouse-components/TextAreaLightHouse.tsx +141 -0
- package/lib/components/shared/accessibility/LightHouse-components/TextInputLightHouse.tsx +95 -0
- package/lib/components/shared/accessibility/LightHouse-components/TooltipLightHouse.tsx +218 -0
- package/lib/components/shared/accessibility/LightHouse-components/UnitInputLightHouse.tsx +128 -0
- package/lib/components/shared/accessibility/LightHouse-components/UploadLightHouse.tsx +269 -0
- package/lib/components/shared/accessibility/index.ts +13 -0
- package/lib/components/shared/accessibility/reportGenerator.ts +522 -0
- package/lib/components/shared/accessibility/storybookParser.ts +93 -0
- package/lib/components/shared/accessibility/testResultsParser.ts +75 -0
- package/lib/context/ShadowAware.tsx +52 -0
- package/lib/context/ThemeContext.tsx +436 -0
- package/lib/context/ThemeProvider.tsx +59 -0
- package/lib/context/index.ts +6 -0
- package/lib/context/initComponentTokens.ts +271 -0
- package/lib/context/theme.enum.ts +4 -0
- package/lib/context/useComponentToken.ts +322 -0
- package/lib/global-utils/GlobalUtils.ts +130 -0
- package/lib/hooks/index.ts +8 -0
- package/lib/hooks/useBreakPoints.ts +48 -0
- package/lib/hooks/useClickOutside.ts +30 -0
- package/lib/hooks/useDebounce.ts +19 -0
- package/lib/hooks/useDropdownInteractionLock.ts +226 -0
- package/lib/hooks/useInputSlotPadding.ts +50 -0
- package/lib/hooks/usePreventParentScroll.ts +37 -0
- package/lib/hooks/useResizeObserver.ts +33 -0
- package/lib/hooks/useResponsiveTokens.ts +26 -0
- package/lib/hooks/useRipple.ts +74 -0
- package/lib/hooks/useScrollLock.ts +174 -0
- package/lib/hooks/useSectionScroll.ts +90 -0
- package/lib/hooks/useTruncationDetection.ts +87 -0
- package/lib/main.ts +321 -0
- package/lib/node.ts +39 -0
- package/lib/pollyfills/resizeObserverPollyfill.ts +35 -0
- package/lib/token-engine-server.ts +95 -0
- package/lib/token-engine.ts +105 -0
- package/lib/tokens/border.tokens.ts +58 -0
- package/lib/tokens/color.tokens.ts +116 -0
- package/lib/tokens/font.tokens.ts +312 -0
- package/lib/tokens/index.ts +2 -0
- package/lib/tokens/opacity.tokens.ts +34 -0
- package/lib/tokens/shadows.tokens.ts +28 -0
- package/lib/tokens/theme.token.ts +29 -0
- package/lib/tokens/unit.tokens.ts +101 -0
- package/lib/tokens/zIndex.tokens.ts +25 -0
- package/lib/utils/accessibility/aria-helpers.ts +317 -0
- package/lib/utils/accessibility/focus-helpers.ts +226 -0
- package/lib/utils/accessibility/icon-helpers.ts +25 -0
- package/lib/utils/accessibility/index.ts +25 -0
- package/lib/utils/accessibility/keyboard-helpers.ts +342 -0
- package/lib/utils/accessibility/visually-hidden.tsx +45 -0
- package/lib/utils/prop-helpers.ts +10 -0
- package/package.json +17 -3
- package/dist/assets/main.css +0 -1
|
@@ -0,0 +1,2052 @@
|
|
|
1
|
+
import {
|
|
2
|
+
useState,
|
|
3
|
+
useEffect,
|
|
4
|
+
useMemo,
|
|
5
|
+
forwardRef,
|
|
6
|
+
useRef,
|
|
7
|
+
useId,
|
|
8
|
+
useCallback,
|
|
9
|
+
} from 'react'
|
|
10
|
+
import {
|
|
11
|
+
DndContext,
|
|
12
|
+
closestCenter,
|
|
13
|
+
KeyboardSensor,
|
|
14
|
+
PointerSensor,
|
|
15
|
+
useSensor,
|
|
16
|
+
useSensors,
|
|
17
|
+
DragEndEvent,
|
|
18
|
+
DragOverlay,
|
|
19
|
+
} from '@dnd-kit/core'
|
|
20
|
+
import {
|
|
21
|
+
arrayMove,
|
|
22
|
+
SortableContext,
|
|
23
|
+
sortableKeyboardCoordinates,
|
|
24
|
+
horizontalListSortingStrategy,
|
|
25
|
+
} from '@dnd-kit/sortable'
|
|
26
|
+
import PrimitiveText from '../Primitives/PrimitiveText/PrimitiveText'
|
|
27
|
+
import {
|
|
28
|
+
DataTableProps,
|
|
29
|
+
SortDirection,
|
|
30
|
+
SortConfig,
|
|
31
|
+
ColumnDefinition,
|
|
32
|
+
SearchConfig,
|
|
33
|
+
ColumnFilter,
|
|
34
|
+
FilterType,
|
|
35
|
+
ColumnType,
|
|
36
|
+
RowActionsConfig,
|
|
37
|
+
} from './types'
|
|
38
|
+
import { TableTokenType } from './dataTable.tokens'
|
|
39
|
+
import {
|
|
40
|
+
sortData,
|
|
41
|
+
searchData,
|
|
42
|
+
applyColumnFilters,
|
|
43
|
+
updateColumnFilter,
|
|
44
|
+
exportSelectedRowsToCSV,
|
|
45
|
+
getSelectedRowCount,
|
|
46
|
+
createSearchConfig,
|
|
47
|
+
clearAllFiltersAndSearch,
|
|
48
|
+
getColumnStyles,
|
|
49
|
+
} from './utils'
|
|
50
|
+
import DataTableHeader from './DataTableHeader'
|
|
51
|
+
import TableHeader from './TableHeader'
|
|
52
|
+
import TableBodyComponent from './TableBody'
|
|
53
|
+
import TableFooter from './TableFooter'
|
|
54
|
+
import BulkActionBar from './TableBody/BulkActionBar'
|
|
55
|
+
import Block from '../Primitives/Block/Block'
|
|
56
|
+
import Button from '../Button/Button'
|
|
57
|
+
import { ButtonSize, ButtonType } from '../Button/types'
|
|
58
|
+
import { Settings, Check, Loader2 } from 'lucide-react'
|
|
59
|
+
import Menu from '../Menu/Menu'
|
|
60
|
+
import { MenuGroupType, MenuAlignment } from '../Menu/types'
|
|
61
|
+
|
|
62
|
+
import { useMobileDataTable } from './hooks/useMobileDataTable'
|
|
63
|
+
import MobileColumnDrawer from './MobileColumnDrawer'
|
|
64
|
+
import { useResponsiveTokens } from '../../hooks/useResponsiveTokens'
|
|
65
|
+
import styled from 'styled-components'
|
|
66
|
+
import { FOUNDATION_THEME } from '../../tokens'
|
|
67
|
+
|
|
68
|
+
const ScrollableContainer = styled(Block)`
|
|
69
|
+
overflow-x: auto;
|
|
70
|
+
scroll-behavior: smooth;
|
|
71
|
+
-webkit-overflow-scrolling: touch;
|
|
72
|
+
|
|
73
|
+
/* Hide scrollbars for Chrome, Safari and Opera */
|
|
74
|
+
&::-webkit-scrollbar {
|
|
75
|
+
display: none;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/* Hide scrollbar for IE, Edge and Firefox */
|
|
79
|
+
-ms-overflow-style: none;
|
|
80
|
+
scrollbar-width: none;
|
|
81
|
+
`
|
|
82
|
+
|
|
83
|
+
const DataTable = forwardRef(
|
|
84
|
+
<T extends Record<string, unknown>>(
|
|
85
|
+
{
|
|
86
|
+
data,
|
|
87
|
+
columns: initialColumns,
|
|
88
|
+
idField,
|
|
89
|
+
title,
|
|
90
|
+
description,
|
|
91
|
+
descriptionTooltipProps,
|
|
92
|
+
defaultSort,
|
|
93
|
+
enableSearch = false,
|
|
94
|
+
searchPlaceholder = 'Search...',
|
|
95
|
+
enableFiltering = false,
|
|
96
|
+
enableAdvancedFilter = false,
|
|
97
|
+
advancedFilterComponent,
|
|
98
|
+
advancedFilters = [],
|
|
99
|
+
columnFreeze = 0,
|
|
100
|
+
columnFreezeRight = 0,
|
|
101
|
+
serverSideSearch = false,
|
|
102
|
+
serverSideFiltering = false,
|
|
103
|
+
serverSidePagination = false,
|
|
104
|
+
isLoading = false,
|
|
105
|
+
enableColumnManager = true,
|
|
106
|
+
enableColumnReordering = false,
|
|
107
|
+
onColumnReorder,
|
|
108
|
+
columnManagerMaxSelections,
|
|
109
|
+
columnManagerAlwaysSelected,
|
|
110
|
+
columnManagerPrimaryAction,
|
|
111
|
+
columnManagerSecondaryAction,
|
|
112
|
+
columnManagerWidth,
|
|
113
|
+
showHeader = true,
|
|
114
|
+
showToolbar = true,
|
|
115
|
+
showSettings = false,
|
|
116
|
+
showFooter = true,
|
|
117
|
+
enableInlineEdit = false,
|
|
118
|
+
enableRowExpansion = false,
|
|
119
|
+
enableRowSelection = false,
|
|
120
|
+
rowSelectionConfig,
|
|
121
|
+
showBulkActionBar = true,
|
|
122
|
+
onRowSelectionChange,
|
|
123
|
+
renderExpandedRow,
|
|
124
|
+
isRowExpandable,
|
|
125
|
+
showSkeleton = false,
|
|
126
|
+
skeletonVariant = 'pulse',
|
|
127
|
+
isRowLoading,
|
|
128
|
+
pagination = {
|
|
129
|
+
currentPage: 1,
|
|
130
|
+
pageSize: 10,
|
|
131
|
+
totalRows: 0,
|
|
132
|
+
pageSizeOptions: [10, 20, 50, 100],
|
|
133
|
+
},
|
|
134
|
+
onPageChange,
|
|
135
|
+
onPageSizeChange,
|
|
136
|
+
onSortChange,
|
|
137
|
+
onSearchChange,
|
|
138
|
+
onFilterChange,
|
|
139
|
+
onAdvancedFiltersChange,
|
|
140
|
+
onRowSave,
|
|
141
|
+
onRowCancel,
|
|
142
|
+
onRowExpansionChange,
|
|
143
|
+
onRowClick,
|
|
144
|
+
onFieldChange,
|
|
145
|
+
headerSlot1,
|
|
146
|
+
headerSlot2,
|
|
147
|
+
bulkActions,
|
|
148
|
+
rowActions,
|
|
149
|
+
onOperations,
|
|
150
|
+
onInsertLeft,
|
|
151
|
+
onInsertRight,
|
|
152
|
+
onDeleteColumn,
|
|
153
|
+
getRowStyle,
|
|
154
|
+
tableBodyHeight,
|
|
155
|
+
mobileColumnsToShow,
|
|
156
|
+
...rest
|
|
157
|
+
}: DataTableProps<T>,
|
|
158
|
+
ref: React.Ref<HTMLDivElement>
|
|
159
|
+
) => {
|
|
160
|
+
const tableToken = useResponsiveTokens<TableTokenType>('TABLE')
|
|
161
|
+
const mobileConfig = useMobileDataTable(mobileColumnsToShow)
|
|
162
|
+
const scrollContainerRef = useRef<HTMLDivElement>(null)
|
|
163
|
+
const tableContainerRef = useRef<HTMLDivElement>(null)
|
|
164
|
+
const [isNarrowContainer, setIsNarrowContainer] =
|
|
165
|
+
useState<boolean>(false)
|
|
166
|
+
const tableId = useId()
|
|
167
|
+
const tableLabelId = title ? `${tableId}-label` : undefined
|
|
168
|
+
const tableDescriptionId = description
|
|
169
|
+
? `${tableId}-description`
|
|
170
|
+
: undefined
|
|
171
|
+
const statusRegionId = `${tableId}-status`
|
|
172
|
+
|
|
173
|
+
const [sortConfig, setSortConfig] = useState<SortConfig | null>(
|
|
174
|
+
defaultSort || null
|
|
175
|
+
)
|
|
176
|
+
const [visibleColumns, setVisibleColumns] = useState<
|
|
177
|
+
ColumnDefinition<T>[]
|
|
178
|
+
>(() => {
|
|
179
|
+
const allVisibleColumns = initialColumns.filter(
|
|
180
|
+
(col) => col.isVisible !== false
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
if (columnManagerMaxSelections && columnManagerAlwaysSelected) {
|
|
184
|
+
const alwaysSelectedFields = columnManagerAlwaysSelected.map(
|
|
185
|
+
(field) => String(field)
|
|
186
|
+
)
|
|
187
|
+
const alwaysSelectedCols = allVisibleColumns.filter((col) =>
|
|
188
|
+
alwaysSelectedFields.includes(String(col.field))
|
|
189
|
+
)
|
|
190
|
+
const selectableCols = allVisibleColumns.filter(
|
|
191
|
+
(col) => !alwaysSelectedFields.includes(String(col.field))
|
|
192
|
+
)
|
|
193
|
+
|
|
194
|
+
const maxSelectableCount =
|
|
195
|
+
columnManagerMaxSelections - alwaysSelectedCols.length
|
|
196
|
+
const limitedSelectableCols = selectableCols.slice(
|
|
197
|
+
0,
|
|
198
|
+
Math.max(0, maxSelectableCount)
|
|
199
|
+
)
|
|
200
|
+
|
|
201
|
+
return [...alwaysSelectedCols, ...limitedSelectableCols]
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
return allVisibleColumns
|
|
205
|
+
})
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
const existingVisibleKeys = new Set(
|
|
208
|
+
visibleColumns.map((c) => c.field)
|
|
209
|
+
)
|
|
210
|
+
|
|
211
|
+
const updatedVisibleColumns: ColumnDefinition<T>[] = []
|
|
212
|
+
|
|
213
|
+
visibleColumns.forEach((col) => {
|
|
214
|
+
const matchingColumn = initialColumns.find(
|
|
215
|
+
(item) => item.field === col.field
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
if (matchingColumn) {
|
|
219
|
+
if (matchingColumn.isVisible !== false) {
|
|
220
|
+
const updatedColumn = {
|
|
221
|
+
...col,
|
|
222
|
+
...matchingColumn,
|
|
223
|
+
} as ColumnDefinition<T>
|
|
224
|
+
updatedVisibleColumns.push(updatedColumn)
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
const newColumns = initialColumns.filter(
|
|
230
|
+
(col) =>
|
|
231
|
+
!existingVisibleKeys.has(col.field) &&
|
|
232
|
+
col.isVisible !== false
|
|
233
|
+
)
|
|
234
|
+
|
|
235
|
+
newColumns.forEach((newCol) => {
|
|
236
|
+
const initialIndex = initialColumns.findIndex(
|
|
237
|
+
(c) => c.field === newCol.field
|
|
238
|
+
)
|
|
239
|
+
const insertIndex = Math.min(
|
|
240
|
+
initialIndex,
|
|
241
|
+
updatedVisibleColumns.length
|
|
242
|
+
)
|
|
243
|
+
updatedVisibleColumns.splice(insertIndex, 0, newCol)
|
|
244
|
+
})
|
|
245
|
+
|
|
246
|
+
const hasChanges =
|
|
247
|
+
visibleColumns.length !== updatedVisibleColumns.length ||
|
|
248
|
+
updatedVisibleColumns.some((updatedCol, index) => {
|
|
249
|
+
const originalCol = visibleColumns[index]
|
|
250
|
+
if (!originalCol) return true
|
|
251
|
+
if (updatedCol.field !== originalCol.field) return true
|
|
252
|
+
|
|
253
|
+
return (
|
|
254
|
+
updatedCol.headerSubtext !==
|
|
255
|
+
originalCol.headerSubtext ||
|
|
256
|
+
updatedCol.header !== originalCol.header ||
|
|
257
|
+
(updatedCol.type === ColumnType.CUSTOM &&
|
|
258
|
+
updatedCol.renderCell !== originalCol.renderCell)
|
|
259
|
+
)
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
if (hasChanges) {
|
|
263
|
+
setVisibleColumns(updatedVisibleColumns)
|
|
264
|
+
}
|
|
265
|
+
}, [initialColumns])
|
|
266
|
+
|
|
267
|
+
const [previousColumnCount, setPreviousColumnCount] = useState<number>(
|
|
268
|
+
() => initialColumns.filter((col) => col.isVisible !== false).length
|
|
269
|
+
)
|
|
270
|
+
const [currentPage, setCurrentPage] = useState<number>(
|
|
271
|
+
pagination?.currentPage || 1
|
|
272
|
+
)
|
|
273
|
+
const [pageSize, setPageSize] = useState<number>(
|
|
274
|
+
pagination?.pageSize || 10
|
|
275
|
+
)
|
|
276
|
+
|
|
277
|
+
useEffect(() => {
|
|
278
|
+
if (serverSidePagination && pagination) {
|
|
279
|
+
if (pagination.currentPage !== currentPage) {
|
|
280
|
+
setCurrentPage(pagination.currentPage)
|
|
281
|
+
}
|
|
282
|
+
if (pagination.pageSize !== pageSize) {
|
|
283
|
+
setPageSize(pagination.pageSize)
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}, [
|
|
287
|
+
serverSidePagination,
|
|
288
|
+
pagination?.currentPage,
|
|
289
|
+
pagination?.pageSize,
|
|
290
|
+
currentPage,
|
|
291
|
+
pageSize,
|
|
292
|
+
])
|
|
293
|
+
|
|
294
|
+
const [selectedRows, setSelectedRows] = useState<
|
|
295
|
+
Record<string, boolean>
|
|
296
|
+
>({})
|
|
297
|
+
const [selectAll, setSelectAll] = useState<boolean | 'indeterminate'>(
|
|
298
|
+
false
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
const [searchConfig, setSearchConfig] = useState<SearchConfig>({
|
|
302
|
+
query: '',
|
|
303
|
+
caseSensitive: false,
|
|
304
|
+
})
|
|
305
|
+
const [columnFilters, setColumnFilters] = useState<ColumnFilter[]>([])
|
|
306
|
+
|
|
307
|
+
const [editingRows, setEditingRows] = useState<Record<string, boolean>>(
|
|
308
|
+
{}
|
|
309
|
+
)
|
|
310
|
+
const [editValues, setEditValues] = useState<Record<string, T>>({})
|
|
311
|
+
|
|
312
|
+
const [expandedRows, setExpandedRows] = useState<
|
|
313
|
+
Record<string, boolean>
|
|
314
|
+
>({})
|
|
315
|
+
|
|
316
|
+
const [isFormatEnabled, setIsFormatEnabled] = useState<boolean>(true)
|
|
317
|
+
|
|
318
|
+
const [mobileDrawerOpen, setMobileDrawerOpen] = useState<boolean>(false)
|
|
319
|
+
const [selectedRowForDrawer, setSelectedRowForDrawer] =
|
|
320
|
+
useState<T | null>(null)
|
|
321
|
+
const [selectedRowIndexForDrawer, setSelectedRowIndexForDrawer] =
|
|
322
|
+
useState<number>(-1)
|
|
323
|
+
|
|
324
|
+
const [internalLoading, setInternalLoading] = useState<boolean>(false)
|
|
325
|
+
|
|
326
|
+
useEffect(() => {
|
|
327
|
+
if (serverSidePagination && !isLoading && internalLoading) {
|
|
328
|
+
setInternalLoading(false)
|
|
329
|
+
}
|
|
330
|
+
}, [serverSidePagination, isLoading, internalLoading])
|
|
331
|
+
|
|
332
|
+
const [activeId, setActiveId] = useState<string | null>(null)
|
|
333
|
+
const lastReorderedColumnsRef = useRef<ColumnDefinition<T>[] | null>(
|
|
334
|
+
null
|
|
335
|
+
)
|
|
336
|
+
const [focusedCell, setFocusedCell] = useState<{
|
|
337
|
+
rowIndex: number
|
|
338
|
+
colIndex: number
|
|
339
|
+
} | null>(null)
|
|
340
|
+
const [measuredFrozenWidths, setMeasuredFrozenWidths] = useState<
|
|
341
|
+
number[]
|
|
342
|
+
>([])
|
|
343
|
+
|
|
344
|
+
const sensors = useSensors(
|
|
345
|
+
useSensor(PointerSensor),
|
|
346
|
+
useSensor(KeyboardSensor, {
|
|
347
|
+
coordinateGetter: sortableKeyboardCoordinates,
|
|
348
|
+
})
|
|
349
|
+
)
|
|
350
|
+
|
|
351
|
+
const handleDragStart = (event: DragEndEvent) => {
|
|
352
|
+
setActiveId(event.active.id as string)
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
const handleDragOver = (event: DragEndEvent) => {
|
|
356
|
+
const { active, over } = event
|
|
357
|
+
|
|
358
|
+
if (over && active.id !== over.id) {
|
|
359
|
+
const oldIndex = visibleColumns.findIndex(
|
|
360
|
+
(col) => String(col.field) === active.id
|
|
361
|
+
)
|
|
362
|
+
const newIndex = visibleColumns.findIndex(
|
|
363
|
+
(col) => String(col.field) === over.id
|
|
364
|
+
)
|
|
365
|
+
|
|
366
|
+
if (
|
|
367
|
+
oldIndex !== -1 &&
|
|
368
|
+
newIndex !== -1 &&
|
|
369
|
+
oldIndex >= columnFreeze &&
|
|
370
|
+
newIndex >= columnFreeze
|
|
371
|
+
) {
|
|
372
|
+
const reorderedColumns = arrayMove(
|
|
373
|
+
visibleColumns,
|
|
374
|
+
oldIndex,
|
|
375
|
+
newIndex
|
|
376
|
+
)
|
|
377
|
+
setVisibleColumns(reorderedColumns)
|
|
378
|
+
lastReorderedColumnsRef.current = reorderedColumns
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
|
|
383
|
+
const handleDragEnd = (event: DragEndEvent) => {
|
|
384
|
+
const { active, over } = event
|
|
385
|
+
|
|
386
|
+
if (over && active.id !== over.id) {
|
|
387
|
+
const oldIndex = visibleColumns.findIndex(
|
|
388
|
+
(col) => String(col.field) === active.id
|
|
389
|
+
)
|
|
390
|
+
const newIndex = visibleColumns.findIndex(
|
|
391
|
+
(col) => String(col.field) === over.id
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
if (
|
|
395
|
+
oldIndex !== -1 &&
|
|
396
|
+
newIndex !== -1 &&
|
|
397
|
+
oldIndex >= columnFreeze &&
|
|
398
|
+
newIndex >= columnFreeze
|
|
399
|
+
) {
|
|
400
|
+
const reorderedColumns = arrayMove(
|
|
401
|
+
visibleColumns,
|
|
402
|
+
oldIndex,
|
|
403
|
+
newIndex
|
|
404
|
+
)
|
|
405
|
+
onColumnReorder?.(reorderedColumns as ColumnDefinition<T>[])
|
|
406
|
+
}
|
|
407
|
+
} else if (lastReorderedColumnsRef.current) {
|
|
408
|
+
onColumnReorder?.(
|
|
409
|
+
lastReorderedColumnsRef.current as ColumnDefinition<T>[]
|
|
410
|
+
)
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
lastReorderedColumnsRef.current = null
|
|
414
|
+
setActiveId(null)
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
const handleDragCancel = () => {
|
|
418
|
+
setActiveId(null)
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const columnIds = visibleColumns
|
|
422
|
+
.filter((_, index) => index >= columnFreeze)
|
|
423
|
+
.map((col) => String(col.field))
|
|
424
|
+
|
|
425
|
+
const effectiveColumnFreeze = mobileConfig.disableColumnFreeze
|
|
426
|
+
? 0
|
|
427
|
+
: columnFreeze
|
|
428
|
+
const effectiveEnableColumnManager = mobileConfig.hideColumnManager
|
|
429
|
+
? false
|
|
430
|
+
: enableColumnManager
|
|
431
|
+
|
|
432
|
+
const { mobileVisibleColumns, mobileOverflowColumns } = useMemo(() => {
|
|
433
|
+
if (!mobileConfig.enableColumnOverflow) {
|
|
434
|
+
return {
|
|
435
|
+
mobileVisibleColumns: visibleColumns,
|
|
436
|
+
mobileOverflowColumns: [],
|
|
437
|
+
}
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const visible = visibleColumns.slice(
|
|
441
|
+
0,
|
|
442
|
+
mobileConfig.maxVisibleColumns
|
|
443
|
+
)
|
|
444
|
+
const overflow = visibleColumns.slice(
|
|
445
|
+
mobileConfig.maxVisibleColumns
|
|
446
|
+
)
|
|
447
|
+
|
|
448
|
+
return {
|
|
449
|
+
mobileVisibleColumns: visible,
|
|
450
|
+
mobileOverflowColumns: overflow,
|
|
451
|
+
}
|
|
452
|
+
}, [
|
|
453
|
+
visibleColumns,
|
|
454
|
+
mobileConfig.enableColumnOverflow,
|
|
455
|
+
mobileConfig.maxVisibleColumns,
|
|
456
|
+
])
|
|
457
|
+
|
|
458
|
+
const effectiveVisibleColumns = mobileConfig.enableColumnOverflow
|
|
459
|
+
? mobileVisibleColumns
|
|
460
|
+
: visibleColumns
|
|
461
|
+
|
|
462
|
+
// Calculate minimum height for empty state based on page size
|
|
463
|
+
// This ensures consistent height whether data is present or not
|
|
464
|
+
const emptyStateMinHeight = useMemo(() => {
|
|
465
|
+
if (tableBodyHeight) {
|
|
466
|
+
return '400px'
|
|
467
|
+
}
|
|
468
|
+
// Use fixed heights based on page size ranges
|
|
469
|
+
// 5 rows/page → 300px
|
|
470
|
+
// 10+ rows/page → 600px
|
|
471
|
+
return pageSize <= 5 ? '300px' : '600px'
|
|
472
|
+
}, [pageSize, tableBodyHeight])
|
|
473
|
+
|
|
474
|
+
const formatOptions: MenuGroupType[] = [
|
|
475
|
+
{
|
|
476
|
+
items: [
|
|
477
|
+
{
|
|
478
|
+
label: 'Format',
|
|
479
|
+
slot3: isFormatEnabled ? <Check size={16} /> : null,
|
|
480
|
+
onClick: () => setIsFormatEnabled(!isFormatEnabled),
|
|
481
|
+
},
|
|
482
|
+
],
|
|
483
|
+
showSeparator: false,
|
|
484
|
+
},
|
|
485
|
+
]
|
|
486
|
+
|
|
487
|
+
const removeNumberFormatting = (value: unknown): string => {
|
|
488
|
+
if (value == null) return ''
|
|
489
|
+
|
|
490
|
+
const stringValue = String(value)
|
|
491
|
+
|
|
492
|
+
let cleaned = stringValue.replace(/[$€£¥₹₽₪₩₦₡₵₸₴₺₻₼₽¢]/g, '')
|
|
493
|
+
|
|
494
|
+
cleaned = cleaned.replace(/%/g, '')
|
|
495
|
+
|
|
496
|
+
cleaned = cleaned.replace(/,/g, '')
|
|
497
|
+
|
|
498
|
+
cleaned = cleaned.trim()
|
|
499
|
+
|
|
500
|
+
const numericValue = parseFloat(cleaned)
|
|
501
|
+
if (!isNaN(numericValue)) {
|
|
502
|
+
return numericValue.toString()
|
|
503
|
+
}
|
|
504
|
+
|
|
505
|
+
return stringValue
|
|
506
|
+
}
|
|
507
|
+
|
|
508
|
+
const getDisplayValue = (
|
|
509
|
+
value: unknown,
|
|
510
|
+
column: ColumnDefinition<T>
|
|
511
|
+
): unknown => {
|
|
512
|
+
if (
|
|
513
|
+
!isFormatEnabled &&
|
|
514
|
+
(column.type === ColumnType.NUMBER ||
|
|
515
|
+
(typeof value === 'string' &&
|
|
516
|
+
/[$€£¥₹₽₪₩₦₡₵₸₴₺₻₼₽¢%,\d]/.test(value)))
|
|
517
|
+
) {
|
|
518
|
+
return removeNumberFormatting(value)
|
|
519
|
+
}
|
|
520
|
+
return value
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
const processedData = useMemo(() => {
|
|
524
|
+
let result = [...data]
|
|
525
|
+
|
|
526
|
+
if (serverSidePagination) {
|
|
527
|
+
return result
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
if (
|
|
531
|
+
enableSearch &&
|
|
532
|
+
!serverSideSearch &&
|
|
533
|
+
searchConfig.query.trim()
|
|
534
|
+
) {
|
|
535
|
+
result = searchData(result, searchConfig, visibleColumns)
|
|
536
|
+
}
|
|
537
|
+
|
|
538
|
+
if (
|
|
539
|
+
enableFiltering &&
|
|
540
|
+
!serverSideFiltering &&
|
|
541
|
+
columnFilters.length > 0
|
|
542
|
+
) {
|
|
543
|
+
result = applyColumnFilters(result, columnFilters)
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
if (sortConfig && sortConfig.field) {
|
|
547
|
+
result = sortData(result, sortConfig, visibleColumns)
|
|
548
|
+
}
|
|
549
|
+
|
|
550
|
+
return result
|
|
551
|
+
}, [
|
|
552
|
+
data,
|
|
553
|
+
searchConfig,
|
|
554
|
+
columnFilters,
|
|
555
|
+
sortConfig,
|
|
556
|
+
visibleColumns,
|
|
557
|
+
enableSearch,
|
|
558
|
+
enableFiltering,
|
|
559
|
+
serverSideSearch,
|
|
560
|
+
serverSideFiltering,
|
|
561
|
+
serverSidePagination,
|
|
562
|
+
])
|
|
563
|
+
|
|
564
|
+
const totalRows = useMemo(() => {
|
|
565
|
+
if (
|
|
566
|
+
serverSidePagination ||
|
|
567
|
+
serverSideSearch ||
|
|
568
|
+
serverSideFiltering
|
|
569
|
+
) {
|
|
570
|
+
return pagination?.totalRows || data.length
|
|
571
|
+
}
|
|
572
|
+
return processedData.length
|
|
573
|
+
}, [
|
|
574
|
+
serverSidePagination,
|
|
575
|
+
serverSideSearch,
|
|
576
|
+
serverSideFiltering,
|
|
577
|
+
pagination?.totalRows,
|
|
578
|
+
data.length,
|
|
579
|
+
processedData.length,
|
|
580
|
+
])
|
|
581
|
+
|
|
582
|
+
useEffect(() => {
|
|
583
|
+
if (
|
|
584
|
+
!serverSidePagination &&
|
|
585
|
+
!serverSideSearch &&
|
|
586
|
+
!serverSideFiltering
|
|
587
|
+
) {
|
|
588
|
+
const totalPages = Math.ceil(totalRows / pageSize)
|
|
589
|
+
if (currentPage > totalPages && totalPages > 0) {
|
|
590
|
+
setCurrentPage(1)
|
|
591
|
+
}
|
|
592
|
+
}
|
|
593
|
+
}, [
|
|
594
|
+
totalRows,
|
|
595
|
+
pageSize,
|
|
596
|
+
currentPage,
|
|
597
|
+
serverSidePagination,
|
|
598
|
+
serverSideSearch,
|
|
599
|
+
serverSideFiltering,
|
|
600
|
+
])
|
|
601
|
+
|
|
602
|
+
useEffect(() => {
|
|
603
|
+
const container = tableContainerRef.current
|
|
604
|
+
if (!container) return
|
|
605
|
+
|
|
606
|
+
const updateContainerWidth = () => {
|
|
607
|
+
const width = container.clientWidth
|
|
608
|
+
setIsNarrowContainer(width < 640)
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
updateContainerWidth()
|
|
612
|
+
|
|
613
|
+
const resizeObserver = new ResizeObserver(updateContainerWidth)
|
|
614
|
+
resizeObserver.observe(container)
|
|
615
|
+
|
|
616
|
+
return () => {
|
|
617
|
+
resizeObserver.disconnect()
|
|
618
|
+
}
|
|
619
|
+
}, [])
|
|
620
|
+
|
|
621
|
+
const currentData = useMemo(() => {
|
|
622
|
+
if (
|
|
623
|
+
serverSideSearch ||
|
|
624
|
+
serverSideFiltering ||
|
|
625
|
+
serverSidePagination
|
|
626
|
+
) {
|
|
627
|
+
return processedData
|
|
628
|
+
}
|
|
629
|
+
|
|
630
|
+
const effectiveCurrentPage =
|
|
631
|
+
serverSidePagination && pagination
|
|
632
|
+
? pagination.currentPage
|
|
633
|
+
: currentPage
|
|
634
|
+
const effectivePageSize =
|
|
635
|
+
serverSidePagination && pagination
|
|
636
|
+
? pagination.pageSize
|
|
637
|
+
: pageSize
|
|
638
|
+
const startIndex = (effectiveCurrentPage - 1) * effectivePageSize
|
|
639
|
+
return processedData.slice(
|
|
640
|
+
startIndex,
|
|
641
|
+
startIndex + effectivePageSize
|
|
642
|
+
)
|
|
643
|
+
}, [
|
|
644
|
+
processedData,
|
|
645
|
+
currentPage,
|
|
646
|
+
pageSize,
|
|
647
|
+
serverSideSearch,
|
|
648
|
+
serverSideFiltering,
|
|
649
|
+
serverSidePagination,
|
|
650
|
+
pagination?.currentPage,
|
|
651
|
+
pagination?.pageSize,
|
|
652
|
+
])
|
|
653
|
+
|
|
654
|
+
const updateSelectAllState = (
|
|
655
|
+
selectedRowsState: Record<string, boolean>
|
|
656
|
+
) => {
|
|
657
|
+
const selectableRowIds = currentData
|
|
658
|
+
.map((row, index) => ({
|
|
659
|
+
row,
|
|
660
|
+
rowId: String(row[idField]),
|
|
661
|
+
index,
|
|
662
|
+
}))
|
|
663
|
+
.filter(
|
|
664
|
+
({ row, index }) =>
|
|
665
|
+
!(isRowDisabledFn && isRowDisabledFn(row, index))
|
|
666
|
+
)
|
|
667
|
+
.map(({ rowId }) => rowId)
|
|
668
|
+
|
|
669
|
+
const totalSelectableCount = selectableRowIds.length
|
|
670
|
+
|
|
671
|
+
if (totalSelectableCount === 0) {
|
|
672
|
+
setSelectAll(false)
|
|
673
|
+
return
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
const selectedCurrentPageRows = selectableRowIds.filter(
|
|
677
|
+
(rowId) => selectedRowsState[rowId]
|
|
678
|
+
)
|
|
679
|
+
|
|
680
|
+
if (selectedCurrentPageRows.length === 0) {
|
|
681
|
+
setSelectAll(false)
|
|
682
|
+
} else if (
|
|
683
|
+
selectedCurrentPageRows.length === totalSelectableCount
|
|
684
|
+
) {
|
|
685
|
+
setSelectAll(true)
|
|
686
|
+
} else {
|
|
687
|
+
setSelectAll('indeterminate')
|
|
688
|
+
}
|
|
689
|
+
}
|
|
690
|
+
|
|
691
|
+
useEffect(() => {
|
|
692
|
+
updateSelectAllState(selectedRows)
|
|
693
|
+
}, [currentData, selectedRows])
|
|
694
|
+
|
|
695
|
+
const hasMountedScrollRef = useRef(false)
|
|
696
|
+
useEffect(() => {
|
|
697
|
+
const currentColumnCount = visibleColumns.length
|
|
698
|
+
|
|
699
|
+
if (hasMountedScrollRef.current) {
|
|
700
|
+
const el = scrollContainerRef.current
|
|
701
|
+
const shouldScrollToEnd =
|
|
702
|
+
currentColumnCount > previousColumnCount &&
|
|
703
|
+
!!el &&
|
|
704
|
+
el.scrollWidth - (el.scrollLeft + el.clientWidth) < 16
|
|
705
|
+
|
|
706
|
+
if (shouldScrollToEnd) {
|
|
707
|
+
setTimeout(() => {
|
|
708
|
+
if (scrollContainerRef.current) {
|
|
709
|
+
scrollContainerRef.current.scrollLeft =
|
|
710
|
+
scrollContainerRef.current.scrollWidth
|
|
711
|
+
}
|
|
712
|
+
}, 100)
|
|
713
|
+
}
|
|
714
|
+
} else {
|
|
715
|
+
hasMountedScrollRef.current = true
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
setPreviousColumnCount(currentColumnCount)
|
|
719
|
+
}, [visibleColumns.length, previousColumnCount])
|
|
720
|
+
|
|
721
|
+
const handleSelectAll = (checked: boolean | 'indeterminate') => {
|
|
722
|
+
const newSelectAll = checked === true
|
|
723
|
+
|
|
724
|
+
const newSelectedRows = { ...selectedRows }
|
|
725
|
+
|
|
726
|
+
if (newSelectAll) {
|
|
727
|
+
currentData.forEach((row, index) => {
|
|
728
|
+
const rowId = String(row[idField])
|
|
729
|
+
// Only select rows that are not disabled
|
|
730
|
+
if (!(isRowDisabledFn && isRowDisabledFn(row, index))) {
|
|
731
|
+
newSelectedRows[rowId] = true
|
|
732
|
+
}
|
|
733
|
+
})
|
|
734
|
+
} else {
|
|
735
|
+
currentData.forEach((row) => {
|
|
736
|
+
const rowId = String(row[idField])
|
|
737
|
+
newSelectedRows[rowId] = false
|
|
738
|
+
})
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
setSelectedRows(newSelectedRows)
|
|
742
|
+
updateSelectAllState(newSelectedRows)
|
|
743
|
+
|
|
744
|
+
if (onRowSelectionChange) {
|
|
745
|
+
const selectedRowIds = Object.entries(newSelectedRows)
|
|
746
|
+
.filter(([, selected]) => selected)
|
|
747
|
+
.map(([id]) => id)
|
|
748
|
+
|
|
749
|
+
currentData.forEach((row) => {
|
|
750
|
+
const rowId = String(row[idField])
|
|
751
|
+
const wasSelected = selectedRows[rowId] || false
|
|
752
|
+
const isSelected = newSelectedRows[rowId] || false
|
|
753
|
+
|
|
754
|
+
if (wasSelected !== isSelected) {
|
|
755
|
+
const rawRowData = data.find(
|
|
756
|
+
(d) => String(d[idField]) === rowId
|
|
757
|
+
)
|
|
758
|
+
const rowDataToPass = (rawRowData || row) as T
|
|
759
|
+
|
|
760
|
+
onRowSelectionChange(
|
|
761
|
+
selectedRowIds,
|
|
762
|
+
isSelected,
|
|
763
|
+
rowId,
|
|
764
|
+
rowDataToPass
|
|
765
|
+
)
|
|
766
|
+
}
|
|
767
|
+
})
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
771
|
+
const isRowDisabledFn = rowSelectionConfig?.isDisabled
|
|
772
|
+
|
|
773
|
+
const handleRowSelect = (rowId: unknown, rowIndex?: number) => {
|
|
774
|
+
const rowIdStr = String(rowId)
|
|
775
|
+
|
|
776
|
+
// If no index provided, fall back to find (for backwards compatibility)
|
|
777
|
+
if (rowIndex === undefined) {
|
|
778
|
+
const row = currentData.find(
|
|
779
|
+
(r) => String(r[idField]) === rowIdStr
|
|
780
|
+
)
|
|
781
|
+
if (!row || (isRowDisabledFn && isRowDisabledFn(row, -1))) {
|
|
782
|
+
return
|
|
783
|
+
}
|
|
784
|
+
// Continue with the found row
|
|
785
|
+
const isSelected = !selectedRows[rowIdStr]
|
|
786
|
+
const newSelectedRows = {
|
|
787
|
+
...selectedRows,
|
|
788
|
+
[rowIdStr]: isSelected,
|
|
789
|
+
}
|
|
790
|
+
setSelectedRows(newSelectedRows)
|
|
791
|
+
updateSelectAllState(newSelectedRows)
|
|
792
|
+
|
|
793
|
+
if (onRowSelectionChange) {
|
|
794
|
+
const selectedRowIds = Object.entries(newSelectedRows)
|
|
795
|
+
.filter(([, selected]) => selected)
|
|
796
|
+
.map(([id]) => id)
|
|
797
|
+
|
|
798
|
+
const rawRowData = data.find(
|
|
799
|
+
(d) => String(d[idField]) === rowIdStr
|
|
800
|
+
)
|
|
801
|
+
const rowDataFromCurrent = currentData.find(
|
|
802
|
+
(row) => String(row[idField]) === rowIdStr
|
|
803
|
+
)
|
|
804
|
+
const rowDataToPass = (rawRowData ||
|
|
805
|
+
rowDataFromCurrent) as T
|
|
806
|
+
|
|
807
|
+
if (rowDataToPass) {
|
|
808
|
+
onRowSelectionChange(
|
|
809
|
+
selectedRowIds,
|
|
810
|
+
isSelected,
|
|
811
|
+
rowIdStr,
|
|
812
|
+
rowDataToPass
|
|
813
|
+
)
|
|
814
|
+
}
|
|
815
|
+
}
|
|
816
|
+
return
|
|
817
|
+
}
|
|
818
|
+
|
|
819
|
+
// Bounds check and use index directly instead of scanning
|
|
820
|
+
if (
|
|
821
|
+
rowIndex < 0 ||
|
|
822
|
+
rowIndex >= currentData.length ||
|
|
823
|
+
String(currentData[rowIndex][idField]) !== rowIdStr
|
|
824
|
+
) {
|
|
825
|
+
return
|
|
826
|
+
}
|
|
827
|
+
|
|
828
|
+
const row = currentData[rowIndex]
|
|
829
|
+
|
|
830
|
+
if (isRowDisabledFn && isRowDisabledFn(row, rowIndex)) {
|
|
831
|
+
return
|
|
832
|
+
}
|
|
833
|
+
|
|
834
|
+
const isSelected = !selectedRows[rowIdStr]
|
|
835
|
+
|
|
836
|
+
const newSelectedRows = {
|
|
837
|
+
...selectedRows,
|
|
838
|
+
[rowIdStr]: isSelected,
|
|
839
|
+
}
|
|
840
|
+
setSelectedRows(newSelectedRows)
|
|
841
|
+
|
|
842
|
+
updateSelectAllState(newSelectedRows)
|
|
843
|
+
|
|
844
|
+
if (onRowSelectionChange) {
|
|
845
|
+
const selectedRowIds = Object.entries(newSelectedRows)
|
|
846
|
+
.filter(([, selected]) => selected)
|
|
847
|
+
.map(([id]) => id)
|
|
848
|
+
|
|
849
|
+
const rawRowData = data.find(
|
|
850
|
+
(d) => String(d[idField]) === rowIdStr
|
|
851
|
+
)
|
|
852
|
+
const rowDataFromCurrent = currentData.find(
|
|
853
|
+
(row) => String(row[idField]) === rowIdStr
|
|
854
|
+
)
|
|
855
|
+
const rowDataToPass = (rawRowData || rowDataFromCurrent) as T
|
|
856
|
+
|
|
857
|
+
if (rowDataToPass) {
|
|
858
|
+
onRowSelectionChange(
|
|
859
|
+
selectedRowIds,
|
|
860
|
+
isSelected,
|
|
861
|
+
rowIdStr,
|
|
862
|
+
rowDataToPass
|
|
863
|
+
)
|
|
864
|
+
}
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
|
|
868
|
+
const exportToCSV = () => {
|
|
869
|
+
try {
|
|
870
|
+
const dataForExport = isFormatEnabled
|
|
871
|
+
? processedData
|
|
872
|
+
: processedData.map((row) => {
|
|
873
|
+
const formattedRow = { ...row } as Record<
|
|
874
|
+
string,
|
|
875
|
+
unknown
|
|
876
|
+
>
|
|
877
|
+
visibleColumns.forEach((column) => {
|
|
878
|
+
const fieldKey = String(column.field)
|
|
879
|
+
if (
|
|
880
|
+
column.type === ColumnType.NUMBER ||
|
|
881
|
+
(typeof formattedRow[fieldKey] === 'string' &&
|
|
882
|
+
/^[$€£¥₹₽₪₩₦₡₵₸₴₺₻₼₽¢%,\d.\s]+$/.test(
|
|
883
|
+
formattedRow[fieldKey]
|
|
884
|
+
))
|
|
885
|
+
) {
|
|
886
|
+
formattedRow[fieldKey] =
|
|
887
|
+
removeNumberFormatting(
|
|
888
|
+
formattedRow[fieldKey]
|
|
889
|
+
)
|
|
890
|
+
}
|
|
891
|
+
})
|
|
892
|
+
return formattedRow as T
|
|
893
|
+
})
|
|
894
|
+
|
|
895
|
+
exportSelectedRowsToCSV(
|
|
896
|
+
dataForExport,
|
|
897
|
+
selectedRows,
|
|
898
|
+
visibleColumns,
|
|
899
|
+
String(idField),
|
|
900
|
+
`${title || 'data'}-export-${new Date().toISOString().split('T')[0]}.csv`
|
|
901
|
+
)
|
|
902
|
+
} catch (error) {
|
|
903
|
+
alert(error instanceof Error ? error.message : 'Export failed')
|
|
904
|
+
}
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
const sortTimeoutRef = useRef<NodeJS.Timeout | null>(null)
|
|
908
|
+
|
|
909
|
+
const applySortConfig = (
|
|
910
|
+
field: keyof T,
|
|
911
|
+
newSortConfig: SortConfig | null
|
|
912
|
+
) => {
|
|
913
|
+
setSortConfig(newSortConfig)
|
|
914
|
+
|
|
915
|
+
if (onSortChange) {
|
|
916
|
+
if (sortTimeoutRef.current) {
|
|
917
|
+
clearTimeout(sortTimeoutRef.current)
|
|
918
|
+
}
|
|
919
|
+
|
|
920
|
+
sortTimeoutRef.current = setTimeout(() => {
|
|
921
|
+
if (newSortConfig) {
|
|
922
|
+
onSortChange(newSortConfig)
|
|
923
|
+
} else {
|
|
924
|
+
onSortChange({
|
|
925
|
+
field: field.toString(),
|
|
926
|
+
direction: SortDirection.NONE,
|
|
927
|
+
})
|
|
928
|
+
}
|
|
929
|
+
sortTimeoutRef.current = null
|
|
930
|
+
}, 10)
|
|
931
|
+
}
|
|
932
|
+
}
|
|
933
|
+
|
|
934
|
+
const handleSort = (field: keyof T, sortType?: string) => {
|
|
935
|
+
const column = visibleColumns.find((col) => col.field === field)
|
|
936
|
+
if (!column || column.isSortable === false) {
|
|
937
|
+
return
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
let direction: SortDirection
|
|
941
|
+
let newSortConfig: SortConfig | null
|
|
942
|
+
|
|
943
|
+
const isSameSort =
|
|
944
|
+
sortConfig?.field === field && sortConfig?.sortType === sortType
|
|
945
|
+
|
|
946
|
+
if (isSameSort) {
|
|
947
|
+
if (sortConfig.direction === SortDirection.ASCENDING) {
|
|
948
|
+
direction = SortDirection.DESCENDING
|
|
949
|
+
newSortConfig = {
|
|
950
|
+
field: field.toString(),
|
|
951
|
+
direction,
|
|
952
|
+
sortType,
|
|
953
|
+
}
|
|
954
|
+
} else if (sortConfig.direction === SortDirection.DESCENDING) {
|
|
955
|
+
direction = SortDirection.NONE
|
|
956
|
+
newSortConfig = null
|
|
957
|
+
} else {
|
|
958
|
+
direction = SortDirection.ASCENDING
|
|
959
|
+
newSortConfig = {
|
|
960
|
+
field: field.toString(),
|
|
961
|
+
direction,
|
|
962
|
+
sortType,
|
|
963
|
+
}
|
|
964
|
+
}
|
|
965
|
+
} else {
|
|
966
|
+
direction = SortDirection.ASCENDING
|
|
967
|
+
newSortConfig = {
|
|
968
|
+
field: field.toString(),
|
|
969
|
+
direction,
|
|
970
|
+
sortType,
|
|
971
|
+
}
|
|
972
|
+
}
|
|
973
|
+
|
|
974
|
+
applySortConfig(field, newSortConfig)
|
|
975
|
+
}
|
|
976
|
+
|
|
977
|
+
const handleSortAscending = (field: keyof T, sortType?: string) => {
|
|
978
|
+
const column = visibleColumns.find((col) => col.field === field)
|
|
979
|
+
if (!column || column.isSortable === false) {
|
|
980
|
+
return
|
|
981
|
+
}
|
|
982
|
+
|
|
983
|
+
const isCurrentlyAscending =
|
|
984
|
+
sortConfig?.field === field &&
|
|
985
|
+
sortConfig.direction === SortDirection.ASCENDING &&
|
|
986
|
+
sortConfig?.sortType === sortType
|
|
987
|
+
|
|
988
|
+
const newSortConfig = isCurrentlyAscending
|
|
989
|
+
? null
|
|
990
|
+
: {
|
|
991
|
+
field: field.toString(),
|
|
992
|
+
direction: SortDirection.ASCENDING,
|
|
993
|
+
sortType,
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
applySortConfig(field, newSortConfig)
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
const handleSortDescending = (field: keyof T, sortType?: string) => {
|
|
1000
|
+
const column = visibleColumns.find((col) => col.field === field)
|
|
1001
|
+
if (!column || column.isSortable === false) {
|
|
1002
|
+
return
|
|
1003
|
+
}
|
|
1004
|
+
|
|
1005
|
+
const isCurrentlyDescending =
|
|
1006
|
+
sortConfig?.field === field &&
|
|
1007
|
+
sortConfig.direction === SortDirection.DESCENDING &&
|
|
1008
|
+
sortConfig?.sortType === sortType
|
|
1009
|
+
|
|
1010
|
+
const newSortConfig = isCurrentlyDescending
|
|
1011
|
+
? null
|
|
1012
|
+
: {
|
|
1013
|
+
field: field.toString(),
|
|
1014
|
+
direction: SortDirection.DESCENDING,
|
|
1015
|
+
sortType,
|
|
1016
|
+
}
|
|
1017
|
+
|
|
1018
|
+
applySortConfig(field, newSortConfig)
|
|
1019
|
+
}
|
|
1020
|
+
|
|
1021
|
+
const handlePageChange = (page: number) => {
|
|
1022
|
+
if (page !== currentPage) {
|
|
1023
|
+
setCurrentPage(page)
|
|
1024
|
+
|
|
1025
|
+
if (serverSidePagination) {
|
|
1026
|
+
setInternalLoading(true)
|
|
1027
|
+
}
|
|
1028
|
+
|
|
1029
|
+
if (onPageChange) {
|
|
1030
|
+
onPageChange(page)
|
|
1031
|
+
}
|
|
1032
|
+
}
|
|
1033
|
+
}
|
|
1034
|
+
|
|
1035
|
+
const handlePageSizeChange = (size: number) => {
|
|
1036
|
+
if (size !== pageSize) {
|
|
1037
|
+
setPageSize(size)
|
|
1038
|
+
setCurrentPage(1)
|
|
1039
|
+
|
|
1040
|
+
if (serverSidePagination) {
|
|
1041
|
+
setInternalLoading(true)
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
if (onPageSizeChange) {
|
|
1045
|
+
onPageSizeChange(size)
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
const handleSearch = (query: string) => {
|
|
1051
|
+
const newSearchConfig = createSearchConfig(
|
|
1052
|
+
query,
|
|
1053
|
+
searchConfig.caseSensitive,
|
|
1054
|
+
searchConfig.searchFields
|
|
1055
|
+
)
|
|
1056
|
+
|
|
1057
|
+
setSearchConfig(newSearchConfig)
|
|
1058
|
+
setCurrentPage(1)
|
|
1059
|
+
|
|
1060
|
+
if (onSearchChange) {
|
|
1061
|
+
onSearchChange(newSearchConfig)
|
|
1062
|
+
}
|
|
1063
|
+
}
|
|
1064
|
+
|
|
1065
|
+
const handleColumnFilter = (
|
|
1066
|
+
field: string,
|
|
1067
|
+
type: FilterType,
|
|
1068
|
+
value: string | string[] | { min: number; max: number },
|
|
1069
|
+
operator:
|
|
1070
|
+
| 'equals'
|
|
1071
|
+
| 'contains'
|
|
1072
|
+
| 'startsWith'
|
|
1073
|
+
| 'endsWith'
|
|
1074
|
+
| 'gt'
|
|
1075
|
+
| 'lt'
|
|
1076
|
+
| 'gte'
|
|
1077
|
+
| 'lte'
|
|
1078
|
+
| 'range' = 'contains'
|
|
1079
|
+
) => {
|
|
1080
|
+
const updatedFilters = updateColumnFilter(
|
|
1081
|
+
columnFilters,
|
|
1082
|
+
field as keyof Record<string, unknown>,
|
|
1083
|
+
type,
|
|
1084
|
+
value,
|
|
1085
|
+
operator
|
|
1086
|
+
)
|
|
1087
|
+
|
|
1088
|
+
setColumnFilters(updatedFilters)
|
|
1089
|
+
setCurrentPage(1)
|
|
1090
|
+
|
|
1091
|
+
if (onFilterChange) {
|
|
1092
|
+
onFilterChange(updatedFilters)
|
|
1093
|
+
}
|
|
1094
|
+
}
|
|
1095
|
+
|
|
1096
|
+
const clearAllFilters = () => {
|
|
1097
|
+
const { searchConfig: clearedSearchConfig } =
|
|
1098
|
+
clearAllFiltersAndSearch()
|
|
1099
|
+
|
|
1100
|
+
setSearchConfig(clearedSearchConfig)
|
|
1101
|
+
setColumnFilters([])
|
|
1102
|
+
setCurrentPage(1)
|
|
1103
|
+
|
|
1104
|
+
if (onAdvancedFiltersChange) {
|
|
1105
|
+
onAdvancedFiltersChange([])
|
|
1106
|
+
}
|
|
1107
|
+
if (onSearchChange) {
|
|
1108
|
+
onSearchChange(clearedSearchConfig)
|
|
1109
|
+
}
|
|
1110
|
+
if (onFilterChange) {
|
|
1111
|
+
onFilterChange([])
|
|
1112
|
+
}
|
|
1113
|
+
}
|
|
1114
|
+
const selectedCount = getSelectedRowCount(selectedRows)
|
|
1115
|
+
|
|
1116
|
+
const handleDeselectAll = () => {
|
|
1117
|
+
const newSelectedRows = { ...selectedRows }
|
|
1118
|
+
currentData.forEach((row) => {
|
|
1119
|
+
const rowId = String(row[idField])
|
|
1120
|
+
newSelectedRows[rowId] = false
|
|
1121
|
+
})
|
|
1122
|
+
setSelectedRows({ ...newSelectedRows })
|
|
1123
|
+
setSelectAll(false)
|
|
1124
|
+
}
|
|
1125
|
+
|
|
1126
|
+
const renderBulkActions = () => {
|
|
1127
|
+
if (!bulkActions?.customActions) return null
|
|
1128
|
+
return bulkActions.customActions
|
|
1129
|
+
}
|
|
1130
|
+
|
|
1131
|
+
const getColumnWidth = (
|
|
1132
|
+
column: ColumnDefinition<T>
|
|
1133
|
+
): React.CSSProperties => {
|
|
1134
|
+
return getColumnStyles(column)
|
|
1135
|
+
}
|
|
1136
|
+
|
|
1137
|
+
const handleEditRow = (rowId: unknown) => {
|
|
1138
|
+
const rowIdStr = String(rowId)
|
|
1139
|
+
const row = currentData.find((r) => String(r[idField]) === rowIdStr)
|
|
1140
|
+
if (row) {
|
|
1141
|
+
setEditingRows((prev) => ({ ...prev, [rowIdStr]: true }))
|
|
1142
|
+
setEditValues((prev) => ({ ...prev, [rowIdStr]: { ...row } }))
|
|
1143
|
+
}
|
|
1144
|
+
}
|
|
1145
|
+
|
|
1146
|
+
const handleSaveRow = (rowId: unknown) => {
|
|
1147
|
+
const rowIdStr = String(rowId)
|
|
1148
|
+
const updatedRow = editValues[rowIdStr]
|
|
1149
|
+
if (updatedRow && onRowSave) {
|
|
1150
|
+
onRowSave(rowId, updatedRow)
|
|
1151
|
+
}
|
|
1152
|
+
setEditingRows((prev) => ({ ...prev, [rowIdStr]: false }))
|
|
1153
|
+
setEditValues((prev) => {
|
|
1154
|
+
const newValues = { ...prev }
|
|
1155
|
+
delete newValues[rowIdStr]
|
|
1156
|
+
return newValues
|
|
1157
|
+
})
|
|
1158
|
+
}
|
|
1159
|
+
|
|
1160
|
+
const handleCancelEdit = (rowId: unknown) => {
|
|
1161
|
+
const rowIdStr = String(rowId)
|
|
1162
|
+
if (onRowCancel) {
|
|
1163
|
+
onRowCancel(rowId)
|
|
1164
|
+
}
|
|
1165
|
+
setEditingRows((prev) => ({ ...prev, [rowIdStr]: false }))
|
|
1166
|
+
setEditValues((prev) => {
|
|
1167
|
+
const newValues = { ...prev }
|
|
1168
|
+
delete newValues[rowIdStr]
|
|
1169
|
+
return newValues
|
|
1170
|
+
})
|
|
1171
|
+
}
|
|
1172
|
+
|
|
1173
|
+
const handleFieldChange = (
|
|
1174
|
+
rowId: unknown,
|
|
1175
|
+
field: keyof T,
|
|
1176
|
+
value: unknown
|
|
1177
|
+
) => {
|
|
1178
|
+
const rowIdStr = String(rowId)
|
|
1179
|
+
|
|
1180
|
+
if (enableInlineEdit) {
|
|
1181
|
+
setEditValues((prev) => ({
|
|
1182
|
+
...prev,
|
|
1183
|
+
[rowIdStr]: {
|
|
1184
|
+
...prev[rowIdStr],
|
|
1185
|
+
[field]: value,
|
|
1186
|
+
},
|
|
1187
|
+
}))
|
|
1188
|
+
} else {
|
|
1189
|
+
if (onFieldChange) {
|
|
1190
|
+
onFieldChange(rowId, field, value)
|
|
1191
|
+
}
|
|
1192
|
+
}
|
|
1193
|
+
}
|
|
1194
|
+
|
|
1195
|
+
const handleRowExpand = (rowId: unknown) => {
|
|
1196
|
+
const rowIdStr = String(rowId)
|
|
1197
|
+
const isCurrentlyExpanded = expandedRows[rowIdStr]
|
|
1198
|
+
|
|
1199
|
+
const newExpandedRows: Record<string, boolean> = {}
|
|
1200
|
+
|
|
1201
|
+
if (!isCurrentlyExpanded) {
|
|
1202
|
+
newExpandedRows[rowIdStr] = true
|
|
1203
|
+
}
|
|
1204
|
+
|
|
1205
|
+
setExpandedRows(newExpandedRows)
|
|
1206
|
+
|
|
1207
|
+
if (onRowExpansionChange) {
|
|
1208
|
+
const rowData = currentData.find(
|
|
1209
|
+
(row) => row[idField] === rowId
|
|
1210
|
+
)
|
|
1211
|
+
if (rowData) {
|
|
1212
|
+
onRowExpansionChange(rowId, !isCurrentlyExpanded, rowData)
|
|
1213
|
+
}
|
|
1214
|
+
}
|
|
1215
|
+
}
|
|
1216
|
+
|
|
1217
|
+
const handleMobileOverflowClick = (row: T) => {
|
|
1218
|
+
const rowIndex = currentData.findIndex(
|
|
1219
|
+
(r) => r[idField] === row[idField]
|
|
1220
|
+
)
|
|
1221
|
+
setSelectedRowForDrawer(row)
|
|
1222
|
+
setSelectedRowIndexForDrawer(rowIndex)
|
|
1223
|
+
setMobileDrawerOpen(true)
|
|
1224
|
+
}
|
|
1225
|
+
|
|
1226
|
+
// const handleTableFocus = () => {
|
|
1227
|
+
// if (!focusedCell && currentData.length > 0) {
|
|
1228
|
+
// setFocusedCell({ rowIndex: 0, colIndex: 0 })
|
|
1229
|
+
// setTimeout(() => {
|
|
1230
|
+
// const firstCell = document.querySelector(
|
|
1231
|
+
// '[data-row-index="0"][data-col-index="0"]'
|
|
1232
|
+
// ) as HTMLElement
|
|
1233
|
+
// if (firstCell) {
|
|
1234
|
+
// firstCell.focus()
|
|
1235
|
+
// }
|
|
1236
|
+
// }, 0)
|
|
1237
|
+
// }
|
|
1238
|
+
// }
|
|
1239
|
+
|
|
1240
|
+
const totalColumnsT =
|
|
1241
|
+
effectiveVisibleColumns.length +
|
|
1242
|
+
(enableRowSelection ? 1 : 0) +
|
|
1243
|
+
(enableRowExpansion ? 1 : 0) +
|
|
1244
|
+
((enableInlineEdit || rowActions) &&
|
|
1245
|
+
!(mobileConfig.isMobile && mobileConfig.enableColumnOverflow)
|
|
1246
|
+
? 1
|
|
1247
|
+
: 0) +
|
|
1248
|
+
(mobileConfig.enableColumnOverflow &&
|
|
1249
|
+
mobileOverflowColumns.length > 0
|
|
1250
|
+
? 1
|
|
1251
|
+
: 0)
|
|
1252
|
+
|
|
1253
|
+
const totalColumns =
|
|
1254
|
+
totalColumnsT > 0 && effectiveEnableColumnManager
|
|
1255
|
+
? totalColumnsT + 1
|
|
1256
|
+
: 0
|
|
1257
|
+
|
|
1258
|
+
const handleTableKeyDown = (
|
|
1259
|
+
event: React.KeyboardEvent<HTMLTableElement>
|
|
1260
|
+
) => {
|
|
1261
|
+
if (event.key === 'Tab') {
|
|
1262
|
+
return
|
|
1263
|
+
}
|
|
1264
|
+
|
|
1265
|
+
const target = event.target as HTMLElement
|
|
1266
|
+
|
|
1267
|
+
if (
|
|
1268
|
+
target.closest('thead') ||
|
|
1269
|
+
target.closest('[role="columnheader"]') ||
|
|
1270
|
+
target.tagName === 'TH'
|
|
1271
|
+
) {
|
|
1272
|
+
return
|
|
1273
|
+
}
|
|
1274
|
+
|
|
1275
|
+
if (
|
|
1276
|
+
target.tagName === 'INPUT' ||
|
|
1277
|
+
target.tagName === 'TEXTAREA' ||
|
|
1278
|
+
target.tagName === 'SELECT' ||
|
|
1279
|
+
target.isContentEditable ||
|
|
1280
|
+
target.closest('button') ||
|
|
1281
|
+
target.closest('[role="button"]') ||
|
|
1282
|
+
target.closest('[role="menuitem"]')
|
|
1283
|
+
) {
|
|
1284
|
+
return
|
|
1285
|
+
}
|
|
1286
|
+
|
|
1287
|
+
let newRowIndex = focusedCell?.rowIndex ?? 0
|
|
1288
|
+
let newColIndex = focusedCell?.colIndex ?? 0
|
|
1289
|
+
|
|
1290
|
+
switch (event.key) {
|
|
1291
|
+
case 'ArrowRight':
|
|
1292
|
+
event.preventDefault()
|
|
1293
|
+
if (newColIndex < totalColumns - 1) {
|
|
1294
|
+
newColIndex++
|
|
1295
|
+
}
|
|
1296
|
+
break
|
|
1297
|
+
case 'ArrowLeft':
|
|
1298
|
+
event.preventDefault()
|
|
1299
|
+
if (newColIndex > 0) {
|
|
1300
|
+
newColIndex--
|
|
1301
|
+
}
|
|
1302
|
+
break
|
|
1303
|
+
case 'ArrowDown':
|
|
1304
|
+
event.preventDefault()
|
|
1305
|
+
if (newRowIndex < currentData.length - 1) {
|
|
1306
|
+
newRowIndex++
|
|
1307
|
+
}
|
|
1308
|
+
break
|
|
1309
|
+
case 'ArrowUp':
|
|
1310
|
+
event.preventDefault()
|
|
1311
|
+
if (newRowIndex > 0) {
|
|
1312
|
+
newRowIndex--
|
|
1313
|
+
}
|
|
1314
|
+
break
|
|
1315
|
+
case 'Home':
|
|
1316
|
+
event.preventDefault()
|
|
1317
|
+
if (event.ctrlKey || event.metaKey) {
|
|
1318
|
+
newRowIndex = 0
|
|
1319
|
+
newColIndex = 0
|
|
1320
|
+
} else {
|
|
1321
|
+
newColIndex = 0
|
|
1322
|
+
}
|
|
1323
|
+
break
|
|
1324
|
+
case 'End':
|
|
1325
|
+
event.preventDefault()
|
|
1326
|
+
if (event.ctrlKey || event.metaKey) {
|
|
1327
|
+
newRowIndex = currentData.length - 1
|
|
1328
|
+
newColIndex = totalColumns - 1
|
|
1329
|
+
} else {
|
|
1330
|
+
newColIndex = totalColumns - 1
|
|
1331
|
+
}
|
|
1332
|
+
break
|
|
1333
|
+
case 'PageDown':
|
|
1334
|
+
event.preventDefault()
|
|
1335
|
+
if (newRowIndex < currentData.length - 1) {
|
|
1336
|
+
newRowIndex = Math.min(
|
|
1337
|
+
newRowIndex + pageSize,
|
|
1338
|
+
currentData.length - 1
|
|
1339
|
+
)
|
|
1340
|
+
}
|
|
1341
|
+
break
|
|
1342
|
+
case 'PageUp':
|
|
1343
|
+
event.preventDefault()
|
|
1344
|
+
if (newRowIndex > 0) {
|
|
1345
|
+
newRowIndex = Math.max(newRowIndex - pageSize, 0)
|
|
1346
|
+
}
|
|
1347
|
+
break
|
|
1348
|
+
case 'Enter':
|
|
1349
|
+
case ' ':
|
|
1350
|
+
// Only trigger row click if focus is on a body cell, not header
|
|
1351
|
+
if (
|
|
1352
|
+
onRowClick &&
|
|
1353
|
+
focusedCell !== null &&
|
|
1354
|
+
!target.closest('thead') &&
|
|
1355
|
+
!target.closest('[role="columnheader"]')
|
|
1356
|
+
) {
|
|
1357
|
+
const row = currentData[focusedCell.rowIndex]
|
|
1358
|
+
if (row) {
|
|
1359
|
+
onRowClick(row, focusedCell.rowIndex)
|
|
1360
|
+
}
|
|
1361
|
+
}
|
|
1362
|
+
return
|
|
1363
|
+
default:
|
|
1364
|
+
return
|
|
1365
|
+
}
|
|
1366
|
+
|
|
1367
|
+
setFocusedCell({ rowIndex: newRowIndex, colIndex: newColIndex })
|
|
1368
|
+
|
|
1369
|
+
setTimeout(() => {
|
|
1370
|
+
const cellSelector = `[data-row-index="${newRowIndex}"][data-col-index="${newColIndex}"]`
|
|
1371
|
+
const cellElement = document.querySelector(
|
|
1372
|
+
cellSelector
|
|
1373
|
+
) as HTMLElement
|
|
1374
|
+
if (cellElement) {
|
|
1375
|
+
cellElement.focus()
|
|
1376
|
+
cellElement.scrollIntoView({
|
|
1377
|
+
behavior: 'smooth',
|
|
1378
|
+
block: 'nearest',
|
|
1379
|
+
inline: 'nearest',
|
|
1380
|
+
})
|
|
1381
|
+
}
|
|
1382
|
+
}, 0)
|
|
1383
|
+
}
|
|
1384
|
+
|
|
1385
|
+
const containerRefCallback = useCallback(
|
|
1386
|
+
(node: HTMLDivElement | null) => {
|
|
1387
|
+
tableContainerRef.current = node
|
|
1388
|
+
if (typeof ref === 'function') {
|
|
1389
|
+
ref(node)
|
|
1390
|
+
} else if (ref) {
|
|
1391
|
+
ref.current = node
|
|
1392
|
+
}
|
|
1393
|
+
},
|
|
1394
|
+
[ref]
|
|
1395
|
+
)
|
|
1396
|
+
|
|
1397
|
+
return (
|
|
1398
|
+
<Block
|
|
1399
|
+
ref={containerRefCallback}
|
|
1400
|
+
style={{
|
|
1401
|
+
position: tableToken.position,
|
|
1402
|
+
padding: tableToken.padding,
|
|
1403
|
+
width: tableToken.width,
|
|
1404
|
+
display: tableToken.display,
|
|
1405
|
+
flexDirection: tableToken.flexDirection,
|
|
1406
|
+
}}
|
|
1407
|
+
data-table={title || 'table'}
|
|
1408
|
+
role="region"
|
|
1409
|
+
aria-label={title || 'Data table'}
|
|
1410
|
+
aria-describedby={
|
|
1411
|
+
[tableLabelId, tableDescriptionId]
|
|
1412
|
+
.filter(Boolean)
|
|
1413
|
+
.join(' ') || undefined
|
|
1414
|
+
}
|
|
1415
|
+
>
|
|
1416
|
+
{title && (
|
|
1417
|
+
<h2
|
|
1418
|
+
id={tableLabelId}
|
|
1419
|
+
style={{ display: 'none' }}
|
|
1420
|
+
aria-hidden="true"
|
|
1421
|
+
>
|
|
1422
|
+
{title}
|
|
1423
|
+
</h2>
|
|
1424
|
+
)}
|
|
1425
|
+
{description && (
|
|
1426
|
+
<p
|
|
1427
|
+
id={tableDescriptionId}
|
|
1428
|
+
style={{ display: 'none' }}
|
|
1429
|
+
aria-hidden="true"
|
|
1430
|
+
>
|
|
1431
|
+
{description}
|
|
1432
|
+
</p>
|
|
1433
|
+
)}
|
|
1434
|
+
<DataTableHeader
|
|
1435
|
+
title={title}
|
|
1436
|
+
description={description}
|
|
1437
|
+
descriptionTooltipProps={descriptionTooltipProps}
|
|
1438
|
+
showHeader={showHeader}
|
|
1439
|
+
showToolbar={showToolbar}
|
|
1440
|
+
enableSearch={enableSearch}
|
|
1441
|
+
searchPlaceholder={searchPlaceholder}
|
|
1442
|
+
searchConfig={searchConfig}
|
|
1443
|
+
enableAdvancedFilter={enableAdvancedFilter}
|
|
1444
|
+
advancedFilterComponent={advancedFilterComponent}
|
|
1445
|
+
advancedFilters={advancedFilters}
|
|
1446
|
+
visibleColumns={
|
|
1447
|
+
visibleColumns as ColumnDefinition<
|
|
1448
|
+
Record<string, unknown>
|
|
1449
|
+
>[]
|
|
1450
|
+
}
|
|
1451
|
+
data={data}
|
|
1452
|
+
onSearch={handleSearch}
|
|
1453
|
+
onAdvancedFiltersChange={onAdvancedFiltersChange}
|
|
1454
|
+
onClearAllFilters={clearAllFilters}
|
|
1455
|
+
headerSlot1={
|
|
1456
|
+
showSettings ? (
|
|
1457
|
+
<>
|
|
1458
|
+
<Menu
|
|
1459
|
+
items={formatOptions}
|
|
1460
|
+
alignment={MenuAlignment.END}
|
|
1461
|
+
sideOffset={8}
|
|
1462
|
+
alignOffset={-20}
|
|
1463
|
+
trigger={
|
|
1464
|
+
<Button
|
|
1465
|
+
buttonType={ButtonType.SECONDARY}
|
|
1466
|
+
leadingIcon={<Settings />}
|
|
1467
|
+
size={ButtonSize.SMALL}
|
|
1468
|
+
aria-label="Table settings"
|
|
1469
|
+
>
|
|
1470
|
+
Settings
|
|
1471
|
+
</Button>
|
|
1472
|
+
}
|
|
1473
|
+
/>
|
|
1474
|
+
</>
|
|
1475
|
+
) : null
|
|
1476
|
+
}
|
|
1477
|
+
headerSlot2={headerSlot1}
|
|
1478
|
+
headerSlot3={headerSlot2}
|
|
1479
|
+
{...rest}
|
|
1480
|
+
/>
|
|
1481
|
+
|
|
1482
|
+
<Block
|
|
1483
|
+
style={{
|
|
1484
|
+
borderRadius: tableToken.dataTable.borderRadius,
|
|
1485
|
+
border: tableToken.dataTable.border,
|
|
1486
|
+
display: 'flex',
|
|
1487
|
+
flexDirection: 'column',
|
|
1488
|
+
position: 'relative',
|
|
1489
|
+
overflow: 'auto',
|
|
1490
|
+
}}
|
|
1491
|
+
>
|
|
1492
|
+
{showBulkActionBar && (
|
|
1493
|
+
<BulkActionBar
|
|
1494
|
+
selectedCount={selectedCount}
|
|
1495
|
+
onExport={exportToCSV}
|
|
1496
|
+
onDeselectAll={handleDeselectAll}
|
|
1497
|
+
customActions={renderBulkActions()}
|
|
1498
|
+
showExport={bulkActions?.showExport}
|
|
1499
|
+
/>
|
|
1500
|
+
)}
|
|
1501
|
+
<Block
|
|
1502
|
+
id={statusRegionId}
|
|
1503
|
+
role="status"
|
|
1504
|
+
aria-live="polite"
|
|
1505
|
+
aria-atomic="true"
|
|
1506
|
+
style={{
|
|
1507
|
+
position: 'absolute',
|
|
1508
|
+
width: '1px',
|
|
1509
|
+
height: '1px',
|
|
1510
|
+
padding: 0,
|
|
1511
|
+
margin: '-1px',
|
|
1512
|
+
overflow: 'hidden',
|
|
1513
|
+
clip: 'rect(0, 0, 0, 0)',
|
|
1514
|
+
whiteSpace: 'nowrap',
|
|
1515
|
+
borderWidth: 0,
|
|
1516
|
+
}}
|
|
1517
|
+
>
|
|
1518
|
+
{isLoading
|
|
1519
|
+
? 'Loading table data'
|
|
1520
|
+
: currentData.length === 0
|
|
1521
|
+
? 'No data available'
|
|
1522
|
+
: `Showing ${currentData.length} of ${totalRows} rows`}
|
|
1523
|
+
</Block>
|
|
1524
|
+
|
|
1525
|
+
<Block
|
|
1526
|
+
style={{
|
|
1527
|
+
position: 'relative',
|
|
1528
|
+
}}
|
|
1529
|
+
>
|
|
1530
|
+
<DndContext
|
|
1531
|
+
sensors={sensors}
|
|
1532
|
+
collisionDetection={closestCenter}
|
|
1533
|
+
onDragStart={handleDragStart}
|
|
1534
|
+
onDragOver={handleDragOver}
|
|
1535
|
+
onDragEnd={handleDragEnd}
|
|
1536
|
+
onDragCancel={handleDragCancel}
|
|
1537
|
+
>
|
|
1538
|
+
<SortableContext
|
|
1539
|
+
items={columnIds}
|
|
1540
|
+
strategy={horizontalListSortingStrategy}
|
|
1541
|
+
>
|
|
1542
|
+
<ScrollableContainer
|
|
1543
|
+
ref={scrollContainerRef}
|
|
1544
|
+
style={{
|
|
1545
|
+
position: 'relative',
|
|
1546
|
+
maxHeight:
|
|
1547
|
+
currentData.length > 0
|
|
1548
|
+
? tableBodyHeight
|
|
1549
|
+
? typeof tableBodyHeight ===
|
|
1550
|
+
'number'
|
|
1551
|
+
? `${tableBodyHeight}px`
|
|
1552
|
+
: tableBodyHeight
|
|
1553
|
+
: '668px'
|
|
1554
|
+
: undefined,
|
|
1555
|
+
overflowX: 'auto',
|
|
1556
|
+
overflowY: 'auto',
|
|
1557
|
+
}}
|
|
1558
|
+
>
|
|
1559
|
+
<table
|
|
1560
|
+
id={tableId}
|
|
1561
|
+
role="grid"
|
|
1562
|
+
aria-label={title || 'Data table'}
|
|
1563
|
+
aria-rowcount={
|
|
1564
|
+
totalRows > 0
|
|
1565
|
+
? totalRows
|
|
1566
|
+
: undefined
|
|
1567
|
+
}
|
|
1568
|
+
aria-colcount={totalColumns}
|
|
1569
|
+
aria-describedby={
|
|
1570
|
+
[tableDescriptionId, statusRegionId]
|
|
1571
|
+
.filter(Boolean)
|
|
1572
|
+
.join(' ') || undefined
|
|
1573
|
+
}
|
|
1574
|
+
onKeyDown={handleTableKeyDown}
|
|
1575
|
+
// onFocus={handleTableFocus}
|
|
1576
|
+
tabIndex={-1}
|
|
1577
|
+
style={{
|
|
1578
|
+
width: tableToken.dataTable.table
|
|
1579
|
+
.width,
|
|
1580
|
+
minWidth: 'auto',
|
|
1581
|
+
tableLayout:
|
|
1582
|
+
tableToken.dataTable.table
|
|
1583
|
+
.tableLayout,
|
|
1584
|
+
borderCollapse:
|
|
1585
|
+
tableToken.dataTable.table
|
|
1586
|
+
.borderCollapse,
|
|
1587
|
+
borderSpacing:
|
|
1588
|
+
tableToken.dataTable.table
|
|
1589
|
+
.borderSpacing,
|
|
1590
|
+
position:
|
|
1591
|
+
tableToken.dataTable.table
|
|
1592
|
+
.position,
|
|
1593
|
+
height: 'auto',
|
|
1594
|
+
minHeight: 'auto',
|
|
1595
|
+
backgroundColor: 'none',
|
|
1596
|
+
outline: 'none',
|
|
1597
|
+
}}
|
|
1598
|
+
>
|
|
1599
|
+
<TableHeader
|
|
1600
|
+
visibleColumns={
|
|
1601
|
+
effectiveVisibleColumns as ColumnDefinition<
|
|
1602
|
+
Record<string, unknown>
|
|
1603
|
+
>[]
|
|
1604
|
+
}
|
|
1605
|
+
allVisibleColumns={
|
|
1606
|
+
visibleColumns as ColumnDefinition<
|
|
1607
|
+
Record<string, unknown>
|
|
1608
|
+
>[]
|
|
1609
|
+
}
|
|
1610
|
+
initialColumns={
|
|
1611
|
+
initialColumns as ColumnDefinition<
|
|
1612
|
+
Record<string, unknown>
|
|
1613
|
+
>[]
|
|
1614
|
+
}
|
|
1615
|
+
selectAll={selectAll}
|
|
1616
|
+
sortConfig={sortConfig}
|
|
1617
|
+
enableInlineEdit={enableInlineEdit}
|
|
1618
|
+
enableColumnManager={
|
|
1619
|
+
effectiveEnableColumnManager
|
|
1620
|
+
}
|
|
1621
|
+
enableColumnReordering={
|
|
1622
|
+
enableColumnReordering
|
|
1623
|
+
}
|
|
1624
|
+
showSkeleton={showSkeleton}
|
|
1625
|
+
isLoading={isLoading}
|
|
1626
|
+
onColumnReorder={(columns) => {
|
|
1627
|
+
setVisibleColumns(
|
|
1628
|
+
columns as ColumnDefinition<T>[]
|
|
1629
|
+
)
|
|
1630
|
+
onColumnReorder?.(
|
|
1631
|
+
columns as ColumnDefinition<T>[]
|
|
1632
|
+
)
|
|
1633
|
+
}}
|
|
1634
|
+
columnManagerMaxSelections={
|
|
1635
|
+
columnManagerMaxSelections
|
|
1636
|
+
}
|
|
1637
|
+
columnManagerAlwaysSelected={columnManagerAlwaysSelected?.map(
|
|
1638
|
+
(field) => String(field)
|
|
1639
|
+
)}
|
|
1640
|
+
columnManagerPrimaryAction={
|
|
1641
|
+
columnManagerPrimaryAction
|
|
1642
|
+
}
|
|
1643
|
+
columnManagerSecondaryAction={
|
|
1644
|
+
columnManagerSecondaryAction
|
|
1645
|
+
}
|
|
1646
|
+
columnManagerWidth={
|
|
1647
|
+
columnManagerWidth
|
|
1648
|
+
}
|
|
1649
|
+
enableRowExpansion={
|
|
1650
|
+
enableRowExpansion
|
|
1651
|
+
}
|
|
1652
|
+
enableRowSelection={
|
|
1653
|
+
enableRowSelection
|
|
1654
|
+
}
|
|
1655
|
+
rowActions={
|
|
1656
|
+
rowActions as
|
|
1657
|
+
| RowActionsConfig<
|
|
1658
|
+
Record<
|
|
1659
|
+
string,
|
|
1660
|
+
unknown
|
|
1661
|
+
>
|
|
1662
|
+
>
|
|
1663
|
+
| undefined
|
|
1664
|
+
}
|
|
1665
|
+
data={data}
|
|
1666
|
+
mobileConfig={mobileConfig}
|
|
1667
|
+
mobileOverflowColumns={
|
|
1668
|
+
mobileOverflowColumns as ColumnDefinition<
|
|
1669
|
+
Record<string, unknown>
|
|
1670
|
+
>[]
|
|
1671
|
+
}
|
|
1672
|
+
onMobileOverflowClick={(row) =>
|
|
1673
|
+
handleMobileOverflowClick(
|
|
1674
|
+
row as T
|
|
1675
|
+
)
|
|
1676
|
+
}
|
|
1677
|
+
onSort={handleSort}
|
|
1678
|
+
onSortAscending={
|
|
1679
|
+
handleSortAscending
|
|
1680
|
+
}
|
|
1681
|
+
onSortDescending={
|
|
1682
|
+
handleSortDescending
|
|
1683
|
+
}
|
|
1684
|
+
onOperations={onOperations}
|
|
1685
|
+
onInsertLeft={onInsertLeft}
|
|
1686
|
+
onInsertRight={onInsertRight}
|
|
1687
|
+
onDeleteColumn={onDeleteColumn}
|
|
1688
|
+
onSelectAll={handleSelectAll}
|
|
1689
|
+
onColumnChange={(columns) =>
|
|
1690
|
+
setVisibleColumns(
|
|
1691
|
+
columns as ColumnDefinition<T>[]
|
|
1692
|
+
)
|
|
1693
|
+
}
|
|
1694
|
+
onColumnFilter={handleColumnFilter}
|
|
1695
|
+
columnFilters={columnFilters}
|
|
1696
|
+
getColumnWidth={
|
|
1697
|
+
getColumnWidth as (
|
|
1698
|
+
column: ColumnDefinition<
|
|
1699
|
+
Record<string, unknown>
|
|
1700
|
+
>,
|
|
1701
|
+
index: number
|
|
1702
|
+
) => React.CSSProperties
|
|
1703
|
+
}
|
|
1704
|
+
columnFreeze={effectiveColumnFreeze}
|
|
1705
|
+
columnFreezeRight={
|
|
1706
|
+
columnFreezeRight
|
|
1707
|
+
}
|
|
1708
|
+
measuredFrozenWidths={
|
|
1709
|
+
measuredFrozenWidths
|
|
1710
|
+
}
|
|
1711
|
+
onFrozenWidthsMeasured={
|
|
1712
|
+
setMeasuredFrozenWidths
|
|
1713
|
+
}
|
|
1714
|
+
/>
|
|
1715
|
+
{currentData.length > 0 && (
|
|
1716
|
+
<TableBodyComponent
|
|
1717
|
+
currentData={currentData}
|
|
1718
|
+
visibleColumns={
|
|
1719
|
+
effectiveVisibleColumns as ColumnDefinition<
|
|
1720
|
+
Record<string, unknown>
|
|
1721
|
+
>[]
|
|
1722
|
+
}
|
|
1723
|
+
mobileConfig={mobileConfig}
|
|
1724
|
+
mobileOverflowColumns={
|
|
1725
|
+
mobileOverflowColumns as ColumnDefinition<
|
|
1726
|
+
Record<string, unknown>
|
|
1727
|
+
>[]
|
|
1728
|
+
}
|
|
1729
|
+
onMobileOverflowClick={(row) =>
|
|
1730
|
+
handleMobileOverflowClick(
|
|
1731
|
+
row as T
|
|
1732
|
+
)
|
|
1733
|
+
}
|
|
1734
|
+
idField={String(idField)}
|
|
1735
|
+
tableTitle={title}
|
|
1736
|
+
selectedRows={selectedRows}
|
|
1737
|
+
editingRows={editingRows}
|
|
1738
|
+
editValues={editValues}
|
|
1739
|
+
expandedRows={expandedRows}
|
|
1740
|
+
enableInlineEdit={
|
|
1741
|
+
enableInlineEdit
|
|
1742
|
+
}
|
|
1743
|
+
enableColumnManager={
|
|
1744
|
+
effectiveEnableColumnManager
|
|
1745
|
+
}
|
|
1746
|
+
enableRowExpansion={
|
|
1747
|
+
enableRowExpansion
|
|
1748
|
+
}
|
|
1749
|
+
enableRowSelection={
|
|
1750
|
+
enableRowSelection
|
|
1751
|
+
}
|
|
1752
|
+
rowSelectionConfig={
|
|
1753
|
+
rowSelectionConfig as
|
|
1754
|
+
| {
|
|
1755
|
+
isDisabled?: (
|
|
1756
|
+
row: Record<
|
|
1757
|
+
string,
|
|
1758
|
+
unknown
|
|
1759
|
+
>,
|
|
1760
|
+
index: number
|
|
1761
|
+
) => boolean
|
|
1762
|
+
disabledText?: (
|
|
1763
|
+
row: Record<
|
|
1764
|
+
string,
|
|
1765
|
+
unknown
|
|
1766
|
+
>,
|
|
1767
|
+
index: number
|
|
1768
|
+
) => string
|
|
1769
|
+
}
|
|
1770
|
+
| undefined
|
|
1771
|
+
}
|
|
1772
|
+
columnFreeze={
|
|
1773
|
+
effectiveColumnFreeze
|
|
1774
|
+
}
|
|
1775
|
+
columnFreezeRight={
|
|
1776
|
+
columnFreezeRight
|
|
1777
|
+
}
|
|
1778
|
+
measuredFrozenWidths={
|
|
1779
|
+
measuredFrozenWidths
|
|
1780
|
+
}
|
|
1781
|
+
focusedCell={focusedCell}
|
|
1782
|
+
onCellFocus={(
|
|
1783
|
+
rowIndex,
|
|
1784
|
+
colIndex
|
|
1785
|
+
) =>
|
|
1786
|
+
setFocusedCell({
|
|
1787
|
+
rowIndex,
|
|
1788
|
+
colIndex,
|
|
1789
|
+
})
|
|
1790
|
+
}
|
|
1791
|
+
renderExpandedRow={
|
|
1792
|
+
renderExpandedRow as
|
|
1793
|
+
| ((expandedData: {
|
|
1794
|
+
row: Record<
|
|
1795
|
+
string,
|
|
1796
|
+
unknown
|
|
1797
|
+
>
|
|
1798
|
+
index: number
|
|
1799
|
+
isExpanded: boolean
|
|
1800
|
+
toggleExpansion: () => void
|
|
1801
|
+
}) => React.ReactNode)
|
|
1802
|
+
| undefined
|
|
1803
|
+
}
|
|
1804
|
+
isRowExpandable={
|
|
1805
|
+
isRowExpandable as
|
|
1806
|
+
| ((
|
|
1807
|
+
row: Record<
|
|
1808
|
+
string,
|
|
1809
|
+
unknown
|
|
1810
|
+
>,
|
|
1811
|
+
index: number
|
|
1812
|
+
) => boolean)
|
|
1813
|
+
| undefined
|
|
1814
|
+
}
|
|
1815
|
+
onRowSelect={handleRowSelect}
|
|
1816
|
+
onEditRow={handleEditRow}
|
|
1817
|
+
onSaveRow={handleSaveRow}
|
|
1818
|
+
onCancelEdit={handleCancelEdit}
|
|
1819
|
+
onRowExpand={handleRowExpand}
|
|
1820
|
+
onFieldChange={
|
|
1821
|
+
handleFieldChange
|
|
1822
|
+
}
|
|
1823
|
+
getColumnWidth={
|
|
1824
|
+
getColumnWidth as (
|
|
1825
|
+
column: ColumnDefinition<
|
|
1826
|
+
Record<
|
|
1827
|
+
string,
|
|
1828
|
+
unknown
|
|
1829
|
+
>
|
|
1830
|
+
>,
|
|
1831
|
+
index: number
|
|
1832
|
+
) => React.CSSProperties
|
|
1833
|
+
}
|
|
1834
|
+
onRowClick={
|
|
1835
|
+
onRowClick as
|
|
1836
|
+
| ((
|
|
1837
|
+
row: Record<
|
|
1838
|
+
string,
|
|
1839
|
+
unknown
|
|
1840
|
+
>,
|
|
1841
|
+
index: number
|
|
1842
|
+
) => void)
|
|
1843
|
+
| undefined
|
|
1844
|
+
}
|
|
1845
|
+
getRowStyle={
|
|
1846
|
+
getRowStyle as
|
|
1847
|
+
| ((
|
|
1848
|
+
row: Record<
|
|
1849
|
+
string,
|
|
1850
|
+
unknown
|
|
1851
|
+
>,
|
|
1852
|
+
index: number
|
|
1853
|
+
) => React.CSSProperties)
|
|
1854
|
+
| undefined
|
|
1855
|
+
}
|
|
1856
|
+
getDisplayValue={(
|
|
1857
|
+
value: unknown,
|
|
1858
|
+
column: ColumnDefinition<
|
|
1859
|
+
Record<string, unknown>
|
|
1860
|
+
>
|
|
1861
|
+
) =>
|
|
1862
|
+
getDisplayValue(
|
|
1863
|
+
value,
|
|
1864
|
+
column as ColumnDefinition<T>
|
|
1865
|
+
)
|
|
1866
|
+
}
|
|
1867
|
+
rowActions={
|
|
1868
|
+
rowActions as
|
|
1869
|
+
| RowActionsConfig<
|
|
1870
|
+
Record<
|
|
1871
|
+
string,
|
|
1872
|
+
unknown
|
|
1873
|
+
>
|
|
1874
|
+
>
|
|
1875
|
+
| undefined
|
|
1876
|
+
}
|
|
1877
|
+
isLoading={
|
|
1878
|
+
isLoading ||
|
|
1879
|
+
(serverSidePagination &&
|
|
1880
|
+
internalLoading)
|
|
1881
|
+
}
|
|
1882
|
+
showSkeleton={showSkeleton}
|
|
1883
|
+
skeletonVariant={
|
|
1884
|
+
skeletonVariant
|
|
1885
|
+
}
|
|
1886
|
+
isRowLoading={
|
|
1887
|
+
isRowLoading as
|
|
1888
|
+
| ((
|
|
1889
|
+
row: Record<
|
|
1890
|
+
string,
|
|
1891
|
+
unknown
|
|
1892
|
+
>,
|
|
1893
|
+
index: number
|
|
1894
|
+
) => boolean)
|
|
1895
|
+
| undefined
|
|
1896
|
+
}
|
|
1897
|
+
/>
|
|
1898
|
+
)}
|
|
1899
|
+
</table>
|
|
1900
|
+
</ScrollableContainer>
|
|
1901
|
+
</SortableContext>
|
|
1902
|
+
<DragOverlay dropAnimation={null}>
|
|
1903
|
+
{activeId ? (
|
|
1904
|
+
<Block
|
|
1905
|
+
style={{
|
|
1906
|
+
backgroundColor:
|
|
1907
|
+
FOUNDATION_THEME.colors
|
|
1908
|
+
.gray[100],
|
|
1909
|
+
border: `1px solid ${FOUNDATION_THEME.colors.gray[300]}`,
|
|
1910
|
+
borderRadius:
|
|
1911
|
+
FOUNDATION_THEME.unit[4],
|
|
1912
|
+
boxShadow:
|
|
1913
|
+
'0 4px 12px rgba(0, 0, 0, 0.15)',
|
|
1914
|
+
padding: `${FOUNDATION_THEME.unit[12]} ${FOUNDATION_THEME.unit[16]}`,
|
|
1915
|
+
cursor: 'grabbing',
|
|
1916
|
+
height: '56px',
|
|
1917
|
+
minWidth: '120px',
|
|
1918
|
+
maxWidth: '320px',
|
|
1919
|
+
display: 'flex',
|
|
1920
|
+
alignItems: 'center',
|
|
1921
|
+
overflow: 'hidden',
|
|
1922
|
+
}}
|
|
1923
|
+
>
|
|
1924
|
+
<PrimitiveText
|
|
1925
|
+
style={{
|
|
1926
|
+
fontSize:
|
|
1927
|
+
FOUNDATION_THEME.font.size
|
|
1928
|
+
.body.sm.fontSize,
|
|
1929
|
+
fontWeight: 600,
|
|
1930
|
+
color: FOUNDATION_THEME.colors
|
|
1931
|
+
.gray[500],
|
|
1932
|
+
whiteSpace: 'nowrap',
|
|
1933
|
+
overflow: 'hidden',
|
|
1934
|
+
textOverflow: 'ellipsis',
|
|
1935
|
+
width: '100%',
|
|
1936
|
+
}}
|
|
1937
|
+
>
|
|
1938
|
+
{
|
|
1939
|
+
visibleColumns.find(
|
|
1940
|
+
(col) =>
|
|
1941
|
+
String(col.field) ===
|
|
1942
|
+
activeId
|
|
1943
|
+
)?.header
|
|
1944
|
+
}
|
|
1945
|
+
</PrimitiveText>
|
|
1946
|
+
</Block>
|
|
1947
|
+
) : null}
|
|
1948
|
+
</DragOverlay>
|
|
1949
|
+
</DndContext>
|
|
1950
|
+
|
|
1951
|
+
{currentData.length === 0 && (
|
|
1952
|
+
<Block
|
|
1953
|
+
display="flex"
|
|
1954
|
+
alignItems="center"
|
|
1955
|
+
justifyContent="center"
|
|
1956
|
+
style={{
|
|
1957
|
+
minHeight: emptyStateMinHeight,
|
|
1958
|
+
backgroundColor:
|
|
1959
|
+
FOUNDATION_THEME.colors.gray[0],
|
|
1960
|
+
color: tableToken.dataTable.table.body.cell
|
|
1961
|
+
.color,
|
|
1962
|
+
fontSize:
|
|
1963
|
+
tableToken.dataTable.table.body.cell
|
|
1964
|
+
.fontSize,
|
|
1965
|
+
}}
|
|
1966
|
+
>
|
|
1967
|
+
{isLoading ? (
|
|
1968
|
+
<Block
|
|
1969
|
+
display="flex"
|
|
1970
|
+
alignItems="center"
|
|
1971
|
+
justifyContent="center"
|
|
1972
|
+
gap={FOUNDATION_THEME.unit[8]}
|
|
1973
|
+
>
|
|
1974
|
+
<Loader2
|
|
1975
|
+
size={FOUNDATION_THEME.unit[20]}
|
|
1976
|
+
className="animate-spin"
|
|
1977
|
+
style={{
|
|
1978
|
+
animation:
|
|
1979
|
+
'spin 1s linear infinite',
|
|
1980
|
+
}}
|
|
1981
|
+
/>
|
|
1982
|
+
<span>Loading data...</span>
|
|
1983
|
+
</Block>
|
|
1984
|
+
) : (
|
|
1985
|
+
<span>No data available</span>
|
|
1986
|
+
)}
|
|
1987
|
+
</Block>
|
|
1988
|
+
)}
|
|
1989
|
+
</Block>
|
|
1990
|
+
|
|
1991
|
+
{showFooter && (
|
|
1992
|
+
<TableFooter
|
|
1993
|
+
pagination={pagination}
|
|
1994
|
+
currentPage={currentPage}
|
|
1995
|
+
pageSize={pageSize}
|
|
1996
|
+
totalRows={totalRows}
|
|
1997
|
+
visibleRows={currentData.length}
|
|
1998
|
+
isLoading={isLoading}
|
|
1999
|
+
showSkeleton={showSkeleton}
|
|
2000
|
+
hasData={currentData.length > 0}
|
|
2001
|
+
isNarrowContainer={isNarrowContainer}
|
|
2002
|
+
onPageChange={handlePageChange}
|
|
2003
|
+
onPageSizeChange={handlePageSizeChange}
|
|
2004
|
+
/>
|
|
2005
|
+
)}
|
|
2006
|
+
</Block>
|
|
2007
|
+
|
|
2008
|
+
{mobileConfig.enableColumnOverflow && selectedRowForDrawer && (
|
|
2009
|
+
<MobileColumnDrawer
|
|
2010
|
+
isOpen={mobileDrawerOpen}
|
|
2011
|
+
onClose={() => {
|
|
2012
|
+
setMobileDrawerOpen(false)
|
|
2013
|
+
setSelectedRowForDrawer(null)
|
|
2014
|
+
setSelectedRowIndexForDrawer(-1)
|
|
2015
|
+
}}
|
|
2016
|
+
row={selectedRowForDrawer as Record<string, unknown>}
|
|
2017
|
+
rowIndex={selectedRowIndexForDrawer}
|
|
2018
|
+
overflowColumns={
|
|
2019
|
+
mobileOverflowColumns as ColumnDefinition<
|
|
2020
|
+
Record<string, unknown>
|
|
2021
|
+
>[]
|
|
2022
|
+
}
|
|
2023
|
+
getDisplayValue={(value, column) =>
|
|
2024
|
+
getDisplayValue(
|
|
2025
|
+
value,
|
|
2026
|
+
column as ColumnDefinition<T>
|
|
2027
|
+
)
|
|
2028
|
+
}
|
|
2029
|
+
onFieldChange={(field, value) => {
|
|
2030
|
+
setSelectedRowForDrawer((prev) =>
|
|
2031
|
+
prev ? { ...prev, [field]: value } : null
|
|
2032
|
+
)
|
|
2033
|
+
if (onFieldChange && selectedRowForDrawer) {
|
|
2034
|
+
const rowId = selectedRowForDrawer[idField]
|
|
2035
|
+
onFieldChange(rowId, field as keyof T, value)
|
|
2036
|
+
}
|
|
2037
|
+
}}
|
|
2038
|
+
rowActions={
|
|
2039
|
+
rowActions as
|
|
2040
|
+
| RowActionsConfig<Record<string, unknown>>
|
|
2041
|
+
| undefined
|
|
2042
|
+
}
|
|
2043
|
+
/>
|
|
2044
|
+
)}
|
|
2045
|
+
</Block>
|
|
2046
|
+
)
|
|
2047
|
+
}
|
|
2048
|
+
)
|
|
2049
|
+
|
|
2050
|
+
DataTable.displayName = 'DataTable'
|
|
2051
|
+
|
|
2052
|
+
export default DataTable
|