@react-spectrum/view 3.0.0-alpha.1 → 3.0.0-nightly-4980928d3-240906

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.
package/dist/main.js CHANGED
@@ -1,104 +1,32 @@
1
- var _babelRuntimeHelpersExtends = $parcel$interopDefault(require("@babel/runtime/helpers/extends"));
1
+ var $6c848be8e8bffe98$exports = require("./View.main.js");
2
+ var $2d8ae89d4e4c1d41$exports = require("./Content.main.js");
3
+ var $e266c0b33fd8525d$exports = require("./Footer.main.js");
4
+ var $62d558b43ecd7a77$exports = require("./Header.main.js");
2
5
 
3
- var _babelRuntimeHelpersObjectWithoutProperties = $parcel$interopDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
4
6
 
5
- var _temp = require("@react-spectrum/utils");
6
-
7
- var filterDOMProps = _temp.filterDOMProps;
8
- var useDOMRef = _temp.useDOMRef;
9
- var useSlotProps = _temp.useSlotProps;
10
- var useStyleProps = _temp.useStyleProps;
11
- var viewStyleProps = _temp.viewStyleProps;
12
- var ClearSlots = _temp.ClearSlots;
13
-
14
- var _react2 = require("react");
15
-
16
- var _react = $parcel$interopDefault(_react2);
17
-
18
- var forwardRef = _react2.forwardRef;
19
-
20
- function $parcel$interopDefault(a) {
21
- return a && a.__esModule ? a.default : a;
22
- }
23
-
24
- function $d32c49000752d7e766aca3dcb18ca2$var$View(props, ref) {
25
- props = useSlotProps(props);
26
-
27
- var _props = props,
28
- _props$elementType = _props.elementType,
29
- ElementType = _props$elementType === void 0 ? 'div' : _props$elementType,
30
- children = _props.children,
31
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(_props, ["elementType", "children"]);
32
-
33
- var _useStyleProps = useStyleProps(props, viewStyleProps),
34
- styleProps = _useStyleProps.styleProps;
35
-
36
- var domRef = useDOMRef(ref);
37
- return (/*#__PURE__*/_react.createElement(ElementType, _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
38
- ref: domRef
39
- }), children)
40
- );
41
- }
42
-
43
- var View = forwardRef($d32c49000752d7e766aca3dcb18ca2$var$View);
44
- exports.View = View;
45
-
46
- function $d1fda12a538a885b09e0aa15c973b51$var$Content(props, ref) {
47
- props = useSlotProps(props, 'content');
48
-
49
- var _props = props,
50
- children = _props.children,
51
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(_props, ["children"]);
52
-
53
- var _useStyleProps = useStyleProps(otherProps),
54
- styleProps = _useStyleProps.styleProps;
55
-
56
- var domRef = useDOMRef(ref);
57
- return (/*#__PURE__*/_react.createElement("section", _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
58
- ref: domRef
59
- }), /*#__PURE__*/_react.createElement(ClearSlots, null, children))
60
- );
7
+ function $parcel$export(e, n, v, s) {
8
+ Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
61
9
  }
62
10
 
63
- var Content = forwardRef($d1fda12a538a885b09e0aa15c973b51$var$Content);
64
- exports.Content = Content;
11
+ $parcel$export(module.exports, "View", () => $6c848be8e8bffe98$exports.View);
12
+ $parcel$export(module.exports, "Content", () => $2d8ae89d4e4c1d41$exports.Content);
13
+ $parcel$export(module.exports, "Footer", () => $e266c0b33fd8525d$exports.Footer);
14
+ $parcel$export(module.exports, "Header", () => $62d558b43ecd7a77$exports.Header);
15
+ /*
16
+ * Copyright 2020 Adobe. All rights reserved.
17
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
18
+ * you may not use this file except in compliance with the License. You may obtain a copy
19
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
20
+ *
21
+ * Unless required by applicable law or agreed to in writing, software distributed under
22
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
23
+ * OF ANY KIND, either express or implied. See the License for the specific language
24
+ * governing permissions and limitations under the License.
25
+ */ /// <reference types="css-module-types" />
65
26
 
