@instructure/ui-modal 11.6.0 → 11.6.1-snapshot-129

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.
Files changed (184) hide show
  1. package/CHANGELOG.md +49 -311
  2. package/es/Modal/{ModalBody → v1/ModalBody}/index.js +2 -2
  3. package/es/Modal/{ModalFooter → v1/ModalFooter}/index.js +1 -1
  4. package/es/Modal/{ModalHeader → v1/ModalHeader}/index.js +2 -2
  5. package/es/Modal/{index.js → v1/index.js} +2 -2
  6. package/es/Modal/v2/ModalBody/index.js +132 -0
  7. package/es/Modal/v2/ModalBody/props.js +26 -0
  8. package/es/Modal/v2/ModalBody/styles.js +68 -0
  9. package/es/Modal/v2/ModalContext.js +34 -0
  10. package/es/Modal/v2/ModalFooter/index.js +73 -0
  11. package/es/{index.js → Modal/v2/ModalFooter/props.js} +3 -1
  12. package/es/Modal/v2/ModalFooter/styles.js +60 -0
  13. package/es/Modal/v2/ModalHeader/index.js +112 -0
  14. package/es/Modal/v2/ModalHeader/props.js +26 -0
  15. package/es/Modal/v2/ModalHeader/styles.js +76 -0
  16. package/es/Modal/v2/index.js +259 -0
  17. package/es/Modal/v2/props.js +26 -0
  18. package/es/Modal/v2/styles.js +119 -0
  19. package/es/exports/a.js +24 -0
  20. package/es/exports/b.js +24 -0
  21. package/lib/Modal/{ModalBody → v1/ModalBody}/index.js +4 -4
  22. package/lib/Modal/{ModalFooter → v1/ModalFooter}/index.js +1 -1
  23. package/lib/Modal/{ModalHeader → v1/ModalHeader}/index.js +3 -3
  24. package/lib/Modal/v1/index.js +285 -0
  25. package/lib/Modal/v2/ModalBody/index.js +137 -0
  26. package/lib/Modal/v2/ModalBody/props.js +31 -0
  27. package/lib/Modal/v2/ModalBody/styles.js +74 -0
  28. package/lib/Modal/v2/ModalContext.js +39 -0
  29. package/lib/Modal/v2/ModalFooter/index.js +78 -0
  30. package/lib/Modal/v2/ModalFooter/props.js +31 -0
  31. package/lib/Modal/v2/ModalFooter/styles.js +66 -0
  32. package/lib/Modal/v2/ModalHeader/index.js +118 -0
  33. package/lib/Modal/v2/ModalHeader/props.js +31 -0
  34. package/lib/Modal/v2/ModalHeader/styles.js +82 -0
  35. package/lib/Modal/{index.js → v2/index.js} +3 -4
  36. package/lib/Modal/v2/props.js +31 -0
  37. package/lib/Modal/v2/styles.js +125 -0
  38. package/lib/{index.js → exports/a.js} +5 -5
  39. package/lib/exports/b.js +30 -0
  40. package/package.json +46 -24
  41. package/src/Modal/{ModalBody → v1/ModalBody}/index.tsx +2 -2
  42. package/src/Modal/{ModalFooter → v1/ModalFooter}/index.tsx +1 -1
  43. package/src/Modal/{ModalHeader → v1/ModalHeader}/index.tsx +3 -3
  44. package/src/Modal/{index.tsx → v1/index.tsx} +2 -2
  45. package/src/Modal/v2/ModalBody/index.tsx +164 -0
  46. package/src/Modal/v2/ModalBody/props.ts +72 -0
  47. package/src/Modal/v2/ModalBody/styles.ts +76 -0
  48. package/src/Modal/v2/ModalContext.ts +46 -0
  49. package/src/Modal/v2/ModalFooter/index.tsx +80 -0
  50. package/src/Modal/v2/ModalFooter/props.ts +50 -0
  51. package/src/Modal/v2/ModalFooter/styles.ts +74 -0
  52. package/src/Modal/v2/ModalHeader/index.tsx +138 -0
  53. package/src/Modal/v2/ModalHeader/props.ts +54 -0
  54. package/src/Modal/v2/ModalHeader/styles.ts +99 -0
  55. package/src/Modal/v2/README.md +673 -0
  56. package/src/Modal/v2/index.tsx +326 -0
  57. package/src/Modal/v2/props.ts +235 -0
  58. package/src/Modal/v2/styles.ts +130 -0
  59. package/src/{index.ts → exports/a.ts} +5 -5
  60. package/src/exports/b.ts +29 -0
  61. package/tsconfig.build.tsbuildinfo +1 -1
  62. package/types/Modal/v1/ModalBody/index.d.ts.map +1 -0
  63. package/types/Modal/v1/ModalBody/props.d.ts.map +1 -0
  64. package/types/Modal/v1/ModalBody/styles.d.ts.map +1 -0
  65. package/types/Modal/v1/ModalBody/theme.d.ts.map +1 -0
  66. package/types/Modal/v1/ModalContext.d.ts.map +1 -0
  67. package/types/Modal/v1/ModalFooter/index.d.ts.map +1 -0
  68. package/types/Modal/v1/ModalFooter/props.d.ts.map +1 -0
  69. package/types/Modal/v1/ModalFooter/styles.d.ts.map +1 -0
  70. package/types/Modal/v1/ModalFooter/theme.d.ts.map +1 -0
  71. package/types/Modal/v1/ModalHeader/index.d.ts.map +1 -0
  72. package/types/Modal/v1/ModalHeader/props.d.ts.map +1 -0
  73. package/types/Modal/v1/ModalHeader/styles.d.ts.map +1 -0
  74. package/types/Modal/v1/ModalHeader/theme.d.ts.map +1 -0
  75. package/types/Modal/v1/index.d.ts.map +1 -0
  76. package/types/Modal/v1/props.d.ts.map +1 -0
  77. package/types/Modal/v1/styles.d.ts.map +1 -0
  78. package/types/Modal/v1/theme.d.ts.map +1 -0
  79. package/types/Modal/v2/ModalBody/index.d.ts +36 -0
  80. package/types/Modal/v2/ModalBody/index.d.ts.map +1 -0
  81. package/types/Modal/v2/ModalBody/props.d.ts +23 -0
  82. package/types/Modal/v2/ModalBody/props.d.ts.map +1 -0
  83. package/types/Modal/v2/ModalBody/styles.d.ts +16 -0
  84. package/types/Modal/v2/ModalBody/styles.d.ts.map +1 -0
  85. package/types/Modal/v2/ModalContext.d.ts +17 -0
  86. package/types/Modal/v2/ModalContext.d.ts.map +1 -0
  87. package/types/Modal/v2/ModalFooter/index.d.ts +27 -0
  88. package/types/Modal/v2/ModalFooter/index.d.ts.map +1 -0
  89. package/types/Modal/v2/ModalFooter/props.d.ts +16 -0
  90. package/types/Modal/v2/ModalFooter/props.d.ts.map +1 -0
  91. package/types/Modal/v2/ModalFooter/styles.d.ts +16 -0
  92. package/types/Modal/v2/ModalFooter/styles.d.ts.map +1 -0
  93. package/types/Modal/v2/ModalHeader/index.d.ts +37 -0
  94. package/types/Modal/v2/ModalHeader/index.d.ts.map +1 -0
  95. package/types/Modal/v2/ModalHeader/props.d.ts +19 -0
  96. package/types/Modal/v2/ModalHeader/props.d.ts.map +1 -0
  97. package/types/Modal/v2/ModalHeader/styles.d.ts +16 -0
  98. package/types/Modal/v2/ModalHeader/styles.d.ts.map +1 -0
  99. package/types/Modal/v2/index.d.ts +54 -0
  100. package/types/Modal/v2/index.d.ts.map +1 -0
  101. package/types/Modal/v2/props.d.ts +132 -0
  102. package/types/Modal/v2/props.d.ts.map +1 -0
  103. package/types/Modal/v2/styles.d.ts +16 -0
  104. package/types/Modal/v2/styles.d.ts.map +1 -0
  105. package/types/exports/a.d.ts +6 -0
  106. package/types/exports/a.d.ts.map +1 -0
  107. package/types/exports/b.d.ts +6 -0
  108. package/types/exports/b.d.ts.map +1 -0
  109. package/types/Modal/ModalBody/index.d.ts.map +0 -1
  110. package/types/Modal/ModalBody/props.d.ts.map +0 -1
  111. package/types/Modal/ModalBody/styles.d.ts.map +0 -1
  112. package/types/Modal/ModalBody/theme.d.ts.map +0 -1
  113. package/types/Modal/ModalContext.d.ts.map +0 -1
  114. package/types/Modal/ModalFooter/index.d.ts.map +0 -1
  115. package/types/Modal/ModalFooter/props.d.ts.map +0 -1
  116. package/types/Modal/ModalFooter/styles.d.ts.map +0 -1
  117. package/types/Modal/ModalFooter/theme.d.ts.map +0 -1
  118. package/types/Modal/ModalHeader/index.d.ts.map +0 -1
  119. package/types/Modal/ModalHeader/props.d.ts.map +0 -1
  120. package/types/Modal/ModalHeader/styles.d.ts.map +0 -1
  121. package/types/Modal/ModalHeader/theme.d.ts.map +0 -1
  122. package/types/Modal/index.d.ts.map +0 -1
  123. package/types/Modal/props.d.ts.map +0 -1
  124. package/types/Modal/styles.d.ts.map +0 -1
  125. package/types/Modal/theme.d.ts.map +0 -1
  126. package/types/index.d.ts +0 -6
  127. package/types/index.d.ts.map +0 -1
  128. /package/es/Modal/{ModalBody → v1/ModalBody}/props.js +0 -0
  129. /package/es/Modal/{ModalBody → v1/ModalBody}/styles.js +0 -0
  130. /package/es/Modal/{ModalBody → v1/ModalBody}/theme.js +0 -0
  131. /package/es/Modal/{ModalContext.js → v1/ModalContext.js} +0 -0
  132. /package/es/Modal/{ModalFooter → v1/ModalFooter}/props.js +0 -0
  133. /package/es/Modal/{ModalFooter → v1/ModalFooter}/styles.js +0 -0
  134. /package/es/Modal/{ModalFooter → v1/ModalFooter}/theme.js +0 -0
  135. /package/es/Modal/{ModalHeader → v1/ModalHeader}/props.js +0 -0
  136. /package/es/Modal/{ModalHeader → v1/ModalHeader}/styles.js +0 -0
  137. /package/es/Modal/{ModalHeader → v1/ModalHeader}/theme.js +0 -0
  138. /package/es/Modal/{props.js → v1/props.js} +0 -0
  139. /package/es/Modal/{styles.js → v1/styles.js} +0 -0
  140. /package/es/Modal/{theme.js → v1/theme.js} +0 -0
  141. /package/lib/Modal/{ModalBody → v1/ModalBody}/props.js +0 -0
  142. /package/lib/Modal/{ModalBody → v1/ModalBody}/styles.js +0 -0
  143. /package/lib/Modal/{ModalBody → v1/ModalBody}/theme.js +0 -0
  144. /package/lib/Modal/{ModalContext.js → v1/ModalContext.js} +0 -0
  145. /package/lib/Modal/{ModalFooter → v1/ModalFooter}/props.js +0 -0
  146. /package/lib/Modal/{ModalFooter → v1/ModalFooter}/styles.js +0 -0
  147. /package/lib/Modal/{ModalFooter → v1/ModalFooter}/theme.js +0 -0
  148. /package/lib/Modal/{ModalHeader → v1/ModalHeader}/props.js +0 -0
  149. /package/lib/Modal/{ModalHeader → v1/ModalHeader}/styles.js +0 -0
  150. /package/lib/Modal/{ModalHeader → v1/ModalHeader}/theme.js +0 -0
  151. /package/lib/Modal/{props.js → v1/props.js} +0 -0
  152. /package/lib/Modal/{styles.js → v1/styles.js} +0 -0
  153. /package/lib/Modal/{theme.js → v1/theme.js} +0 -0
  154. /package/src/Modal/{ModalBody → v1/ModalBody}/props.ts +0 -0
  155. /package/src/Modal/{ModalBody → v1/ModalBody}/styles.ts +0 -0
  156. /package/src/Modal/{ModalBody → v1/ModalBody}/theme.ts +0 -0
  157. /package/src/Modal/{ModalContext.ts → v1/ModalContext.ts} +0 -0
  158. /package/src/Modal/{ModalFooter → v1/ModalFooter}/props.ts +0 -0
  159. /package/src/Modal/{ModalFooter → v1/ModalFooter}/styles.ts +0 -0
  160. /package/src/Modal/{ModalFooter → v1/ModalFooter}/theme.ts +0 -0
  161. /package/src/Modal/{ModalHeader → v1/ModalHeader}/props.ts +0 -0
  162. /package/src/Modal/{ModalHeader → v1/ModalHeader}/styles.ts +0 -0
  163. /package/src/Modal/{ModalHeader → v1/ModalHeader}/theme.ts +0 -0
  164. /package/src/Modal/{README.md → v1/README.md} +0 -0
  165. /package/src/Modal/{props.ts → v1/props.ts} +0 -0
  166. /package/src/Modal/{styles.ts → v1/styles.ts} +0 -0
  167. /package/src/Modal/{theme.ts → v1/theme.ts} +0 -0
  168. /package/types/Modal/{ModalBody → v1/ModalBody}/index.d.ts +0 -0
  169. /package/types/Modal/{ModalBody → v1/ModalBody}/props.d.ts +0 -0
  170. /package/types/Modal/{ModalBody → v1/ModalBody}/styles.d.ts +0 -0
  171. /package/types/Modal/{ModalBody → v1/ModalBody}/theme.d.ts +0 -0
  172. /package/types/Modal/{ModalContext.d.ts → v1/ModalContext.d.ts} +0 -0
  173. /package/types/Modal/{ModalFooter → v1/ModalFooter}/index.d.ts +0 -0
  174. /package/types/Modal/{ModalFooter → v1/ModalFooter}/props.d.ts +0 -0
  175. /package/types/Modal/{ModalFooter → v1/ModalFooter}/styles.d.ts +0 -0
  176. /package/types/Modal/{ModalFooter → v1/ModalFooter}/theme.d.ts +0 -0
  177. /package/types/Modal/{ModalHeader → v1/ModalHeader}/index.d.ts +0 -0
  178. /package/types/Modal/{ModalHeader → v1/ModalHeader}/props.d.ts +0 -0
  179. /package/types/Modal/{ModalHeader → v1/ModalHeader}/styles.d.ts +0 -0
  180. /package/types/Modal/{ModalHeader → v1/ModalHeader}/theme.d.ts +0 -0
  181. /package/types/Modal/{index.d.ts → v1/index.d.ts} +0 -0
  182. /package/types/Modal/{props.d.ts → v1/props.d.ts} +0 -0
  183. /package/types/Modal/{styles.d.ts → v1/styles.d.ts} +0 -0
  184. /package/types/Modal/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -0,0 +1,66 @@
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} sharedTokens Shared theme token object
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (componentTheme, props) => {
43
+ const variant = props.variant,
44
+ spacing = props.spacing;
45
+ const backgroundStyle = variant === 'inverse' ? {
46
+ background: componentTheme.inverseBackgroundColor,
47
+ borderTop: `${componentTheme.borderWidth} solid ${componentTheme.inverseBorderColor}`
48
+ } : {
49
+ background: componentTheme.backgroundColor,
50
+ borderTop: `${componentTheme.borderWidth} solid ${componentTheme.borderColor}`
51
+ };
52
+ return {
53
+ modalFooter: {
54
+ label: 'modalFooter',
55
+ flex: '0 0 auto',
56
+ boxSizing: 'border-box',
57
+ padding: spacing === 'compact' ? componentTheme.paddingCompact : componentTheme.padding,
58
+ borderBottomRightRadius: componentTheme.borderRadius,
59
+ borderBottomLeftRadius: componentTheme.borderRadius,
60
+ display: 'flex',
61
+ justifyContent: 'flex-end',
62
+ ...backgroundStyle
63
+ }
64
+ };
65
+ };
66
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,118 @@
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.ModalHeader = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
11
+ var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
12
+ var _emotion = require("@instructure/emotion");
13
+ var _latest = require("@instructure/ui-buttons/latest");
14
+ var _styles = _interopRequireDefault(require("./styles"));
15
+ var _props = require("./props");
16
+ var _ModalContext = _interopRequireDefault(require("../ModalContext"));
17
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
18
+ const _excluded = ["children"];
19
+ var _dec, _class, _ModalHeader;
20
+ /*
21
+ * The MIT License (MIT)
22
+ *
23
+ * Copyright (c) 2015 - present Instructure, Inc.
24
+ *
25
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
26
+ * of this software and associated documentation files (the "Software"), to deal
27
+ * in the Software without restriction, including without limitation the rights
28
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
29
+ * copies of the Software, and to permit persons to whom the Software is
30
+ * furnished to do so, subject to the following conditions:
31
+ *
32
+ * The above copyright notice and this permission notice shall be included in all
33
+ * copies or substantial portions of the Software.
34
+ *
35
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
36
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
37
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
38
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
39
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
40
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
41
+ * SOFTWARE.
42
+ */
43
+ /**
44
+ ---
45
+ parent: Modal
46
+ id: Modal.Header
47
+ ---
48
+ **/
49
+ let ModalHeader = exports.ModalHeader = (_dec = (0, _emotion.withStyle)(_styles.default, 'ModalHeader'), _dec(_class = (_ModalHeader = class ModalHeader extends _react.Component {
50
+ constructor(...args) {
51
+ super(...args);
52
+ this.ref = null;
53
+ /**
54
+ * Gets all text in a DOM subtree, text under <button> nodes is excluded
55
+ */
56
+ this.getTextExcludingButtons = root => {
57
+ const walker = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
58
+ acceptNode(node) {
59
+ var _node$parentElement;
60
+ return (_node$parentElement = node.parentElement) !== null && _node$parentElement !== void 0 && _node$parentElement.closest('button') ? NodeFilter.FILTER_REJECT : NodeFilter.FILTER_ACCEPT;
61
+ }
62
+ });
63
+ let text = '';
64
+ let current;
65
+ while (current = walker.nextNode()) {
66
+ text += current.nodeValue;
67
+ }
68
+ return text;
69
+ };
70
+ this.handleRef = el => {
71
+ this.ref = el;
72
+ if (el) {
73
+ var _this$context$setBody, _this$context;
74
+ const txt = this.getTextExcludingButtons(el);
75
+ (_this$context$setBody = (_this$context = this.context).setBodyScrollAriaLabel) === null || _this$context$setBody === void 0 ? void 0 : _this$context$setBody.call(_this$context, txt);
76
+ }
77
+ };
78
+ this.makeStyleProps = () => {
79
+ return {
80
+ withCloseButton: this.usesCloseButton
81
+ };
82
+ };
83
+ }
84
+ componentDidMount() {
85
+ var _this$props$makeStyle, _this$props;
86
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStyleProps());
87
+ }
88
+ componentDidUpdate() {
89
+ var _this$props$makeStyle2, _this$props2;
90
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStyleProps());
91
+ }
92
+ get usesCloseButton() {
93
+ let hasCloseButton = false;
94
+ _react.Children.forEach(this.props.children, child => {
95
+ if (child && (0, _matchComponentTypes.matchComponentTypes)(child, [_latest.CloseButton])) {
96
+ hasCloseButton = true;
97
+ }
98
+ });
99
+ return hasCloseButton;
100
+ }
101
+ render() {
102
+ var _this$props$styles;
103
+ const _this$props3 = this.props,
104
+ children = _this$props3.children,
105
+ rest = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
106
+ return (0, _jsxRuntime.jsx)("div", {
107
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.modalHeader,
108
+ ...(0, _passthroughProps.passthroughProps)(rest),
109
+ ref: this.handleRef,
110
+ "data-cid": "ModalHeader",
111
+ children: children
112
+ });
113
+ }
114
+ }, _ModalHeader.displayName = "ModalHeader", _ModalHeader.componentId = 'Modal.Header', _ModalHeader.allowedProps = _props.allowedProps, _ModalHeader.defaultProps = {
115
+ variant: 'default',
116
+ spacing: 'default'
117
+ }, _ModalHeader.contextType = _ModalContext.default, _ModalHeader)) || _class);
118
+ var _default = exports.default = ModalHeader;
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = 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
+ const allowedProps = exports.allowedProps = ['children', 'variant', 'spacing'];
@@ -0,0 +1,82 @@
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} _sharedTokens Shared theme token object (unused)
39
+ * @param {Object} state the state of the component, the style is applied to
40
+ * @return {Object} The final style object, which will be used in the component
41
+ */
42
+ const generateStyle = (componentTheme, props, _sharedTokens, state) => {
43
+ const variant = props.variant,
44
+ spacing = props.spacing;
45
+ const withCloseButton = state.withCloseButton;
46
+ const sizeVariants = {
47
+ default: {
48
+ padding: componentTheme.padding,
49
+ paddingInlineStart: componentTheme.padding,
50
+ paddingInlineEnd: withCloseButton ? `calc(${componentTheme.padding} * 2 + 1em)` : componentTheme.padding
51
+ },
52
+ compact: {
53
+ padding: componentTheme.paddingCompact,
54
+ paddingInlineStart: componentTheme.paddingCompact,
55
+ paddingInlineEnd: withCloseButton ? `calc(${componentTheme.paddingCompact} * 2 + 1em)` : componentTheme.paddingCompact
56
+ }
57
+ };
58
+ const inverseStyle = variant === 'inverse' ? {
59
+ background: componentTheme.inverseBackgroundColor,
60
+ borderBottomColor: componentTheme.inverseBorderColor
61
+ } : {};
62
+ return {
63
+ modalHeader: {
64
+ borderTopLeftRadius: 'inherit',
65
+ borderTopRightRadius: 'inherit',
66
+ label: 'modalHeader',
67
+ boxSizing: 'border-box',
68
+ flex: '0 0 auto',
69
+ background: componentTheme.backgroundColor,
70
+ borderBottomWidth: componentTheme.borderWidth,
71
+ borderBottomStyle: 'solid',
72
+ borderBottomColor: componentTheme.borderColor,
73
+ ...sizeVariants[spacing],
74
+ ...inverseStyle,
75
+ // Position is set to relative for small viewports to ensure proper close button positioning during scrolling
76
+ '@media (max-height: 20rem)': {
77
+ position: 'relative'
78
+ }
79
+ }
80
+ };
81
+ };
82
+ var _default = exports.default = generateStyle;
@@ -32,13 +32,12 @@ var _createChainedFunction = require("@instructure/ui-utils/lib/createChainedFun
32
32
  var _Transition = require("@instructure/ui-motion/lib/Transition");
33
33
  var _Portal = require("@instructure/ui-portal/lib/Portal");
34
34
  var _Dialog = require("@instructure/ui-dialog/lib/Dialog");
35
- var _Mask = require("@instructure/ui-overlays/lib/Mask");
35
+ var _latest = require("@instructure/ui-overlays/latest");
36
36
  var _ModalHeader = require("./ModalHeader");
37
37
  var _ModalBody = require("./ModalBody");
38
38
  var _ModalFooter = require("./ModalFooter");
39
39
  var _emotion = require("@instructure/emotion");
40
40
  var _styles = _interopRequireDefault(require("./styles"));
41
- var _theme = _interopRequireDefault(require("./theme"));
42
41
  var _props = require("./props");
43
42
  var _ModalContext = _interopRequireDefault(require("./ModalContext"));
44
43
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
@@ -73,7 +72,7 @@ category: components
73
72
  tags: overlay, portal, dialog
74
73
  ---
75
74
  **/
76
- let Modal = exports.Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Modal = class Modal extends _react.Component {
75
+ let Modal = exports.Modal = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Modal = class Modal extends _react.Component {
77
76
  constructor(props) {
78
77
  var _props$open;
79
78
  super(props);
@@ -211,7 +210,7 @@ let Modal = exports.Modal = (_dec = (0, _emotion.withStyle)(_styles.default, _th
211
210
  ,
212
211
  children: this.renderChildren()
213
212
  });
214
- return (0, _jsxRuntime.jsx)(_Mask.Mask, {
213
+ return (0, _jsxRuntime.jsx)(_latest.Mask, {
215
214
  placement: this.maskPlacement,
216
215
  fullscreen: constrain === 'window',
217
216
  themeOverride: isFullScreen ? {
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = 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
+ const allowedProps = exports.allowedProps = ['label', 'children', 'as', 'size', 'variant', 'open', 'defaultFocusElement', 'shouldReturnFocus', 'shouldCloseOnDocumentClick', 'onOpen', 'onClose', 'onDismiss', 'contentRef', 'mountNode', 'insertAt', 'liveRegion', 'transition', 'onEnter', 'onEntering', 'onEntered', 'onExit', 'onExiting', 'onExited', 'constrain', 'overflow'];
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _uiThemes = require("@instructure/ui-themes");
8
+ /*
9
+ * The MIT License (MIT)
10
+ *
11
+ * Copyright (c) 2015 - present Instructure, Inc.
12
+ *
13
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
14
+ * of this software and associated documentation files (the "Software"), to deal
15
+ * in the Software without restriction, including without limitation the rights
16
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17
+ * copies of the Software, and to permit persons to whom the Software is
18
+ * furnished to do so, subject to the following conditions:
19
+ *
20
+ * The above copyright notice and this permission notice shall be included in all
21
+ * copies or substantial portions of the Software.
22
+ *
23
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
+ * SOFTWARE.
30
+ */
31
+
32
+ /**
33
+ * ---
34
+ * private: true
35
+ * ---
36
+ * Generates the style object from the theme and provided additional information
37
+ * @param {Object} componentTheme The theme variable object.
38
+ * @param {Object} props the props of the component, the style is applied to
39
+ * @param {Object} sharedTokens Shared theme token object
40
+ * @param {Object} state the state of the component, the style is applied to
41
+ * @return {Object} The final style object, which will be used in the component
42
+ */
43
+ const generateStyle = (componentTheme, props) => {
44
+ const size = props.size,
45
+ variant = props.variant,
46
+ overflow = props.overflow;
47
+ const commonSizeStyleExceptForFullscreen = {
48
+ maxWidth: '95%',
49
+ maxHeight: '95%',
50
+ ...(overflow === 'fit' && {
51
+ transform: 'translateY(2.5%)'
52
+ })
53
+ };
54
+ const sizeStyles = {
55
+ auto: {
56
+ flex: '0 1 auto',
57
+ minWidth: componentTheme.autoMinWidth,
58
+ ...commonSizeStyleExceptForFullscreen
59
+ },
60
+ small: {
61
+ flex: `0 1 ${componentTheme.smallMaxWidth}`,
62
+ ...commonSizeStyleExceptForFullscreen
63
+ },
64
+ medium: {
65
+ flex: `0 1 ${componentTheme.mediumMaxWidth}`,
66
+ ...commonSizeStyleExceptForFullscreen
67
+ },
68
+ large: {
69
+ flex: `0 1 ${componentTheme.largeMaxWidth}`,
70
+ ...commonSizeStyleExceptForFullscreen
71
+ },
72
+ fullscreen: {
73
+ flex: 1,
74
+ width: '100%',
75
+ height: '100%',
76
+ boxShadow: 'none',
77
+ border: 'none',
78
+ borderRadius: 0
79
+ }
80
+ };
81
+ const backgroundStyles = variant === 'inverse' ? {
82
+ background: componentTheme.inverseBackgroundColor,
83
+ border: `${componentTheme.borderWidth} solid ${componentTheme.inverseBorderColor}`,
84
+ color: componentTheme.inverseTextColor
85
+ } : {
86
+ background: componentTheme.backgroundColor,
87
+ border: `${componentTheme.borderWidth} solid ${componentTheme.borderColor}`,
88
+ color: componentTheme.textColor
89
+ };
90
+ return {
91
+ modal: {
92
+ label: 'modal',
93
+ fontFamily: componentTheme.fontFamily,
94
+ display: 'flex',
95
+ minWidth: '1px',
96
+ flexDirection: 'column',
97
+ position: 'relative',
98
+ boxSizing: 'border-box',
99
+ boxShadow: (0, _uiThemes.boxShadowObjectsToCSSString)(componentTheme.boxShadow),
100
+ borderRadius: componentTheme.borderRadius,
101
+ overflow: 'hidden',
102
+ ...sizeStyles[size],
103
+ ...backgroundStyles
104
+ },
105
+ constrainContext: {
106
+ label: 'modal__constrainContext',
107
+ display: 'block',
108
+ position: 'relative',
109
+ width: '100%',
110
+ height: '100%'
111
+ },
112
+ joinedHeaderAndBody: {
113
+ display: 'flex',
114
+ flexDirection: 'column',
115
+ overflow: 'hidden',
116
+ flex: '1 1 auto',
117
+ // ModalHeader and ModalBody is set to scrollable above 20rem height instead of just the ModalBody
118
+ '@media (max-height: 20rem)': {
119
+ overflowY: 'auto',
120
+ maxHeight: '20rem'
121
+ }
122
+ }
123
+ };
124
+ };
125
+ var _default = exports.default = generateStyle;
@@ -6,25 +6,25 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Modal", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Modal.Modal;
9
+ return _v.Modal;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "ModalBody", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Modal.ModalBody;
15
+ return _v.ModalBody;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "ModalFooter", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _Modal.ModalFooter;
21
+ return _v.ModalFooter;
22
22
  }
23
23
  });
24
24
  Object.defineProperty(exports, "ModalHeader", {
25
25
  enumerable: true,
26
26
  get: function () {
27
- return _Modal.ModalHeader;
27
+ return _v.ModalHeader;
28
28
  }
29
29
  });
30
- var _Modal = require("./Modal");
30
+ var _v = require("../Modal/v1");
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Modal", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Modal;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "ModalBody", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v.ModalBody;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "ModalFooter", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _v.ModalFooter;
22
+ }
23
+ });
24
+ Object.defineProperty(exports, "ModalHeader", {
25
+ enumerable: true,
26
+ get: function () {
27
+ return _v.ModalHeader;
28
+ }
29
+ });
30
+ var _v = require("../Modal/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-modal",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A component for displaying content in a dialog overlay",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,28 +15,28 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/shared-types": "11.6.0",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/console": "11.6.0",
21
- "@instructure/ui-buttons": "11.6.0",
22
- "@instructure/ui-dialog": "11.6.0",
23
- "@instructure/ui-motion": "11.6.0",
24
- "@instructure/ui-dom-utils": "11.6.0",
25
- "@instructure/ui-portal": "11.6.0",
26
- "@instructure/ui-overlays": "11.6.0",
27
- "@instructure/ui-react-utils": "11.6.0",
28
- "@instructure/ui-utils": "11.6.0",
29
- "@instructure/ui-view": "11.6.0"
18
+ "@instructure/console": "11.6.1-snapshot-129",
19
+ "@instructure/shared-types": "11.6.1-snapshot-129",
20
+ "@instructure/ui-buttons": "11.6.1-snapshot-129",
21
+ "@instructure/emotion": "11.6.1-snapshot-129",
22
+ "@instructure/ui-dialog": "11.6.1-snapshot-129",
23
+ "@instructure/ui-dom-utils": "11.6.1-snapshot-129",
24
+ "@instructure/ui-motion": "11.6.1-snapshot-129",
25
+ "@instructure/ui-overlays": "11.6.1-snapshot-129",
26
+ "@instructure/ui-portal": "11.6.1-snapshot-129",
27
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
28
+ "@instructure/ui-utils": "11.6.1-snapshot-129",
29
+ "@instructure/ui-view": "11.6.1-snapshot-129"
30
30
  },
31
31
  "devDependencies": {
32
32
  "@testing-library/jest-dom": "^6.6.3",
33
33
  "@testing-library/react": "15.0.7",
34
34
  "@testing-library/user-event": "^14.6.1",
35
35
  "vitest": "^3.2.2",
36
- "@instructure/ui-babel-preset": "11.6.0",
37
- "@instructure/ui-color-utils": "11.6.0",
38
- "@instructure/ui-position": "11.6.0",
39
- "@instructure/ui-themes": "11.6.0"
36
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
37
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
38
+ "@instructure/ui-position": "11.6.1-snapshot-129",
39
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "react": ">=18 <=19"
@@ -46,17 +46,39 @@
46
46
  },
47
47
  "sideEffects": false,
48
48
  "exports": {
49
- ".": {
50
- "types": "./types/index.d.ts",
51
- "import": "./es/index.js",
52
- "require": "./lib/index.js",
53
- "default": "./es/index.js"
54
- },
55
49
  "./lib/*": "./lib/*",
56
50
  "./es/*": "./es/*",
57
51
  "./types/*": "./types/*",
58
52
  "./package.json": "./package.json",
59
- "./src/*": "./src/*"
53
+ "./src/*": "./src/*",
54
+ ".": {
55
+ "src": "./src/exports/a.ts",
56
+ "types": "./types/exports/a.d.ts",
57
+ "import": "./es/exports/a.js",
58
+ "require": "./lib/exports/a.js",
59
+ "default": "./es/exports/a.js"
60
+ },
61
+ "./v11_6": {
62
+ "src": "./src/exports/a.ts",
63
+ "types": "./types/exports/a.d.ts",
64
+ "import": "./es/exports/a.js",
65
+ "require": "./lib/exports/a.js",
66
+ "default": "./es/exports/a.js"
67
+ },
68
+ "./v11_7": {
69
+ "src": "./src/exports/b.ts",
70
+ "types": "./types/exports/b.d.ts",
71
+ "import": "./es/exports/b.js",
72
+ "require": "./lib/exports/b.js",
73
+ "default": "./es/exports/b.js"
74
+ },
75
+ "./latest": {
76
+ "src": "./src/exports/b.ts",
77
+ "types": "./types/exports/b.d.ts",
78
+ "import": "./es/exports/b.js",
79
+ "require": "./lib/exports/b.js",
80
+ "default": "./es/exports/b.js"
81
+ }
60
82
  },
61
83
  "scripts": {
62
84
  "lint": "ui-scripts lint",
@@ -24,11 +24,11 @@
24
24
 
25
25
  import { Component } from 'react'
26
26
 
27
- import { View } from '@instructure/ui-view'
27
+ import { View } from '@instructure/ui-view/v11_6'
28
28
  import { omitProps } from '@instructure/ui-react-utils'
29
29
  import { getCSSStyleDeclaration } from '@instructure/ui-dom-utils'
30
30
 
31
- import { withStyle } from '@instructure/emotion'
31
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
32
32
  import generateStyle from './styles'
33
33
  import generateComponentTheme from './theme'
34
34