@stack-spot/portal-components 2.26.0 → 2.27.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/CHANGELOG.md +621 -614
- package/dist/components/AnimatedHeight.d.ts +1 -1
- package/dist/components/AnimatedHeight.js +26 -26
- package/dist/components/AsyncContent.d.ts +1 -1
- package/dist/components/AsyncContent.js +1 -1
- package/dist/components/BannerWarning.d.ts +1 -1
- package/dist/components/BannerWarning.js +1 -1
- package/dist/components/Breadcrumb/index.d.ts +2 -2
- package/dist/components/Breadcrumb/index.js +1 -1
- package/dist/components/Breadcrumb/styled.js +31 -31
- package/dist/components/ButtonLoading.d.ts +1 -1
- package/dist/components/ButtonLoading.js +1 -1
- package/dist/components/ChatBot.d.ts +1 -1
- package/dist/components/ChatBot.js +1 -1
- package/dist/components/ContentValidateFilter.d.ts +1 -1
- package/dist/components/ContentValidateFilter.js +1 -1
- package/dist/components/FadingOverflow.d.ts +1 -1
- package/dist/components/FadingOverflow.js +69 -69
- package/dist/components/FileTreeView/More.d.ts +1 -1
- package/dist/components/FileTreeView/More.js +1 -1
- package/dist/components/FileTreeView/index.d.ts +1 -1
- package/dist/components/FileTreeView/index.js +1 -1
- package/dist/components/InfiniteScroll.d.ts +1 -1
- package/dist/components/InfiniteScroll.js +1 -1
- package/dist/components/InfoMaintenanceBanner.d.ts +1 -1
- package/dist/components/InfoMaintenanceBanner.js +2 -2
- package/dist/components/LazyMarkdown/BlockquoteMd.d.ts +1 -1
- package/dist/components/LazyMarkdown/BlockquoteMd.js +1 -1
- package/dist/components/LazyMarkdown/CodeViewer.d.ts +1 -1
- package/dist/components/LazyMarkdown/CodeViewer.js +76 -76
- package/dist/components/LazyMarkdown/Markdown.d.ts +1 -1
- package/dist/components/LazyMarkdown/Markdown.js +1 -1
- package/dist/components/LazyMarkdown/MarkdownButton.d.ts +1 -1
- package/dist/components/LazyMarkdown/MarkdownButton.js +1 -1
- package/dist/components/LazyMarkdown/Video.d.ts +1 -1
- package/dist/components/LazyMarkdown/Video.js +1 -1
- package/dist/components/LazyMarkdown/index.d.ts +1 -1
- package/dist/components/LazyMarkdown/index.js +1 -1
- package/dist/components/Placeholder.d.ts +3 -3
- package/dist/components/Placeholder.js +1 -1
- package/dist/components/ScrollView.js +16 -16
- package/dist/components/Select/BadgeItem.d.ts +1 -1
- package/dist/components/Select/BadgeItem.js +1 -1
- package/dist/components/Select/ClearInput.d.ts +1 -1
- package/dist/components/Select/ClearInput.js +1 -1
- package/dist/components/Select/CloseItem.d.ts +1 -1
- package/dist/components/Select/CloseItem.js +1 -1
- package/dist/components/Select/CreatableSelect.js +1 -1
- package/dist/components/Select/CustomMenu.d.ts +1 -1
- package/dist/components/Select/CustomMenu.js +1 -1
- package/dist/components/Select/LabelItem.d.ts +1 -1
- package/dist/components/Select/LabelItem.js +1 -1
- package/dist/components/Select/MultiValue.d.ts +1 -1
- package/dist/components/Select/MultiValue.js +1 -1
- package/dist/components/Select/SelectInfiniteScroll.d.ts +1 -1
- package/dist/components/Select/SelectInfiniteScroll.js +1 -1
- package/dist/components/Select/SelectSearch.d.ts +1 -1
- package/dist/components/Select/SelectSearch.js +1 -1
- package/dist/components/SelectionList.d.ts +1 -1
- package/dist/components/SelectionList.js +61 -61
- package/dist/components/StatusCircle.d.ts +1 -1
- package/dist/components/StatusCircle.js +6 -6
- package/dist/components/Stepper/Navigation.js +4 -4
- package/dist/components/Stepper/Step.js +3 -3
- package/dist/components/Stepper/Stepper.js +6 -6
- package/dist/components/Stepper/headers.js +22 -22
- package/dist/components/Table/HeaderItem.js +1 -1
- package/dist/components/Table/SettingsVerticalMenu.d.ts +1 -1
- package/dist/components/Table/SettingsVerticalMenu.js +1 -1
- package/dist/components/Table/StyledLinkTable.d.ts +1 -1
- package/dist/components/Table/StyledLinkTable.js +5 -5
- package/dist/components/Table/TableData.d.ts +1 -1
- package/dist/components/Table/TableData.js +25 -25
- package/dist/components/TimelineSection.d.ts +1 -1
- package/dist/components/TimelineSection.js +14 -14
- package/dist/components/error/ErrorFeedback.d.ts +1 -1
- package/dist/components/error/ErrorFeedback.js +35 -35
- package/dist/components/error/NotFound.d.ts +1 -1
- package/dist/components/error/NotFound.js +1 -1
- package/dist/components/error/UnderMaintenance.d.ts +1 -1
- package/dist/components/error/UnderMaintenance.js +1 -1
- package/dist/components/form/Form/Form.d.ts +1 -1
- package/dist/components/form/Form/Form.js +1 -1
- package/dist/components/form/Form/FormGroup.d.ts +2 -2
- package/dist/components/form/Form/FormGroup.js +1 -1
- package/dist/components/form/SearchInput.d.ts +1 -1
- package/dist/components/form/SearchInput.js +1 -1
- package/dist/components/form/Select/CustomSelect.d.ts +1 -1
- package/dist/components/form/Select/CustomSelect.js +1 -1
- package/dist/components/form/Select/DetailedSelect.d.ts +1 -1
- package/dist/components/form/Select/DetailedSelect.js +1 -1
- package/dist/components/form/Select/Select.d.ts +1 -1
- package/dist/components/form/Select/Select.js +1 -1
- package/dist/components/form/Select/styled.js +161 -161
- package/dist/components/form/Select/utils.js +1 -1
- package/dist/components/notification/NotificationComponent.d.ts +1 -1
- package/dist/components/notification/NotificationComponent.js +54 -54
- package/dist/components/notification/NotificationItem.d.ts +1 -1
- package/dist/components/notification/NotificationItem.js +1 -1
- package/dist/components/notification/NotificationList.d.ts +1 -1
- package/dist/components/notification/NotificationList.js +43 -43
- package/dist/components/notification/NotificationPlaceholder.d.ts +1 -1
- package/dist/components/notification/NotificationPlaceholder.js +9 -9
- package/dist/components/notification/NotificationPlaceholder.js.map +1 -1
- package/dist/containers/NotificationsPage.d.ts +1 -1
- package/dist/containers/NotificationsPage.js +10 -10
- package/dist/context/anchor.d.ts +1 -1
- package/dist/context/anchor.js +1 -1
- package/dist/context/loading.d.ts +1 -1
- package/dist/context/loading.js +1 -1
- package/dist/context/notification/context.d.ts +1 -1
- package/dist/context/notification/context.js +1 -1
- package/dist/hooks/date.js +1 -1
- package/dist/hooks/service-now.js +28 -28
- package/dist/svg/AI.d.ts +1 -1
- package/dist/svg/AI.js +1 -1
- package/dist/svg/CS.d.ts +1 -1
- package/dist/svg/CS.js +1 -1
- package/dist/svg/EDP.d.ts +1 -1
- package/dist/svg/EDP.js +1 -1
- package/dist/svg/Forbidden.d.ts +1 -1
- package/dist/svg/Forbidden.js +1 -1
- package/dist/svg/GenericPlaceholder.d.ts +1 -1
- package/dist/svg/GenericPlaceholder.js +1 -1
- package/dist/svg/HUB.d.ts +1 -1
- package/dist/svg/HUB.js +1 -1
- package/dist/svg/Logo.d.ts +1 -1
- package/dist/svg/Logo.js +1 -1
- package/dist/svg/MiniLogo.d.ts +1 -1
- package/dist/svg/MiniLogo.js +1 -1
- package/dist/svg/NotFound.d.ts +1 -1
- package/dist/svg/NotFound.js +1 -1
- package/dist/svg/ServerError.d.ts +1 -1
- package/dist/svg/ServerError.js +1 -1
- package/dist/svg/Unauthenticated.d.ts +1 -1
- package/dist/svg/Unauthenticated.js +1 -1
- package/package.json +6 -6
- package/readme.md +66 -66
- package/src/components/AnimatedHeight.tsx +174 -174
- package/src/components/AsyncContent.tsx +78 -78
- package/src/components/BannerWarning.tsx +91 -91
- package/src/components/Breadcrumb/index.tsx +76 -76
- package/src/components/Breadcrumb/styled.ts +37 -37
- package/src/components/ButtonLoading.tsx +29 -29
- package/src/components/ChatBot.tsx +82 -82
- package/src/components/ContentValidateFilter.tsx +15 -15
- package/src/components/FadingOverflow.tsx +265 -265
- package/src/components/FileTreeView/More.tsx +114 -114
- package/src/components/FileTreeView/index.tsx +186 -186
- package/src/components/InfiniteScroll.tsx +24 -24
- package/src/components/InfoMaintenanceBanner.tsx +29 -29
- package/src/components/LazyMarkdown/BlockquoteMd.tsx +107 -107
- package/src/components/LazyMarkdown/CodeViewer.tsx +161 -161
- package/src/components/LazyMarkdown/Markdown.tsx +122 -122
- package/src/components/LazyMarkdown/MarkdownButton.tsx +24 -24
- package/src/components/LazyMarkdown/Video.tsx +13 -13
- package/src/components/LazyMarkdown/index.tsx +21 -21
- package/src/components/Placeholder.tsx +118 -118
- package/src/components/ScrollView.tsx +57 -57
- package/src/components/Select/BadgeItem.tsx +58 -58
- package/src/components/Select/ClearInput.tsx +24 -24
- package/src/components/Select/CloseItem.tsx +38 -38
- package/src/components/Select/CreatableSelect.tsx +155 -155
- package/src/components/Select/CustomMenu.tsx +16 -16
- package/src/components/Select/LabelItem.tsx +8 -8
- package/src/components/Select/MultiValue.tsx +49 -49
- package/src/components/Select/SelectInfiniteScroll.tsx +82 -82
- package/src/components/Select/SelectSearch.tsx +195 -195
- package/src/components/Select/index.tsx +7 -7
- package/src/components/Select/types.ts +8 -8
- package/src/components/SelectionList.tsx +427 -427
- package/src/components/StatusCircle.tsx +67 -67
- package/src/components/Stepper/Navigation.tsx +97 -97
- package/src/components/Stepper/Step.tsx +30 -30
- package/src/components/Stepper/Stepper.tsx +113 -113
- package/src/components/Stepper/headers.tsx +64 -64
- package/src/components/Stepper/index.ts +3 -3
- package/src/components/Table/HeaderItem.tsx +52 -52
- package/src/components/Table/SettingsVerticalMenu.tsx +50 -50
- package/src/components/Table/StyledLinkTable.tsx +22 -22
- package/src/components/Table/TableData.tsx +251 -251
- package/src/components/Table/index.tsx +2 -2
- package/src/components/TimelineSection.tsx +66 -66
- package/src/components/error/ErrorFeedback.tsx +217 -217
- package/src/components/error/NotFound.tsx +24 -24
- package/src/components/error/UnderMaintenance.tsx +30 -30
- package/src/components/error/index.ts +4 -4
- package/src/components/form/Form/Form.tsx +101 -101
- package/src/components/form/Form/FormGroup.tsx +221 -221
- package/src/components/form/Form/index.ts +2 -2
- package/src/components/form/SearchInput.tsx +69 -69
- package/src/components/form/Select/CustomSelect.tsx +232 -232
- package/src/components/form/Select/DetailedSelect.tsx +85 -85
- package/src/components/form/Select/Select.tsx +67 -67
- package/src/components/form/Select/index.ts +4 -4
- package/src/components/form/Select/styled.ts +165 -165
- package/src/components/form/Select/types.ts +112 -112
- package/src/components/form/Select/utils.tsx +28 -28
- package/src/components/notification/NotificationComponent.tsx +340 -340
- package/src/components/notification/NotificationItem.tsx +336 -336
- package/src/components/notification/NotificationList.tsx +178 -178
- package/src/components/notification/NotificationPlaceholder.tsx +43 -43
- package/src/components/notification/types.ts +72 -72
- package/src/containers/NotificationsPage.tsx +98 -98
- package/src/context/anchor.tsx +37 -37
- package/src/context/loading.tsx +36 -36
- package/src/context/notification/LazyNotificationList.ts +103 -103
- package/src/context/notification/NotificationController.ts +104 -104
- package/src/context/notification/context.tsx +23 -23
- package/src/context/notification/hooks.ts +98 -98
- package/src/context/notification/types.ts +65 -65
- package/src/hooks/date.ts +31 -31
- package/src/hooks/keyboard.tsx +128 -128
- package/src/hooks/manual-render.tsx +10 -10
- package/src/hooks/service-now.tsx +233 -233
- package/src/hooks/text.tsx +30 -30
- package/src/hooks/title.tsx +28 -28
- package/src/hooks/use-effect-once.tsx +43 -43
- package/src/index.ts +19 -19
- package/src/notifications.ts +11 -11
- package/src/svg/AI.tsx +41 -41
- package/src/svg/CS.tsx +48 -48
- package/src/svg/EDP.tsx +31 -31
- package/src/svg/Forbidden.tsx +22 -22
- package/src/svg/GenericPlaceholder.tsx +20 -20
- package/src/svg/HUB.tsx +48 -48
- package/src/svg/Logo.tsx +16 -16
- package/src/svg/MiniLogo.tsx +12 -12
- package/src/svg/NotFound.tsx +16 -16
- package/src/svg/ServerError.tsx +33 -33
- package/src/svg/Unauthenticated.tsx +16 -16
- package/src/svg/index.ts +11 -11
- package/src/utils/accessibility.ts +135 -135
- package/src/utils/cookie.ts +73 -73
- package/src/utils/promise.ts +5 -5
- package/src/utils/read-file.ts +16 -16
- package/tsconfig.json +10 -10
|
@@ -1,64 +1,64 @@
|
|
|
1
|
-
import { Box, Flex, Text } from '@citric/core'
|
|
2
|
-
import { theme } from '@stack-spot/portal-theme'
|
|
3
|
-
import { FC, useContext } from 'react'
|
|
4
|
-
import { styled } from 'styled-components'
|
|
5
|
-
import { StepperContext } from './Stepper'
|
|
6
|
-
|
|
7
|
-
const StyledStepHeader = styled(Box)`
|
|
8
|
-
flex: 1;
|
|
9
|
-
border-top: 0.25rem solid ${theme.color.light[600]};
|
|
10
|
-
padding-top: 1rem;
|
|
11
|
-
|
|
12
|
-
&.active {
|
|
13
|
-
border-color: ${theme.color.primary[500]};
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
&.finished {
|
|
17
|
-
flex: unset;
|
|
18
|
-
width: 4.5rem;
|
|
19
|
-
border-color: ${theme.color.success[500]};
|
|
20
|
-
}
|
|
21
|
-
`
|
|
22
|
-
|
|
23
|
-
const StyledStepHeaderText = styled(Text)`
|
|
24
|
-
color: ${theme.color.light.contrastText};
|
|
25
|
-
width: 100%;
|
|
26
|
-
height: 1.5rem;
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
text-overflow: ellipsis;
|
|
29
|
-
overflow: hidden;
|
|
30
|
-
`
|
|
31
|
-
|
|
32
|
-
interface StepperHeader {
|
|
33
|
-
/**
|
|
34
|
-
* Title that is passed to the step component is used here.
|
|
35
|
-
*/
|
|
36
|
-
title: string,
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export interface StepperHeadersProps {
|
|
40
|
-
headers: StepperHeader[],
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Renders a component that represents the visual part of a step within the stepper component.
|
|
45
|
-
* The initial color of the step is primary.500 and when completed it is changed to the success.500 color.
|
|
46
|
-
*
|
|
47
|
-
* The component stepper wraps this component.
|
|
48
|
-
*/
|
|
49
|
-
|
|
50
|
-
export const StepperHeaders: FC<StepperHeadersProps> = ({ headers }) => {
|
|
51
|
-
const { activeIndex } = useContext(StepperContext)
|
|
52
|
-
return (
|
|
53
|
-
<Flex sx={{ gap: '1rem' }}>
|
|
54
|
-
{headers.map((header, index) => (
|
|
55
|
-
<StyledStepHeader
|
|
56
|
-
key={header.title}
|
|
57
|
-
className={index < activeIndex ? 'finished' : (index === activeIndex ? 'active' : '')}
|
|
58
|
-
>
|
|
59
|
-
<StyledStepHeaderText>{header.title}</StyledStepHeaderText>
|
|
60
|
-
</StyledStepHeader>
|
|
61
|
-
))}
|
|
62
|
-
</Flex>
|
|
63
|
-
)
|
|
64
|
-
}
|
|
1
|
+
import { Box, Flex, Text } from '@citric/core'
|
|
2
|
+
import { theme } from '@stack-spot/portal-theme'
|
|
3
|
+
import { FC, useContext } from 'react'
|
|
4
|
+
import { styled } from 'styled-components'
|
|
5
|
+
import { StepperContext } from './Stepper'
|
|
6
|
+
|
|
7
|
+
const StyledStepHeader = styled(Box)`
|
|
8
|
+
flex: 1;
|
|
9
|
+
border-top: 0.25rem solid ${theme.color.light[600]};
|
|
10
|
+
padding-top: 1rem;
|
|
11
|
+
|
|
12
|
+
&.active {
|
|
13
|
+
border-color: ${theme.color.primary[500]};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
&.finished {
|
|
17
|
+
flex: unset;
|
|
18
|
+
width: 4.5rem;
|
|
19
|
+
border-color: ${theme.color.success[500]};
|
|
20
|
+
}
|
|
21
|
+
`
|
|
22
|
+
|
|
23
|
+
const StyledStepHeaderText = styled(Text)`
|
|
24
|
+
color: ${theme.color.light.contrastText};
|
|
25
|
+
width: 100%;
|
|
26
|
+
height: 1.5rem;
|
|
27
|
+
white-space: nowrap;
|
|
28
|
+
text-overflow: ellipsis;
|
|
29
|
+
overflow: hidden;
|
|
30
|
+
`
|
|
31
|
+
|
|
32
|
+
interface StepperHeader {
|
|
33
|
+
/**
|
|
34
|
+
* Title that is passed to the step component is used here.
|
|
35
|
+
*/
|
|
36
|
+
title: string,
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface StepperHeadersProps {
|
|
40
|
+
headers: StepperHeader[],
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Renders a component that represents the visual part of a step within the stepper component.
|
|
45
|
+
* The initial color of the step is primary.500 and when completed it is changed to the success.500 color.
|
|
46
|
+
*
|
|
47
|
+
* The component stepper wraps this component.
|
|
48
|
+
*/
|
|
49
|
+
|
|
50
|
+
export const StepperHeaders: FC<StepperHeadersProps> = ({ headers }) => {
|
|
51
|
+
const { activeIndex } = useContext(StepperContext)
|
|
52
|
+
return (
|
|
53
|
+
<Flex sx={{ gap: '1rem' }}>
|
|
54
|
+
{headers.map((header, index) => (
|
|
55
|
+
<StyledStepHeader
|
|
56
|
+
key={header.title}
|
|
57
|
+
className={index < activeIndex ? 'finished' : (index === activeIndex ? 'active' : '')}
|
|
58
|
+
>
|
|
59
|
+
<StyledStepHeaderText>{header.title}</StyledStepHeaderText>
|
|
60
|
+
</StyledStepHeader>
|
|
61
|
+
))}
|
|
62
|
+
</Flex>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { Stepper, StepperContext } from './Stepper'
|
|
2
|
-
export { Step } from './Step'
|
|
3
|
-
export { StepperNavigation } from './Navigation'
|
|
1
|
+
export { Stepper, StepperContext } from './Stepper'
|
|
2
|
+
export { Step } from './Step'
|
|
3
|
+
export { StepperNavigation } from './Navigation'
|
|
@@ -1,52 +1,52 @@
|
|
|
1
|
-
import { Button, Flex, IconBox, Styles, Text } from '@citric/core'
|
|
2
|
-
import { Props as FlexProps } from '@citric/core/dist/Flex'
|
|
3
|
-
import { SortAscending, SortDescending } from '@citric/icons'
|
|
4
|
-
import React, { ReactNode } from 'react'
|
|
5
|
-
|
|
6
|
-
export type SortTypes = 'ASC' | 'DESC' | undefined
|
|
7
|
-
|
|
8
|
-
interface HeaderSortProps extends FlexProps {
|
|
9
|
-
children: ReactNode | string,
|
|
10
|
-
sortType: SortTypes,
|
|
11
|
-
onSort: (sortType: SortTypes) => void,
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export const parseParams = ({ key, sort }: { key: string | undefined, sort: 'ASC' | 'DESC' | undefined }) =>
|
|
15
|
-
key && sort ? `${key?.toUpperCase()}_${sort?.toUpperCase()}` : undefined
|
|
16
|
-
|
|
17
|
-
function next(current: SortTypes) {
|
|
18
|
-
switch (current) {
|
|
19
|
-
case undefined: return 'ASC'
|
|
20
|
-
case 'ASC': return 'DESC'
|
|
21
|
-
case 'DESC': return undefined
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const HeaderSort: React.FC<HeaderSortProps> = ({ children, sortType, onSort, ...props }) => (
|
|
26
|
-
<Flex
|
|
27
|
-
as={Button}
|
|
28
|
-
appearance="text"
|
|
29
|
-
alignItems="center"
|
|
30
|
-
flexWrap="nowrap"
|
|
31
|
-
sx={{ '&:hover, &:active, &:focus': { borderColor: 'transparent' }, padding: 0 } as Styles}
|
|
32
|
-
onClick={() => onSort(next(sortType))} {...props}>
|
|
33
|
-
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
34
|
-
{children}
|
|
35
|
-
</Text>
|
|
36
|
-
|
|
37
|
-
<IconBox colorIcon="inverse.500" size="xs">
|
|
38
|
-
{sortType === 'ASC' && <SortAscending />}
|
|
39
|
-
{sortType === 'DESC' && <SortDescending />}
|
|
40
|
-
</IconBox>
|
|
41
|
-
</Flex>
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
type FullFlexProps = Parameters<typeof Flex>[0]
|
|
45
|
-
|
|
46
|
-
export const Header: React.FC<FullFlexProps> = ({ children, ...props }) => (
|
|
47
|
-
<Flex alignItems="center" {...props}>
|
|
48
|
-
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
49
|
-
{children}
|
|
50
|
-
</Text>
|
|
51
|
-
</Flex>
|
|
52
|
-
)
|
|
1
|
+
import { Button, Flex, IconBox, Styles, Text } from '@citric/core'
|
|
2
|
+
import { Props as FlexProps } from '@citric/core/dist/Flex'
|
|
3
|
+
import { SortAscending, SortDescending } from '@citric/icons'
|
|
4
|
+
import React, { ReactNode } from 'react'
|
|
5
|
+
|
|
6
|
+
export type SortTypes = 'ASC' | 'DESC' | undefined
|
|
7
|
+
|
|
8
|
+
interface HeaderSortProps extends FlexProps {
|
|
9
|
+
children: ReactNode | string,
|
|
10
|
+
sortType: SortTypes,
|
|
11
|
+
onSort: (sortType: SortTypes) => void,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export const parseParams = ({ key, sort }: { key: string | undefined, sort: 'ASC' | 'DESC' | undefined }) =>
|
|
15
|
+
key && sort ? `${key?.toUpperCase()}_${sort?.toUpperCase()}` : undefined
|
|
16
|
+
|
|
17
|
+
function next(current: SortTypes) {
|
|
18
|
+
switch (current) {
|
|
19
|
+
case undefined: return 'ASC'
|
|
20
|
+
case 'ASC': return 'DESC'
|
|
21
|
+
case 'DESC': return undefined
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export const HeaderSort: React.FC<HeaderSortProps> = ({ children, sortType, onSort, ...props }) => (
|
|
26
|
+
<Flex
|
|
27
|
+
as={Button}
|
|
28
|
+
appearance="text"
|
|
29
|
+
alignItems="center"
|
|
30
|
+
flexWrap="nowrap"
|
|
31
|
+
sx={{ '&:hover, &:active, &:focus': { borderColor: 'transparent' }, padding: 0 } as Styles}
|
|
32
|
+
onClick={() => onSort(next(sortType))} {...props}>
|
|
33
|
+
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
34
|
+
{children}
|
|
35
|
+
</Text>
|
|
36
|
+
|
|
37
|
+
<IconBox colorIcon="inverse.500" size="xs">
|
|
38
|
+
{sortType === 'ASC' && <SortAscending />}
|
|
39
|
+
{sortType === 'DESC' && <SortDescending />}
|
|
40
|
+
</IconBox>
|
|
41
|
+
</Flex>
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
type FullFlexProps = Parameters<typeof Flex>[0]
|
|
45
|
+
|
|
46
|
+
export const Header: React.FC<FullFlexProps> = ({ children, ...props }) => (
|
|
47
|
+
<Flex alignItems="center" {...props}>
|
|
48
|
+
<Text appearance="microtext1" mr="2" colorScheme="light.700">
|
|
49
|
+
{children}
|
|
50
|
+
</Text>
|
|
51
|
+
</Flex>
|
|
52
|
+
)
|
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { Box, IconBox, OneOfIconSizes } from '@citric/core'
|
|
2
|
-
import { SxProperties } from '@citric/core/dist/sx'
|
|
3
|
-
import { EllipsisVertical } from '@citric/icons'
|
|
4
|
-
import { IconButton } from '@citric/ui'
|
|
5
|
-
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
6
|
-
import { useState } from 'react'
|
|
7
|
-
|
|
8
|
-
interface SettingsVerticalMenuProps {
|
|
9
|
-
id: string,
|
|
10
|
-
buttonAriaLabel?: string,
|
|
11
|
-
size?: OneOfIconSizes,
|
|
12
|
-
sxIconButton?: SxProperties,
|
|
13
|
-
buttonDataTestHint?: string,
|
|
14
|
-
items: React.ComponentProps<typeof SelectionList>['items'],
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export const SettingsVerticalMenu = ({
|
|
18
|
-
id,
|
|
19
|
-
buttonAriaLabel,
|
|
20
|
-
size,
|
|
21
|
-
buttonDataTestHint,
|
|
22
|
-
sxIconButton,
|
|
23
|
-
items = [] }: SettingsVerticalMenuProps) => {
|
|
24
|
-
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
25
|
-
if (items?.length === 0) {
|
|
26
|
-
return null
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
return (
|
|
30
|
-
<Box sx={{ position: 'relative' }}>
|
|
31
|
-
<IconButton
|
|
32
|
-
role="button"
|
|
33
|
-
title={buttonAriaLabel}
|
|
34
|
-
data-test-hint={buttonDataTestHint}
|
|
35
|
-
aria-label={buttonAriaLabel}
|
|
36
|
-
onClick={() => setVisibleMenu(state => !state)} >
|
|
37
|
-
<IconBox size={size} sx={sxIconButton}>
|
|
38
|
-
<EllipsisVertical />
|
|
39
|
-
</IconBox>
|
|
40
|
-
</IconButton>
|
|
41
|
-
<SelectionList
|
|
42
|
-
id={id}
|
|
43
|
-
visible={visibleMenu}
|
|
44
|
-
onHide={() => setVisibleMenu(false)}
|
|
45
|
-
style={{ position: 'absolute', top: 40, right: 0, minWidth: '200px' }}
|
|
46
|
-
items={items}
|
|
47
|
-
/>
|
|
48
|
-
</Box>
|
|
49
|
-
)
|
|
50
|
-
}
|
|
1
|
+
import { Box, IconBox, OneOfIconSizes } from '@citric/core'
|
|
2
|
+
import { SxProperties } from '@citric/core/dist/sx'
|
|
3
|
+
import { EllipsisVertical } from '@citric/icons'
|
|
4
|
+
import { IconButton } from '@citric/ui'
|
|
5
|
+
import { SelectionList } from '@stack-spot/portal-components/SelectionList'
|
|
6
|
+
import { useState } from 'react'
|
|
7
|
+
|
|
8
|
+
interface SettingsVerticalMenuProps {
|
|
9
|
+
id: string,
|
|
10
|
+
buttonAriaLabel?: string,
|
|
11
|
+
size?: OneOfIconSizes,
|
|
12
|
+
sxIconButton?: SxProperties,
|
|
13
|
+
buttonDataTestHint?: string,
|
|
14
|
+
items: React.ComponentProps<typeof SelectionList>['items'],
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const SettingsVerticalMenu = ({
|
|
18
|
+
id,
|
|
19
|
+
buttonAriaLabel,
|
|
20
|
+
size,
|
|
21
|
+
buttonDataTestHint,
|
|
22
|
+
sxIconButton,
|
|
23
|
+
items = [] }: SettingsVerticalMenuProps) => {
|
|
24
|
+
const [visibleMenu, setVisibleMenu] = useState(false)
|
|
25
|
+
if (items?.length === 0) {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<Box sx={{ position: 'relative' }}>
|
|
31
|
+
<IconButton
|
|
32
|
+
role="button"
|
|
33
|
+
title={buttonAriaLabel}
|
|
34
|
+
data-test-hint={buttonDataTestHint}
|
|
35
|
+
aria-label={buttonAriaLabel}
|
|
36
|
+
onClick={() => setVisibleMenu(state => !state)} >
|
|
37
|
+
<IconBox size={size} sx={sxIconButton}>
|
|
38
|
+
<EllipsisVertical />
|
|
39
|
+
</IconBox>
|
|
40
|
+
</IconButton>
|
|
41
|
+
<SelectionList
|
|
42
|
+
id={id}
|
|
43
|
+
visible={visibleMenu}
|
|
44
|
+
onHide={() => setVisibleMenu(false)}
|
|
45
|
+
style={{ position: 'absolute', top: 40, right: 0, minWidth: '200px' }}
|
|
46
|
+
items={items}
|
|
47
|
+
/>
|
|
48
|
+
</Box>
|
|
49
|
+
)
|
|
50
|
+
}
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import styled from 'styled-components'
|
|
2
|
-
import { ReactNode } from 'react'
|
|
3
|
-
import { useAnchorTag } from '../../context/anchor'
|
|
4
|
-
|
|
5
|
-
const StyledLink = styled.a`
|
|
6
|
-
&:hover {
|
|
7
|
-
text-decoration: underline;
|
|
8
|
-
}
|
|
9
|
-
`
|
|
10
|
-
|
|
11
|
-
export const StyledLinkTable = ({
|
|
12
|
-
children,
|
|
13
|
-
...props
|
|
14
|
-
}: { children: ReactNode } & React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
|
15
|
-
const Link = useAnchorTag()
|
|
16
|
-
|
|
17
|
-
return (
|
|
18
|
-
<StyledLink as={Link} {...props}>
|
|
19
|
-
{children}
|
|
20
|
-
</StyledLink>
|
|
21
|
-
)
|
|
22
|
-
}
|
|
1
|
+
import styled from 'styled-components'
|
|
2
|
+
import { ReactNode } from 'react'
|
|
3
|
+
import { useAnchorTag } from '../../context/anchor'
|
|
4
|
+
|
|
5
|
+
const StyledLink = styled.a`
|
|
6
|
+
&:hover {
|
|
7
|
+
text-decoration: underline;
|
|
8
|
+
}
|
|
9
|
+
`
|
|
10
|
+
|
|
11
|
+
export const StyledLinkTable = ({
|
|
12
|
+
children,
|
|
13
|
+
...props
|
|
14
|
+
}: { children: ReactNode } & React.AnchorHTMLAttributes<HTMLAnchorElement>) => {
|
|
15
|
+
const Link = useAnchorTag()
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<StyledLink as={Link} {...props}>
|
|
19
|
+
{children}
|
|
20
|
+
</StyledLink>
|
|
21
|
+
)
|
|
22
|
+
}
|