@instructure/ui-buttons 8.50.1-snapshot-1 → 8.50.1-snapshot-13

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
- ## [8.50.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v8.50.0...v8.50.1-snapshot-1) (2023-12-06)
6
+ ## [8.50.1-snapshot-13](https://github.com/instructure/instructure-ui/compare/v8.50.0...v8.50.1-snapshot-13) (2023-12-07)
7
7
 
8
8
  **Note:** Version bump only for package @instructure/ui-buttons
9
9
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "8.50.1-snapshot-1",
3
+ "version": "8.50.1-snapshot-13",
4
4
  "description": "Accessible button components",
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": "8.50.1-snapshot-1",
27
- "@instructure/ui-test-locator": "8.50.1-snapshot-1",
28
- "@instructure/ui-test-queries": "8.50.1-snapshot-1",
29
- "@instructure/ui-test-utils": "8.50.1-snapshot-1",
30
- "@instructure/ui-themes": "8.50.1-snapshot-1"
26
+ "@instructure/ui-babel-preset": "8.50.1-snapshot-13",
27
+ "@instructure/ui-test-locator": "8.50.1-snapshot-13",
28
+ "@instructure/ui-test-queries": "8.50.1-snapshot-13",
29
+ "@instructure/ui-test-utils": "8.50.1-snapshot-13",
30
+ "@instructure/ui-themes": "8.50.1-snapshot-13"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.23.2",
34
- "@instructure/console": "8.50.1-snapshot-1",
35
- "@instructure/emotion": "8.50.1-snapshot-1",
36
- "@instructure/shared-types": "8.50.1-snapshot-1",
37
- "@instructure/ui-a11y-content": "8.50.1-snapshot-1",
38
- "@instructure/ui-a11y-utils": "8.50.1-snapshot-1",
39
- "@instructure/ui-color-utils": "8.50.1-snapshot-1",
40
- "@instructure/ui-dom-utils": "8.50.1-snapshot-1",
41
- "@instructure/ui-icons": "8.50.1-snapshot-1",
42
- "@instructure/ui-position": "8.50.1-snapshot-1",
43
- "@instructure/ui-react-utils": "8.50.1-snapshot-1",
44
- "@instructure/ui-testable": "8.50.1-snapshot-1",
45
- "@instructure/ui-tooltip": "8.50.1-snapshot-1",
46
- "@instructure/ui-utils": "8.50.1-snapshot-1",
47
- "@instructure/ui-view": "8.50.1-snapshot-1",
34
+ "@instructure/console": "8.50.1-snapshot-13",
35
+ "@instructure/emotion": "8.50.1-snapshot-13",
36
+ "@instructure/shared-types": "8.50.1-snapshot-13",
37
+ "@instructure/ui-a11y-content": "8.50.1-snapshot-13",
38
+ "@instructure/ui-a11y-utils": "8.50.1-snapshot-13",
39
+ "@instructure/ui-color-utils": "8.50.1-snapshot-13",
40
+ "@instructure/ui-dom-utils": "8.50.1-snapshot-13",
41
+ "@instructure/ui-icons": "8.50.1-snapshot-13",
42
+ "@instructure/ui-position": "8.50.1-snapshot-13",
43
+ "@instructure/ui-react-utils": "8.50.1-snapshot-13",
44
+ "@instructure/ui-testable": "8.50.1-snapshot-13",
45
+ "@instructure/ui-tooltip": "8.50.1-snapshot-13",
46
+ "@instructure/ui-utils": "8.50.1-snapshot-13",
47
+ "@instructure/ui-view": "8.50.1-snapshot-13",
48
48
  "keycode": "^2.2.1",
49
49
  "prop-types": "^15.8.1"
50
50
  },
