@instructure/ui-buttons 10.16.5-snapshot-3 → 10.16.5-snapshot-4

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,9 +3,12 @@
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.16.5-snapshot-3](https://github.com/instructure/instructure-ui/compare/v10.16.4...v10.16.5-snapshot-3) (2025-05-16)
6
+ ## [10.16.5-snapshot-4](https://github.com/instructure/instructure-ui/compare/v10.16.4...v10.16.5-snapshot-4) (2025-05-16)
7
7
 
8
- **Note:** Version bump only for package @instructure/ui-buttons
8
+
9
+ ### Features
10
+
11
+ * **ui-buttons,shared-types:** add ai-primary and ai-secondary colors to buttons ([47868fc](https://github.com/instructure/instructure-ui/commit/47868fc9fe552c0389183c4e19ae25825fe4bc7d))
9
12
 
10
13
 
11
14
 
@@ -30,7 +30,7 @@ const propTypes = {
30
30
  elementRef: PropTypes.func,
31
31
  as: PropTypes.elementType,
32
32
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
33
- color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
33
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
34
34
  focusColor: PropTypes.oneOf(['info', 'inverse']),
35
35
  display: PropTypes.oneOf(['inline-block', 'block']),
36
36
  textAlign: PropTypes.oneOf(['start', 'center']),
@@ -22,6 +22,8 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
 
25
+ import { darken, lighten } from '@instructure/ui-color-utils';
26
+
25
27
  /**
26
28
  * ---
27
29
  * private: true
@@ -111,6 +113,56 @@ const generateStyle = (componentTheme, props, state) => {
111
113
  }
112
114
  };
113
115
  const colorVariants = {
116
+ 'ai-primary': {
117
+ default: {
118
+ color: componentTheme.primaryColor,
119
+ background: `
120
+ linear-gradient(165deg, ${componentTheme.aiBackgroundTopGradientColor} -20.97%, ${componentTheme.aiBackgroundBottomGradientColor} 141.21%) padding-box,
121
+ linear-gradient(125deg, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 141.21%) border-box`,
122
+ border: 'solid transparent',
123
+ boxShadow: componentTheme.primaryBoxShadow
124
+ },
125
+ active: {
126
+ background: `
127
+ linear-gradient(165deg, ${darken(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${darken(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
128
+ linear-gradient(125deg, ${darken(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${darken(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
129
+ border: 'solid transparent',
130
+ boxShadow: componentTheme.aiActiveBoxShadow
131
+ },
132
+ hover: {
133
+ background: `
134
+ linear-gradient(165deg, ${darken(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${darken(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
135
+ linear-gradient(125deg, ${darken(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${darken(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
136
+ border: 'solid transparent',
137
+ boxShadow: componentTheme.primaryHoverBoxShadow
138
+ }
139
+ },
140
+ 'ai-secondary': {
141
+ default: {
142
+ background: `
143
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
144
+ linear-gradient(white) padding-box,
145
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
146
+ border: 'solid transparent',
147
+ boxShadow: componentTheme.primaryBoxShadow,
148
+ WebkitTextFillColor: 'transparent'
149
+ },
150
+ active: {
151
+ background: `
152
+ linear-gradient(165deg, ${darken(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${darken(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
153
+ linear-gradient(125deg, ${darken(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${darken(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
154
+ border: 'solid transparent',
155
+ boxShadow: componentTheme.aiActiveBoxShadow
156
+ },
157
+ hover: {
158
+ background: `
159
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
160
+ linear-gradient(165deg, ${lighten(componentTheme.aiBackgroundTopGradientColor, 70)} -20.97%, ${lighten(componentTheme.aiBackgroundBottomGradientColor, 70)} 141.21%) padding-box,
161
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
162
+ border: 'solid transparent',
163
+ boxShadow: componentTheme.primaryHoverBoxShadow
164
+ }
165
+ },
114
166
  primary: withBackground ? {
115
167
  default: {
116
168
  color: componentTheme.primaryColor,
@@ -31,7 +31,7 @@ const activeShadow = 'inset 0 0 0.1875rem 0.0625rem';
31
31
  * @return {Object} The final theme object with the overrides and component variables
32
32
  */
33
33
  const generateComponentTheme = theme => {
34
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts10, _colors$contrasts11, _colors$contrasts12, _colors$contrasts13, _colors$contrasts14, _colors$contrasts15, _colors$contrasts16, _colors$contrasts17, _colors$contrasts18, _colors$contrasts19, _colors$contrasts20, _colors$contrasts21, _colors$contrasts22, _colors$contrasts23, _colors$contrasts24, _colors$contrasts25, _colors$contrasts26, _colors$contrasts27, _colors$contrasts28, _colors$contrasts29, _colors$contrasts30, _colors$contrasts31, _colors$contrasts32, _colors$contrasts33, _colors$contrasts34, _colors$contrasts35, _colors$contrasts36, _colors$contrasts37, _colors$contrasts38, _colors$contrasts39, _colors$contrasts40, _colors$contrasts41, _colors$contrasts42, _colors$contrasts43, _colors$contrasts44, _colors$contrasts45, _colors$contrasts46, _colors$contrasts47, _colors$contrasts48, _colors$contrasts49, _colors$contrasts50;
34
+ var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts10, _colors$contrasts11, _colors$contrasts12, _colors$contrasts13, _colors$contrasts14, _colors$contrasts15, _colors$contrasts16, _colors$contrasts17, _colors$contrasts18, _colors$contrasts19, _colors$contrasts20, _colors$contrasts21, _colors$contrasts22, _colors$contrasts23, _colors$contrasts24, _colors$contrasts25, _colors$contrasts26, _colors$contrasts27, _colors$contrasts28, _colors$contrasts29, _colors$contrasts30, _colors$contrasts31, _colors$contrasts32, _colors$contrasts33, _colors$contrasts34, _colors$contrasts35, _colors$contrasts36, _colors$contrasts37, _colors$contrasts38, _colors$contrasts39, _colors$contrasts40, _colors$contrasts41, _colors$contrasts42, _colors$contrasts43, _colors$contrasts44, _colors$contrasts45, _colors$contrasts46, _colors$contrasts47, _colors$contrasts48, _colors$contrasts49, _colors$contrasts50, _colors$contrasts51, _colors$contrasts52, _colors$contrasts53, _colors$contrasts54;
35
35
  const borders = theme.borders,
36
36
  colors = theme.colors,
37
37
  forms = theme.forms,
@@ -164,7 +164,12 @@ const generateComponentTheme = theme => {
164
164
  primaryInverseBoxShadow: 'none',
165
165
  primaryInverseGhostBoxShadow: 'none',
166
166
  primaryInverseHoverBoxShadow: 'none',
167
- primaryInverseGhostHoverBoxShadow: 'none'
167
+ primaryInverseGhostHoverBoxShadow: 'none',
168
+ aiBackgroundTopGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts51 = colors.contrasts) === null || _colors$contrasts51 === void 0 ? void 0 : _colors$contrasts51.violet4570,
169
+ aiBackgroundBottomGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts52 = colors.contrasts) === null || _colors$contrasts52 === void 0 ? void 0 : _colors$contrasts52.sea4570,
170
+ aiBorderTopGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts53 = colors.contrasts) === null || _colors$contrasts53 === void 0 ? void 0 : _colors$contrasts53.violet5790,
171
+ aiBorderBottomGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts54 = colors.contrasts) === null || _colors$contrasts54 === void 0 ? void 0 : _colors$contrasts54.sea5790,
172
+ aiActiveBoxShadow: '0px 0px 5px 0px #013451 inset'
168
173
  };
169
174
  return {
170
175
  ...componentVariables,
@@ -30,7 +30,7 @@ const propTypes = {
30
30
  elementRef: PropTypes.func,
31
31
  as: PropTypes.elementType,
32
32
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
33
- color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
33
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
34
34
  focusColor: PropTypes.oneOf(['info', 'inverse']),
35
35
  display: PropTypes.oneOf(['inline-block', 'block']),
36
36
  textAlign: PropTypes.oneOf(['start', 'center']),
@@ -32,7 +32,7 @@ const propTypes = {
32
32
  elementRef: PropTypes.func,
33
33
  as: PropTypes.elementType,
34
34
  interaction: PropTypes.oneOf(['enabled', 'disabled', 'readonly']),
35
- color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
35
+ color: PropTypes.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
36
36
  focusColor: PropTypes.oneOf(['info', 'inverse']),
37
37
  shape: PropTypes.oneOf(['rectangle', 'circle']),
38
38
  withBackground: PropTypes.bool,
@@ -37,7 +37,7 @@ const propTypes = exports.propTypes = {
37
37
  elementRef: _propTypes.default.func,
38
38
  as: _propTypes.default.elementType,
39
39
  interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
40
- color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
40
+ color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
41
41
  focusColor: _propTypes.default.oneOf(['info', 'inverse']),
42
42
  display: _propTypes.default.oneOf(['inline-block', 'block']),
43
43
  textAlign: _propTypes.default.oneOf(['start', 'center']),
@@ -4,6 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
+ var _darken = require("@instructure/ui-color-utils/lib/darken.js");
8
+ var _lighten = require("@instructure/ui-color-utils/lib/lighten.js");
7
9
  /*
8
10
  * The MIT License (MIT)
9
11
  *
@@ -117,6 +119,56 @@ const generateStyle = (componentTheme, props, state) => {
117
119
  }
118
120
  };
119
121
  const colorVariants = {
122
+ 'ai-primary': {
123
+ default: {
124
+ color: componentTheme.primaryColor,
125
+ background: `
126
+ linear-gradient(165deg, ${componentTheme.aiBackgroundTopGradientColor} -20.97%, ${componentTheme.aiBackgroundBottomGradientColor} 141.21%) padding-box,
127
+ linear-gradient(125deg, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 141.21%) border-box`,
128
+ border: 'solid transparent',
129
+ boxShadow: componentTheme.primaryBoxShadow
130
+ },
131
+ active: {
132
+ background: `
133
+ linear-gradient(165deg, ${(0, _darken.darken)(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${(0, _darken.darken)(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
134
+ linear-gradient(125deg, ${(0, _darken.darken)(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${(0, _darken.darken)(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
135
+ border: 'solid transparent',
136
+ boxShadow: componentTheme.aiActiveBoxShadow
137
+ },
138
+ hover: {
139
+ background: `
140
+ linear-gradient(165deg, ${(0, _darken.darken)(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${(0, _darken.darken)(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
141
+ linear-gradient(125deg, ${(0, _darken.darken)(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${(0, _darken.darken)(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
142
+ border: 'solid transparent',
143
+ boxShadow: componentTheme.primaryHoverBoxShadow
144
+ }
145
+ },
146
+ 'ai-secondary': {
147
+ default: {
148
+ background: `
149
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
150
+ linear-gradient(white) padding-box,
151
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
152
+ border: 'solid transparent',
153
+ boxShadow: componentTheme.primaryBoxShadow,
154
+ WebkitTextFillColor: 'transparent'
155
+ },
156
+ active: {
157
+ background: `
158
+ linear-gradient(165deg, ${(0, _darken.darken)(componentTheme.aiBackgroundTopGradientColor, 10)} -20.97%, ${(0, _darken.darken)(componentTheme.aiBackgroundBottomGradientColor, 10)} 141.21%) padding-box,
159
+ linear-gradient(125deg, ${(0, _darken.darken)(componentTheme.aiBorderTopGradientColor, 10)} 0%, ${(0, _darken.darken)(componentTheme.aiBorderBottomGradientColor, 10)} 141.21%) border-box`,
160
+ border: 'solid transparent',
161
+ boxShadow: componentTheme.aiActiveBoxShadow
162
+ },
163
+ hover: {
164
+ background: `
165
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
166
+ linear-gradient(165deg, ${(0, _lighten.lighten)(componentTheme.aiBackgroundTopGradientColor, 70)} -20.97%, ${(0, _lighten.lighten)(componentTheme.aiBackgroundBottomGradientColor, 70)} 141.21%) padding-box,
167
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
168
+ border: 'solid transparent',
169
+ boxShadow: componentTheme.primaryHoverBoxShadow
170
+ }
171
+ },
120
172
  primary: withBackground ? {
121
173
  default: {
122
174
  color: componentTheme.primaryColor,
@@ -38,7 +38,7 @@ const activeShadow = 'inset 0 0 0.1875rem 0.0625rem';
38
38
  * @return {Object} The final theme object with the overrides and component variables
39
39
  */
40
40
  const generateComponentTheme = theme => {
41
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts10, _colors$contrasts11, _colors$contrasts12, _colors$contrasts13, _colors$contrasts14, _colors$contrasts15, _colors$contrasts16, _colors$contrasts17, _colors$contrasts18, _colors$contrasts19, _colors$contrasts20, _colors$contrasts21, _colors$contrasts22, _colors$contrasts23, _colors$contrasts24, _colors$contrasts25, _colors$contrasts26, _colors$contrasts27, _colors$contrasts28, _colors$contrasts29, _colors$contrasts30, _colors$contrasts31, _colors$contrasts32, _colors$contrasts33, _colors$contrasts34, _colors$contrasts35, _colors$contrasts36, _colors$contrasts37, _colors$contrasts38, _colors$contrasts39, _colors$contrasts40, _colors$contrasts41, _colors$contrasts42, _colors$contrasts43, _colors$contrasts44, _colors$contrasts45, _colors$contrasts46, _colors$contrasts47, _colors$contrasts48, _colors$contrasts49, _colors$contrasts50;
41
+ var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts10, _colors$contrasts11, _colors$contrasts12, _colors$contrasts13, _colors$contrasts14, _colors$contrasts15, _colors$contrasts16, _colors$contrasts17, _colors$contrasts18, _colors$contrasts19, _colors$contrasts20, _colors$contrasts21, _colors$contrasts22, _colors$contrasts23, _colors$contrasts24, _colors$contrasts25, _colors$contrasts26, _colors$contrasts27, _colors$contrasts28, _colors$contrasts29, _colors$contrasts30, _colors$contrasts31, _colors$contrasts32, _colors$contrasts33, _colors$contrasts34, _colors$contrasts35, _colors$contrasts36, _colors$contrasts37, _colors$contrasts38, _colors$contrasts39, _colors$contrasts40, _colors$contrasts41, _colors$contrasts42, _colors$contrasts43, _colors$contrasts44, _colors$contrasts45, _colors$contrasts46, _colors$contrasts47, _colors$contrasts48, _colors$contrasts49, _colors$contrasts50, _colors$contrasts51, _colors$contrasts52, _colors$contrasts53, _colors$contrasts54;
42
42
  const borders = theme.borders,
43
43
  colors = theme.colors,
44
44
  forms = theme.forms,
@@ -171,7 +171,12 @@ const generateComponentTheme = theme => {
171
171
  primaryInverseBoxShadow: 'none',
172
172
  primaryInverseGhostBoxShadow: 'none',
173
173
  primaryInverseHoverBoxShadow: 'none',
174
- primaryInverseGhostHoverBoxShadow: 'none'
174
+ primaryInverseGhostHoverBoxShadow: 'none',
175
+ aiBackgroundTopGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts51 = colors.contrasts) === null || _colors$contrasts51 === void 0 ? void 0 : _colors$contrasts51.violet4570,
176
+ aiBackgroundBottomGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts52 = colors.contrasts) === null || _colors$contrasts52 === void 0 ? void 0 : _colors$contrasts52.sea4570,
177
+ aiBorderTopGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts53 = colors.contrasts) === null || _colors$contrasts53 === void 0 ? void 0 : _colors$contrasts53.violet5790,
178
+ aiBorderBottomGradientColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts54 = colors.contrasts) === null || _colors$contrasts54 === void 0 ? void 0 : _colors$contrasts54.sea5790,
179
+ aiActiveBoxShadow: '0px 0px 5px 0px #013451 inset'
175
180
  };
176
181
  return {
177
182
  ...componentVariables,
@@ -37,7 +37,7 @@ const propTypes = exports.propTypes = {
37
37
  elementRef: _propTypes.default.func,
38
38
  as: _propTypes.default.elementType,
39
39
  interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
40
- color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
40
+ color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
41
41
  focusColor: _propTypes.default.oneOf(['info', 'inverse']),
42
42
  display: _propTypes.default.oneOf(['inline-block', 'block']),
43
43
  textAlign: _propTypes.default.oneOf(['start', 'center']),
@@ -39,7 +39,7 @@ const propTypes = exports.propTypes = {
39
39
  elementRef: _propTypes.default.func,
40
40
  as: _propTypes.default.elementType,
41
41
  interaction: _propTypes.default.oneOf(['enabled', 'disabled', 'readonly']),
42
- color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger']),
42
+ color: _propTypes.default.oneOf(['primary', 'primary-inverse', 'secondary', 'success', 'danger', 'ai-primary', 'ai-secondary']),
43
43
  focusColor: _propTypes.default.oneOf(['info', 'inverse']),
44
44
  shape: _propTypes.default.oneOf(['rectangle', 'circle']),
45
45
  withBackground: _propTypes.default.bool,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "10.16.5-snapshot-3",
3
+ "version": "10.16.5-snapshot-4",
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.16.5-snapshot-3",
27
- "@instructure/ui-babel-preset": "10.16.5-snapshot-3",
28
- "@instructure/ui-test-utils": "10.16.5-snapshot-3",
29
- "@instructure/ui-themes": "10.16.5-snapshot-3",
26
+ "@instructure/ui-axe-check": "10.16.5-snapshot-4",
27
+ "@instructure/ui-babel-preset": "10.16.5-snapshot-4",
28
+ "@instructure/ui-test-utils": "10.16.5-snapshot-4",
29
+ "@instructure/ui-themes": "10.16.5-snapshot-4",
30
30
  "@testing-library/jest-dom": "^6.6.3",
31
31
  "@testing-library/react": "^16.0.1",
32
32
  "@testing-library/user-event": "^14.5.2",
@@ -34,21 +34,21 @@
34
34
  },
35
35
  "dependencies": {
36
36
  "@babel/runtime": "^7.26.0",
37
- "@instructure/console": "10.16.5-snapshot-3",
38
- "@instructure/emotion": "10.16.5-snapshot-3",
39
- "@instructure/shared-types": "10.16.5-snapshot-3",
40
- "@instructure/ui-a11y-content": "10.16.5-snapshot-3",
41
- "@instructure/ui-a11y-utils": "10.16.5-snapshot-3",
42
- "@instructure/ui-color-utils": "10.16.5-snapshot-3",
43
- "@instructure/ui-dom-utils": "10.16.5-snapshot-3",
44
- "@instructure/ui-icons": "10.16.5-snapshot-3",
45
- "@instructure/ui-position": "10.16.5-snapshot-3",
46
- "@instructure/ui-prop-types": "10.16.5-snapshot-3",
47
- "@instructure/ui-react-utils": "10.16.5-snapshot-3",
48
- "@instructure/ui-testable": "10.16.5-snapshot-3",
49
- "@instructure/ui-tooltip": "10.16.5-snapshot-3",
50
- "@instructure/ui-utils": "10.16.5-snapshot-3",
51
- "@instructure/ui-view": "10.16.5-snapshot-3",
37
+ "@instructure/console": "10.16.5-snapshot-4",
38
+ "@instructure/emotion": "10.16.5-snapshot-4",
39
+ "@instructure/shared-types": "10.16.5-snapshot-4",
40
+ "@instructure/ui-a11y-content": "10.16.5-snapshot-4",
41
+ "@instructure/ui-a11y-utils": "10.16.5-snapshot-4",
42
+ "@instructure/ui-color-utils": "10.16.5-snapshot-4",
43
+ "@instructure/ui-dom-utils": "10.16.5-snapshot-4",
44
+ "@instructure/ui-icons": "10.16.5-snapshot-4",
45
+ "@instructure/ui-position": "10.16.5-snapshot-4",
46
+ "@instructure/ui-prop-types": "10.16.5-snapshot-4",
47
+ "@instructure/ui-react-utils": "10.16.5-snapshot-4",
48
+ "@instructure/ui-testable": "10.16.5-snapshot-4",
49
+ "@instructure/ui-tooltip": "10.16.5-snapshot-4",
50
+ "@instructure/ui-utils": "10.16.5-snapshot-4",
51
+ "@instructure/ui-view": "10.16.5-snapshot-4",
52
52
  "keycode": "^2",
53
53
  "prop-types": "^15.8.1"
54
54
  },
@@ -76,7 +76,14 @@ type BaseButtonOwnProps = {
76
76
  /**
77
77
  * Specifies the color for the `Button`.
78
78
  */
79
- color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
79
+ color?:
80
+ | 'primary'
81
+ | 'primary-inverse'
82
+ | 'secondary'
83
+ | 'success'
84
+ | 'danger'
85
+ | 'ai-primary'
86
+ | 'ai-secondary'
80
87
 
81
88
  /**
82
89
  * Override the `Button`'s default focus outline color.
@@ -194,7 +201,9 @@ const propTypes: PropValidators<PropKeys> = {
194
201
  'primary-inverse',
195
202
  'secondary',
196
203
  'success',
197
- 'danger'
204
+ 'danger',
205
+ 'ai-primary',
206
+ 'ai-secondary'
198
207
  ]),
199
208
  focusColor: PropTypes.oneOf(['info', 'inverse']),
200
209
  display: PropTypes.oneOf(['inline-block', 'block']),
@@ -29,6 +29,8 @@ import type {
29
29
  BaseButtonStyle
30
30
  } from './props'
31
31
 
32
+ import { darken, lighten } from '@instructure/ui-color-utils'
33
+
32
34
  /**
33
35
  * ---
34
36
  * private: true
@@ -131,6 +133,102 @@ const generateStyle = (
131
133
  }
132
134
 
133
135
  const colorVariants = {
136
+ 'ai-primary': {
137
+ default: {
138
+ color: componentTheme.primaryColor,
139
+ background: `
140
+ linear-gradient(165deg, ${componentTheme.aiBackgroundTopGradientColor} -20.97%, ${componentTheme.aiBackgroundBottomGradientColor} 141.21%) padding-box,
141
+ linear-gradient(125deg, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 141.21%) border-box`,
142
+ border: 'solid transparent',
143
+ boxShadow: componentTheme.primaryBoxShadow
144
+ },
145
+ active: {
146
+ background: `
147
+ linear-gradient(165deg, ${darken(
148
+ componentTheme.aiBackgroundTopGradientColor,
149
+ 10
150
+ )} -20.97%, ${darken(
151
+ componentTheme.aiBackgroundBottomGradientColor,
152
+ 10
153
+ )} 141.21%) padding-box,
154
+ linear-gradient(125deg, ${darken(
155
+ componentTheme.aiBorderTopGradientColor,
156
+ 10
157
+ )} 0%, ${darken(
158
+ componentTheme.aiBorderBottomGradientColor,
159
+ 10
160
+ )} 141.21%) border-box`,
161
+ border: 'solid transparent',
162
+ boxShadow: componentTheme.aiActiveBoxShadow
163
+ },
164
+ hover: {
165
+ background: `
166
+ linear-gradient(165deg, ${darken(
167
+ componentTheme.aiBackgroundTopGradientColor,
168
+ 10
169
+ )} -20.97%, ${darken(
170
+ componentTheme.aiBackgroundBottomGradientColor,
171
+ 10
172
+ )} 141.21%) padding-box,
173
+ linear-gradient(125deg, ${darken(
174
+ componentTheme.aiBorderTopGradientColor,
175
+ 10
176
+ )} 0%, ${darken(
177
+ componentTheme.aiBorderBottomGradientColor,
178
+ 10
179
+ )} 141.21%) border-box`,
180
+ border: 'solid transparent',
181
+ boxShadow: componentTheme.primaryHoverBoxShadow
182
+ }
183
+ },
184
+ 'ai-secondary': {
185
+ default: {
186
+ background: `
187
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
188
+ linear-gradient(white) padding-box,
189
+ linear-gradient(to bottom, ${componentTheme.aiBorderTopGradientColor} -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
190
+ border: 'solid transparent',
191
+ boxShadow: componentTheme.primaryBoxShadow,
192
+ WebkitTextFillColor: 'transparent'
193
+ },
194
+ active: {
195
+ background: `
196
+ linear-gradient(165deg, ${darken(
197
+ componentTheme.aiBackgroundTopGradientColor,
198
+ 10
199
+ )} -20.97%, ${darken(
200
+ componentTheme.aiBackgroundBottomGradientColor,
201
+ 10
202
+ )} 141.21%) padding-box,
203
+ linear-gradient(125deg, ${darken(
204
+ componentTheme.aiBorderTopGradientColor,
205
+ 10
206
+ )} 0%, ${darken(
207
+ componentTheme.aiBorderBottomGradientColor,
208
+ 10
209
+ )} 141.21%) border-box`,
210
+ border: 'solid transparent',
211
+ boxShadow: componentTheme.aiActiveBoxShadow
212
+ },
213
+ hover: {
214
+ background: `
215
+ linear-gradient(to bottom, ${
216
+ componentTheme.aiBorderTopGradientColor
217
+ } 0%, ${componentTheme.aiBorderBottomGradientColor} 100%) text,
218
+ linear-gradient(165deg, ${lighten(
219
+ componentTheme.aiBackgroundTopGradientColor,
220
+ 70
221
+ )} -20.97%, ${lighten(
222
+ componentTheme.aiBackgroundBottomGradientColor,
223
+ 70
224
+ )} 141.21%) padding-box,
225
+ linear-gradient(to bottom, ${
226
+ componentTheme.aiBorderTopGradientColor
227
+ } -40%, ${componentTheme.aiBorderBottomGradientColor} 140%) border-box`,
228
+ border: 'solid transparent',
229
+ boxShadow: componentTheme.primaryHoverBoxShadow
230
+ }
231
+ },
134
232
  primary: withBackground
135
233
  ? {
136
234
  default: {
@@ -196,7 +196,13 @@ const generateComponentTheme = (theme: Theme): BaseButtonTheme => {
196
196
  primaryInverseBoxShadow: 'none',
197
197
  primaryInverseGhostBoxShadow: 'none',
198
198
  primaryInverseHoverBoxShadow: 'none',
199
- primaryInverseGhostHoverBoxShadow: 'none'
199
+ primaryInverseGhostHoverBoxShadow: 'none',
200
+
201
+ aiBackgroundTopGradientColor: colors?.contrasts?.violet4570,
202
+ aiBackgroundBottomGradientColor: colors?.contrasts?.sea4570,
203
+ aiBorderTopGradientColor: colors?.contrasts?.violet5790,
204
+ aiBorderBottomGradientColor: colors?.contrasts?.sea5790,
205
+ aiActiveBoxShadow: '0px 0px 5px 0px #013451 inset'
200
206
  }
201
207
 
202
208
  return {
@@ -25,6 +25,24 @@ type: example
25
25
  <Button color="success" margin="small">Success</Button>
26
26
  <Button color="danger" margin="small">Danger</Button>
27
27
  <Button color="primary-inverse" margin="small">Primary Inverse</Button>
28
+ <Button color="ai-primary" margin="small">AI Primary</Button>
29
+ <Button color="ai-secondary" margin="small">AI Secondary</Button>
30
+ </View>
31
+ ```
32
+
33
+ ### AI buttons
34
+
35
+ There is a specific need for `AI buttons`, which has an icon and gradient colors for `background` and `borders`. Here are the preset examples you can use. (the `IconButton` examples are also included for convenience)
36
+
37
+ ```js
38
+ ---
39
+ type: example
40
+ ---
41
+ <View display="block">
42
+ <Button color="ai-primary" renderIcon={IconAiSolid} margin="small">AI Primary</Button>
43
+ <Button color="ai-secondary" renderIcon={IconAiColoredSolid} margin="small">AI Secondary</Button>
44
+ <IconButton color="ai-primary" screenReaderLabel="AI button" margin="small"><IconAiSolid/></IconButton>
45
+ <IconButton color="ai-secondary" screenReaderLabel="AI button" margin="small"><IconAiColoredSolid/></IconButton>
28
46
  </View>
29
47
  ```
30
48
 
@@ -70,7 +70,14 @@ type ButtonOwnProps = {
70
70
  /**
71
71
  * Specifies the color for the `Button`.
72
72
  */
73
- color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
73
+ color?:
74
+ | 'primary'
75
+ | 'primary-inverse'
76
+ | 'secondary'
77
+ | 'success'
78
+ | 'danger'
79
+ | 'ai-primary'
80
+ | 'ai-secondary'
74
81
 
75
82
  /**
76
83
  * Override the `Button`'s default focus outline color.
@@ -145,7 +152,9 @@ const propTypes: PropValidators<PropKeys> = {
145
152
  'primary-inverse',
146
153
  'secondary',
147
154
  'success',
148
- 'danger'
155
+ 'danger',
156
+ 'ai-primary',
157
+ 'ai-secondary'
149
158
  ]),
150
159
  focusColor: PropTypes.oneOf(['info', 'inverse']),
151
160
  display: PropTypes.oneOf(['inline-block', 'block']),
@@ -38,6 +38,18 @@ type: example
38
38
  </Tooltip>
39
39
  ```
40
40
 
41
+ ### AI Icon buttons
42
+
43
+ ```js
44
+ ---
45
+ type: example
46
+ ---
47
+ <View display="block">
48
+ <IconButton color="ai-primary" screenReaderLabel="AI button" margin="small"><IconAiSolid/></IconButton>
49
+ <IconButton color="ai-secondary" screenReaderLabel="AI button" margin="small"><IconAiColoredSolid/></IconButton>
50
+ </View>
51
+ ```
52
+
41
53
  ### Shaping
42
54
 
43
55
  The `shape` prop specifies if the IconButton will render as a `rectangle` or `circle`.
@@ -81,7 +81,14 @@ type IconButtonOwnProps = {
81
81
  /**
82
82
  * Specifies the color for the `IconButton`.
83
83
  */
84
- color?: 'primary' | 'primary-inverse' | 'secondary' | 'success' | 'danger'
84
+ color?:
85
+ | 'primary'
86
+ | 'primary-inverse'
87
+ | 'secondary'
88
+ | 'success'
89
+ | 'danger'
90
+ | 'ai-primary'
91
+ | 'ai-secondary'
85
92
 
86
93
  /**
87
94
  * Override the `Button`'s default focus outline color.
@@ -152,7 +159,9 @@ const propTypes: PropValidators<PropKeys> = {
152
159
  'primary-inverse',
153
160
  'secondary',
154
161
  'success',
155
- 'danger'
162
+ 'danger',
163
+ 'ai-primary',
164
+ 'ai-secondary'
156
165
  ]),
157
166
  focusColor: PropTypes.oneOf(['info', 'inverse']),
158
167
  shape: PropTypes.oneOf(['rectangle', 'circle']),