@instructure/ui-grid 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 (140) hide show
  1. package/CHANGELOG.md +27 -276
  2. package/es/Grid/{index.js → v1/index.js} +3 -3
  3. package/es/Grid/v2/index.js +98 -0
  4. package/es/Grid/v2/props.js +26 -0
  5. package/es/Grid/v2/styles.js +61 -0
  6. package/es/GridCol/{index.js → v1/index.js} +1 -1
  7. package/es/GridCol/v2/index.js +100 -0
  8. package/es/GridCol/v2/props.js +26 -0
  9. package/es/GridCol/v2/styles.js +211 -0
  10. package/es/GridRow/{index.js → v1/index.js} +2 -2
  11. package/es/GridRow/v2/index.js +93 -0
  12. package/es/GridRow/v2/props.js +26 -0
  13. package/es/GridRow/v2/styles.js +137 -0
  14. package/es/{index.js → exports/a.js} +1 -1
  15. package/es/exports/b.js +24 -0
  16. package/lib/Grid/v1/index.js +120 -0
  17. package/lib/Grid/{index.js → v2/index.js} +7 -8
  18. package/lib/Grid/v2/props.js +31 -0
  19. package/lib/Grid/v2/styles.js +67 -0
  20. package/lib/GridCol/v1/index.js +106 -0
  21. package/lib/GridCol/{index.js → v2/index.js} +1 -2
  22. package/lib/GridCol/v2/props.js +31 -0
  23. package/lib/GridCol/v2/styles.js +217 -0
  24. package/lib/GridRow/v1/index.js +102 -0
  25. package/lib/GridRow/{index.js → v2/index.js} +3 -4
  26. package/{src/index.ts → lib/GridRow/v2/props.js} +7 -6
  27. package/lib/GridRow/v2/styles.js +143 -0
  28. package/lib/{index.js → exports/a.js} +4 -4
  29. package/lib/exports/b.js +24 -0
  30. package/package.json +39 -17
  31. package/src/Grid/{index.tsx → v1/index.tsx} +4 -4
  32. package/src/Grid/{props.ts → v1/props.ts} +1 -1
  33. package/src/Grid/{styles.ts → v1/styles.ts} +1 -1
  34. package/src/Grid/v2/README.md +239 -0
  35. package/src/Grid/v2/index.tsx +117 -0
  36. package/src/Grid/v2/props.ts +62 -0
  37. package/src/Grid/v2/styles.ts +70 -0
  38. package/src/GridCol/{index.tsx → v1/index.tsx} +1 -1
  39. package/src/GridCol/{props.ts → v1/props.ts} +1 -1
  40. package/src/GridCol/{styles.ts → v1/styles.ts} +1 -1
  41. package/src/GridCol/v2/index.tsx +113 -0
  42. package/src/GridCol/v2/props.ts +90 -0
  43. package/src/GridCol/v2/styles.ts +221 -0
  44. package/src/GridRow/{index.tsx → v1/index.tsx} +3 -3
  45. package/src/GridRow/{props.ts → v1/props.ts} +1 -1
  46. package/src/GridRow/{styles.ts → v1/styles.ts} +1 -1
  47. package/src/GridRow/v2/index.tsx +109 -0
  48. package/src/GridRow/v2/props.ts +66 -0
  49. package/src/GridRow/v2/styles.ts +120 -0
  50. package/src/exports/a.ts +30 -0
  51. package/src/exports/b.ts +30 -0
  52. package/tsconfig.build.tsbuildinfo +1 -1
  53. package/types/Grid/{index.d.ts → v1/index.d.ts} +4 -4
  54. package/types/Grid/v1/index.d.ts.map +1 -0
  55. package/types/Grid/{props.d.ts → v1/props.d.ts} +1 -1
  56. package/types/Grid/v1/props.d.ts.map +1 -0
  57. package/types/Grid/v1/styles.d.ts.map +1 -0
  58. package/types/Grid/v1/theme.d.ts.map +1 -0
  59. package/types/Grid/v2/index.d.ts +42 -0
  60. package/types/Grid/v2/index.d.ts.map +1 -0
  61. package/types/Grid/v2/props.d.ts +23 -0
  62. package/types/Grid/v2/props.d.ts.map +1 -0
  63. package/types/Grid/v2/styles.d.ts +15 -0
  64. package/types/Grid/v2/styles.d.ts.map +1 -0
  65. package/types/GridCol/{index.d.ts → v1/index.d.ts} +1 -1
  66. package/types/GridCol/v1/index.d.ts.map +1 -0
  67. package/types/GridCol/{props.d.ts → v1/props.d.ts} +1 -1
  68. package/types/GridCol/v1/props.d.ts.map +1 -0
  69. package/types/GridCol/v1/styles.d.ts.map +1 -0
  70. package/types/GridCol/v1/theme.d.ts.map +1 -0
  71. package/types/GridCol/v2/index.d.ts +51 -0
  72. package/types/GridCol/v2/index.d.ts.map +1 -0
  73. package/types/GridCol/v2/props.d.ts +40 -0
  74. package/types/GridCol/v2/props.d.ts.map +1 -0
  75. package/types/GridCol/v2/styles.d.ts +15 -0
  76. package/types/GridCol/v2/styles.d.ts.map +1 -0
  77. package/types/GridRow/{index.d.ts → v1/index.d.ts} +3 -3
  78. package/types/GridRow/v1/index.d.ts.map +1 -0
  79. package/types/GridRow/{props.d.ts → v1/props.d.ts} +1 -1
  80. package/types/GridRow/v1/props.d.ts.map +1 -0
  81. package/types/GridRow/v1/styles.d.ts.map +1 -0
  82. package/types/GridRow/v1/theme.d.ts.map +1 -0
  83. package/types/GridRow/v2/index.d.ts +36 -0
  84. package/types/GridRow/v2/index.d.ts.map +1 -0
  85. package/types/GridRow/v2/props.d.ts +25 -0
  86. package/types/GridRow/v2/props.d.ts.map +1 -0
  87. package/types/GridRow/v2/styles.d.ts +15 -0
  88. package/types/GridRow/v2/styles.d.ts.map +1 -0
  89. package/types/exports/a.d.ts +6 -0
  90. package/types/exports/a.d.ts.map +1 -0
  91. package/types/exports/b.d.ts +6 -0
  92. package/types/exports/b.d.ts.map +1 -0
  93. package/types/utils/v1/GridTypes.d.ts.map +1 -0
  94. package/types/Grid/index.d.ts.map +0 -1
  95. package/types/Grid/props.d.ts.map +0 -1
  96. package/types/Grid/styles.d.ts.map +0 -1
  97. package/types/Grid/theme.d.ts.map +0 -1
  98. package/types/GridCol/index.d.ts.map +0 -1
  99. package/types/GridCol/props.d.ts.map +0 -1
  100. package/types/GridCol/styles.d.ts.map +0 -1
  101. package/types/GridCol/theme.d.ts.map +0 -1
  102. package/types/GridRow/index.d.ts.map +0 -1
  103. package/types/GridRow/props.d.ts.map +0 -1
  104. package/types/GridRow/styles.d.ts.map +0 -1
  105. package/types/GridRow/theme.d.ts.map +0 -1
  106. package/types/GridTypes.d.ts.map +0 -1
  107. package/types/index.d.ts +0 -6
  108. package/types/index.d.ts.map +0 -1
  109. /package/es/Grid/{props.js → v1/props.js} +0 -0
  110. /package/es/Grid/{styles.js → v1/styles.js} +0 -0
  111. /package/es/Grid/{theme.js → v1/theme.js} +0 -0
  112. /package/es/GridCol/{props.js → v1/props.js} +0 -0
  113. /package/es/GridCol/{styles.js → v1/styles.js} +0 -0
  114. /package/es/GridCol/{theme.js → v1/theme.js} +0 -0
  115. /package/es/GridRow/{props.js → v1/props.js} +0 -0
  116. /package/es/GridRow/{styles.js → v1/styles.js} +0 -0
  117. /package/es/GridRow/{theme.js → v1/theme.js} +0 -0
  118. /package/es/{GridTypes.js → utils/v1/GridTypes.js} +0 -0
  119. /package/lib/Grid/{props.js → v1/props.js} +0 -0
  120. /package/lib/Grid/{styles.js → v1/styles.js} +0 -0
  121. /package/lib/Grid/{theme.js → v1/theme.js} +0 -0
  122. /package/lib/GridCol/{props.js → v1/props.js} +0 -0
  123. /package/lib/GridCol/{styles.js → v1/styles.js} +0 -0
  124. /package/lib/GridCol/{theme.js → v1/theme.js} +0 -0
  125. /package/lib/GridRow/{props.js → v1/props.js} +0 -0
  126. /package/lib/GridRow/{styles.js → v1/styles.js} +0 -0
  127. /package/lib/GridRow/{theme.js → v1/theme.js} +0 -0
  128. /package/lib/{GridTypes.js → utils/v1/GridTypes.js} +0 -0
  129. /package/src/Grid/{README.md → v1/README.md} +0 -0
  130. /package/src/Grid/{theme.ts → v1/theme.ts} +0 -0
  131. /package/src/GridCol/{theme.ts → v1/theme.ts} +0 -0
  132. /package/src/GridRow/{theme.ts → v1/theme.ts} +0 -0
  133. /package/src/{GridTypes.ts → utils/v1/GridTypes.ts} +0 -0
  134. /package/types/Grid/{styles.d.ts → v1/styles.d.ts} +0 -0
  135. /package/types/Grid/{theme.d.ts → v1/theme.d.ts} +0 -0
  136. /package/types/GridCol/{styles.d.ts → v1/styles.d.ts} +0 -0
  137. /package/types/GridCol/{theme.d.ts → v1/theme.d.ts} +0 -0
  138. /package/types/GridRow/{styles.d.ts → v1/styles.d.ts} +0 -0
  139. /package/types/GridRow/{theme.d.ts → v1/theme.d.ts} +0 -0
  140. /package/types/{GridTypes.d.ts → utils/v1/GridTypes.d.ts} +0 -0
