@instructure/ui-view 11.0.1-snapshot-1 → 11.0.1-snapshot-2

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.
@@ -448,530 +448,264 @@ The focus outline adjusts to account for the shape of the View. For example, the
448
448
  `circle`, `pill`, `small`, `medium`, and `large`. In each case, the border radius of the focus outline will automatically adjust
449
449
  to match the border radius of the corresponding View. The color of the focus outline can be changed for different contexts via the `focusColor` property.
450
450
 
451
- - ```javascript
452
- class FocusedExample extends React.Component {
453
- constructor(props) {
454
- super(props)
455
-
456
- this.state = {
457
- isFocused: true,
458
- inset: false,
459
- focusColor: undefined
460
- }
461
- }
462
-
463
- updateFocused = (event) => {
464
- this.setState({ isFocused: event.target.checked })
465
- }
466
-
467
- updateInset = (event) => {
468
- this.setState({ inset: event.target.checked })
469
- }
470
-
471
- updateFocusRingColor = (event, value) => {
472
- this.setState({ focusColor: value })
473
- }
474
-
475
- render() {
476
- return (
477
- <View as="div">
478
- <View
479
- as="div"
480
- background="primary"
481
- padding="small"
482
- margin="0 0 small"
483
- borderWidth="small"
484
- >
485
- <FormFieldGroup
486
- rowSpacing="small"
487
- description={
488
- <ScreenReaderContent>
489
- View focus outline examples
490
- </ScreenReaderContent>
491
- }
492
- >
493
- <Flex gap="small" direction="row">
494
- <Flex gap="small" direction="column" width="15rem">
495
- <Checkbox
496
- label="withFocusOutline"
497
- checked={this.state.isFocused}
498
- onChange={this.updateFocused}
499
- />
500
- <Checkbox
501
- label="focusPosition = inset"
502
- checked={this.state.inset}
503
- onChange={this.updateInset}
504
- />
505
- </Flex>
506
- <RadioInputGroup
507
- onChange={this.updateFocusRingColor}
508
- name="focusColor"
509
- defaultValue="info"
510
- variant="toggle"
511
- description="Focus ring color"
512
- >
513
- <RadioInput label="info" value="info" />
514
- <RadioInput label="inverse" value="inverse" />
515
- <RadioInput label="success" value="success" />
516
- <RadioInput label="danger" value="danger" />
517
- </RadioInputGroup>
518
- </Flex>
519
- </FormFieldGroup>
520
- </View>
521
- <View as="div">
522
- <code>borderRadius =</code>
523
- <View
524
- display="inline-block"
525
- margin="small"
526
- padding="small"
527
- background="primary"
528
- borderRadius="small"
529
- borderWidth="small"
530
- position="relative"
531
- focusColor={this.state.focusColor}
532
- withFocusOutline={this.state.isFocused}
533
- focusPosition={this.state.inset ? 'inset' : 'offset'}
534
- >
535
- small
536
- </View>
537
- <View
538
- display="inline-block"
539
- margin="small"
540
- padding="small"
541
- background="primary"
542
- borderRadius="medium"
543
- borderWidth="small"
544
- position="relative"
545
- focusColor={this.state.focusColor}
546
- withFocusOutline={this.state.isFocused}
547
- focusPosition={this.state.inset ? 'inset' : 'offset'}
548
- >
549
- medium
550
- </View>
551
- <View
552
- display="inline-block"
553
- margin="small"
554
- padding="small"
555
- background="primary"
556
- borderRadius="large"
557
- borderWidth="small"
558
- position="relative"
559
- focusColor={this.state.focusColor}
560
- withFocusOutline={this.state.isFocused}
561
- focusPosition={this.state.inset ? 'inset' : 'offset'}
562
- >
563
- large
564
- </View>
565
- <View
566
- display="inline-block"
567
- height="100px"
568
- width="100px"
569
- margin="small"
570
- background="primary"
571
- borderRadius="circle"
572
- borderWidth="small"
573
- position="relative"
574
- focusColor={this.state.focusColor}
575
- withFocusOutline={this.state.isFocused}
576
- focusPosition={this.state.inset ? 'inset' : 'offset'}
577
- >
578
- <Flex
579
- width="100%"
580
- height="100%"
581
- alignItems="center"
582
- justifyItems="center"
583
- >
584
- <Flex.Item>circle</Flex.Item>
585
- </Flex>
586
- </View>
587
- <View
588
- background="primary-inverse"
589
- display="inline-block"
590
- padding="small"
591
- >
592
- <View
593
- display="block"
594
- margin="small"
595
- padding="small"
596
- background="primary-inverse"
597
- borderRadius="large"
598
- borderWidth="small"
599
- position="relative"
600
- withFocusOutline={this.state.isFocused}
601
- focusColor={this.state.focusColor}
602
- focusPosition={this.state.inset ? 'inset' : 'offset'}
603
- >
604
- medium
605
- </View>
606
- </View>
607
- <View
608
- display="inline-block"
609
- margin="small"
610
- padding="small"
611
- background="primary"
612
- borderRadius="pill"
613
- borderWidth="small"
614
- position="relative"
615
- width="100px"
616
- textAlign="center"
617
- focusColor={this.state.focusColor}
618
- withFocusOutline={this.state.isFocused}
619
- focusPosition={this.state.inset ? 'inset' : 'offset'}
620
- >
621
- pill
622
- </View>
623
- <View
624
- display="inline-block"
625
- margin="small"
626
- padding="small"
627
- background="primary"
628
- borderWidth="small"
629
- borderRadius="none large"
630
- position="relative"
631
- focusColor={this.state.focusColor}
632
- withFocusOutline={this.state.isFocused}
633
- focusPosition={this.state.inset ? 'inset' : 'offset'}
451
+ ```js
452
+ ---
453
+ type: example
454
+ ---
455
+ const FocusedExample = () => {
456
+ const [isFocused, setIsFocused] = useState(true)
457
+ const [inset, setInset] = useState(false)
458
+ const [focusColor, setfocusColor] = useState(undefined)
459
+
460
+ const updateFocused = (event) => setIsFocused(event.target.checked)
461
+ const updateInset = (event) => setInset(event.target.checked)
462
+ const updateFocusRingColor = (event) => setfocusColor(event.target.value)
463
+
464
+ return (
465
+ <View as="div">
466
+ <View
467
+ as="div"
468
+ background="primary"
469
+ padding="small"
470
+ margin="0 0 small"
471
+ borderWidth="small"
472
+ >
473
+ <FormFieldGroup
474
+ rowSpacing="small"
475
+ description={
476
+ <ScreenReaderContent>
477
+ View focus outline examples
478
+ </ScreenReaderContent>
479
+ }
480
+ >
481
+ <Flex gap="small" direction="row">
482
+ <Flex gap="small" direction="column" width="15rem">
483
+ <Checkbox
484
+ label="withFocusOutline"
485
+ checked={isFocused}
486
+ onChange={updateFocused}
487
+ />
488
+ <Checkbox
489
+ label="focusPosition = inset"
490
+ checked={inset}
491
+ onChange={updateInset}
492
+ />
493
+ </Flex>
494
+ <RadioInputGroup
495
+ onChange={updateFocusRingColor}
496
+ name="focusColor_2"
497
+ defaultValue="info"
498
+ variant="toggle"
499
+ description="Focus ring color"
634
500
  >
635
- none large
636
- </View>
637
- </View>
638
- </View>
639
- )
640
- }
641
- }
642
- render(<FocusedExample />)
643
- ```
644
-
645
- - ```javascript
646
- const FocusedExample = () => {
647
- const [isFocused, setIsFocused] = useState(true)
648
- const [inset, setInset] = useState(false)
649
- const [focusColor, setfocusColor] = useState(undefined)
650
-
651
- const updateFocused = (event) => setIsFocused(event.target.checked)
652
- const updateInset = (event) => setInset(event.target.checked)
653
- const updateFocusRingColor = (event) => setfocusColor(event.target.value)
654
-
655
- return (
501
+ <RadioInput label="info" value="info" />
502
+ <RadioInput label="inverse" value="inverse" />
503
+ <RadioInput label="success" value="success" />
504
+ <RadioInput label="danger" value="danger" />
505
+ </RadioInputGroup>
506
+ </Flex>
507
+ </FormFieldGroup>
508
+ </View>
656
509
  <View as="div">
510
+ <code>borderRadius =</code>
511
+ <View
512
+ display="inline-block"
513
+ margin="small"
514
+ padding="small"
515
+ background="primary"
516
+ borderRadius="small"
517
+ borderWidth="small"
518
+ position="relative"
519
+ focusColor={focusColor}
520
+ withFocusOutline={isFocused}
521
+ focusPosition={inset ? 'inset' : 'offset'}
522
+ >
523
+ small
524
+ </View>
657
525
  <View
658
- as="div"
526
+ display="inline-block"
527
+ margin="small"
528
+ padding="small"
659
529
  background="primary"
530
+ borderRadius="medium"
531
+ borderWidth="small"
532
+ position="relative"
533
+ withFocusOutline={isFocused}
534
+ focusColor={focusColor}
535
+ focusPosition={inset ? 'inset' : 'offset'}
536
+ >
537
+ medium
538
+ </View>
539
+ <View
540
+ display="inline-block"
541
+ margin="small"
660
542
  padding="small"
661
- margin="0 0 small"
543
+ background="primary"
544
+ borderRadius="large"
662
545
  borderWidth="small"
546
+ position="relative"
547
+ withFocusOutline={isFocused}
548
+ focusColor={focusColor}
549
+ focusPosition={inset ? 'inset' : 'offset'}
663
550
  >
664
- <FormFieldGroup
665
- rowSpacing="small"
666
- description={
667
- <ScreenReaderContent>
668
- View focus outline examples
669
- </ScreenReaderContent>
670
- }
671
- >
672
- <Flex gap="small" direction="row">
673
- <Flex gap="small" direction="column" width="15rem">
674
- <Checkbox
675
- label="withFocusOutline"
676
- checked={isFocused}
677
- onChange={updateFocused}
678
- />
679
- <Checkbox
680
- label="focusPosition = inset"
681
- checked={inset}
682
- onChange={updateInset}
683
- />
684
- </Flex>
685
- <RadioInputGroup
686
- onChange={updateFocusRingColor}
687
- name="focusColor_2"
688
- defaultValue="info"
689
- variant="toggle"
690
- description="Focus ring color"
691
- >
692
- <RadioInput label="info" value="info" />
693
- <RadioInput label="inverse" value="inverse" />
694
- <RadioInput label="success" value="success" />
695
- <RadioInput label="danger" value="danger" />
696
- </RadioInputGroup>
697
- </Flex>
698
- </FormFieldGroup>
551
+ large
699
552
  </View>
700
- <View as="div">
701
- <code>borderRadius =</code>
702
- <View
703
- display="inline-block"
704
- margin="small"
705
- padding="small"
706
- background="primary"
707
- borderRadius="small"
708
- borderWidth="small"
709
- position="relative"
710
- focusColor={focusColor}
711
- withFocusOutline={isFocused}
712
- focusPosition={inset ? 'inset' : 'offset'}
713
- >
714
- small
715
- </View>
716
- <View
717
- display="inline-block"
718
- margin="small"
719
- padding="small"
720
- background="primary"
721
- borderRadius="medium"
722
- borderWidth="small"
723
- position="relative"
724
- withFocusOutline={isFocused}
725
- focusColor={focusColor}
726
- focusPosition={inset ? 'inset' : 'offset'}
553
+ <View
554
+ display="inline-block"
555
+ height="100px"
556
+ width="100px"
557
+ margin="small"
558
+ background="primary"
559
+ borderRadius="circle"
560
+ borderWidth="small"
561
+ position="relative"
562
+ withFocusOutline={isFocused}
563
+ focusColor={focusColor}
564
+ focusPosition={inset ? 'inset' : 'offset'}
565
+ >
566
+ <Flex
567
+ width="100%"
568
+ height="100%"
569
+ alignItems="center"
570
+ justifyItems="center"
727
571
  >
728
- medium
729
- </View>
572
+ <Flex.Item>circle</Flex.Item>
573
+ </Flex>
574
+ </View>
575
+ <View
576
+ background="primary-inverse"
577
+ display="inline-block"
578
+ padding="small"
579
+ >
730
580
  <View
731
- display="inline-block"
581
+ display="block"
732
582
  margin="small"
733
583
  padding="small"
734
- background="primary"
735
- borderRadius="large"
736
- borderWidth="small"
737
- position="relative"
738
- withFocusOutline={isFocused}
739
- focusColor={focusColor}
740
- focusPosition={inset ? 'inset' : 'offset'}
741
- >
742
- large
743
- </View>
744
- <View
745
- display="inline-block"
746
- height="100px"
747
- width="100px"
748
- margin="small"
749
- background="primary"
750
- borderRadius="circle"
751
- borderWidth="small"
752
- position="relative"
753
- withFocusOutline={isFocused}
754
- focusColor={focusColor}
755
- focusPosition={inset ? 'inset' : 'offset'}
756
- >
757
- <Flex
758
- width="100%"
759
- height="100%"
760
- alignItems="center"
761
- justifyItems="center"
762
- >
763
- <Flex.Item>circle</Flex.Item>
764
- </Flex>
765
- </View>
766
- <View
767
584
  background="primary-inverse"
768
- display="inline-block"
769
- padding="small"
770
- >
771
- <View
772
- display="block"
773
- margin="small"
774
- padding="small"
775
- background="primary-inverse"
776
- borderRadius="large"
777
- borderWidth="small"
778
- position="relative"
779
- withFocusOutline={isFocused}
780
- focusColor={focusColor}
781
- focusColor="inverse"
782
- focusPosition={inset ? 'inset' : 'offset'}
783
- >
784
- medium
785
- </View>
786
- </View>
787
- <View
788
- display="inline-block"
789
- margin="small"
790
- padding="small"
791
- background="primary"
792
- borderRadius="pill"
585
+ borderRadius="large"
793
586
  borderWidth="small"
794
587
  position="relative"
795
- focusColor="success"
796
- width="100px"
797
- textAlign="center"
798
- focusColor={focusColor}
799
588
  withFocusOutline={isFocused}
800
- focusPosition={inset ? 'inset' : 'offset'}
801
- >
802
- pill
803
- </View>
804
- <View
805
- display="inline-block"
806
- margin="small"
807
- padding="small"
808
- background="primary"
809
- borderWidth="small"
810
- borderRadius="none large"
811
- focusColor="danger"
812
- position="relative"
813
589
  focusColor={focusColor}
814
- withFocusOutline={isFocused}
590
+ focusColor="inverse"
815
591
  focusPosition={inset ? 'inset' : 'offset'}
816
592
  >
817
- none large
593
+ medium
818
594
  </View>
819
595
  </View>
596
+ <View
597
+ display="inline-block"
598
+ margin="small"
599
+ padding="small"
600
+ background="primary"
601
+ borderRadius="pill"
602
+ borderWidth="small"
603
+ position="relative"
604
+ focusColor="success"
605
+ width="100px"
606
+ textAlign="center"
607
+ focusColor={focusColor}
608
+ withFocusOutline={isFocused}
609
+ focusPosition={inset ? 'inset' : 'offset'}
610
+ >
611
+ pill
612
+ </View>
613
+ <View
614
+ display="inline-block"
615
+ margin="small"
616
+ padding="small"
617
+ background="primary"
618
+ borderWidth="small"
619
+ borderRadius="none large"
620
+ focusColor="danger"
621
+ position="relative"
622
+ focusColor={focusColor}
623
+ withFocusOutline={isFocused}
624
+ focusPosition={inset ? 'inset' : 'offset'}
625
+ >
626
+ none large
627
+ </View>
820
628
  </View>
821
- )
822
- }
629
+ </View>
630
+ )
631
+ }
823
632
 
