@instructure/ui-buttons 8.18.0 → 8.18.1-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/LICENSE.md ADDED
@@ -0,0 +1,27 @@
1
+ ---
2
+ title: The MIT License (MIT)
3
+ category: Getting Started
4
+ order: 9
5
+ ---
6
+
7
+ # The MIT License (MIT)
8
+
9
+ Copyright (c) 2015 Instructure, Inc.
10
+
11
+ **Permission is hereby granted, free of charge, to any person obtaining a copy
12
+ of this software and associated documentation files (the "Software"), to deal
13
+ in the Software without restriction, including without limitation the rights
14
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
+ copies of the Software, and to permit persons to whom the Software is
16
+ furnished to do so, subject to the following conditions.**
17
+
18
+ The above copyright notice and this permission notice shall be included in all
19
+ copies or substantial portions of the Software.
20
+
21
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
+ SOFTWARE.
@@ -108,11 +108,15 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
108
108
  }
109
109
 
110
110
  componentDidMount() {
111
- this.props.makeStyles?.(this.makeStylesVariables);
111
+ var _this$props$makeStyle, _this$props2;
112
+
113
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
112
114
  }
113
115
 
114
116
  componentDidUpdate() {
115
- this.props.makeStyles?.(this.makeStylesVariables);
117
+ var _this$props$makeStyle2, _this$props3;
118
+
119
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
116
120
  }
117
121
 
118
122
  get _rootElement() {
@@ -127,9 +131,9 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
127
131
  }
128
132
 
129
133
  get hasOnlyIconVisible() {
130
- const _this$props2 = this.props,
131
- children = _this$props2.children,
132
- renderIcon = _this$props2.renderIcon;
134
+ const _this$props4 = this.props,
135
+ children = _this$props4.children,
136
+ renderIcon = _this$props4.renderIcon;
133
137
  return !!(renderIcon && !hasVisibleChildren(children));
134
138
  }
135
139
 
@@ -168,10 +172,10 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
168
172
  }
169
173
 
