@registrucentras/rc-ses-react-components 1.4.1 → 1.6.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 (102) hide show
  1. package/dist/components/common/Accordion/hooks/useAccordionController.d.ts +1 -0
  2. package/dist/components/common/Card/index.d.ts +7 -2
  3. package/dist/components/common/ImageCard/index.d.ts +13 -0
  4. package/dist/components/common/ListWithIcons/components/ListWithIconsItem.d.ts +9 -0
  5. package/dist/components/common/ListWithIcons/index.d.ts +14 -0
  6. package/dist/components/layout/Footer/index.d.ts +5 -0
  7. package/dist/components/layout/ServiceFormContainer/CardFormContainer/index.d.ts +3 -2
  8. package/dist/components/layout/ServiceWizardStepper/StepperTypes.d.ts +0 -3
  9. package/dist/components/layout/ServiceWizardStepper/components/DesktopStepper.d.ts +2 -1
  10. package/dist/components/layout/ServiceWizardStepper/components/MobileStepper.d.ts +2 -1
  11. package/dist/components/layout/ServiceWizardStepper/components/StyledStepLabel.d.ts +2 -2
  12. package/dist/components/layout/ServiceWizardStepper/index.d.ts +3 -2
  13. package/dist/library/icons.d.ts +1 -3
  14. package/dist/library/index.d.ts +6 -14
  15. package/dist/library/types.d.ts +2 -0
  16. package/dist/registrucentras-rc-ses-react-components.cjs +11 -11
  17. package/dist/registrucentras-rc-ses-react-components.js +2530 -2251
  18. package/dist/stories/components/display/Card.stories.d.ts +49 -0
  19. package/dist/stories/components/display/ImageCard.stories.d.ts +8 -0
  20. package/dist/stories/components/display/ListWithIcons.stories.d.ts +33 -0
  21. package/dist/stories/components/{Alert.stories.d.ts → feedback/Alert.stories.d.ts} +1 -1
  22. package/dist/stories/components/{Icons.stories.d.ts → icons/Icons.stories.d.ts} +1 -1
  23. package/dist/stories/components/inputs/FileDropzone.stories.d.ts +32 -0
  24. package/dist/stories/components/inputs/PhoneInput.stories.d.ts +24 -0
  25. package/dist/stories/components/inputs/SearchableField.stories.d.ts +2 -2
  26. package/dist/stories/components/inputs/Select.stories.d.ts +3 -3
  27. package/dist/stories/components/inputs/TextField.stories.d.ts +5 -5
  28. package/dist/stories/components/layout/Footer.stories.d.ts +8 -0
  29. package/dist/stories/components/{Accordion.stories.d.ts → navigation/Accordion.stories.d.ts} +2 -2
  30. package/dist/stories/components/{Breadcrumbs.stories.d.ts → navigation/Breadcrumbs.stories.d.ts} +1 -1
  31. package/dist/stories/components/{DataPagination.stories.d.ts → navigation/DataPagination.stories.d.ts} +1 -1
  32. package/dist/stories/components/navigation/ServiceWizardStepper.stories.d.ts +7 -0
  33. package/package.json +1 -1
  34. package/src/components/common/Accordion/hooks/useAccordionController.tsx +43 -11
  35. package/src/components/common/Card/index.test.tsx +36 -0
  36. package/src/components/common/Card/index.tsx +62 -22
  37. package/src/components/common/DataPagination/components/PaginationButton.tsx +1 -1
  38. package/src/components/common/DataPagination/index.tsx +1 -1
  39. package/src/components/common/ImageCard/index.test.tsx +78 -0
  40. package/src/components/common/ImageCard/index.tsx +43 -0
  41. package/src/components/common/ListWithIcons/components/ListWithIconsItem.tsx +94 -0
  42. package/src/components/common/ListWithIcons/index.test.tsx +75 -0
  43. package/src/components/common/ListWithIcons/index.tsx +47 -0
  44. package/src/components/form/inputs/CheckboxFormControl.tsx +1 -1
  45. package/src/components/form/inputs/FileDropzone.tsx +1 -1
  46. package/src/components/form/inputs/FileUpload.tsx +9 -3
  47. package/src/components/form/inputs/NumberStepper.tsx +2 -2
  48. package/src/components/form/inputs/PhoneInputFormControl/components/RowComponent.tsx +1 -0
  49. package/src/components/form/inputs/RadioButtonGroup.tsx +1 -1
  50. package/src/components/layout/Footer/index.test.tsx +20 -0
  51. package/src/components/layout/Footer/index.tsx +33 -0
  52. package/src/components/layout/ServiceFormContainer/AccordionFormContainer/index.tsx +21 -4
  53. package/src/components/layout/ServiceFormContainer/AccordionFormContainer/utils.ts +0 -1
  54. package/src/components/layout/ServiceFormContainer/CardFormContainer/index.test.tsx +14 -12
  55. package/src/components/layout/ServiceFormContainer/CardFormContainer/index.tsx +4 -1
  56. package/src/components/layout/ServiceWizardStepper/StepperTypes.ts +0 -3
  57. package/src/components/layout/ServiceWizardStepper/components/DesktopStepper.test.tsx +33 -4
  58. package/src/components/layout/ServiceWizardStepper/components/DesktopStepper.tsx +6 -2
  59. package/src/components/layout/ServiceWizardStepper/components/MobileStepper.test.tsx +34 -7
  60. package/src/components/layout/ServiceWizardStepper/components/MobileStepper.tsx +4 -2
  61. package/src/components/layout/ServiceWizardStepper/components/StyledStepLabel.tsx +4 -2
  62. package/src/components/layout/ServiceWizardStepper/index.tsx +13 -21
  63. package/src/examples/CardMultipleStepForm/index.tsx +18 -31
  64. package/src/examples/HorizontalMultiStepForm/index.tsx +22 -17
  65. package/src/examples/ListWithPagination/index.tsx +41 -11
  66. package/src/library/icons.ts +3 -2
  67. package/src/library/index.ts +14 -22
  68. package/src/library/types.ts +6 -0
  69. package/src/stories/components/{buttons → actions}/Button.stories.tsx +1 -1
  70. package/src/stories/components/{Card.stories.tsx → display/Card.stories.tsx} +19 -1
  71. package/src/stories/components/{Card.test.tsx → display/Card.test.tsx} +2 -1
  72. package/src/stories/components/display/ImageCard.stories.tsx +54 -0
  73. package/src/stories/components/display/ListWithIcons.stories.tsx +74 -0
  74. package/src/stories/components/{Alert.stories.tsx → feedback/Alert.stories.tsx} +1 -1
  75. package/src/stories/components/form/CardFormContainer.stories.tsx +23 -33
  76. package/src/stories/components/form/CheckboxFormControl.stories.tsx +1 -1
  77. package/src/stories/components/form/ServiceFormActions.stories.tsx +1 -1
  78. package/src/stories/components/form/ServiceFormContainer.stories.tsx +1 -1
  79. package/src/stories/components/{Icons.stories.tsx → icons/Icons.stories.tsx} +1 -1
  80. package/src/stories/components/inputs/Checkbox.stories.tsx +1 -1
  81. package/src/stories/components/inputs/DatePicker.stories.tsx +1 -1
  82. package/src/stories/components/inputs/FileDropzone.stories.tsx +117 -0
  83. package/src/stories/components/inputs/FileUpload.stories.tsx +1 -1
  84. package/src/stories/components/inputs/NumberStepper.stories.tsx +1 -1
  85. package/src/stories/components/inputs/PhoneInput.stories.tsx +110 -0
  86. package/src/stories/components/inputs/RadioButtonGroup.stories.tsx +1 -1
  87. package/src/stories/components/inputs/SearchableField.stories.tsx +1 -1
  88. package/src/stories/components/inputs/Select.stories.tsx +1 -1
  89. package/src/stories/components/inputs/TextField.stories.tsx +1 -1
  90. package/src/stories/components/layout/Footer.stories.tsx +19 -0
  91. package/src/stories/components/{Accordion.stories.tsx → navigation/Accordion.stories.tsx} +1 -1
  92. package/src/stories/components/{Breadcrumbs.stories.tsx → navigation/Breadcrumbs.stories.tsx} +1 -1
  93. package/src/stories/components/{DataPagination.stories.tsx → navigation/DataPagination.stories.tsx} +1 -1
  94. package/src/stories/components/navigation/ServiceWizardStepper.stories.tsx +53 -0
  95. package/src/theme/light/MuiAutocomplete.ts +4 -0
  96. package/src/theme/light/MuiCard.tsx +16 -2
  97. package/src/theme/light/MuiInputBase.ts +3 -1
  98. package/dist/stories/ServiceWizardStepper.stories.d.ts +0 -7
  99. package/dist/stories/components/Card.stories.d.ts +0 -24
  100. package/src/stories/ServiceWizardStepper.stories.tsx +0 -39
  101. /package/dist/stories/components/{buttons → actions}/Button.stories.d.ts +0 -0
  102. /package/src/stories/components/{buttons → actions}/Button.test.ts +0 -0
