@registrucentras/rc-ses-react-components 1.12.0 → 1.13.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/dist/assets/icons/CaretUpBoldIcon.d.ts +3 -0
- package/dist/assets/icons/CaretUpIcon.d.ts +3 -0
- package/dist/assets/icons/ListIcon.d.ts +3 -0
- package/dist/assets/icons/MinusIcon.d.ts +3 -0
- package/dist/assets/icons/NotePencilIcon.d.ts +3 -0
- package/dist/assets/icons/PlusIcon.d.ts +3 -0
- package/dist/assets/icons/TrashIcon.d.ts +3 -0
- package/dist/assets/icons/UserIcon.d.ts +3 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +106 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +12 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +7 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.d.ts +2 -0
- package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +4 -0
- package/dist/components/common/AdvancedList/index.d.ts +11 -0
- package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +4 -1
- package/dist/components/common/SelectableCardList/index.d.ts +3 -0
- package/dist/components/form/inputs/Select/index.d.ts +1 -0
- package/dist/library/icons.d.ts +9 -1
- package/dist/library/index.d.ts +3 -0
- package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
- package/dist/registrucentras-rc-ses-react-components.js +3807 -3102
- package/dist/stories/components/display/AdvancedList.stories.d.ts +33 -0
- package/dist/stories/components/display/AdvancedListItem.stories.d.ts +33 -0
- package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +3 -3
- package/dist/theme/motion.d.ts +16 -0
- package/package.json +1 -1
- package/src/assets/icons/CaretUpBoldIcon.tsx +17 -0
- package/src/assets/icons/CaretUpIcon.tsx +9 -0
- package/src/assets/icons/ListIcon.tsx +17 -0
- package/src/assets/icons/MinusIcon.tsx +9 -0
- package/src/assets/icons/NotePencilIcon.tsx +9 -0
- package/src/assets/icons/PlusIcon.tsx +9 -0
- package/src/assets/icons/TrashIcon.tsx +23 -0
- package/src/assets/icons/UserIcon.tsx +17 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +100 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +214 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +241 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.test.ts +80 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.ts +28 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +631 -0
- package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +329 -0
- package/src/components/common/AdvancedList/index.test.tsx +97 -0
- package/src/components/common/AdvancedList/index.tsx +52 -0
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +50 -0
- package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +34 -0
- package/src/components/common/SelectableCardList/index.tsx +6 -0
- package/src/components/common/Tooltip/index.test.tsx +1 -3
- package/src/components/form/inputs/FileDropzone.tsx +1 -0
- package/src/components/form/inputs/FileUpload.tsx +1 -0
- package/src/components/form/inputs/NumberStepper.tsx +1 -0
- package/src/components/form/inputs/RadioButtonGroup.test.tsx +71 -0
- package/src/components/form/inputs/RadioButtonGroup.tsx +1 -0
- package/src/components/form/inputs/Select/index.test.tsx +57 -0
- package/src/components/form/inputs/Select/index.tsx +2 -0
- package/src/i18n/namespaces/common/en.json +11 -0
- package/src/i18n/namespaces/common/lt.json +11 -0
- package/src/library/icons.ts +16 -0
- package/src/library/index.ts +3 -0
- package/src/setupTests.ts +7 -1
- package/src/stories/components/display/AdvancedList.stories.tsx +660 -0
- package/src/stories/components/display/AdvancedListItem.stories.tsx +593 -0
- package/src/stories/components/display/SelectableCardList.stories.tsx +3 -0
- package/src/theme/motion.tsx +10 -0
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { AdvancedListItemData, AdvancedListProps } from '../../../components/common/AdvancedList';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ items, error }: AdvancedListProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
tags: string[];
|
|
7
|
+
args: {
|
|
8
|
+
items: AdvancedListItemData[];
|
|
9
|
+
error: undefined;
|
|
10
|
+
};
|
|
11
|
+
argTypes: {
|
|
12
|
+
items: {
|
|
13
|
+
control: false;
|
|
14
|
+
};
|
|
15
|
+
error: {
|
|
16
|
+
control: false;
|
|
17
|
+
};
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export default meta;
|
|
21
|
+
type Story = StoryObj<typeof meta>;
|
|
22
|
+
export declare const Main: Story;
|
|
23
|
+
export declare const Error: Story;
|
|
24
|
+
export declare const KitchenSink: Story;
|
|
25
|
+
export declare const OwnerTypeExpand: Story;
|
|
26
|
+
export declare const RadioBranchForm: Story;
|
|
27
|
+
export declare const FigmaAnatomy: Story;
|
|
28
|
+
export declare const LeadingOptions: Story;
|
|
29
|
+
export declare const TrailingOptions: Story;
|
|
30
|
+
export declare const StateShowcase: Story;
|
|
31
|
+
export declare const UniversalPresetList: Story;
|
|
32
|
+
export declare const PaymentTileList: Story;
|
|
33
|
+
export declare const CartWithDeleteList: Story;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { StoryObj } from '@storybook/react';
|
|
2
|
+
import { AdvancedListItemProps } from '../../../components/common/AdvancedList/components/AdvancedListItem';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: ({ title, label, subtitle, metaItems, leadingMedia, expandedContent, expanded, onExpandedChange, leading, trailing, state, onClick, }: AdvancedListItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
tags: string[];
|
|
7
|
+
args: {
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle: string;
|
|
10
|
+
state: "rest";
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
export default meta;
|
|
14
|
+
type Story = StoryObj<typeof meta>;
|
|
15
|
+
export declare const Main: Story;
|
|
16
|
+
export declare const Selected: Story;
|
|
17
|
+
export declare const Disabled: Story;
|
|
18
|
+
export declare const ErrorState: Story;
|
|
19
|
+
export declare const IgaliotojaiPreset: Story;
|
|
20
|
+
export declare const JaAtstovaiRedaguojamaPreset: Story;
|
|
21
|
+
export declare const JaAtstovaiPerziuraPreset: Story;
|
|
22
|
+
export declare const PasirenkamasSarasasPreset: Story;
|
|
23
|
+
export declare const CheckboxWithLeadingMedia: Story;
|
|
24
|
+
export declare const KrepselisPreset: Story;
|
|
25
|
+
export declare const RadioExpand: Story;
|
|
26
|
+
export declare const CheckboxExpand: Story;
|
|
27
|
+
export declare const NestedRadioGroup: Story;
|
|
28
|
+
export declare const LongExpandedContent: Story;
|
|
29
|
+
export declare const TrailingShowcase: Story;
|
|
30
|
+
export declare const LeadingShowcase: Story;
|
|
31
|
+
export declare const UniversalPreset: Story;
|
|
32
|
+
export declare const PaymentTilePreset: Story;
|
|
33
|
+
export declare const KrepselisWithDeletePreset: Story;
|
|
@@ -14,11 +14,11 @@ declare const meta: {
|
|
|
14
14
|
argTypes: {
|
|
15
15
|
color: {
|
|
16
16
|
description: string;
|
|
17
|
-
options: ("inherit" | "
|
|
18
|
-
mapping: ("inherit" | "
|
|
17
|
+
options: ("inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning")[];
|
|
18
|
+
mapping: ("inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning")[];
|
|
19
19
|
control: {
|
|
20
20
|
type: "select";
|
|
21
|
-
labels: ("inherit" | "
|
|
21
|
+
labels: ("inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning")[];
|
|
22
22
|
};
|
|
23
23
|
table: {
|
|
24
24
|
defaultValue: {
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
declare const duration: {
|
|
2
|
+
standard: number;
|
|
3
|
+
};
|
|
4
|
+
declare const easing: {
|
|
5
|
+
standard: string;
|
|
6
|
+
};
|
|
7
|
+
export { duration, easing };
|
|
8
|
+
declare const _default: {
|
|
9
|
+
duration: {
|
|
10
|
+
standard: number;
|
|
11
|
+
};
|
|
12
|
+
easing: {
|
|
13
|
+
standard: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export default _default;
|
package/package.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { CaretUpIcon as CaretUp } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function CaretUpBoldIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
|
|
6
|
+
return (
|
|
7
|
+
<CaretUp
|
|
8
|
+
{...rest}
|
|
9
|
+
className={className}
|
|
10
|
+
size={size}
|
|
11
|
+
weight='bold'
|
|
12
|
+
color={fillColor}
|
|
13
|
+
/>
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default CaretUpBoldIcon
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { CaretUpIcon as CaretUp } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function CaretUpBoldIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
|
|
6
|
+
return <CaretUp {...rest} className={className} size={size} color={fillColor} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default CaretUpBoldIcon
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ListIcon as List } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function ListIcon({
|
|
6
|
+
className,
|
|
7
|
+
fillColor,
|
|
8
|
+
size = 24,
|
|
9
|
+
weight = 'regular',
|
|
10
|
+
...rest
|
|
11
|
+
}: IconProps) {
|
|
12
|
+
return (
|
|
13
|
+
<List {...rest} className={className} size={size} weight={weight} color={fillColor} />
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default ListIcon
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { MinusIcon as Minus } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function MinusIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
|
|
6
|
+
return <Minus {...rest} className={className} size={size} color={fillColor} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default MinusIcon
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { NotePencilIcon as NotePencil } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function NotePencilIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
|
|
6
|
+
return <NotePencil {...rest} className={className} size={size} color={fillColor} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default NotePencilIcon
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { PlusIcon as Plus } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function PlusIcon({ className, size = 16, fillColor, ...rest }: IconProps) {
|
|
6
|
+
return <Plus {...rest} className={className} size={size} color={fillColor} />
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export default PlusIcon
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { TrashIcon as Trash } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function TrashIcon({
|
|
6
|
+
className,
|
|
7
|
+
fillColor,
|
|
8
|
+
size = 24,
|
|
9
|
+
weight = 'regular',
|
|
10
|
+
...rest
|
|
11
|
+
}: IconProps) {
|
|
12
|
+
return (
|
|
13
|
+
<Trash
|
|
14
|
+
{...rest}
|
|
15
|
+
className={className}
|
|
16
|
+
size={size}
|
|
17
|
+
weight={weight}
|
|
18
|
+
color={fillColor}
|
|
19
|
+
/>
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export default TrashIcon
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { UserIcon as User } from '@phosphor-icons/react'
|
|
2
|
+
|
|
3
|
+
import IconProps from '../IconProps'
|
|
4
|
+
|
|
5
|
+
function UserIcon({
|
|
6
|
+
className,
|
|
7
|
+
fillColor,
|
|
8
|
+
size = 24,
|
|
9
|
+
weight = 'regular',
|
|
10
|
+
...rest
|
|
11
|
+
}: IconProps) {
|
|
12
|
+
return (
|
|
13
|
+
<User {...rest} className={className} size={size} weight={weight} color={fillColor} />
|
|
14
|
+
)
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export default UserIcon
|
package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { ComponentType, ReactNode } from 'react'
|
|
2
|
+
|
|
3
|
+
import { ListWithIconsItemData } from '@/components/common/ListWithIcons/ListWithIcons.types'
|
|
4
|
+
|
|
5
|
+
export type AdvancedListItemState = 'rest' | 'selected' | 'disabled' | 'error'
|
|
6
|
+
|
|
7
|
+
export type AdvancedListItemStatusColor = 'grey' | 'warning' | 'success' | 'error'
|
|
8
|
+
|
|
9
|
+
export type AdvancedListItemAction = {
|
|
10
|
+
label: string
|
|
11
|
+
icon?: ComponentType<{ fillColor?: string; size?: number }>
|
|
12
|
+
onClick: () => void
|
|
13
|
+
disabled?: boolean
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export type AdvancedListItemLeading =
|
|
17
|
+
| { type: 'none' }
|
|
18
|
+
| {
|
|
19
|
+
type: 'reorder'
|
|
20
|
+
onMoveUp?: () => void
|
|
21
|
+
onMoveDown?: () => void
|
|
22
|
+
moveUpDisabled?: boolean
|
|
23
|
+
moveDownDisabled?: boolean
|
|
24
|
+
}
|
|
25
|
+
| {
|
|
26
|
+
type: 'checkbox'
|
|
27
|
+
checked: boolean
|
|
28
|
+
onChange: (checked: boolean) => void
|
|
29
|
+
'aria-label'?: string
|
|
30
|
+
}
|
|
31
|
+
| {
|
|
32
|
+
type: 'radio'
|
|
33
|
+
checked: boolean
|
|
34
|
+
onChange: (checked: boolean) => void
|
|
35
|
+
name?: string
|
|
36
|
+
'aria-label'?: string
|
|
37
|
+
}
|
|
38
|
+
| { type: 'drag'; 'aria-label'?: string }
|
|
39
|
+
| {
|
|
40
|
+
type: 'icon'
|
|
41
|
+
icon: ComponentType<{ fillColor?: string; size?: number }>
|
|
42
|
+
'aria-label'?: string
|
|
43
|
+
}
|
|
44
|
+
| { type: 'avatar'; initials?: string; src?: string; alt?: string }
|
|
45
|
+
| { type: 'index'; index: number }
|
|
46
|
+
|
|
47
|
+
export type AdvancedListItemTrailing =
|
|
48
|
+
| { type: 'none' }
|
|
49
|
+
| { type: 'actions'; actions: AdvancedListItemAction[] }
|
|
50
|
+
| {
|
|
51
|
+
type: 'toggle'
|
|
52
|
+
checked: boolean
|
|
53
|
+
onChange: (checked: boolean) => void
|
|
54
|
+
'aria-label'?: string
|
|
55
|
+
}
|
|
56
|
+
| { type: 'status'; label: string; color?: AdvancedListItemStatusColor }
|
|
57
|
+
| {
|
|
58
|
+
type: 'price'
|
|
59
|
+
amount: string
|
|
60
|
+
caption?: string
|
|
61
|
+
onDelete?: () => void
|
|
62
|
+
deleteAriaLabel?: string
|
|
63
|
+
}
|
|
64
|
+
| {
|
|
65
|
+
type: 'checkbox'
|
|
66
|
+
checked: boolean
|
|
67
|
+
onChange: (checked: boolean) => void
|
|
68
|
+
'aria-label'?: string
|
|
69
|
+
}
|
|
70
|
+
| {
|
|
71
|
+
type: 'radio'
|
|
72
|
+
checked: boolean
|
|
73
|
+
onChange: (checked: boolean) => void
|
|
74
|
+
name?: string
|
|
75
|
+
'aria-label'?: string
|
|
76
|
+
}
|
|
77
|
+
| { type: 'chevron' }
|
|
78
|
+
| {
|
|
79
|
+
type: 'stepper'
|
|
80
|
+
value: number
|
|
81
|
+
onChange: (value: number) => void
|
|
82
|
+
min?: number
|
|
83
|
+
max?: number
|
|
84
|
+
'aria-label'?: string
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface AdvancedListItemProps {
|
|
88
|
+
title: string
|
|
89
|
+
label?: string
|
|
90
|
+
subtitle?: string
|
|
91
|
+
metaItems?: ListWithIconsItemData[]
|
|
92
|
+
leadingMedia?: ReactNode
|
|
93
|
+
expandedContent?: ReactNode
|
|
94
|
+
expanded?: boolean
|
|
95
|
+
onExpandedChange?: (expanded: boolean) => void
|
|
96
|
+
leading?: AdvancedListItemLeading
|
|
97
|
+
trailing?: AdvancedListItemTrailing
|
|
98
|
+
state?: AdvancedListItemState
|
|
99
|
+
onClick?: () => void
|
|
100
|
+
}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { Avatar, Box, IconButton, Radio, Stack, Typography } from '@mui/material'
|
|
2
|
+
import { RefObject } from 'react'
|
|
3
|
+
import { useTranslation } from 'react-i18next'
|
|
4
|
+
|
|
5
|
+
import CaretDownIcon from '@/assets/icons/CaretDownIcon'
|
|
6
|
+
import CaretUpIcon from '@/assets/icons/CaretUpIcon'
|
|
7
|
+
import ListIcon from '@/assets/icons/ListIcon'
|
|
8
|
+
import RcSesSimpleCheckbox from '@/components/form/inputs/SimpleCheckbox'
|
|
9
|
+
import palette from '@/theme/palette'
|
|
10
|
+
|
|
11
|
+
import { AdvancedListItemLeading as AdvancedListItemLeadingData } from '../AdvancedListItem.types'
|
|
12
|
+
|
|
13
|
+
type Props = {
|
|
14
|
+
leading: AdvancedListItemLeadingData
|
|
15
|
+
disabled?: boolean
|
|
16
|
+
inputRef?: RefObject<HTMLInputElement>
|
|
17
|
+
expandableId?: string
|
|
18
|
+
expanded?: boolean
|
|
19
|
+
titleId?: string
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const stop = (e: { stopPropagation: () => void }) => e.stopPropagation()
|
|
23
|
+
|
|
24
|
+
const getAccessibleNameProps = (
|
|
25
|
+
explicitLabel: string | undefined,
|
|
26
|
+
titleId: string | undefined,
|
|
27
|
+
) => {
|
|
28
|
+
if (explicitLabel) return { 'aria-label': explicitLabel }
|
|
29
|
+
if (titleId) return { 'aria-labelledby': titleId }
|
|
30
|
+
return {}
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const AdvancedListItemLeading = ({
|
|
34
|
+
leading,
|
|
35
|
+
disabled,
|
|
36
|
+
inputRef,
|
|
37
|
+
expandableId,
|
|
38
|
+
expanded,
|
|
39
|
+
titleId,
|
|
40
|
+
}: Props) => {
|
|
41
|
+
const { t } = useTranslation('common', {
|
|
42
|
+
keyPrefix: 'components.AdvancedListItemLeading',
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
if (leading.type === 'reorder') {
|
|
46
|
+
return (
|
|
47
|
+
<Stack alignItems='center' onClick={stop}>
|
|
48
|
+
{!!leading.onMoveUp && (
|
|
49
|
+
<IconButton
|
|
50
|
+
aria-label={t('moveUp')}
|
|
51
|
+
size='small'
|
|
52
|
+
disabled={disabled || leading.moveUpDisabled}
|
|
53
|
+
onClick={(e) => {
|
|
54
|
+
stop(e)
|
|
55
|
+
leading.onMoveUp?.()
|
|
56
|
+
}}
|
|
57
|
+
sx={{ padding: '0.125rem' }}
|
|
58
|
+
>
|
|
59
|
+
<CaretUpIcon size={16} weight='regular' fillColor={palette.primary[700]} />
|
|
60
|
+
</IconButton>
|
|
61
|
+
)}
|
|
62
|
+
{!!leading.onMoveDown && (
|
|
63
|
+
<IconButton
|
|
64
|
+
aria-label={t('moveDown')}
|
|
65
|
+
size='small'
|
|
66
|
+
disabled={disabled || leading.moveDownDisabled}
|
|
67
|
+
onClick={(e) => {
|
|
68
|
+
stop(e)
|
|
69
|
+
leading.onMoveDown?.()
|
|
70
|
+
}}
|
|
71
|
+
sx={{ padding: '0.125rem' }}
|
|
72
|
+
>
|
|
73
|
+
<CaretDownIcon size={16} fillColor={palette.primary[700]} />
|
|
74
|
+
</IconButton>
|
|
75
|
+
)}
|
|
76
|
+
</Stack>
|
|
77
|
+
)
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
if (leading.type === 'drag') {
|
|
81
|
+
return (
|
|
82
|
+
<Box
|
|
83
|
+
aria-label={leading['aria-label']}
|
|
84
|
+
aria-hidden={!leading['aria-label']}
|
|
85
|
+
sx={{
|
|
86
|
+
display: 'flex',
|
|
87
|
+
alignItems: 'center',
|
|
88
|
+
justifyContent: 'center',
|
|
89
|
+
width: '1.5rem',
|
|
90
|
+
height: '1.5rem',
|
|
91
|
+
cursor: disabled ? 'default' : 'grab',
|
|
92
|
+
}}
|
|
93
|
+
>
|
|
94
|
+
<ListIcon size={20} fillColor={palette.grey[500]} />
|
|
95
|
+
</Box>
|
|
96
|
+
)
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (leading.type === 'icon') {
|
|
100
|
+
const { icon: Icon } = leading
|
|
101
|
+
|
|
102
|
+
return (
|
|
103
|
+
<Box
|
|
104
|
+
aria-label={leading['aria-label']}
|
|
105
|
+
aria-hidden={!leading['aria-label']}
|
|
106
|
+
sx={{
|
|
107
|
+
display: 'flex',
|
|
108
|
+
alignItems: 'center',
|
|
109
|
+
justifyContent: 'center',
|
|
110
|
+
width: '1.5rem',
|
|
111
|
+
height: '1.5rem',
|
|
112
|
+
}}
|
|
113
|
+
>
|
|
114
|
+
<Icon size={24} fillColor={palette.grey[700]} />
|
|
115
|
+
</Box>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
if (leading.type === 'avatar') {
|
|
120
|
+
return (
|
|
121
|
+
<Avatar
|
|
122
|
+
src={leading.src}
|
|
123
|
+
alt={leading.alt}
|
|
124
|
+
sx={{
|
|
125
|
+
display: 'flex',
|
|
126
|
+
width: '2rem',
|
|
127
|
+
height: '2rem',
|
|
128
|
+
justifyContent: 'center',
|
|
129
|
+
alignItems: 'center',
|
|
130
|
+
backgroundColor: palette.grey[100],
|
|
131
|
+
color: palette.grey[600],
|
|
132
|
+
fontSize: '0.8125rem',
|
|
133
|
+
fontWeight: 400,
|
|
134
|
+
lineHeight: '1.125rem',
|
|
135
|
+
}}
|
|
136
|
+
>
|
|
137
|
+
{leading.initials}
|
|
138
|
+
</Avatar>
|
|
139
|
+
)
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
if (leading.type === 'index') {
|
|
143
|
+
return (
|
|
144
|
+
<Box
|
|
145
|
+
sx={{
|
|
146
|
+
display: 'flex',
|
|
147
|
+
alignItems: 'center',
|
|
148
|
+
justifyContent: 'center',
|
|
149
|
+
width: '1.5rem',
|
|
150
|
+
height: '1.5rem',
|
|
151
|
+
}}
|
|
152
|
+
>
|
|
153
|
+
<Typography
|
|
154
|
+
variant='body2'
|
|
155
|
+
sx={{ fontSize: '0.9375rem', fontWeight: 400, lineHeight: '1.375rem' }}
|
|
156
|
+
color={palette.grey[600]}
|
|
157
|
+
>
|
|
158
|
+
{leading.index}
|
|
159
|
+
</Typography>
|
|
160
|
+
</Box>
|
|
161
|
+
)
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
if (leading.type === 'checkbox') {
|
|
165
|
+
return (
|
|
166
|
+
<RcSesSimpleCheckbox
|
|
167
|
+
checked={leading.checked}
|
|
168
|
+
disabled={disabled}
|
|
169
|
+
inputRef={inputRef}
|
|
170
|
+
inputProps={{
|
|
171
|
+
...getAccessibleNameProps(leading['aria-label'], titleId),
|
|
172
|
+
...(expandableId && {
|
|
173
|
+
'aria-expanded': expanded,
|
|
174
|
+
'aria-controls': expandableId,
|
|
175
|
+
}),
|
|
176
|
+
}}
|
|
177
|
+
onClick={stop}
|
|
178
|
+
onChange={(e) => {
|
|
179
|
+
stop(e)
|
|
180
|
+
leading.onChange(e.target.checked)
|
|
181
|
+
}}
|
|
182
|
+
sx={{ padding: 0 }}
|
|
183
|
+
/>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
// change to RcSesRadio when it is implemented
|
|
187
|
+
if (leading.type === 'radio') {
|
|
188
|
+
return (
|
|
189
|
+
<Radio
|
|
190
|
+
checked={leading.checked}
|
|
191
|
+
disabled={disabled}
|
|
192
|
+
name={leading.name}
|
|
193
|
+
inputRef={inputRef}
|
|
194
|
+
inputProps={{
|
|
195
|
+
...getAccessibleNameProps(leading['aria-label'], titleId),
|
|
196
|
+
...(expandableId && {
|
|
197
|
+
'aria-expanded': expanded,
|
|
198
|
+
'aria-controls': expandableId,
|
|
199
|
+
}),
|
|
200
|
+
}}
|
|
201
|
+
onClick={stop}
|
|
202
|
+
onChange={(e) => {
|
|
203
|
+
stop(e)
|
|
204
|
+
leading.onChange(e.target.checked)
|
|
205
|
+
}}
|
|
206
|
+
sx={{ padding: 0 }}
|
|
207
|
+
/>
|
|
208
|
+
)
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
return null
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
export default AdvancedListItemLeading
|