@react-aria/separator 3.4.16 → 3.5.0
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/import.mjs +2 -2
- package/dist/main.js +2 -2
- package/dist/main.js.map +1 -1
- package/dist/module.js +2 -2
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +2 -0
- package/package.json +15 -13
- package/src/index.ts +3 -2
- package/dist/types.d.ts +0 -22
- package/dist/types.d.ts.map +0 -1
- package/dist/useSeparator.main.js +0 -42
- package/dist/useSeparator.main.js.map +0 -1
- package/dist/useSeparator.mjs +0 -37
- package/dist/useSeparator.module.js +0 -37
- package/dist/useSeparator.module.js.map +0 -1
- package/src/useSeparator.ts +0 -55
package/dist/import.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useSeparator as $
|
|
1
|
+
import {useSeparator as $0f2fbf48fd33aab1$re_export$useSeparator} from "react-aria/useSeparator";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useSeparator as $f4b273590fab9f93$export$52210f68a14655d0} from "./useSe
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$0f2fbf48fd33aab1$re_export$useSeparator as useSeparator};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
var $
|
|
1
|
+
var $eV4bP$reactariauseSeparator = require("react-aria/useSeparator");
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
function $parcel$export(e, n, v, s) {
|
|
5
5
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
6
|
}
|
|
7
7
|
|
|
8
|
-
$parcel$export(module.exports, "useSeparator", ()
|
|
8
|
+
$parcel$export(module.exports, "useSeparator", function () { return $eV4bP$reactariauseSeparator.useSeparator; });
|
|
9
9
|
/*
|
|
10
10
|
* Copyright 2020 Adobe. All rights reserved.
|
|
11
11
|
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/separator/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 */\nexport
|
|
1
|
+
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/separator/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 */\nexport {useSeparator} from 'react-aria/useSeparator';\n\nexport type {SeparatorProps, SeparatorAria} from 'react-aria/useSeparator';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {useSeparator as $
|
|
1
|
+
import {useSeparator as $0f2fbf48fd33aab1$re_export$useSeparator} from "react-aria/useSeparator";
|
|
2
2
|
|
|
3
3
|
/*
|
|
4
4
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -13,5 +13,5 @@ import {useSeparator as $f4b273590fab9f93$export$52210f68a14655d0} from "./useSe
|
|
|
13
13
|
*/
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
export {$
|
|
16
|
+
export {$0f2fbf48fd33aab1$re_export$useSeparator as useSeparator};
|
|
17
17
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/separator/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 */\nexport
|
|
1
|
+
{"mappings":";;AAAA;;;;;;;;;;CAUC","sources":["packages/@react-aria/separator/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 */\nexport {useSeparator} from 'react-aria/useSeparator';\n\nexport type {SeparatorProps, SeparatorAria} from 'react-aria/useSeparator';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-aria/separator",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.5.0",
|
|
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
8
|
"exports": {
|
|
9
|
-
"
|
|
10
|
-
|
|
11
|
-
"./dist/types.d.ts",
|
|
12
|
-
"./
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
"
|
|
9
|
+
".": {
|
|
10
|
+
"source": "./src/index.ts",
|
|
11
|
+
"types": "./dist/types/src/index.d.ts",
|
|
12
|
+
"import": "./dist/import.mjs",
|
|
13
|
+
"require": "./dist/main.js"
|
|
14
|
+
},
|
|
15
|
+
"./package.json": "./package.json"
|
|
16
16
|
},
|
|
17
|
-
"types": "dist/types.d.ts",
|
|
17
|
+
"types": "dist/types/src/index.d.ts",
|
|
18
18
|
"source": "src/index.ts",
|
|
19
19
|
"files": [
|
|
20
20
|
"dist",
|
|
@@ -26,9 +26,8 @@
|
|
|
26
26
|
"url": "https://github.com/adobe/react-spectrum"
|
|
27
27
|
},
|
|
28
28
|
"dependencies": {
|
|
29
|
-
"@
|
|
30
|
-
"
|
|
31
|
-
"@swc/helpers": "^0.5.0"
|
|
29
|
+
"@swc/helpers": "^0.5.0",
|
|
30
|
+
"react-aria": "3.48.0"
|
|
32
31
|
},
|
|
33
32
|
"peerDependencies": {
|
|
34
33
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
@@ -37,5 +36,8 @@
|
|
|
37
36
|
"publishConfig": {
|
|
38
37
|
"access": "public"
|
|
39
38
|
},
|
|
40
|
-
"
|
|
39
|
+
"targets": {
|
|
40
|
+
"types": false
|
|
41
|
+
},
|
|
42
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
41
43
|
}
|
package/src/index.ts
CHANGED
|
@@ -9,5 +9,6 @@
|
|
|
9
9
|
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
|
-
export
|
|
13
|
-
|
|
12
|
+
export {useSeparator} from 'react-aria/useSeparator';
|
|
13
|
+
|
|
14
|
+
export type {SeparatorProps, SeparatorAria} from 'react-aria/useSeparator';
|
package/dist/types.d.ts
DELETED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { AriaLabelingProps, DOMAttributes, DOMProps, Orientation } from "@react-types/shared";
|
|
2
|
-
export interface SeparatorProps extends DOMProps, AriaLabelingProps {
|
|
3
|
-
/**
|
|
4
|
-
* The orientation of the separator.
|
|
5
|
-
* @default 'horizontal'
|
|
6
|
-
*/
|
|
7
|
-
orientation?: Orientation;
|
|
8
|
-
/** The HTML element type that will be used to render the separator. */
|
|
9
|
-
elementType?: string;
|
|
10
|
-
}
|
|
11
|
-
export interface SeparatorAria {
|
|
12
|
-
/** Props for the separator element. */
|
|
13
|
-
separatorProps: DOMAttributes;
|
|
14
|
-
}
|
|
15
|
-
/**
|
|
16
|
-
* Provides the accessibility implementation for a separator.
|
|
17
|
-
* A separator is a visual divider between two groups of content,
|
|
18
|
-
* e.g. groups of menu items or sections of a page.
|
|
19
|
-
*/
|
|
20
|
-
export function useSeparator(props: SeparatorProps): SeparatorAria;
|
|
21
|
-
|
|
22
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";AAeA,+BAAgC,SAAQ,QAAQ,EAAE,iBAAiB;IACjE;;;OAGG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,uEAAuE;IACvE,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB;AAED;IACE,uCAAuC;IACvC,cAAc,EAAE,aAAa,CAAA;CAC9B;AAED;;;;GAIG;AACH,6BAA6B,KAAK,EAAE,cAAc,GAAG,aAAa,CAmBjE","sources":["packages/@react-aria/separator/src/packages/@react-aria/separator/src/useSeparator.ts","packages/@react-aria/separator/src/packages/@react-aria/separator/src/index.ts","packages/@react-aria/separator/src/index.ts"],"sourcesContent":[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 */\nexport type {SeparatorProps, SeparatorAria} from './useSeparator';\nexport {useSeparator} from './useSeparator';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
var $hN9Dd$reactariautils = require("@react-aria/utils");
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function $parcel$export(e, n, v, s) {
|
|
5
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
$parcel$export(module.exports, "useSeparator", () => $8fe2a70229d5746b$export$52210f68a14655d0);
|
|
9
|
-
/*
|
|
10
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
11
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
12
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
13
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
14
|
-
*
|
|
15
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
16
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
17
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
18
|
-
* governing permissions and limitations under the License.
|
|
19
|
-
*/
|
|
20
|
-
function $8fe2a70229d5746b$export$52210f68a14655d0(props) {
|
|
21
|
-
let domProps = (0, $hN9Dd$reactariautils.filterDOMProps)(props, {
|
|
22
|
-
labelable: true
|
|
23
|
-
});
|
|
24
|
-
let ariaOrientation;
|
|
25
|
-
// if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined
|
|
26
|
-
// if it's vertical, we need to specify it
|
|
27
|
-
if (props.orientation === 'vertical') ariaOrientation = 'vertical';
|
|
28
|
-
// hr elements implicitly have role = separator and a horizontal orientation
|
|
29
|
-
if (props.elementType !== 'hr') return {
|
|
30
|
-
separatorProps: {
|
|
31
|
-
...domProps,
|
|
32
|
-
role: 'separator',
|
|
33
|
-
'aria-orientation': ariaOrientation
|
|
34
|
-
}
|
|
35
|
-
};
|
|
36
|
-
return {
|
|
37
|
-
separatorProps: domProps
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
//# sourceMappingURL=useSeparator.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;AAAA;;;;;;;;;;CAUC;AAyBM,SAAS,0CAAa,KAAqB;IAChD,IAAI,WAAW,CAAA,GAAA,oCAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI;IACJ,iGAAiG;IACjG,0CAA0C;IAC1C,IAAI,MAAM,WAAW,KAAK,YACxB,kBAAkB;IAEpB,4EAA4E;IAC5E,IAAI,MAAM,WAAW,KAAK,MACxB,OAAO;QACL,gBAAgB;YACd,GAAG,QAAQ;YACX,MAAM;YACN,oBAAoB;QACtB;IACF;IAEF,OAAO;QAAC,gBAAgB;IAAQ;AAClC","sources":["packages/@react-aria/separator/src/useSeparator.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\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Orientation} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\n\nexport interface SeparatorProps extends DOMProps, AriaLabelingProps {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n orientation?: Orientation,\n /** The HTML element type that will be used to render the separator. */\n elementType?: string\n}\n\nexport interface SeparatorAria {\n /** Props for the separator element. */\n separatorProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a separator.\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\nexport function useSeparator(props: SeparatorProps): SeparatorAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let ariaOrientation;\n // if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined\n // if it's vertical, we need to specify it\n if (props.orientation === 'vertical') {\n ariaOrientation = 'vertical';\n }\n // hr elements implicitly have role = separator and a horizontal orientation\n if (props.elementType !== 'hr') {\n return {\n separatorProps: {\n ...domProps,\n role: 'separator',\n 'aria-orientation': ariaOrientation\n }\n };\n }\n return {separatorProps: domProps};\n}\n"],"names":[],"version":3,"file":"useSeparator.main.js.map"}
|
package/dist/useSeparator.mjs
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {filterDOMProps as $1vbRD$filterDOMProps} from "@react-aria/utils";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
function $f4b273590fab9f93$export$52210f68a14655d0(props) {
|
|
15
|
-
let domProps = (0, $1vbRD$filterDOMProps)(props, {
|
|
16
|
-
labelable: true
|
|
17
|
-
});
|
|
18
|
-
let ariaOrientation;
|
|
19
|
-
// if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined
|
|
20
|
-
// if it's vertical, we need to specify it
|
|
21
|
-
if (props.orientation === 'vertical') ariaOrientation = 'vertical';
|
|
22
|
-
// hr elements implicitly have role = separator and a horizontal orientation
|
|
23
|
-
if (props.elementType !== 'hr') return {
|
|
24
|
-
separatorProps: {
|
|
25
|
-
...domProps,
|
|
26
|
-
role: 'separator',
|
|
27
|
-
'aria-orientation': ariaOrientation
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
separatorProps: domProps
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export {$f4b273590fab9f93$export$52210f68a14655d0 as useSeparator};
|
|
37
|
-
//# sourceMappingURL=useSeparator.module.js.map
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import {filterDOMProps as $1vbRD$filterDOMProps} from "@react-aria/utils";
|
|
2
|
-
|
|
3
|
-
/*
|
|
4
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
5
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
7
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
-
*
|
|
9
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
10
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
11
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
12
|
-
* governing permissions and limitations under the License.
|
|
13
|
-
*/
|
|
14
|
-
function $f4b273590fab9f93$export$52210f68a14655d0(props) {
|
|
15
|
-
let domProps = (0, $1vbRD$filterDOMProps)(props, {
|
|
16
|
-
labelable: true
|
|
17
|
-
});
|
|
18
|
-
let ariaOrientation;
|
|
19
|
-
// if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined
|
|
20
|
-
// if it's vertical, we need to specify it
|
|
21
|
-
if (props.orientation === 'vertical') ariaOrientation = 'vertical';
|
|
22
|
-
// hr elements implicitly have role = separator and a horizontal orientation
|
|
23
|
-
if (props.elementType !== 'hr') return {
|
|
24
|
-
separatorProps: {
|
|
25
|
-
...domProps,
|
|
26
|
-
role: 'separator',
|
|
27
|
-
'aria-orientation': ariaOrientation
|
|
28
|
-
}
|
|
29
|
-
};
|
|
30
|
-
return {
|
|
31
|
-
separatorProps: domProps
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
export {$f4b273590fab9f93$export$52210f68a14655d0 as useSeparator};
|
|
37
|
-
//# sourceMappingURL=useSeparator.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;AAAA;;;;;;;;;;CAUC;AAyBM,SAAS,0CAAa,KAAqB;IAChD,IAAI,WAAW,CAAA,GAAA,qBAAa,EAAE,OAAO;QAAC,WAAW;IAAI;IACrD,IAAI;IACJ,iGAAiG;IACjG,0CAA0C;IAC1C,IAAI,MAAM,WAAW,KAAK,YACxB,kBAAkB;IAEpB,4EAA4E;IAC5E,IAAI,MAAM,WAAW,KAAK,MACxB,OAAO;QACL,gBAAgB;YACd,GAAG,QAAQ;YACX,MAAM;YACN,oBAAoB;QACtB;IACF;IAEF,OAAO;QAAC,gBAAgB;IAAQ;AAClC","sources":["packages/@react-aria/separator/src/useSeparator.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\nimport {AriaLabelingProps, DOMAttributes, DOMProps, Orientation} from '@react-types/shared';\nimport {filterDOMProps} from '@react-aria/utils';\n\nexport interface SeparatorProps extends DOMProps, AriaLabelingProps {\n /**\n * The orientation of the separator.\n * @default 'horizontal'\n */\n orientation?: Orientation,\n /** The HTML element type that will be used to render the separator. */\n elementType?: string\n}\n\nexport interface SeparatorAria {\n /** Props for the separator element. */\n separatorProps: DOMAttributes\n}\n\n/**\n * Provides the accessibility implementation for a separator.\n * A separator is a visual divider between two groups of content,\n * e.g. groups of menu items or sections of a page.\n */\nexport function useSeparator(props: SeparatorProps): SeparatorAria {\n let domProps = filterDOMProps(props, {labelable: true});\n let ariaOrientation;\n // if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined\n // if it's vertical, we need to specify it\n if (props.orientation === 'vertical') {\n ariaOrientation = 'vertical';\n }\n // hr elements implicitly have role = separator and a horizontal orientation\n if (props.elementType !== 'hr') {\n return {\n separatorProps: {\n ...domProps,\n role: 'separator',\n 'aria-orientation': ariaOrientation\n }\n };\n }\n return {separatorProps: domProps};\n}\n"],"names":[],"version":3,"file":"useSeparator.module.js.map"}
|
package/src/useSeparator.ts
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
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 {AriaLabelingProps, DOMAttributes, DOMProps, Orientation} from '@react-types/shared';
|
|
14
|
-
import {filterDOMProps} from '@react-aria/utils';
|
|
15
|
-
|
|
16
|
-
export interface SeparatorProps extends DOMProps, AriaLabelingProps {
|
|
17
|
-
/**
|
|
18
|
-
* The orientation of the separator.
|
|
19
|
-
* @default 'horizontal'
|
|
20
|
-
*/
|
|
21
|
-
orientation?: Orientation,
|
|
22
|
-
/** The HTML element type that will be used to render the separator. */
|
|
23
|
-
elementType?: string
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export interface SeparatorAria {
|
|
27
|
-
/** Props for the separator element. */
|
|
28
|
-
separatorProps: DOMAttributes
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Provides the accessibility implementation for a separator.
|
|
33
|
-
* A separator is a visual divider between two groups of content,
|
|
34
|
-
* e.g. groups of menu items or sections of a page.
|
|
35
|
-
*/
|
|
36
|
-
export function useSeparator(props: SeparatorProps): SeparatorAria {
|
|
37
|
-
let domProps = filterDOMProps(props, {labelable: true});
|
|
38
|
-
let ariaOrientation;
|
|
39
|
-
// if orientation is horizontal, aria-orientation default is horizontal, so we leave it undefined
|
|
40
|
-
// if it's vertical, we need to specify it
|
|
41
|
-
if (props.orientation === 'vertical') {
|
|
42
|
-
ariaOrientation = 'vertical';
|
|
43
|
-
}
|
|
44
|
-
// hr elements implicitly have role = separator and a horizontal orientation
|
|
45
|
-
if (props.elementType !== 'hr') {
|
|
46
|
-
return {
|
|
47
|
-
separatorProps: {
|
|
48
|
-
...domProps,
|
|
49
|
-
role: 'separator',
|
|
50
|
-
'aria-orientation': ariaOrientation
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return {separatorProps: domProps};
|
|
55
|
-
}
|