@@ -0,0 +1,137 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+
25
+ /**
26
+ * ---
27
+ * private: true
28
+ * ---
29
+ * Generates the style object from the theme and provided additional information
30
+ * @param {Object} componentTheme The theme variable object.
31
+ * @param {Object} props the props of the component, the style is applied to
32
+ * @param {Object} state the state of the component, the style is applied to
33
+ * @return {Object} The final style object, which will be used in the component
34
+ */
35
+ const generateStyle = (componentTheme, props) => {
36
+ const hAlign = props.hAlign,
37
+ vAlign = props.vAlign,
38
+ rowSpacing = props.rowSpacing,
39
+ colSpacing = props.colSpacing,
40
+ isLastRow = props.isLastRow,
41
+ startAt = props.startAt,
42
+ visualDebug = props.visualDebug;
43
+ const getGridRowStyle = () => {
44
+ const hAlignVariants = {
45
+ center: {
46
+ justifyContent: 'center'
47
+ },
48
+ start: {
49
+ justifyContent: 'flex-start'
50
+ },
51
+ end: {
52
+ justifyContent: 'flex-end'
53
+ },
54
+ 'space-around': {
55
+ justifyContent: 'space-around'
56
+ },
57
+ 'space-between': {
58
+ justifyContent: 'space-between'
59
+ }
60
+ };
61
+ const vAlignVariants = {
62
+ top: {
63
+ alignItems: 'flex-start'
64
+ },
65
+ middle: {
66
+ alignItems: 'center'
67
+ },
68
+ bottom: {
69
+ alignItems: 'flex-end'
70
+ },
71
+ stretch: {
72
+ alignItems: 'stretch'
73
+ }
74
+ };
75
+ const colSpacingVariants = {
76
+ small: {
77
+ margin: `0 calc(-1 * ${componentTheme.spacingSmall} / 2)`
78
+ },
79
+ medium: {
80
+ margin: `0 calc(-1 * ${componentTheme.spacingMedium} / 2)`
81
+ },
82
+ large: {
83
+ margin: `0 calc(-1 * ${componentTheme.spacingLarge} / 2)`
84
+ },
85
+ none: {}
86
+ };
87
+ const rowSpacingVariants = {
88
+ small: {
89
+ marginBottom: componentTheme.spacingSmall
90
+ },
91
+ medium: {
92
+ marginBottom: componentTheme.spacingMedium
93
+ },
94
+ large: {
95
+ marginBottom: componentTheme.spacingLarge
96
+ },
97
+ none: {
98
+ marginBottom: 0
99
+ }
100
+ };
101
+ return {
102
+ display: 'flex',
103
+ flexFlow: 'row nowrap',
104
+ ...(hAlign && hAlignVariants[hAlign]),
105
+ ...(vAlign && vAlignVariants[vAlign]),
106
+ ...(colSpacing && colSpacingVariants[colSpacing]),
107
+ ...(rowSpacing && rowSpacingVariants[rowSpacing]),
108
+ ...(isLastRow && {
109
+ marginBottom: 0
110
+ })
111
+ };
112
+ };
113
+ const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
114
+ ...getGridRowStyle()
115
+ } : {};
116
+ return {
117
+ gridRow: {
118
+ label: 'gridRow',
119
+ display: 'block',
120
+ boxSizing: 'border-box',
121
+ ...getStartAtVariants('small'),
122
+ [`@media screen and (min-width: ${componentTheme.mediumMin})`]: {
123
+ ...getStartAtVariants('medium')
124
+ },
125
+ [`@media screen and (min-width: ${componentTheme.largeMin})`]: {
126
+ ...getStartAtVariants('large')
127
+ },
128
+ [`@media screen and (min-width: ${componentTheme.xLargeMin})`]: {
129
+ ...getStartAtVariants('x-large')
130
+ },
131
+ ...(visualDebug && {
132
+ outline: '0.0625rem dashed blue'
133
+ })
134
+ }
135
+ };
136
+ };
137
+ export default generateStyle;
@@ -21,4 +21,4 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
- export { Grid, GridRow, GridCol } from "./Grid/index.js";
24
+ export { Grid, GridRow, GridCol } from "../Grid/v1/index.js";
@@ -0,0 +1,24 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ export { Grid, GridRow, GridCol } from "../Grid/v2/index.js";
@@ -0,0 +1,120 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+ Object.defineProperty(exports, "__esModule", {
5
+ value: true
6
+ });
7
+ exports.Grid = void 0;
8
+ Object.defineProperty(exports, "GridCol", {
9
+ enumerable: true,
10
+ get: function () {
11
+ return _v2.GridCol;
12
+ }
13
+ });
14
+ Object.defineProperty(exports, "GridRow", {
15
+ enumerable: true,
16
+ get: function () {
17
+ return _v.GridRow;
18
+ }
19
+ });
20
+ exports.default = void 0;
21
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
22
+ var _react = require("react");
23
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
24
+ var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
25
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
26
+ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
27
+ var _v = require("../../GridRow/v1");
28
+ var _v2 = require("../../GridCol/v1");
29
+ var _emotion = require("@instructure/emotion");
30
+ var _styles = _interopRequireDefault(require("./styles"));
31
+ var _theme = _interopRequireDefault(require("./theme"));
32
+ var _props = require("./props");
33
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
34
+ const _excluded = ["styles", "makeStyles"],
35
+ _excluded2 = ["styles"];
36
+ var _dec, _class, _Grid;
37
+ /*
38
+ * The MIT License (MIT)
39
+ *
40
+ * Copyright (c) 2015 - present Instructure, Inc.
41
+ *
42
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
43
+ * of this software and associated documentation files (the "Software"), to deal
44
+ * in the Software without restriction, including without limitation the rights
45
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
46
+ * copies of the Software, and to permit persons to whom the Software is
47
+ * furnished to do so, subject to the following conditions:
48
+ *
49
+ * The above copyright notice and this permission notice shall be included in all
50
+ * copies or substantial portions of the Software.
51
+ *
52
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
53
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
54
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
55
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
56
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
57
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
58
+ * SOFTWARE.
59
+ */
60
+ /**
61
+ ---
62
+ category: components
63
+ ---
64
+ **/
65
+ let Grid = exports.Grid = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_Grid = class Grid extends _react.Component {
66
+ constructor(...args) {
67
+ super(...args);
68
+ this.ref = null;
69
+ this.handleRef = el => {
70
+ this.ref = el;
71
+ };
72
+ }
73
+ componentDidMount() {
74
+ var _this$props$makeStyle, _this$props;
75
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
76
+ }
77
+ componentDidUpdate() {
78
+ var _this$props$makeStyle2, _this$props2;
79
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
80
+ }
81
+ renderChildren() {
82
+ const _this$props3 = this.props,
83
+ styles = _this$props3.styles,
84
+ makeStyles = _this$props3.makeStyles,
85
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
86
+ const children = _react.Children.toArray(this.props.children);
87
+ return children.map((child, index) => {
88
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridRow])) {
89
+ return (0, _safeCloneElement.safeCloneElement)(child, {
90
+ ...(0, _pickProps.pickProps)(props, Grid.allowedProps),
91
+ ...child.props /* child props should override parent */,
92
+ isLastRow: index + 1 === children.length
93
+ });
94
+ } else {
95
+ return child; // PropType validation should handle errors
96
+ }
97
+ });
98
+ }
99
+ render() {
100
+ const _this$props4 = this.props,
101
+ styles = _this$props4.styles,
102
+ restProps = (0, _objectWithoutProperties2.default)(_this$props4, _excluded2);
103
+ const props = (0, _omitProps.omitProps)(restProps, Grid.allowedProps);
104
+ return (0, _jsxRuntime.jsx)("span", {
105
+ ...props,
106
+ css: styles === null || styles === void 0 ? void 0 : styles.grid,
107
+ ref: this.handleRef,
108
+ children: this.renderChildren()
109
+ });
110
+ }
111
+ }, _Grid.displayName = "Grid", _Grid.componentId = 'Grid', _Grid.allowedProps = _props.allowedProps, _Grid.defaultProps = {
112
+ colSpacing: 'medium',
113
+ rowSpacing: 'medium',
114
+ hAlign: 'start',
115
+ startAt: 'small',
116
+ vAlign: 'top',
117
+ visualDebug: false,
118
+ children: null
119
+ }, _Grid.Row = _v.GridRow, _Grid.Col = _v2.GridCol, _Grid)) || _class);
120
+ var _default = exports.default = Grid;
@@ -8,13 +8,13 @@ exports.Grid = void 0;
8
8
  Object.defineProperty(exports, "GridCol", {
9
9
  enumerable: true,
10
10
  get: function () {
11
- return _GridCol.GridCol;
11
+ return _v2.GridCol;
12
12
  }
13
13
  });
