@instructure/ui-toggle-details 10.2.3-snapshot-3 → 10.2.3-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.3-snapshot-3](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-3) (2024-09-20)
6
+ ## [10.2.3-snapshot-5](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-5) (2024-09-24)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-toggle-details
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-toggle-details",
3
- "version": "10.2.3-snapshot-3",
3
+ "version": "10.2.3-snapshot-5",
4
4
  "description": "A styled toggleable, accordion-like component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,28 +23,28 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-babel-preset": "10.2.3-snapshot-3",
27
- "@instructure/ui-test-locator": "10.2.3-snapshot-3",
28
- "@instructure/ui-test-queries": "10.2.3-snapshot-3",
29
- "@instructure/ui-test-utils": "10.2.3-snapshot-3",
30
- "@instructure/ui-themes": "10.2.3-snapshot-3"
26
+ "@instructure/ui-babel-preset": "10.2.3-snapshot-5",
27
+ "@instructure/ui-test-locator": "10.2.3-snapshot-5",
28
+ "@instructure/ui-test-queries": "10.2.3-snapshot-5",
29
+ "@instructure/ui-test-utils": "10.2.3-snapshot-5",
30
+ "@instructure/ui-themes": "10.2.3-snapshot-5"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.24.5",
34
- "@instructure/emotion": "10.2.3-snapshot-3",
35
- "@instructure/shared-types": "10.2.3-snapshot-3",
36
- "@instructure/ui-buttons": "10.2.3-snapshot-3",
37
- "@instructure/ui-dom-utils": "10.2.3-snapshot-3",
38
- "@instructure/ui-expandable": "10.2.3-snapshot-3",
39
- "@instructure/ui-flex": "10.2.3-snapshot-3",
40
- "@instructure/ui-icons": "10.2.3-snapshot-3",
41
- "@instructure/ui-motion": "10.2.3-snapshot-3",
42
- "@instructure/ui-prop-types": "10.2.3-snapshot-3",
43
- "@instructure/ui-react-utils": "10.2.3-snapshot-3",
44
- "@instructure/ui-testable": "10.2.3-snapshot-3",
45
- "@instructure/ui-utils": "10.2.3-snapshot-3",
46
- "@instructure/ui-view": "10.2.3-snapshot-3",
47
- "@instructure/uid": "10.2.3-snapshot-3",
34
+ "@instructure/emotion": "10.2.3-snapshot-5",
35
+ "@instructure/shared-types": "10.2.3-snapshot-5",
36
+ "@instructure/ui-buttons": "10.2.3-snapshot-5",
37
+ "@instructure/ui-dom-utils": "10.2.3-snapshot-5",
38
+ "@instructure/ui-expandable": "10.2.3-snapshot-5",
39
+ "@instructure/ui-flex": "10.2.3-snapshot-5",
40
+ "@instructure/ui-icons": "10.2.3-snapshot-5",
41
+ "@instructure/ui-motion": "10.2.3-snapshot-5",
42
+ "@instructure/ui-prop-types": "10.2.3-snapshot-5",
43
+ "@instructure/ui-react-utils": "10.2.3-snapshot-5",
44
+ "@instructure/ui-testable": "10.2.3-snapshot-5",
45
+ "@instructure/ui-utils": "10.2.3-snapshot-5",
46
+ "@instructure/ui-view": "10.2.3-snapshot-5",
47
+ "@instructure/uid": "10.2.3-snapshot-5",
48
48
  "prop-types": "^15.8.1"
49
49
  },
50
50
  "peerDependencies": {
@@ -20,42 +20,73 @@ type: example
20
20
 
21
21
  ToggleDetails can be controlled:
22
22
 
23
- ```js
24
- ---
25
- type: example
26
- ---
23
+ - ```js
24
+ class Example extends React.Component {
25
+ state = {
26
+ expanded: true
27
+ }
28
+
29
+ handleChange = (event, expanded) => this.setState({ expanded })
30
+
31
+ handleToggle = () => this.setState({ expanded: !this.state.expanded })
32
+
33
+ render() {
34
+ return (
35
+ <div>
36
+ <Button onClick={this.handleToggle}>
37
+ This Button {this.state.expanded ? 'Collapses' : 'Expands'}
38
+ </Button>
39
+ <br />
40
+ <br />
41
+ <ToggleDetails
42
+ summary="Click to hide me!"
43
+ expanded={this.state.expanded}
44
+ onToggle={this.handleChange}
45
+ >
46
+ <Text weight="bold">I am controlled and expanded!</Text>{' '}
47
+ {lorem.paragraph()}
48
+ </ToggleDetails>
49
+ </div>
50
+ )
51
+ }
52
+ }
27
53
 
28
- class Example extends React.Component {
29
- state = {
30
- expanded: true
31
- };
54
+ render(<Example />)
55
+ ```
56
+
57
+ - ```js
58
+ const Example = () => {
59
+ const [expanded, setExpanded] = useState(true)
32
60
 
33
- handleChange = (event, expanded) => this.setState({ expanded });
61
+ const handleChange = (event, expanded) => {
62
+ setExpanded(expanded)
63
+ }
34
64
 
35
- handleToggle = () => this.setState({ expanded: !this.state.expanded });
65
+ const handleToggle = () => {
66
+ setExpanded((prevExpanded) => !prevExpanded)
67
+ }
36
68
 
37
- render () {
38
69
  return (
39
70
  <div>
40
- <Button onClick={this.handleToggle}>
41
- This Button {this.state.expanded ? 'Collapses' : 'Expands'}
71
+ <Button onClick={handleToggle}>
72
+ This Button {expanded ? 'Collapses' : 'Expands'}
42
73
  </Button>
43
74
  <br />
44
75
  <br />
45
76
  <ToggleDetails
46
77
  summary="Click to hide me!"
47
- expanded={this.state.expanded}
48
- onToggle={this.handleChange}
78
+ expanded={expanded}
79
+ onToggle={handleChange}
49
80
  >
50
- <Text weight="bold">I am controlled and expanded!</Text> {lorem.paragraph()}
81
+ <Text weight="bold">I am controlled and expanded!</Text>
82
+ {lorem.paragraph()}
51
83
  </ToggleDetails>
52
84
  </div>
53
- )
85
+ )
54
86
  }
55
- }
56
87
 
57
- render(<Example />)
58
- ```
88
+ render(<Example />)
89
+ ```
59
90
 
60
91
  Setting ToggleDetails to `filled` will make the toggle use a full-width [Button](#Button) component.
61
92