@@ -7,7 +7,7 @@ Use [Button](#Button), [IconButton](#IconButton), or [CondensedButton](#Condense
7
7
 
8
8
  ```js
9
9
  ---
10
- example: true
10
+ type: example
11
11
  ---
12
12
  <View display="block" margin="medium">
13
13
  <BaseButton>Click me</BaseButton>
@@ -6,7 +6,7 @@ Button allows users to perform actions or trigger changes. If selecting the Butt
6
6
 
7
7
  ```js
8
8
  ---
9
- example: true
9
+ type: example
10
10
  ---
11
11
  <Button>Hello{null}</Button>
12
12
  ```
@@ -17,7 +17,7 @@ The `color` prop will change the Button's color scheme.
17
17
 
18
18
  ```js
19
19
  ---
20
- example: true
20
+ type: example
21
21
  ---
22
22
  <View display="block">
23
23
  <Button color="primary" margin="small">Primary</Button>
@@ -34,7 +34,7 @@ To specify the Button `size`, set the size prop to `small`, `medium` (default) o
34
34
 
35
35
  ```js
36
36
  ---
37
- example: true
37
+ type: example
38
38
  ---
39
39
  <View display="block">
40
40
  <Button size="small" margin="small">Small</Button>
@@ -49,7 +49,7 @@ An icon can be rendered alongside the Button content using the `renderIcon` prop
49
49
 
50
50
  ```js
51
51
  ---
52
- example: true
52
+ type: example
53
53
  ---
54
54
  <Button renderIcon={IconAddLine}>Add Item</Button>
55
55
  ```
@@ -60,7 +60,7 @@ Just like native HTML buttons, the Button text will wrap to the next line when i
60
60
 
61
61
  ```js
62
62
  ---
63
- example: true
63
+ type: example
64
64
  ---
65
65
  <View
66
66
  display="block"
@@ -77,33 +77,73 @@ example: true
77
77
 
78
78
  If you need to prevent text wrapping, you can use the [TruncateText](#TruncateText) util. You can also conditionally render a [Tooltip](#Tooltip) with the full text when truncation occurs.
79
79
 
80
- ```js
81
- ---
82
- example: true
83
- render: false
84
- ---
85
- class Example extends React.Component {
86
- state = {
87
- isTruncated: false
88
- }
80
+ - ```js
81
+ class Example extends React.Component {
82
+ state = {
83
+ isTruncated: false
84
+ }
89
85
 
90
- handleUpdate = (isTruncated) => {
91
- if (this.state.isTruncated !== isTruncated) {
92
- this.setState({ isTruncated })
86
+ handleUpdate = (isTruncated) => {
87
+ if (this.state.isTruncated !== isTruncated) {
88
+ this.setState({ isTruncated })
89
+ }
93
90
  }
94
- }
95
91
 
96
- renderButton () {
97
- return (
98
- <Button color="primary">
99
- <TruncateText onUpdate={this.handleUpdate}>
100
- {this.props.message}
101
- </TruncateText>
102
- </Button>
103
- )
92
+ renderButton() {
93
+ return (
94
+ <Button color="primary">
95
+ <TruncateText onUpdate={this.handleUpdate}>
96
+ {this.props.message}
97
+ </TruncateText>
98
+ </Button>
99
+ )
100
+ }
101
+
102
+ render() {
103
+ return (
104
+ <View
105
+ display="block"
106
+ width="10rem"
107
+ margin="small"
108
+ padding="small none"
109
+ withVisualDebug
110
+ >
111
+ {this.state.isTruncated ? (
112
+ <Tooltip
113
+ renderTip={this.props.message}
114
+ mountNode={() => document.getElementById('main')}
115
+ >
116
+ {this.renderButton()}
117
+ </Tooltip>
118
+ ) : (
119
+ this.renderButton()
120
+ )}
121
+ </View>
122
+ )
123
+ }
104
124
  }
105
125
 
106
- render () {
126
+ render(<Example message="A Button With a Whole Lot of Text" />)
127
+ ```
128
+
129
+ - ```js
130
+ const Example = ({ message }) => {
131
+ const [isTruncated, setIsTruncated] = useState(false)
132
+
133
+ const handleUpdate = (shouldBeTruncated) => {
134
+ if (isTruncated !== shouldBeTruncated) {
135
+ setIsTruncated(shouldBeTruncated)
136
+ }
137
+ }
138
+
139
+ const renderButton = () => {
140
+ return (
141
+ <Button color="primary">
142
+ <TruncateText onUpdate={handleUpdate}>{message}</TruncateText>
143
+ </Button>
144
+ )
145
+ }
146
+
107
147
  return (
108
148
  <View
109
149
  display="block"
@@ -112,21 +152,22 @@ class Example extends React.Component {
112
152
  padding="small none"
113
153
  withVisualDebug
114
154
  >
115
- {this.state.isTruncated ? (
155
+ {isTruncated ? (
116
156
  <Tooltip
117
- renderTip={this.props.message}
157
+ renderTip={message}
118
158
  mountNode={() => document.getElementById('main')}
119
159
  >
120
- { this.renderButton() }
160
+ {renderButton()}
121
161
  </Tooltip>
122
- ) : this.renderButton()}
162
+ ) : (
163
+ renderButton()
164
+ )}
123
165
  </View>
124
166
  )
125
167
  }
126
- }
127
168
 
128
- render(<Example message="A Button With a Whole Lot of Text" />)
129
- ```
169
+ render(<Example message="A Button With a Whole Lot of Text" />)
170
+ ```
130
171
 
131
172
  ### Display
132
173
 
@@ -134,7 +175,7 @@ By default, the Button displays inline with other elements. If you need it to ex
134
175
 
135
176
  ```js
136
177
  ---
137
- example: true
178
+ type: example
138
179
  ---
139
180
  <View
140
181
  display="block"
@@ -160,7 +201,7 @@ Use backgroundless buttons for interfaces on dark backgrounds or when there is a
160
201
 
161
202
  ```js
162
203
  ---
163
- example: true
204
+ type: example
164
205
  ---
165
206
  <View display="block">
166
207
  <View display="inline-block" background="primary">
@@ -176,7 +217,7 @@ example: true
176
217
 
177
218
  ```js
178
219
  ---
179
- guidelines: true
220
+ type: embed
180
221
  ---
181
222
  <Guidelines>
182
223
  <Figure recommendation="yes" title="Do">
@@ -199,7 +240,7 @@ guidelines: true
199
240
 
200
241
  ```js
201
242
  ---
202
- guidelines: true
243
+ type: embed
203
244
  ---
204
245
  <Guidelines>
205
246
  <Figure recommendation="a11y" title="Accessibility">
@@ -8,7 +8,7 @@ The `placement` prop designates the `CloseButton` placement within the parent co
8
8
 
9
9
  ```js
10
10
  ---
11
- example: true
11
+ type: example
12
12
  ---
13
13
  <View display="block" position="relative" height="5rem" background="primary" shadow="resting">
14
14
  <CloseButton placement="end" offset="small" screenReaderLabel="Close" />
@@ -19,7 +19,7 @@ If you need the `CloseButton` to work in a layout with other elements vs. absolu
19
19
 
20
20
  ```js
21
21
  ---
22
- example: true
22
+ type: example
23
23
  ---
24
24
  <View display="block" position="relative" background="primary" shadow="resting">
25
25
  <Flex height="6rem" justifyItems="space-between" alignItems="center" padding="medium">
@@ -37,7 +37,7 @@ If you need even more customization, note that you can always compose this compo
37
37
 
38
38
  ```js
39
39
  ---
40
- example: true
40
+ type: example
41
41
  ---
42
42
  <View display="block" position="relative" height="5rem" background="primary" shadow="resting">
43
43
  <Flex justifyItems="end">
@@ -59,7 +59,7 @@ example: true
59
59
 
60
60
  ```js
61
61
  ---
62
- guidelines: true
62
+ type: embed
63
63
  ---
64
64
  <Guidelines>
65
65
  <Figure recommendation="a11y" title="Accessibility">
@@ -6,7 +6,7 @@ CondensedButton is a button component that renders without padding. It is meant
6
6
 
7
7
  ```js
8
8
  ---
9
- example: true
9
+ type: example
10
10
  ---
11
11
  <View display="block" background="primary" padding="small">
12
12
  <CondensedButton>Click Me</CondensedButton>
@@ -17,7 +17,7 @@ In the following example, CondensedButton is used so that the button content can
17
17
 
18
18
  ```js
19
19
  ---
20
- example: true
20
+ type: example
21
21
  ---
22
22
  <Table caption='Tallest Roller Coasters'>
23
23
  <Table.Head>
@@ -6,7 +6,7 @@ An IconButton can be used when the Button only renders an Icon and does not have
6
6
 
7
7
  ```js
8
8
  ---
9
- example: true
9
+ type: example
10
10
  ---
11
11
  <IconButton screenReaderLabel="Add User"><IconAddLine /></IconButton>
12
12
  ```
@@ -17,7 +17,7 @@ Because the IconButton visually only renders an icon, a description is necessary
17
17
 
18
18
  ```js
19
19
  ---
20
- example: true
20
+ type: example
21
21
  ---
22
22
  <IconButton color="primary" screenReaderLabel="Add blog post"><IconAddLine /></IconButton>
23
23
  ```
@@ -26,7 +26,7 @@ Using [Tooltip](#Tooltip) in conjunction with IconButton can also provide necess
26
26
 
27
27
  ```js
28
28
  ---
29
- example: true
29
+ type: example
30
30
  ---
31
31
  <Tooltip
32
32
  renderTip="View user profile"
@@ -43,7 +43,7 @@ The `shape` prop specifies if the IconButton will render as a `rectangle` or `ci
43
43
 
44
44
  ```js
45
45
  ---
46
- example: true
46
+ type: example
47
47
  ---
48
48
  <View display="block">
49
49
  <IconButton shape="rectangle" screenReaderLabel="Delete tag" margin="small"><IconXSolid /></IconButton>
@@ -57,7 +57,7 @@ The background and border can be optionally removed as needed by setting the `wi
57
57
 
58
58
  ```js
59
59
  ---
60
- example: true
60
+ type: example
61
61
  ---
62
62
  <View display="block">
63
63
  <View display="inline-block" background="primary">
@@ -7,8 +7,7 @@ between one of two states (locked/unlocked, published/unpublished, etc.).
7
7
 
8
8
  ```javascript
9
9
  ---
10
- example: true
11
- render: false
10
+ type: example
12
11
  ---
13
12
  class Example extends React.Component {
14
13
  state = {
@@ -46,8 +45,7 @@ render(<Example />)
46
45
 
47
46
  ```javascript
48
47
  ---
49
- example: true
50
- render: false
48
+ type: example
51
49
  ---
52
50
  class InverseExample extends React.Component {
53
51
  state = {
@@ -85,7 +83,7 @@ render(<InverseExample />)
85
83
 
86
84
  ```js
87
85
  ---
88
- guidelines: true
86
+ type: embed
89
87
  ---
90
88
  <Guidelines>
91
89
  <Figure recommendation="yes" title="Do">