@juspay/blend-design-system 0.0.37-beta.4 → 0.0.37-beta.5
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/components/Breadcrumb/Breadcrumb.d.ts +2 -5
- package/dist/components/Breadcrumb/types.d.ts +6 -0
- package/dist/components/Charts/ChartUtils.d.ts +2 -0
- package/dist/components/Charts/types.d.ts +2 -2
- package/dist/components/DateRangePicker/types.d.ts +1 -1
- package/dist/components/DateRangePicker/utils.d.ts +2 -0
- package/dist/components/Directory/Directory.d.ts +1 -1
- package/dist/components/Directory/types.d.ts +1 -1
- package/dist/components/Directory/utils.d.ts +2 -0
- package/dist/components/Radio/StyledRadio.d.ts +0 -1
- package/dist/components/Sidebar/SidebarContent.d.ts +1 -1
- package/dist/components/Sidebar/types.d.ts +10 -1
- package/dist/components/Sidebar/utils.d.ts +1 -1
- package/dist/components/SidebarV2/SidebarV2Panel.d.ts +1 -1
- package/dist/components/SidebarV2/index.d.ts +1 -1
- package/dist/components/SidebarV2/types.d.ts +3 -0
- package/dist/components/Stepper/types.d.ts +2 -0
- package/dist/main.js +27657 -27314
- package/dist/tokens.js +17 -16
- package/lib/components/Avatar/Avatar.tsx +6 -1
- package/lib/components/AvatarGroup/AvatarGroup.tsx +1 -1
- package/lib/components/AvatarV2/AvatarV2.tsx +10 -1
- package/lib/components/Breadcrumb/Breadcrumb.tsx +9 -8
- package/lib/components/Breadcrumb/types.ts +12 -0
- package/lib/components/Button/ButtonBase.tsx +1 -1
- package/lib/components/Card/CardComponents.tsx +52 -17
- package/lib/components/Charts/ChartUtils.tsx +7 -0
- package/lib/components/Charts/Charts.tsx +4 -2
- package/lib/components/Charts/CoreChart.tsx +4 -2
- package/lib/components/Charts/types.tsx +2 -2
- package/lib/components/ChartsV2/ChartV2.tsx +1 -1
- package/lib/components/Checkbox/Checkbox.tsx +29 -7
- package/lib/components/CodeBlock/CodeBlock.tsx +47 -1
- package/lib/components/CodeBlock/codeBlock.token.ts +5 -5
- package/lib/components/CodeEditor/CodeEditor.tsx +26 -4
- package/lib/components/CodeEditor/MonacoEditorWrapper.tsx +13 -1
- package/lib/components/DataTable/DataTable.tsx +8 -0
- package/lib/components/DataTable/TableHeader/FilterComponents.tsx +4 -0
- package/lib/components/DateRangePicker/DateRangePicker.tsx +34 -17
- package/lib/components/DateRangePicker/types.ts +5 -5
- package/lib/components/DateRangePicker/utils.ts +5 -0
- package/lib/components/Directory/Directory.tsx +3 -2
- package/lib/components/Directory/types.ts +1 -1
- package/lib/components/Directory/utils.ts +6 -0
- package/lib/components/Drawer/components/DrawerBase.tsx +16 -0
- package/lib/components/Drawer/components/NestedSelectDrawer.tsx +13 -1
- package/lib/components/Drawer/components/SelectDrawer.tsx +9 -1
- package/lib/components/Inputs/OTPInput/OTPInput.tsx +5 -3
- package/lib/components/Menu/Menu.tsx +9 -1
- package/lib/components/Modal/useModal.ts +7 -0
- package/lib/components/Radio/Radio.tsx +12 -5
- package/lib/components/Radio/StyledRadio.tsx +33 -17
- package/lib/components/Sidebar/Sidebar.tsx +11 -1
- package/lib/components/Sidebar/SidebarContent.tsx +5 -2
- package/lib/components/Sidebar/TenantPanel.tsx +52 -34
- package/lib/components/Sidebar/types.ts +11 -1
- package/lib/components/Sidebar/utils.ts +1 -1
- package/lib/components/SidebarV2/SecondarySidebar.tsx +86 -44
- package/lib/components/SidebarV2/SidebarV2Panel.tsx +4 -2
- package/lib/components/SidebarV2/index.ts +1 -0
- package/lib/components/SidebarV2/types.ts +4 -0
- package/lib/components/StatCard/statcard.tokens.ts +1 -1
- package/lib/components/Stepper/VerticalStepper.tsx +209 -171
- package/lib/components/Stepper/types.ts +2 -0
- package/lib/components/StepperV2/Stepper/Steps.tsx +15 -1
- package/lib/components/Text/Text.tsx +1 -0
- package/lib/components/Upload/Upload.tsx +6 -0
- package/lib/components/Upload/components/FileListDisplay.tsx +159 -16
- package/lib/components/Upload/utils.ts +10 -2
- package/lib/context/ThemeProvider.tsx +19 -8
- package/lib/hooks/useDebounce.ts +9 -1
- package/package.json +1 -1
|
@@ -440,7 +440,7 @@ const StepComponent = forwardRef<
|
|
|
440
440
|
display="flex"
|
|
441
441
|
justifyContent="space-between"
|
|
442
442
|
gap={8}
|
|
443
|
-
alignItems="
|
|
443
|
+
alignItems="center"
|
|
444
444
|
>
|
|
445
445
|
<Block
|
|
446
446
|
display="flex"
|
|
@@ -566,6 +566,16 @@ const StepComponent = forwardRef<
|
|
|
566
566
|
/>
|
|
567
567
|
</Block>
|
|
568
568
|
)}
|
|
569
|
+
{step.slot && (
|
|
570
|
+
<Block
|
|
571
|
+
flexShrink={0}
|
|
572
|
+
onClick={(e: React.MouseEvent) => {
|
|
573
|
+
e.stopPropagation()
|
|
574
|
+
}}
|
|
575
|
+
>
|
|
576
|
+
{step.slot}
|
|
577
|
+
</Block>
|
|
578
|
+
)}
|
|
569
579
|
</Block>
|
|
570
580
|
|
|
571
581
|
{isExpanded &&
|
|
@@ -623,184 +633,212 @@ const StepComponent = forwardRef<
|
|
|
623
633
|
}
|
|
624
634
|
>
|
|
625
635
|
<Block
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
636
|
+
display="flex"
|
|
637
|
+
justifyContent="space-between"
|
|
638
|
+
alignItems="center"
|
|
639
|
+
gap={8}
|
|
640
|
+
>
|
|
641
|
+
<Block
|
|
642
|
+
data-element="substep"
|
|
643
|
+
data-id={`Substep ${index + 1}: ${subStep.title}${
|
|
644
|
+
isSubstepCompleted
|
|
645
|
+
? ', completed'
|
|
646
|
+
: isSubstepCurrent
|
|
647
|
+
? ', current'
|
|
648
|
+
: isSubstepDisabled
|
|
649
|
+
? ', disabled'
|
|
650
|
+
: isSubstepSkipped
|
|
651
|
+
? ', skipped'
|
|
652
|
+
: ', pending'
|
|
653
|
+
}`}
|
|
654
|
+
data-numeric={subStep.id}
|
|
655
|
+
ref={(el) => {
|
|
656
|
+
substepRefs.current[
|
|
657
|
+
index
|
|
658
|
+
] = el
|
|
659
|
+
}}
|
|
660
|
+
role={
|
|
661
|
+
clickable
|
|
662
|
+
? 'button'
|
|
663
|
+
: 'group'
|
|
664
|
+
}
|
|
665
|
+
tabIndex={
|
|
666
|
+
clickable &&
|
|
667
|
+
!isSubstepDisabled
|
|
668
|
+
? 0
|
|
669
|
+
: -1
|
|
670
|
+
}
|
|
671
|
+
aria-label={`Substep ${index + 1}: ${subStep.title}${
|
|
672
|
+
isSubstepCompleted
|
|
673
|
+
? ', completed'
|
|
674
|
+
: isSubstepCurrent
|
|
675
|
+
? ', current'
|
|
676
|
+
: isSubstepDisabled
|
|
677
|
+
? ', disabled'
|
|
678
|
+
: isSubstepSkipped
|
|
679
|
+
? ', skipped'
|
|
680
|
+
: ', pending'
|
|
681
|
+
}`}
|
|
682
|
+
aria-disabled={
|
|
683
|
+
isSubstepDisabled
|
|
684
|
+
? 'true'
|
|
685
|
+
: undefined
|
|
686
|
+
}
|
|
687
|
+
aria-current={
|
|
688
|
+
isSubstepCurrent
|
|
689
|
+
? 'step'
|
|
690
|
+
: undefined
|
|
691
|
+
}
|
|
692
|
+
style={{
|
|
693
|
+
flex: 1,
|
|
694
|
+
cursor: clickable
|
|
695
|
+
? 'pointer'
|
|
696
|
+
: 'default',
|
|
697
|
+
}}
|
|
698
|
+
onClick={
|
|
699
|
+
clickable &&
|
|
700
|
+
onSubstepClick
|
|
701
|
+
? (
|
|
702
|
+
e: React.MouseEvent
|
|
703
|
+
) => {
|
|
704
|
+
e.preventDefault()
|
|
705
|
+
e.stopPropagation()
|
|
706
|
+
onSubstepClick(
|
|
707
|
+
stepIndex,
|
|
708
|
+
index
|
|
709
|
+
)
|
|
710
|
+
}
|
|
711
|
+
: undefined
|
|
712
|
+
}
|
|
713
|
+
onKeyDown={(
|
|
714
|
+
event: React.KeyboardEvent
|
|
715
|
+
) => {
|
|
716
|
+
if (isSubstepDisabled)
|
|
717
|
+
return
|
|
718
|
+
|
|
719
|
+
switch (event.key) {
|
|
720
|
+
case 'Enter':
|
|
721
|
+
case ' ': {
|
|
722
|
+
if (
|
|
723
|
+
clickable &&
|
|
724
|
+
onSubstepClick
|
|
725
|
+
) {
|
|
726
|
+
event.preventDefault()
|
|
727
|
+
event.stopPropagation()
|
|
728
|
+
onSubstepClick(
|
|
729
|
+
stepIndex,
|
|
730
|
+
index
|
|
731
|
+
)
|
|
732
|
+
}
|
|
733
|
+
break
|
|
734
|
+
}
|
|
735
|
+
case 'ArrowUp': {
|
|
707
736
|
event.preventDefault()
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
737
|
+
const prevIndex =
|
|
738
|
+
Math.max(
|
|
739
|
+
index -
|
|
740
|
+
1,
|
|
741
|
+
0
|
|
742
|
+
)
|
|
743
|
+
if (
|
|
744
|
+
step.substeps &&
|
|
745
|
+
!step
|
|
746
|
+
.substeps[
|
|
747
|
+
prevIndex
|
|
748
|
+
]
|
|
749
|
+
?.disabled &&
|
|
750
|
+
substepRefs
|
|
751
|
+
.current[
|
|
752
|
+
prevIndex
|
|
753
|
+
]
|
|
754
|
+
) {
|
|
755
|
+
setFocusedSubstepIndex(
|
|
756
|
+
prevIndex
|
|
757
|
+
)
|
|
758
|
+
substepRefs.current[
|
|
759
|
+
prevIndex
|
|
760
|
+
]?.focus()
|
|
761
|
+
}
|
|
762
|
+
break
|
|
713
763
|
}
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
764
|
+
case 'ArrowDown': {
|
|
765
|
+
event.preventDefault()
|
|
766
|
+
const nextIndex =
|
|
767
|
+
Math.min(
|
|
768
|
+
index +
|
|
769
|
+
1,
|
|
770
|
+
step.substeps
|
|
771
|
+
? step
|
|
772
|
+
.substeps
|
|
773
|
+
.length -
|
|
774
|
+
1
|
|
775
|
+
: 0
|
|
776
|
+
)
|
|
777
|
+
if (
|
|
778
|
+
step.substeps &&
|
|
779
|
+
!step
|
|
780
|
+
.substeps[
|
|
781
|
+
nextIndex
|
|
782
|
+
]
|
|
783
|
+
?.disabled &&
|
|
784
|
+
substepRefs
|
|
785
|
+
.current[
|
|
786
|
+
nextIndex
|
|
787
|
+
]
|
|
788
|
+
) {
|
|
789
|
+
setFocusedSubstepIndex(
|
|
790
|
+
nextIndex
|
|
791
|
+
)
|
|
792
|
+
substepRefs.current[
|
|
793
|
+
nextIndex
|
|
794
|
+
]?.focus()
|
|
795
|
+
}
|
|
796
|
+
break
|
|
739
797
|
}
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const nextIndex =
|
|
745
|
-
Math.min(
|
|
746
|
-
index + 1,
|
|
747
|
-
step.substeps
|
|
748
|
-
? step
|
|
749
|
-
.substeps
|
|
750
|
-
.length -
|
|
751
|
-
1
|
|
752
|
-
: 0
|
|
753
|
-
)
|
|
754
|
-
if (
|
|
755
|
-
step.substeps &&
|
|
756
|
-
!step.substeps[
|
|
757
|
-
nextIndex
|
|
758
|
-
]?.disabled &&
|
|
759
|
-
substepRefs
|
|
760
|
-
.current[
|
|
761
|
-
nextIndex
|
|
762
|
-
]
|
|
763
|
-
) {
|
|
798
|
+
case 'ArrowLeft':
|
|
799
|
+
case 'ArrowRight': {
|
|
800
|
+
// Move back to parent step
|
|
801
|
+
event.preventDefault()
|
|
764
802
|
setFocusedSubstepIndex(
|
|
765
|
-
|
|
803
|
+
null
|
|
766
804
|
)
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
805
|
+
if (
|
|
806
|
+
ref &&
|
|
807
|
+
typeof ref !==
|
|
808
|
+
'function'
|
|
809
|
+
) {
|
|
810
|
+
ref.current?.focus()
|
|
811
|
+
}
|
|
812
|
+
break
|
|
770
813
|
}
|
|
771
|
-
break
|
|
772
814
|
}
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
)
|
|
780
|
-
if (
|
|
781
|
-
ref &&
|
|
782
|
-
typeof ref !==
|
|
783
|
-
'function'
|
|
784
|
-
) {
|
|
785
|
-
ref.current?.focus()
|
|
786
|
-
}
|
|
787
|
-
break
|
|
788
|
-
}
|
|
789
|
-
}
|
|
790
|
-
}}
|
|
791
|
-
onFocus={() => {
|
|
792
|
-
setFocusedSubstepIndex(
|
|
793
|
-
index
|
|
794
|
-
)
|
|
795
|
-
}}
|
|
796
|
-
>
|
|
797
|
-
<Text
|
|
798
|
-
fontSize={12}
|
|
799
|
-
fontWeight={500}
|
|
800
|
-
color={textColor}
|
|
815
|
+
}}
|
|
816
|
+
onFocus={() => {
|
|
817
|
+
setFocusedSubstepIndex(
|
|
818
|
+
index
|
|
819
|
+
)
|
|
820
|
+
}}
|
|
801
821
|
>
|
|
802
|
-
|
|
803
|
-
|
|
822
|
+
<Text
|
|
823
|
+
fontSize={12}
|
|
824
|
+
fontWeight={500}
|
|
825
|
+
color={textColor}
|
|
826
|
+
>
|
|
827
|
+
{subStep.title}
|
|
828
|
+
</Text>
|
|
829
|
+
</Block>
|
|
830
|
+
{subStep.slot && (
|
|
831
|
+
<Block
|
|
832
|
+
flexShrink={0}
|
|
833
|
+
onClick={(
|
|
834
|
+
e: React.MouseEvent
|
|
835
|
+
) => {
|
|
836
|
+
e.stopPropagation()
|
|
837
|
+
}}
|
|
838
|
+
>
|
|
839
|
+
{subStep.slot}
|
|
840
|
+
</Block>
|
|
841
|
+
)}
|
|
804
842
|
</Block>
|
|
805
843
|
</Block>
|
|
806
844
|
)
|
|
@@ -26,6 +26,7 @@ export type SubStep = {
|
|
|
26
26
|
title: string
|
|
27
27
|
status?: StepState
|
|
28
28
|
disabled?: boolean
|
|
29
|
+
slot?: ReactNode
|
|
29
30
|
}
|
|
30
31
|
|
|
31
32
|
export type Step = {
|
|
@@ -35,6 +36,7 @@ export type Step = {
|
|
|
35
36
|
disabled?: boolean
|
|
36
37
|
description?: string
|
|
37
38
|
icon?: ReactNode
|
|
39
|
+
slot?: ReactNode
|
|
38
40
|
substeps?: SubStep[]
|
|
39
41
|
isExpandable?: boolean
|
|
40
42
|
isExpanded?: boolean
|
|
@@ -62,6 +62,9 @@ export const Steps = forwardRef<
|
|
|
62
62
|
const [isExpanded, setIsExpanded] = useState<boolean>(
|
|
63
63
|
step.isExpanded ?? hasSubsteps
|
|
64
64
|
)
|
|
65
|
+
const focusTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(
|
|
66
|
+
null
|
|
67
|
+
)
|
|
65
68
|
|
|
66
69
|
useEffect(() => {
|
|
67
70
|
if (step.isExpanded !== undefined) {
|
|
@@ -84,6 +87,14 @@ export const Steps = forwardRef<
|
|
|
84
87
|
return () => cancelAnimationFrame(animationFrameId)
|
|
85
88
|
}, [isExpanded, hasSubsteps, step.substeps?.length])
|
|
86
89
|
|
|
90
|
+
useEffect(() => {
|
|
91
|
+
return () => {
|
|
92
|
+
if (focusTimeoutRef.current) {
|
|
93
|
+
clearTimeout(focusTimeoutRef.current)
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}, [])
|
|
97
|
+
|
|
87
98
|
const stepState = getStepState(step, isCompleted, isCurrent)
|
|
88
99
|
const isClickable = Boolean(clickable && !step.disabled && onClick)
|
|
89
100
|
|
|
@@ -192,7 +203,10 @@ export const Steps = forwardRef<
|
|
|
192
203
|
if (!isHorizontal && hasSubsteps && !isExpanded) {
|
|
193
204
|
event.preventDefault()
|
|
194
205
|
toggleExpand()
|
|
195
|
-
|
|
206
|
+
focusTimeoutRef.current = setTimeout(
|
|
207
|
+
() => focusFirstSubstep(),
|
|
208
|
+
100
|
|
209
|
+
)
|
|
196
210
|
return
|
|
197
211
|
}
|
|
198
212
|
if (!isHorizontal && hasSubsteps && isExpanded) {
|
|
@@ -146,6 +146,12 @@ const Upload: React.FC<UploadProps> = ({
|
|
|
146
146
|
|
|
147
147
|
const uploadManager = useMemo(() => createUploadManager(), [])
|
|
148
148
|
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
return () => {
|
|
151
|
+
uploadManager.cancelAllUploads()
|
|
152
|
+
}
|
|
153
|
+
}, [uploadManager])
|
|
154
|
+
|
|
149
155
|
const handleInternalDrop = useMemo(
|
|
150
156
|
() =>
|
|
151
157
|
createComplexDropHandler(
|