170
174
  get focusColor() {
171
- const _this$props3 = this.props,
172
- color = _this$props3.color,
173
- focusColor = _this$props3.focusColor,
174
- withBackground = _this$props3.withBackground; // Give user specified focusColor preference
175
+ const _this$props5 = this.props,
176
+ color = _this$props5.color,
177
+ focusColor = _this$props5.focusColor,
178
+ withBackground = _this$props5.withBackground; // Give user specified focusColor preference
175
179
 
176
180
  if (focusColor) {
177
181
  return focusColor;
@@ -197,12 +201,12 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
197
201
  }
198
202
 
199
203
  renderChildren() {
200
- const _this$props4 = this.props,
201
- renderIcon = _this$props4.renderIcon,
202
- children = _this$props4.children,
203
- styles = _this$props4.styles;
204
+ const _this$props6 = this.props,
205
+ renderIcon = _this$props6.renderIcon,
206
+ children = _this$props6.children,
207
+ styles = _this$props6.styles;
204
208
  const wrappedChildren = jsx("span", {
205
- css: styles?.children
209
+ css: styles === null || styles === void 0 ? void 0 : styles.children
206
210
  }, children);
207
211
 
208
212
  if (!renderIcon) {
@@ -211,45 +215,45 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
211
215
 
212
216
  const hasOnlyIconVisible = this.hasOnlyIconVisible;
213
217
  const wrappedIcon = jsx("span", {
214
- css: styles?.iconSVG
218
+ css: styles === null || styles === void 0 ? void 0 : styles.iconSVG
215
219
  }, callRenderProp(renderIcon));
216
220
  const flexChildren = hasOnlyIconVisible ? jsx("span", {
217
- css: styles?.iconOnly
221
+ css: styles === null || styles === void 0 ? void 0 : styles.iconOnly
218
222
  }, wrappedIcon, children) : [jsx("span", {
219
223
  key: "icon",
220
- css: styles?.iconWrapper
224
+ css: styles === null || styles === void 0 ? void 0 : styles.iconWrapper
221
225
  }, wrappedIcon), jsx("span", {
222
226
  key: "children",
223
- css: styles?.childrenWrapper
227
+ css: styles === null || styles === void 0 ? void 0 : styles.childrenWrapper
224
228
  }, wrappedChildren)];
225
229
  return jsx("span", {
226
- css: styles?.childrenLayout
230
+ css: styles === null || styles === void 0 ? void 0 : styles.childrenLayout
227
231
  }, flexChildren);
228
232
  }
229
233
 
230
234
  render() {
231
- const _this$props5 = this.props,
232
- type = _this$props5.type,
233
- size = _this$props5.size,
234
- elementRef = _this$props5.elementRef,
235
- as = _this$props5.as,
236
- href = _this$props5.href,
237
- color = _this$props5.color,
238
- focusColor = _this$props5.focusColor,
239
- textAlign = _this$props5.textAlign,
240
- shape = _this$props5.shape,
241
- display = _this$props5.display,
242
- withBackground = _this$props5.withBackground,
243
- withBorder = _this$props5.withBorder,
244
- isCondensed = _this$props5.isCondensed,
245
- margin = _this$props5.margin,
246
- cursor = _this$props5.cursor,
247
- onClick = _this$props5.onClick,
248
- renderIcon = _this$props5.renderIcon,
249
- tabIndex = _this$props5.tabIndex,
250
- styles = _this$props5.styles,
251
- makeStyles = _this$props5.makeStyles,
252
- props = _objectWithoutProperties(_this$props5, _excluded);
235
+ const _this$props7 = this.props,
236
+ type = _this$props7.type,
237
+ size = _this$props7.size,
238
+ elementRef = _this$props7.elementRef,
239
+ as = _this$props7.as,
240
+ href = _this$props7.href,
241
+ color = _this$props7.color,
242
+ focusColor = _this$props7.focusColor,
243
+ textAlign = _this$props7.textAlign,
244
+ shape = _this$props7.shape,
245
+ display = _this$props7.display,
246
+ withBackground = _this$props7.withBackground,
247
+ withBorder = _this$props7.withBorder,
248
+ isCondensed = _this$props7.isCondensed,
249
+ margin = _this$props7.margin,
250
+ cursor = _this$props7.cursor,
251
+ onClick = _this$props7.onClick,
252
+ renderIcon = _this$props7.renderIcon,
253
+ tabIndex = _this$props7.tabIndex,
254
+ styles = _this$props7.styles,
255
+ makeStyles = _this$props7.makeStyles,
256
+ props = _objectWithoutProperties(_this$props7, _excluded);
253
257
 
254
258
  const isDisabled = this.isDisabled,
255
259
  isEnabled = this.isEnabled,
@@ -275,9 +279,9 @@ let BaseButton = (_dec = withStyle(generateStyles, generateComponentTheme), _dec
275
279
  role: onClick && as !== 'button' ? 'button' : void 0,
276
280
  tabIndex: onClick && as ? tabIndexNumber || 0 : tabIndexNumber,
277
281
  disabled: isDisabled || isReadOnly,
278
- css: isEnabled ? styles?.baseButton : null
282
+ css: isEnabled ? styles === null || styles === void 0 ? void 0 : styles.baseButton : null
279
283
  }), jsx("span", {
280
- css: styles?.content
284
+ css: styles === null || styles === void 0 ? void 0 : styles.content
281
285
  }, this.renderChildren()));
282
286
  }
283
287
 
@@ -72,8 +72,8 @@ const generateComponentTheme = theme => {
72
72
  primaryGhostHoverBackground: alpha(theme['ic-brand-button--primary-bgd'], 10)
73
73
  },
74
74
  'canvas-high-contrast': {
75
- secondaryBorderColor: colors?.borderMedium,
76
- primaryInverseBorderColor: colors?.borderMedium
75
+ secondaryBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
76
+ primaryInverseBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium
77
77
  },
