@instructure/ui-view 10.2.2-snapshot-2 → 10.2.2-snapshot-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/CHANGELOG.md CHANGED
@@ -3,7 +3,7 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
- ## [10.2.2-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.2.1...v10.2.2-snapshot-2) (2024-09-03)
6
+ ## [10.2.2-snapshot-5](https://github.com/instructure/instructure-ui/compare/v10.2.1...v10.2.2-snapshot-5) (2024-09-10)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-view
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-view",
3
- "version": "10.2.2-snapshot-2",
3
+ "version": "10.2.2-snapshot-5",
4
4
  "description": "A component for basic styles including spacing, sizing, borders, display, positioning, and focus states.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -24,22 +24,22 @@
24
24
  "license": "MIT",
25
25
  "dependencies": {
26
26
  "@babel/runtime": "^7.24.5",
27
- "@instructure/console": "10.2.2-snapshot-2",
28
- "@instructure/emotion": "10.2.2-snapshot-2",
29
- "@instructure/shared-types": "10.2.2-snapshot-2",
30
- "@instructure/ui-color-utils": "10.2.2-snapshot-2",
31
- "@instructure/ui-dom-utils": "10.2.2-snapshot-2",
32
- "@instructure/ui-i18n": "10.2.2-snapshot-2",
33
- "@instructure/ui-position": "10.2.2-snapshot-2",
34
- "@instructure/ui-prop-types": "10.2.2-snapshot-2",
35
- "@instructure/ui-react-utils": "10.2.2-snapshot-2",
27
+ "@instructure/console": "10.2.2-snapshot-5",
28
+ "@instructure/emotion": "10.2.2-snapshot-5",
29
+ "@instructure/shared-types": "10.2.2-snapshot-5",
30
+ "@instructure/ui-color-utils": "10.2.2-snapshot-5",
31
+ "@instructure/ui-dom-utils": "10.2.2-snapshot-5",
32
+ "@instructure/ui-i18n": "10.2.2-snapshot-5",
33
+ "@instructure/ui-position": "10.2.2-snapshot-5",
34
+ "@instructure/ui-prop-types": "10.2.2-snapshot-5",
35
+ "@instructure/ui-react-utils": "10.2.2-snapshot-5",
36
36
  "prop-types": "^15.8.1"
37
37
  },