@@ -4,11 +4,17 @@ import { StepItem } from '../StepperTypes'
4
4
  import DesktopStepper from './DesktopStepper'
5
5
 
6
6
  const steps: StepItem[] = [
7
- { id: '1', title: 'Step 1', state: 'completed' },
8
- { id: '2', title: 'Step 2', state: 'active' },
9
- { id: '3', title: 'Step 3', state: 'pending' },
7
+ { id: '1', title: 'Step 1' },
8
+ { id: '2', title: 'Step 2' },
9
+ { id: '3', title: 'Step 3' },
10
10
  ]
11
11
 
12
+ const getStepState = (index: number, activeStep: number) => {
13
+ if (index < activeStep) return 'completed'
14
+ if (index === activeStep) return 'active'
15
+ return 'pending'
16
+ }
17
+
12
18
  describe('DesktopStepper', () => {
13
19
  it('renders all steps', () => {
14
20
  const { getByText } = render(
@@ -17,8 +23,10 @@ describe('DesktopStepper', () => {
17
23
  activeStep={1}
18
24
  handleStepClick={() => {}}
19
25
  resolvedOrientation='horizontal'
26
+ getStepState={(index) => getStepState(index, 1)}
20
27
  />,
21
28
  )
29
+
22
30
  expect(getByText('Step 1')).toBeInTheDocument()
23
31
  expect(getByText('Step 2')).toBeInTheDocument()
24
32
  expect(getByText('Step 3')).toBeInTheDocument()
@@ -26,15 +34,36 @@ describe('DesktopStepper', () => {
26
34
 
27
35
  it('calls handleStepClick when a step is clicked', () => {
28
36
  const handleStepClick = vi.fn()
37
+
29
38
  const { getByText } = render(
30
39
  <DesktopStepper
31
40
  stepEntries={steps}
32
41
  activeStep={1}
33
42
  handleStepClick={handleStepClick}
34
43
  resolvedOrientation='horizontal'
44
+ getStepState={(index) => getStepState(index, 1)}
35
45
  />,
36
46
  )
47
+
37
48
  fireEvent.click(getByText('Step 1'))
38
- expect(handleStepClick).toHaveBeenCalled()
49
+ expect(handleStepClick).toHaveBeenCalledWith(0)
50
+ })
51
+
52
+ it('does not allow clicking future steps', () => {
53
+ const handleStepClick = vi.fn()
54
+
55
+ const { getByText } = render(
56
+ <DesktopStepper
57
+ stepEntries={steps}
58
+ activeStep={1}
59
+ handleStepClick={handleStepClick}
60
+ resolvedOrientation='horizontal'
61
+ getStepState={(index) => getStepState(index, 1)}
62
+ />,
63
+ )
64
+
65
+ fireEvent.click(getByText('Step 3'))
66
+
67
+ expect(handleStepClick).not.toHaveBeenCalled()
39
68
  })
40
69
  })
@@ -11,6 +11,7 @@ interface DesktopStepperProps {
11
11
  handleStepClick: (index: number) => void
12
12
  resolvedOrientation: 'vertical' | 'horizontal'
13
13
  isLoading?: boolean
14
+ getStepState: (index: number) => 'completed' | 'active' | 'pending'
14
15
  }
15
16
 
16
17
  const DesktopStepper = ({
@@ -19,6 +20,7 @@ const DesktopStepper = ({
19
20
  handleStepClick,
20
21
  resolvedOrientation,
21
22
  isLoading = false,
23
+ getStepState,
22
24
  }: DesktopStepperProps) => (
23
25
  <Stepper
24
26
  alternativeLabel={resolvedOrientation === 'horizontal'}
@@ -37,13 +39,15 @@ const DesktopStepper = ({
37
39
  }
38
40
  >
39
41
  {stepEntries.map((step, index) => {
40
- const isClickable = index <= (activeStep === -1 ? 0 : activeStep)
42
+ const isClickable = index <= activeStep
43
+ const stepState = getStepState(index)
44
+
41
45
  return (
42
46
  <Step key={step.id}>
43
47
  <StepButton onClick={() => handleStepClick(index)} disabled={!isClickable}>
44
48
  <StyledStepLabel
45
49
  StepIconComponent={CustomStepIcon}
46
- stepState={step.state}
50
+ stepState={stepState}
47
51
  orientation={resolvedOrientation}
48
52
  isLast={index === stepEntries.length - 1}
49
53
  >
@@ -4,18 +4,45 @@ import { StepItem } from '../StepperTypes'
4
4
  import MobileStepper from './MobileStepper'
5
5
 
6
6
  const steps: StepItem[] = [
7
- { id: '1', title: 'Step 1', state: 'completed' },
8
- { id: '2', title: 'Step 2', state: 'active' },
9
- { id: '3', title: 'Step 3', state: 'pending' },
7
+ { id: '1', title: 'Step 1' },
8
+ { id: '2', title: 'Step 2' },
9
+ { id: '3', title: 'Step 3' },
10
10
  ]
11
11
 
12
+ const getStepState = (index: number, activeStep: number) => {
13
+ if (index < activeStep) return 'completed'
14
+ if (index === activeStep) return 'active'
15
+ return 'pending'
16
+ }
17
+
12
18
  describe('MobileStepper', () => {
13
- it('renders all steps', () => {
19
+ it('renders all steps and navigation button', () => {
20
+ render(
21
+ <MobileStepper
22
+ stepEntries={steps}
23
+ activeStep={1}
24
+ handleStepClick={() => {}}
25
+ getStepState={(index) => getStepState(index, 1)}
26
+ />,
27
+ )
28
+
29
+ const buttons = screen.getAllByRole('button')
30
+
31
+ expect(buttons).toHaveLength(steps.length + 1)
32
+ })
33
+
34
+ it('does not render back button on first step', () => {
14
35
  render(
15
- <MobileStepper stepEntries={steps} activeStep={1} handleStepClick={() => {}} />,
36
+ <MobileStepper
37
+ stepEntries={steps}
38
+ activeStep={0}
39
+ handleStepClick={() => {}}
40
+ getStepState={(index) => getStepState(index, 0)}
41
+ />,
16
42
  )
17
43
 
18
- const stepButtons = screen.getAllByRole('button')
19
- expect(stepButtons).toHaveLength(steps.length + 1) // +1 for the "previous" button
44
+ const buttons = screen.getAllByRole('button')
45
+
46
+ expect(buttons).toHaveLength(steps.length)
20
47
  })
21
48
  })
@@ -11,12 +11,14 @@ interface MobileStepperProps {
11
11
  stepEntries: StepItem[]
12
12
  activeStep: number
13
13
  handleStepClick: (index: number) => void
14
+ getStepState: (index: number) => 'completed' | 'active' | 'pending'
14
15
  }
15
16
 
16
17
  const MobileStepper = ({
17
18
  stepEntries,
18
19
  activeStep,
19
20
  handleStepClick,
21
+ getStepState,
20
22
  }: MobileStepperProps) => (
21
23
  <Box className='ServiceWizardStepper-MobileStepperWrapper'>
22
24
  <Box className='ServiceWizardStepper-NavSlot'>
@@ -35,12 +37,12 @@ const MobileStepper = ({
35
37
  connector={<StepConnector />}
36
38
  className='ServiceWizardStepper ServiceWizardStepper-horizontal'
37
39
  >
38
- {stepEntries.map((step) => (
40
+ {stepEntries.map((step, index) => (
39
41
  <Step key={step.id}>
40
42
  <StepButton disabled>
41
43
  <StyledStepLabel
42
44
  StepIconComponent={CustomStepIcon}
43
- stepState={step.state}
45
+ stepState={getStepState(index)}
44
46
  />
45
47
  </StepButton>
46
48
  </Step>
@@ -2,10 +2,10 @@ import { StepLabel, styled } from '@mui/material'
2
2
 
3
3
  import palette, { grey } from '@/theme/palette'
4
4
 
5
- import { StepItem } from '../StepperTypes'
5
+ export type StepState = 'completed' | 'active' | 'pending'
6
6
 
7
7
  interface StyledStepLabelProps {
8
- stepState: StepItem['state']
8
+ stepState: StepState
9
9
  orientation?: 'vertical' | 'horizontal'
10
10
  isLast?: boolean
11
11
  }
@@ -18,11 +18,13 @@ const StyledStepLabel = styled(StepLabel, {
18
18
  fontWeight: stepState === 'active' ? 700 : 400,
19
19
  color: stepState === 'pending' ? grey[500] : grey[800],
20
20
  },
21
+
21
22
  ...(orientation === 'vertical' && {
22
23
  '& .MuiStepLabel-label.Mui-active': {
23
24
  fontSize: '14px',
24
25
  },
25
26
  }),
27
+
26
28
  ...(orientation === 'vertical' &&
27
29
  !isLast && {
28
30
  '&.MuiStepLabel-root.MuiStepLabel-vertical .MuiStepLabel-label': {
@@ -1,5 +1,4 @@
1
1
  import { useMediaQuery, useTheme } from '@mui/material'
2
- import { useEffect, useState } from 'react'
3
2
 
4
3
  import './ServiceWizardStepper.css'
5
4
  import { StepItem } from './StepperTypes'
@@ -9,60 +8,53 @@ import MobileStepper from './components/MobileStepper'
9
8
  export interface ServiceWizardStepperProps {
10
9
  orientation?: 'vertical' | 'horizontal'
11
10
  steps: StepItem[]
12
- onStepClick?: (steps: StepItem[]) => void
11
+ activeStep: number
12
+ onStepClick?: (index: number) => void
13
13
  isLoading?: boolean
14
14
  }
15
15
 
16
- const updateSteps = (index: number, prev: StepItem[]): StepItem[] =>
17
- prev.map((step, i) => {
18
- if (i < index) return { ...step, state: 'completed' }
19
- if (i === index) return { ...step, state: 'active' }
20
- return { ...step, state: 'pending' }
21
- })
22
-
23
16
  function ServiceWizardStepper({
24
17
  steps,
18
+ activeStep,
25
19
  orientation = 'horizontal',
26
20
  onStepClick,
27
21
  isLoading = false,
28
22
  }: ServiceWizardStepperProps) {
29
- const [currentSteps, setCurrentSteps] = useState(steps)
30
-
31
- useEffect(() => {
32
- setCurrentSteps(steps)
33
- }, [steps])
34
-
35
23
  const theme = useTheme()
36
24
  const isMobile = useMediaQuery(theme.breakpoints.down('md'))
37
25
 
38
26
  const resolvedOrientation = isMobile ? 'horizontal' : orientation
39
27
 
40
- const activeStep = currentSteps.findIndex((s) => s.state === 'active') ?? 0
28
+ const getStepState = (index: number) => {
29
+ if (index < activeStep) return 'completed'
30
+ if (index === activeStep) return 'active'
31
+ return 'pending'
32
+ }
41
33
 
42
34
  const handleStepClick = (index: number) => {
43
35
  if (index < 0 || index > activeStep) return
44
- const updatedSteps = updateSteps(index, currentSteps)
45
- setCurrentSteps(updatedSteps)
46
- onStepClick?.(updatedSteps)
36
+ onStepClick?.(index)
47
37
  }
48
38
 
49
39
  if (isMobile) {
50
40
  return (
51
41
  <MobileStepper
52
- stepEntries={currentSteps}
42
+ stepEntries={steps}
53
43
  activeStep={activeStep}
54
44
  handleStepClick={handleStepClick}
45
+ getStepState={getStepState}
55
46
  />
56
47
  )
57
48
  }
58
49
 
59
50
  return (
60
51
  <DesktopStepper
61
- stepEntries={currentSteps}
52
+ stepEntries={steps}
62
53
  activeStep={activeStep}
63
54
  handleStepClick={handleStepClick}
64
55
  resolvedOrientation={resolvedOrientation}
65
56
  isLoading={isLoading}
57
+ getStepState={getStepState}
66
58
  />
67
59
  )
68
60
  }
@@ -7,38 +7,28 @@ import ServicePage from '@/components/layout/ServicePage'
7
7
  import { StepItem } from '@/components/layout/ServiceWizardStepper/StepperTypes'
8
8
 
9
9
  const steps: StepItem[] = [
10
- { id: '1', state: 'completed', title: '1-2 žodžių tekstas' },
11
- { id: '2', state: 'active', title: '1-2 žodžių tekstas' },
12
- { id: '3', state: 'pending', title: '1-2 žodžių tekstas' },
13
- { id: '4', state: 'pending', title: '1-2 žodžių tekstas' },
10
+ { id: '1', title: '1-2 žodžių tekstas' },
11
+ { id: '2', title: '1-2 žodžių tekstas' },
12
+ { id: '3', title: '1-2 žodžių tekstas' },
13
+ { id: '4', title: '1-2 žodžių tekstas' },
14
14
  ]
15
15
 
16
16
  function CardMultipleStepForm() {
17
- const [currentSteps, setSteps] = useState(steps)
18
- const activeStep = currentSteps.findIndex((s) => s.state === 'active')
17
+ const [activeStep, setActiveStep] = useState(0)
19
18
 
20
19
  const handleBack = () => {
21
- if (activeStep <= 0) return
22
-
23
- const updatedSteps: StepItem[] = currentSteps.map((step, index) => {
24
- if (index < activeStep - 1) return { ...step, state: 'completed' }
25
- if (index === activeStep - 1) return { ...step, state: 'active' }
26
- return { ...step, state: 'pending' }
27
- })
28
-
29
- setSteps(updatedSteps)
20
+ setActiveStep((prev) => Math.max(prev - 1, 0))
30
21
  }
31
22
 
32
23
  const handleNext = () => {
33
- const activeIndex = currentSteps.findIndex((s) => s.state === 'active')
34
- if (activeIndex === -1 || activeIndex === currentSteps.length - 1) return
35
- const updatedSteps: StepItem[] = currentSteps.map((step, index) => {
36
- if (index < activeIndex + 1) return { ...step, state: 'completed' }
37
- if (index === activeIndex + 1) return { ...step, state: 'active' }
38
- return { ...step, state: 'pending' }
39
- })
40
- setSteps(updatedSteps)
24
+ setActiveStep((prev) => Math.min(prev + 1, steps.length - 1))
25
+ }
26
+
27
+ const handleStepClick = (index: number) => {
28
+ if (index > activeStep) return
29
+ setActiveStep(index)
41
30
  }
31
+
42
32
  return (
43
33
  <ServicePage>
44
34
  <ServiceHeader
@@ -62,22 +52,19 @@ function CardMultipleStepForm() {
62
52
  </ServiceHeader>
63
53
 
64
54
  <RcSesCardFormContainer
65
- steps={currentSteps}
66
- onStepClick={(newSteps) => setSteps(newSteps)}
55
+ steps={steps}
56
+ activeStep={activeStep}
57
+ onStepClick={handleStepClick}
67
58
  title='Test'
68
59
  description='Test description'
69
- leadingActions={
70
- <Button onClick={handleBack} disabled={activeStep === 0}>
71
- Back
72
- </Button>
73
- }
60
+ leadingActions={activeStep !== 0 && <Button onClick={handleBack}>Back</Button>}
74
61
  trailingActions={
75
62
  <>
76
63
  <Button variant='outlined'>Button</Button>
77
64
  <Button
78
65
  variant='contained'
79
66
  onClick={handleNext}
80
- disabled={activeStep === currentSteps.length - 1}
67
+ disabled={activeStep === steps.length - 1}
81
68
  >
82
69
  Next
83
70
  </Button>
@@ -6,24 +6,24 @@ import ServiceWizardStepper from '@/components/layout/ServiceWizardStepper'
6
6
  import { StepItem } from '@/components/layout/ServiceWizardStepper/StepperTypes'
7
7
 
8
8
  const steps3: StepItem[] = [
9
- { id: '1', state: 'completed', title: '1-2 žodžių tekstas' },
10
- { id: '2', state: 'active', title: '1-2 žodžių tekstas' },
11
- { id: '3', state: 'pending', title: '1-2 žodžių tekstas' },
9
+ { id: '1', title: '1-2 žodžių tekstas' },
10
+ { id: '2', title: '1-2 žodžių tekstas' },
11
+ { id: '3', title: '1-2 žodžių tekstas' },
12
12
  ]
13
13
 
14
14
  const steps4: StepItem[] = [
15
- { id: '1', state: 'active', title: '1-2 žodžių tekstas' },
16
- { id: '2', state: 'pending', title: '1-2 žodžių tekstas' },
17
- { id: '3', state: 'pending', title: '1-2 žodžių tekstas' },
18
- { id: '4', state: 'pending', title: '1-2 žodžių tekstas' },
15
+ { id: '1', title: '1-2 žodžių tekstas' },
16
+ { id: '2', title: '1-2 žodžių tekstas' },
17
+ { id: '3', title: '1-2 žodžių tekstas' },
18
+ { id: '4', title: '1-2 žodžių tekstas' },
19
19
  ]
20
20
 
21
21
  const steps5: StepItem[] = [
22
- { id: '1', state: 'completed', title: '1-2 žodžių tekstas' },
23
- { id: '2', state: 'completed', title: '1-2 žodžių tekstas' },
24
- { id: '3', state: 'active', title: '1-2 žodžių tekstas' },
25
- { id: '4', state: 'pending', title: '1-2 žodžių tekstas' },
26
- { id: '5', state: 'pending', title: '1-2 žodžių tekstas' },
22
+ { id: '1', title: '1-2 žodžių tekstas' },
23
+ { id: '2', title: '1-2 žodžių tekstas' },
24
+ { id: '3', title: '1-2 žodžių tekstas' },
25
+ { id: '4', title: '1-2 žodžių tekstas' },
26
+ { id: '5', title: '1-2 žodžių tekstas' },
27
27
  ]
28
28
 
29
29
  function HorizontalMultipleStepForm() {
@@ -50,13 +50,18 @@ function HorizontalMultipleStepForm() {
50
50
  </ServiceHeader>
51
51
 
52
52
  <div
53
- style={{ padding: '2rem', display: 'flex', flexDirection: 'column', gap: '2rem' }}
53
+ style={{
54
+ padding: '2rem',
55
+ display: 'flex',
56
+ flexDirection: 'column',
57
+ gap: '2rem',
58
+ }}
54
59
  >
55
- <ServiceWizardStepper steps={steps3} />
56
- <ServiceWizardStepper steps={steps4} />
57
- <ServiceWizardStepper steps={steps5} />
60
+ <ServiceWizardStepper steps={steps3} activeStep={1} />
61
+ <ServiceWizardStepper steps={steps4} activeStep={0} />
62
+ <ServiceWizardStepper steps={steps5} activeStep={2} />
58
63
  </div>
59
- <ServiceWizardStepper steps={steps5} />
64
+ <ServiceWizardStepper steps={steps5} activeStep={4} />
60
65
  </ServicePage>
61
66
  )
62
67
  }
@@ -1,11 +1,43 @@
1
- import { Grid, Typography } from '@mui/material'
1
+ import { Button, Grid } from '@mui/material'
2
2
  import React, { useState } from 'react'
3
3
 
4
4
  import DataPagination from '@/components/common/DataPagination'
5
+ import ListWithIcons from '@/components/common/ListWithIcons'
5
6
  import ServicePage from '@/components/layout/ServicePage'
7
+ import { QuestionIcon } from '@/library/icons'
8
+ import palette from '@/theme/palette'
9
+
10
+ const mockItems = [
11
+ {
12
+ id: '1',
13
+ icon: <QuestionIcon fillColor={palette.grey[600]} />,
14
+ text: 'Explanatory text Test ilgas pavadinimas',
15
+ tooltip: 'Extra info',
16
+ },
17
+ {
18
+ id: '2',
19
+ icon: <QuestionIcon fillColor={palette.grey[600]} />,
20
+ text: 'Disabled item',
21
+ tooltip: 'Extra info',
22
+ disabled: true,
23
+ },
24
+ {
25
+ id: '3',
26
+ icon: <QuestionIcon fillColor={palette.grey[600]} />,
27
+ text: 'Hover me',
28
+ tooltip: 'Extra info',
29
+ },
30
+ {
31
+ id: '4',
32
+ icon: <QuestionIcon fillColor={palette.grey[600]} />,
33
+ text: 'Loading item',
34
+ tooltip: 'Extra info',
35
+ },
36
+ ]
6
37
 
7
38
  function ListWithPagination() {
8
39
  const [page, setPage] = useState(1)
40
+ const [isLoading, setIsLoading] = useState(false)
9
41
  const ITEMS_PER_PAGE = 5
10
42
 
11
43
  const mockData = React.useMemo(
@@ -17,19 +49,14 @@ function ListWithPagination() {
17
49
  [],
18
50
  )
19
51
 
20
- const paginatedData = React.useMemo(() => {
21
- const start = (page - 1) * ITEMS_PER_PAGE
22
- return mockData.slice(start, start + ITEMS_PER_PAGE)
23
- }, [page, mockData])
52
+ const handleSetIsLoading = () => {
53
+ setIsLoading(!isLoading)
54
+ }
24
55
 
25
56
  return (
26
57
  <ServicePage>
27
- <Grid container spacing={2} sx={{ mt: 2 }}>
28
- {paginatedData.map((item) => (
29
- <Grid item xs={12} key={item.id}>
30
- <Typography>{item.name}</Typography>
31
- </Grid>
32
- ))}
58
+ <Grid container sx={{ mt: 2 }}>
59
+ <ListWithIcons items={mockItems} layout='horizontal' isLoading={isLoading} />
33
60
  </Grid>
34
61
 
35
62
  <DataPagination
@@ -37,6 +64,9 @@ function ListWithPagination() {
37
64
  page={page}
38
65
  onChange={setPage}
39
66
  />
67
+ <Button onClick={handleSetIsLoading} sx={{ mt: 2 }}>
68
+ Toggle loading
69
+ </Button>
40
70
  </ServicePage>
41
71
  )
42
72
  }
@@ -34,9 +34,10 @@ import WarningDiamondFillIcon from '@/assets/icons/WarningDiamondFillIcon'
34
34
  import WarningFillIcon from '@/assets/icons/WarningFillIcon'
35
35
  import XCircleFillIcon from '@/assets/icons/XCircleFillIcon'
36
36
 
37
- export { RcSesLogo }
38
- export { ArrowRightIcon, ArrowLeftIcon }
39
37
  export {
38
+ RcSesLogo,
39
+ ArrowLeftIcon,
40
+ ArrowRightIcon,
40
41
  BarcodeIcon,
41
42
  CalendarBlankIcon,
42
43
  CaretDoubleLeftBoldIcon,
@@ -3,16 +3,6 @@ import type {} from '@mui/system'
3
3
  import type {} from '@mui/x-date-pickers/themeAugmentation'
4
4
 
5
5
  import RcSesIconProps from '@/assets/IconProps'
6
- import RcSesLogo from '@/assets/Logo'
7
- import ArrowLeftIcon from '@/assets/icons/ArrowLeftIcon'
8
- import ArrowRightIcon from '@/assets/icons/ArrowRightIcon'
9
- import CaretDoubleLeftBoldIcon from '@/assets/icons/CaretDoubleLeftBoldIcon'
10
- import CaretDoubleRightBoldIcon from '@/assets/icons/CaretDoubleRightBoldIcon'
11
- import CaretDownBoldIcon from '@/assets/icons/CaretDownBoldIcon'
12
- import CaretDownIcon from '@/assets/icons/CaretDownIcon'
13
- import CaretLeftBoldIcon from '@/assets/icons/CaretLeftBoldIcon'
14
- import CaretLeftIcon from '@/assets/icons/CaretLeftIcon'
15
- import CaretRightBoldIcon from '@/assets/icons/CaretRightBoldIcon'
16
6
  import RcSesAccordion from '@/components/common/Accordion'
17
7
  import useAccordionController from '@/components/common/Accordion/hooks/useAccordionController'
18
8
  import RcSesAlert from '@/components/common/Alert'
@@ -22,6 +12,8 @@ import RcSesButtonWithPopover from '@/components/common/Button/ButtonWithPopover
22
12
  import RcSesCard from '@/components/common/Card'
23
13
  import DataPagination from '@/components/common/DataPagination'
24
14
  import RcSesIconWithCircularBackground from '@/components/common/IconWithCircularBackground'
15
+ import RcSesImageCard from '@/components/common/ImageCard'
16
+ import ListWithIcons from '@/components/common/ListWithIcons'
25
17
  import RcSesTab from '@/components/common/Tabs/Tab'
26
18
  import RcSesTabPanel from '@/components/common/Tabs/TabPanel'
27
19
  import RcSesTabs from '@/components/common/Tabs/Tabs'
@@ -39,6 +31,7 @@ import RcSesRadioButtonGroup from '@/components/form/inputs/RadioButtonGroup'
39
31
  import RcSesSearchableField from '@/components/form/inputs/SearchableField'
40
32
  import RcSesSelect from '@/components/form/inputs/Select'
41
33
  import RcSesTextField from '@/components/form/inputs/TextField'
34
+ import RcSesFooter from '@/components/layout/Footer'
42
35
  import RcSesServiceFormActions from '@/components/layout/ServiceFormActions'
43
36
  import RcSesServiceFormContainer from '@/components/layout/ServiceFormContainer/AccordionFormContainer'
44
37
  import RcSesCardFormContainer from '@/components/layout/ServiceFormContainer/CardFormContainer'
@@ -56,7 +49,15 @@ declare module '@mui/x-date-pickers/models' {
56
49
 
57
50
  export { RcSesPalette, RcSesTheme }
58
51
  export { RcSesAccordion, useAccordionController }
59
- export { RcSesAlert, RcSesBreadcrumbs, RcSesButton, RcSesButtonWithPopover, RcSesCard }
52
+ export {
53
+ RcSesAlert,
54
+ RcSesBreadcrumbs,
55
+ RcSesButton,
56
+ RcSesButtonWithPopover,
57
+ RcSesCard,
58
+ RcSesFooter,
59
+ RcSesImageCard,
60
+ }
60
61
  export { RcSesCheckbox, RcSesCheckboxFormControl }
61
62
  export { RcSesDatepicker }
62
63
  export { RcSesFileUpload }
@@ -69,6 +70,7 @@ export { RcSesSelect }
69
70
  export { RcSesTab, RcSesTabPanel, RcSesTabs, RcSesTabsWrapper }
70
71
  export { RcSesTextField }
71
72
  export { DataPagination }
73
+ export { ListWithIcons }
72
74
  export { ServiceWizardStepper }
73
75
  export type * from './types'
74
76
 
@@ -84,14 +86,4 @@ export {
84
86
  export type { RcSesIconProps }
85
87
  export { RcSesIconWithCircularBackground }
86
88
 
87
- export { RcSesLogo }
88
- export { ArrowRightIcon, ArrowLeftIcon }
89
- export {
90
- CaretDoubleLeftBoldIcon,
91
- CaretDoubleRightBoldIcon,
92
- CaretDownBoldIcon,
93
- CaretDownIcon,
94
- CaretLeftBoldIcon,
95
- CaretLeftIcon,
96
- CaretRightBoldIcon,
97
- }
89
+ export * from './icons'
@@ -1,5 +1,11 @@
1
1
  import { RcSesCardProps } from '@/components/common/Card'
2
+ import {
3
+ ListWithIconsItemData,
4
+ ListWithIconsProps,
5
+ } from '@/components/common/ListWithIcons'
2
6
  import { RcSesCardFormContainerProps } from '@/components/layout/ServiceFormContainer/CardFormContainer'
3
7
  import { ServiceWizardStepperProps } from '@/components/layout/ServiceWizardStepper'
4
8
 
9
+ export type { ListWithIconsProps, ListWithIconsItemData }
10
+
5
11
  export type { RcSesCardFormContainerProps, RcSesCardProps, ServiceWizardStepperProps }
@@ -24,7 +24,7 @@ const colorOptions = [
24
24
  ]
25
25
 
26
26
  const meta = {
27
- title: 'components/common/buttons/Button',
27
+ title: 'components/actions/Button',
28
28
  component: Button,
29
29
  parameters: {
30
30
  layout: 'centered',
@@ -3,11 +3,13 @@ import { Box, Typography } from '@mui/material'
3
3
  import type { Meta, StoryFn } from '@storybook/react'
4
4
 
5
5
  import CaretLeftIcon from '@/assets/icons/CaretLeftIcon'
6
+ import MagnifyingGlassIcon from '@/assets/icons/MagnifyingGlassIcon'
6
7
  import RcSesButton from '@/components/common/Button'
7
8
  import RcSesCard from '@/components/common/Card'
9
+ import palette from '@/theme/palette'
8
10
 
9
11
  const meta: Meta<typeof RcSesCard> = {
10
- title: 'components/common/Card',
12
+ title: 'components/display/Card',
11
13
  component: RcSesCard,
12
14
  tags: ['autodocs'],
13
15
  }
@@ -49,3 +51,19 @@ Main.args = {
49
51
  </>
50
52
  ),
51
53
  }
54
+
55
+ export const WithImage = Template.bind({})
56
+ WithImage.args = {
57
+ variant: 'elevation',
58
+ centered: true,
59
+ title: 'Place heading text here',
60
+ description:
61
+ 'Additional description text elaborating on situation and what to do next.',
62
+ image: (
63
+ <Box sx={{ color: palette.grey[400], position: 'relative', display: 'inline-flex' }}>
64
+ <MagnifyingGlassIcon size={64} fillColor={palette.grey[400]} />
65
+ </Box>
66
+ ),
67
+ children: <RcSesButton>Button</RcSesButton>,
68
+ contentBackground: false,
69
+ }