@instructure/ui-flex 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 (89) hide show
  1. package/CHANGELOG.md +30 -281
  2. package/es/Flex/{Item → v1/Item}/index.js +2 -2
  3. package/es/Flex/{index.js → v1/index.js} +2 -2
  4. package/es/Flex/v2/Item/index.js +97 -0
  5. package/es/Flex/v2/Item/props.js +26 -0
  6. package/es/Flex/v2/Item/styles.js +68 -0
  7. package/es/Flex/v2/index.js +119 -0
  8. package/es/Flex/v2/props.js +26 -0
  9. package/es/Flex/v2/styles.js +101 -0
  10. package/es/{index.js → exports/a.js} +1 -1
  11. package/{src/index.ts → es/exports/b.js} +1 -5
  12. package/lib/Flex/{Item → v1/Item}/index.js +3 -3
  13. package/lib/Flex/v1/index.js +135 -0
  14. package/lib/Flex/v2/Item/index.js +102 -0
  15. package/lib/Flex/v2/Item/props.js +31 -0
  16. package/lib/Flex/v2/Item/styles.js +74 -0
  17. package/lib/Flex/{index.js → v2/index.js} +3 -4
  18. package/lib/Flex/v2/props.js +31 -0
  19. package/lib/Flex/v2/styles.js +107 -0
  20. package/lib/{index.js → exports/a.js} +3 -3
  21. package/lib/exports/b.js +18 -0
  22. package/package.json +38 -16
  23. package/src/Flex/{Item → v1/Item}/index.tsx +2 -2
  24. package/src/Flex/{index.tsx → v1/index.tsx} +2 -2
  25. package/src/Flex/v2/Item/index.tsx +115 -0
  26. package/src/Flex/v2/Item/props.ts +146 -0
  27. package/src/Flex/v2/Item/styles.ts +66 -0
  28. package/src/Flex/v2/README.md +419 -0
  29. package/src/Flex/v2/index.tsx +157 -0
  30. package/src/Flex/v2/props.ts +152 -0
  31. package/src/Flex/v2/styles.ts +112 -0
  32. package/src/exports/a.ts +28 -0
  33. package/src/exports/b.ts +28 -0
  34. package/tsconfig.build.tsbuildinfo +1 -1
  35. package/types/Flex/v1/Item/index.d.ts.map +1 -0
  36. package/types/Flex/v1/Item/props.d.ts.map +1 -0
  37. package/types/Flex/v1/Item/styles.d.ts.map +1 -0
  38. package/types/Flex/v1/index.d.ts.map +1 -0
  39. package/types/Flex/v1/props.d.ts.map +1 -0
  40. package/types/Flex/v1/styles.d.ts.map +1 -0
  41. package/types/Flex/v1/theme.d.ts.map +1 -0
  42. package/types/Flex/v2/Item/index.d.ts +41 -0
  43. package/types/Flex/v2/Item/index.d.ts.map +1 -0
  44. package/types/Flex/v2/Item/props.d.ts +79 -0
  45. package/types/Flex/v2/Item/props.d.ts.map +1 -0
  46. package/types/Flex/v2/Item/styles.d.ts +14 -0
  47. package/types/Flex/v2/Item/styles.d.ts.map +1 -0
  48. package/types/Flex/v2/index.d.ts +49 -0
  49. package/types/Flex/v2/index.d.ts.map +1 -0
  50. package/types/Flex/v2/props.d.ts +83 -0
  51. package/types/Flex/v2/props.d.ts.map +1 -0
  52. package/types/Flex/v2/styles.d.ts +19 -0
  53. package/types/Flex/v2/styles.d.ts.map +1 -0
  54. package/types/exports/a.d.ts +4 -0
  55. package/types/exports/a.d.ts.map +1 -0
  56. package/types/exports/b.d.ts +4 -0
  57. package/types/exports/b.d.ts.map +1 -0
  58. package/types/Flex/Item/index.d.ts.map +0 -1
  59. package/types/Flex/Item/props.d.ts.map +0 -1
  60. package/types/Flex/Item/styles.d.ts.map +0 -1
  61. package/types/Flex/index.d.ts.map +0 -1
  62. package/types/Flex/props.d.ts.map +0 -1
  63. package/types/Flex/styles.d.ts.map +0 -1
  64. package/types/Flex/theme.d.ts.map +0 -1
  65. package/types/index.d.ts +0 -4
  66. package/types/index.d.ts.map +0 -1
  67. /package/es/Flex/{Item → v1/Item}/props.js +0 -0
  68. /package/es/Flex/{Item → v1/Item}/styles.js +0 -0
  69. /package/es/Flex/{props.js → v1/props.js} +0 -0
  70. /package/es/Flex/{styles.js → v1/styles.js} +0 -0
  71. /package/es/Flex/{theme.js → v1/theme.js} +0 -0
  72. /package/lib/Flex/{Item → v1/Item}/props.js +0 -0
  73. /package/lib/Flex/{Item → v1/Item}/styles.js +0 -0
  74. /package/lib/Flex/{props.js → v1/props.js} +0 -0
  75. /package/lib/Flex/{styles.js → v1/styles.js} +0 -0
  76. /package/lib/Flex/{theme.js → v1/theme.js} +0 -0
  77. /package/src/Flex/{Item → v1/Item}/props.ts +0 -0
  78. /package/src/Flex/{Item → v1/Item}/styles.ts +0 -0
  79. /package/src/Flex/{README.md → v1/README.md} +0 -0
  80. /package/src/Flex/{props.ts → v1/props.ts} +0 -0
  81. /package/src/Flex/{styles.ts → v1/styles.ts} +0 -0
  82. /package/src/Flex/{theme.ts → v1/theme.ts} +0 -0
  83. /package/types/Flex/{Item → v1/Item}/index.d.ts +0 -0
  84. /package/types/Flex/{Item → v1/Item}/props.d.ts +0 -0
  85. /package/types/Flex/{Item → v1/Item}/styles.d.ts +0 -0
  86. /package/types/Flex/{index.d.ts → v1/index.d.ts} +0 -0
  87. /package/types/Flex/{props.d.ts → v1/props.d.ts} +0 -0
  88. /package/types/Flex/{styles.d.ts → v1/styles.d.ts} +0 -0
  89. /package/types/Flex/{theme.d.ts → v1/theme.d.ts} +0 -0
