@@ -839,64 +839,102 @@ export const WithCustomTrailingVisuals = () => (
839
839
</ ActionList >
840
840
)
841
841
842
- // removing this until CSS Modules FF ships, currently broken in production if button semantic FF is false
843
- // export const WithTrailingAction = () => {
844
- // return (
845
- // <FeatureFlags flags={{primer_react_action_list_item_as_button: true}}>
846
- // <ActionList>
847
- // <ActionList.Item>
848
- // <ActionList.LeadingVisual>
849
- // <FileDirectoryIcon />
850
- // </ActionList.LeadingVisual>
851
- // Item 1 (with default TrailingAction)
852
- // <ActionList.TrailingAction label="Expand sidebar" icon={ArrowLeftIcon} />
853
- // </ActionList.Item>
854
- // <ActionList.Item>
855
- // Item 2 (with link TrailingAction)
856
- // <ActionList.TrailingAction as="a" href="#" label="Some action 1" icon={ArrowRightIcon} />
857
- // </ActionList.Item>
858
- // <ActionList.Item>
859
- // Item 3<ActionList.Description>This is an inline description.</ActionList.Description>
860
- // <ActionList.TrailingAction label="Some action 2" icon={BookIcon} />
861
- // </ActionList.Item>
862
- // <ActionList.Item>
863
- // Item 4<ActionList.Description variant="block">This is a block description.</ActionList.Description>
864
- // <ActionList.TrailingAction label="Some action 3" icon={BookIcon} />
865
- // </ActionList.Item>
866
- // <ActionList.Item>
867
- // Item 5<ActionList.Description variant="block">This is a block description.</ActionList.Description>
868
- // <ActionList.TrailingAction label="Some action 4" />
869
- // </ActionList.Item>
870
- // <ActionList.Item>
871
- // Item 6
872
- // <ActionList.TrailingAction href="#" as="a" label="Some action 5" />
873
- // </ActionList.Item>
874
- // <ActionList.LinkItem href="#">
875
- // LinkItem 1
876
- // <ActionList.Description>
877
- // with TrailingAction this is a long description and should not cause horizontal scroll on smaller screen
878
- // sizes
879
- // </ActionList.Description>
880
- // <ActionList.TrailingAction label="Another action" />
881
- // </ActionList.LinkItem>
882
- // <ActionList.LinkItem href="#">
883
- // LinkItem 2
884
- // <ActionList.Description>
885
- // with TrailingVisual this is a long description and should not cause horizontal scroll on smaller screen
886
- // sizes
887
- // </ActionList.Description>
888
- // <ActionList.TrailingVisual>
889
- // <TableIcon />
890
- // </ActionList.TrailingVisual>
891
- // </ActionList.LinkItem>
892
- // <ActionList.Item inactiveText="Unavailable due to an outage">
893
- // Inactive Item<ActionList.Description>With TrailingAction</ActionList.Description>
894
- // <ActionList.TrailingAction as="a" href="#" label="Some action 8" icon={ArrowRightIcon} />
895
- // </ActionList.Item>
896
- // </ActionList>
897
- // </FeatureFlags>
898
- // )
899
- // }
842
+ export const WithTrailingAction = ( ) => {
843
+ const [ loadingState , setLoadingState ] = React . useState ( false )
844
+
845
+ // Auto-toggle every 2.5 seconds to continuously show transitions
846
+ React . useEffect ( ( ) => {
847
+ const interval = setInterval ( ( ) => {
848
+ setLoadingState ( prev => ! prev )
849
+ } , 2500 )
850
+
851
+ return ( ) => clearInterval ( interval )
852
+ } , [ ] )
853
+
854
+ return (
855
+ < FeatureFlags flags = { { primer_react_action_list_item_as_button : true } } >
856
+ < ActionList >
857
+ < ActionList . Item >
858
+ < ActionList . LeadingVisual >
859
+ < FileDirectoryIcon />
860
+ </ ActionList . LeadingVisual >
861
+ Item 1 (with default TrailingAction)
862
+ < ActionList . TrailingAction label = "Expand sidebar" icon = { ArrowLeftIcon } />
863
+ </ ActionList . Item >
864
+ < ActionList . Item >
865
+ Item 2 (with link TrailingAction)
866
+ < ActionList . TrailingAction as = "a" href = "#" label = "Some action 1" icon = { ArrowRightIcon } />
867
+ </ ActionList . Item >
868
+ < ActionList . Item >
869
+ Item 3< ActionList . Description > This is an inline description.</ ActionList . Description >
870
+ < ActionList . TrailingAction label = "Some action 2" icon = { BookIcon } />
871
+ </ ActionList . Item >
872
+ < ActionList . Item >
873
+ Item 4< ActionList . Description variant = "block" > This is a block description.</ ActionList . Description >
874
+ < ActionList . TrailingAction label = "Some action 3" icon = { BookIcon } />
875
+ </ ActionList . Item >
876
+ < ActionList . Item >
877
+ Item 5< ActionList . Description variant = "block" > This is a block description.</ ActionList . Description >
878
+ < ActionList . TrailingAction label = "Some action 4" />
879
+ </ ActionList . Item >
880
+ < ActionList . Item >
881
+ Item 6
882
+ < ActionList . TrailingAction href = "#" as = "a" label = "Some action 5" />
883
+ </ ActionList . Item >
884
+ < ActionList . Item >
885
+ Icon button loading state
886
+ < ActionList . Description >
887
+ Shows how IconButton maintains width and centers spinner when loading
888
+ </ ActionList . Description >
889
+ < ActionList . TrailingAction label = "Process item" icon = { ArrowRightIcon } loading />
890
+ </ ActionList . Item >
891
+ < ActionList . Item >
892
+ Icon button with transitions
893
+ < ActionList . Description >
894
+ Automatically toggles loading state every 2.5 seconds to show transitions
895
+ </ ActionList . Description >
896
+ < ActionList . TrailingAction label = "Toggle loading" icon = { ArrowRightIcon } loading = { loadingState } />
897
+ </ ActionList . Item >
898
+ < ActionList . Item >
899
+ Text button loading state
900
+ < ActionList . Description >
901
+ Shows how text button aligns spinner to the right and preserves width
902
+ </ ActionList . Description >
903
+ < ActionList . TrailingAction label = "Save changes" loading />
904
+ </ ActionList . Item >
905
+ < ActionList . Item >
906
+ Text button with transitions
907
+ < ActionList . Description >
908
+ Automatically toggles loading state every 2.5 seconds to show transitions
909
+ </ ActionList . Description >
910
+ < ActionList . TrailingAction label = "Apply settings" loading = { loadingState } />
911
+ </ ActionList . Item >
912
+ < ActionList . LinkItem href = "#" >
913
+ LinkItem 1
914
+ < ActionList . Description >
915
+ with TrailingAction this is a long description and should not cause horizontal scroll on smaller screen
916
+ sizes
917
+ </ ActionList . Description >
918
+ < ActionList . TrailingAction label = "Another action" />
919
+ </ ActionList . LinkItem >
920
+ < ActionList . LinkItem href = "#" >
921
+ LinkItem 2
922
+ < ActionList . Description >
923
+ with TrailingVisual this is a long description and should not cause horizontal scroll on smaller screen
924
+ sizes
925
+ </ ActionList . Description >
926
+ < ActionList . TrailingVisual >
927
+ < TableIcon />
928
+ </ ActionList . TrailingVisual >
929
+ </ ActionList . LinkItem >
930
+ < ActionList . Item inactiveText = "Unavailable due to an outage" >
931
+ Inactive Item< ActionList . Description > With TrailingAction</ ActionList . Description >
932
+ < ActionList . TrailingAction as = "a" href = "#" label = "Some action 8" icon = { ArrowRightIcon } />
933
+ </ ActionList . Item >
934
+ </ ActionList >
935
+ </ FeatureFlags >
936
+ )
937
+ }
900
938
901
939
export const FullVariant = ( ) => (
902
940
< ActionList variant = "full" >
0 commit comments