66
- function $e9f8bc9d3d36c51094e9cf8018cbec$var$Footer(props, ref) {
67
- props = useSlotProps(props, 'footer');
68
27
 
69
- var _props = props,
70
- children = _props.children,
71
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(_props, ["children"]);
72
28
 
73
- var _useStyleProps = useStyleProps(otherProps),
74
- styleProps = _useStyleProps.styleProps;
75
29
 
76
- var domRef = useDOMRef(ref);
77
- return (/*#__PURE__*/_react.createElement("footer", _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
78
- ref: domRef
79
- }), children)
80
- );
81
- }
82
30
 
83
- var Footer = forwardRef($e9f8bc9d3d36c51094e9cf8018cbec$var$Footer);
84
- exports.Footer = Footer;
85
-
86
- function $b8666d2e267ec708a6c2a8024ae4e$var$Header(props, ref) {
87
- props = useSlotProps(props, 'header');
88
-
89
- var _props = props,
90
- children = _props.children,
91
- otherProps = _babelRuntimeHelpersObjectWithoutProperties(_props, ["children"]);
92
-
93
- var _useStyleProps = useStyleProps(otherProps),
94
- styleProps = _useStyleProps.styleProps;
95
-
96
- var domRef = useDOMRef(ref);
97
- return (/*#__PURE__*/_react.createElement("header", _babelRuntimeHelpersExtends({}, filterDOMProps(otherProps), styleProps, {
98
- ref: domRef
99
- }), children)
100
- );
101
- }
102
31
 
103
- var Header = forwardRef($b8666d2e267ec708a6c2a8024ae4e$var$Header);
104
- exports.Header = Header;
32
+ //# sourceMappingURL=main.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/view/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/// <reference types=\"css-module-types\" />\nexport {View} from './View';\nexport {Content} from './Content';\nexport {Footer} from './Footer';\nexport {Header} from './Header';\nexport type {ContentProps, FooterProps, HeaderProps, ViewProps} from '@react-types/view';\n"],"names":[],"version":3,"file":"main.js.map"}
package/dist/module.js CHANGED
@@ -1,85 +1,24 @@
1
- import _babelRuntimeHelpersEsmExtends from "@babel/runtime/helpers/esm/extends";
2
- import _babelRuntimeHelpersEsmObjectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import { filterDOMProps, useDOMRef, useSlotProps, useStyleProps, viewStyleProps, ClearSlots } from "@react-spectrum/utils";
4
- import _react, { forwardRef } from "react";
1
+ import {View as $b9606c0c41d55371$export$27a5bd065ad55220} from "./View.module.js";
2
+ import {Content as $0a7c18a2ef74b280$export$7c6e2c02157bb7d2} from "./Content.module.js";
3
+ import {Footer as $8d68cc89c1f9278e$export$a06f1c675e846f6f} from "./Footer.module.js";
4
+ import {Header as $aedcc4886d2a392a$export$8b251419efc915eb} from "./Header.module.js";
5
5
 
6
- function $c66d91ef484a1e068d908a8d$var$View(props, ref) {
7
- props = useSlotProps(props);
6
+ /*
7
+ * Copyright 2020 Adobe. All rights reserved.
8
+ * This file is licensed to you under the Apache License, Version 2.0 (the "License");
9
+ * you may not use this file except in compliance with the License. You may obtain a copy
10
+ * of the License at http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software distributed under
13
+ * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
14
+ * OF ANY KIND, either express or implied. See the License for the specific language
15
+ * governing permissions and limitations under the License.
16
+ */ /// <reference types="css-module-types" />
8
17
 
9
- let {
10
- elementType: ElementType = 'div',
11
- children
12
- } = props,
13
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["elementType", "children"]);
14
18
 
15
- let {
16
- styleProps
17
- } = useStyleProps(props, viewStyleProps);
18
- let domRef = useDOMRef(ref);
19
- return (/*#__PURE__*/_react.createElement(ElementType, _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
20
- ref: domRef
21
- }), children)
22
- );
23
- }
24
19
 
25
- export const View = forwardRef($c66d91ef484a1e068d908a8d$var$View);
26
20
 
27
- function $dab4ade329b7589c4d81c2dc1b08dc49$var$Content(props, ref) {
28
- props = useSlotProps(props, 'content');
29
21
 
30
- let {
31
- children
32
- } = props,
33
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["children"]);
34
22
 