14
14
  Object.defineProperty(exports, "GridRow", {
15
15
  enumerable: true,
16
16
  get: function () {
17
- return _GridRow.GridRow;
17
+ return _v.GridRow;
18
18
  }
19
19
  });
20
20
  exports.default = void 0;
@@ -24,11 +24,10 @@ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElemen
24
24
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
25
25
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
26
26
  var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
27
- var _GridRow = require("../GridRow");
28
- var _GridCol = require("../GridCol");
27
+ var _v = require("../../GridRow/v2");
28
+ var _v2 = require("../../GridCol/v2");
29
29
  var _emotion = require("@instructure/emotion");
30
30
  var _styles = _interopRequireDefault(require("./styles"));
31
- var _theme = _interopRequireDefault(require("./theme"));
32
31
  var _props = require("./props");
33
32
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
34
33
  const _excluded = ["styles", "makeStyles"],
@@ -62,7 +61,7 @@ var _dec, _class, _Grid;
62
61
  category: components
63
62
  ---
64
63
  **/
65
- let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Grid = class Grid extends _react.Component {
64
+ let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Grid = class Grid extends _react.Component {
66
65
  constructor(...args) {
67
66
  super(...args);
68
67
  this.ref = null;
@@ -85,7 +84,7 @@ let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default, _them
85
84
  props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
86
85
  const children = _react.Children.toArray(this.props.children);
87
86
  return children.map((child, index) => {
88
- if ((0, _matchComponentTypes.matchComponentTypes)(child, [_GridRow.GridRow])) {
87
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridRow])) {
89
88
  return (0, _safeCloneElement.safeCloneElement)(child, {
90
89
  ...(0, _pickProps.pickProps)(props, Grid.allowedProps),
91
90
  ...child.props /* child props should override parent */,
@@ -116,5 +115,5 @@ let Grid = exports.Grid = (_dec = (0, _emotion.withStyle)(_styles.default, _them
116
115
  vAlign: 'top',
117
116
  visualDebug: false,
118
117
  children: null
119
- }, _Grid.Row = _GridRow.GridRow, _Grid.Col = _GridCol.GridCol, _Grid)) || _class);
118
+ }, _Grid.Row = _v.GridRow, _Grid.Col = _v2.GridCol, _Grid)) || _class);
120
119
  var _default = exports.default = Grid;