@@ -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.Item = void 0;
8
+ var _react = require("react");
9
+ var _omitProps = require("@instructure/ui-react-utils/lib/omitProps.js");
10
+ var _latest = require("@instructure/ui-view/latest");
11
+ var _emotion = require("@instructure/emotion");
12
+ var _styles = _interopRequireDefault(require("./styles"));
13
+ var _props = require("./props");
14
+ var _jsxRuntime = require("@emotion/react/jsx-runtime");
15
+ var _dec, _class, _Item;
16
+ /*
17
+ * The MIT License (MIT)
18
+ *
19
+ * Copyright (c) 2015 - present Instructure, Inc.
20
+ *
21
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
22
+ * of this software and associated documentation files (the "Software"), to deal
23
+ * in the Software without restriction, including without limitation the rights
24
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
25
+ * copies of the Software, and to permit persons to whom the Software is
26
+ * furnished to do so, subject to the following conditions:
27
+ *
28
+ * The above copyright notice and this permission notice shall be included in all
29
+ * copies or substantial portions of the Software.
30
+ *
31
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
32
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
33
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
34
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
35
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
36
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
37
+ * SOFTWARE.
38
+ */
39
+ /**
40
+ ---
41
+ parent: Flex
42
+ id: Flex.Item
43
+ ---
44
+ **/
45
+ let Item = exports.Item = (_dec = (0, _emotion.withStyleLegacy)(_styles.default, null), _dec(_class = (_Item = class Item extends _react.Component {
46
+ constructor(...args) {
47
+ super(...args);
48
+ this.ref = null;
49
+ this.handleRef = el => {
50
+ const elementRef = this.props.elementRef;
51
+ this.ref = el;
52
+ if (typeof elementRef === 'function') {
53
+ elementRef(el);
54
+ }
55
+ };
56
+ }
57
+ componentDidMount() {
58
+ var _this$props$makeStyle, _this$props;
59
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
60
+ }
61
+ componentDidUpdate() {
62
+ var _this$props$makeStyle2, _this$props2;
63
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
64
+ }
65
+ render() {
66
+ const props = (0, _omitProps.omitProps)(this.props, Item.allowedProps);
67
+ const _this$props3 = this.props,
68
+ as = _this$props3.as,
69
+ children = _this$props3.children,
70
+ withVisualDebug = _this$props3.withVisualDebug,
71
+ textAlign = _this$props3.textAlign,
72
+ size = _this$props3.size,
73
+ direction = _this$props3.direction,
74
+ margin = _this$props3.margin,
75
+ padding = _this$props3.padding,
76
+ overflowX = _this$props3.overflowX,
77
+ overflowY = _this$props3.overflowY,
78
+ styles = _this$props3.styles;
79
+ const dirColumn = direction === 'column';
80
+ const dirRow = direction === 'row';
81
+ return (0, _jsxRuntime.jsx)(_latest.View, {
82
+ ...props,
83
+ css: styles === null || styles === void 0 ? void 0 : styles.flexItem,
84
+ elementRef: this.handleRef,
85
+ as: as,
86
+ minHeight: dirColumn ? size : void 0,
87
+ minWidth: dirRow ? size : void 0,
88
+ textAlign: textAlign,
89
+ margin: margin,
90
+ padding: padding,
91
+ overflowX: overflowX,
92
+ overflowY: overflowY || (dirColumn ? 'auto' : 'visible'),
93
+ withVisualDebug: withVisualDebug,
94
+ children: children
95
+ });
96
+ }
97
+ }, _Item.displayName = "Item", _Item.componentId = 'Flex.Item', _Item.allowedProps = _props.allowedProps, _Item.defaultProps = {
98
+ as: 'span',
99
+ shouldGrow: false,
100
+ shouldShrink: false
101
+ }, _Item)) || _class);
102
+ var _default = exports.default = Item;
@@ -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', 'as', 'elementRef', 'margin', 'padding', 'align', 'direction', 'textAlign', 'overflowX', 'overflowY', 'shouldGrow', 'shouldShrink', 'size', 'withVisualDebug', 'order'];
@@ -0,0 +1,74 @@
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 shouldGrow = props.shouldGrow,
43
+ shouldShrink = props.shouldShrink,
44
+ align = props.align,
45
+ size = props.size,
46
+ order = props.order;
47
+ const alignSelfValues = {
48
+ start: 'flex-start',
49
+ end: 'flex-end',
50
+ center: 'center',
51
+ stretch: 'stretch'
52
+ };
53
+ return {
54
+ flexItem: {
55
+ label: 'flexItem',
56
+ boxSizing: 'border-box',
57
+ minWidth: '0.0625rem',
58
+ flexBasis: size,
59
+ ...(order !== void 0 ? {
60
+ order
61
+ } : {}),
62
+ // initial value is 1, but we want 0 as our default,
63
+ // so users can opt in to shrink like they do grow
64
+ flexShrink: shouldShrink ? 1 : 0,
65
+ ...(shouldGrow && {
66
+ flexGrow: 1
67
+ }),
68
+ ...(align && {
69
+ alignSelf: alignSelfValues[align]
70
+ })
71
+ }
72
+ };
73
+ };
74
+ var _default = exports.default = generateStyle;
@@ -17,11 +17,10 @@ var _safeCloneElement = require("@instructure/ui-react-utils/lib/safeCloneElemen
17
17
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
18
18
  var _matchComponentTypes = require("@instructure/ui-react-utils/lib/matchComponentTypes.js");
19
19
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
20
- var _View = require("@instructure/ui-view/lib/View");
20
+ var _latest = require("@instructure/ui-view/latest");
21
21
  var _emotion = require("@instructure/emotion");
22
22
  var _Item = require("./Item");
23
23
  var _styles = _interopRequireDefault(require("./styles"));
24
- var _theme = _interopRequireDefault(require("./theme"));
25
24
  var _props = require("./props");
26
25
  var _jsxRuntime = require("@emotion/react/jsx-runtime");
27
26
  var _dec, _class, _Flex;
@@ -54,7 +53,7 @@ category: components
54
53
  ---
55
54
  @module Flex
56
55
  **/
57
- let Flex = exports.Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec(_class = (_Flex = class Flex extends _react.Component {
56
+ let Flex = exports.Flex = (_dec = (0, _emotion.withStyle)(_styles.default), _dec(_class = (_Flex = class Flex extends _react.Component {
58
57
  constructor(...args) {
59
58
  super(...args);
60
59
  this.ref = null;
@@ -105,7 +104,7 @@ let Flex = exports.Flex = (_dec = (0, _emotion.withStyle)(_styles.default, _them
105
104
  const gapValuesArray = gap === null || gap === void 0 ? void 0 : gap.split(' ');
106
105
  if (gapValuesArray.length > 1 && wrap === 'no-wrap') {}
107
106
  if (children && _react.Children.count(children) > 0) {
108
- return (0, _jsxRuntime.jsx)(_View.View, {
107
+ return (0, _jsxRuntime.jsx)(_latest.View, {
109
108
  ...(0, _passthroughProps.passthroughProps)(this.props),
110
109
  css: styles === null || styles === void 0 ? void 0 : styles.flex,
111
110
  elementRef: this.handleRef,
@@ -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', 'as', 'elementRef', 'height', 'width', 'margin', 'padding', 'display', 'textAlign', 'direction', 'alignItems', 'justifyItems', 'wrap', 'withVisualDebug'];
@@ -0,0 +1,107 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+ var _emotion = require("@instructure/emotion");
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 {string} props.justifyItems
40
+ * @param {string} props.direction
41
+ * @param {string} props.alignItems
42
+ * @param {string} props.wrap
43
+ * @param {Object} state the state of the component, the style is applied to
44
+ * @return {Object} The final style object, which will be used in the component
45
+ */
46
+
47
+ const generateStyle = (componentTheme, props, sharedTokens) => {
48
+ const justifyItems = props.justifyItems,
49
+ wrap = props.wrap,
50
+ direction = props.direction,
51
+ gap = props.gap;
52
+
53
+ // align-items css prop
54
+ // When flex direction is row, 'center' is the most useful default because it
55
+ // vertically aligns Items. For column direction, though, we want 'stretch'.
56
+ const alignItems = props.alignItems || (direction === 'column' || direction === 'column-reverse' ? 'stretch' : 'center');
57
+ const alignItemsValues = {
58
+ center: 'center',
59
+ start: 'flex-start',
60
+ end: 'flex-end',
61
+ stretch: 'stretch'
62
+ };
63
+
64
+ // justify-content css prop
65
+ const justifyItemsValues = {
66
+ start: 'flex-start',
67
+ end: 'flex-end',
68
+ center: 'center',
69
+ 'space-around': 'space-around',
70
+ 'space-between': 'space-between'
71
+ };
72
+
73
+ // wrap css prop
74
+ const wrapValues = {
75
+ wrap: 'wrap',
76
+ 'wrap-reverse': 'wrap-reverse',
77
+ 'no-wrap': void 0
78
+ };
79
+
80
+ // flex-direction css props
81
+ const flexDirectionValues = {
82
+ column: 'column',
83
+ 'column-reverse': 'column-reverse',
84
+ row: 'row',
85
+ 'row-reverse': 'row-reverse'
86
+ };
87
+
88
+ // gap css prop
89
+ const gapValues = (0, _emotion.makeThemeVars)('gap', {
90
+ ...sharedTokens.spacing,
91
+ ...sharedTokens.legacy.spacing
92
+ });
93
+ const getGapValue = (gap, values) => (0, _emotion.getShorthandPropValue)('Flex', values, gap, 'gap');
94
+ return {
95
+ flex: {
96
+ label: 'flex',
97
+ fontFamily: componentTheme.fontFamily,
98
+ boxSizing: 'border-box',
99
+ alignItems: alignItemsValues[alignItems],
100
+ justifyContent: justifyItemsValues[justifyItems],
101
+ flexWrap: wrapValues[wrap],
102
+ flexDirection: flexDirectionValues[direction],
103
+ gap: getGapValue(gap, gapValues)
104
+ }
105
+ };
106
+ };
107
+ var _default = exports.default = generateStyle;
@@ -6,13 +6,13 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "Flex", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Flex.Flex;
9
+ return _v.Flex;
10
10
  }
11
11
  });
12
12
  Object.defineProperty(exports, "FlexItem", {
13
13
  enumerable: true,
14
14
  get: function () {
15
- return _Flex.FlexItem;
15
+ return _v.FlexItem;
16
16
  }
17
17
  });
18
- var _Flex = require("./Flex");
18
+ var _v = require("../Flex/v1");
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "Flex", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _v.Flex;
10
+ }
11
+ });
12
+ Object.defineProperty(exports, "FlexItem", {
13
+ enumerable: true,
14
+ get: function () {
15
+ return _v.FlexItem;
16
+ }
17
+ });
18
+ var _v = require("../Flex/v2");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-flex",
3
- "version": "11.6.0",
3
+ "version": "11.6.1-snapshot-129",
4
4
  "description": "A component that makes it easy to align content using flexbox CSS",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "module": "./es/index.js",
@@ -15,19 +15,19 @@
15
15
  "license": "MIT",
16
16
  "dependencies": {
17
17
  "@babel/runtime": "^7.27.6",
18
- "@instructure/console": "11.6.0",
19
- "@instructure/emotion": "11.6.0",
20
- "@instructure/shared-types": "11.6.0",
21
- "@instructure/ui-react-utils": "11.6.0",
22
- "@instructure/ui-view": "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-view": "11.6.1-snapshot-129",
22
+ "@instructure/ui-react-utils": "11.6.1-snapshot-129"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@testing-library/jest-dom": "^6.6.3",
26
26
  "@testing-library/react": "15.0.7",
27
27
  "vitest": "^3.2.2",
28
- "@instructure/ui-axe-check": "11.6.0",
29
- "@instructure/ui-babel-preset": "11.6.0",
30
- "@instructure/ui-themes": "11.6.0"
28
+ "@instructure/ui-axe-check": "11.6.1-snapshot-129",
29
+ "@instructure/ui-themes": "11.6.1-snapshot-129",
30
+ "@instructure/ui-babel-preset": "11.6.1-snapshot-129"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "react": ">=18 <=19"
@@ -37,17 +37,39 @@
37
37
  },
38
38
  "sideEffects": false,
39
39
  "exports": {
40
- ".": {
41
- "types": "./types/index.d.ts",
42
- "import": "./es/index.js",
43
- "require": "./lib/index.js",
44
- "default": "./es/index.js"
45
- },
46
40
  "./lib/*": "./lib/*",
47
41
  "./es/*": "./es/*",
48
42
  "./types/*": "./types/*",
49
43
  "./package.json": "./package.json",
50
- "./src/*": "./src/*"
44
+ "./src/*": "./src/*",
45
+ ".": {
46
+ "src": "./src/exports/a.ts",
47
+ "types": "./types/exports/a.d.ts",
48
+ "import": "./es/exports/a.js",
49
+ "require": "./lib/exports/a.js",
50
+ "default": "./es/exports/a.js"
51
+ },
52
+ "./v11_6": {
53
+ "src": "./src/exports/a.ts",
54
+ "types": "./types/exports/a.d.ts",
55
+ "import": "./es/exports/a.js",
56
+ "require": "./lib/exports/a.js",
57
+ "default": "./es/exports/a.js"
58
+ },
59
+ "./v11_7": {
60
+ "src": "./src/exports/b.ts",
61
+ "types": "./types/exports/b.d.ts",
62
+ "import": "./es/exports/b.js",
63
+ "require": "./lib/exports/b.js",
64
+ "default": "./es/exports/b.js"
65
+ },
66
+ "./latest": {
67
+ "src": "./src/exports/b.ts",
68
+ "types": "./types/exports/b.d.ts",
69
+ "import": "./es/exports/b.js",
70
+ "require": "./lib/exports/b.js",
71
+ "default": "./es/exports/b.js"
72
+ }
51
73
  },
52
74
  "scripts": {
53
75
  "lint": "ui-scripts lint",
@@ -25,8 +25,8 @@
25
25
  import { Component } from 'react'
26
26
 
27
27
  import { omitProps } from '@instructure/ui-react-utils'
28
- import { View } from '@instructure/ui-view'
29
- import { withStyle } from '@instructure/emotion'
28
+ import { View } from '@instructure/ui-view/v11_6'
29
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
30
30
 
31
31
  import generateStyle from './styles'
32
32
 
@@ -30,8 +30,8 @@ import {
30
30
  matchComponentTypes,
31
31
  callRenderProp
32
32
  } from '@instructure/ui-react-utils'
33
- import { View } from '@instructure/ui-view'
34
- import { withStyle } from '@instructure/emotion'
33
+ import { View } from '@instructure/ui-view/v11_6'
34
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
35
35
 
36
36
  import { Item } from './Item'
37
37
  import type { FlexItemProps } from './Item/props'
@@ -0,0 +1,115 @@
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
+ import { Component } from 'react'
26
+
27
+ import { omitProps } from '@instructure/ui-react-utils'
28
+ import { View } from '@instructure/ui-view/latest'
29
+ import { withStyleLegacy as withStyle } from '@instructure/emotion'
30
+
31
+ import generateStyle from './styles'
32
+
33
+ import { allowedProps } from './props'
34
+ import type { FlexItemProps } from './props'
35
+
36
+ /**
37
+ ---
38
+ parent: Flex
39
+ id: Flex.Item
40
+ ---
41
+ **/
42
+ @withStyle(generateStyle, null)
43
+ class Item extends Component<FlexItemProps> {
44
+ static readonly componentId = 'Flex.Item'
45
+
46
+ componentDidMount() {
47
+ this.props.makeStyles?.()
48
+ }
49
+
50
+ componentDidUpdate() {
51
+ this.props.makeStyles?.()
52
+ }
53
+
54
+ static allowedProps = allowedProps
55
+ static defaultProps = {
56
+ as: 'span',
57
+ shouldGrow: false,
58
+ shouldShrink: false
59
+ }
60
+
61
+ ref: Element | null = null
62
+
63
+ handleRef = (el: Element | null) => {
64
+ const { elementRef } = this.props
65
+
66
+ this.ref = el
67
+
68
+ if (typeof elementRef === 'function') {
69
+ elementRef(el)
70
+ }
71
+ }
72
+
73
+ render() {
74
+ const props = omitProps(this.props, Item.allowedProps)
75
+
76
+ const {
77
+ as,
78
+ children,
79
+ withVisualDebug,
80
+ textAlign,
81
+ size,
82
+ direction,
83
+ margin,
84
+ padding,
85
+ overflowX,
86
+ overflowY,
87
+ styles
88
+ } = this.props
89
+
90
+ const dirColumn = direction === 'column'
91
+ const dirRow = direction === 'row'
92
+
93
+ return (
94
+ <View
95
+ {...props}
96
+ css={styles?.flexItem}
97
+ elementRef={this.handleRef}
98
+ as={as}
99
+ minHeight={dirColumn ? size : undefined}
100
+ minWidth={dirRow ? size : undefined}
101
+ textAlign={textAlign}
102
+ margin={margin}
103
+ padding={padding}
104
+ overflowX={overflowX}
105
+ overflowY={overflowY || (dirColumn ? 'auto' : 'visible')}
106
+ withVisualDebug={withVisualDebug}
107
+ >
108
+ {children}
109
+ </View>
110
+ )
111
+ }
112
+ }
113
+
114
+ export default Item
115
+ export { Item }