824
- render(<FocusedExample />)
825
- ```
633
+ render(<FocusedExample />)
634
+ ```
826
635
 
827
636
  Handle vertical and horizontal content overflow with the `overflowX` and `overflowY`
828
637
  props.
829
638
 
830
639
  > **Important CSS note:** Setting one axis to `visible` and setting the other to a different value results in `visible` behaving as `auto`.
831
640
 
832
- - ```javascript
833
- class OverflowExample extends React.Component {
834
- constructor(props) {
835
- super(props)
836
-
837
- this.state = {
838
- overflowY: 'visible',
839
- overflowX: 'visible'
840
- }
841
- }
842
-
843
- updateOverflowY = (event, value) => {
844
- this.setState({
845
- overflowY: value
846
- })
847
- }
848
-
849
- updateOverflowX = (event, value) => {
850
- this.setState({
851
- overflowX: value
852
- })
853
- }
641
+ ```js
642
+ ---
643
+ type: example
644
+ ---
645
+ const OverflowExample = () => {
646
+ const [overflowY, setOverflowY] = useState('visible')
647
+ const [overflowX, setOverflowX] = useState('visible')
854
648
 
855
- render() {
856
- return (
857
- <View as="div">
858
- <FormFieldGroup
859
- description={
860
- <ScreenReaderContent>Overflow example</ScreenReaderContent>
861
- }
862
- rowSpacing="small"
863
- vAlign="top"
864
- layout="columns"
865
- >
866
- <RadioInputGroup
867
- onChange={this.updateOverflowY}
868
- name="overflowY"
869
- defaultValue="visible"
870
- variant="toggle"
871
- description="overflowY ="
872
- >
873
- <RadioInput label="visible" value="visible" />
874
- <RadioInput label="auto" value="auto" />
875
- <RadioInput label="hidden" value="hidden" />
876
- </RadioInputGroup>
877
- <RadioInputGroup
878
- onChange={this.updateOverflowX}
879
- name="overflowX"
880
- defaultValue="visible"
881
- variant="toggle"
882
- description="overflowX ="
883
- >
884
- <RadioInput label="visible" value="visible" />
885
- <RadioInput label="auto" value="auto" />
886
- <RadioInput label="hidden" value="hidden" />
887
- </RadioInputGroup>
888
- </FormFieldGroup>
889
- <View
890
- as="div"
891
- height="7rem"
892
- width="20rem"
893
- margin="medium none x-large"
894
- overflowY={this.state.overflowY}
895
- overflowX={this.state.overflowX}
896
- withVisualDebug
897
- >
898
- <div style={{ width: '30rem', height: '10rem' }}>
899
- <Img src={avatarSquare} constrain="cover" />
900
- </div>
901
- </View>
902
- </View>
903
- )
904
- }
649
+ const updateOverflowY = (event, value) => {
650
+ setOverflowY(value)
905
651
  }
906
652
 
907
- render(<OverflowExample />)
908
- ```
909
-
910
- - ```javascript
911
- const OverflowExample = () => {
912
- const [overflowY, setOverflowY] = useState('visible')
913
- const [overflowX, setOverflowX] = useState('visible')
914
-
915
- const updateOverflowY = (event, value) => {
916
- setOverflowY(value)
917
- }
918
-
919
- const updateOverflowX = (event, value) => {
920
- setOverflowX(value)
921
- }
653
+ const updateOverflowX = (event, value) => {
654
+ setOverflowX(value)
655
+ }
922
656
 
923
- return (
924
- <View as="div">
925
- <FormFieldGroup
926
- description={
927
- <ScreenReaderContent>Overflow example</ScreenReaderContent>
928
- }
929
- rowSpacing="small"
930
- vAlign="top"
931
- layout="columns"
657
+ return (
658
+ <View as="div">
659
+ <FormFieldGroup
660
+ description={
661
+ <ScreenReaderContent>Overflow example</ScreenReaderContent>
662
+ }
663
+ rowSpacing="small"
664
+ vAlign="top"
665
+ layout="columns"
666
+ >
667
+ <RadioInputGroup
668
+ onChange={updateOverflowY}
669
+ name="overflowY"
670
+ defaultValue="visible"
671
+ variant="toggle"
672
+ description="overflowY ="
932
673
  >
933
- <RadioInputGroup
934
- onChange={updateOverflowY}
935
- name="overflowY"
936
- defaultValue="visible"
937
- variant="toggle"
938
- description="overflowY ="
939
- >
940
- <RadioInput label="visible" value="visible" />
941
- <RadioInput label="auto" value="auto" />
942
- <RadioInput label="hidden" value="hidden" />
943
- </RadioInputGroup>
944
- <RadioInputGroup
945
- onChange={updateOverflowX}
946
- name="overflowX"
947
- defaultValue="visible"
948
- variant="toggle"
949
- description="overflowX ="
950
- >
951
- <RadioInput label="visible" value="visible" />
952
- <RadioInput label="auto" value="auto" />
953
- <RadioInput label="hidden" value="hidden" />
954
- </RadioInputGroup>
955
- </FormFieldGroup>
956
- <View
957
- as="div"
958
- height="7rem"
959
- width="20rem"
960
- margin="medium none x-large"
961
- overflowY={overflowY}
962
- overflowX={overflowX}
963
- withVisualDebug
674
+ <RadioInput label="visible" value="visible" />
675
+ <RadioInput label="auto" value="auto" />
676
+ <RadioInput label="hidden" value="hidden" />
677
+ </RadioInputGroup>
678
+ <RadioInputGroup
679
+ onChange={updateOverflowX}
680
+ name="overflowX"
681
+ defaultValue="visible"
682
+ variant="toggle"
683
+ description="overflowX ="
964
684
  >
965
- <div style={{ width: '30rem', height: '10rem' }}>
966
- <Img src={avatarSquare} constrain="cover" />
967
- </div>
968
- </View>
685
+ <RadioInput label="visible" value="visible" />
686
+ <RadioInput label="auto" value="auto" />
687
+ <RadioInput label="hidden" value="hidden" />
688
+ </RadioInputGroup>
689
+ </FormFieldGroup>
690
+ <View
691
+ as="div"
692
+ height="7rem"
693
+ width="20rem"
694
+ margin="medium none x-large"
695
+ overflowY={overflowY}
696
+ overflowX={overflowX}
697
+ withVisualDebug
698
+ >
699
+ <div style={{ width: '30rem', height: '10rem' }}>
700
+ <Img src={avatarSquare} constrain="cover" />
701
+ </div>
969
702
  </View>
970
- )
971
- }
703
+ </View>
704
+ )
705
+ }
972
706
 
973
- render(<OverflowExample />)
974
- ```
707
+ render(<OverflowExample />)
708
+ ```
975
709
 
976
710
  ### Debugging
977
711