@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,217 @@
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 vAlign = props.vAlign,
43
+ textAlign = props.textAlign,
44
+ rowSpacing = props.rowSpacing,
45
+ colSpacing = props.colSpacing,
46
+ isLastRow = props.isLastRow,
47
+ isLastCol = props.isLastCol,
48
+ startAt = props.startAt,
49
+ visualDebug = props.visualDebug;
50
+ const rowSpacingVariants = {
51
+ small: {
52
+ marginBottom: componentTheme.spacingSmall
53
+ },
54
+ medium: {
55
+ marginBottom: componentTheme.spacingMedium
56
+ },
57
+ large: {
58
+ marginBottom: componentTheme.spacingLarge
59
+ },
60
+ none: {
61
+ marginBottom: 0
62
+ }
63
+ };
64
+ const getStartGridColumnStyle = () => {
65
+ const colSpacingVariants = {
66
+ small: {
67
+ paddingLeft: `calc(${componentTheme.spacingSmall} / 2)`,
68
+ paddingRight: `calc(${componentTheme.spacingSmall} / 2)`
69
+ },
70
+ medium: {
71
+ paddingLeft: `calc(${componentTheme.spacingMedium} / 2)`,
72
+ paddingRight: `calc(${componentTheme.spacingMedium} / 2)`
73
+ },
74
+ large: {
75
+ paddingLeft: `calc(${componentTheme.spacingLarge} / 2)`,
76
+ paddingRight: `calc(${componentTheme.spacingLarge} / 2)`
77
+ },
78
+ none: {}
79
+ };
80
+ const vAlignVariants = {
81
+ top: {
82
+ alignSelf: 'flex-start'
83
+ },
84
+ middle: {
85
+ alignSelf: 'center'
86
+ },
87
+ bottom: {
88
+ alignSelf: 'flex-end'
89
+ },
90
+ stretch: {
91
+ alignSelf: 'stretch'
92
+ }
93
+ };
94
+ const textAlignVariants = {
95
+ start: {
96
+ textAlign: 'start'
97
+ },
98
+ end: {
99
+ textAlign: 'end'
100
+ },
101
+ center: {
102
+ textAlign: 'center'
103
+ },
104
+ inherit: {
105
+ textAlign: 'inherit'
106
+ }
107
+ };
108
+ return {
109
+ flexGrow: 1,
110
+ flexShrink: 1,
111
+ flexBasis: '0%',
112
+ marginBottom: 0,
113
+ boxSizing: 'border-box',
114
+ ...(colSpacing && colSpacingVariants[colSpacing]),
115
+ ...(vAlign && vAlignVariants[vAlign]),
116
+ ...(textAlign && textAlignVariants[textAlign])
117
+ };
118
+ };
119
+ const enabledBreakpoints = () => {
120
+ const breakpoints = ['small', 'medium', 'large', 'x-large', null];
121
+ return breakpoints.slice(breakpoints.indexOf(startAt));
122
+ };
123
+ const breakpointIsEnabled = breakpoint => {
124
+ return enabledBreakpoints().includes(breakpoint);
125
+ };
126
+ const getColSize = breakpoint => {
127
+ let width = props.width;
128
+ if (!width) return;
129
+ if (width && typeof width === 'object') {
130
+ width = width[breakpoint === 'x-large' ? 'xLarge' : breakpoint];
131
+ }
132
+ return width;
133
+ };
134
+ const getColOffset = breakpoint => {
135
+ let offset = props.offset;
136
+ if (!offset) return;
137
+ if (offset && typeof offset === 'object') {
138
+ offset = offset[breakpoint === 'x-large' ? 'xLarge' : breakpoint];
139
+ }
140
+ return offset;
141
+ };
142
+ const getFlexColumnBySize = (size = '1') => {
143
+ switch (size) {
144
+ case 'auto':
145
+ return {
146
+ flexGrow: 0,
147
+ flexShrink: 0,
148
+ flexBasis: 'auto'
149
+ };
150
+ case 12:
151
+ return {
152
+ flex: '0 0 100%'
153
+ };
154
+ default:
155
+ return {
156
+ flexGrow: 0,
157
+ flexShrink: 0,
158
+ flexBasis: `calc(${size} / 12 * 99.999%)`,
159
+ maxWidth: `calc(${size} / 12 * 99.999%)`
160
+ };
161
+ }
162
+ };
163
+ const getColumnOffsetBySize = (size = '1') => {
164
+ switch (size) {
165
+ case 'auto':
166
+ case 12:
167
+ return {};
168
+ default:
169
+ return {
170
+ marginInlineStart: `calc(${size} / 12 * 99.999%)`,
171
+ marginInlineEnd: 0
172
+ };
173
+ }
174
+ };
175
+ const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
176
+ ...getStartGridColumnStyle()
177
+ } : {};
178
+ const getGridColumnsForBreakpoint = breakpoint => {
179
+ const size = getColSize(breakpoint);
180
+ const offset = getColOffset(breakpoint);
181
+ return breakpointIsEnabled(breakpoint) ? {
182
+ ...(size && getFlexColumnBySize(size)),
183
+ ...(offset && getColumnOffsetBySize(offset))
184
+ } : {};
185
+ };
186
+ const getBreakpointStyles = breakpoint => ({
187
+ ...getStartAtVariants(breakpoint),
188
+ ...getGridColumnsForBreakpoint(breakpoint)
189
+ });
190
+ return {
191
+ gridCol: {
192
+ label: 'gridCol',
193
+ display: 'block',
194
+ boxSizing: 'border-box',
195
+ textAlign: 'inherit',
196
+ minWidth: '0.0625rem',
197
+ ...(rowSpacing && rowSpacingVariants[rowSpacing]),
198
+ ...(isLastRow && isLastCol && {
199
+ marginBottom: 0
200
+ }),
201
+ ...getBreakpointStyles('small'),
202
+ [`@media screen and (min-width: ${componentTheme.mediumMin})`]: {
203
+ ...getBreakpointStyles('medium')
204
+ },
205
+ [`@media screen and (min-width: ${componentTheme.largeMin})`]: {
206
+ ...getBreakpointStyles('large')
207
+ },
208
+ [`@media screen and (min-width: ${componentTheme.xLargeMin})`]: {
209
+ ...getBreakpointStyles('x-large')
210
+ },
211
+ ...(visualDebug && {
212
+ outline: '0.0625rem dashed red'
213
+ })
214
+ }
215
+ };
216
+ };
217
+ var _default = exports.default = generateStyle;
@@ -0,0 +1,102 @@
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.GridRow = void 0;
8
+ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
9
+ var _react = require("react");
10
+ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElement.js");
11
+ var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
12
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
+ var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
14
+ var _v = require("../../GridCol/v1/");
15
+ var _emotion = require("@instructure/emotion");
16
+ var _styles = _interopRequireDefault(require("./styles"));
17
+ var _theme = _interopRequireDefault(require("./theme"));
18
+ var _props = require("./props");
19
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
+ const _excluded = ["styles", "makeStyles"],
21
+ _excluded2 = ["styles"];
22
+ var _dec, _class, _GridRow;
23
+ /*
24
+ * The MIT License (MIT)
25
+ *
26
+ * Copyright (c) 2015 - present Instructure, Inc.
27
+ *
28
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
29
+ * of this software and associated documentation files (the "Software"), to deal
30
+ * in the Software without restriction, including without limitation the rights
31
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32
+ * copies of the Software, and to permit persons to whom the Software is
33
+ * furnished to do so, subject to the following conditions:
34
+ *
35
+ * The above copyright notice and this permission notice shall be included in all
36
+ * copies or substantial portions of the Software.
37
+ *
38
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44
+ * SOFTWARE.
45
+ */
46
+ /**
47
+ ---
48
+ parent: Grid
49
+ id: Grid.Row
50
+ ---
51
+ **/
52
+ let GridRow = exports.GridRow = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, _theme.default), _dec(_class = (_GridRow = class GridRow extends _react.Component {
53
+ constructor(...args) {
54
+ super(...args);
55
+ this.ref = null;
56
+ this.handleRef = el => {
57
+ this.ref = el;
58
+ };
59
+ }
60
+ componentDidMount() {
61
+ var _this$props$makeStyle, _this$props;
62
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
63
+ }
64
+ componentDidUpdate() {
65
+ var _this$props$makeStyle2, _this$props2;
66
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
67
+ }
68
+ renderChildren() {
69
+ const _this$props3 = this.props,
70
+ styles = _this$props3.styles,
71
+ makeStyles = _this$props3.makeStyles,
72
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
73
+ return _react.Children.map(this.props.children, (child, index) => {
74
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridCol])) {
75
+ return (0, _safeCloneElement.safeCloneElement)(child, {
76
+ ...(0, _pickProps.pickProps)(props, GridRow.allowedProps),
77
+ ...child.props /* child props should override parent */,
78
+ isLastRow: props.isLastRow,
79
+ isLastCol: index + 1 === _react.Children.count(this.props.children)
80
+ });
81
+ } else {
82
+ return child; // PropType validation should handle errors
83
+ }
84
+ });
85
+ }
86
+ render() {
87
+ const _this$props4 = this.props,
88
+ styles = _this$props4.styles,
89
+ restProps = (0, _objectWithoutProperties2.default)(_this$props4, _excluded2);
90
+ const props = (0, _omitProps.omitProps)(restProps, GridRow.allowedProps);
91
+ return (0, _jsxRuntime.jsx)("span", {
92
+ ...props,
93
+ css: styles === null || styles === void 0 ? void 0 : styles.gridRow,
94
+ ref: this.handleRef,
95
+ children: this.renderChildren()
96
+ });
97
+ }
98
+ }, _GridRow.displayName = "GridRow", _GridRow.componentId = 'Grid.Row', _GridRow.allowedProps = _props.allowedProps, _GridRow.defaultProps = {
99
+ children: null,
100
+ isLastRow: false
101
+ }, _GridRow)) || _class);
102
+ var _default = exports.default = GridRow;
@@ -11,10 +11,9 @@ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElemen
11
11
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
12
12
  var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