78
78
  instructure: {
79
79
  borderRadius: '999em',
@@ -89,29 +89,29 @@ const generateComponentTheme = theme => {
89
89
  const componentVariables = {
90
90
  transform: 'none',
91
91
  hoverTransform: 'none',
92
- fontFamily: typography?.fontFamily,
93
- fontWeight: typography?.fontWeightNormal,
92
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
93
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
94
94
  textTransform: 'none',
95
95
  letterSpacing: 'normal',
96
- borderRadius: borders?.radiusMedium,
97
- borderStyle: borders?.style,
98
- borderWidth: borders?.widthSmall,
99
- smallHeight: forms?.inputHeightSmall,
100
- smallFontSize: typography?.fontSizeSmall,
101
- smallPaddingHorizontal: spacing?.xSmall,
96
+ borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
97
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
98
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
99
+ smallHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightSmall,
100
+ smallFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
101
+ smallPaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
102
102
  smallPaddingTop: '0.375rem',
103
103
  smallPaddingBottom: '0.3125rem',
104
- mediumHeight: forms?.inputHeightMedium,
105
- mediumFontSize: typography?.fontSizeMedium,
106
- mediumPaddingHorizontal: spacing?.small,
104
+ mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
105
+ mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
106
+ mediumPaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.small,
107
107
  mediumPaddingTop: '0.5625rem',
108
108
  mediumPaddingBottom: '0.5625rem',
109
- largeHeight: forms?.inputHeightLarge,
110
- largeFontSize: typography?.fontSizeLarge,
111
- largePaddingHorizontal: spacing?.medium,
109
+ largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge,
110
+ largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
111
+ largePaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.medium,
112
112
  largePaddingTop: '0.6875rem',
113
113
  largePaddingBottom: '0.6875rem',
114
- lineHeight: typography?.lineHeightFit,
114
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightFit,
115
115
  iconSizeSmall: '1rem',
116
116
  iconSizeMedium: '1.25rem',
117
117
  iconSizeLarge: '1.625rem',
@@ -119,47 +119,47 @@ const generateComponentTheme = theme => {
119
119
  iconTextGapCondensed: spacing.xxSmall,
120
120
  ...generateButtonThemeVars({
121
121
  style: 'primary',
122
- backgroundColor: colors?.backgroundBrand,
123
- borderColor: colors?.borderBrand,
124
- textColor: colors?.textLightest,
125
- ghostTextColor: colors?.textBrand
122
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrand,
123
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
124
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
125
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textBrand
126
126
  }),
127
127
  ...generateButtonThemeVars({
128
128
  style: 'secondary',
129
- backgroundColor: colors?.backgroundLight,
130
- borderColor: colors?.borderLight,
131
- ghostBorderColor: colors?.borderDarkest,
132
- textColor: colors?.textDarkest,
133
- ghostTextColor: colors?.textDarkest
129
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
130
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderLight,
131
+ ghostBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDarkest,
132
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
133
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest
134
134
  }),
135
135
  ...generateButtonThemeVars({
136
136
  style: 'success',
137
- backgroundColor: colors?.backgroundSuccess,
138
- borderColor: colors?.borderSuccess,
139
- textColor: colors?.textLightest,
140
- ghostTextColor: colors?.textSuccess
137
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundSuccess,
138
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderSuccess,
139
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
140
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textSuccess
141
141
  }),
142
142
  ...generateButtonThemeVars({
143
143
  style: 'danger',
144
- backgroundColor: colors?.backgroundDanger,
145
- borderColor: colors?.borderDanger,
146
- textColor: colors?.textLightest,
147
- ghostTextColor: colors?.textDanger
144
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDanger,
145
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
146
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
147
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textDanger
148
148
  }),
149
149
  ...generateButtonThemeVars({
150
150
  style: 'primaryInverse',
151
- backgroundColor: colors?.backgroundLightest,
152
- borderColor: colors?.borderLightest,
153
- textColor: colors?.textDarkest,
154
- ghostTextColor: colors?.textLightest
151
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
152
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
153
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
154
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textLightest
155
155
  }),
156
156
  // Overrides for primary-inverse to match what was previously the `light` button variant
157
- primaryInverseBorderColor: darken(colors?.borderLight, 10),
158
- primaryInverseHoverBackground: darken(colors?.backgroundLightest, 5),
159
- primaryInverseActiveBackground: colors?.backgroundLightest,
160
- primaryInverseActiveBoxShadow: `${activeShadow} ${darken(colors?.borderLightest, 25)}`,
157
+ primaryInverseBorderColor: darken(colors === null || colors === void 0 ? void 0 : colors.borderLight, 10),
158
+ primaryInverseHoverBackground: darken(colors === null || colors === void 0 ? void 0 : colors.backgroundLightest, 5),
159
+ primaryInverseActiveBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
160
+ primaryInverseActiveBoxShadow: `${activeShadow} ${darken(colors === null || colors === void 0 ? void 0 : colors.borderLightest, 25)}`,
161
161
  // Overrides for ghost hover states to ensure correct color contrast for a11y
162
- successGhostHoverBackground: alpha(colors?.textSuccess, 1)
162
+ successGhostHoverBackground: alpha(colors === null || colors === void 0 ? void 0 : colors.textSuccess, 1)
163
163
  };
164
164
  return { ...componentVariables,
165
165
  ...themeSpecificStyle[themeName]
@@ -61,11 +61,15 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
61
61
  }
62
62
 
63
63
  componentDidMount() {
64
- this.props.makeStyles?.();
64
+ var _this$props$makeStyle, _this$props;
65
+
66
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
65
67
  }
66
68
 
67
69
  componentDidUpdate() {
68
- this.props.makeStyles?.();
70
+ var _this$props$makeStyle2, _this$props2;
71
+
72
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
69
73
  }
70
74
 
71
75
  get interaction() {
@@ -80,24 +84,24 @@ let CloseButton = (_dec = withStyle(generateStyle, generateComponentTheme), _dec
80
84
  }
81
85
 
82
86
  render() {
83
- const _this$props = this.props,
84
- screenReaderLabel = _this$props.screenReaderLabel,
85
- elementRef = _this$props.elementRef,
86
- size = _this$props.size,
87
- onClick = _this$props.onClick,
88
- margin = _this$props.margin,
89
- placement = _this$props.placement,
90
- offset = _this$props.offset,
91
- type = _this$props.type,
92
- as = _this$props.as,
93
- href = _this$props.href,
94
- cursor = _this$props.cursor,
95
- tabIndex = _this$props.tabIndex,
96
- styles = _this$props.styles,
97
- props = _objectWithoutProperties(_this$props, _excluded);
87
+ const _this$props3 = this.props,
88
+ screenReaderLabel = _this$props3.screenReaderLabel,
89
+ elementRef = _this$props3.elementRef,
90
+ size = _this$props3.size,
91
+ onClick = _this$props3.onClick,
92
+ margin = _this$props3.margin,
93
+ placement = _this$props3.placement,
94
+ offset = _this$props3.offset,
95
+ type = _this$props3.type,
96
+ as = _this$props3.as,
97
+ href = _this$props3.href,
98
+ cursor = _this$props3.cursor,
99
+ tabIndex = _this$props3.tabIndex,
100
+ styles = _this$props3.styles,
101
+ props = _objectWithoutProperties(_this$props3, _excluded);
98
102
 
99
103
  return jsx("span", Object.assign({}, passthroughProps(props), {
100
- css: styles?.closeButton
104
+ css: styles === null || styles === void 0 ? void 0 : styles.closeButton
101
105
  }), jsx(BaseButton, {
102
106
  renderIcon: IconXSolid,
103
107
  elementRef: this.handleRef,
@@ -31,10 +31,10 @@ const generateComponentTheme = theme => {
31
31
  const spacing = theme.spacing,
32
32
  stacking = theme.stacking;
33
33
  const componentVariables = {
34
- offsetMedium: spacing?.medium,
35
- offsetSmall: spacing?.small,
36
- offsetXSmall: spacing?.xSmall,
37
- zIndex: stacking?.above
34
+ offsetMedium: spacing === null || spacing === void 0 ? void 0 : spacing.medium,
35
+ offsetSmall: spacing === null || spacing === void 0 ? void 0 : spacing.small,
36
+ offsetXSmall: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
37
+ zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above
38
38
  };
39
39
  return { ...componentVariables
40
40
  };
@@ -112,11 +112,15 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
112
112
  }
113
113
 
114
114
  componentDidMount() {
115
- this.props.makeStyles?.(this.makeStylesVariables);
115
+ var _this$props$makeStyle, _this$props2;
116
+
117
+ (_this$props$makeStyle = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props2, this.makeStylesVariables);
116
118
  }
117
119
 
118
120
  componentDidUpdate() {
119
- this.props.makeStyles?.(this.makeStylesVariables);
121
+ var _this$props$makeStyle2, _this$props3;
122
+
123
+ (_this$props$makeStyle2 = (_this$props3 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props3, this.makeStylesVariables);
120
124
  }
121
125
 
122
126
  get _rootElement() {
@@ -131,9 +135,9 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
131
135
  }
132
136
 
133
137
  get hasOnlyIconVisible() {
134
- const _this$props2 = this.props,
135
- children = _this$props2.children,
136
- renderIcon = _this$props2.renderIcon;
138
+ const _this$props4 = this.props,
139
+ children = _this$props4.children,
140
+ renderIcon = _this$props4.renderIcon;
137
141
  return !!(renderIcon && !(0, _hasVisibleChildren.hasVisibleChildren)(children));
138
142
  }
139
143
 
@@ -172,10 +176,10 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
172
176
  }
173
177
 
174
178
  get focusColor() {
175
- const _this$props3 = this.props,
176
- color = _this$props3.color,
177
- focusColor = _this$props3.focusColor,
178
- withBackground = _this$props3.withBackground; // Give user specified focusColor preference
179
+ const _this$props5 = this.props,
180
+ color = _this$props5.color,
181
+ focusColor = _this$props5.focusColor,
182
+ withBackground = _this$props5.withBackground; // Give user specified focusColor preference
179
183
 
180
184
  if (focusColor) {
181
185
  return focusColor;
@@ -201,12 +205,12 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
201
205
  }
202
206
 
203
207
  renderChildren() {
204
- const _this$props4 = this.props,
205
- renderIcon = _this$props4.renderIcon,
206
- children = _this$props4.children,
207
- styles = _this$props4.styles;
208
+ const _this$props6 = this.props,
209
+ renderIcon = _this$props6.renderIcon,
210
+ children = _this$props6.children,
211
+ styles = _this$props6.styles;
208
212
  const wrappedChildren = (0, _emotion.jsx)("span", {
209
- css: styles?.children
213
+ css: styles === null || styles === void 0 ? void 0 : styles.children
210
214
  }, children);
211
215
 
212
216
  if (!renderIcon) {
@@ -215,45 +219,45 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
215
219
 
216
220
  const hasOnlyIconVisible = this.hasOnlyIconVisible;
217
221
  const wrappedIcon = (0, _emotion.jsx)("span", {
218
- css: styles?.iconSVG
222
+ css: styles === null || styles === void 0 ? void 0 : styles.iconSVG
219
223
  }, (0, _callRenderProp.callRenderProp)(renderIcon));
220
224
  const flexChildren = hasOnlyIconVisible ? (0, _emotion.jsx)("span", {
221
- css: styles?.iconOnly
225
+ css: styles === null || styles === void 0 ? void 0 : styles.iconOnly
222
226
  }, wrappedIcon, children) : [(0, _emotion.jsx)("span", {
223
227
  key: "icon",
224
- css: styles?.iconWrapper
228
+ css: styles === null || styles === void 0 ? void 0 : styles.iconWrapper
225
229
  }, wrappedIcon), (0, _emotion.jsx)("span", {
226
230
  key: "children",
227
- css: styles?.childrenWrapper
231
+ css: styles === null || styles === void 0 ? void 0 : styles.childrenWrapper
228
232
  }, wrappedChildren)];
229
233
  return (0, _emotion.jsx)("span", {
230
- css: styles?.childrenLayout
234
+ css: styles === null || styles === void 0 ? void 0 : styles.childrenLayout
231
235
  }, flexChildren);
232
236
  }
233
237
 
234
238
  render() {
235
- const _this$props5 = this.props,
236
- type = _this$props5.type,
237
- size = _this$props5.size,
238
- elementRef = _this$props5.elementRef,
239
- as = _this$props5.as,
240
- href = _this$props5.href,
241
- color = _this$props5.color,
242
- focusColor = _this$props5.focusColor,
243
- textAlign = _this$props5.textAlign,
244
- shape = _this$props5.shape,
245
- display = _this$props5.display,
246
- withBackground = _this$props5.withBackground,
247
- withBorder = _this$props5.withBorder,
248
- isCondensed = _this$props5.isCondensed,
249
- margin = _this$props5.margin,
250
- cursor = _this$props5.cursor,
251
- onClick = _this$props5.onClick,
252
- renderIcon = _this$props5.renderIcon,
253
- tabIndex = _this$props5.tabIndex,
254
- styles = _this$props5.styles,
255
- makeStyles = _this$props5.makeStyles,
256
- props = (0, _objectWithoutProperties2.default)(_this$props5, _excluded);
239
+ const _this$props7 = this.props,
240
+ type = _this$props7.type,
241
+ size = _this$props7.size,
242
+ elementRef = _this$props7.elementRef,
243
+ as = _this$props7.as,
244
+ href = _this$props7.href,
245
+ color = _this$props7.color,
246
+ focusColor = _this$props7.focusColor,
247
+ textAlign = _this$props7.textAlign,
248
+ shape = _this$props7.shape,
249
+ display = _this$props7.display,
250
+ withBackground = _this$props7.withBackground,
251
+ withBorder = _this$props7.withBorder,
252
+ isCondensed = _this$props7.isCondensed,
253
+ margin = _this$props7.margin,
254
+ cursor = _this$props7.cursor,
255
+ onClick = _this$props7.onClick,
256
+ renderIcon = _this$props7.renderIcon,
257
+ tabIndex = _this$props7.tabIndex,
258
+ styles = _this$props7.styles,
259
+ makeStyles = _this$props7.makeStyles,
260
+ props = (0, _objectWithoutProperties2.default)(_this$props7, _excluded);
257
261
  const isDisabled = this.isDisabled,
258
262
  isEnabled = this.isEnabled,
259
263
  isReadOnly = this.isReadOnly;
@@ -278,9 +282,9 @@ let BaseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default
278
282
  role: onClick && as !== 'button' ? 'button' : void 0,
279
283
  tabIndex: onClick && as ? tabIndexNumber || 0 : tabIndexNumber,
280
284
  disabled: isDisabled || isReadOnly,
281
- css: isEnabled ? styles?.baseButton : null
285
+ css: isEnabled ? styles === null || styles === void 0 ? void 0 : styles.baseButton : null
282
286
  }), (0, _emotion.jsx)("span", {
283
- css: styles?.content
287
+ css: styles === null || styles === void 0 ? void 0 : styles.content
284
288
  }, this.renderChildren()));
285
289
  }
286
290
 
@@ -82,8 +82,8 @@ const generateComponentTheme = theme => {
82
82
  primaryGhostHoverBackground: (0, _alpha.alpha)(theme['ic-brand-button--primary-bgd'], 10)
83
83
  },
84
84
  'canvas-high-contrast': {
85
- secondaryBorderColor: colors?.borderMedium,
86
- primaryInverseBorderColor: colors?.borderMedium
85
+ secondaryBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
86
+ primaryInverseBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium
87
87
  },
88
88
  instructure: {
89
89
  borderRadius: '999em',
@@ -99,29 +99,29 @@ const generateComponentTheme = theme => {
99
99
  const componentVariables = {
100
100
  transform: 'none',
101
101
  hoverTransform: 'none',
102
- fontFamily: typography?.fontFamily,
103
- fontWeight: typography?.fontWeightNormal,
102
+ fontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
103
+ fontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
104
104
  textTransform: 'none',
105
105
  letterSpacing: 'normal',
106
- borderRadius: borders?.radiusMedium,
107
- borderStyle: borders?.style,
108
- borderWidth: borders?.widthSmall,
109
- smallHeight: forms?.inputHeightSmall,
110
- smallFontSize: typography?.fontSizeSmall,
111
- smallPaddingHorizontal: spacing?.xSmall,
106
+ borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
107
+ borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
108
+ borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthSmall,
109
+ smallHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightSmall,
110
+ smallFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeSmall,
111
+ smallPaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
112
112
  smallPaddingTop: '0.375rem',
113
113
  smallPaddingBottom: '0.3125rem',
114
- mediumHeight: forms?.inputHeightMedium,
115
- mediumFontSize: typography?.fontSizeMedium,
116
- mediumPaddingHorizontal: spacing?.small,
114
+ mediumHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightMedium,
115
+ mediumFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
116
+ mediumPaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.small,
117
117
  mediumPaddingTop: '0.5625rem',
118
118
  mediumPaddingBottom: '0.5625rem',
119
- largeHeight: forms?.inputHeightLarge,
120
- largeFontSize: typography?.fontSizeLarge,
121
- largePaddingHorizontal: spacing?.medium,
119
+ largeHeight: forms === null || forms === void 0 ? void 0 : forms.inputHeightLarge,
120
+ largeFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeLarge,
121
+ largePaddingHorizontal: spacing === null || spacing === void 0 ? void 0 : spacing.medium,
122
122
  largePaddingTop: '0.6875rem',
123
123
  largePaddingBottom: '0.6875rem',
124
- lineHeight: typography?.lineHeightFit,
124
+ lineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightFit,
125
125
  iconSizeSmall: '1rem',
126
126
  iconSizeMedium: '1.25rem',
127
127
  iconSizeLarge: '1.625rem',
@@ -129,47 +129,47 @@ const generateComponentTheme = theme => {
129
129
  iconTextGapCondensed: spacing.xxSmall,
130
130
  ...generateButtonThemeVars({
131
131
  style: 'primary',
132
- backgroundColor: colors?.backgroundBrand,
133
- borderColor: colors?.borderBrand,
134
- textColor: colors?.textLightest,
135
- ghostTextColor: colors?.textBrand
132
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundBrand,
133
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderBrand,
134
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
135
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textBrand
136
136
  }),
137
137
  ...generateButtonThemeVars({
138
138
  style: 'secondary',
139
- backgroundColor: colors?.backgroundLight,
140
- borderColor: colors?.borderLight,
141
- ghostBorderColor: colors?.borderDarkest,
142
- textColor: colors?.textDarkest,
143
- ghostTextColor: colors?.textDarkest
139
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLight,
140
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderLight,
141
+ ghostBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderDarkest,
142
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
143
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest
144
144
  }),
145
145
  ...generateButtonThemeVars({
146
146
  style: 'success',
147
- backgroundColor: colors?.backgroundSuccess,
148
- borderColor: colors?.borderSuccess,
149
- textColor: colors?.textLightest,
150
- ghostTextColor: colors?.textSuccess
147
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundSuccess,
148
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderSuccess,
149
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
150
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textSuccess
151
151
  }),
152
152
  ...generateButtonThemeVars({
153
153
  style: 'danger',
154
- backgroundColor: colors?.backgroundDanger,
155
- borderColor: colors?.borderDanger,
156
- textColor: colors?.textLightest,
157
- ghostTextColor: colors?.textDanger
154
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundDanger,
155
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderDanger,
156
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textLightest,
157
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textDanger
158
158
  }),
159
159
  ...generateButtonThemeVars({
160
160
  style: 'primaryInverse',
161
- backgroundColor: colors?.backgroundLightest,
162
- borderColor: colors?.borderLightest,
163
- textColor: colors?.textDarkest,
164
- ghostTextColor: colors?.textLightest
161
+ backgroundColor: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
162
+ borderColor: colors === null || colors === void 0 ? void 0 : colors.borderLightest,
163
+ textColor: colors === null || colors === void 0 ? void 0 : colors.textDarkest,
164
+ ghostTextColor: colors === null || colors === void 0 ? void 0 : colors.textLightest
165
165
  }),
166
166
  // Overrides for primary-inverse to match what was previously the `light` button variant
167
- primaryInverseBorderColor: (0, _darken.darken)(colors?.borderLight, 10),
168
- primaryInverseHoverBackground: (0, _darken.darken)(colors?.backgroundLightest, 5),
169
- primaryInverseActiveBackground: colors?.backgroundLightest,
170
- primaryInverseActiveBoxShadow: `${activeShadow} ${(0, _darken.darken)(colors?.borderLightest, 25)}`,
167
+ primaryInverseBorderColor: (0, _darken.darken)(colors === null || colors === void 0 ? void 0 : colors.borderLight, 10),
168
+ primaryInverseHoverBackground: (0, _darken.darken)(colors === null || colors === void 0 ? void 0 : colors.backgroundLightest, 5),
169
+ primaryInverseActiveBackground: colors === null || colors === void 0 ? void 0 : colors.backgroundLightest,
170
+ primaryInverseActiveBoxShadow: `${activeShadow} ${(0, _darken.darken)(colors === null || colors === void 0 ? void 0 : colors.borderLightest, 25)}`,
171
171
  // Overrides for ghost hover states to ensure correct color contrast for a11y
172
- successGhostHoverBackground: (0, _alpha.alpha)(colors?.textSuccess, 1)
172
+ successGhostHoverBackground: (0, _alpha.alpha)(colors === null || colors === void 0 ? void 0 : colors.textSuccess, 1)
173
173
  };
174
174
  return { ...componentVariables,
175
175
  ...themeSpecificStyle[themeName]
@@ -57,11 +57,15 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
57
57
  }
58
58
 
59
59
  componentDidMount() {
60
- this.props.makeStyles?.();
60
+ var _this$props$makeStyle, _this$props;
61
+
62
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
61
63
  }
62
64
 
63
65
  componentDidUpdate() {
64
- this.props.makeStyles?.();
66
+ var _this$props$makeStyle2, _this$props2;
67
+
68
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
65
69
  }
66
70
 
67
71
  get interaction() {
@@ -76,23 +80,23 @@ let CloseButton = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
76
80
  }
77
81
 
78
82
  render() {
79
- const _this$props = this.props,
80
- screenReaderLabel = _this$props.screenReaderLabel,
81
- elementRef = _this$props.elementRef,
82
- size = _this$props.size,
83
- onClick = _this$props.onClick,
84
- margin = _this$props.margin,
85
- placement = _this$props.placement,
86
- offset = _this$props.offset,
87
- type = _this$props.type,
88
- as = _this$props.as,
89
- href = _this$props.href,
90
- cursor = _this$props.cursor,
91
- tabIndex = _this$props.tabIndex,
92
- styles = _this$props.styles,
93
- props = (0, _objectWithoutProperties2.default)(_this$props, _excluded);
83
+ const _this$props3 = this.props,
84
+ screenReaderLabel = _this$props3.screenReaderLabel,
85
+ elementRef = _this$props3.elementRef,
86
+ size = _this$props3.size,
87
+ onClick = _this$props3.onClick,
88
+ margin = _this$props3.margin,
89
+ placement = _this$props3.placement,
90
+ offset = _this$props3.offset,
91
+ type = _this$props3.type,
92
+ as = _this$props3.as,
93
+ href = _this$props3.href,
94
+ cursor = _this$props3.cursor,
95
+ tabIndex = _this$props3.tabIndex,
96
+ styles = _this$props3.styles,
97
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
94
98
  return (0, _emotion.jsx)("span", Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
95
- css: styles?.closeButton
99
+ css: styles === null || styles === void 0 ? void 0 : styles.closeButton
96
100
  }), (0, _emotion.jsx)(_BaseButton.BaseButton, {
97
101
  renderIcon: _IconXSolid.IconXSolid,
98
102
  elementRef: this.handleRef,
@@ -38,10 +38,10 @@ const generateComponentTheme = theme => {
38
38
  const spacing = theme.spacing,
39
39
  stacking = theme.stacking;
40
40
  const componentVariables = {
41
- offsetMedium: spacing?.medium,
42
- offsetSmall: spacing?.small,
43
- offsetXSmall: spacing?.xSmall,
44
- zIndex: stacking?.above
41
+ offsetMedium: spacing === null || spacing === void 0 ? void 0 : spacing.medium,
42
+ offsetSmall: spacing === null || spacing === void 0 ? void 0 : spacing.small,
43
+ offsetXSmall: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
44
+ zIndex: stacking === null || stacking === void 0 ? void 0 : stacking.above
45
45
  };
46
46
  return { ...componentVariables
47
47
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-buttons",
3
- "version": "8.18.0",
3
+ "version": "8.18.1-snapshot.2+ca4c1ff9d",
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.18.0",
27
- "@instructure/ui-test-locator": "8.18.0",
28
- "@instructure/ui-test-queries": "8.18.0",
29
- "@instructure/ui-test-utils": "8.18.0",
30
- "@instructure/ui-themes": "8.18.0"
26
+ "@instructure/ui-babel-preset": "8.18.1-snapshot.2+ca4c1ff9d",
27
+ "@instructure/ui-test-locator": "8.18.1-snapshot.2+ca4c1ff9d",
28
+ "@instructure/ui-test-queries": "8.18.1-snapshot.2+ca4c1ff9d",
29
+ "@instructure/ui-test-utils": "8.18.1-snapshot.2+ca4c1ff9d",
30
+ "@instructure/ui-themes": "8.18.1-snapshot.2+ca4c1ff9d"
31
31
  },
32
32
  "dependencies": {
33
33
  "@babel/runtime": "^7.13.10",
34
- "@instructure/console": "8.18.0",
35
- "@instructure/emotion": "8.18.0",
36
- "@instructure/shared-types": "8.18.0",
37
- "@instructure/ui-a11y-content": "8.18.0",
38
- "@instructure/ui-a11y-utils": "8.18.0",
39
- "@instructure/ui-color-utils": "8.18.0",
40
- "@instructure/ui-dom-utils": "8.18.0",
41
- "@instructure/ui-icons": "8.18.0",
42
- "@instructure/ui-position": "8.18.0",
43
- "@instructure/ui-react-utils": "8.18.0",
44
- "@instructure/ui-testable": "8.18.0",
45
- "@instructure/ui-tooltip": "8.18.0",
46
- "@instructure/ui-utils": "8.18.0",
47
- "@instructure/ui-view": "8.18.0",
34
+ "@instructure/console": "8.18.1-snapshot.2+ca4c1ff9d",
35
+ "@instructure/emotion": "8.18.1-snapshot.2+ca4c1ff9d",
36
+ "@instructure/shared-types": "8.18.1-snapshot.2+ca4c1ff9d",
37
+ "@instructure/ui-a11y-content": "8.18.1-snapshot.2+ca4c1ff9d",
38
+ "@instructure/ui-a11y-utils": "8.18.1-snapshot.2+ca4c1ff9d",
39
+ "@instructure/ui-color-utils": "8.18.1-snapshot.2+ca4c1ff9d",
40
+ "@instructure/ui-dom-utils": "8.18.1-snapshot.2+ca4c1ff9d",
41
+ "@instructure/ui-icons": "8.18.1-snapshot.2+ca4c1ff9d",
42
+ "@instructure/ui-position": "8.18.1-snapshot.2+ca4c1ff9d",
43
+ "@instructure/ui-react-utils": "8.18.1-snapshot.2+ca4c1ff9d",
44
+ "@instructure/ui-testable": "8.18.1-snapshot.2+ca4c1ff9d",
45
+ "@instructure/ui-tooltip": "8.18.1-snapshot.2+ca4c1ff9d",
46
+ "@instructure/ui-utils": "8.18.1-snapshot.2+ca4c1ff9d",
47
+ "@instructure/ui-view": "8.18.1-snapshot.2+ca4c1ff9d",
48
48
  "keycode": "^2",
49
49
  "prop-types": "^15"
50
50
  },
@@ -54,5 +54,6 @@
54
54
  "publishConfig": {
55
55
  "access": "public"
56
56
  },
57
- "sideEffects": false
57
+ "sideEffects": false,
58
+ "gitHead": "ca4c1ff9d3985151ae0758fb596de41652dbb58b"
58
59
  }