@spaced-out/ui-design-system 0.4.13-beta.0 → 0.4.13-beta.1
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/.cspell/custom-words.txt +2 -0
- package/CHANGELOG.md +7 -0
- package/cspell.json +3 -1
- package/gulpfile.js +2 -1
- package/lib/styles/index.js +535 -275
- package/package.json +2 -2
- package/lib/components/AIPromptFlow/AIPromptFlow.stories.tsx +0 -465
- package/lib/components/Accordion/Accordion.stories.tsx +0 -165
- package/lib/components/Accordion/Accordion.tsx +0 -112
- package/lib/components/Accordion/AccordionGroup.stories.tsx +0 -215
- package/lib/components/Accordion/AccordionGroup.tsx +0 -77
- package/lib/components/Accordion/index.ts +0 -2
- package/lib/components/Avatar/Avatar.stories.tsx +0 -152
- package/lib/components/Avatar/Avatar.tsx +0 -272
- package/lib/components/Avatar/index.ts +0 -1
- package/lib/components/AvatarGroup/AvatarGroup.stories.tsx +0 -138
- package/lib/components/AvatarGroup/AvatarGroup.tsx +0 -164
- package/lib/components/AvatarGroup/index.ts +0 -1
- package/lib/components/Badge/Badge.stories.tsx +0 -131
- package/lib/components/Badge/Badge.tsx +0 -149
- package/lib/components/Badge/index.ts +0 -1
- package/lib/components/BadgedIcon/BadgedIcon.stories.tsx +0 -80
- package/lib/components/BadgedIcon/BadgedIcon.tsx +0 -76
- package/lib/components/BadgedIcon/index.ts +0 -1
- package/lib/components/Banner/Banner.stories.tsx +0 -187
- package/lib/components/Banner/Banner.tsx +0 -55
- package/lib/components/Banner/index.ts +0 -1
- package/lib/components/Breadcrumbs/BreadcrumbLink/BreadcrumbLink.stories.tsx +0 -114
- package/lib/components/Breadcrumbs/BreadcrumbLink/BreadcrumbLink.tsx +0 -52
- package/lib/components/Breadcrumbs/BreadcrumbLink/index.ts +0 -1
- package/lib/components/Breadcrumbs/Breadcrumbs.stories.tsx +0 -189
- package/lib/components/Breadcrumbs/Breadcrumbs.tsx +0 -59
- package/lib/components/Breadcrumbs/index.ts +0 -2
- package/lib/components/Button/Button.stories.tsx +0 -220
- package/lib/components/Button/Button.tsx +0 -285
- package/lib/components/Button/index.ts +0 -8
- package/lib/components/ButtonDropdown/ButtonDropdown.stories.tsx +0 -677
- package/lib/components/ButtonDropdown/ButtonDropdown.tsx +0 -221
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.stories.tsx +0 -624
- package/lib/components/ButtonDropdown/SimpleButtonDropdown.tsx +0 -167
- package/lib/components/ButtonDropdown/index.ts +0 -2
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.stories.tsx +0 -125
- package/lib/components/ButtonTabs/ButtonTab/ButtonTab.tsx +0 -76
- package/lib/components/ButtonTabs/ButtonTab/index.ts +0 -1
- package/lib/components/ButtonTabs/ButtonTabDropdown.tsx +0 -147
- package/lib/components/ButtonTabs/ButtonTabs.stories.tsx +0 -393
- package/lib/components/ButtonTabs/ButtonTabs.tsx +0 -119
- package/lib/components/ButtonTabs/index.ts +0 -2
- package/lib/components/Card/Card.stories.tsx +0 -245
- package/lib/components/Card/Card.tsx +0 -172
- package/lib/components/Card/index.ts +0 -1
- package/lib/components/Charts/ChartTooltip/index.ts +0 -13
- package/lib/components/Charts/ChartWrapper/ChartWrapper.tsx +0 -179
- package/lib/components/Charts/ChartWrapper/index.ts +0 -1
- package/lib/components/Charts/ColumnChart/ColumnChart.stories.tsx +0 -574
- package/lib/components/Charts/ColumnChart/ColumnChart.tsx +0 -125
- package/lib/components/Charts/ColumnChart/index.ts +0 -1
- package/lib/components/Charts/DonutChart/DonutChart.stories.tsx +0 -415
- package/lib/components/Charts/DonutChart/DonutChart.tsx +0 -155
- package/lib/components/Charts/DonutChart/index.ts +0 -1
- package/lib/components/Charts/FunnelChart/FunnelChart.stories.tsx +0 -510
- package/lib/components/Charts/FunnelChart/FunnelChart.tsx +0 -110
- package/lib/components/Charts/FunnelChart/index.ts +0 -1
- package/lib/components/Charts/LineChart/LineChart.stories.tsx +0 -590
- package/lib/components/Charts/LineChart/LineChart.tsx +0 -109
- package/lib/components/Charts/LineChart/index.ts +0 -1
- package/lib/components/Charts/SpiderChart/SpiderChart.stories.tsx +0 -467
- package/lib/components/Charts/SpiderChart/SpiderChart.tsx +0 -104
- package/lib/components/Charts/SpiderChart/index.ts +0 -1
- package/lib/components/Charts/index.ts +0 -11
- package/lib/components/ChatBubble/ChatAnchor.stories.tsx +0 -95
- package/lib/components/ChatBubble/ChatBubble.stories.tsx +0 -277
- package/lib/components/ChatBubble/ChatBubble.tsx +0 -232
- package/lib/components/ChatBubble/index.ts +0 -1
- package/lib/components/Checkbox/Checkbox.stories.tsx +0 -180
- package/lib/components/Checkbox/Checkbox.tsx +0 -168
- package/lib/components/Checkbox/CheckboxGroup.stories.tsx +0 -381
- package/lib/components/Checkbox/CheckboxGroup.tsx +0 -119
- package/lib/components/Checkbox/index.ts +0 -2
- package/lib/components/Chip/Chip.stories.tsx +0 -335
- package/lib/components/Chip/Chip.tsx +0 -204
- package/lib/components/Chip/index.ts +0 -2
- package/lib/components/CircularLoader/CircularLoader.stories.tsx +0 -75
- package/lib/components/CircularLoader/CircularLoader.tsx +0 -51
- package/lib/components/CircularLoader/index.ts +0 -1
- package/lib/components/CollapsibleCard/CollapsibleCard.stories.tsx +0 -311
- package/lib/components/CollapsibleCard/CollapsibleCard.tsx +0 -135
- package/lib/components/CollapsibleCard/index.ts +0 -1
- package/lib/components/Combobox/Combobox.stories.tsx +0 -306
- package/lib/components/Combobox/Combobox.tsx +0 -297
- package/lib/components/Combobox/helper.ts +0 -201
- package/lib/components/Combobox/index.ts +0 -1
- package/lib/components/ConditionalWrapper/ConditionalWrapper.stories.tsx +0 -51
- package/lib/components/ConditionalWrapper/ConditionalWrapper.ts +0 -16
- package/lib/components/ConditionalWrapper/index.ts +0 -1
- package/lib/components/DateRangePicker/Calendar.tsx +0 -110
- package/lib/components/DateRangePicker/DateRangePicker.stories.tsx +0 -397
- package/lib/components/DateRangePicker/DateRangePicker.tsx +0 -210
- package/lib/components/DateRangePicker/DateRangeWrapper.tsx +0 -386
- package/lib/components/DateRangePicker/Day.tsx +0 -74
- package/lib/components/DateRangePicker/index.ts +0 -1
- package/lib/components/Dialog/Dialog.stories.tsx +0 -254
- package/lib/components/Dialog/Dialog.tsx +0 -222
- package/lib/components/Dialog/index.ts +0 -1
- package/lib/components/Disclaimer/Disclaimer.stories.tsx +0 -148
- package/lib/components/Disclaimer/Disclaimer.tsx +0 -35
- package/lib/components/Disclaimer/index.ts +0 -1
- package/lib/components/Dropdown/Dropdown.stories.tsx +0 -785
- package/lib/components/Dropdown/Dropdown.tsx +0 -174
- package/lib/components/Dropdown/SimpleDropdown.stories.tsx +0 -534
- package/lib/components/Dropdown/SimpleDropdown.tsx +0 -167
- package/lib/components/Dropdown/index.ts +0 -2
- package/lib/components/EmptyState/EmptyImages/CalendarEmptyImage.tsx +0 -108
- package/lib/components/EmptyState/EmptyImages/ChartEmptyImage.tsx +0 -194
- package/lib/components/EmptyState/EmptyImages/DataEmptyImage.tsx +0 -116
- package/lib/components/EmptyState/EmptyImages/FileEmptyImage.tsx +0 -133
- package/lib/components/EmptyState/EmptyImages/MessageEmptyImage.tsx +0 -64
- package/lib/components/EmptyState/EmptyImages/UploadEmptyImage.tsx +0 -67
- package/lib/components/EmptyState/EmptyImages/index.ts +0 -6
- package/lib/components/EmptyState/EmptyState.stories.tsx +0 -104
- package/lib/components/EmptyState/EmptyState.tsx +0 -83
- package/lib/components/EmptyState/index.ts +0 -1
- package/lib/components/ErrorMessage/ErrorImages/ForbiddenImage.tsx +0 -85
- package/lib/components/ErrorMessage/ErrorImages/NotFoundImage.tsx +0 -117
- package/lib/components/ErrorMessage/ErrorImages/ServerErrorImage.tsx +0 -237
- package/lib/components/ErrorMessage/ErrorImages/UnauthorizedImage.tsx +0 -73
- package/lib/components/ErrorMessage/ErrorImages/index.ts +0 -4
- package/lib/components/ErrorMessage/ErrorMessage.stories.tsx +0 -112
- package/lib/components/ErrorMessage/ErrorMessage.tsx +0 -87
- package/lib/components/ErrorMessage/index.ts +0 -1
- package/lib/components/FileUpload/FileBlock/FileBlock.stories.tsx +0 -85
- package/lib/components/FileUpload/FileBlock/FileBlock.tsx +0 -136
- package/lib/components/FileUpload/FileBlock/index.ts +0 -1
- package/lib/components/FileUpload/FileUpload.stories.tsx +0 -958
- package/lib/components/FileUpload/FileUpload.tsx +0 -206
- package/lib/components/FileUpload/index.ts +0 -2
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.stories.tsx +0 -345
- package/lib/components/FilterButtonOverlay/FilterButtonOverlay.tsx +0 -163
- package/lib/components/FilterButtonOverlay/index.ts +0 -1
- package/lib/components/FocusManager/FocusManager.stories.tsx +0 -117
- package/lib/components/FocusManager/FocusManager.tsx +0 -59
- package/lib/components/FocusManager/index.ts +0 -1
- package/lib/components/FocusManagerWithArrowKeyNavigation/FocusManagerWithArrowKeyNavigation.stories.tsx +0 -557
- package/lib/components/FocusManagerWithArrowKeyNavigation/FocusManagerWithArrowKeyNavigation.tsx +0 -156
- package/lib/components/FocusManagerWithArrowKeyNavigation/index.ts +0 -1
- package/lib/components/FormTitleWrapper/FormTitleWrapper.stories.tsx +0 -173
- package/lib/components/FormTitleWrapper/FormTitleWrapper.tsx +0 -63
- package/lib/components/FormTitleWrapper/index.ts +0 -1
- package/lib/components/Grid/Col.stories.tsx +0 -114
- package/lib/components/Grid/Grid.tsx +0 -119
- package/lib/components/Grid/GridPatterns.stories.tsx +0 -420
- package/lib/components/Grid/Row.stories.tsx +0 -135
- package/lib/components/Grid/Tablist.layout.stories.tsx +0 -281
- package/lib/components/Grid/index.ts +0 -1
- package/lib/components/Icon/ClickableIcon.tsx +0 -104
- package/lib/components/Icon/Icon.docs.ts +0 -118
- package/lib/components/Icon/Icon.stories.tsx +0 -79
- package/lib/components/Icon/Icon.tsx +0 -78
- package/lib/components/Icon/SemanticIcon.stories.tsx +0 -74
- package/lib/components/Icon/SemanticIcon.tsx +0 -49
- package/lib/components/Icon/index.ts +0 -3
- package/lib/components/InContextAlert/InContextAlert.stories.tsx +0 -164
- package/lib/components/InContextAlert/InContextAlert.tsx +0 -204
- package/lib/components/InContextAlert/index.ts +0 -1
- package/lib/components/InfinitePagination/InfinitePagination.stories.tsx +0 -323
- package/lib/components/InfinitePagination/InfinitePagination.tsx +0 -121
- package/lib/components/InfinitePagination/index.ts +0 -1
- package/lib/components/InlineDropdown/InlineDropdown.stories.tsx +0 -415
- package/lib/components/InlineDropdown/InlineDropdown.tsx +0 -175
- package/lib/components/InlineDropdown/SimpleInlineDropdown.stories.tsx +0 -513
- package/lib/components/InlineDropdown/SimpleInlineDropdown.tsx +0 -165
- package/lib/components/InlineDropdown/index.ts +0 -2
- package/lib/components/Input/Input.stories.tsx +0 -590
- package/lib/components/Input/Input.tsx +0 -336
- package/lib/components/Input/NativeColorpicker.stories.tsx +0 -337
- package/lib/components/Input/NativeDatepicker.stories.tsx +0 -424
- package/lib/components/Input/index.ts +0 -1
- package/lib/components/KPIBox/KPIBox.stories.tsx +0 -321
- package/lib/components/KPIBox/KPIBox.tsx +0 -94
- package/lib/components/KPIBox/index.ts +0 -1
- package/lib/components/LinearLoader/LinearLoader.stories.tsx +0 -132
- package/lib/components/LinearLoader/LinearLoader.tsx +0 -48
- package/lib/components/LinearLoader/index.ts +0 -1
- package/lib/components/Link/Link.stories.tsx +0 -302
- package/lib/components/Link/Link.tsx +0 -231
- package/lib/components/Link/index.ts +0 -1
- package/lib/components/Menu/Menu.stories.tsx +0 -1046
- package/lib/components/Menu/Menu.tsx +0 -391
- package/lib/components/Menu/MenuOptionButton.tsx +0 -206
- package/lib/components/Menu/index.ts +0 -2
- package/lib/components/Modal/Modal.stories.tsx +0 -430
- package/lib/components/Modal/Modal.tsx +0 -379
- package/lib/components/Modal/index.ts +0 -8
- package/lib/components/Notification/Notification.stories.tsx +0 -132
- package/lib/components/Notification/Notification.tsx +0 -140
- package/lib/components/Notification/index.ts +0 -1
- package/lib/components/OptionButton/OptionButton.stories.tsx +0 -397
- package/lib/components/OptionButton/OptionButton.tsx +0 -149
- package/lib/components/OptionButton/SimpleOptionButton.stories.tsx +0 -525
- package/lib/components/OptionButton/SimpleOptionButton.tsx +0 -160
- package/lib/components/OptionButton/index.ts +0 -2
- package/lib/components/PageTitle/PageTitle.stories.tsx +0 -257
- package/lib/components/PageTitle/PageTitle.tsx +0 -276
- package/lib/components/PageTitle/index.ts +0 -1
- package/lib/components/Pagination/Pagination.stories.tsx +0 -259
- package/lib/components/Pagination/Pagination.tsx +0 -147
- package/lib/components/Pagination/PaginationItem.tsx +0 -118
- package/lib/components/Pagination/index.ts +0 -1
- package/lib/components/Panel/Panel.stories.tsx +0 -452
- package/lib/components/Panel/Panel.tsx +0 -181
- package/lib/components/Panel/index.ts +0 -2
- package/lib/components/ProgressDonut/ProgressDonut.stories.tsx +0 -97
- package/lib/components/ProgressDonut/ProgressDonut.tsx +0 -111
- package/lib/components/ProgressDonut/index.ts +0 -1
- package/lib/components/PromptChip/PromptChip.stories.tsx +0 -202
- package/lib/components/PromptChip/PromptChip.tsx +0 -166
- package/lib/components/PromptChip/index.ts +0 -1
- package/lib/components/PromptInput/PromptInput.stories.tsx +0 -349
- package/lib/components/PromptInput/PromptInput.tsx +0 -190
- package/lib/components/PromptInput/index.ts +0 -1
- package/lib/components/RadioButton/RadioButton.stories.tsx +0 -157
- package/lib/components/RadioButton/RadioButton.tsx +0 -135
- package/lib/components/RadioButton/RadioGroup.stories.tsx +0 -283
- package/lib/components/RadioButton/RadioGroup.tsx +0 -90
- package/lib/components/RadioButton/index.ts +0 -2
- package/lib/components/RadioTile/RadioTile.stories.tsx +0 -276
- package/lib/components/RadioTile/RadioTile.tsx +0 -107
- package/lib/components/RadioTile/index.ts +0 -1
- package/lib/components/RangeSlider/RangeSlider.stories.tsx +0 -342
- package/lib/components/RangeSlider/RangeSlider.tsx +0 -201
- package/lib/components/RangeSlider/index.ts +0 -1
- package/lib/components/Rating/Rating.stories.tsx +0 -257
- package/lib/components/Rating/Rating.tsx +0 -141
- package/lib/components/Rating/index.ts +0 -1
- package/lib/components/ScoreBar/ScoreBar.stories.tsx +0 -182
- package/lib/components/ScoreBar/ScoreBar.tsx +0 -133
- package/lib/components/ScoreBar/index.ts +0 -1
- package/lib/components/SearchInput/SearchInput.stories.tsx +0 -260
- package/lib/components/SearchInput/SearchInput.tsx +0 -81
- package/lib/components/SearchInput/index.ts +0 -2
- package/lib/components/Separator/Separator.stories.tsx +0 -95
- package/lib/components/Separator/Separator.tsx +0 -57
- package/lib/components/Separator/index.ts +0 -1
- package/lib/components/Shimmer/Shimmer.stories.tsx +0 -317
- package/lib/components/Shimmer/Shimmer.tsx +0 -143
- package/lib/components/Shimmer/index.ts +0 -1
- package/lib/components/SideMenuLink/SideMenuLink.stories.tsx +0 -153
- package/lib/components/SideMenuLink/SideMenuLink.tsx +0 -344
- package/lib/components/SideMenuLink/index.ts +0 -1
- package/lib/components/StatusIndicator/StatusIndicator.stories.tsx +0 -130
- package/lib/components/StatusIndicator/StatusIndicator.tsx +0 -62
- package/lib/components/StatusIndicator/index.ts +0 -1
- package/lib/components/Stepper/Step/Step.stories.tsx +0 -117
- package/lib/components/Stepper/Step/Step.tsx +0 -125
- package/lib/components/Stepper/Step/StepContent.tsx +0 -40
- package/lib/components/Stepper/Step/StepLabel.tsx +0 -40
- package/lib/components/Stepper/Step/index.ts +0 -3
- package/lib/components/Stepper/Stepper.stories.tsx +0 -422
- package/lib/components/Stepper/Stepper.tsx +0 -68
- package/lib/components/Stepper/index.ts +0 -2
- package/lib/components/StickyBar/StickyBar.stories.tsx +0 -152
- package/lib/components/StickyBar/StickyBar.tsx +0 -65
- package/lib/components/StickyBar/index.ts +0 -1
- package/lib/components/SubMenu/SubMenu.stories.tsx +0 -413
- package/lib/components/SubMenu/SubMenu.tsx +0 -96
- package/lib/components/SubMenu/SubMenuGroup.tsx +0 -161
- package/lib/components/SubMenu/SubMenuItem.tsx +0 -170
- package/lib/components/SubMenu/SubMenuLink.tsx +0 -87
- package/lib/components/SubMenu/index.ts +0 -4
- package/lib/components/Table/BasicTable.stories.tsx +0 -647
- package/lib/components/Table/BulkActions.stories.tsx +0 -267
- package/lib/components/Table/Cell.tsx +0 -125
- package/lib/components/Table/DefaultRow.tsx +0 -159
- package/lib/components/Table/DefaultTableHeader.tsx +0 -244
- package/lib/components/Table/InlineEdit.stories.tsx +0 -390
- package/lib/components/Table/StaticTable.tsx +0 -230
- package/lib/components/Table/Table.docs.ts +0 -495
- package/lib/components/Table/Table.tsx +0 -135
- package/lib/components/Table/TableActionBar.tsx +0 -55
- package/lib/components/Table/TableBottomBar.tsx +0 -25
- package/lib/components/Table/TableTopBar.tsx +0 -25
- package/lib/components/Table/dummyTableData.ts +0 -2189
- package/lib/components/Table/hooks.ts +0 -102
- package/lib/components/Table/index.ts +0 -8
- package/lib/components/Tabs/Tab/Tab.stories.tsx +0 -151
- package/lib/components/Tabs/Tab/Tab.tsx +0 -152
- package/lib/components/Tabs/Tab/index.ts +0 -1
- package/lib/components/Tabs/TabList/TabDropdown.tsx +0 -125
- package/lib/components/Tabs/TabList/TabList.stories.tsx +0 -172
- package/lib/components/Tabs/TabList/TabList.tsx +0 -178
- package/lib/components/Tabs/TabList/index.ts +0 -1
- package/lib/components/Tabs/index.ts +0 -2
- package/lib/components/Text/HighlightedText.stories.tsx +0 -122
- package/lib/components/Text/Text.stories.tsx +0 -302
- package/lib/components/Text/Text.tsx +0 -882
- package/lib/components/Text/index.ts +0 -30
- package/lib/components/TextTile/TextTile.stories.tsx +0 -89
- package/lib/components/TextTile/TextTile.tsx +0 -51
- package/lib/components/TextTile/index.ts +0 -1
- package/lib/components/Textarea/Textarea.stories.tsx +0 -324
- package/lib/components/Textarea/Textarea.tsx +0 -148
- package/lib/components/Textarea/index.ts +0 -2
- package/lib/components/Timeline/Timeline.stories.tsx +0 -272
- package/lib/components/Timeline/Timeline.tsx +0 -57
- package/lib/components/Timeline/TimelineItem/TimelineItem.stories.tsx +0 -216
- package/lib/components/Timeline/TimelineItem/TimelineItem.tsx +0 -128
- package/lib/components/Timeline/TimelineItem/index.ts +0 -1
- package/lib/components/Timeline/index.ts +0 -2
- package/lib/components/Toast/Toast.stories.tsx +0 -274
- package/lib/components/Toast/Toast.tsx +0 -264
- package/lib/components/Toast/ToastContainer.tsx +0 -123
- package/lib/components/Toast/ToastManager.ts +0 -60
- package/lib/components/Toast/index.ts +0 -10
- package/lib/components/Toggle/Toggle.stories.tsx +0 -175
- package/lib/components/Toggle/Toggle.tsx +0 -121
- package/lib/components/Toggle/index.ts +0 -1
- package/lib/components/TokenListInput/TokenListInput.stories.tsx +0 -678
- package/lib/components/TokenListInput/TokenListInput.tsx +0 -393
- package/lib/components/TokenListInput/TokenValueChips.tsx +0 -69
- package/lib/components/TokenListInput/index.ts +0 -1
- package/lib/components/Tooltip/Tooltip.stories.tsx +0 -316
- package/lib/components/Tooltip/Tooltip.tsx +0 -188
- package/lib/components/Tooltip/index.ts +0 -1
- package/lib/components/Truncate/Truncate.stories.tsx +0 -106
- package/lib/components/Truncate/Truncate.tsx +0 -80
- package/lib/components/Truncate/index.ts +0 -2
- package/lib/components/TruncatedTextWithTooltip/TruncatedTextWithTooltip.stories.tsx +0 -147
- package/lib/components/TruncatedTextWithTooltip/TruncatedTextWithTooltip.tsx +0 -109
- package/lib/components/TruncatedTextWithTooltip/index.ts +0 -1
- package/lib/components/Typeahead/SimpleTypeahead.stories.tsx +0 -567
- package/lib/components/Typeahead/SimpleTypeahead.tsx +0 -159
- package/lib/components/Typeahead/Typeahead.stories.tsx +0 -552
- package/lib/components/Typeahead/Typeahead.tsx +0 -243
- package/lib/components/Typeahead/index.ts +0 -2
- package/lib/components/WeekdayPicker/WeekdayPicker.stories.tsx +0 -263
- package/lib/components/WeekdayPicker/WeekdayPicker.tsx +0 -224
- package/lib/components/WeekdayPicker/index.ts +0 -1
- package/lib/components/index.ts +0 -77
- package/lib/hooks/index.ts +0 -16
- package/lib/hooks/useArbitraryOptionAddition/index.ts +0 -1
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.stories.tsx +0 -158
- package/lib/hooks/useArbitraryOptionAddition/useArbitraryOptionAddition.ts +0 -127
- package/lib/hooks/useCopyToClipboard/index.ts +0 -1
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.stories.tsx +0 -112
- package/lib/hooks/useCopyToClipboard/useCopyToClipboard.ts +0 -29
- package/lib/hooks/useDebounce/index.ts +0 -1
- package/lib/hooks/useDebounce/useDebounce.stories.tsx +0 -82
- package/lib/hooks/useDebounce/useDebounce.ts +0 -15
- package/lib/hooks/useFileUpload/index.ts +0 -1
- package/lib/hooks/useFileUpload/useFileUpload.stories.tsx +0 -468
- package/lib/hooks/useFileUpload/useFileUpload.ts +0 -326
- package/lib/hooks/useFilteredOptions/index.ts +0 -1
- package/lib/hooks/useFilteredOptions/useFilteredOptions.stories.tsx +0 -142
- package/lib/hooks/useFilteredOptions/useFilteredOptions.ts +0 -92
- package/lib/hooks/useInfiniteScroll/index.ts +0 -1
- package/lib/hooks/useInfiniteScroll/useInfiniteScroll.ts +0 -85
- package/lib/hooks/useInputState/index.ts +0 -1
- package/lib/hooks/useInputState/useInputState.stories.tsx +0 -62
- package/lib/hooks/useInputState/useInputState.ts +0 -24
- package/lib/hooks/useLockedBody/index.ts +0 -1
- package/lib/hooks/useLockedBody/useLockedBody.stories.tsx +0 -71
- package/lib/hooks/useLockedBody/useLockedBody.ts +0 -53
- package/lib/hooks/useModal/index.ts +0 -1
- package/lib/hooks/useModal/useModal.stories.tsx +0 -134
- package/lib/hooks/useModal/useModal.ts +0 -36
- package/lib/hooks/useMountTransition/index.ts +0 -25
- package/lib/hooks/useMountTransition/useMountTransition.stories.tsx +0 -64
- package/lib/hooks/usePagination/index.ts +0 -1
- package/lib/hooks/usePagination/usePagination.stories.tsx +0 -72
- package/lib/hooks/usePagination/usePagination.ts +0 -151
- package/lib/hooks/useReferenceElementWidth/index.ts +0 -1
- package/lib/hooks/useReferenceElementWidth/useReferenceElementWidth.ts +0 -19
- package/lib/hooks/useResizeObserver/index.ts +0 -1
- package/lib/hooks/useResizeObserver/useResizeObserver.ts +0 -29
- package/lib/hooks/useToastPortal/index.ts +0 -1
- package/lib/hooks/useToastPortal/useToastPortal.ts +0 -34
- package/lib/hooks/useToggle/index.ts +0 -1
- package/lib/hooks/useToggle/useToggle.stories.tsx +0 -70
- package/lib/hooks/useToggle/useToggle.ts +0 -13
- package/lib/hooks/useWindowSize/index.ts +0 -1
- package/lib/hooks/useWindowSize/useWindowSize.stories.tsx +0 -62
- package/lib/hooks/useWindowSize/useWindowSize.ts +0 -39
- package/lib/index.ts +0 -6
- package/lib/styles/index.ts +0 -533
- package/lib/styles/variables/_border.ts +0 -23
- package/lib/styles/variables/_color.ts +0 -207
- package/lib/styles/variables/_elevation.ts +0 -13
- package/lib/styles/variables/_font.ts +0 -59
- package/lib/styles/variables/_motion.ts +0 -11
- package/lib/styles/variables/_opacity.ts +0 -29
- package/lib/styles/variables/_shadow.ts +0 -47
- package/lib/styles/variables/_size.ts +0 -113
- package/lib/styles/variables/_space.ts +0 -23
- package/lib/types/charts.ts +0 -247
- package/lib/types/common.ts +0 -11
- package/lib/types/cssvariables.d.ts +0 -8
- package/lib/types/date-range-picker.ts +0 -20
- package/lib/types/flow-to-typescript-codemod.d.ts +0 -48
- package/lib/types/global.d.ts +0 -84
- package/lib/types/index.ts +0 -6
- package/lib/types/menu.ts +0 -13
- package/lib/types/toast.ts +0 -34
- package/lib/types/typography.ts +0 -17
- package/lib/utils/array/are-arrays-equal.ts +0 -12
- package/lib/utils/array/index.ts +0 -1
- package/lib/utils/charts/charts.ts +0 -110
- package/lib/utils/charts/columnChart.ts +0 -62
- package/lib/utils/charts/donutChart.ts +0 -123
- package/lib/utils/charts/funnelChart.ts +0 -97
- package/lib/utils/charts/helpers.ts +0 -65
- package/lib/utils/charts/index.ts +0 -7
- package/lib/utils/charts/lineChart.ts +0 -51
- package/lib/utils/charts/spiderChart.ts +0 -57
- package/lib/utils/charts/typography.ts +0 -52
- package/lib/utils/classify/classify.stories.tsx +0 -65
- package/lib/utils/classify/index.ts +0 -27
- package/lib/utils/click-away/ClickAway.stories.tsx +0 -248
- package/lib/utils/click-away/click-away.ts +0 -230
- package/lib/utils/click-away/index.ts +0 -1
- package/lib/utils/date-range-picker/date-range-picker.ts +0 -430
- package/lib/utils/date-range-picker/index.ts +0 -2
- package/lib/utils/date-range-picker/timezones.ts +0 -263
- package/lib/utils/dom/dom.stories.tsx +0 -59
- package/lib/utils/dom/dom.ts +0 -247
- package/lib/utils/dom/index.ts +0 -1
- package/lib/utils/helpers/helpers.stories.tsx +0 -124
- package/lib/utils/helpers/helpers.ts +0 -51
- package/lib/utils/helpers/index.ts +0 -1
- package/lib/utils/index.ts +0 -14
- package/lib/utils/makeClassNameComponent/index.ts +0 -1
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.stories.tsx +0 -46
- package/lib/utils/makeClassNameComponent/makeClassNameComponent.tsx +0 -60
- package/lib/utils/menu/index.ts +0 -1
- package/lib/utils/menu/menu.ts +0 -174
- package/lib/utils/merge-refs/index.ts +0 -1
- package/lib/utils/merge-refs/merge-refs.stories.tsx +0 -92
- package/lib/utils/merge-refs/merge-refs.ts +0 -16
- package/lib/utils/rating/index.ts +0 -1
- package/lib/utils/rating/rating.ts +0 -30
- package/lib/utils/score-bar/index.ts +0 -1
- package/lib/utils/score-bar/score-bar.ts +0 -45
- package/lib/utils/string/index.ts +0 -1
- package/lib/utils/string/string.stories.tsx +0 -71
- package/lib/utils/string/string.ts +0 -26
- package/lib/utils/token-list-input/token-list-input.ts +0 -32
- package/lib/utils/tokens/index.ts +0 -1
- package/lib/utils/tokens/tokens.ts +0 -237
|
@@ -1,958 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
import {convertFileSize} from '../../utils/helpers';
|
|
4
|
-
import {getRandomDataVariation} from '../../utils/tokens';
|
|
5
|
-
import {BasicDialog} from '../Dialog';
|
|
6
|
-
import {EmptyState} from '../EmptyState';
|
|
7
|
-
import {Link} from '../Link';
|
|
8
|
-
import {BasicSingleCell, Table} from '../Table';
|
|
9
|
-
import {BodyMedium, SubTitleMedium} from '../Text';
|
|
10
|
-
import {Truncate} from '../Truncate';
|
|
11
|
-
|
|
12
|
-
import type {FileUploadProps} from './';
|
|
13
|
-
import type {FileObject} from './FileUpload';
|
|
14
|
-
import {FileUpload} from './FileUpload';
|
|
15
|
-
|
|
16
|
-
import css from './FileUpload.stories.module.css';
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
export default {
|
|
20
|
-
tags: ['autodocs'],
|
|
21
|
-
title: 'Components/File Upload/File Upload',
|
|
22
|
-
component: FileUpload,
|
|
23
|
-
argTypes: {
|
|
24
|
-
classNames: {
|
|
25
|
-
description: 'Provide an optional className to be applied',
|
|
26
|
-
control: {
|
|
27
|
-
type: 'object',
|
|
28
|
-
},
|
|
29
|
-
table: {
|
|
30
|
-
type: {
|
|
31
|
-
summary:
|
|
32
|
-
'{ wrapper?: string, instruction?: string, secondaryInstruction?: string, dropZone?: string, files?: string }',
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
},
|
|
36
|
-
label: {
|
|
37
|
-
description: 'The label for the File Uploader',
|
|
38
|
-
control: {
|
|
39
|
-
type: 'text',
|
|
40
|
-
},
|
|
41
|
-
table: {
|
|
42
|
-
type: {summary: 'React.ReactNode'},
|
|
43
|
-
defaultValue: {summary: ''},
|
|
44
|
-
},
|
|
45
|
-
},
|
|
46
|
-
instruction: {
|
|
47
|
-
description:
|
|
48
|
-
'The instruction for the File Uploader. This appears as the first line of the File Uploader',
|
|
49
|
-
control: {
|
|
50
|
-
type: 'text',
|
|
51
|
-
},
|
|
52
|
-
table: {
|
|
53
|
-
type: {summary: 'React.ReactNode'},
|
|
54
|
-
defaultValue: {summary: 'Drag & drop the file here or click to select'},
|
|
55
|
-
},
|
|
56
|
-
},
|
|
57
|
-
draggingInstruction: {
|
|
58
|
-
description:
|
|
59
|
-
'This gets activated when the user drags the file over the File Uploader. Instruction text gets replaced by draggingInstruction',
|
|
60
|
-
control: {
|
|
61
|
-
type: 'text',
|
|
62
|
-
},
|
|
63
|
-
table: {
|
|
64
|
-
type: {summary: 'React.ReactNode'},
|
|
65
|
-
defaultValue: {summary: 'Drop the file here to start uploading..'},
|
|
66
|
-
},
|
|
67
|
-
},
|
|
68
|
-
secondaryInstruction: {
|
|
69
|
-
description: `The secondary instruction for the File Uploader. This appears as the second line of the
|
|
70
|
-
File Uploader. Use this to notify users of file type accepted, size accepted, etc.`,
|
|
71
|
-
control: {
|
|
72
|
-
type: 'text',
|
|
73
|
-
},
|
|
74
|
-
table: {
|
|
75
|
-
type: {summary: 'React.ReactNode'},
|
|
76
|
-
defaultValue: {summary: ''},
|
|
77
|
-
},
|
|
78
|
-
},
|
|
79
|
-
maxSize: {
|
|
80
|
-
description:
|
|
81
|
-
'The maximum size of each file that can be uploaded. This is in bytes',
|
|
82
|
-
control: {
|
|
83
|
-
type: 'number',
|
|
84
|
-
},
|
|
85
|
-
table: {
|
|
86
|
-
type: {summary: 'number'},
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
accept: {
|
|
90
|
-
description: `Set accepted file types. Checkout [MDN](https://developer.mozilla.org/en-US/docs/Web/API/window/showOpenFilePicker)
|
|
91
|
-
types option for more information. Keep in mind that mime type determination is not reliable across platforms.
|
|
92
|
-
CSV files, for example, are reported as text/plain under macOS but as application/vnd.ms-excel under Windows.
|
|
93
|
-
In some cases there might not be a mime type set at all [GitHub](https://github.com/react-dropzone/react-dropzone/issues/276).`,
|
|
94
|
-
control: {
|
|
95
|
-
type: 'array',
|
|
96
|
-
},
|
|
97
|
-
table: {
|
|
98
|
-
type: {summary: 'AcceptProps'},
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
onValidFilesDrop: {
|
|
102
|
-
description: `
|
|
103
|
-
The callback function that is called when the user selects or drop **valid file(s)**.
|
|
104
|
-
Only the currently dropped/selected files are passed as argument.
|
|
105
|
-
`,
|
|
106
|
-
action: 'on valid files drop or select',
|
|
107
|
-
table: {
|
|
108
|
-
type: {
|
|
109
|
-
summary:
|
|
110
|
-
'onValidFilesDrop?: ( validFiles: Array<FileObject>) => mixed',
|
|
111
|
-
},
|
|
112
|
-
},
|
|
113
|
-
},
|
|
114
|
-
onRejectedFilesDrop: {
|
|
115
|
-
description: `
|
|
116
|
-
The callback function that is called when the user selects or drop **invalid file(s)**.
|
|
117
|
-
Only the currently dropped/selected files are passed as argument.
|
|
118
|
-
`,
|
|
119
|
-
action: 'on rejected files drop or select',
|
|
120
|
-
table: {
|
|
121
|
-
type: {
|
|
122
|
-
summary:
|
|
123
|
-
'onRejectedFilesDrop?: ( rejectedFiles: Array<FileObject>) => mixed',
|
|
124
|
-
},
|
|
125
|
-
},
|
|
126
|
-
},
|
|
127
|
-
handleFileDeletionExternally: {
|
|
128
|
-
description: `If **true**, the component will not handle file deletion internally. This is useful when you want to
|
|
129
|
-
handle file deletion externally. For example, you can use this prop to show a confirmation modal before deleting a file.`,
|
|
130
|
-
control: {
|
|
131
|
-
type: 'boolean',
|
|
132
|
-
},
|
|
133
|
-
table: {
|
|
134
|
-
type: {summary: 'boolean'},
|
|
135
|
-
defaultValue: {summary: 'false'},
|
|
136
|
-
},
|
|
137
|
-
},
|
|
138
|
-
onFileClear: {
|
|
139
|
-
description: `The callback function that is called when the user clears the file.`,
|
|
140
|
-
action: 'file cleared',
|
|
141
|
-
table: {
|
|
142
|
-
type: {
|
|
143
|
-
summary: '(id: string) => mixed',
|
|
144
|
-
},
|
|
145
|
-
},
|
|
146
|
-
},
|
|
147
|
-
onFileRefreshClick: {
|
|
148
|
-
description: `The callback function that is called when the user clicks on the refresh icon.`,
|
|
149
|
-
action: 'file Refreshed',
|
|
150
|
-
table: {
|
|
151
|
-
type: {
|
|
152
|
-
summary: '(file: FileObject) => mixed',
|
|
153
|
-
},
|
|
154
|
-
},
|
|
155
|
-
},
|
|
156
|
-
disabled: {
|
|
157
|
-
description: 'If **true**, the component is disabled',
|
|
158
|
-
control: {
|
|
159
|
-
type: 'boolean',
|
|
160
|
-
},
|
|
161
|
-
table: {
|
|
162
|
-
type: {summary: 'boolean'},
|
|
163
|
-
defaultValue: {summary: 'false'},
|
|
164
|
-
},
|
|
165
|
-
},
|
|
166
|
-
ref: {
|
|
167
|
-
description: `File upload state management callbacks along with \`validFiles\`, \`rejectedFiles\` and \`files\` are
|
|
168
|
-
exposed as \`ref\` which is a \`React.Ref\` object.`,
|
|
169
|
-
table: {
|
|
170
|
-
type: {summary: 'FileUploadRef'},
|
|
171
|
-
},
|
|
172
|
-
},
|
|
173
|
-
maxFiles: {
|
|
174
|
-
description: `Maximum accepted number of files The default value is 1 which corresponds to single file upload.
|
|
175
|
-
You can also **set the value to 0 which means there is no limitation to how many files are accepted**.`,
|
|
176
|
-
control: {
|
|
177
|
-
type: 'number',
|
|
178
|
-
},
|
|
179
|
-
table: {
|
|
180
|
-
type: {summary: 'number'},
|
|
181
|
-
defaultValue: {summary: '1'},
|
|
182
|
-
},
|
|
183
|
-
},
|
|
184
|
-
required: {
|
|
185
|
-
description: 'if **true**, a red star would be added to the label',
|
|
186
|
-
control: {
|
|
187
|
-
type: 'boolean',
|
|
188
|
-
},
|
|
189
|
-
table: {
|
|
190
|
-
type: {summary: 'boolean'},
|
|
191
|
-
defaultValue: {summary: 'false'},
|
|
192
|
-
},
|
|
193
|
-
},
|
|
194
|
-
},
|
|
195
|
-
parameters: {
|
|
196
|
-
docs: {
|
|
197
|
-
subtitle: 'Generates a FileUpload component.',
|
|
198
|
-
source: {
|
|
199
|
-
code: null,
|
|
200
|
-
},
|
|
201
|
-
description: {
|
|
202
|
-
component: `
|
|
203
|
-
\`\`\`js
|
|
204
|
-
import { FileUpload } from "@spaced-out/ui-design-system/lib/components/FileUpload";
|
|
205
|
-
\`\`\`
|
|
206
|
-
The \`FileUpload\` component is a customizable file upload component which utilizes the \`useFileUploadHook\`.
|
|
207
|
-
It provides an intuitive and user-friendly interface for uploading files.
|
|
208
|
-
The component supports features such as drag and drop functionality, file validation, error handling, and file clearing.
|
|
209
|
-
|
|
210
|
-
When files are dragged and dropped or selected using the file browser, the \`FileUpload\` component displays the file names along
|
|
211
|
-
with additional information such as success message, progress state and error message. It also provides an option to remove individual files.
|
|
212
|
-
|
|
213
|
-
The component supports various visual states, including a hover state when files are being dragged over the
|
|
214
|
-
component, an error state when invalid files are selected, and a disabled state when the component is not interactive.
|
|
215
|
-
|
|
216
|
-
Additionally, the \`FileUpload\` component allows customization through props, enabling you to specify the maximum
|
|
217
|
-
file size, accepted file types, callbacks for handling valid and rejected file(s) drop, and more.
|
|
218
|
-
|
|
219
|
-
You can access valid files, rejected files, and all files using the \`ref\` object passed to the \`FileUpload\` component. You can
|
|
220
|
-
also do several operations on a file using the functions exposed on the \`ref\`
|
|
221
|
-
|
|
222
|
-
\`\`\`js
|
|
223
|
-
// Valid Files:
|
|
224
|
-
ref.current?.validFiles;
|
|
225
|
-
|
|
226
|
-
// Rejected Files:
|
|
227
|
-
ref.current?.rejectedFiles;
|
|
228
|
-
|
|
229
|
-
// All Files:
|
|
230
|
-
ref.current?.files;
|
|
231
|
-
|
|
232
|
-
// Operations on a file:
|
|
233
|
-
|
|
234
|
-
// Move file to progress state
|
|
235
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
236
|
-
|
|
237
|
-
// Move file to success state
|
|
238
|
-
ref.current?.moveFileToSuccess(id, successMessage);
|
|
239
|
-
|
|
240
|
-
// Move file to reject state
|
|
241
|
-
ref.current?.moveFileToReject(id, rejectReason);
|
|
242
|
-
|
|
243
|
-
// Show re-upload button
|
|
244
|
-
ref.current?.setShowReUpload(id, showReUpload);
|
|
245
|
-
|
|
246
|
-
// Clear file(Use this in combination of handleFileDeletionExternally, when you want to handle deletion externally)
|
|
247
|
-
ref.current?.handleFileClear(id);
|
|
248
|
-
\`\`\`
|
|
249
|
-
|
|
250
|
-
Each File object returned has these properties:
|
|
251
|
-
|
|
252
|
-
\`\`\`js
|
|
253
|
-
type FileObject = {
|
|
254
|
-
file: File,
|
|
255
|
-
id: string,
|
|
256
|
-
reject?: boolean,
|
|
257
|
-
rejectReason?: string,
|
|
258
|
-
progress?: FileProgress,
|
|
259
|
-
success?: boolean,
|
|
260
|
-
successMessage?: string,
|
|
261
|
-
showReUpload?: boolean,
|
|
262
|
-
};
|
|
263
|
-
\`\`\`
|
|
264
|
-
|
|
265
|
-
To transition file state a bunch of functions are exposed as \`ref\` which is a \`React.Ref\` object.
|
|
266
|
-
|
|
267
|
-
\`\`\`js
|
|
268
|
-
// File upload state management callbacks are exposed as \`ref\` which is a \`React.Ref\` object.
|
|
269
|
-
export type FileUploadRef = {
|
|
270
|
-
moveFileToProgress: (id: string, progress: FileProgress) => mixed,
|
|
271
|
-
moveFileToSuccess: (id: string, successMessage?: string) => mixed,
|
|
272
|
-
moveFileToReject: (id: string, rejectReason?: string) => mixed,
|
|
273
|
-
setShowReUpload: (id: string, showReUpload?: boolean) => mixed,
|
|
274
|
-
handleFileClear: (id: string) => mixed,
|
|
275
|
-
validFiles: Array<FileObject>,
|
|
276
|
-
rejectedFiles: Array<FileObject>,
|
|
277
|
-
files: Array<FileObject>,
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// File upload Props
|
|
281
|
-
type FileUploadProps = {
|
|
282
|
-
...
|
|
283
|
-
// File drop/select callbacks
|
|
284
|
-
onValidFilesDrop?: (validFiles: Array<FileObject>) => mixed,
|
|
285
|
-
onRejectedFilesDrop?: (rejectedFiles: Array<FileObject>) => mixed,
|
|
286
|
-
|
|
287
|
-
// File clear callbacks
|
|
288
|
-
onFileClear?: (id: string) => mixed,
|
|
289
|
-
|
|
290
|
-
// File refresh callback
|
|
291
|
-
onFileRefreshClick?: (file: FileObject) => mixed,
|
|
292
|
-
|
|
293
|
-
...
|
|
294
|
-
};
|
|
295
|
-
\`\`\`
|
|
296
|
-
\`\`\`js
|
|
297
|
-
// Usage:
|
|
298
|
-
|
|
299
|
-
const ref = React.useRef(null);
|
|
300
|
-
|
|
301
|
-
const mockState = (id: string) => {
|
|
302
|
-
let progress = 0;
|
|
303
|
-
const intervalId = setInterval(() => {
|
|
304
|
-
progress += 5;
|
|
305
|
-
if (progress >= 100) {
|
|
306
|
-
ref.current?.moveFileToSuccess(id);
|
|
307
|
-
clearInterval(intervalId);
|
|
308
|
-
} else {
|
|
309
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
310
|
-
}
|
|
311
|
-
}, 100);
|
|
312
|
-
};
|
|
313
|
-
\`\`\`
|
|
314
|
-
\`\`\`jsx
|
|
315
|
-
<FileUpload
|
|
316
|
-
{...args}
|
|
317
|
-
ref={ref}
|
|
318
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
319
|
-
uploadedFiles.forEach((file) => {
|
|
320
|
-
mockState(file.id);
|
|
321
|
-
});
|
|
322
|
-
}}
|
|
323
|
-
/>
|
|
324
|
-
\`\`\`
|
|
325
|
-
`,
|
|
326
|
-
},
|
|
327
|
-
},
|
|
328
|
-
storySource: {
|
|
329
|
-
componentPath: '/src/components/FileUpload/FileUpload.jsx',
|
|
330
|
-
},
|
|
331
|
-
},
|
|
332
|
-
};
|
|
333
|
-
|
|
334
|
-
/**
|
|
335
|
-
* Renders a FileUpload component for uploading a single file.
|
|
336
|
-
*
|
|
337
|
-
* This example demonstrates how to use the FileUpload component with a single file upload.
|
|
338
|
-
*/
|
|
339
|
-
export const _SingleFile = (args: FileUploadProps) => {
|
|
340
|
-
const [files, setFiles] = React.useState([]);
|
|
341
|
-
const ref = React.useRef(null);
|
|
342
|
-
|
|
343
|
-
return (
|
|
344
|
-
<>
|
|
345
|
-
<div className={css.container}>
|
|
346
|
-
<div className={css.content}>
|
|
347
|
-
<FileUpload
|
|
348
|
-
{...args}
|
|
349
|
-
ref={ref}
|
|
350
|
-
onValidFilesDrop={() => {
|
|
351
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
352
|
-
setFiles(ref.current?.files);
|
|
353
|
-
}}
|
|
354
|
-
onRejectedFilesDrop={() => {
|
|
355
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
356
|
-
setFiles(ref.current?.files);
|
|
357
|
-
}}
|
|
358
|
-
onFileClear={() => {
|
|
359
|
-
setTimeout(() => {
|
|
360
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
361
|
-
setFiles(ref.current?.files);
|
|
362
|
-
});
|
|
363
|
-
}}
|
|
364
|
-
/>
|
|
365
|
-
</div>
|
|
366
|
-
</div>
|
|
367
|
-
<div className={css.fileDataContainer}>
|
|
368
|
-
<FileUploadData files={files || []} />
|
|
369
|
-
</div>
|
|
370
|
-
</>
|
|
371
|
-
);
|
|
372
|
-
};
|
|
373
|
-
|
|
374
|
-
_SingleFile.args = {
|
|
375
|
-
label: 'Upload a file(Only one file allowed)',
|
|
376
|
-
secondaryInstruction: 'Types: .png, .jpg or .jpeg',
|
|
377
|
-
maxFiles: 1,
|
|
378
|
-
accept: {
|
|
379
|
-
'image/jpeg': ['.jpg', '.jpeg'],
|
|
380
|
-
'image/png': ['.png'],
|
|
381
|
-
},
|
|
382
|
-
};
|
|
383
|
-
|
|
384
|
-
/**
|
|
385
|
-
* Renders a FileUpload component for uploading multiple files.
|
|
386
|
-
*
|
|
387
|
-
* This example demonstrates how to use the FileUpload component with multiple file uploads.
|
|
388
|
-
*/
|
|
389
|
-
export const _MultiFile = (args: FileUploadProps) => {
|
|
390
|
-
const [files, setFiles] = React.useState([]);
|
|
391
|
-
const ref = React.useRef(null);
|
|
392
|
-
return (
|
|
393
|
-
<>
|
|
394
|
-
<div className={css.container}>
|
|
395
|
-
<div className={css.content}>
|
|
396
|
-
<FileUpload
|
|
397
|
-
{...args}
|
|
398
|
-
ref={ref}
|
|
399
|
-
onValidFilesDrop={() => {
|
|
400
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
401
|
-
setFiles(ref.current?.files);
|
|
402
|
-
}}
|
|
403
|
-
onRejectedFilesDrop={() => {
|
|
404
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
405
|
-
setFiles(ref.current?.files);
|
|
406
|
-
}}
|
|
407
|
-
onFileClear={() => {
|
|
408
|
-
setTimeout(() => {
|
|
409
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
410
|
-
setFiles(ref.current?.files);
|
|
411
|
-
});
|
|
412
|
-
}}
|
|
413
|
-
/>
|
|
414
|
-
</div>
|
|
415
|
-
</div>
|
|
416
|
-
<div className={css.fileDataContainer}>
|
|
417
|
-
<FileUploadData files={files || []} />
|
|
418
|
-
</div>
|
|
419
|
-
</>
|
|
420
|
-
);
|
|
421
|
-
};
|
|
422
|
-
|
|
423
|
-
_MultiFile.args = {
|
|
424
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
425
|
-
secondaryInstruction: 'Types: .png, .jpg or .jpeg',
|
|
426
|
-
maxFiles: 0,
|
|
427
|
-
accept: {
|
|
428
|
-
'image/jpeg': ['.jpg', '.jpeg'],
|
|
429
|
-
'image/png': ['.png'],
|
|
430
|
-
},
|
|
431
|
-
};
|
|
432
|
-
|
|
433
|
-
/**
|
|
434
|
-
* Renders a FileUpload component for uploading multiple files.
|
|
435
|
-
*
|
|
436
|
-
* This example demonstrates how to use the FileUpload component with confirmation modal and handle deletion externally.
|
|
437
|
-
*/
|
|
438
|
-
export const _WithDeletionConfirmation = (args: FileUploadProps) => {
|
|
439
|
-
const [showConfirmation, setShowConfirmation] = React.useState(false);
|
|
440
|
-
const [fileIdToDelete, setFileIdToDelete] = React.useState('');
|
|
441
|
-
const [files, setFiles] = React.useState([]);
|
|
442
|
-
const ref = React.useRef(null);
|
|
443
|
-
return (
|
|
444
|
-
<>
|
|
445
|
-
<div className={css.container}>
|
|
446
|
-
<div className={css.content}>
|
|
447
|
-
<FileUpload
|
|
448
|
-
{...args}
|
|
449
|
-
ref={ref}
|
|
450
|
-
onValidFilesDrop={() => {
|
|
451
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
452
|
-
setFiles(ref.current?.files);
|
|
453
|
-
}}
|
|
454
|
-
handleFileDeletionExternally={true}
|
|
455
|
-
onRejectedFilesDrop={() => {
|
|
456
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
457
|
-
setFiles(ref.current?.files);
|
|
458
|
-
}}
|
|
459
|
-
onFileClear={(id) => {
|
|
460
|
-
setFileIdToDelete(id);
|
|
461
|
-
setShowConfirmation(true);
|
|
462
|
-
}}
|
|
463
|
-
/>
|
|
464
|
-
</div>
|
|
465
|
-
</div>
|
|
466
|
-
<div className={css.fileDataContainer}>
|
|
467
|
-
<FileUploadData files={files || []} />
|
|
468
|
-
</div>
|
|
469
|
-
<BasicDialog
|
|
470
|
-
isOpen={showConfirmation}
|
|
471
|
-
abortText="Close"
|
|
472
|
-
body="Are you sure you want to delete this file?"
|
|
473
|
-
confirmText="Confirm"
|
|
474
|
-
handleAbort={() => {
|
|
475
|
-
setShowConfirmation(false);
|
|
476
|
-
}}
|
|
477
|
-
handleConfirm={() => {
|
|
478
|
-
// @ts-ignore - TS2339 - Property 'handleFileClear' does not exist on type 'never'.
|
|
479
|
-
ref.current?.handleFileClear(fileIdToDelete);
|
|
480
|
-
setTimeout(() => {
|
|
481
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
482
|
-
setFiles(ref.current?.files);
|
|
483
|
-
});
|
|
484
|
-
setShowConfirmation(false);
|
|
485
|
-
}}
|
|
486
|
-
heading="Delete File"
|
|
487
|
-
onClose={() => {
|
|
488
|
-
setShowConfirmation(false);
|
|
489
|
-
}}
|
|
490
|
-
semantic="danger"
|
|
491
|
-
/>
|
|
492
|
-
</>
|
|
493
|
-
);
|
|
494
|
-
};
|
|
495
|
-
|
|
496
|
-
_WithDeletionConfirmation.args = {
|
|
497
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
498
|
-
secondaryInstruction: 'Types: .png, .jpg or .jpeg',
|
|
499
|
-
maxFiles: 0,
|
|
500
|
-
accept: {
|
|
501
|
-
'image/jpeg': ['.jpg', '.jpeg'],
|
|
502
|
-
'image/png': ['.png'],
|
|
503
|
-
},
|
|
504
|
-
};
|
|
505
|
-
|
|
506
|
-
/**
|
|
507
|
-
* Renders a FileUpload component with progress state.
|
|
508
|
-
*
|
|
509
|
-
* This example demonstrates how to use the FileUpload component with progress state.
|
|
510
|
-
*/
|
|
511
|
-
export const _WithProgress = (args: FileUploadProps) => {
|
|
512
|
-
const [files, setFiles] = React.useState([]);
|
|
513
|
-
const ref = React.useRef(null);
|
|
514
|
-
|
|
515
|
-
const mockState = (id: string) => {
|
|
516
|
-
let progress = 0;
|
|
517
|
-
const intervalId = setInterval(() => {
|
|
518
|
-
progress += 5;
|
|
519
|
-
if (progress >= 105) {
|
|
520
|
-
// @ts-ignore - TS2339 - Property 'moveFileToSuccess' does not exist on type 'never'.
|
|
521
|
-
ref.current?.moveFileToSuccess(id);
|
|
522
|
-
clearInterval(intervalId);
|
|
523
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
524
|
-
setFiles(ref.current?.files);
|
|
525
|
-
} else {
|
|
526
|
-
// @ts-ignore - TS2339 - Property 'moveFileToProgress' does not exist on type 'never'.
|
|
527
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
528
|
-
}
|
|
529
|
-
}, 100);
|
|
530
|
-
};
|
|
531
|
-
|
|
532
|
-
return (
|
|
533
|
-
<>
|
|
534
|
-
<div className={css.container}>
|
|
535
|
-
<div className={css.content}>
|
|
536
|
-
<FileUpload
|
|
537
|
-
{...args}
|
|
538
|
-
ref={ref}
|
|
539
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
540
|
-
uploadedFiles.forEach((file) => {
|
|
541
|
-
mockState(file.id);
|
|
542
|
-
});
|
|
543
|
-
}}
|
|
544
|
-
onRejectedFilesDrop={() => {
|
|
545
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
546
|
-
setFiles(ref.current?.files);
|
|
547
|
-
}}
|
|
548
|
-
onFileClear={() => {
|
|
549
|
-
setTimeout(() => {
|
|
550
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
551
|
-
setFiles(ref.current?.files);
|
|
552
|
-
});
|
|
553
|
-
}}
|
|
554
|
-
/>
|
|
555
|
-
</div>
|
|
556
|
-
</div>
|
|
557
|
-
<div className={css.fileDataContainer}>
|
|
558
|
-
<FileUploadData files={files || []} />
|
|
559
|
-
</div>
|
|
560
|
-
</>
|
|
561
|
-
);
|
|
562
|
-
};
|
|
563
|
-
|
|
564
|
-
_WithProgress.args = {
|
|
565
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
566
|
-
secondaryInstruction: 'Types: .png, .jpg or .jpeg',
|
|
567
|
-
maxFiles: 0,
|
|
568
|
-
accept: {
|
|
569
|
-
'image/jpeg': ['.jpg', '.jpeg'],
|
|
570
|
-
'image/png': ['.png'],
|
|
571
|
-
},
|
|
572
|
-
};
|
|
573
|
-
|
|
574
|
-
/**
|
|
575
|
-
* Renders a FileUpload component with indeterminate progress state.
|
|
576
|
-
*
|
|
577
|
-
* This example demonstrates how to use the FileUpload component with indeterminate progress state.
|
|
578
|
-
*/
|
|
579
|
-
export const _WithIndeterminateProgress = (args: FileUploadProps) => {
|
|
580
|
-
const [files, setFiles] = React.useState([]);
|
|
581
|
-
const ref = React.useRef(null);
|
|
582
|
-
|
|
583
|
-
const mockState = (id: string) => {
|
|
584
|
-
// @ts-ignore - TS2339 - Property 'moveFileToProgress' does not exist on type 'never'.
|
|
585
|
-
ref.current?.moveFileToProgress(id, 'indeterminate');
|
|
586
|
-
setTimeout(() => {
|
|
587
|
-
// @ts-ignore - TS2339 - Property 'moveFileToSuccess' does not exist on type 'never'.
|
|
588
|
-
ref.current?.moveFileToSuccess(id);
|
|
589
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
590
|
-
setFiles(ref.current?.files);
|
|
591
|
-
}, 5000);
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
return (
|
|
595
|
-
<>
|
|
596
|
-
<div className={css.container}>
|
|
597
|
-
<div className={css.content}>
|
|
598
|
-
<FileUpload
|
|
599
|
-
{...args}
|
|
600
|
-
ref={ref}
|
|
601
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
602
|
-
uploadedFiles.forEach((file) => {
|
|
603
|
-
mockState(file.id);
|
|
604
|
-
});
|
|
605
|
-
}}
|
|
606
|
-
onRejectedFilesDrop={() => {
|
|
607
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
608
|
-
setFiles(ref.current?.files);
|
|
609
|
-
}}
|
|
610
|
-
onFileClear={() => {
|
|
611
|
-
setTimeout(() => {
|
|
612
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
613
|
-
setFiles(ref.current?.files);
|
|
614
|
-
});
|
|
615
|
-
}}
|
|
616
|
-
/>
|
|
617
|
-
</div>
|
|
618
|
-
</div>
|
|
619
|
-
<div className={css.fileDataContainer}>
|
|
620
|
-
<FileUploadData files={files || []} />
|
|
621
|
-
</div>
|
|
622
|
-
</>
|
|
623
|
-
);
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
_WithIndeterminateProgress.args = {
|
|
627
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
628
|
-
secondaryInstruction: 'Types: .png, .jpg or .jpeg',
|
|
629
|
-
maxFiles: 0,
|
|
630
|
-
accept: {
|
|
631
|
-
'image/jpeg': ['.jpg', '.jpeg'],
|
|
632
|
-
'image/png': ['.png'],
|
|
633
|
-
},
|
|
634
|
-
};
|
|
635
|
-
|
|
636
|
-
/**
|
|
637
|
-
* Renders a FileUpload component with custom error and success messages.
|
|
638
|
-
*
|
|
639
|
-
* This example demonstrates how to use the FileUpload component with custom error and success messages.
|
|
640
|
-
*/
|
|
641
|
-
export const _WithCustomErrorMessages = (args: FileUploadProps) => {
|
|
642
|
-
const [files, setFiles] = React.useState([]);
|
|
643
|
-
const ref = React.useRef(null);
|
|
644
|
-
|
|
645
|
-
const mockState = (id: string, idx: number) => {
|
|
646
|
-
let progress = 0;
|
|
647
|
-
const intervalId = setInterval(() => {
|
|
648
|
-
progress += 5;
|
|
649
|
-
if (progress >= 105) {
|
|
650
|
-
if (idx === 0) {
|
|
651
|
-
// @ts-ignore - TS2339 - Property 'moveFileToReject' does not exist on type 'never'.
|
|
652
|
-
ref.current?.moveFileToReject(
|
|
653
|
-
id,
|
|
654
|
-
'File rejected: Your custom error message',
|
|
655
|
-
);
|
|
656
|
-
} else {
|
|
657
|
-
// @ts-ignore - TS2339 - Property 'moveFileToSuccess' does not exist on type 'never'.
|
|
658
|
-
ref.current?.moveFileToSuccess(id);
|
|
659
|
-
}
|
|
660
|
-
clearInterval(intervalId);
|
|
661
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
662
|
-
setFiles(ref.current?.files);
|
|
663
|
-
} else {
|
|
664
|
-
// @ts-ignore - TS2339 - Property 'moveFileToProgress' does not exist on type 'never'.
|
|
665
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
666
|
-
}
|
|
667
|
-
}, 100);
|
|
668
|
-
};
|
|
669
|
-
|
|
670
|
-
return (
|
|
671
|
-
<>
|
|
672
|
-
<div className={css.container}>
|
|
673
|
-
<div className={css.content}>
|
|
674
|
-
<FileUpload
|
|
675
|
-
{...args}
|
|
676
|
-
ref={ref}
|
|
677
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
678
|
-
uploadedFiles.forEach((file, idx) => {
|
|
679
|
-
mockState(file.id, idx);
|
|
680
|
-
});
|
|
681
|
-
}}
|
|
682
|
-
onRejectedFilesDrop={() => {
|
|
683
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
684
|
-
setFiles(ref.current?.files);
|
|
685
|
-
}}
|
|
686
|
-
onFileClear={() => {
|
|
687
|
-
setTimeout(() => {
|
|
688
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
689
|
-
setFiles(ref.current?.files);
|
|
690
|
-
});
|
|
691
|
-
}}
|
|
692
|
-
/>
|
|
693
|
-
</div>
|
|
694
|
-
</div>
|
|
695
|
-
<div className={css.fileDataContainer}>
|
|
696
|
-
<FileUploadData files={files || []} />
|
|
697
|
-
</div>
|
|
698
|
-
</>
|
|
699
|
-
);
|
|
700
|
-
};
|
|
701
|
-
|
|
702
|
-
_WithCustomErrorMessages.args = {
|
|
703
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
704
|
-
secondaryInstruction: 'Try uploading multiple files at once.',
|
|
705
|
-
maxFiles: 0,
|
|
706
|
-
};
|
|
707
|
-
|
|
708
|
-
/**
|
|
709
|
-
* Renders a FileUpload component with max size validation.
|
|
710
|
-
*
|
|
711
|
-
* This example demonstrates how to use the FileUpload component with max size validation.
|
|
712
|
-
*/
|
|
713
|
-
export const _WithMaxSizeValidation = (args: FileUploadProps) => {
|
|
714
|
-
const [files, setFiles] = React.useState([]);
|
|
715
|
-
const ref = React.useRef(null);
|
|
716
|
-
|
|
717
|
-
const mockState = (id: string) => {
|
|
718
|
-
let progress = 0;
|
|
719
|
-
const intervalId = setInterval(() => {
|
|
720
|
-
progress += 5;
|
|
721
|
-
if (progress >= 105) {
|
|
722
|
-
// @ts-ignore - TS2339 - Property 'moveFileToSuccess' does not exist on type 'never'.
|
|
723
|
-
ref.current?.moveFileToSuccess(id);
|
|
724
|
-
clearInterval(intervalId);
|
|
725
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
726
|
-
setFiles(ref.current?.files);
|
|
727
|
-
} else {
|
|
728
|
-
// @ts-ignore - TS2339 - Property 'moveFileToProgress' does not exist on type 'never'.
|
|
729
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
730
|
-
}
|
|
731
|
-
}, 100);
|
|
732
|
-
};
|
|
733
|
-
|
|
734
|
-
return (
|
|
735
|
-
<>
|
|
736
|
-
<div className={css.container}>
|
|
737
|
-
<div className={css.content}>
|
|
738
|
-
<FileUpload
|
|
739
|
-
{...args}
|
|
740
|
-
ref={ref}
|
|
741
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
742
|
-
uploadedFiles.forEach((file) => {
|
|
743
|
-
mockState(file.id);
|
|
744
|
-
});
|
|
745
|
-
}}
|
|
746
|
-
onRejectedFilesDrop={() => {
|
|
747
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
748
|
-
setFiles(ref.current?.files);
|
|
749
|
-
}}
|
|
750
|
-
onFileClear={() => {
|
|
751
|
-
setTimeout(() => {
|
|
752
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
753
|
-
setFiles(ref.current?.files);
|
|
754
|
-
});
|
|
755
|
-
}}
|
|
756
|
-
/>
|
|
757
|
-
</div>
|
|
758
|
-
</div>
|
|
759
|
-
<div className={css.fileDataContainer}>
|
|
760
|
-
<FileUploadData files={files || []} />
|
|
761
|
-
</div>
|
|
762
|
-
</>
|
|
763
|
-
);
|
|
764
|
-
};
|
|
765
|
-
|
|
766
|
-
_WithMaxSizeValidation.args = {
|
|
767
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
768
|
-
secondaryInstruction: 'Try uploading a file greater than 2MB',
|
|
769
|
-
maxFiles: 0,
|
|
770
|
-
maxSize: 2000000, // 2MB
|
|
771
|
-
};
|
|
772
|
-
|
|
773
|
-
/**
|
|
774
|
-
* Renders a FileUpload component with re upload icon when file state is moved to error.
|
|
775
|
-
*
|
|
776
|
-
* This example demonstrates how to use the FileUpload component with reupload.
|
|
777
|
-
*/
|
|
778
|
-
export const _WithFileRefresh = (args: FileUploadProps) => {
|
|
779
|
-
const ref = React.useRef(null);
|
|
780
|
-
const [files, setFiles] = React.useState([]);
|
|
781
|
-
|
|
782
|
-
const mockState = (id: string) => {
|
|
783
|
-
let progress = 0;
|
|
784
|
-
const intervalId = setInterval(() => {
|
|
785
|
-
progress += 5;
|
|
786
|
-
if (progress >= 105) {
|
|
787
|
-
// @ts-ignore - TS2339 - Property 'moveFileToSuccess' does not exist on type 'never'.
|
|
788
|
-
ref.current?.moveFileToSuccess(id);
|
|
789
|
-
clearInterval(intervalId);
|
|
790
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
791
|
-
setFiles(ref.current?.files);
|
|
792
|
-
} else {
|
|
793
|
-
// @ts-ignore - TS2339 - Property 'moveFileToProgress' does not exist on type 'never'.
|
|
794
|
-
ref.current?.moveFileToProgress(id, progress);
|
|
795
|
-
}
|
|
796
|
-
}, 100);
|
|
797
|
-
};
|
|
798
|
-
|
|
799
|
-
const mockReUpload = (id: string) => {
|
|
800
|
-
// @ts-ignore - TS2339 - Property 'setShowReUpload' does not exist on type 'never'.
|
|
801
|
-
ref.current?.setShowReUpload(id, true);
|
|
802
|
-
setTimeout(() => {
|
|
803
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
804
|
-
setFiles(ref.current?.files);
|
|
805
|
-
});
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
return (
|
|
809
|
-
<>
|
|
810
|
-
<div className={css.container}>
|
|
811
|
-
<div className={css.content}>
|
|
812
|
-
<FileUpload
|
|
813
|
-
{...args}
|
|
814
|
-
ref={ref}
|
|
815
|
-
onValidFilesDrop={(uploadedFiles) => {
|
|
816
|
-
uploadedFiles.forEach((file) => {
|
|
817
|
-
mockState(file.id);
|
|
818
|
-
});
|
|
819
|
-
}}
|
|
820
|
-
onRejectedFilesDrop={(uploadedFiles) => {
|
|
821
|
-
uploadedFiles.forEach((file) => {
|
|
822
|
-
mockReUpload(file.id);
|
|
823
|
-
});
|
|
824
|
-
}}
|
|
825
|
-
onFileRefreshClick={(file) => {
|
|
826
|
-
mockState(file.id);
|
|
827
|
-
}}
|
|
828
|
-
onFileClear={() => {
|
|
829
|
-
setTimeout(() => {
|
|
830
|
-
// @ts-ignore - TS2339 - Property 'files' does not exist on type 'never'.
|
|
831
|
-
setFiles(ref.current?.files);
|
|
832
|
-
});
|
|
833
|
-
}}
|
|
834
|
-
/>
|
|
835
|
-
</div>
|
|
836
|
-
</div>
|
|
837
|
-
<div className={css.fileDataContainer}>
|
|
838
|
-
<FileUploadData files={files || []} />
|
|
839
|
-
</div>
|
|
840
|
-
</>
|
|
841
|
-
);
|
|
842
|
-
};
|
|
843
|
-
|
|
844
|
-
_WithFileRefresh.args = {
|
|
845
|
-
label: 'Upload Files(Multiple files allowed)',
|
|
846
|
-
secondaryInstruction: 'Try uploading a file greater than 2MB',
|
|
847
|
-
maxFiles: 0,
|
|
848
|
-
maxSize: 2000000, // 2MB
|
|
849
|
-
};
|
|
850
|
-
|
|
851
|
-
type FileUploadTableProps = {
|
|
852
|
-
files: Array<FileObject>;
|
|
853
|
-
};
|
|
854
|
-
|
|
855
|
-
const emptyText = getRandomDataVariation();
|
|
856
|
-
|
|
857
|
-
const FileUploadData = (
|
|
858
|
-
{
|
|
859
|
-
files,
|
|
860
|
-
}: FileUploadTableProps,
|
|
861
|
-
) => (<div className={css.dataTable}>
|
|
862
|
-
<SubTitleMedium color="warning" className={css.textLabel}>
|
|
863
|
-
Data Table(This is not a part of File Upload Component)
|
|
864
|
-
</SubTitleMedium>
|
|
865
|
-
<DataTable files={files} />
|
|
866
|
-
</div>);
|
|
867
|
-
|
|
868
|
-
const DataTable = ({
|
|
869
|
-
files,
|
|
870
|
-
}: {
|
|
871
|
-
files: Array<FileObject>;
|
|
872
|
-
}) => (
|
|
873
|
-
<Table
|
|
874
|
-
entries={files}
|
|
875
|
-
emptyText={
|
|
876
|
-
<div className={css.emptyStateWrapper}>
|
|
877
|
-
<EmptyState
|
|
878
|
-
imageVariant="data"
|
|
879
|
-
title={emptyText.title}
|
|
880
|
-
description={emptyText.description}
|
|
881
|
-
></EmptyState>
|
|
882
|
-
</div>
|
|
883
|
-
}
|
|
884
|
-
headers={[
|
|
885
|
-
{
|
|
886
|
-
key: 'file',
|
|
887
|
-
label: `File Name`,
|
|
888
|
-
render: ({data}) => (
|
|
889
|
-
<BasicSingleCell className={css.mediumColumn}>
|
|
890
|
-
<BodyMedium color={data.success ? 'success' : 'danger'}>
|
|
891
|
-
<Truncate>{data.file.name}</Truncate>
|
|
892
|
-
</BodyMedium>
|
|
893
|
-
</BasicSingleCell>
|
|
894
|
-
),
|
|
895
|
-
},
|
|
896
|
-
{
|
|
897
|
-
key: 'file',
|
|
898
|
-
label: `File Type`,
|
|
899
|
-
render: ({data}) => (
|
|
900
|
-
<BasicSingleCell className={css.mediumColumn}>
|
|
901
|
-
<Link
|
|
902
|
-
as="bodyMedium"
|
|
903
|
-
href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types"
|
|
904
|
-
target="_blank"
|
|
905
|
-
>
|
|
906
|
-
<Truncate>{data.file.type}</Truncate>
|
|
907
|
-
</Link>
|
|
908
|
-
</BasicSingleCell>
|
|
909
|
-
),
|
|
910
|
-
},
|
|
911
|
-
{
|
|
912
|
-
key: 'file',
|
|
913
|
-
label: 'File Size',
|
|
914
|
-
render: ({data, className}) => (
|
|
915
|
-
<BasicSingleCell className={className}>
|
|
916
|
-
<BodyMedium>{convertFileSize(data.file.size)}</BodyMedium>
|
|
917
|
-
</BasicSingleCell>
|
|
918
|
-
),
|
|
919
|
-
},
|
|
920
|
-
{
|
|
921
|
-
key: 'success',
|
|
922
|
-
label: 'Is file Valid',
|
|
923
|
-
render: ({data, className}) => (
|
|
924
|
-
<BasicSingleCell className={className}>
|
|
925
|
-
<BodyMedium>{data.success ? 'true' : 'false'}</BodyMedium>
|
|
926
|
-
</BasicSingleCell>
|
|
927
|
-
),
|
|
928
|
-
},
|
|
929
|
-
{
|
|
930
|
-
key: 'reject',
|
|
931
|
-
label: 'Is File Rejected?',
|
|
932
|
-
render: ({data, className}) => (
|
|
933
|
-
<BasicSingleCell className={className}>
|
|
934
|
-
<BodyMedium>{data.reject ? 'true' : 'false'}</BodyMedium>
|
|
935
|
-
</BasicSingleCell>
|
|
936
|
-
),
|
|
937
|
-
},
|
|
938
|
-
{
|
|
939
|
-
key: 'rejectReason',
|
|
940
|
-
label: 'Rejection Reason',
|
|
941
|
-
render: ({data, className}) => (
|
|
942
|
-
<BasicSingleCell className={className}>
|
|
943
|
-
<BodyMedium>{data.rejectReason || '-'}</BodyMedium>
|
|
944
|
-
</BasicSingleCell>
|
|
945
|
-
),
|
|
946
|
-
},
|
|
947
|
-
{
|
|
948
|
-
key: 'showReUpload',
|
|
949
|
-
label: 'Show ReUpload',
|
|
950
|
-
render: ({data, className}) => (
|
|
951
|
-
<BasicSingleCell className={className}>
|
|
952
|
-
<BodyMedium>{data.showReUpload ? 'true' : 'false'}</BodyMedium>
|
|
953
|
-
</BasicSingleCell>
|
|
954
|
-
),
|
|
955
|
-
},
|
|
956
|
-
]}
|
|
957
|
-
/>
|
|
958
|
-
);
|