13
13
  var _pickProps = require("@instructure/ui-react-utils/lib/pickProps.js");
14
- var _GridCol = require("../GridCol");
14
+ var _v = require("../../GridCol/v2/");
15
15
  var _emotion = require("@instructure/emotion");
16
16
  var _styles = _interopRequireDefault(require("./styles"));
17
- var _theme = _interopRequireDefault(require("./theme"));
18
17
  var _props = require("./props");
19
18
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
20
19
  const _excluded = ["styles", "makeStyles"],
@@ -49,7 +48,7 @@ parent: Grid
49
48
  id: Grid.Row
50
49
  ---
51
50
  **/
52
- let GridRow = exports.GridRow = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_GridRow = class GridRow extends _react.Component {
51
+ let GridRow = exports.GridRow = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_GridRow = class GridRow extends _react.Component {
53
52
  constructor(...args) {
54
53
  super(...args);
55
54
  this.ref = null;
@@ -71,7 +70,7 @@ let GridRow = exports.GridRow = (_dec = (0, _emotion.withStyle)(_styles.default,
71
70
  makeStyles = _this$props3.makeStyles,
72
71
  props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
73
72
  return _react.Children.map(this.props.children, (child, index) => {
74
- if ((0, _matchComponentTypes.matchComponentTypes)(child, [_GridCol.GridCol])) {
73
+ if ((0, _matchComponentTypes.matchComponentTypes)(child, [_v.GridCol])) {
75
74
  return (0, _safeCloneElement.safeCloneElement)(child, {
76
75
  ...(0, _pickProps.pickProps)(props, GridRow.allowedProps),
77
76
  ...child.props /* child props should override parent */,
@@ -1,3 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.allowedProps = void 0;
1
7
  /*
2
8
  * The MIT License (MIT)
3
9
  *
@@ -21,10 +27,5 @@
21
27
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
28
  * SOFTWARE.
23
29
  */
24
- export { Grid, GridRow, GridCol } from './Grid'
25
-
26
- export type { GridBreakpoints } from './GridTypes'
27
30
 
28
- export type { GridProps } from './Grid/props'
29
- export type { GridRowProps } from './GridRow/props'
30
- export type { GridColProps } from './GridCol/props'
31
+ const allowedProps = exports.allowedProps = ['children', 'rowSpacing', 'colSpacing', 'hAlign', 'vAlign', 'startAt', 'visualDebug', 'isLastRow'];
@@ -0,0 +1,143 @@
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 hAlign = props.hAlign,
43
+ vAlign = props.vAlign,
44
+ rowSpacing = props.rowSpacing,
45
+ colSpacing = props.colSpacing,
46
+ isLastRow = props.isLastRow,
47
+ startAt = props.startAt,
48
+ visualDebug = props.visualDebug;
49
+ const getGridRowStyle = () => {
50
+ const hAlignVariants = {
51
+ center: {
52
+ justifyContent: 'center'
53
+ },
54
+ start: {
55
+ justifyContent: 'flex-start'
56
+ },
57
+ end: {
58
+ justifyContent: 'flex-end'
59
+ },
60
+ 'space-around': {
61
+ justifyContent: 'space-around'
62
+ },
63
+ 'space-between': {
64
+ justifyContent: 'space-between'
65
+ }
66
+ };
67
+ const vAlignVariants = {
68
+ top: {
69
+ alignItems: 'flex-start'
70
+ },
71
+ middle: {
72
+ alignItems: 'center'
73
+ },
74
+ bottom: {
75
+ alignItems: 'flex-end'
76
+ },
77
+ stretch: {
78
+ alignItems: 'stretch'
79
+ }
80
+ };
81
+ const colSpacingVariants = {
82
+ small: {
83
+ margin: `0 calc(-1 * ${componentTheme.spacingSmall} / 2)`
84
+ },
85
+ medium: {
86
+ margin: `0 calc(-1 * ${componentTheme.spacingMedium} / 2)`
87
+ },
88
+ large: {
89
+ margin: `0 calc(-1 * ${componentTheme.spacingLarge} / 2)`
90
+ },
91
+ none: {}
92
+ };
93
+ const rowSpacingVariants = {
94
+ small: {
95
+ marginBottom: componentTheme.spacingSmall
96
+ },
97
+ medium: {
98
+ marginBottom: componentTheme.spacingMedium
99
+ },
100
+ large: {
101
+ marginBottom: componentTheme.spacingLarge
102
+ },
103
+ none: {
104
+ marginBottom: 0
105
+ }
106
+ };
107
+ return {
108
+ display: 'flex',
109
+ flexFlow: 'row nowrap',
110
+ ...(hAlign && hAlignVariants[hAlign]),
111
+ ...(vAlign && vAlignVariants[vAlign]),
112
+ ...(colSpacing && colSpacingVariants[colSpacing]),
113
+ ...(rowSpacing && rowSpacingVariants[rowSpacing]),
114
+ ...(isLastRow && {
115
+ marginBottom: 0
116
+ })
117
+ };
118
+ };
119
+ const getStartAtVariants = breakpoint => !!startAt && startAt === breakpoint ? {
120
+ ...getGridRowStyle()
121
+ } : {};
122
+ return {
123
+ gridRow: {
124
+ label: 'gridRow',
125
+ display: 'block',
126
+ boxSizing: 'border-box',
127
+ ...getStartAtVariants('small'),
128
+ [`@media screen and (min-width: ${componentTheme.mediumMin})`]: {
129
+ ...getStartAtVariants('medium')
130
+ },
131
+ [`@media screen and (min-width: ${componentTheme.largeMin})`]: {
132
+ ...getStartAtVariants('large')
133
+ },
134
+ [`@media screen and (min-width: ${componentTheme.xLargeMin})`]: {
135
+ ...getStartAtVariants('x-large')
136
+ },
137
+ ...(visualDebug && {
138
+ outline: '0.0625rem dashed blue'
139
+ })
140
+ }
141
+ };
142
+ };
143
+ var _default = exports.default = generateStyle;
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Grid", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Grid.Grid;
9
+ return _v.Grid;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "GridCol", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Grid.GridCol;
15
+ return _v.GridCol;
16
16
  }
17
17
  });
18
18
  Object.defineProperty(exports, "GridRow", {
19
19
  enumerable: true,
20
20
  get: function () {
21
- return _Grid.GridRow;
21
+ return _v.GridRow;
22
22
  }
23
23
  });
24
- var _Grid = require("./Grid");
24
+ var _v = require("../Grid/v1");
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Grid", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Grid;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "GridCol", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v.GridCol;
16
+ }
17
+ });
18
+ Object.defineProperty(exports, "GridRow", {
19
+ enumerable: true,
20
+ get: function () {
21
+ return _v.GridRow;
22
+ }
23
+ });
24
+ var _v = require("../Grid/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-grid",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A Grid component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,20 +15,20 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/console": "11.6.0",
19
- "@instructure/ui-a11y-content": "11.6.0",
20
- "@instructure/ui-react-utils": "11.6.0",
21
- "@instructure/emotion": "11.6.0",
22
- "@instructure/shared-types": "11.6.0",
23
- "@instructure/ui-utils": "11.6.0"
18
+ "@instructure/console": "11.6.1-snapshot-129",
19
+ "@instructure/emotion": "11.6.1-snapshot-129",
20
+ "@instructure/shared-types": "11.6.1-snapshot-129",
21
+ "@instructure/ui-a11y-content": "11.6.1-snapshot-129",
22
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129",
23
+ "@instructure/ui-utils": "11.6.1-snapshot-129"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@testing-library/jest-dom": "^6.6.3",
27
27
  "@testing-library/react": "15.0.7",
28
28
  "vitest": "^3.2.2",
29
- "@instructure/ui-babel-preset": "11.6.0",
30
- "@instructure/ui-color-utils": "11.6.0",
31
- "@instructure/ui-themes": "11.6.0"
29
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129",
30
+ "@instructure/ui-color-utils": "11.6.1-snapshot-129",
31
+ "@instructure/ui-themes": "11.6.1-snapshot-129"
32
32
  },
33
33
  "peerDependencies": {
34
34
  "react": ">=18 <=19"
@@ -38,17 +38,39 @@
38
38
  },
39
39
  "sideEffects": false,
40
40
  "exports": {
41
- ".": {
42
- "types": "./types/index.d.ts",
43
- "import": "./es/index.js",
44
- "require": "./lib/index.js",
45
- "default": "./es/index.js"
46
- },
47
41
  "./lib/*": "./lib/*",
48
42
  "./es/*": "./es/*",
49
43
  "./types/*": "./types/*",
50
44
  "./package.json": "./package.json",
51
- "./src/*": "./src/*"
45
+ "./src/*": "./src/*",
46
+ ".": {
47
+ "src": "./src/exports/a.ts",
48
+ "types": "./types/exports/a.d.ts",
49
+ "import": "./es/exports/a.js",
50
+ "require": "./lib/exports/a.js",
51
+ "default": "./es/exports/a.js"
52
+ },
53
+ "./v11_6": {
54
+ "src": "./src/exports/a.ts",
55
+ "types": "./types/exports/a.d.ts",
56
+ "import": "./es/exports/a.js",
57
+ "require": "./lib/exports/a.js",
58
+ "default": "./es/exports/a.js"
59
+ },
60
+ "./v11_7": {
61
+ "src": "./src/exports/b.ts",
62
+ "types": "./types/exports/b.d.ts",
63
+ "import": "./es/exports/b.js",
64
+ "require": "./lib/exports/b.js",
65
+ "default": "./es/exports/b.js"
66
+ },
67
+ "./latest": {
68
+ "src": "./src/exports/b.ts",
69
+ "types": "./types/exports/b.d.ts",
70
+ "import": "./es/exports/b.js",
71
+ "require": "./lib/exports/b.js",
72
+ "default": "./es/exports/b.js"
73
+ }
52
74
  },
53
75
  "scripts": {
54
76
  "lint": "ui-scripts lint",
@@ -31,11 +31,11 @@ import {
31
31
  pickProps
32
32
  } from '@instructure/ui-react-utils'
33
33
 
34
- import { GridRow } from '../GridRow'
35
- import type { GridRowProps } from '../GridRow/props'
36
- import { GridCol } from '../GridCol'
34
+ import { GridRow } from '../../GridRow/v1'
35
+ import type { GridRowProps } from '../../GridRow/v1/props'
36
+ import { GridCol } from '../../GridCol/v1'
37
37
 
38
- import { withStyle } from '@instructure/emotion'
38
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
39
39
 
40
40
  import generateStyle from './styles'
41
41
  import generateComponentTheme from './theme'
@@ -24,7 +24,7 @@
24
24
 
25
25
  import type { GridTheme, OtherHTMLAttributes } from '@instructure/shared-types'
26
26
  import type { WithStyleProps, ComponentStyle } from '@instructure/emotion'
27
- import type { GridBreakpoints } from '../GridTypes'
27
+ import type { GridBreakpoints } from '../../utils/v1/GridTypes'
28
28
 
29
29
  type GridOwnProps = {
30
30
  /**
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import type { GridTheme } from '@instructure/shared-types'
26
- import type { GridBreakpoints } from '../GridTypes'
26
+ import type { GridBreakpoints } from '../../utils/v1/GridTypes'
27
27
  import type { GridProps, GridStyle } from './props'
28
28
 
29
29
  /**