@@ -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', 'colSpacing', 'rowSpacing', 'hAlign', 'vAlign', 'startAt', 'visualDebug'];
@@ -0,0 +1,67 @@
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 startAt = props.startAt,
43
+ visualDebug = props.visualDebug;
44
+ const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
45
+ boxSizing: 'border-box'
46
+ } : {};
47
+ return {
48
+ grid: {
49
+ label: 'grid',
50
+ display: 'block',
51
+ ...getStartAtVariants('small'),
52
+ [`@media screen and (min-width: ${componentTheme.mediumMin})`]: {
53
+ ...getStartAtVariants('medium')
54
+ },
55
+ [`@media screen and (min-width: ${componentTheme.largeMin})`]: {
56
+ ...getStartAtVariants('large')
57
+ },
58
+ [`@media screen and (min-width: ${componentTheme.xLargeMin})`]: {
59
+ ...getStartAtVariants('x-large')
60
+ },
61
+ ...(visualDebug && {
62
+ outline: '0.0625rem dashed red'
63
+ })
64
+ }
65
+ };
66
+ };
67
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,106 @@
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.GridCol = void 0;
8
+ var _react = require("react");
9
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
+ var _emotion = require("@instructure/emotion");
11
+ var _console = require("@instructure/console");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _theme = _interopRequireDefault(require("./theme"));
14
+ var _props = require("./props");
15
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
+ var _dec, _class, _GridCol;
17
+ /*
18
+ * The MIT License (MIT)
19
+ *
20
+ * Copyright (c) 2015 - present Instructure, Inc.
21
+ *
22
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
23
+ * of this software and associated documentation files (the "Software"), to deal
24
+ * in the Software without restriction, including without limitation the rights
25
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
26
+ * copies of the Software, and to permit persons to whom the Software is
27
+ * furnished to do so, subject to the following conditions:
28
+ *
29
+ * The above copyright notice and this permission notice shall be included in all
30
+ * copies or substantial portions of the Software.
31
+ *
32
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
33
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
34
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
35
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
36
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
37
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
38
+ * SOFTWARE.
39
+ */
40
+ /**
41
+ ---
42
+ parent: Grid
43
+ id: Grid.Col
44
+ ---
45
+ **/
46
+ let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_GridCol = class GridCol extends _react.Component {
47
+ constructor(...args) {
48
+ super(...args);
49
+ this.ref = null;
50
+ this.handleRef = el => {
51
+ const elementRef = this.props.elementRef;
52
+ this.ref = el;
53
+ if (typeof elementRef === 'function') {
54
+ elementRef(el);
55
+ }
56
+ };
57
+ }
58
+ widthCheck() {
59
+ const width = this.props.width;
60
+ let shouldWarn = false;
61
+ if (width) {
62
+ if (typeof width === 'number' && width <= 0) {
63
+ shouldWarn = true;
64
+ }
65
+ if (typeof width === 'object') {
66
+ Object.keys(width).forEach(breakpoint => {
67
+ //@ts-expect-error Ts doesn't understand Object.keys properly
68
+ if (typeof width[breakpoint] === 'number' && width[breakpoint] <= 0) {
69
+ shouldWarn = true;
70
+ }
71
+ });
72
+ }
73
+ }
74
+ if (shouldWarn) {
75
+ (0, _console.logWarn)(false, 'Col width must be positive!');
76
+ }
77
+ }
78
+ componentDidMount() {
79
+ var _this$props$makeStyle, _this$props;
80
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
81
+ this.widthCheck();
82
+ }
83
+ componentDidUpdate() {
84
+ var _this$props$makeStyle2, _this$props2;
85
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
86
+ this.widthCheck();
87
+ }
88
+ render() {
89
+ const _this$props3 = this.props,
90
+ children = _this$props3.children,
91
+ styles = _this$props3.styles;
92
+ const props = (0, _omitProps.omitProps)(this.props, GridCol.allowedProps);
93
+ return (0, _jsxRuntime.jsx)("span", {
94
+ ...props,
95
+ ref: this.handleRef,
96
+ css: styles === null || styles === void 0 ? void 0 : styles.gridCol,
97
+ children: children
98
+ });
99
+ }
100
+ }, _GridCol.displayName = "GridCol", _GridCol.componentId = 'Grid.Col', _GridCol.allowedProps = _props.allowedProps, _GridCol.defaultProps = {
101
+ textAlign: 'inherit',
102
+ children: null,
103
+ isLastCol: false,
104
+ isLastRow: false
105
+ }, _GridCol)) || _class);
106
+ var _default = exports.default = GridCol;
@@ -10,7 +10,6 @@ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
10
  var _emotion = require("@instructure/emotion");
11
11
  var _console = require("@instructure/console");
12
12
  var _styles = _interopRequireDefault(require("./styles"));
13
- var _theme = _interopRequireDefault(require("./theme"));
14
13
  var _props = require("./props");
15
14
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
16
15
  var _dec, _class, _GridCol;
@@ -43,7 +42,7 @@ parent: Grid
43
42
  id: Grid.Col
44
43
  ---
45
44
  **/
46
- let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_GridCol = class GridCol extends _react.Component {
45
+ let GridCol = exports.GridCol = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_GridCol = class GridCol extends _react.Component {
47
46
  constructor(...args) {
48
47
  super(...args);
49
48
  this.ref = null;
@@ -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', 'colSpacing', 'rowSpacing', 'textAlign', 'hAlign', 'vAlign', 'startAt', 'visualDebug', 'width', 'offset', 'isLastRow', 'isLastCol', 'elementRef'];