@instructure/ui-alerts 11.6.0 → 11.6.1-pr-snapshot-1779894247159

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,6 +3,14 @@
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
+ ## [11.6.1-pr-snapshot-1779894247159](https://github.com/instructure/instructure-ui/compare/v11.6.0...v11.6.1-pr-snapshot-1779894247159) (2026-05-27)
7
+
8
+ **Note:** Version bump only for package @instructure/ui-alerts
9
+
10
+
11
+
12
+
13
+
6
14
  # [11.6.0](https://github.com/instructure/instructure-ui/compare/v11.5.0...v11.6.0) (2026-02-18)
7
15
 
8
16
  **Note:** Version bump only for package @instructure/ui-alerts
@@ -1,9 +1,3 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.allowedProps = void 0;
7
1
  /*
8
2
  * The MIT License (MIT)
9
3
  *
@@ -28,4 +22,16 @@ exports.allowedProps = void 0;
28
22
  * SOFTWARE.
29
23
  */
30
24
 
31
- const allowedProps = exports.allowedProps = ['children', 'variant', 'margin', 'liveRegion', 'liveRegionPoliteness', 'isLiveRegionAtomic', 'screenReaderOnly', 'timeout', 'renderCloseButtonLabel', 'onDismiss', 'transition', 'open', 'hasShadow', 'renderCustomIcon'];
25
+ module.exports = {
26
+ presets: [
27
+ [
28
+ require('@instructure/ui-babel-preset'),
29
+ {
30
+ coverage: Boolean(process.env.COVERAGE),
31
+ esModules: Boolean(process.env.ES_MODULES),
32
+ removeConsole: process.env.NODE_ENV === 'production',
33
+ transformImports: Boolean(process.env.TRANSFORM_IMPORTS)
34
+ }
35
+ ]
36
+ ]
37
+ }
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@instructure/ui-alerts",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-pr-snapshot-1779894247159",
4
+ "type": "module",
4
5
  "description": "An alert component",
5
6
  "author": "Instructure, Inc. Engineering and Product Design",
6
7
  "module": "./es/index.js",
7
- "main": "./lib/index.js",
8
8
  "types": "./types/index.d.ts",
9
9
  "repository": {
10
10
  "type": "git",
@@ -16,26 +16,26 @@
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
18
  "keycode": "^2",
19
- "@instructure/shared-types": "11.6.0",
20
- "@instructure/console": "11.6.0",
21
- "@instructure/ui-a11y-content": "11.6.0",
22
- "@instructure/ui-buttons": "11.6.0",
23
- "@instructure/emotion": "11.6.0",
24
- "@instructure/ui-icons": "11.6.0",
25
- "@instructure/ui-react-utils": "11.6.0",
26
- "@instructure/ui-motion": "11.6.0",
27
- "@instructure/ui-themes": "11.6.0",
28
- "@instructure/ui-view": "11.6.0"
19
+ "@instructure/console": "11.6.1-pr-snapshot-1779894247159",
20
+ "@instructure/emotion": "11.6.1-pr-snapshot-1779894247159",
21
+ "@instructure/ui-buttons": "11.6.1-pr-snapshot-1779894247159",
22
+ "@instructure/ui-a11y-content": "11.6.1-pr-snapshot-1779894247159",
23
+ "@instructure/shared-types": "11.6.1-pr-snapshot-1779894247159",
24
+ "@instructure/ui-icons": "11.6.1-pr-snapshot-1779894247159",
25
+ "@instructure/ui-react-utils": "11.6.1-pr-snapshot-1779894247159",
26
+ "@instructure/ui-motion": "11.6.1-pr-snapshot-1779894247159",
27
+ "@instructure/ui-themes": "11.6.1-pr-snapshot-1779894247159",
28
+ "@instructure/ui-view": "11.6.1-pr-snapshot-1779894247159"
29
29
  },