38
38
  "devDependencies": {
39
- "@instructure/ui-axe-check": "10.2.2-snapshot-2",
40
- "@instructure/ui-babel-preset": "10.2.2-snapshot-2",
41
- "@instructure/ui-test-utils": "10.2.2-snapshot-2",
42
- "@instructure/ui-themes": "10.2.2-snapshot-2",
39
+ "@instructure/ui-axe-check": "10.2.2-snapshot-5",
40
+ "@instructure/ui-babel-preset": "10.2.2-snapshot-5",
41
+ "@instructure/ui-test-utils": "10.2.2-snapshot-5",
42
+ "@instructure/ui-themes": "10.2.2-snapshot-5",
43
43
  "@testing-library/jest-dom": "^6.4.6",
44
44
  "@testing-library/react": "^15.0.7",
45
45
  "vitest": "^2.0.2"
@@ -458,47 +458,210 @@ The focus outline adjusts to account for the shape of the View. For example, the
458
458
  to match the border radius of the corresponding View. For Views with irregular border radius (e.g., `borderRadius="small large none medium"`), the focus outline will appear with square edges. The color of the focus outline can be
459
459
  changed for different contexts via the `focusColor` property.
460
460
 
461
- ```javascript
462
- ---
463
- type: example
464
- ---
465
- class FocusedExample extends React.Component {
466
- constructor (props) {
467
- super(props)
461
+ - ```javascript
462
+ class FocusedExample extends React.Component {
463
+ constructor(props) {
464
+ super(props)
468
465
 
469
- this.state = {
470
- isFocused: true,
471
- inset: false
466
+ this.state = {
467
+ isFocused: true,
468
+ inset: false
469
+ }
472
470
  }
473
- }
474
471
 
475
- updateFocused = (event) => {
476
- this.setState({isFocused: event.target.checked})
477
- }
472
+ updateFocused = (event) => {
473
+ this.setState({ isFocused: event.target.checked })
474
+ }
475
+
476
+ updateInset = (event) => {
477
+ this.setState({ inset: event.target.checked })
478
+ }
478
479
 
479
- updateInset = (event) => {
480
- this.setState({inset: event.target.checked})
480
+ render() {
481
+ return (
482
+ <View as="div">
483
+ <View
484
+ as="div"
485
+ background="primary"
486
+ padding="small"
487
+ margin="0 0 small"
488
+ borderWidth="small"
489
+ >
490
+ <FormFieldGroup
491
+ rowSpacing="small"
492
+ description={
493
+ <ScreenReaderContent>
494
+ View focus outline examples
495
+ </ScreenReaderContent>
496
+ }
497
+ >
498
+ <Checkbox
499
+ label="withFocusOutline"
500
+ checked={this.state.isFocused}
501
+ onChange={this.updateFocused}
502
+ />
503
+ <Checkbox
504
+ label="focusPosition = inset"
505
+ checked={this.state.inset}
506
+ onChange={this.updateInset}
507
+ />
508
+ </FormFieldGroup>
509
+ </View>
510
+ <View as="div">
511
+ <code>borderRadius =</code>
512
+ <View
513
+ display="inline-block"
514
+ margin="small"
515
+ padding="small"
516
+ background="primary"
517
+ borderRadius="small"
518
+ borderWidth="small"
519
+ position="relative"
520
+ withFocusOutline={this.state.isFocused}
521
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
522
+ >
523
+ small
524
+ </View>
525
+ <View
526
+ display="inline-block"
527
+ margin="small"
528
+ padding="small"
529
+ background="primary"
530
+ borderRadius="medium"
531
+ borderWidth="small"
532
+ position="relative"
533
+ withFocusOutline={this.state.isFocused}
534
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
535
+ >
536
+ medium
537
+ </View>
538
+ <View
539
+ display="inline-block"
540
+ margin="small"
541
+ padding="small"
542
+ background="primary"
543
+ borderRadius="large"
544
+ borderWidth="small"
545
+ position="relative"
546
+ withFocusOutline={this.state.isFocused}
547
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
548
+ >
549
+ large
550
+ </View>
551
+ <View
552
+ display="inline-block"
553
+ height="100px"
554
+ width="100px"
555
+ margin="small"
556
+ background="primary"
557
+ borderRadius="circle"
558
+ borderWidth="small"
559
+ position="relative"
560
+ withFocusOutline={this.state.isFocused}
561
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
562
+ >
563
+ <Flex
564
+ width="100%"
565
+ height="100%"
566
+ alignItems="center"
567
+ justifyItems="center"
568
+ >
569
+ <Flex.Item>circle</Flex.Item>
570
+ </Flex>
571
+ </View>
572
+ <View
573
+ background="primary-inverse"
574
+ display="inline-block"
575
+ padding="small"
576
+ >
577
+ <View
578
+ display="block"
579
+ margin="small"
580
+ padding="small"
581
+ background="primary-inverse"
582
+ borderRadius="large"
583
+ borderWidth="small"
584
+ position="relative"
585
+ withFocusOutline={this.state.isFocused}
586
+ focusColor="inverse"
587
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
588
+ >
589
+ medium
590
+ </View>
591
+ </View>
592
+ <View
593
+ display="inline-block"
594
+ margin="small"
595
+ padding="small"
596
+ background="primary"
597
+ borderRadius="pill"
598
+ borderWidth="small"
599
+ position="relative"
600
+ focusColor="success"
601
+ width="100px"
602
+ textAlign="center"
603
+ withFocusOutline={this.state.isFocused}
604
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
605
+ >
606
+ pill
607
+ </View>
608
+ <View
609
+ display="inline-block"
610
+ margin="small"
611
+ padding="small"
612
+ background="primary"
613
+ borderWidth="small"
614
+ borderRadius="none large"
615
+ focusColor="danger"
616
+ position="relative"
617
+ withFocusOutline={this.state.isFocused}
618
+ focusPosition={this.state.inset ? 'inset' : 'offset'}
619
+ >
620
+ none large
621
+ </View>
622
+ </View>
623
+ </View>
624
+ )
625
+ }
481
626
  }
482
627
 
483
- render () {
484
- const { isFocused, focusPosition } = this.state
628
+ render(<FocusedExample />)
629
+ ```
630
+
631
+ - ```javascript
632
+ const FocusedExample = () => {
633
+ const [isFocused, setIsFocused] = useState(true)
634
+ const [inset, setInset] = useState(false)
635
+
636
+ const updateFocused = (event) => setIsFocused(event.target.checked)
637
+ const updateInset = (event) => setInset(event.target.checked)
485
638
 
486
639
  return (
487
640
  <View as="div">
488
- <View as="div" background="primary" padding="small" margin="0 0 small" borderWidth="small">
641
+ <View
642
+ as="div"
643
+ background="primary"
644
+ padding="small"
645
+ margin="0 0 small"
646
+ borderWidth="small"
647
+ >
489
648
  <FormFieldGroup
490
649
  rowSpacing="small"
491
- description={<ScreenReaderContent>View focus outline examples</ScreenReaderContent>}
650
+ description={
651
+ <ScreenReaderContent>
652
+ View focus outline examples
653
+ </ScreenReaderContent>
654
+ }
492
655
  >
493
656
  <Checkbox
494
657
  label="withFocusOutline"
495
- checked={this.state.isFocused}
496
- onChange={this.updateFocused}
658
+ checked={isFocused}
659
+ onChange={updateFocused}
497
660
  />
498
661
  <Checkbox
499
662
  label="focusPosition = inset"
500
- checked={this.state.inset}
501
- onChange={this.updateInset}
663
+ checked={inset}
664
+ onChange={updateInset}
502
665
  />
503
666
  </FormFieldGroup>
504
667
  </View>
@@ -512,8 +675,8 @@ class FocusedExample extends React.Component {
512
675
  borderRadius="small"
513
676
  borderWidth="small"
514
677
  position="relative"
515
- withFocusOutline={this.state.isFocused}
516
- focusPosition={this.state.inset ? 'inset' : 'offset'}
678
+ withFocusOutline={isFocused}
679
+ focusPosition={inset ? 'inset' : 'offset'}
517
680
  >
518
681
  small
519
682
  </View>
@@ -525,8 +688,8 @@ class FocusedExample extends React.Component {
525
688
  borderRadius="medium"
526
689
  borderWidth="small"
527
690
  position="relative"
528
- withFocusOutline={this.state.isFocused}
529
- focusPosition={this.state.inset ? 'inset' : 'offset'}
691
+ withFocusOutline={isFocused}
692
+ focusPosition={inset ? 'inset' : 'offset'}
530
693
  >
531
694
  medium
532
695
  </View>
@@ -538,8 +701,8 @@ class FocusedExample extends React.Component {
538
701
  borderRadius="large"
539
702
  borderWidth="small"
540
703
  position="relative"
541
- withFocusOutline={this.state.isFocused}
542
- focusPosition={this.state.inset ? 'inset' : 'offset'}
704
+ withFocusOutline={isFocused}
705
+ focusPosition={inset ? 'inset' : 'offset'}
543
706
  >
544
707
  large
545
708
  </View>
@@ -552,8 +715,8 @@ class FocusedExample extends React.Component {
552
715
  borderRadius="circle"
553
716
  borderWidth="small"
554
717
  position="relative"
555
- withFocusOutline={this.state.isFocused}
556
- focusPosition={this.state.inset ? 'inset' : 'offset'}
718
+ withFocusOutline={isFocused}
719
+ focusPosition={inset ? 'inset' : 'offset'}
557
720
  >
558
721
  <Flex
559
722
  width="100%"
@@ -561,12 +724,14 @@ class FocusedExample extends React.Component {
561
724
  alignItems="center"
562
725
  justifyItems="center"
563
726
  >
564
- <Flex.Item>
565
- circle
566
- </Flex.Item>
727
+ <Flex.Item>circle</Flex.Item>
567
728
  </Flex>
568
729
  </View>
569
- <View background="primary-inverse" display="inline-block" padding="small">
730
+ <View
731
+ background="primary-inverse"
732
+ display="inline-block"
733
+ padding="small"
734
+ >
570
735
  <View
571
736
  display="block"
572
737
  margin="small"
@@ -575,9 +740,9 @@ class FocusedExample extends React.Component {
575
740
  borderRadius="large"
576
741
  borderWidth="small"
577
742
  position="relative"
578
- withFocusOutline={this.state.isFocused}
743
+ withFocusOutline={isFocused}
579
744
  focusColor="inverse"
580
- focusPosition={this.state.inset ? 'inset' : 'offset'}
745
+ focusPosition={inset ? 'inset' : 'offset'}
581
746
  >
582
747
  medium
583
748
  </View>
@@ -593,8 +758,8 @@ class FocusedExample extends React.Component {
593
758
  focusColor="success"
594
759
  width="100px"
595
760
  textAlign="center"
596
- withFocusOutline={this.state.isFocused}
597
- focusPosition={this.state.inset ? 'inset' : 'offset'}
761
+ withFocusOutline={isFocused}
762
+ focusPosition={inset ? 'inset' : 'offset'}
598
763
  >
599
764
  pill
600
765
  </View>
@@ -607,8 +772,8 @@ class FocusedExample extends React.Component {
607
772
  borderRadius="none large"
608
773
  focusColor="danger"
609
774
  position="relative"
610
- withFocusOutline={this.state.isFocused}
611
- focusPosition={this.state.inset ? 'inset' : 'offset'}
775
+ withFocusOutline={isFocused}
776
+ focusPosition={inset ? 'inset' : 'offset'}
612
777
  >
613
778
  none large
614
779
  </View>
@@ -616,52 +781,118 @@ class FocusedExample extends React.Component {
616
781
  </View>
617
782
  )
618
783
  }
619
- }
620
784
 
621
- render(<FocusedExample />)
622
- ```
785
+ render(<FocusedExample />)
786
+ ```
623
787
 
624
788
  Handle vertical and horizontal content overflow with the `overflowX` and `overflowY`
625
789
  props.
626
790
 
627
791
  > **Important CSS note:** Setting one axis to `visible` and setting the other to a different value results in `visible` behaving as `auto`.
628
792
 
629
- ```javascript
630
- ---
631
- type: example
632
- ---
633
- class OverflowExample extends React.Component {
634
- constructor (props) {
635
- super(props)
793
+ - ```javascript
794
+ class OverflowExample extends React.Component {
795
+ constructor(props) {
796
+ super(props)
636
797
 
637
- this.state = {
638
- overflowY: 'visible'
798
+ this.state = {
799
+ overflowY: 'visible',
800
+ overflowX: 'visible'
801
+ }
639
802
  }
640
- }
641
803
 
642
- updateOverflowY = (event, value) => {
643
- this.setState({
644
- overflowY: value
645
- })
646
- }
804
+ updateOverflowY = (event, value) => {
805
+ this.setState({
806
+ overflowY: value
807
+ })
808
+ }
647
809
 
648
- updateOverflowX = (event, value) => {
649
- this.setState({
650
- overflowX: value
651
- })
810
+ updateOverflowX = (event, value) => {
811
+ this.setState({
812
+ overflowX: value
813
+ })
814
+ }
815
+
816
+ render() {
817
+ return (
818
+ <View as="div">
819
+ <FormFieldGroup
820
+ description={
821
+ <ScreenReaderContent>Overflow example</ScreenReaderContent>
822
+ }
823
+ rowSpacing="small"
824
+ vAlign="top"
825
+ layout="columns"
826
+ >
827
+ <RadioInputGroup
828
+ onChange={this.updateOverflowY}
829
+ name="overflowY"
830
+ defaultValue="visible"
831
+ variant="toggle"
832
+ description="overflowY ="
833
+ >
834
+ <RadioInput label="visible" value="visible" />
835
+ <RadioInput label="auto" value="auto" />
836
+ <RadioInput label="hidden" value="hidden" />
837
+ </RadioInputGroup>
838
+ <RadioInputGroup
839
+ onChange={this.updateOverflowX}
840
+ name="overflowX"
841
+ defaultValue="visible"
842
+ variant="toggle"
843
+ description="overflowX ="
844
+ >
845
+ <RadioInput label="visible" value="visible" />
846
+ <RadioInput label="auto" value="auto" />
847
+ <RadioInput label="hidden" value="hidden" />
848
+ </RadioInputGroup>
849
+ </FormFieldGroup>
850
+ <View
851
+ as="div"
852
+ height="7rem"
853
+ width="20rem"
854
+ margin="medium none x-large"
855
+ overflowY={this.state.overflowY}
856
+ overflowX={this.state.overflowX}
857
+ withVisualDebug
858
+ >
859
+ <div style={{ width: '30rem', height: '10rem' }}>
860
+ <Img src={avatarSquare} constrain="cover" />
861
+ </div>
862
+ </View>
863
+ </View>
864
+ )
865
+ }
652
866
  }
653
867
 
654
- render () {
868
+ render(<OverflowExample />)
869
+ ```
870
+
871
+ - ```javascript
872
+ const OverflowExample = () => {
873
+ const [overflowY, setOverflowY] = useState('visible')
874
+ const [overflowX, setOverflowX] = useState('visible')
875
+
876
+ const updateOverflowY = (event, value) => {
877
+ setOverflowY(value)
878
+ }
879
+
880
+ const updateOverflowX = (event, value) => {
881
+ setOverflowX(value)
882
+ }
883
+
655
884
  return (
656
885
  <View as="div">
657
886
  <FormFieldGroup
658
- description={<ScreenReaderContent>Overflow example</ScreenReaderContent>}
887
+ description={
888
+ <ScreenReaderContent>Overflow example</ScreenReaderContent>
889
+ }
659
890
  rowSpacing="small"
660
891
  vAlign="top"
661
892
  layout="columns"
662
893
  >
663
894
  <RadioInputGroup
664
- onChange={this.updateOverflowY}
895
+ onChange={updateOverflowY}
665
896
  name="overflowY"
666
897
  defaultValue="visible"
667
898
  variant="toggle"
@@ -672,7 +903,7 @@ class OverflowExample extends React.Component {
672
903
  <RadioInput label="hidden" value="hidden" />
673
904
  </RadioInputGroup>
674
905
  <RadioInputGroup
675
- onChange={this.updateOverflowX}
906
+ onChange={updateOverflowX}
676
907
  name="overflowX"
677
908
  defaultValue="visible"
678
909
  variant="toggle"
@@ -688,22 +919,20 @@ class OverflowExample extends React.Component {
688
919
  height="7rem"
689
920
  width="20rem"
690
921
  margin="medium none x-large"
691
- overflowY={this.state.overflowY}
692
- overflowX={this.state.overflowX}
922
+ overflowY={overflowY}
923
+ overflowX={overflowX}
693
924
  withVisualDebug
694
925
  >
695
- <div style={{width: '30rem', height: '10rem'}}>
926
+ <div style={{ width: '30rem', height: '10rem' }}>
696
927
  <Img src={avatarSquare} constrain="cover" />
697
928
  </div>
698
-
699
929
  </View>
700
930
  </View>
701
931
  )
702
932
  }
703
- }
704
933
 
705
- render(<OverflowExample />)
706
- ```
934
+ render(<OverflowExample />)
935
+ ```
707
936
 
708
937
  ### Debugging
709
938