@instructure/ui-alerts 10.21.0 → 10.21.1-snapshot-1
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 +11 -0
- package/es/Alert/index.js +16 -13
- package/es/Alert/props.js +3 -2
- package/es/Alert/styles.js +3 -0
- package/lib/Alert/index.js +16 -13
- package/lib/Alert/props.js +3 -2
- package/lib/Alert/styles.js +3 -0
- package/package.json +15 -15
- package/src/Alert/index.tsx +4 -3
- package/src/Alert/props.ts +9 -2
- package/src/Alert/styles.ts +3 -0
- package/tsconfig.build.tsbuildinfo +1 -1
- package/types/Alert/index.d.ts +2 -0
- package/types/Alert/index.d.ts.map +1 -1
- package/types/Alert/props.d.ts +4 -0
- package/types/Alert/props.d.ts.map +1 -1
- package/types/Alert/styles.d.ts.map +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
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.21.1-snapshot-1](https://github.com/instructure/instructure-ui/compare/v10.21.0...v10.21.1-snapshot-1) (2025-07-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **ui-alerts:** fix Alert border radius override and add new prop for custom icon ([78ef567](https://github.com/instructure/instructure-ui/commit/78ef56729411333e4504c7080460df40ff9e718e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [10.21.0](https://github.com/instructure/instructure-ui/compare/v10.20.1...v10.21.0) (2025-06-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @instructure/ui-alerts
|
package/es/Alert/index.js
CHANGED
|
@@ -170,18 +170,21 @@ let Alert = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
renderIcon() {
|
|
173
|
-
|
|
174
|
-
|
|
173
|
+
const _this$props3 = this.props,
|
|
174
|
+
renderCustomIcon = _this$props3.renderCustomIcon,
|
|
175
|
+
variant = _this$props3.variant,
|
|
176
|
+
styles = _this$props3.styles;
|
|
177
|
+
const Icon = this.variantUI[variant];
|
|
175
178
|
return _jsx("div", {
|
|
176
|
-
css:
|
|
177
|
-
children: _jsx(Icon, {})
|
|
179
|
+
css: styles === null || styles === void 0 ? void 0 : styles.icon,
|
|
180
|
+
children: renderCustomIcon ? callRenderProp(renderCustomIcon) : _jsx(Icon, {})
|
|
178
181
|
});
|
|
179
182
|
}
|
|
180
183
|
renderCloseButton() {
|
|
181
|
-
var _this$props$
|
|
184
|
+
var _this$props$styles;
|
|
182
185
|
const closeButtonLabel = this.props.renderCloseButtonLabel && callRenderProp(this.props.renderCloseButtonLabel);
|
|
183
186
|
return closeButtonLabel ? _jsx("div", {
|
|
184
|
-
css: (_this$props$
|
|
187
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.closeButton,
|
|
185
188
|
children: _jsx(CloseButton, {
|
|
186
189
|
onClick: this.close,
|
|
187
190
|
size: "small",
|
|
@@ -192,13 +195,13 @@ let Alert = (_dec = withDeterministicId(), _dec2 = withStyle(generateStyle, gene
|
|
|
192
195
|
renderAlert() {
|
|
193
196
|
// prevent onDismiss from being passed to the View component
|
|
194
197
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
195
|
-
const _this$
|
|
196
|
-
margin = _this$
|
|
197
|
-
styles = _this$
|
|
198
|
-
children = _this$
|
|
199
|
-
onDismiss = _this$
|
|
200
|
-
variantScreenReaderLabel = _this$
|
|
201
|
-
props = _objectWithoutProperties(_this$
|
|
198
|
+
const _this$props4 = this.props,
|
|
199
|
+
margin = _this$props4.margin,
|
|
200
|
+
styles = _this$props4.styles,
|
|
201
|
+
children = _this$props4.children,
|
|
202
|
+
onDismiss = _this$props4.onDismiss,
|
|
203
|
+
variantScreenReaderLabel = _this$props4.variantScreenReaderLabel,
|
|
204
|
+
props = _objectWithoutProperties(_this$props4, _excluded);
|
|
202
205
|
return _jsxs(View, {
|
|
203
206
|
...passthroughProps({
|
|
204
207
|
...props
|
package/es/Alert/props.js
CHANGED
|
@@ -37,7 +37,8 @@ const propTypes = {
|
|
|
37
37
|
transition: PropTypes.oneOf(['none', 'fade']),
|
|
38
38
|
open: PropTypes.bool,
|
|
39
39
|
hasShadow: PropTypes.bool,
|
|
40
|
-
variantScreenReaderLabel: PropTypes.string
|
|
40
|
+
variantScreenReaderLabel: PropTypes.string,
|
|
41
|
+
renderCustomIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
41
42
|
};
|
|
42
|
-
const allowedProps = ['children', 'variant', 'margin', 'liveRegion', 'liveRegionPoliteness', 'isLiveRegionAtomic', 'screenReaderOnly', 'timeout', 'renderCloseButtonLabel', 'onDismiss', 'transition', 'open', 'hasShadow'];
|
|
43
|
+
const allowedProps = ['children', 'variant', 'margin', 'liveRegion', 'liveRegionPoliteness', 'isLiveRegionAtomic', 'screenReaderOnly', 'timeout', 'renderCloseButtonLabel', 'onDismiss', 'transition', 'open', 'hasShadow', 'renderCustomIcon'];
|
|
43
44
|
export { propTypes, allowedProps };
|
package/es/Alert/styles.js
CHANGED
|
@@ -98,6 +98,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
98
98
|
justifyContent: 'center',
|
|
99
99
|
fontSize: '1.125rem',
|
|
100
100
|
borderRight: `${componentTheme.borderWidth} ${componentTheme.borderStyle}`,
|
|
101
|
+
margin: -1,
|
|
102
|
+
borderStartStartRadius: componentTheme.borderRadius,
|
|
103
|
+
borderEndStartRadius: componentTheme.borderRadius,
|
|
101
104
|
...variantStyles[variant].icon
|
|
102
105
|
},
|
|
103
106
|
closeButton: {
|
package/lib/Alert/index.js
CHANGED
|
@@ -181,18 +181,21 @@ let Alert = exports.Alert = (_dec = (0, _withDeterministicId.withDeterministicId
|
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
183
|
renderIcon() {
|
|
184
|
-
|
|
185
|
-
|
|
184
|
+
const _this$props3 = this.props,
|
|
185
|
+
renderCustomIcon = _this$props3.renderCustomIcon,
|
|
186
|
+
variant = _this$props3.variant,
|
|
187
|
+
styles = _this$props3.styles;
|
|
188
|
+
const Icon = this.variantUI[variant];
|
|
186
189
|
return (0, _jsxRuntime.jsx)("div", {
|
|
187
|
-
css:
|
|
188
|
-
children: (0, _jsxRuntime.jsx)(Icon, {})
|
|
190
|
+
css: styles === null || styles === void 0 ? void 0 : styles.icon,
|
|
191
|
+
children: renderCustomIcon ? (0, _callRenderProp.callRenderProp)(renderCustomIcon) : (0, _jsxRuntime.jsx)(Icon, {})
|
|
189
192
|
});
|
|
190
193
|
}
|
|
191
194
|
renderCloseButton() {
|
|
192
|
-
var _this$props$
|
|
195
|
+
var _this$props$styles;
|
|
193
196
|
const closeButtonLabel = this.props.renderCloseButtonLabel && (0, _callRenderProp.callRenderProp)(this.props.renderCloseButtonLabel);
|
|
194
197
|
return closeButtonLabel ? (0, _jsxRuntime.jsx)("div", {
|
|
195
|
-
css: (_this$props$
|
|
198
|
+
css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.closeButton,
|
|
196
199
|
children: (0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
|
|
197
200
|
onClick: this.close,
|
|
198
201
|
size: "small",
|
|
@@ -203,13 +206,13 @@ let Alert = exports.Alert = (_dec = (0, _withDeterministicId.withDeterministicId
|
|
|
203
206
|
renderAlert() {
|
|
204
207
|
// prevent onDismiss from being passed to the View component
|
|
205
208
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
206
|
-
const _this$
|
|
207
|
-
margin = _this$
|
|
208
|
-
styles = _this$
|
|
209
|
-
children = _this$
|
|
210
|
-
onDismiss = _this$
|
|
211
|
-
variantScreenReaderLabel = _this$
|
|
212
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
209
|
+
const _this$props4 = this.props,
|
|
210
|
+
margin = _this$props4.margin,
|
|
211
|
+
styles = _this$props4.styles,
|
|
212
|
+
children = _this$props4.children,
|
|
213
|
+
onDismiss = _this$props4.onDismiss,
|
|
214
|
+
variantScreenReaderLabel = _this$props4.variantScreenReaderLabel,
|
|
215
|
+
props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
|
|
213
216
|
return (0, _jsxRuntime.jsxs)(_View.View, {
|
|
214
217
|
...(0, _passthroughProps.passthroughProps)({
|
|
215
218
|
...props
|
package/lib/Alert/props.js
CHANGED
|
@@ -44,6 +44,7 @@ const propTypes = exports.propTypes = {
|
|
|
44
44
|
transition: _propTypes.default.oneOf(['none', 'fade']),
|
|
45
45
|
open: _propTypes.default.bool,
|
|
46
46
|
hasShadow: _propTypes.default.bool,
|
|
47
|
-
variantScreenReaderLabel: _propTypes.default.string
|
|
47
|
+
variantScreenReaderLabel: _propTypes.default.string,
|
|
48
|
+
renderCustomIcon: _propTypes.default.oneOfType([_propTypes.default.node, _propTypes.default.func])
|
|
48
49
|
};
|
|
49
|
-
const allowedProps = exports.allowedProps = ['children', 'variant', 'margin', 'liveRegion', 'liveRegionPoliteness', 'isLiveRegionAtomic', 'screenReaderOnly', 'timeout', 'renderCloseButtonLabel', 'onDismiss', 'transition', 'open', 'hasShadow'];
|
|
50
|
+
const allowedProps = exports.allowedProps = ['children', 'variant', 'margin', 'liveRegion', 'liveRegionPoliteness', 'isLiveRegionAtomic', 'screenReaderOnly', 'timeout', 'renderCloseButtonLabel', 'onDismiss', 'transition', 'open', 'hasShadow', 'renderCustomIcon'];
|
package/lib/Alert/styles.js
CHANGED
|
@@ -104,6 +104,9 @@ const generateStyle = (componentTheme, props) => {
|
|
|
104
104
|
justifyContent: 'center',
|
|
105
105
|
fontSize: '1.125rem',
|
|
106
106
|
borderRight: `${componentTheme.borderWidth} ${componentTheme.borderStyle}`,
|
|
107
|
+
margin: -1,
|
|
108
|
+
borderStartStartRadius: componentTheme.borderRadius,
|
|
109
|
+
borderEndStartRadius: componentTheme.borderRadius,
|
|
107
110
|
...variantStyles[variant].icon
|
|
108
111
|
},
|
|
109
112
|
closeButton: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-alerts",
|
|
3
|
-
"version": "10.21.
|
|
3
|
+
"version": "10.21.1-snapshot-1",
|
|
4
4
|
"description": "An alert component",
|
|
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.21.
|
|
27
|
-
"@instructure/ui-babel-preset": "10.21.
|
|
28
|
-
"@instructure/ui-color-utils": "10.21.
|
|
29
|
-
"@instructure/ui-scripts": "10.21.
|
|
26
|
+
"@instructure/ui-axe-check": "10.21.1-snapshot-1",
|
|
27
|
+
"@instructure/ui-babel-preset": "10.21.1-snapshot-1",
|
|
28
|
+
"@instructure/ui-color-utils": "10.21.1-snapshot-1",
|
|
29
|
+
"@instructure/ui-scripts": "10.21.1-snapshot-1",
|
|
30
30
|
"@testing-library/jest-dom": "^6.6.3",
|
|
31
31
|
"@testing-library/react": "^16.0.1",
|
|
32
32
|
"@testing-library/user-event": "^14.6.1",
|
|
@@ -34,16 +34,16 @@
|
|
|
34
34
|
},
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"@babel/runtime": "^7.27.6",
|
|
37
|
-
"@instructure/console": "10.21.
|
|
38
|
-
"@instructure/emotion": "10.21.
|
|
39
|
-
"@instructure/shared-types": "10.21.
|
|
40
|
-
"@instructure/ui-a11y-content": "10.21.
|
|
41
|
-
"@instructure/ui-buttons": "10.21.
|
|
42
|
-
"@instructure/ui-icons": "10.21.
|
|
43
|
-
"@instructure/ui-motion": "10.21.
|
|
44
|
-
"@instructure/ui-react-utils": "10.21.
|
|
45
|
-
"@instructure/ui-themes": "10.21.
|
|
46
|
-
"@instructure/ui-view": "10.21.
|
|
37
|
+
"@instructure/console": "10.21.1-snapshot-1",
|
|
38
|
+
"@instructure/emotion": "10.21.1-snapshot-1",
|
|
39
|
+
"@instructure/shared-types": "10.21.1-snapshot-1",
|
|
40
|
+
"@instructure/ui-a11y-content": "10.21.1-snapshot-1",
|
|
41
|
+
"@instructure/ui-buttons": "10.21.1-snapshot-1",
|
|
42
|
+
"@instructure/ui-icons": "10.21.1-snapshot-1",
|
|
43
|
+
"@instructure/ui-motion": "10.21.1-snapshot-1",
|
|
44
|
+
"@instructure/ui-react-utils": "10.21.1-snapshot-1",
|
|
45
|
+
"@instructure/ui-themes": "10.21.1-snapshot-1",
|
|
46
|
+
"@instructure/ui-view": "10.21.1-snapshot-1",
|
|
47
47
|
"keycode": "^2",
|
|
48
48
|
"prop-types": "^15.8.1"
|
|
49
49
|
},
|
package/src/Alert/index.tsx
CHANGED
|
@@ -237,10 +237,11 @@ class Alert extends Component<AlertProps, AlertState> {
|
|
|
237
237
|
}
|
|
238
238
|
|
|
239
239
|
renderIcon() {
|
|
240
|
-
const
|
|
240
|
+
const { renderCustomIcon, variant, styles } = this.props
|
|
241
|
+
const Icon = this.variantUI[variant!]
|
|
241
242
|
return (
|
|
242
|
-
<div css={
|
|
243
|
-
<Icon />
|
|
243
|
+
<div css={styles?.icon}>
|
|
244
|
+
{renderCustomIcon ? callRenderProp(renderCustomIcon) : <Icon />}
|
|
244
245
|
</div>
|
|
245
246
|
)
|
|
246
247
|
}
|
package/src/Alert/props.ts
CHANGED
|
@@ -109,6 +109,11 @@ type AlertOwnProps = {
|
|
|
109
109
|
* If the alert should have a shadow.
|
|
110
110
|
*/
|
|
111
111
|
hasShadow: boolean
|
|
112
|
+
|
|
113
|
+
/**
|
|
114
|
+
* An icon, or function that returns an icon. Setting it will override the variant's icon.
|
|
115
|
+
*/
|
|
116
|
+
renderCustomIcon?: Renderable
|
|
112
117
|
}
|
|
113
118
|
|
|
114
119
|
type PropKeys = keyof AlertOwnProps
|
|
@@ -137,7 +142,8 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
137
142
|
transition: PropTypes.oneOf(['none', 'fade']),
|
|
138
143
|
open: PropTypes.bool,
|
|
139
144
|
hasShadow: PropTypes.bool,
|
|
140
|
-
variantScreenReaderLabel: PropTypes.string
|
|
145
|
+
variantScreenReaderLabel: PropTypes.string,
|
|
146
|
+
renderCustomIcon: PropTypes.oneOfType([PropTypes.node, PropTypes.func])
|
|
141
147
|
}
|
|
142
148
|
|
|
143
149
|
const allowedProps: AllowedPropKeys = [
|
|
@@ -153,7 +159,8 @@ const allowedProps: AllowedPropKeys = [
|
|
|
153
159
|
'onDismiss',
|
|
154
160
|
'transition',
|
|
155
161
|
'open',
|
|
156
|
-
'hasShadow'
|
|
162
|
+
'hasShadow',
|
|
163
|
+
'renderCustomIcon'
|
|
157
164
|
]
|
|
158
165
|
|
|
159
166
|
type AlertState = {
|
package/src/Alert/styles.ts
CHANGED
|
@@ -95,6 +95,9 @@ const generateStyle = (
|
|
|
95
95
|
justifyContent: 'center',
|
|
96
96
|
fontSize: '1.125rem',
|
|
97
97
|
borderRight: `${componentTheme.borderWidth} ${componentTheme.borderStyle}`,
|
|
98
|
+
margin: -1,
|
|
99
|
+
borderStartStartRadius: componentTheme.borderRadius,
|
|
100
|
+
borderEndStartRadius: componentTheme.borderRadius,
|
|
98
101
|
...variantStyles[variant!].icon
|
|
99
102
|
},
|
|
100
103
|
closeButton: {
|