@react-spectrum/layout 3.0.0-alpha.1 → 3.0.0-nightly-641446f65-240905

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.
@@ -0,0 +1 @@
1
+ {"mappings":";;;;AAAA;;;;;;;;;;CAUC;;;AAeD,MAAM,uCAAgC;IACpC,GAAG,CAAA,GAAA,qBAAa,CAAC;IACjB,UAAU;QAAC;QAAgB,CAAA,GAAA,uBAAe;KAAE;IAC5C,aAAa;QAAC;QAAmB;KAAmB;IACpD,UAAU;QAAC;QAAgB;KAAmB;IAC9C,OAAO;QAAC;QAAqB;KAAuB;IACpD,SAAS;QAAC;QAAuB;KAAkB;IACnD,MAAM;QAAC;QAAoB;KAAkB;IAC7C,KAAK;QAAC;QAAO,CAAA,GAAA,qBAAa;KAAE;IAC5B,QAAQ;QAAC;QAAU,CAAA,GAAA,qBAAa;KAAE;IAClC,WAAW;QAAC;QAAa,CAAA,GAAA,qBAAa;KAAE;IACxC,cAAc;QAAC;QAAgB,CAAA,GAAA,uBAAe;KAAE;IAChD,gBAAgB;QAAC;QAAkB,CAAA,GAAA,uBAAe;KAAE;IACpD,YAAY;QAAC;QAAc,CAAA,GAAA,uBAAe;KAAE;IAC5C,cAAc;QAAC;QAAgB,CAAA,GAAA,uBAAe;KAAE;AAClD;AAEA,SAAS,2BAAK,KAAgB,EAAE,GAA2B;IACzD,IAAI,YACF,QAAQ,EACR,GAAG,YACJ,GAAG;IACJ,IAAI,cAAC,UAAU,EAAC,GAAG,CAAA,GAAA,oBAAY,EAAE,YAAY;IAC7C,WAAW,KAAK,CAAC,OAAO,GAAG,QAAQ,eAAe;IAClD,IAAI,SAAS,CAAA,GAAA,gBAAQ,EAAE;IAEvB,qBACE,gCAAC;QAAK,GAAG,CAAA,GAAA,qBAAa,EAAE,WAAW;QAAG,GAAG,UAAU;QAAE,KAAK;OACvD;AAGP;AAQO,SAAS,0CAAO,KAAwC,EAAE,MAAyC;IACxG,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,wCAAkB,QAAQ,CAAC,CAAC;AACzD;AAQO,SAAS,0CAAO,GAAmB,EAAE,GAAmB;IAC7D,OAAO,CAAC,OAAO,EAAE,yCAAmB,KAAK,EAAE,EAAE,yCAAmB,KAAK,CAAC,CAAC;AACzE;AAOO,SAAS,0CAAW,SAAyB;IAClD,OAAO,CAAC,YAAY,EAAE,yCAAmB,WAAW,CAAC,CAAC;AACxD;AAEA,SAAS,6CAAuB,KAAK;IACnC,OAAO,MAAM,GAAG,CAAC,CAAA,IAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,CAAC;AACvC;AAEA,SAAS,yCAAmB,KAAK;IAC/B,IAAI,kEAAkE,IAAI,CAAC,QACzE,OAAO;IAGT,OAAO,CAAA,GAAA,qBAAa,EAAE;AACxB;AAEA,SAAS,wCAAkB,KAAK;IAC9B,IAAI,MAAM,OAAO,CAAC,QAChB,OAAO,MAAM,GAAG,CAAC,0CAAoB,IAAI,CAAC;IAG5C,OAAO,yCAAmB;AAC5B;AAEA;;;CAGC,GACD,MAAM,0DAAQ,CAAA,GAAA,iBAAS,EAAE","sources":["packages/@react-spectrum/layout/src/Grid.tsx"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n baseStyleProps,\n dimensionValue,\n passthroughStyle,\n StyleHandlers,\n useDOMRef,\n useStyleProps\n} from '@react-spectrum/utils';\nimport {DimensionValue, DOMRef} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\nimport {GridProps} from '@react-types/layout';\nimport React, {forwardRef} from 'react';\n\nconst gridStyleProps: StyleHandlers = {\n ...baseStyleProps,\n autoFlow: ['gridAutoFlow', passthroughStyle],\n autoColumns: ['gridAutoColumns', gridDimensionValue],\n autoRows: ['gridAutoRows', gridDimensionValue],\n areas: ['gridTemplateAreas', gridTemplateAreasValue],\n columns: ['gridTemplateColumns', gridTemplateValue],\n rows: ['gridTemplateRows', gridTemplateValue],\n gap: ['gap', dimensionValue],\n rowGap: ['rowGap', dimensionValue],\n columnGap: ['columnGap', dimensionValue],\n justifyItems: ['justifyItems', passthroughStyle],\n justifyContent: ['justifyContent', passthroughStyle],\n alignItems: ['alignItems', passthroughStyle],\n alignContent: ['alignContent', passthroughStyle]\n};\n\nfunction Grid(props: GridProps, ref: DOMRef<HTMLDivElement>) {\n let {\n children,\n ...otherProps\n } = props;\n let {styleProps} = useStyleProps(otherProps, gridStyleProps);\n styleProps.style.display = 'grid'; // inline-grid?\n let domRef = useDOMRef(ref);\n\n return (\n <div {...filterDOMProps(otherProps)} {...styleProps} ref={domRef}>\n {children}\n </div>\n );\n}\n\n/**\n * Can be used to make a repeating fragment of the columns or rows list.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat).\n * @param count - The number of times to repeat the fragment.\n * @param repeat - The fragment to repeat.\n */\nexport function repeat(count: number | 'auto-fill' | 'auto-fit', repeat: DimensionValue | DimensionValue[]): string {\n return `repeat(${count}, ${gridTemplateValue(repeat)})`;\n}\n\n/**\n * Defines a size range greater than or equal to min and less than or equal to max.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/minmax).\n * @param min - The minimum size.\n * @param max - The maximum size.\n */\nexport function minmax(min: DimensionValue, max: DimensionValue): string {\n return `minmax(${gridDimensionValue(min)}, ${gridDimensionValue(max)})`;\n}\n\n/**\n * Clamps a given size to an available size.\n * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content).\n * @param dimension - The size to clamp.\n */\nexport function fitContent(dimension: DimensionValue): string {\n return `fit-content(${gridDimensionValue(dimension)})`;\n}\n\nfunction gridTemplateAreasValue(value) {\n return value.map(v => `\"${v}\"`).join('\\n');\n}\n\nfunction gridDimensionValue(value) {\n if (/^max-content|min-content|minmax|auto|fit-content|repeat|subgrid/.test(value)) {\n return value;\n }\n\n return dimensionValue(value);\n}\n\nfunction gridTemplateValue(value) {\n if (Array.isArray(value)) {\n return value.map(gridDimensionValue).join(' ');\n }\n\n return gridDimensionValue(value);\n}\n\n/**\n * A layout container using CSS grid. Supports Spectrum dimensions as values to\n * ensure consistent and adaptive sizing and spacing.\n */\nconst _Grid = forwardRef(Grid);\nexport {_Grid as Grid};\n"],"names":[],"version":3,"file":"Grid.module.js.map"}
@@ -0,0 +1,17 @@
1
+ .NW91UW_flex-container, .NW91UW_flex {
2
+ display: flex;
3
+ }
4
+
5
+ .NW91UW_flex-gap {
6
+ --gap: 0px;
7
+ --column-gap: var(--gap);
8
+ --row-gap: var(--gap);
9
+ margin: calc(var(--row-gap) / -2) calc(var(--column-gap) / -2);
10
+ width: calc(100% + calc(var(--column-gap) + 1px));
11
+ height: calc(100% + var(--row-gap));
12
+ }
13
+
14
+ .NW91UW_flex-container .NW91UW_flex-gap > * {
15
+ margin: calc(var(--row-gap) / 2) calc(var(--column-gap) / 2);
16
+ }
17
+ /*# sourceMappingURL=flex-gap.27391a03.css.map */
@@ -0,0 +1 @@
1
+ {"mappings":"AAYA;;;;AASA;;;;;;;;;AAmBA","sources":["packages/@react-spectrum/layout/src/flex-gap.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.flex-container {\n /* this is necessary so that the inner margins don't affect anything outside */\n display: flex;\n}\n\n.flex {\n display: flex;\n}\n\n.flex-gap {\n --gap: 0px;\n --column-gap: var(--gap);\n --row-gap: var(--gap);\n\n /* apply a negative margin to counteract the margin on each item at the edges */\n margin: calc(var(--row-gap) / -2) calc(var(--column-gap) / -2);\n\n /* increase the width and height to account for this margin */\n /* Add 1px to fix rounding error in Safari (╯°□°)╯︵ ┻━┻ */\n width: calc(100% + calc(var(--column-gap) + 1px));\n height: calc(100% + var(--row-gap));\n}\n\n/* If the selector was .flex-gap > *, it wouldn't override when components have a margin 0 specified by a single\n * class selector, specificity is equal. Both are one class. Neither > nor * contribute to specificity.\n * We need to make it more specific, so we raise it by 1 class.\n */\n.flex-container .flex-gap > * {\n /* apply half of the gap to each side of every item */\n margin: calc(var(--row-gap) / 2) calc(var(--column-gap) / 2);\n}\n"],"names":[],"version":3,"file":"flex-gap.27391a03.css.map"}
@@ -0,0 +1,17 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+
6
+ $parcel$export(module.exports, "flex", () => $12be0ef8be5abc46$export$97691fbb80847c19, (v) => $12be0ef8be5abc46$export$97691fbb80847c19 = v);
7
+ $parcel$export(module.exports, "flex-container", () => $12be0ef8be5abc46$export$69d7a39fa31a000b, (v) => $12be0ef8be5abc46$export$69d7a39fa31a000b = v);
8
+ $parcel$export(module.exports, "flex-gap", () => $12be0ef8be5abc46$export$31a9da8b58047a44, (v) => $12be0ef8be5abc46$export$31a9da8b58047a44 = v);
9
+ var $12be0ef8be5abc46$export$97691fbb80847c19;
10
+ var $12be0ef8be5abc46$export$69d7a39fa31a000b;
11
+ var $12be0ef8be5abc46$export$31a9da8b58047a44;
12
+ $12be0ef8be5abc46$export$97691fbb80847c19 = `NW91UW_flex`;
13
+ $12be0ef8be5abc46$export$69d7a39fa31a000b = `NW91UW_flex-container`;
14
+ $12be0ef8be5abc46$export$31a9da8b58047a44 = `NW91UW_flex-gap`;
15
+
16
+
17
+ //# sourceMappingURL=flex-gap_css.main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AAFA,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA6B,CAAC,eAAe,CAAC","sources":["packages/@react-spectrum/layout/src/flex-gap.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.flex-container {\n /* this is necessary so that the inner margins don't affect anything outside */\n display: flex;\n}\n\n.flex {\n display: flex;\n}\n\n.flex-gap {\n --gap: 0px;\n --column-gap: var(--gap);\n --row-gap: var(--gap);\n\n /* apply a negative margin to counteract the margin on each item at the edges */\n margin: calc(var(--row-gap) / -2) calc(var(--column-gap) / -2);\n\n /* increase the width and height to account for this margin */\n /* Add 1px to fix rounding error in Safari (╯°□°)╯︵ ┻━┻ */\n width: calc(100% + calc(var(--column-gap) + 1px));\n height: calc(100% + var(--row-gap));\n}\n\n/* If the selector was .flex-gap > *, it wouldn't override when components have a margin 0 specified by a single\n * class selector, specificity is equal. Both are one class. Neither > nor * contribute to specificity.\n * We need to make it more specific, so we raise it by 1 class.\n */\n.flex-container .flex-gap > * {\n /* apply half of the gap to each side of every item */\n margin: calc(var(--row-gap) / 2) calc(var(--column-gap) / 2);\n}\n"],"names":[],"version":3,"file":"flex-gap_css.main.js.map"}
@@ -0,0 +1,19 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $01dd1839b5376a46$exports = {};
6
+
7
+ $parcel$export($01dd1839b5376a46$exports, "flex", () => $01dd1839b5376a46$export$97691fbb80847c19, (v) => $01dd1839b5376a46$export$97691fbb80847c19 = v);
8
+ $parcel$export($01dd1839b5376a46$exports, "flex-container", () => $01dd1839b5376a46$export$69d7a39fa31a000b, (v) => $01dd1839b5376a46$export$69d7a39fa31a000b = v);
9
+ $parcel$export($01dd1839b5376a46$exports, "flex-gap", () => $01dd1839b5376a46$export$31a9da8b58047a44, (v) => $01dd1839b5376a46$export$31a9da8b58047a44 = v);
10
+ var $01dd1839b5376a46$export$97691fbb80847c19;
11
+ var $01dd1839b5376a46$export$69d7a39fa31a000b;
12
+ var $01dd1839b5376a46$export$31a9da8b58047a44;
13
+ $01dd1839b5376a46$export$97691fbb80847c19 = `NW91UW_flex`;
14
+ $01dd1839b5376a46$export$69d7a39fa31a000b = `NW91UW_flex-container`;
15
+ $01dd1839b5376a46$export$31a9da8b58047a44 = `NW91UW_flex-gap`;
16
+
17
+
18
+ export {$01dd1839b5376a46$exports as default};
19
+ //# sourceMappingURL=flex-gap_css.module.js.map
@@ -0,0 +1,19 @@
1
+
2
+ function $parcel$export(e, n, v, s) {
3
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
4
+ }
5
+ var $01dd1839b5376a46$exports = {};
6
+
7
+ $parcel$export($01dd1839b5376a46$exports, "flex", () => $01dd1839b5376a46$export$97691fbb80847c19, (v) => $01dd1839b5376a46$export$97691fbb80847c19 = v);
8
+ $parcel$export($01dd1839b5376a46$exports, "flex-container", () => $01dd1839b5376a46$export$69d7a39fa31a000b, (v) => $01dd1839b5376a46$export$69d7a39fa31a000b = v);
9
+ $parcel$export($01dd1839b5376a46$exports, "flex-gap", () => $01dd1839b5376a46$export$31a9da8b58047a44, (v) => $01dd1839b5376a46$export$31a9da8b58047a44 = v);
10
+ var $01dd1839b5376a46$export$97691fbb80847c19;
11
+ var $01dd1839b5376a46$export$69d7a39fa31a000b;
12
+ var $01dd1839b5376a46$export$31a9da8b58047a44;
13
+ $01dd1839b5376a46$export$97691fbb80847c19 = `NW91UW_flex`;
14
+ $01dd1839b5376a46$export$69d7a39fa31a000b = `NW91UW_flex-container`;
15
+ $01dd1839b5376a46$export$31a9da8b58047a44 = `NW91UW_flex-gap`;
16
+
17
+
18
+ export {$01dd1839b5376a46$exports as default};
19
+ //# sourceMappingURL=flex-gap_css.module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;AAAA,IAAA;AACA,IAAA;AACA,IAAA;AAFA,4CAAyB,CAAC,WAAW,CAAC;AACtC,4CAAmC,CAAC,qBAAqB,CAAC;AAC1D,4CAA6B,CAAC,eAAe,CAAC","sources":["packages/@react-spectrum/layout/src/flex-gap.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n.flex-container {\n /* this is necessary so that the inner margins don't affect anything outside */\n display: flex;\n}\n\n.flex {\n display: flex;\n}\n\n.flex-gap {\n --gap: 0px;\n --column-gap: var(--gap);\n --row-gap: var(--gap);\n\n /* apply a negative margin to counteract the margin on each item at the edges */\n margin: calc(var(--row-gap) / -2) calc(var(--column-gap) / -2);\n\n /* increase the width and height to account for this margin */\n /* Add 1px to fix rounding error in Safari (╯°□°)╯︵ ┻━┻ */\n width: calc(100% + calc(var(--column-gap) + 1px));\n height: calc(100% + var(--row-gap));\n}\n\n/* If the selector was .flex-gap > *, it wouldn't override when components have a margin 0 specified by a single\n * class selector, specificity is equal. Both are one class. Neither > nor * contribute to specificity.\n * We need to make it more specific, so we raise it by 1 class.\n */\n.flex-container .flex-gap > * {\n /* apply half of the gap to each side of every item */\n margin: calc(var(--row-gap) / 2) calc(var(--column-gap) / 2);\n}\n"],"names":[],"version":3,"file":"flex-gap_css.module.js.map"}
@@ -0,0 +1,20 @@
1
+ import {fitContent as $994c48bfb00b620b$export$2f0b47b0911ce698, Grid as $994c48bfb00b620b$export$ef2184bd89960b14, minmax as $994c48bfb00b620b$export$9c1b655deaca4988, repeat as $994c48bfb00b620b$export$76d90c956114f2c2} from "./Grid.mjs";
2
+ import {Flex as $884c64d19340d345$export$f51f4c4ede09e011} from "./Flex.mjs";
3
+
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ /// <reference types="css-module-types" />
15
+
16
+
17
+
18
+
19
+ export {$994c48bfb00b620b$export$76d90c956114f2c2 as repeat, $994c48bfb00b620b$export$9c1b655deaca4988 as minmax, $994c48bfb00b620b$export$2f0b47b0911ce698 as fitContent, $994c48bfb00b620b$export$ef2184bd89960b14 as Grid, $884c64d19340d345$export$f51f4c4ede09e011 as Flex};
20
+ //# sourceMappingURL=module.js.map
package/dist/main.js CHANGED
@@ -1,59 +1,29 @@
1
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
1
+ var $65aafe8662d00781$exports = require("./Grid.main.js");
2
+ var $a2ef5497697e8437$exports = require("./Flex.main.js");
2
3
 
3
- var _babelRuntimeHelpersObjectWithoutProperties = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
4
4
 
5
- var _temp = require("@react-spectrum/utils");
6
-
7
- var filterDOMProps = _temp.filterDOMProps;
8
- var gridStyleProps = _temp.gridStyleProps;
9
- var useDOMRef = _temp.useDOMRef;
10
- var useStyleProps = _temp.useStyleProps;
11
- var flexStyleProps = _temp.flexStyleProps;
12
-
13
- var _react2 = require("react");
14
-
15
- var _react = $parcel$interopDefault(_react2);
16
-
17
- var forwardRef = _react2.forwardRef;
18
-
19
- function $parcel$interopDefault(a) {
20
- return a && a.__esModule ? a.default : a;
21
- }
22
-
23
- function $bd62d28075b6b841c88fe57de44bdc3$var$Grid(props, ref) {
24
- var children = props.children,
25
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(props, ["children"]);
26
-
27
- var _useStyleProps = useStyleProps(otherProps, gridStyleProps),
28
- styleProps = _useStyleProps.styleProps;
29
-
30
- styleProps.style.display = 'grid'; // inline-grid?
31
-
32
- var domRef = useDOMRef(ref);
33
- return (/*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
34
- ref: domRef
35
- }), children)
36
- );
5
+ function $parcel$export(e, n, v, s) {
6
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
37
7
  }
38
8
 
39
- var Grid = forwardRef($bd62d28075b6b841c88fe57de44bdc3$var$Grid);
40
- exports.Grid = Grid;
41
-
42
- function $ead627e26ff771b74d9888896ccfad$var$Flex(props, ref) {
43
- var children = props.children,
44
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(props, ["children"]);
9
+ $parcel$export(module.exports, "repeat", () => $65aafe8662d00781$exports.repeat);
10
+ $parcel$export(module.exports, "minmax", () => $65aafe8662d00781$exports.minmax);
11
+ $parcel$export(module.exports, "fitContent", () => $65aafe8662d00781$exports.fitContent);
12
+ $parcel$export(module.exports, "Grid", () => $65aafe8662d00781$exports.Grid);
13
+ $parcel$export(module.exports, "Flex", () => $a2ef5497697e8437$exports.Flex);
14
+ /*
15
+ * Copyright 2020 Adobe. All rights reserved.
16
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
17
+ * you may not use this file except in compliance with the License. You may obtain a copy
18
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
19
+ *
20
+ * Unless required by applicable law or agreed to in writing, software distributed under
21
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
22
+ * OF ANY KIND, either express or implied. See the License for the specific language
23
+ * governing permissions and limitations under the License.
24
+ */ /// <reference types="css-module-types" />
45
25
 
46
- var _useStyleProps = useStyleProps(otherProps, flexStyleProps),
47
- styleProps = _useStyleProps.styleProps;
48
26
 
49
- styleProps.style.display = 'flex'; // inline-flex?
50
27
 
51
- var domRef = useDOMRef(ref);
52
- return (/*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
53
- ref: domRef
54
- }), children)
55
- );
56
- }
57
28
 
58
- var Flex = forwardRef($ead627e26ff771b74d9888896ccfad$var$Flex);
59
- exports.Flex = Flex;
29
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {repeat, minmax, fitContent, Grid} from './Grid';\nexport {Flex} from './Flex';\nexport type {DimensionValue} from '@react-types/shared';\nexport type {FlexProps, GridProps} from '@react-types/layout';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,44 +1,20 @@
1
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
2
- import _babelRuntimeHelpersEsmObjectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import { filterDOMProps, gridStyleProps, useDOMRef, useStyleProps, flexStyleProps } from "@react-spectrum/utils";
4
- import _react, { forwardRef } from "react";
1
+ import {fitContent as $994c48bfb00b620b$export$2f0b47b0911ce698, Grid as $994c48bfb00b620b$export$ef2184bd89960b14, minmax as $994c48bfb00b620b$export$9c1b655deaca4988, repeat as $994c48bfb00b620b$export$76d90c956114f2c2} from "./Grid.module.js";
2
+ import {Flex as $884c64d19340d345$export$f51f4c4ede09e011} from "./Flex.module.js";
5
3
 
6
- function $d99f94699068126d2406add01649cb90$var$Grid(props, ref) {
7
- let {
8
- children
9
- } = props,
10
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["children"]);
4
+ /*
5
+ * Copyright 2020 Adobe. All rights reserved.
6
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License. You may obtain a copy
8
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software distributed under
11
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
12
+ * OF ANY KIND, either express or implied. See the License for the specific language
13
+ * governing permissions and limitations under the License.
14
+ */ /// <reference types="css-module-types" />
11
15
 
12
- let {
13
- styleProps
14
- } = useStyleProps(otherProps, gridStyleProps);
15
- styleProps.style.display = 'grid'; // inline-grid?
16
16
 
17
- let domRef = useDOMRef(ref);
18
- return (/*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
19
- ref: domRef
20
- }), children)
21
- );
22
- }
23
17
 
24
- export const Grid = forwardRef($d99f94699068126d2406add01649cb90$var$Grid);
25
18
 
26
- function $d35d5a99ecac3fe7880f5be28ee4e7$var$Flex(props, ref) {
27
- let {
28
- children
29
- } = props,
30
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["children"]);
31
-
32
- let {
33
- styleProps
34
- } = useStyleProps(otherProps, flexStyleProps);
35
- styleProps.style.display = 'flex'; // inline-flex?
36
-
37
- let domRef = useDOMRef(ref);
38
- return (/*#__PURE__*/_react.createElement("div", _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
39
- ref: domRef
40
- }), children)
41
- );
42
- }
43
-
44
- export const Flex = forwardRef($d35d5a99ecac3fe7880f5be28ee4e7$var$Flex);
19
+ export {$994c48bfb00b620b$export$76d90c956114f2c2 as repeat, $994c48bfb00b620b$export$9c1b655deaca4988 as minmax, $994c48bfb00b620b$export$2f0b47b0911ce698 as fitContent, $994c48bfb00b620b$export$ef2184bd89960b14 as Grid, $884c64d19340d345$export$f51f4c4ede09e011 as Flex};
20
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;AAAA;;;;;;;;;;CAUC,GAED,0CAA0C","sources":["packages/@react-spectrum/layout/src/index.ts"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {repeat, minmax, fitContent, Grid} from './Grid';\nexport {Flex} from './Flex';\nexport type {DimensionValue} from '@react-types/shared';\nexport type {FlexProps, GridProps} from '@react-types/layout';\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,5 +1,37 @@
1
+ import { DimensionValue, DOMRefValue } from "@react-types/shared";
1
2
  import { GridProps, FlexProps } from "@react-types/layout";
2
- export const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLDivElement>>>;
3
- export const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLDivElement>>>;
3
+ import React from "react";
4
+ /**
5
+ * Can be used to make a repeating fragment of the columns or rows list.
6
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat).
7
+ * @param count - The number of times to repeat the fragment.
8
+ * @param repeat - The fragment to repeat.
9
+ */
10
+ export function repeat(count: number | 'auto-fill' | 'auto-fit', repeat: DimensionValue | DimensionValue[]): string;
11
+ /**
12
+ * Defines a size range greater than or equal to min and less than or equal to max.
13
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/minmax).
14
+ * @param min - The minimum size.
15
+ * @param max - The maximum size.
16
+ */
17
+ export function minmax(min: DimensionValue, max: DimensionValue): string;
18
+ /**
19
+ * Clamps a given size to an available size.
20
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content).
21
+ * @param dimension - The size to clamp.
22
+ */
23
+ export function fitContent(dimension: DimensionValue): string;
24
+ /**
25
+ * A layout container using CSS grid. Supports Spectrum dimensions as values to
26
+ * ensure consistent and adaptive sizing and spacing.
27
+ */
28
+ export const Grid: React.ForwardRefExoticComponent<GridProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
29
+ /**
30
+ * A layout container using flexbox. Provides Spectrum dimension values, and supports the gap
31
+ * property to define consistent spacing between items.
32
+ */
33
+ export const Flex: React.ForwardRefExoticComponent<FlexProps & React.RefAttributes<DOMRefValue<HTMLDivElement>>>;
34
+ export type { DimensionValue } from '@react-types/shared';
35
+ export type { FlexProps, GridProps } from '@react-types/layout';
4
36
 
5
37
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/govett/dev/react-spectrum/packages/@react-spectrum/layout/src/packages/@react-spectrum/layout/src/Grid.tsx","/Users/govett/dev/react-spectrum/packages/@react-spectrum/layout/src/packages/@react-spectrum/layout/src/Flex.tsx"],"names":[],"mappings":";AAsCA,OAAA,MAAM,iIAAwB,CAAC;ACL/B,OAAA,MAAM,iIAAwB,CAAC","file":"types.d.ts.map"}
1
+ {"mappings":";;;AA0DA;;;;;GAKG;AACH,uBAAuB,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,EAAE,QAAQ,cAAc,GAAG,cAAc,EAAE,GAAG,MAAM,CAElH;AAED;;;;;GAKG;AACH,uBAAuB,GAAG,EAAE,cAAc,EAAE,GAAG,EAAE,cAAc,GAAG,MAAM,CAEvE;AAED;;;;GAIG;AACH,2BAA2B,SAAS,EAAE,cAAc,GAAG,MAAM,CAE5D;AAsBD;;;GAGG;AACH,OAAA,MAAM,mGAAwB,CAAC;ACtB/B;;;GAGG;AACH,OAAA,MAAM,mGAAwB,CAAC;AC7E/B,YAAY,EAAC,cAAc,EAAC,MAAM,qBAAqB,CAAC;AACxD,YAAY,EAAC,SAAS,EAAE,SAAS,EAAC,MAAM,qBAAqB,CAAC","sources":["packages/@react-spectrum/layout/src/packages/@react-spectrum/layout/src/Grid.tsx","packages/@react-spectrum/layout/src/packages/@react-spectrum/layout/src/Flex.tsx","packages/@react-spectrum/layout/src/packages/@react-spectrum/layout/src/index.ts","packages/@react-spectrum/layout/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n/// <reference types=\"css-module-types\" />\n\nexport {repeat, minmax, fitContent, Grid} from './Grid';\nexport {Flex} from './Flex';\nexport type {DimensionValue} from '@react-types/shared';\nexport type {FlexProps, GridProps} from '@react-types/layout';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,16 +1,24 @@
1
1
  {
2
2
  "name": "@react-spectrum/layout",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-nightly-641446f65-240905",
4
4
  "description": "Spectrum UI components in React",
5
5
  "license": "Apache-2.0",
6
6
  "main": "dist/main.js",
7
7
  "module": "dist/module.js",
8
+ "exports": {
9
+ "types": "./dist/types.d.ts",
10
+ "import": "./dist/import.mjs",
11
+ "require": "./dist/main.js"
12
+ },
8
13
  "types": "dist/types.d.ts",
9
14
  "source": "src/index.ts",
10
15
  "files": [
11
- "dist"
16
+ "dist",
17
+ "src"
18
+ ],
19
+ "sideEffects": [
20
+ "*.css"
12
21
  ],
13
- "sideEffects": false,
14
22
  "targets": {
15
23
  "main": {
16
24
  "includeNodeModules": [
@@ -25,24 +33,24 @@
25
33
  },
26
34
  "repository": {
27
35
  "type": "git",
28
- "url": "https://github.com/adobe-private/react-spectrum-v3"
36
+ "url": "https://github.com/adobe/react-spectrum"
29
37
  },
30
38
  "dependencies": {
31
- "@babel/runtime": "^7.6.2",
32
- "@react-aria/utils": "^3.0.0-rc.2",
33
- "@react-spectrum/utils": "^3.0.0-rc.2",
34
- "@react-types/layout": "^3.0.0-alpha.1",
35
- "classnames": "^2.2.6"
39
+ "@react-aria/utils": "^3.0.0-nightly-641446f65-240905",
40
+ "@react-spectrum/utils": "^3.0.0-nightly-641446f65-240905",
41
+ "@react-types/layout": "^3.0.0-nightly-641446f65-240905",
42
+ "@react-types/shared": "^3.0.0-nightly-641446f65-240905",
43
+ "@swc/helpers": "^0.5.0"
36
44
  },
37
45
  "devDependencies": {
38
- "@adobe/spectrum-css-temp": "^3.0.0-alpha.1"
46
+ "@adobe/spectrum-css-temp": "3.0.0-alpha.1"
39
47
  },
40
48
  "peerDependencies": {
41
- "@react-spectrum/provider": "^3.0.0-rc.1",
42
- "react": "^16.8.0"
49
+ "@react-spectrum/provider": "^3.0.0-nightly-641446f65-240905",
50
+ "react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0"
43
51
  },
44
52
  "publishConfig": {
45
53
  "access": "public"
46
54
  },
47
- "gitHead": "207e6ee9076905c96638a7f81a367758872e1410"
48
- }
55
+ "stableVersion": "3.6.8"
56
+ }
package/src/Flex.tsx ADDED
@@ -0,0 +1,95 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {classNames, passthroughStyle, responsiveDimensionValue, StyleHandlers, useBreakpoint, useDOMRef, useStyleProps} from '@react-spectrum/utils';
14
+ import {DOMRef} from '@react-types/shared';
15
+ import {filterDOMProps} from '@react-aria/utils';
16
+ import {FlexProps} from '@react-types/layout';
17
+ import React, {forwardRef} from 'react';
18
+ import styles from './flex-gap.css';
19
+
20
+ const flexStyleProps: StyleHandlers = {
21
+ direction: ['flexDirection', passthroughStyle],
22
+ wrap: ['flexWrap', flexWrapValue],
23
+ justifyContent: ['justifyContent', flexAlignValue],
24
+ alignItems: ['alignItems', flexAlignValue],
25
+ alignContent: ['alignContent', flexAlignValue]
26
+ };
27
+
28
+ function Flex(props: FlexProps, ref: DOMRef<HTMLDivElement>) {
29
+ let {
30
+ children,
31
+ ...otherProps
32
+ } = props;
33
+ let breakpointProvider = useBreakpoint();
34
+ let matchedBreakpoints = breakpointProvider?.matchedBreakpoints || ['base'];
35
+ let {styleProps} = useStyleProps(otherProps);
36
+ let {styleProps: flexStyle} = useStyleProps(otherProps, flexStyleProps);
37
+ let domRef = useDOMRef(ref);
38
+
39
+ let style = {
40
+ ...styleProps.style,
41
+ ...flexStyle.style
42
+ };
43
+
44
+ if (props.gap != null) {
45
+ style.gap = responsiveDimensionValue(props.gap, matchedBreakpoints);
46
+ }
47
+
48
+ if (props.columnGap != null) {
49
+ style.columnGap = responsiveDimensionValue(props.columnGap, matchedBreakpoints);
50
+ }
51
+
52
+ if (props.rowGap != null) {
53
+ style.rowGap = responsiveDimensionValue(props.rowGap, matchedBreakpoints);
54
+ }
55
+
56
+ return (
57
+ <div {...filterDOMProps(otherProps)} className={classNames(styles, 'flex', styleProps.className)} style={style} ref={domRef}>
58
+ {children}
59
+ </div>
60
+ );
61
+ }
62
+
63
+ /**
64
+ * Normalize 'start' and 'end' alignment values to 'flex-start' and 'flex-end'
65
+ * in flex containers for browser compatibility.
66
+ */
67
+ function flexAlignValue(value) {
68
+ if (value === 'start') {
69
+ return 'flex-start';
70
+ }
71
+
72
+ if (value === 'end') {
73
+ return 'flex-end';
74
+ }
75
+
76
+ return value;
77
+ }
78
+
79
+ /**
80
+ * Takes a boolean and translates it to flex wrap or nowrap.
81
+ */
82
+ function flexWrapValue(value) {
83
+ if (typeof value === 'boolean') {
84
+ return value ? 'wrap' : 'nowrap';
85
+ }
86
+
87
+ return value;
88
+ }
89
+
90
+ /**
91
+ * A layout container using flexbox. Provides Spectrum dimension values, and supports the gap
92
+ * property to define consistent spacing between items.
93
+ */
94
+ const _Flex = forwardRef(Flex);
95
+ export {_Flex as Flex};
package/src/Grid.tsx ADDED
@@ -0,0 +1,113 @@
1
+ /*
2
+ * Copyright 2020 Adobe. All rights reserved.
3
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
4
+ * you may not use this file except in compliance with the License. You may obtain a copy
5
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
6
+ *
7
+ * Unless required by applicable law or agreed to in writing, software distributed under
8
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
9
+ * OF ANY KIND, either express or implied. See the License for the specific language
10
+ * governing permissions and limitations under the License.
11
+ */
12
+
13
+ import {
14
+ baseStyleProps,
15
+ dimensionValue,
16
+ passthroughStyle,
17
+ StyleHandlers,
18
+ useDOMRef,
19
+ useStyleProps
20
+ } from '@react-spectrum/utils';
21
+ import {DimensionValue, DOMRef} from '@react-types/shared';
22
+ import {filterDOMProps} from '@react-aria/utils';
23
+ import {GridProps} from '@react-types/layout';
24
+ import React, {forwardRef} from 'react';
25
+
26
+ const gridStyleProps: StyleHandlers = {
27
+ ...baseStyleProps,
28
+ autoFlow: ['gridAutoFlow', passthroughStyle],
29
+ autoColumns: ['gridAutoColumns', gridDimensionValue],
30
+ autoRows: ['gridAutoRows', gridDimensionValue],
31
+ areas: ['gridTemplateAreas', gridTemplateAreasValue],
32
+ columns: ['gridTemplateColumns', gridTemplateValue],
33
+ rows: ['gridTemplateRows', gridTemplateValue],
34
+ gap: ['gap', dimensionValue],
35
+ rowGap: ['rowGap', dimensionValue],
36
+ columnGap: ['columnGap', dimensionValue],
37
+ justifyItems: ['justifyItems', passthroughStyle],
38
+ justifyContent: ['justifyContent', passthroughStyle],
39
+ alignItems: ['alignItems', passthroughStyle],
40
+ alignContent: ['alignContent', passthroughStyle]
41
+ };
42
+
43
+ function Grid(props: GridProps, ref: DOMRef<HTMLDivElement>) {
44
+ let {
45
+ children,
46
+ ...otherProps
47
+ } = props;
48
+ let {styleProps} = useStyleProps(otherProps, gridStyleProps);
49
+ styleProps.style.display = 'grid'; // inline-grid?
50
+ let domRef = useDOMRef(ref);
51
+
52
+ return (
53
+ <div {...filterDOMProps(otherProps)} {...styleProps} ref={domRef}>
54
+ {children}
55
+ </div>
56
+ );
57
+ }
58
+
59
+ /**
60
+ * Can be used to make a repeating fragment of the columns or rows list.
61
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/repeat).
62
+ * @param count - The number of times to repeat the fragment.
63
+ * @param repeat - The fragment to repeat.
64
+ */
65
+ export function repeat(count: number | 'auto-fill' | 'auto-fit', repeat: DimensionValue | DimensionValue[]): string {
66
+ return `repeat(${count}, ${gridTemplateValue(repeat)})`;
67
+ }
68
+
69
+ /**
70
+ * Defines a size range greater than or equal to min and less than or equal to max.
71
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/minmax).
72
+ * @param min - The minimum size.
73
+ * @param max - The maximum size.
74
+ */
75
+ export function minmax(min: DimensionValue, max: DimensionValue): string {
76
+ return `minmax(${gridDimensionValue(min)}, ${gridDimensionValue(max)})`;
77
+ }
78
+
79
+ /**
80
+ * Clamps a given size to an available size.
81
+ * See [MDN](https://developer.mozilla.org/en-US/docs/Web/CSS/fit-content).
82
+ * @param dimension - The size to clamp.
83
+ */
84
+ export function fitContent(dimension: DimensionValue): string {
85
+ return `fit-content(${gridDimensionValue(dimension)})`;
86
+ }
87
+
88
+ function gridTemplateAreasValue(value) {
89
+ return value.map(v => `"${v}"`).join('\n');
90
+ }
91
+
92
+ function gridDimensionValue(value) {
93
+ if (/^max-content|min-content|minmax|auto|fit-content|repeat|subgrid/.test(value)) {
94
+ return value;
95
+ }
96
+
97
+ return dimensionValue(value);
98
+ }
99
+
100
+ function gridTemplateValue(value) {
101
+ if (Array.isArray(value)) {
102
+ return value.map(gridDimensionValue).join(' ');
103
+ }
104
+
105
+ return gridDimensionValue(value);
106
+ }
107
+
108
+ /**
109
+ * A layout container using CSS grid. Supports Spectrum dimensions as values to
110
+ * ensure consistent and adaptive sizing and spacing.
111
+ */
112
+ const _Grid = forwardRef(Grid);
113
+ export {_Grid as Grid};