35
- let {
36
- styleProps
37
- } = useStyleProps(otherProps);
38
- let domRef = useDOMRef(ref);
39
- return (/*#__PURE__*/_react.createElement("section", _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
40
- ref: domRef
41
- }), /*#__PURE__*/_react.createElement(ClearSlots, null, children))
42
- );
43
- }
44
-
45
- export const Content = forwardRef($dab4ade329b7589c4d81c2dc1b08dc49$var$Content);
46
-
47
- function $f8e24f985c1a80022f1a77e7dda020$var$Footer(props, ref) {
48
- props = useSlotProps(props, 'footer');
49
-
50
- let {
51
- children
52
- } = props,
53
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["children"]);
54
-
55
- let {
56
- styleProps
57
- } = useStyleProps(otherProps);
58
- let domRef = useDOMRef(ref);
59
- return (/*#__PURE__*/_react.createElement("footer", _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
60
- ref: domRef
61
- }), children)
62
- );
63
- }
64
-
65
- export const Footer = forwardRef($f8e24f985c1a80022f1a77e7dda020$var$Footer);
66
-
67
- function $a9f5358902db9c33ab333be39357797$var$Header(props, ref) {
68
- props = useSlotProps(props, 'header');
69
-
70
- let {
71
- children
72
- } = props,
73
- otherProps = _babelRuntimeHelpersEsmObjectWithoutProperties(props, ["children"]);
74
-
75
- let {
76
- styleProps
77
- } = useStyleProps(otherProps);
78
- let domRef = useDOMRef(ref);
79
- return (/*#__PURE__*/_react.createElement("header", _babelRuntimeHelpersEsmExtends({}, filterDOMProps(otherProps), styleProps, {
80
- ref: domRef
81
- }), children)
82
- );
83
- }
84
-
85
- export const Header = forwardRef($a9f5358902db9c33ab333be39357797$var$Header);
23
+ export {$b9606c0c41d55371$export$27a5bd065ad55220 as View, $0a7c18a2ef74b280$export$7c6e2c02157bb7d2 as Content, $8d68cc89c1f9278e$export$a06f1c675e846f6f as Footer, $aedcc4886d2a392a$export$8b251419efc915eb as Header};
24
+ //# sourceMappingURL=module.js.map
@@ -0,0 +1 @@
1
+ {"mappings":";;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/view/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/// <reference types=\"css-module-types\" />\nexport {View} from './View';\nexport {Content} from './Content';\nexport {Footer} from './Footer';\nexport {Header} from './Header';\nexport type {ContentProps, FooterProps, HeaderProps, ViewProps} from '@react-types/view';\n"],"names":[],"version":3,"file":"module.js.map"}
package/dist/types.d.ts CHANGED
@@ -1,7 +1,25 @@
1
+ import { ColorVersion, DOMRef, DOMRefValue } from "@react-types/shared";
2
+ import React, { ReactElement } from "react";
1
3
  import { ViewProps, ContentProps, FooterProps, HeaderProps } from "@react-types/view";
2
- export const View: React.ForwardRefExoticComponent<ViewProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLElement>>>;
3
- export const Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLElement>>>;
4
- export const Footer: React.ForwardRefExoticComponent<FooterProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLElement>>>;
5
- export const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<import("@react-types/shared").DOMRefValue<HTMLElement>>>;
4
+ /**
5
+ * View is a general purpose container with no specific semantics that can be used for custom styling purposes.
6
+ * It supports Spectrum style props to ensure consistency with other Spectrum components.
7
+ */
8
+ export const View: <C extends ColorVersion = 5>(props: ViewProps<C> & {
9
+ ref?: DOMRef;
10
+ }) => ReactElement;
11
+ /**
12
+ * Content represents the primary content within a Spectrum container.
13
+ */
14
+ export const Content: React.ForwardRefExoticComponent<ContentProps & React.RefAttributes<DOMRefValue<HTMLElement>>>;
15
+ /**
16
+ * Footer represents a footer within a Spectrum container.
17
+ */
18
+ export const Footer: React.ForwardRefExoticComponent<FooterProps & React.RefAttributes<DOMRefValue<HTMLElement>>>;
19
+ /**
20
+ * Header represents a header within a Spectrum container.
21
+ */
22
+ export const Header: React.ForwardRefExoticComponent<HeaderProps & React.RefAttributes<DOMRefValue<HTMLElement>>>;
23
+ export type { ContentProps, FooterProps, HeaderProps, ViewProps } from '@react-types/view';
6
24
 
