@registrucentras/rc-ses-react-components 1.11.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.
Files changed (79) hide show
  1. package/README.md +5 -1
  2. package/dist/assets/icons/CaretUpBoldIcon.d.ts +3 -0
  3. package/dist/assets/icons/CaretUpIcon.d.ts +3 -0
  4. package/dist/assets/icons/ListIcon.d.ts +3 -0
  5. package/dist/assets/icons/MinusIcon.d.ts +3 -0
  6. package/dist/assets/icons/NotePencilIcon.d.ts +3 -0
  7. package/dist/assets/icons/PlusIcon.d.ts +3 -0
  8. package/dist/assets/icons/TrashIcon.d.ts +3 -0
  9. package/dist/assets/icons/UserIcon.d.ts +3 -0
  10. package/dist/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.d.ts +106 -0
  11. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.d.ts +12 -0
  12. package/dist/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.d.ts +7 -0
  13. package/dist/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.d.ts +2 -0
  14. package/dist/components/common/AdvancedList/components/AdvancedListItem/index.d.ts +4 -0
  15. package/dist/components/common/AdvancedList/index.d.ts +11 -0
  16. package/dist/components/common/SelectableCardList/components/SelectableCardListItem.d.ts +4 -1
  17. package/dist/components/common/SelectableCardList/index.d.ts +4 -1
  18. package/dist/components/common/Tooltip/index.d.ts +20 -0
  19. package/dist/components/form/inputs/Select/index.d.ts +1 -0
  20. package/dist/library/icons.d.ts +9 -1
  21. package/dist/library/index.d.ts +5 -0
  22. package/dist/library/types.d.ts +2 -1
  23. package/dist/registrucentras-rc-ses-react-components.cjs +10 -10
  24. package/dist/registrucentras-rc-ses-react-components.js +4218 -3377
  25. package/dist/stories/components/display/AdvancedList.stories.d.ts +33 -0
  26. package/dist/stories/components/display/AdvancedListItem.stories.d.ts +33 -0
  27. package/dist/stories/components/display/SelectableCardList.stories.d.ts +8 -1
  28. package/dist/stories/components/display/Tooltip.stories.d.ts +48 -0
  29. package/dist/stories/components/loaders/LoadingSpinner.stories.d.ts +3 -3
  30. package/dist/theme/light/MuiTooltip.d.ts +3 -0
  31. package/dist/theme/motion.d.ts +16 -0
  32. package/package.json +1 -1
  33. package/src/assets/icons/CaretUpBoldIcon.tsx +17 -0
  34. package/src/assets/icons/CaretUpIcon.tsx +9 -0
  35. package/src/assets/icons/ListIcon.tsx +17 -0
  36. package/src/assets/icons/MinusIcon.tsx +9 -0
  37. package/src/assets/icons/NotePencilIcon.tsx +9 -0
  38. package/src/assets/icons/PlusIcon.tsx +9 -0
  39. package/src/assets/icons/TrashIcon.tsx +23 -0
  40. package/src/assets/icons/UserIcon.tsx +17 -0
  41. package/src/components/common/AdvancedList/components/AdvancedListItem/AdvancedListItem.types.ts +100 -0
  42. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemLeading.tsx +214 -0
  43. package/src/components/common/AdvancedList/components/AdvancedListItem/components/AdvancedListItemTrailing.tsx +241 -0
  44. package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.test.ts +80 -0
  45. package/src/components/common/AdvancedList/components/AdvancedListItem/hooks/usePrefersReducedMotion.ts +28 -0
  46. package/src/components/common/AdvancedList/components/AdvancedListItem/index.test.tsx +631 -0
  47. package/src/components/common/AdvancedList/components/AdvancedListItem/index.tsx +329 -0
  48. package/src/components/common/AdvancedList/index.test.tsx +97 -0
  49. package/src/components/common/AdvancedList/index.tsx +52 -0
  50. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +7 -5
  51. package/src/components/common/SelectableCardList/components/SelectableCardListItem.test.tsx +50 -0
  52. package/src/components/common/SelectableCardList/components/SelectableCardListItem.tsx +34 -0
  53. package/src/components/common/SelectableCardList/index.test.tsx +56 -2
  54. package/src/components/common/SelectableCardList/index.tsx +29 -10
  55. package/src/components/common/Tooltip/index.test.tsx +85 -0
  56. package/src/components/common/Tooltip/index.tsx +167 -0
  57. package/src/components/form/inputs/FileDropzone.tsx +1 -0
  58. package/src/components/form/inputs/FileUpload.tsx +1 -0
  59. package/src/components/form/inputs/NumberStepper.tsx +1 -0
  60. package/src/components/form/inputs/RadioButtonGroup.test.tsx +71 -0
  61. package/src/components/form/inputs/RadioButtonGroup.tsx +1 -0
  62. package/src/components/form/inputs/Select/index.test.tsx +159 -0
  63. package/src/components/form/inputs/Select/index.tsx +109 -53
  64. package/src/i18n/namespaces/common/en.json +14 -0
  65. package/src/i18n/namespaces/common/lt.json +14 -0
  66. package/src/library/icons.ts +16 -0
  67. package/src/library/index.ts +5 -0
  68. package/src/library/types.ts +2 -0
  69. package/src/setupTests.ts +7 -1
  70. package/src/stories/components/display/AdvancedList.stories.tsx +660 -0
  71. package/src/stories/components/display/AdvancedListItem.stories.tsx +593 -0
  72. package/src/stories/components/display/SelectableCardList.stories.tsx +19 -0
  73. package/src/stories/components/display/Tooltip.stories.tsx +67 -0
  74. package/src/stories/components/inputs/Select.stories.tsx +38 -2
  75. package/src/theme/light/MuiAutocomplete.ts +3 -1
  76. package/src/theme/light/MuiInputBase.ts +4 -0
  77. package/src/theme/light/MuiTooltip.ts +40 -0
  78. package/src/theme/light/index.tsx +2 -0
  79. 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;