30
30
  "devDependencies": {
31
31
  "@testing-library/jest-dom": "^6.6.3",
32
32
  "@testing-library/react": "15.0.7",
33
33
  "@testing-library/user-event": "^14.6.1",
34
34
  "vitest": "^3.2.2",
35
- "@instructure/ui-babel-preset": "11.6.0",
36
- "@instructure/ui-scripts": "11.6.0",
37
- "@instructure/ui-color-utils": "11.6.0",
38
- "@instructure/ui-axe-check": "11.6.0"
35
+ "@instructure/ui-axe-check": "11.6.1-pr-snapshot-1779894247159",
36
+ "@instructure/ui-babel-preset": "11.6.1-pr-snapshot-1779894247159",
37
+ "@instructure/ui-color-utils": "11.6.1-pr-snapshot-1779894247159",
38
+ "@instructure/ui-scripts": "11.6.1-pr-snapshot-1779894247159"
39
39
  },
40
40
  "peerDependencies": {
41
41
  "react": ">=18 <=19",
@@ -49,10 +49,8 @@
49
49
  ".": {
50
50
  "types": "./types/index.d.ts",
51
51
  "import": "./es/index.js",
52
- "require": "./lib/index.js",
53
52
  "default": "./es/index.js"
54
53
  },
55
- "./lib/*": "./lib/*",
56
54
  "./es/*": "./es/*",
57
55
  "./types/*": "./types/*",
58
56
  "./package.json": "./package.json",
@@ -62,7 +60,7 @@
62
60
  "lint": "ui-scripts lint",
63
61
  "lint:fix": "ui-scripts lint --fix",
64
62
  "clean": "ui-scripts clean",
65
- "build": "ui-scripts build --modules es,cjs",
63
+ "build": "ui-scripts build",
66
64
  "build:watch": "pnpm run ts:check -- --watch & ui-scripts build --watch",
67
65
  "build:types": "tsc -p tsconfig.build.json",
68
66
  "ts:check": "tsc -p tsconfig.build.json --noEmit --emitDeclarationOnly false"
@@ -1,274 +0,0 @@
1
- "use strict";
2
-
3
- var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
- Object.defineProperty(exports, "__esModule", {
5
- value: true
6
- });
7
- exports.default = exports.Alert = void 0;
8
- var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
- var _react = require("react");
10
- var _reactDom = _interopRequireDefault(require("react-dom"));
11
- var _keycode = _interopRequireDefault(require("keycode"));
12
- var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
13
- var _withDeterministicId = require("@instructure/ui-react-utils/lib/DeterministicIdContext/withDeterministicId.js");
14
- var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
15
- var _CloseButton = require("@instructure/ui-buttons/lib/CloseButton");
16
- var _View = require("@instructure/ui-view/lib/View");
17
- var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
18
- var _IconCheckMarkSolid = require("@instructure/ui-icons/lib/IconCheckMarkSolid.js");
19
- var _IconInfoBorderlessSolid = require("@instructure/ui-icons/lib/IconInfoBorderlessSolid.js");
20
- var _IconWarningBorderlessSolid = require("@instructure/ui-icons/lib/IconWarningBorderlessSolid.js");
21
- var _IconNoSolid = require("@instructure/ui-icons/lib/IconNoSolid.js");
22
- var _Transition = require("@instructure/ui-motion/lib/Transition");
23
- var _console = require("@instructure/console");
24
- var _emotion = require("@instructure/emotion");
25
- var _styles = _interopRequireDefault(require("./styles"));
26
- var _theme = _interopRequireDefault(require("./theme"));
27
- var _props = require("./props");
28
- var _jsxRuntime = require("@emotion/react/jsx-runtime");
29
- const _excluded = ["margin", "styles", "children", "onDismiss", "variantScreenReaderLabel"];
30
- var _dec, _dec2, _class, _Alert;
31
- /*
32
- * The MIT License (MIT)
33
- *
34
- * Copyright (c) 2015 - present Instructure, Inc.
35
- *
36
- * Permission is hereby granted, free of charge, to any person obtaining a copy
37
- * of this software and associated documentation files (the "Software"), to deal
38
- * in the Software without restriction, including without limitation the rights
39
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
40
- * copies of the Software, and to permit persons to whom the Software is
41
- * furnished to do so, subject to the following conditions:
42
- *
43
- * The above copyright notice and this permission notice shall be included in all
44
- * copies or substantial portions of the Software.
45
- *
46
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
47
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
48
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
49
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
50
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
51
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
52
- * SOFTWARE.
53
- */
54
- /**
55
- ---
56
- category: components
57
- ---
58
- **/
59
- let Alert = exports.Alert = (_dec = (0, _withDeterministicId.withDeterministicId)(), _dec2 = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = _dec2(_class = (_Alert = class Alert extends _react.Component {
60
- constructor(props) {
61
- super(props);
62
- this._timeouts = [];
63
- this.srid = void 0;
64
- this.variantUI = {
65
- error: _IconNoSolid.IconNoSolid,
66
- info: _IconInfoBorderlessSolid.IconInfoBorderlessSolid,
67
- success: _IconCheckMarkSolid.IconCheckMarkSolid,
68
- warning: _IconWarningBorderlessSolid.IconWarningBorderlessSolid
69
- };
70
- this.ref = null;
71
- this.handleRef = el => {
72
- this.ref = el;
73
- };
74
- this.handleTimeout = () => {
75
- if (this.props.timeout > 0) {
76
- this._timeouts.push(setTimeout(() => {
77
- this.close();
78
- }, this.props.timeout));
79
- }
80
- };
81
- this.onExitTransition = () => {
82
- if (this.props.onDismiss) {
83
- this.props.onDismiss();
84
- }
85
- };
86
- this.close = () => {
87
- this.clearTimeouts();
88
- this.removeScreenreaderAlert();
89
- this.setState({
90
- open: false
91
- }, () => {
92
- if (this.props.onDismiss && (this.props.transition === 'none' || this.props.screenReaderOnly)) {
93
- this.props.onDismiss();
94
- }
95
- });
96
- };
97
- this.handleKeyUp = event => {
98
- if (this.props.renderCloseButtonLabel && event.keyCode === _keycode.default.codes.esc) {
99
- this.close();
100
- }
101
- };
102
- this.srid = this.props.deterministicId();
103
- this.state = {
104
- open: true
105
- };
106
- }
107
- clearTimeouts() {
108
- this._timeouts.forEach(timeout => clearTimeout(timeout));
109
- this._timeouts = [];
110
- }
111
- // duck type for a dom node
112
- isDOMNode(n) {
113
- return n && typeof n === 'object' && n.nodeType === 1;
114
- }
115
- getLiveRegion() {
116
- const lr = typeof this.props.liveRegion === 'function' ? this.props.liveRegion() : this.props.liveRegion;
117
- return this.isDOMNode(lr) ? lr : null;
118
- }
119
- initLiveRegion(liveRegion) {
120
- (0, _console.logError)(liveRegion.getAttribute('role') === 'alert', `[Alert] live region must have role='alert' set on page load in order to announce content`);
121
- if (liveRegion) {
122
- liveRegion.setAttribute('aria-live', this.props.liveRegionPoliteness);
123
- // indicates what notifications the user agent will trigger when the
124
- // accessibility tree within a live region is modified.
125
- // additions: elements are added, text: Text content is added
126
- liveRegion.setAttribute('aria-relevant', 'additions text');
127
- liveRegion.setAttribute('aria-atomic', `${this.props.isLiveRegionAtomic}`);
128
- }
129
- }
130
- createScreenreaderContentNode() {
131
- return (0, _jsxRuntime.jsxs)(_ScreenReaderContent.ScreenReaderContent, {
132
- children: [this.props.variantScreenReaderLabel || '', " ", this.props.children]
133
- });
134
- }
135
- createScreenreaderAlert() {
136
- const liveRegion = this.getLiveRegion();
137
- if (liveRegion) {
138
- const div = document.createElement('div');
139
- div.setAttribute('id', this.srid);
140
- liveRegion.appendChild(div);
141
- }
142
- }
143
- removeScreenreaderAlert() {
144
- const liveRegion = this.getLiveRegion();
145
- if (liveRegion) {
146
- const div = document.getElementById(this.srid);
147
- if (div) {
148
- // Accessibility attributes must be removed for the deletion of the node
149
- // and then reapplied because JAWS/IE will not respect the
150
- // "aria-relevant" attribute and read when the node is deleted if
151
- // the attributes are in place
152
- liveRegion.removeAttribute('aria-live');
153
- liveRegion.removeAttribute('aria-relevant');
154
- liveRegion.removeAttribute('aria-atomic');
155
- this.initLiveRegion(liveRegion);
156
- }
157
- }
158
- }
159
- componentDidMount() {
160
- var _this$props$makeStyle, _this$props;
161
- (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
162
- const liveRegion = this.getLiveRegion();
163
- if (liveRegion) {
164
- this.initLiveRegion(liveRegion);
165
- }
166
- this.handleTimeout();
167
- }
168
- componentWillUnmount() {
169
- this.clearTimeouts();
170
- }
171
- componentDidUpdate(prevProps) {
172
- var _this$props$makeStyle2, _this$props2;
173
- (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
174
- if (!!this.props.open === false && !!this.props.open !== !!prevProps.open) {
175
- // this outside world is asking us to close the alert, which needs to
176
- // take place internally so the transition runs
177
- this.close();
178
- }
179
- }
180
- renderIcon() {
181
- const _this$props3 = this.props,
182
- renderCustomIcon = _this$props3.renderCustomIcon,
183
- variant = _this$props3.variant,
184
- styles = _this$props3.styles;
185
- const Icon = this.variantUI[variant];
186
- return (0, _jsxRuntime.jsx)("div", {
187
- css: styles === null || styles === void 0 ? void 0 : styles.icon,
188
- children: renderCustomIcon ? (0, _callRenderProp.callRenderProp)(renderCustomIcon) : (0, _jsxRuntime.jsx)(Icon, {})
189
- });
190
- }
191
- renderCloseButton() {
192
- var _this$props$styles;
193
- const closeButtonLabel = this.props.renderCloseButtonLabel && (0, _callRenderProp.callRenderProp)(this.props.renderCloseButtonLabel);
194
- return closeButtonLabel ? (0, _jsxRuntime.jsx)("div", {
195
- css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.closeButton,
196
- children: (0, _jsxRuntime.jsx)(_CloseButton.CloseButton, {
197
- onClick: this.close,
198
- size: "small",
199
- screenReaderLabel: closeButtonLabel
200
- })
201
- }, "closeButton") : null;
202
- }
203
- renderAlert() {
204
- // prevent onDismiss from being passed to the View component
205
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
206
- const _this$props4 = this.props,
207
- margin = _this$props4.margin,
208
- styles = _this$props4.styles,
209
- children = _this$props4.children,
210
- onDismiss = _this$props4.onDismiss,
211
- variantScreenReaderLabel = _this$props4.variantScreenReaderLabel,
212
- props = (0, _objectWithoutProperties2.default)(_this$props4, _excluded);
213
- return (0, _jsxRuntime.jsxs)(_View.View, {
214
- ...(0, _passthroughProps.passthroughProps)({
215
- ...props
216
- }),
217
- as: "div",
218
- margin: margin,
219
- css: styles === null || styles === void 0 ? void 0 : styles.alert,
220
- onKeyUp: this.handleKeyUp,
221
- elementRef: this.handleRef,
222
- children: [this.renderIcon(), (0, _jsxRuntime.jsxs)("div", {
223
- css: styles === null || styles === void 0 ? void 0 : styles.content,
224
- children: [variantScreenReaderLabel && (0, _jsxRuntime.jsx)("span", {
225
- css: styles === null || styles === void 0 ? void 0 : styles.variantScreenReaderLabel,
226
- children: variantScreenReaderLabel
227
- }), children]
228
- }), this.renderCloseButton()]
229
- });
230
- }
231
- createScreenReaderPortal(liveRegion) {
232
- const open = this.state.open;
233
- return open ? /*#__PURE__*/_reactDom.default.createPortal((0, _jsxRuntime.jsx)("div", {
234
- id: this.srid,
235
- children: this.createScreenreaderContentNode()
236
- }), liveRegion) : null;
237
- }
238
- render() {
239
- const liveRegion = this.getLiveRegion();
240
- const screenReaderContent = liveRegion ? this.createScreenReaderPortal(liveRegion) : null;
241
- // Don't render anything if screen reader only
242
- if (this.props.screenReaderOnly) {
243
- (0, _console.logError)(!!this.getLiveRegion(), `[Alert] The 'screenReaderOnly' prop must be used in conjunction with 'liveRegion'.`);
244
- return screenReaderContent;
245
- }
246
- if (this.props.transition === 'none') {
247
- return this.state.open ? (0, _jsxRuntime.jsxs)(_react.Fragment, {
248
- children: [screenReaderContent, this.renderAlert()]
249
- }) : null;
250
- }
251
- return (0, _jsxRuntime.jsxs)(_react.Fragment, {
252
- children: [screenReaderContent, (0, _jsxRuntime.jsx)(_Transition.Transition, {
253
- type: this.props.transition,
254
- transitionOnMount: true,
255
- in: this.state.open,
256
- unmountOnExit: true,
257
- onExited: this.onExitTransition,
258
- children: this.renderAlert()
259
- })]
260
- });
261
- }
262
- }, _Alert.displayName = "Alert", _Alert.componentId = 'Alert', _Alert.allowedProps = _props.allowedProps, _Alert.defaultProps = {
263
- variant: 'info',
264
- margin: 'x-small 0',
265
- timeout: 0,
266
- transition: 'fade',
267
- open: true,
268
- screenReaderOnly: false,
269
- liveRegionPoliteness: 'assertive',
270
- isLiveRegionAtomic: false,
271
- children: null,
272
- hasShadow: true
273
- }, _Alert)) || _class) || _class);
274
- var _default = exports.default = Alert;
@@ -1,139 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * ---
33
- * private: true
34
- * ---
35
- * Generates the style object from the theme and provided additional information
36
- * @param {Object} componentTheme The theme variable object.
37
- * @param {Object} props the props of the component, the style is applied to
38
- * @param {Object} state the state of the component, the style is applied to
39
- * @return {Object} The final style object, which will be used in the component
40
- */
41
- const generateStyle = (componentTheme, props) => {
42
- const variant = props.variant,
43
- hasShadow = props.hasShadow;
44
- const variantStyles = {
45
- error: {
46
- alert: {
47
- borderColor: componentTheme.dangerBorderColor
48
- },
49
- icon: {
50
- background: componentTheme.dangerIconBackground,
51
- borderRightColor: componentTheme.dangerIconBackground
52
- }
53
- },
54
- info: {
55
- alert: {
56
- borderColor: componentTheme.infoBorderColor
57
- },
58
- icon: {
59
- background: componentTheme.infoIconBackground,
60
- borderRightColor: componentTheme.infoIconBackground
61
- }
62
- },
63
- success: {
64
- alert: {
65
- borderColor: componentTheme.successBorderColor
66
- },
67
- icon: {
68
- backgroundColor: componentTheme.successIconBackground,
69
- borderRightColor: componentTheme.successIconBackground
70
- }
71
- },
72
- warning: {
73
- alert: {
74
- borderColor: componentTheme.warningBorderColor
75
- },
76
- icon: {
77
- background: componentTheme.warningIconBackground,
78
- borderRightColor: componentTheme.warningIconBackground
79
- }
80
- }
81
- };
82
- return {
83
- alert: {
84
- label: 'alert',
85
- color: componentTheme.color,
86
- background: componentTheme.background,
87
- boxSizing: 'border-box',
88
- display: 'flex',
89
- minWidth: '12rem',
90
- borderWidth: componentTheme.borderWidth,
91
- borderStyle: componentTheme.borderStyle,
92
- borderRadius: componentTheme.borderRadius,
93
- ...variantStyles[variant].alert,
94
- ...(hasShadow && {
95
- boxShadow: componentTheme.boxShadow
96
- })
97
- },
98
- icon: {
99
- color: componentTheme.iconColor,
100
- boxSizing: 'border-box',
101
- flex: '0 0 2.5rem',
102
- display: 'flex',
103
- alignItems: 'center',
104
- justifyContent: 'center',
105
- fontSize: '1.125rem',
106
- borderRight: `${componentTheme.borderWidth} ${componentTheme.borderStyle}`,
107
- margin: -1,
108
- borderStartStartRadius: componentTheme.borderRadius,
109
- borderEndStartRadius: componentTheme.borderRadius,
110
- ...variantStyles[variant].icon
111
- },
112
- closeButton: {
113
- boxSizing: 'border-box',
114
- display: 'flex',
115
- alignItems: 'flex-start',
116
- order: 1,
117
- marginTop: componentTheme.closeButtonMarginTop,
118
- marginRight: componentTheme.closeButtonMarginRight
119
- },
120
- content: {
121
- boxSizing: 'border-box',
122
- flex: 1,
123
- minWidth: '0.0625rem',
124
- fontSize: componentTheme.contentFontSize,
125
- fontFamily: componentTheme.contentFontFamily,
126
- fontWeight: componentTheme.contentFontWeight,
127
- lineHeight: componentTheme.contentLineHeight,
128
- padding: componentTheme.contentPadding
129
- },
130
- variantScreenReaderLabel: {
131
- position: 'absolute',
132
- height: '1px',
133
- width: '1px',
134
- overflow: 'hidden',
135
- margin: '-1px'
136
- }
137
- };
138
- };
139
- var _default = exports.default = generateStyle;
@@ -1,79 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
- /*
8
- * The MIT License (MIT)
9
- *
10
- * Copyright (c) 2015 - present Instructure, Inc.
11
- *
12
- * Permission is hereby granted, free of charge, to any person obtaining a copy
13
- * of this software and associated documentation files (the "Software"), to deal
14
- * in the Software without restriction, including without limitation the rights
15
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
16
- * copies of the Software, and to permit persons to whom the Software is
17
- * furnished to do so, subject to the following conditions:
18
- *
19
- * The above copyright notice and this permission notice shall be included in all
20
- * copies or substantial portions of the Software.
21
- *
22
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
23
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
24
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
25
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
26
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
27
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
28
- * SOFTWARE.
29
- */
30
-
31
- /**
32
- * Generates the theme object for the component from the theme and provided additional information
33
- * @param {Object} theme The actual theme object.
34
- * @return {Object} The final theme object with the overrides and component variables
35
- */
36
- const generateComponentTheme = theme => {
37
- var _colors$contrasts, _colors$contrasts2, _colors$contrasts3, _colors$contrasts4, _colors$contrasts5, _colors$contrasts6, _colors$contrasts7, _colors$contrasts8, _colors$contrasts9, _colors$contrasts0, _colors$contrasts1;
38
- const colors = theme.colors,
39
- spacing = theme.spacing,
40
- borders = theme.borders,
41
- typography = theme.typography,
42
- shadows = theme.shadows,
43
- themeName = theme.key;
44
- const themeSpecificStyle = {
45
- canvas: {
46
- color: theme['ic-brand-font-color-dark']
47
- }
48
- };
49
- const componentVariables = {
50
- background: colors === null || colors === void 0 ? void 0 : (_colors$contrasts = colors.contrasts) === null || _colors$contrasts === void 0 ? void 0 : _colors$contrasts.white1010,
51
- color: colors === null || colors === void 0 ? void 0 : (_colors$contrasts2 = colors.contrasts) === null || _colors$contrasts2 === void 0 ? void 0 : _colors$contrasts2.grey125125,
52
- marginTop: spacing === null || spacing === void 0 ? void 0 : spacing.small,
53
- borderRadius: borders === null || borders === void 0 ? void 0 : borders.radiusMedium,
54
- borderWidth: borders === null || borders === void 0 ? void 0 : borders.widthMedium,
55
- borderStyle: borders === null || borders === void 0 ? void 0 : borders.style,
56
- contentPadding: `${spacing === null || spacing === void 0 ? void 0 : spacing.small} ${spacing === null || spacing === void 0 ? void 0 : spacing.medium}`,
57
- contentFontSize: typography === null || typography === void 0 ? void 0 : typography.fontSizeMedium,
58
- contentFontFamily: typography === null || typography === void 0 ? void 0 : typography.fontFamily,
59
- contentFontWeight: typography === null || typography === void 0 ? void 0 : typography.fontWeightNormal,
60
- contentLineHeight: typography === null || typography === void 0 ? void 0 : typography.lineHeightCondensed,
61
- closeButtonMarginTop: spacing === null || spacing === void 0 ? void 0 : spacing.xSmall,
62
- closeButtonMarginRight: spacing === null || spacing === void 0 ? void 0 : spacing.xxSmall,
63
- iconColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts3 = colors.contrasts) === null || _colors$contrasts3 === void 0 ? void 0 : _colors$contrasts3.white1010,
64
- successBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts4 = colors.contrasts) === null || _colors$contrasts4 === void 0 ? void 0 : _colors$contrasts4.green4570,
65
- successIconBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts5 = colors.contrasts) === null || _colors$contrasts5 === void 0 ? void 0 : _colors$contrasts5.green4570,
66
- infoBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts6 = colors.contrasts) === null || _colors$contrasts6 === void 0 ? void 0 : _colors$contrasts6.blue4570,
67
- infoIconBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts7 = colors.contrasts) === null || _colors$contrasts7 === void 0 ? void 0 : _colors$contrasts7.blue4570,
68
- warningBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts8 = colors.contrasts) === null || _colors$contrasts8 === void 0 ? void 0 : _colors$contrasts8.orange4570,
69
- warningIconBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts9 = colors.contrasts) === null || _colors$contrasts9 === void 0 ? void 0 : _colors$contrasts9.orange4570,
70
- dangerBorderColor: colors === null || colors === void 0 ? void 0 : (_colors$contrasts0 = colors.contrasts) === null || _colors$contrasts0 === void 0 ? void 0 : _colors$contrasts0.red4570,
71
- dangerIconBackground: colors === null || colors === void 0 ? void 0 : (_colors$contrasts1 = colors.contrasts) === null || _colors$contrasts1 === void 0 ? void 0 : _colors$contrasts1.red4570,
72
- boxShadow: shadows === null || shadows === void 0 ? void 0 : shadows.depth2
73
- };
74
- return {
75
- ...componentVariables,
76
- ...themeSpecificStyle[themeName]
77
- };
78
- };
79
- var _default = exports.default = generateComponentTheme;
package/lib/index.js DELETED
@@ -1,12 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- Object.defineProperty(exports, "Alert", {
7
- enumerable: true,
8
- get: function () {
9
- return _Alert.Alert;
10
- }
11
- });
12
- var _Alert = require("./Alert");
package/lib/package.json DELETED
@@ -1 +0,0 @@
1
- {"type":"commonjs"}