sanity-plugin-media 4.3.6 → 5.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +6 -15
- package/dist/index.cjs +0 -4721
- package/dist/index.cjs.map +0 -1
- package/dist/index.d.cts +0 -239
- package/dist/index.d.cts.map +0 -1
- package/sanity.json +0 -8
- package/src/__tests__/fixtures/createEpicTestStore.ts +0 -28
- package/src/__tests__/fixtures/listenMock.ts +0 -9
- package/src/__tests__/fixtures/mockSanityClient.ts +0 -84
- package/src/__tests__/fixtures/renderWithProviders.tsx +0 -55
- package/src/__tests__/fixtures/rootState.ts +0 -27
- package/src/__tests__/fixtures/withinDialog.ts +0 -28
- package/src/components/AssetGridVirtualized/index.tsx +0 -94
- package/src/components/AssetMetadata/index.tsx +0 -122
- package/src/components/AssetTableVirtualized/index.tsx +0 -73
- package/src/components/AutoTagInputWrapper/index.tsx +0 -85
- package/src/components/Browser/Browser.test.tsx +0 -45
- package/src/components/Browser/index.tsx +0 -90
- package/src/components/Browser/useBrowserInit.ts +0 -126
- package/src/components/ButtonAssetCopy/index.tsx +0 -65
- package/src/components/ButtonViewGroup/index.tsx +0 -39
- package/src/components/CardAsset/CardAsset.test.tsx +0 -323
- package/src/components/CardAsset/index.tsx +0 -290
- package/src/components/CardUpload/index.tsx +0 -161
- package/src/components/Controls/index.tsx +0 -136
- package/src/components/DebugControls/index.tsx +0 -80
- package/src/components/Dialog/index.tsx +0 -11
- package/src/components/DialogAssetEdit/Details.tsx +0 -181
- package/src/components/DialogAssetEdit/DialogAssetEdit.test.tsx +0 -216
- package/src/components/DialogAssetEdit/index.tsx +0 -493
- package/src/components/DialogConfirm/index.tsx +0 -90
- package/src/components/DialogSearchFacets/index.tsx +0 -42
- package/src/components/DialogTagCreate/DialogTagCreate.test.tsx +0 -121
- package/src/components/DialogTagCreate/index.tsx +0 -111
- package/src/components/DialogTagEdit/DialogTagEdit.test.tsx +0 -165
- package/src/components/DialogTagEdit/index.tsx +0 -201
- package/src/components/DialogTags/index.tsx +0 -45
- package/src/components/Dialogs/index.tsx +0 -76
- package/src/components/DocumentList/index.tsx +0 -62
- package/src/components/FileAssetPreview/index.tsx +0 -37
- package/src/components/FileIcon/index.tsx +0 -43
- package/src/components/FormBuilderTool/FormBuilderTool.test.tsx +0 -63
- package/src/components/FormBuilderTool/index.tsx +0 -69
- package/src/components/FormFieldInputLabel/index.tsx +0 -66
- package/src/components/FormFieldInputTags/index.tsx +0 -98
- package/src/components/FormFieldInputText/index.tsx +0 -41
- package/src/components/FormFieldInputTextarea/index.tsx +0 -43
- package/src/components/FormSubmitButton/index.tsx +0 -59
- package/src/components/Header/index.tsx +0 -80
- package/src/components/Image/index.tsx +0 -41
- package/src/components/Items/index.tsx +0 -68
- package/src/components/Notifications/index.tsx +0 -24
- package/src/components/OrderSelect/index.tsx +0 -66
- package/src/components/PickedBar/index.tsx +0 -77
- package/src/components/Progress/index.tsx +0 -38
- package/src/components/ReduxProvider/index.tsx +0 -96
- package/src/components/SearchFacet/index.tsx +0 -66
- package/src/components/SearchFacetNumber/index.tsx +0 -133
- package/src/components/SearchFacetSelect/index.tsx +0 -110
- package/src/components/SearchFacetString/index.tsx +0 -88
- package/src/components/SearchFacetTags/index.tsx +0 -121
- package/src/components/SearchFacets/index.tsx +0 -72
- package/src/components/SearchFacetsControl/index.tsx +0 -140
- package/src/components/TableHeader/index.tsx +0 -110
- package/src/components/TableHeaderItem/index.tsx +0 -61
- package/src/components/TableRowAsset/index.tsx +0 -419
- package/src/components/TableRowUpload/index.tsx +0 -164
- package/src/components/Tag/index.tsx +0 -200
- package/src/components/TagIcon/index.tsx +0 -22
- package/src/components/TagView/index.tsx +0 -39
- package/src/components/TagViewHeader/index.tsx +0 -70
- package/src/components/TagsPanel/index.tsx +0 -40
- package/src/components/TagsVirtualized/index.tsx +0 -160
- package/src/components/TextInputNumber/index.tsx +0 -32
- package/src/components/TextInputSearch/index.tsx +0 -60
- package/src/components/Tool/index.tsx +0 -13
- package/src/components/UploadDropzone/UploadDropzone.test.tsx +0 -40
- package/src/components/UploadDropzone/index.tsx +0 -173
- package/src/config/orders.ts +0 -28
- package/src/config/searchFacets.ts +0 -312
- package/src/constants.ts +0 -87
- package/src/contexts/AssetSourceDispatchContext.tsx +0 -38
- package/src/contexts/DropzoneDispatchContext.tsx +0 -32
- package/src/contexts/ToolOptionsContext.tsx +0 -66
- package/src/formSchema/index.test.ts +0 -56
- package/src/formSchema/index.ts +0 -39
- package/src/hooks/useBreakpointIndex.ts +0 -50
- package/src/hooks/useKeyPress.ts +0 -39
- package/src/hooks/usePortalPopoverProps.ts +0 -13
- package/src/hooks/useTypedSelector.ts +0 -7
- package/src/hooks/useVersionedClient.ts +0 -6
- package/src/index.ts +0 -5
- package/src/modules/assets/actions.ts +0 -42
- package/src/modules/assets/deleteAndUpdateEpics.test.ts +0 -87
- package/src/modules/assets/fetchEpic.test.ts +0 -73
- package/src/modules/assets/index.ts +0 -782
- package/src/modules/assets/reducer.test.ts +0 -91
- package/src/modules/assets/tagsAndListenerEpics.test.ts +0 -206
- package/src/modules/debug/index.ts +0 -28
- package/src/modules/dialog/actions.ts +0 -10
- package/src/modules/dialog/epics.test.ts +0 -168
- package/src/modules/dialog/index.ts +0 -238
- package/src/modules/dialog/reducer.test.ts +0 -185
- package/src/modules/index.ts +0 -117
- package/src/modules/notifications/epics.test.ts +0 -374
- package/src/modules/notifications/index.ts +0 -199
- package/src/modules/notifications/reducer.test.ts +0 -54
- package/src/modules/search/index.test.ts +0 -36
- package/src/modules/search/index.ts +0 -167
- package/src/modules/selected/index.ts +0 -22
- package/src/modules/selectors.test.ts +0 -21
- package/src/modules/selectors.ts +0 -17
- package/src/modules/tags/epics.test.ts +0 -96
- package/src/modules/tags/index.test.ts +0 -42
- package/src/modules/tags/index.ts +0 -540
- package/src/modules/types.ts +0 -3
- package/src/modules/uploads/actions.ts +0 -13
- package/src/modules/uploads/epics.test.ts +0 -109
- package/src/modules/uploads/index.test.ts +0 -59
- package/src/modules/uploads/index.ts +0 -272
- package/src/operators/checkTagName.test.ts +0 -29
- package/src/operators/checkTagName.ts +0 -33
- package/src/operators/debugThrottle.ts +0 -25
- package/src/plugin.tsx +0 -54
- package/src/schemas/tag.ts +0 -28
- package/src/styled/GlobalStyles/index.tsx +0 -40
- package/src/styled/react-select/creatable.tsx +0 -184
- package/src/styled/react-select/single.tsx +0 -184
- package/src/types/index.ts +0 -346
- package/src/types/sanity-ui.d.ts +0 -5
- package/src/utils/applyMediaTags.ts +0 -87
- package/src/utils/blocksToText.test.ts +0 -43
- package/src/utils/blocksToText.ts +0 -27
- package/src/utils/constructFilter.test.ts +0 -120
- package/src/utils/constructFilter.ts +0 -98
- package/src/utils/generatePreviewBlobUrl.test.ts +0 -68
- package/src/utils/generatePreviewBlobUrl.ts +0 -53
- package/src/utils/getAssetResolution.test.ts +0 -13
- package/src/utils/getAssetResolution.ts +0 -7
- package/src/utils/getDocumentAssetIds.test.ts +0 -50
- package/src/utils/getDocumentAssetIds.ts +0 -35
- package/src/utils/getSchemeColor.test.ts +0 -12
- package/src/utils/getSchemeColor.ts +0 -43
- package/src/utils/getTagSelectOptions.test.ts +0 -44
- package/src/utils/getTagSelectOptions.ts +0 -16
- package/src/utils/getUniqueDocuments.test.ts +0 -26
- package/src/utils/getUniqueDocuments.ts +0 -15
- package/src/utils/imageDprUrl.test.ts +0 -46
- package/src/utils/imageDprUrl.ts +0 -27
- package/src/utils/isSupportedAssetType.test.ts +0 -16
- package/src/utils/isSupportedAssetType.ts +0 -15
- package/src/utils/mediaField.ts +0 -73
- package/src/utils/sanitizeFormData.test.ts +0 -59
- package/src/utils/sanitizeFormData.ts +0 -26
- package/src/utils/typeGuards.test.ts +0 -18
- package/src/utils/typeGuards.ts +0 -9
- package/src/utils/uploadSanityAsset.test.ts +0 -29
- package/src/utils/uploadSanityAsset.ts +0 -97
- package/src/utils/withMaxConcurrency.test.ts +0 -43
- package/src/utils/withMaxConcurrency.ts +0 -55
- package/src/utils/zodFormResolver.ts +0 -17
- package/v2-incompatible.js +0 -11
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import {AddIcon} from '@sanity/icons'
|
|
2
|
-
import {Button, Flex, Menu, MenuButton, MenuDivider, MenuGroup, MenuItem} from '@sanity/ui'
|
|
3
|
-
import {useDispatch} from 'react-redux'
|
|
4
|
-
|
|
5
|
-
import {FACETS} from '../../constants'
|
|
6
|
-
import {useToolOptions} from '../../contexts/ToolOptionsContext'
|
|
7
|
-
import {usePortalPopoverProps} from '../../hooks/usePortalPopoverProps'
|
|
8
|
-
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
9
|
-
import {searchActions} from '../../modules/search'
|
|
10
|
-
import type {SearchFacetDivider, SearchFacetGroup, SearchFacetInputProps} from '../../types'
|
|
11
|
-
|
|
12
|
-
const SearchFacetsControl = () => {
|
|
13
|
-
// Redux
|
|
14
|
-
const dispatch = useDispatch()
|
|
15
|
-
const assetTypes = useTypedSelector((state) => state.assets.assetTypes)
|
|
16
|
-
const searchFacets = useTypedSelector((state) => state.search.facets)
|
|
17
|
-
const selectedDocument = useTypedSelector((state) => state.selected.document)
|
|
18
|
-
|
|
19
|
-
const popoverProps = usePortalPopoverProps()
|
|
20
|
-
|
|
21
|
-
const {creditLine} = useToolOptions()
|
|
22
|
-
|
|
23
|
-
const isTool = !selectedDocument
|
|
24
|
-
|
|
25
|
-
const filteredFacets = FACETS
|
|
26
|
-
// Filter facets based on current context, whether it's invoked as a tool, or via selection through via custom asset source.
|
|
27
|
-
.filter((facet) => {
|
|
28
|
-
// Remove credit line filter if it's not enabled
|
|
29
|
-
if (!creditLine?.enabled && facet?.type === 'string' && facet?.name === 'creditLine') {
|
|
30
|
-
return false
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
if (facet.type === 'group' || facet.type === 'divider') {
|
|
34
|
-
return true
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
if (isTool) {
|
|
38
|
-
return !facet?.selectOnly
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
const matchingAssetTypes = facet.assetTypes.filter((assetType) =>
|
|
42
|
-
assetTypes.includes(assetType),
|
|
43
|
-
)
|
|
44
|
-
return matchingAssetTypes.length > 0
|
|
45
|
-
})
|
|
46
|
-
// Remove adjacent and leading / trailing dividers
|
|
47
|
-
.filter((facet, index, facets) => {
|
|
48
|
-
const previousFacet = facets[index - 1]
|
|
49
|
-
// Ignore leading + trailing dividers
|
|
50
|
-
if (facet.type === 'divider' && (index === 0 || index === facets.length - 1)) {
|
|
51
|
-
return false
|
|
52
|
-
}
|
|
53
|
-
// Ignore adjacent dividers
|
|
54
|
-
if (facet.type === 'divider' && previousFacet?.type === 'divider') {
|
|
55
|
-
return false
|
|
56
|
-
}
|
|
57
|
-
return true
|
|
58
|
-
})
|
|
59
|
-
|
|
60
|
-
const hasSearchFacets = filteredFacets.length > 0
|
|
61
|
-
|
|
62
|
-
const renderMenuFacets = (
|
|
63
|
-
facets: (SearchFacetDivider | SearchFacetGroup | SearchFacetInputProps)[],
|
|
64
|
-
level: number = 0,
|
|
65
|
-
) => {
|
|
66
|
-
return (
|
|
67
|
-
<>
|
|
68
|
-
{facets?.map((facet, index) => {
|
|
69
|
-
if (facet.type === 'divider') {
|
|
70
|
-
return <MenuDivider key={index} />
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Recursively render menu facets
|
|
74
|
-
if (facet.type === 'group') {
|
|
75
|
-
return (
|
|
76
|
-
<MenuGroup key={`group-${level}-${index}`} text={facet.title} title={facet.title}>
|
|
77
|
-
{renderMenuFacets(facet.facets, level + 1)}
|
|
78
|
-
</MenuGroup>
|
|
79
|
-
)
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
if (facet) {
|
|
83
|
-
const disabled =
|
|
84
|
-
!facet.operatorTypes && !!searchFacets.find((v) => v.name === facet.name)
|
|
85
|
-
|
|
86
|
-
return (
|
|
87
|
-
<MenuItem
|
|
88
|
-
disabled={disabled}
|
|
89
|
-
fontSize={1}
|
|
90
|
-
key={facet.name}
|
|
91
|
-
onClick={() => dispatch(searchActions.facetsAdd({facet}))}
|
|
92
|
-
padding={2}
|
|
93
|
-
text={facet.title}
|
|
94
|
-
/>
|
|
95
|
-
)
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
return null
|
|
99
|
-
})}
|
|
100
|
-
</>
|
|
101
|
-
)
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
return (
|
|
105
|
-
<Flex>
|
|
106
|
-
{/* Add filter button */}
|
|
107
|
-
<MenuButton
|
|
108
|
-
button={
|
|
109
|
-
<Button
|
|
110
|
-
disabled={!hasSearchFacets}
|
|
111
|
-
fontSize={1}
|
|
112
|
-
icon={AddIcon}
|
|
113
|
-
mode="bleed"
|
|
114
|
-
space={2}
|
|
115
|
-
text="Add filter"
|
|
116
|
-
tone="primary"
|
|
117
|
-
/>
|
|
118
|
-
}
|
|
119
|
-
id="facets"
|
|
120
|
-
menu={<Menu>{renderMenuFacets(filteredFacets)}</Menu>}
|
|
121
|
-
popover={{
|
|
122
|
-
...popoverProps,
|
|
123
|
-
placement: 'right-start',
|
|
124
|
-
}}
|
|
125
|
-
/>
|
|
126
|
-
|
|
127
|
-
{/* Clear facets button */}
|
|
128
|
-
{searchFacets.length > 0 && (
|
|
129
|
-
<Button
|
|
130
|
-
fontSize={1}
|
|
131
|
-
mode="bleed"
|
|
132
|
-
onClick={() => dispatch(searchActions.facetsClear())}
|
|
133
|
-
text="Clear"
|
|
134
|
-
/>
|
|
135
|
-
)}
|
|
136
|
-
</Flex>
|
|
137
|
-
)
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
export default SearchFacetsControl
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
import {Checkbox, Flex, Grid, type ThemeColorSchemeKey, useMediaIndex} from '@sanity/ui'
|
|
2
|
-
import {type MouseEvent} from 'react'
|
|
3
|
-
import {useDispatch} from 'react-redux'
|
|
4
|
-
import {useColorSchemeValue} from 'sanity'
|
|
5
|
-
import {styled, css} from 'styled-components'
|
|
6
|
-
|
|
7
|
-
import {GRID_TEMPLATE_COLUMNS, PANEL_HEIGHT} from '../../constants'
|
|
8
|
-
import {useAssetSourceActions} from '../../contexts/AssetSourceDispatchContext'
|
|
9
|
-
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
10
|
-
import {assetsActions, selectAssetsLength, selectAssetsPickedLength} from '../../modules/assets'
|
|
11
|
-
import {getSchemeColor} from '../../utils/getSchemeColor'
|
|
12
|
-
import TableHeaderItem from '../TableHeaderItem'
|
|
13
|
-
|
|
14
|
-
// TODO: DRY
|
|
15
|
-
const ContextActionContainer = styled<typeof Flex, {$scheme: ThemeColorSchemeKey}>(Flex)(({
|
|
16
|
-
$scheme,
|
|
17
|
-
}) => {
|
|
18
|
-
return css`
|
|
19
|
-
cursor: pointer;
|
|
20
|
-
@media (hover: hover) and (pointer: fine) {
|
|
21
|
-
&:hover {
|
|
22
|
-
background: ${getSchemeColor($scheme, 'bg')};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
`
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
const TableHeader = () => {
|
|
29
|
-
const scheme = useColorSchemeValue()
|
|
30
|
-
|
|
31
|
-
// Redux
|
|
32
|
-
const dispatch = useDispatch()
|
|
33
|
-
const fetching = useTypedSelector((state) => state.assets.fetching)
|
|
34
|
-
const itemsLength = useTypedSelector(selectAssetsLength)
|
|
35
|
-
const numPickedAssets = useTypedSelector(selectAssetsPickedLength)
|
|
36
|
-
|
|
37
|
-
const mediaIndex = useMediaIndex()
|
|
38
|
-
const {onSelect} = useAssetSourceActions()
|
|
39
|
-
|
|
40
|
-
const allSelected = numPickedAssets === itemsLength
|
|
41
|
-
|
|
42
|
-
// Callbacks
|
|
43
|
-
const handleContextActionClick = (e: MouseEvent) => {
|
|
44
|
-
e.stopPropagation()
|
|
45
|
-
|
|
46
|
-
if (allSelected) {
|
|
47
|
-
dispatch(assetsActions.pickClear())
|
|
48
|
-
} else {
|
|
49
|
-
dispatch(assetsActions.pickAll())
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
// Note that even though we hide the table header on smaller breakpoints, we never set it to
|
|
54
|
-
// `display: none`, as doing so causes issues with react-virtuoso.
|
|
55
|
-
// Instead, we give it 0 height and hide it with `visibility: hidden`.
|
|
56
|
-
return (
|
|
57
|
-
<Grid
|
|
58
|
-
style={{
|
|
59
|
-
alignItems: 'center',
|
|
60
|
-
background: 'var(--card-bg-color)',
|
|
61
|
-
borderBottom: '1px solid var(--card-border-color)',
|
|
62
|
-
gridColumnGap: mediaIndex < 3 ? 0 : '16px',
|
|
63
|
-
gridTemplateColumns: GRID_TEMPLATE_COLUMNS.LARGE,
|
|
64
|
-
height: mediaIndex < 3 ? 0 : `${PANEL_HEIGHT}px`,
|
|
65
|
-
letterSpacing: '0.025em',
|
|
66
|
-
position: 'sticky',
|
|
67
|
-
textTransform: 'uppercase',
|
|
68
|
-
top: 0,
|
|
69
|
-
visibility: mediaIndex < 3 ? 'hidden' : 'visible',
|
|
70
|
-
width: '100%',
|
|
71
|
-
zIndex: 1, // force stacking context
|
|
72
|
-
}}
|
|
73
|
-
>
|
|
74
|
-
{onSelect ? (
|
|
75
|
-
<TableHeaderItem />
|
|
76
|
-
) : (
|
|
77
|
-
<ContextActionContainer
|
|
78
|
-
align="center"
|
|
79
|
-
justify="center"
|
|
80
|
-
onClick={handleContextActionClick}
|
|
81
|
-
$scheme={scheme}
|
|
82
|
-
style={{
|
|
83
|
-
height: '100%',
|
|
84
|
-
position: 'relative',
|
|
85
|
-
}}
|
|
86
|
-
>
|
|
87
|
-
<Checkbox
|
|
88
|
-
checked={!fetching && allSelected}
|
|
89
|
-
readOnly
|
|
90
|
-
style={{
|
|
91
|
-
pointerEvents: 'none', // TODO: consider alternative for usability
|
|
92
|
-
transform: 'scale(0.8)',
|
|
93
|
-
}}
|
|
94
|
-
/>
|
|
95
|
-
</ContextActionContainer>
|
|
96
|
-
)}
|
|
97
|
-
|
|
98
|
-
<TableHeaderItem />
|
|
99
|
-
<TableHeaderItem field="originalFilename" title="Filename" />
|
|
100
|
-
<TableHeaderItem title="Resolution" />
|
|
101
|
-
<TableHeaderItem field="mimeType" title="MIME type" />
|
|
102
|
-
<TableHeaderItem field="size" title="Size" />
|
|
103
|
-
<TableHeaderItem field="_updatedAt" title="Last updated" />
|
|
104
|
-
<TableHeaderItem title="References" />
|
|
105
|
-
<TableHeaderItem />
|
|
106
|
-
</Grid>
|
|
107
|
-
)
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
export default TableHeader
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import {ChevronDownIcon, ChevronUpIcon} from '@sanity/icons'
|
|
2
|
-
import {Box, Label} from '@sanity/ui'
|
|
3
|
-
import {useDispatch} from 'react-redux'
|
|
4
|
-
|
|
5
|
-
import useTypedSelector from '../../hooks/useTypedSelector'
|
|
6
|
-
import {assetsActions} from '../../modules/assets'
|
|
7
|
-
|
|
8
|
-
type Props = {
|
|
9
|
-
field?: string
|
|
10
|
-
title?: string
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
const TableHeaderItem = (props: Props) => {
|
|
14
|
-
const {field, title} = props
|
|
15
|
-
|
|
16
|
-
// Redux
|
|
17
|
-
const dispatch = useDispatch()
|
|
18
|
-
const order = useTypedSelector((state) => state.assets.order)
|
|
19
|
-
|
|
20
|
-
const isActive = order.field === field
|
|
21
|
-
|
|
22
|
-
// Callbacks
|
|
23
|
-
const handleClick = () => {
|
|
24
|
-
if (!field || !title) {
|
|
25
|
-
return
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
if (isActive) {
|
|
29
|
-
const direction = order.direction === 'asc' ? 'desc' : 'asc'
|
|
30
|
-
dispatch(assetsActions.orderSet({order: {field, direction}}))
|
|
31
|
-
} else {
|
|
32
|
-
dispatch(assetsActions.orderSet({order: {field, direction: 'asc'}}))
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
return (
|
|
37
|
-
<Label muted={!field} size={0}>
|
|
38
|
-
<Box
|
|
39
|
-
onClick={field ? handleClick : undefined}
|
|
40
|
-
style={{
|
|
41
|
-
cursor: field ? 'pointer' : 'default',
|
|
42
|
-
display: 'inline',
|
|
43
|
-
whiteSpace: 'nowrap',
|
|
44
|
-
}}
|
|
45
|
-
>
|
|
46
|
-
<span
|
|
47
|
-
style={{
|
|
48
|
-
marginRight: '0.4em',
|
|
49
|
-
}}
|
|
50
|
-
>
|
|
51
|
-
{title}
|
|
52
|
-
</span>
|
|
53
|
-
|
|
54
|
-
{isActive && order?.direction === 'asc' && <ChevronUpIcon />}
|
|
55
|
-
{isActive && order?.direction === 'desc' && <ChevronDownIcon />}
|
|
56
|
-
</Box>
|
|
57
|
-
</Label>
|
|
58
|
-
)
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export default TableHeaderItem
|