@@ -2,8 +2,15 @@ import { StoryObj } from '@storybook/react';
2
2
  import { SelectableCardListItemData, SelectableCardListProps } from '../../../components/common/SelectableCardList';
3
3
  declare const meta: {
4
4
  title: string;
5
- component: ({ items, selectedId, onSelect, error, }: SelectableCardListProps) => import("react/jsx-runtime").JSX.Element;
5
+ component: (props: SelectableCardListProps) => import("react/jsx-runtime").JSX.Element;
6
6
  tags: string[];
7
+ parameters: {
8
+ docs: {
9
+ description: {
10
+ component: string;
11
+ };
12
+ };
13
+ };
7
14
  args: {
8
15
  items: SelectableCardListItemData[];
9
16
  selectedId: null;
@@ -0,0 +1,48 @@
1
+ import { default as RcSesTooltip } from '../../../components/common/Tooltip';
2
+ declare const meta: {
3
+ title: string;
4
+ component: typeof RcSesTooltip;
5
+ parameters: {
6
+ layout: string;
7
+ };
8
+ tags: string[];
9
+ argTypes: {
10
+ title: {
11
+ control: "text";
12
+ description: string;
13
+ };
14
+ placement: {
15
+ control: "select";
16
+ options: string[];
17
+ description: string;
18
+ };
19
+ slotProps: {
20
+ control: false;
21
+ description: string;
22
+ };
23
+ children: {
24
+ control: false;
25
+ description: string;
26
+ };
27
+ };
28
+ };
29
+ export default meta;
30
+ export declare const Default: {
31
+ readonly args: {
32
+ readonly title: "Deklaruojant išvykimą iš Lietuvos nurodoma užsienio valstybė, į kurią išvykstama.";
33
+ };
34
+ readonly render: (args: any) => import("react/jsx-runtime").JSX.Element;
35
+ };
36
+ export declare const CustomTrigger: {
37
+ readonly args: {
38
+ readonly title: "Papildoma informacija apie paslaugą.";
39
+ };
40
+ readonly render: (args: any) => import("react/jsx-runtime").JSX.Element;
41
+ readonly parameters: {
42
+ readonly docs: {
43
+ readonly source: {
44
+ readonly code: "<RcSesTooltip title=\"Papildoma informacija apie paslaugą.\">\n <Button variant=\"text\">Mygtukas</Button>\n</RcSesTooltip>";
45
+ };
46
+ };
47
+ };
48
+ };
@@ -14,11 +14,11 @@ declare const meta: {
14
14
  argTypes: {
15
15
  color: {
16
16
  description: string;
17
- options: ("inherit" | "success" | "info" | "warning" | "error" | "primary" | "secondary")[];
18
- mapping: ("inherit" | "success" | "info" | "warning" | "error" | "primary" | "secondary")[];
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" | "success" | "info" | "warning" | "error" | "primary" | "secondary")[];
21
+ labels: ("inherit" | "primary" | "secondary" | "success" | "error" | "info" | "warning")[];
22
22
  };
23
23
  table: {
24
24
  defaultValue: {
@@ -0,0 +1,3 @@
1
+ import { Components } from '@mui/material';
2
+ declare const MuiTooltip: Components['MuiTooltip'];
3
+ export default MuiTooltip;
@@ -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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@registrucentras/rc-ses-react-components",
3
3
  "author": "VĮ REGISTRŲ CENTRAS",
4
- "version": "1.11.0",
4
+ "version": "1.13.0",
5
5
  "description": "RC SES React komponentų biblioteka",
6
6
  "type": "module",
7
7
  "private": false,
@@ -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
@@ -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