@instructure/ui-buttons 10.2.3-snapshot-1 → 10.2.3-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.
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-1](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-1) (2024-09-17)
6
+ ## [10.2.3-snapshot-2](https://github.com/instructure/instructure-ui/compare/v10.2.2...v10.2.3-snapshot-2) (2024-09-20)
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": "10.2.3-snapshot-1",
3
+ "version": "10.2.3-snapshot-2",
4
4
  "description": "Accessible button components",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -23,10 +23,10 @@
23
23
  },
24
24
  "license": "MIT",
25
25
  "devDependencies": {
26
- "@instructure/ui-axe-check": "10.2.3-snapshot-1",
27
- "@instructure/ui-babel-preset": "10.2.3-snapshot-1",
28
- "@instructure/ui-test-utils": "10.2.3-snapshot-1",
29
- "@instructure/ui-themes": "10.2.3-snapshot-1",
26
+ "@instructure/ui-axe-check": "10.2.3-snapshot-2",
27
+ "@instructure/ui-babel-preset": "10.2.3-snapshot-2",
28
+ "@instructure/ui-test-utils": "10.2.3-snapshot-2",
29
+ "@instructure/ui-themes": "10.2.3-snapshot-2",
30
30
  "@testing-library/jest-dom": "^6.4.6",
31
31
  "@testing-library/react": "^15.0.7",
32
32
  "@testing-library/user-event": "^14.5.2",
@@ -34,21 +34,21 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.24.5",
37
- "@instructure/console": "10.2.3-snapshot-1",
38
- "@instructure/emotion": "10.2.3-snapshot-1",
39
- "@instructure/shared-types": "10.2.3-snapshot-1",
40
- "@instructure/ui-a11y-content": "10.2.3-snapshot-1",
41
- "@instructure/ui-a11y-utils": "10.2.3-snapshot-1",
42
- "@instructure/ui-color-utils": "10.2.3-snapshot-1",
43
- "@instructure/ui-dom-utils": "10.2.3-snapshot-1",
44
- "@instructure/ui-icons": "10.2.3-snapshot-1",
45
- "@instructure/ui-position": "10.2.3-snapshot-1",
46
- "@instructure/ui-prop-types": "10.2.3-snapshot-1",
47
- "@instructure/ui-react-utils": "10.2.3-snapshot-1",
48
- "@instructure/ui-testable": "10.2.3-snapshot-1",
49
- "@instructure/ui-tooltip": "10.2.3-snapshot-1",
50
- "@instructure/ui-utils": "10.2.3-snapshot-1",
51
- "@instructure/ui-view": "10.2.3-snapshot-1",
37
+ "@instructure/console": "10.2.3-snapshot-2",
38
+ "@instructure/emotion": "10.2.3-snapshot-2",
39
+ "@instructure/shared-types": "10.2.3-snapshot-2",
40
+ "@instructure/ui-a11y-content": "10.2.3-snapshot-2",
41
+ "@instructure/ui-a11y-utils": "10.2.3-snapshot-2",
42
+ "@instructure/ui-color-utils": "10.2.3-snapshot-2",
43
+ "@instructure/ui-dom-utils": "10.2.3-snapshot-2",
44
+ "@instructure/ui-icons": "10.2.3-snapshot-2",
45
+ "@instructure/ui-position": "10.2.3-snapshot-2",
46
+ "@instructure/ui-prop-types": "10.2.3-snapshot-2",
47
+ "@instructure/ui-react-utils": "10.2.3-snapshot-2",
48
+ "@instructure/ui-testable": "10.2.3-snapshot-2",
49
+ "@instructure/ui-tooltip": "10.2.3-snapshot-2",
50
+ "@instructure/ui-utils": "10.2.3-snapshot-2",
51
+ "@instructure/ui-view": "10.2.3-snapshot-2",
52
52
  "keycode": "^2",
53
53
  "prop-types": "^15.8.1"
54
54
  },
@@ -3,7 +3,7 @@ describes: BaseButton
3
3
  ---
4
4
 