7
25
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/Users/govett/dev/react-spectrum/packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/View.tsx","/Users/govett/dev/react-spectrum/packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Content.tsx","/Users/govett/dev/react-spectrum/packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Footer.tsx","/Users/govett/dev/react-spectrum/packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Header.tsx"],"names":[],"mappings":";AAqCA,OAAA,MAAM,8HAAwB,CAAC;ACD/B,OAAA,MAAM,oIAA8B,CAAC;ACHrC,OAAA,MAAM,kIAA4B,CAAC;ACAnC,OAAA,MAAM,kIAA4B,CAAC","file":"types.d.ts.map"}
1
+ {"mappings":";;;AAwCA;;;GAGG;AACH,OAAA,MAAM,MAA4B,CAAC,CAA0B,SAAhB,YAAY,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,GAAG;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAC,KAAK,YAAY,CAAC;ACRrH;;GAEG;AACH,OAAA,MAAM,sGAA8B,CAAC;ACHrC;;GAEG;AACH,OAAA,MAAM,oGAA4B,CAAC;ACHnC;;GAEG;AACH,OAAA,MAAM,oGAA4B,CAAC;ACvBnC,YAAY,EAAC,YAAY,EAAE,WAAW,EAAE,WAAW,EAAE,SAAS,EAAC,MAAM,mBAAmB,CAAC","sources":["packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/View.tsx","packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Content.tsx","packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Footer.tsx","packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/Header.tsx","packages/@react-spectrum/view/src/packages/@react-spectrum/view/src/index.ts","packages/@react-spectrum/view/src/index.ts"],"sourcesContent":[null,null,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/// <reference types=\"css-module-types\" />\nexport {View} from './View';\nexport {Content} from './Content';\nexport {Footer} from './Footer';\nexport {Header} from './Header';\nexport type {ContentProps, FooterProps, HeaderProps, ViewProps} from '@react-types/view';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
package/package.json CHANGED
@@ -1,16 +1,24 @@
1
1
  {
2
2
  "name": "@react-spectrum/view",
3
- "version": "3.0.0-alpha.1",
3
+ "version": "3.0.0-nightly-4980928d3-240906",
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/i18n": "^3.0.0-rc.2",
33
- "@react-spectrum/utils": "^3.0.0-rc.2",
34
- "@react-types/shared": "^3.0.0-rc.2",
35
- "@react-types/view": "^3.0.0-alpha.1"
39
+ "@react-aria/utils": "^3.0.0-nightly-4980928d3-240906",
40
+ "@react-spectrum/utils": "^3.0.0-nightly-4980928d3-240906",
41
+ "@react-types/shared": "^3.0.0-nightly-4980928d3-240906",
42
+ "@react-types/view": "^3.0.0-nightly-4980928d3-240906",
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-4980928d3-240906",
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.12"
56
+ }
@@ -0,0 +1,41 @@
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 {ClearSlots, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';
14
+ import {ContentProps} from '@react-types/view';
15
+ import {DOMRef} from '@react-types/shared';
16
+ import {filterDOMProps} from '@react-aria/utils';
17
+ import React, {forwardRef} from 'react';
18
+
19
+ function Content(props: ContentProps, ref: DOMRef) {
20
+ props = useSlotProps(props, 'content');
21
+ let {
22
+ children,
23
+ ...otherProps
24
+ } = props;
25
+ let {styleProps} = useStyleProps(otherProps);
26
+ let domRef = useDOMRef(ref);
27
+
28
+ return (
29
+ <section {...filterDOMProps(otherProps)} {...styleProps} ref={domRef}>
30
+ <ClearSlots>
31
+ {children}
32
+ </ClearSlots>
33
+ </section>
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Content represents the primary content within a Spectrum container.
39
+ */
40
+ const _Content = forwardRef(Content);
41
+ export {_Content as Content};
package/src/Footer.tsx ADDED
@@ -0,0 +1,41 @@
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 {ClearSlots, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';
14
+ import {DOMRef} from '@react-types/shared';
15
+ import {filterDOMProps} from '@react-aria/utils';
16
+ import {FooterProps} from '@react-types/view';
17
+ import React, {forwardRef} from 'react';
18
+
19
+ function Footer(props: FooterProps, ref: DOMRef) {
20
+ props = useSlotProps(props, 'footer');
21
+ let {
22
+ children,
23
+ ...otherProps
24
+ } = props;
25
+ let {styleProps} = useStyleProps(otherProps);
26
+ let domRef = useDOMRef(ref);
27
+
28
+ return (
29
+ <footer {...filterDOMProps(otherProps)} {...styleProps} ref={domRef}>
30
+ <ClearSlots>
31
+ {children}
32
+ </ClearSlots>
33
+ </footer>
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Footer represents a footer within a Spectrum container.
39
+ */
40
+ const _Footer = forwardRef(Footer);
41
+ export {_Footer as Footer};
package/src/Header.tsx ADDED
@@ -0,0 +1,41 @@
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 {ClearSlots, useDOMRef, useSlotProps, useStyleProps} from '@react-spectrum/utils';
14
+ import {DOMRef} from '@react-types/shared';
15
+ import {filterDOMProps} from '@react-aria/utils';
16
+ import {HeaderProps} from '@react-types/view';
17
+ import React, {forwardRef} from 'react';
18
+
19
+ function Header(props: HeaderProps, ref: DOMRef) {
20
+ props = useSlotProps(props, 'header');
21
+ let {
22
+ children,
23
+ ...otherProps
24
+ } = props;
25
+ let {styleProps} = useStyleProps(otherProps);
26
+ let domRef = useDOMRef(ref);
27
+
28
+ return (
29
+ <header {...filterDOMProps(otherProps)} {...styleProps} ref={domRef}>
30
+ <ClearSlots>
31
+ {children}
32
+ </ClearSlots>
33
+ </header>
34
+ );
35
+ }
36
+
37
+ /**
38
+ * Header represents a header within a Spectrum container.
39
+ */
40
+ const _Header = forwardRef(Header);
41
+ export {_Header as Header};
package/src/View.tsx ADDED
@@ -0,0 +1,46 @@
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 {ClearSlots, useDOMRef, useSlotProps, useStyleProps, viewStyleProps} from '@react-spectrum/utils';
14
+ import {ColorVersion, DOMRef} from '@react-types/shared';
15
+ import {filterDOMProps} from '@react-aria/utils';
16
+ import React, {forwardRef, ReactElement} from 'react';
17
+ import {ViewProps} from '@react-types/view';
18
+
19
+ function View<C extends ColorVersion>(props: ViewProps<C>, ref: DOMRef) {
20
+ props = useSlotProps(props);
21
+ let {
22
+ elementType: ElementType = 'div',
23
+ children,
24
+ ...otherProps
25
+ } = props;
26
+ let {styleProps} = useStyleProps(props, viewStyleProps);
27
+ let domRef = useDOMRef(ref);
28
+
29
+ return (
30
+ <ElementType
31
+ {...filterDOMProps(otherProps)}
32
+ {...styleProps}
33
+ ref={domRef}>
34
+ <ClearSlots>
35
+ {children}
36
+ </ClearSlots>
37
+ </ElementType>
38
+ );
39
+ }
40
+
41
+ /**
42
+ * View is a general purpose container with no specific semantics that can be used for custom styling purposes.
43
+ * It supports Spectrum style props to ensure consistency with other Spectrum components.
44
+ */
45
+ const _View = forwardRef(View) as <C extends ColorVersion = 5>(props: ViewProps<C> & {ref?: DOMRef}) => ReactElement;
46
+ export {_View as View};
package/src/index.ts ADDED
@@ -0,0 +1,17 @@
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
+ /// <reference types="css-module-types" />
13
+ export {View} from './View';
14
+ export {Content} from './Content';
15
+ export {Footer} from './Footer';
16
+ export {Header} from './Header';
17
+ export type {ContentProps, FooterProps, HeaderProps, ViewProps} from '@react-types/view';