5
5
  `BaseButton` is a low level utility component used to compose Instructure UI buttons. In most cases, it should not be used directly.
6
- Use [Button](#Button), [IconButton](#IconButton), or [CondensedButton](#CondensedButton) instead.
6
+ Use [Button](#Button), [CloseButton](#CloseButton), [IconButton](#IconButton), or [CondensedButton](#CondensedButton) instead.
7
7
 
8
8
  ```js
9
9
  ---
@@ -213,6 +213,90 @@ type: example
213
213
  </View>
214
214
  ```
215
215
 
216
+ ### Styling buttons
217
+
218
+ [Button](#Button) and [IconButton](#IconButton) share the same styling mechanics (they are `BaseButton`s underneath). You need to set the theme based on their `color` and `withBackground` prop:
219
+
220
+ ```js
221
+ ---
222
+ type: example
223
+ ---
224
+ class Example extends React.Component {
225
+ state = {
226
+ withBackground: true,
227
+ color : "secondary"
228
+ }
229
+ toggleWithBackground = (event) => this.setState({ withBackground: !this.state.withBackground })
230
+ changeColor = (event,color) => {this.setState({color})}
231
+ render() {
232
+ const overrides = {
233
+ borderWidth: "0.3rem",
234
+ // what to override depends on the 'color' value (by default 'secondary')
235
+ // if withBackground is true:
236
+ secondaryColor: '#000000', // icon color
237
+ secondaryBackground: '#ff00ff',
238
+ secondaryBorderColor: 'brown',
239
+
240
+ secondaryActiveBackground: '#000000', // &:active CSS, e.g. space is pressed, not hovered, see https://developer.mozilla.org/en-US/docs/Web/CSS/:active
241
+ secondaryActiveBoxShadow: '10px 5px 5px red',
242
+
243
+ secondaryHoverBackground: '#00FF00',
244
+ // if withBackground is false:
245
+ secondaryGhostColor: '#0000FF',
246
+ secondaryGhostBackground: 'transparent',
247
+ secondaryGhostBorderColor: '#FF00FF',
248
+
249
+ secondaryGhostActiveBackground: '#FF0000',
250
+ secondaryGhostActiveBoxShadow: '10px 5px 5px green',
251
+
252
+ secondaryGhostHoverBackground: '#00FFFF'
253
+ }
254
+ return (
255
+ <>
256
+ <FormFieldGroup description="In this example 'secondary' colors are overridden">
257
+ <Checkbox
258
+ checked={this.state.withBackground}
259
+ label="withBackground?"
260
+ onChange={this.toggleWithBackground}
261
+ />
262
+ </FormFieldGroup>
263
+ <View display="block" margin="small none">
264
+ <RadioInputGroup
265
+ name="color"
266
+ defaultValue="secondary"
267
+ description="Color:"
268
+ variant="toggle"
269
+ size="small"
270
+ onChange={this.changeColor} >
271
+ <RadioInput label="Primary" value="primary"/>
272
+ <RadioInput label="secondary" value="secondary" />
273
+ </RadioInputGroup>
274
+ </View>
275
+ <Flex margin="none none medium" gap="medium">
276
+ <Flex.Item>
277
+ <Button withBackground={this.state.withBackground}
278
+ color={this.state.color}
279
+ themeOverride={overrides}
280
+ >
281
+ Button
282
+ </Button>
283
+ </Flex.Item>
284
+ <Flex.Item>
285
+ <IconButton screenReaderLabel="View user profile"
286
+ withBackground={this.state.withBackground}
287
+ color={this.state.color}
288
+ themeOverride={overrides}>
289
+ <IconUserLine />
290
+ </IconButton>
291
+ </Flex.Item>
292
+ </Flex>
293
+ </>
294
+ )
295
+ }
296
+ }
297
+ render(<Example />)
298
+ ```
299
+
216
300
  ### Guidelines
217
301
 
218
302
  ```js
@@ -72,3 +72,7 @@ type: example
72
72
  </View>
73
73
  </View>
74
74
  ```
75
+
76
+ ### Styling
77
+
78
+ For an example see [Button](#Button/#Styling%20buttons)