@react-spectrum/breadcrumbs 3.9.26 → 3.10.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 +3 -3
- package/dist/main.js +4 -4
- package/dist/main.js.map +1 -1
- package/dist/module.js +3 -3
- package/dist/module.js.map +1 -1
- package/dist/types/src/index.d.ts +3 -0
- package/package.json +14 -37
- package/src/index.ts +4 -3
- package/dist/BreadcrumbItem.main.js +0 -71
- package/dist/BreadcrumbItem.main.js.map +0 -1
- package/dist/BreadcrumbItem.mjs +0 -66
- package/dist/BreadcrumbItem.module.js +0 -66
- package/dist/BreadcrumbItem.module.js.map +0 -1
- package/dist/Breadcrumbs.main.js +0 -204
- package/dist/Breadcrumbs.main.js.map +0 -1
- package/dist/Breadcrumbs.mjs +0 -199
- package/dist/Breadcrumbs.module.js +0 -199
- package/dist/Breadcrumbs.module.js.map +0 -1
- package/dist/breadcrumb_vars_css.main.js +0 -68
- package/dist/breadcrumb_vars_css.main.js.map +0 -1
- package/dist/breadcrumb_vars_css.mjs +0 -70
- package/dist/breadcrumb_vars_css.module.js +0 -70
- package/dist/breadcrumb_vars_css.module.js.map +0 -1
- package/dist/breadcrumbs.1fc75877.css +0 -337
- package/dist/breadcrumbs.1fc75877.css.map +0 -1
- package/dist/types.d.ts +0 -11
- package/dist/types.d.ts.map +0 -1
- package/src/BreadcrumbItem.tsx +0 -81
- package/src/Breadcrumbs.tsx +0 -248
package/dist/import.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Breadcrumbs as $
|
|
2
|
-
import {Item as $
|
|
1
|
+
import {Breadcrumbs as $f1f255760e2249ca$re_export$Breadcrumbs} from "@adobe/react-spectrum/Breadcrumbs";
|
|
2
|
+
import {Item as $f1f255760e2249ca$re_export$Item} from "react-stately/Item";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -16,5 +16,5 @@ import {Item as $37781313afe0968e$re_export$Item} from "@react-stately/collectio
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
export {$
|
|
19
|
+
export {$f1f255760e2249ca$re_export$Breadcrumbs as Breadcrumbs, $f1f255760e2249ca$re_export$Item as Item};
|
|
20
20
|
//# sourceMappingURL=module.js.map
|
package/dist/main.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var $
|
|
2
|
-
var $
|
|
1
|
+
var $ljGUQ$adobereactspectrumBreadcrumbs = require("@adobe/react-spectrum/Breadcrumbs");
|
|
2
|
+
var $ljGUQ$reactstatelyItem = require("react-stately/Item");
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
function $parcel$export(e, n, v, s) {
|
|
6
6
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
$parcel$export(module.exports, "Breadcrumbs", ()
|
|
10
|
-
$parcel$export(module.exports, "Item", ()
|
|
9
|
+
$parcel$export(module.exports, "Breadcrumbs", function () { return $ljGUQ$adobereactspectrumBreadcrumbs.Breadcrumbs; });
|
|
10
|
+
$parcel$export(module.exports, "Item", function () { return $ljGUQ$reactstatelyItem.Item; });
|
|
11
11
|
/*
|
|
12
12
|
* Copyright 2020 Adobe. All rights reserved.
|
|
13
13
|
* 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,GACD,0CAA0C","sources":["packages/@react-spectrum/breadcrumbs/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 {Breadcrumbs} from '
|
|
1
|
+
{"mappings":";;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/breadcrumbs/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 {Breadcrumbs} from '@adobe/react-spectrum/Breadcrumbs';\n\nexport type {SpectrumBreadcrumbsProps} from '@adobe/react-spectrum/Breadcrumbs';\nexport {Item} from 'react-stately/Item';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {Breadcrumbs as $
|
|
2
|
-
import {Item as $
|
|
1
|
+
import {Breadcrumbs as $f1f255760e2249ca$re_export$Breadcrumbs} from "@adobe/react-spectrum/Breadcrumbs";
|
|
2
|
+
import {Item as $f1f255760e2249ca$re_export$Item} from "react-stately/Item";
|
|
3
3
|
|
|
4
4
|
/*
|
|
5
5
|
* Copyright 2020 Adobe. All rights reserved.
|
|
@@ -16,5 +16,5 @@ import {Item as $37781313afe0968e$re_export$Item} from "@react-stately/collectio
|
|
|
16
16
|
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
export {$
|
|
19
|
+
export {$f1f255760e2249ca$re_export$Breadcrumbs as Breadcrumbs, $f1f255760e2249ca$re_export$Item as Item};
|
|
20
20
|
//# sourceMappingURL=module.js.map
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/breadcrumbs/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 {Breadcrumbs} from '
|
|
1
|
+
{"mappings":";;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C","sources":["packages/@react-spectrum/breadcrumbs/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 {Breadcrumbs} from '@adobe/react-spectrum/Breadcrumbs';\n\nexport type {SpectrumBreadcrumbsProps} from '@adobe/react-spectrum/Breadcrumbs';\nexport {Item} from 'react-stately/Item';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/package.json
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/breadcrumbs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.10.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",
|
|
@@ -24,46 +24,23 @@
|
|
|
24
24
|
"*.css"
|
|
25
25
|
],
|
|
26
26
|
"targets": {
|
|
27
|
-
"
|
|
28
|
-
"includeNodeModules": [
|
|
29
|
-
"@adobe/spectrum-css-temp"
|
|
30
|
-
]
|
|
31
|
-
},
|
|
32
|
-
"module": {
|
|
33
|
-
"includeNodeModules": [
|
|
34
|
-
"@adobe/spectrum-css-temp"
|
|
35
|
-
]
|
|
36
|
-
}
|
|
27
|
+
"types": false
|
|
37
28
|
},
|
|
38
29
|
"repository": {
|
|
39
30
|
"type": "git",
|
|
40
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
41
32
|
},
|
|
42
33
|
"dependencies": {
|
|
43
|
-
"@react-
|
|
44
|
-
"@
|
|
45
|
-
"
|
|
46
|
-
"@react-aria/interactions": "^3.27.0",
|
|
47
|
-
"@react-aria/utils": "^3.33.0",
|
|
48
|
-
"@react-spectrum/button": "^3.17.6",
|
|
49
|
-
"@react-spectrum/menu": "^3.22.10",
|
|
50
|
-
"@react-spectrum/utils": "^3.12.11",
|
|
51
|
-
"@react-stately/collections": "^3.12.9",
|
|
52
|
-
"@react-types/breadcrumbs": "^3.7.18",
|
|
53
|
-
"@react-types/shared": "^3.33.0",
|
|
54
|
-
"@spectrum-icons/ui": "^3.6.22",
|
|
55
|
-
"@swc/helpers": "^0.5.0"
|
|
56
|
-
},
|
|
57
|
-
"devDependencies": {
|
|
58
|
-
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
34
|
+
"@adobe/react-spectrum": "3.47.0",
|
|
35
|
+
"@swc/helpers": "^0.5.0",
|
|
36
|
+
"react-stately": "3.46.0"
|
|
59
37
|
},
|
|
60
38
|
"peerDependencies": {
|
|
61
|
-
"@react-spectrum/provider": "^3.0.0",
|
|
62
39
|
"react": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1",
|
|
63
40
|
"react-dom": "^16.8.0 || ^17.0.0-rc.1 || ^18.0.0 || ^19.0.0-rc.1"
|
|
64
41
|
},
|
|
65
42
|
"publishConfig": {
|
|
66
43
|
"access": "public"
|
|
67
44
|
},
|
|
68
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "a6999bdf494a2e9c0381a5881908328bdd22ddae"
|
|
69
46
|
}
|
package/src/index.ts
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
* governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
/// <reference types="css-module-types" />
|
|
13
|
-
export {Breadcrumbs} from '
|
|
14
|
-
|
|
15
|
-
export type {SpectrumBreadcrumbsProps} from '@react-
|
|
13
|
+
export {Breadcrumbs} from '@adobe/react-spectrum/Breadcrumbs';
|
|
14
|
+
|
|
15
|
+
export type {SpectrumBreadcrumbsProps} from '@adobe/react-spectrum/Breadcrumbs';
|
|
16
|
+
export {Item} from 'react-stately/Item';
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
require("./breadcrumbs.1fc75877.css");
|
|
2
|
-
var $3292ef9f328419fc$exports = require("./breadcrumb_vars_css.main.js");
|
|
3
|
-
var $k4xVk$spectrumiconsuiChevronRightSmall = require("@spectrum-icons/ui/ChevronRightSmall");
|
|
4
|
-
var $k4xVk$reactspectrumutils = require("@react-spectrum/utils");
|
|
5
|
-
var $k4xVk$reactariafocus = require("@react-aria/focus");
|
|
6
|
-
var $k4xVk$reactariautils = require("@react-aria/utils");
|
|
7
|
-
var $k4xVk$react = require("react");
|
|
8
|
-
var $k4xVk$reactariabreadcrumbs = require("@react-aria/breadcrumbs");
|
|
9
|
-
var $k4xVk$reactariainteractions = require("@react-aria/interactions");
|
|
10
|
-
var $k4xVk$reactariai18n = require("@react-aria/i18n");
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
function $parcel$export(e, n, v, s) {
|
|
18
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
$parcel$export(module.exports, "BreadcrumbItem", () => $d90ab02c74e9be0c$export$c13f210c706eb549);
|
|
22
|
-
/*
|
|
23
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
24
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
25
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
26
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
27
|
-
*
|
|
28
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
29
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
30
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
31
|
-
* governing permissions and limitations under the License.
|
|
32
|
-
*/
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
function $d90ab02c74e9be0c$export$c13f210c706eb549(props) {
|
|
42
|
-
let { children: children, isCurrent: isCurrent, isDisabled: isDisabled, isMenu: isMenu } = props;
|
|
43
|
-
let { direction: direction } = (0, $k4xVk$reactariai18n.useLocale)();
|
|
44
|
-
let ref = (0, $k4xVk$react.useRef)(null);
|
|
45
|
-
let ElementType = props.href ? 'a' : 'span';
|
|
46
|
-
let { itemProps: itemProps } = (0, $k4xVk$reactariabreadcrumbs.useBreadcrumbItem)({
|
|
47
|
-
...props,
|
|
48
|
-
elementType: ElementType
|
|
49
|
-
}, ref);
|
|
50
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $k4xVk$reactariainteractions.useHover)(props);
|
|
51
|
-
// If this item contains a menu button, then it shouldn't be a link.
|
|
52
|
-
if (isMenu) itemProps = {};
|
|
53
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($k4xVk$react))).createElement((0, $k4xVk$react.Fragment), null, /*#__PURE__*/ (0, ($parcel$interopDefault($k4xVk$react))).createElement((0, $k4xVk$reactariafocus.FocusRing), {
|
|
54
|
-
focusRingClass: (0, $k4xVk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), 'focus-ring')
|
|
55
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($k4xVk$react))).createElement(ElementType, {
|
|
56
|
-
...(0, $k4xVk$reactariautils.mergeProps)(itemProps, hoverProps),
|
|
57
|
-
ref: ref,
|
|
58
|
-
className: (0, $k4xVk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), {
|
|
59
|
-
'spectrum-Breadcrumbs-itemLink': !isMenu,
|
|
60
|
-
'is-disabled': !isCurrent && isDisabled,
|
|
61
|
-
'is-hovered': isHovered
|
|
62
|
-
})
|
|
63
|
-
}, children)), /*#__PURE__*/ (0, ($parcel$interopDefault($k4xVk$react))).createElement((0, ($parcel$interopDefault($k4xVk$spectrumiconsuiChevronRightSmall))), {
|
|
64
|
-
UNSAFE_className: (0, $k4xVk$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), 'spectrum-Breadcrumbs-itemSeparator', {
|
|
65
|
-
'is-reversed': direction === 'rtl'
|
|
66
|
-
})
|
|
67
|
-
}));
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
//# sourceMappingURL=BreadcrumbItem.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAiBM,SAAS,0CAAe,KAAkC;IAC/D,IAAI,YACF,QAAQ,aACR,SAAS,cACT,UAAU,UACV,MAAM,EACP,GAAG;IAEJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,8BAAQ;IAC1B,IAAI,MAAM,CAAA,GAAA,mBAAK,EAAE;IACjB,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IACxD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,6CAAgB,EAAE;QAClC,GAAG,KAAK;QACR,aAAa;IACf,GAAG;IACH,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,qCAAO,EAAE;IAEvC,oEAAoE;IACpE,IAAI,QACF,YAAY,CAAC;IAGf,qBACE,0DAAC,CAAA,GAAA,qBAAO,uBACN,0DAAC,CAAA,GAAA,+BAAQ;QAAE,gBAAgB,CAAA,GAAA,oCAAS,EAAE,CAAA,GAAA,mDAAK,GAAG;qBAC5C,0DAAC;QACE,GAAG,CAAA,GAAA,gCAAS,EAAE,WAAW,WAAW;QACrC,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL;YACE,iCAAiC,CAAC;YAClC,eAAe,CAAC,aAAa;YAC7B,cAAc;QAChB;OAGH,0BAGL,0DAAC,CAAA,GAAA,iEAAgB;QACf,kBACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,mDAAK,GACL,sCACA;YACE,eAAe,cAAc;QAC/B;;AAKZ","sources":["packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.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 {BreadcrumbItemProps} from '@react-types/breadcrumbs';\nimport ChevronRightSmall from '@spectrum-icons/ui/ChevronRightSmall';\nimport {classNames} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, JSX, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/breadcrumb/vars.css';\nimport {useBreadcrumbItem} from '@react-aria/breadcrumbs';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface SpectrumBreadcrumbItemProps extends BreadcrumbItemProps {\n isMenu?: boolean\n}\n\nexport function BreadcrumbItem(props: SpectrumBreadcrumbItemProps): JSX.Element {\n let {\n children,\n isCurrent,\n isDisabled,\n isMenu\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef(null);\n let ElementType: React.ElementType = props.href ? 'a' : 'span';\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: ElementType\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n // If this item contains a menu button, then it shouldn't be a link.\n if (isMenu) {\n itemProps = {};\n }\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <ElementType\n {...mergeProps(itemProps, hoverProps)}\n ref={ref}\n className={\n classNames(\n styles,\n {\n 'spectrum-Breadcrumbs-itemLink': !isMenu,\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }>\n {children}\n </ElementType>\n </FocusRing>\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"BreadcrumbItem.main.js.map"}
|
package/dist/BreadcrumbItem.mjs
DELETED
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import "./breadcrumbs.1fc75877.css";
|
|
2
|
-
import $9saoi$breadcrumb_vars_cssmodulejs from "./breadcrumb_vars_css.mjs";
|
|
3
|
-
import $9saoi$spectrumiconsuiChevronRightSmall from "@spectrum-icons/ui/ChevronRightSmall";
|
|
4
|
-
import {classNames as $9saoi$classNames} from "@react-spectrum/utils";
|
|
5
|
-
import {FocusRing as $9saoi$FocusRing} from "@react-aria/focus";
|
|
6
|
-
import {mergeProps as $9saoi$mergeProps} from "@react-aria/utils";
|
|
7
|
-
import $9saoi$react, {useRef as $9saoi$useRef, Fragment as $9saoi$Fragment} from "react";
|
|
8
|
-
import {useBreadcrumbItem as $9saoi$useBreadcrumbItem} from "@react-aria/breadcrumbs";
|
|
9
|
-
import {useHover as $9saoi$useHover} from "@react-aria/interactions";
|
|
10
|
-
import {useLocale as $9saoi$useLocale} from "@react-aria/i18n";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function $2bfa2c84c665c457$export$c13f210c706eb549(props) {
|
|
36
|
-
let { children: children, isCurrent: isCurrent, isDisabled: isDisabled, isMenu: isMenu } = props;
|
|
37
|
-
let { direction: direction } = (0, $9saoi$useLocale)();
|
|
38
|
-
let ref = (0, $9saoi$useRef)(null);
|
|
39
|
-
let ElementType = props.href ? 'a' : 'span';
|
|
40
|
-
let { itemProps: itemProps } = (0, $9saoi$useBreadcrumbItem)({
|
|
41
|
-
...props,
|
|
42
|
-
elementType: ElementType
|
|
43
|
-
}, ref);
|
|
44
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9saoi$useHover)(props);
|
|
45
|
-
// If this item contains a menu button, then it shouldn't be a link.
|
|
46
|
-
if (isMenu) itemProps = {};
|
|
47
|
-
return /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$Fragment), null, /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$FocusRing), {
|
|
48
|
-
focusRingClass: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), 'focus-ring')
|
|
49
|
-
}, /*#__PURE__*/ (0, $9saoi$react).createElement(ElementType, {
|
|
50
|
-
...(0, $9saoi$mergeProps)(itemProps, hoverProps),
|
|
51
|
-
ref: ref,
|
|
52
|
-
className: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), {
|
|
53
|
-
'spectrum-Breadcrumbs-itemLink': !isMenu,
|
|
54
|
-
'is-disabled': !isCurrent && isDisabled,
|
|
55
|
-
'is-hovered': isHovered
|
|
56
|
-
})
|
|
57
|
-
}, children)), /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$spectrumiconsuiChevronRightSmall), {
|
|
58
|
-
UNSAFE_className: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), 'spectrum-Breadcrumbs-itemSeparator', {
|
|
59
|
-
'is-reversed': direction === 'rtl'
|
|
60
|
-
})
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export {$2bfa2c84c665c457$export$c13f210c706eb549 as BreadcrumbItem};
|
|
66
|
-
//# sourceMappingURL=BreadcrumbItem.module.js.map
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import "./breadcrumbs.1fc75877.css";
|
|
2
|
-
import $9saoi$breadcrumb_vars_cssmodulejs from "./breadcrumb_vars_css.module.js";
|
|
3
|
-
import $9saoi$spectrumiconsuiChevronRightSmall from "@spectrum-icons/ui/ChevronRightSmall";
|
|
4
|
-
import {classNames as $9saoi$classNames} from "@react-spectrum/utils";
|
|
5
|
-
import {FocusRing as $9saoi$FocusRing} from "@react-aria/focus";
|
|
6
|
-
import {mergeProps as $9saoi$mergeProps} from "@react-aria/utils";
|
|
7
|
-
import $9saoi$react, {useRef as $9saoi$useRef, Fragment as $9saoi$Fragment} from "react";
|
|
8
|
-
import {useBreadcrumbItem as $9saoi$useBreadcrumbItem} from "@react-aria/breadcrumbs";
|
|
9
|
-
import {useHover as $9saoi$useHover} from "@react-aria/interactions";
|
|
10
|
-
import {useLocale as $9saoi$useLocale} from "@react-aria/i18n";
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
function $parcel$interopDefault(a) {
|
|
14
|
-
return a && a.__esModule ? a.default : a;
|
|
15
|
-
}
|
|
16
|
-
/*
|
|
17
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
18
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
19
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
20
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
21
|
-
*
|
|
22
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
23
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
24
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
25
|
-
* governing permissions and limitations under the License.
|
|
26
|
-
*/
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
function $2bfa2c84c665c457$export$c13f210c706eb549(props) {
|
|
36
|
-
let { children: children, isCurrent: isCurrent, isDisabled: isDisabled, isMenu: isMenu } = props;
|
|
37
|
-
let { direction: direction } = (0, $9saoi$useLocale)();
|
|
38
|
-
let ref = (0, $9saoi$useRef)(null);
|
|
39
|
-
let ElementType = props.href ? 'a' : 'span';
|
|
40
|
-
let { itemProps: itemProps } = (0, $9saoi$useBreadcrumbItem)({
|
|
41
|
-
...props,
|
|
42
|
-
elementType: ElementType
|
|
43
|
-
}, ref);
|
|
44
|
-
let { hoverProps: hoverProps, isHovered: isHovered } = (0, $9saoi$useHover)(props);
|
|
45
|
-
// If this item contains a menu button, then it shouldn't be a link.
|
|
46
|
-
if (isMenu) itemProps = {};
|
|
47
|
-
return /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$Fragment), null, /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$FocusRing), {
|
|
48
|
-
focusRingClass: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), 'focus-ring')
|
|
49
|
-
}, /*#__PURE__*/ (0, $9saoi$react).createElement(ElementType, {
|
|
50
|
-
...(0, $9saoi$mergeProps)(itemProps, hoverProps),
|
|
51
|
-
ref: ref,
|
|
52
|
-
className: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), {
|
|
53
|
-
'spectrum-Breadcrumbs-itemLink': !isMenu,
|
|
54
|
-
'is-disabled': !isCurrent && isDisabled,
|
|
55
|
-
'is-hovered': isHovered
|
|
56
|
-
})
|
|
57
|
-
}, children)), /*#__PURE__*/ (0, $9saoi$react).createElement((0, $9saoi$spectrumiconsuiChevronRightSmall), {
|
|
58
|
-
UNSAFE_className: (0, $9saoi$classNames)((0, ($parcel$interopDefault($9saoi$breadcrumb_vars_cssmodulejs))), 'spectrum-Breadcrumbs-itemSeparator', {
|
|
59
|
-
'is-reversed': direction === 'rtl'
|
|
60
|
-
})
|
|
61
|
-
}));
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
export {$2bfa2c84c665c457$export$c13f210c706eb549 as BreadcrumbItem};
|
|
66
|
-
//# sourceMappingURL=BreadcrumbItem.module.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC;;;;;;;;;AAiBM,SAAS,0CAAe,KAAkC;IAC/D,IAAI,YACF,QAAQ,aACR,SAAS,cACT,UAAU,UACV,MAAM,EACP,GAAG;IAEJ,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,gBAAQ;IAC1B,IAAI,MAAM,CAAA,GAAA,aAAK,EAAE;IACjB,IAAI,cAAiC,MAAM,IAAI,GAAG,MAAM;IACxD,IAAI,aAAC,SAAS,EAAC,GAAG,CAAA,GAAA,wBAAgB,EAAE;QAClC,GAAG,KAAK;QACR,aAAa;IACf,GAAG;IACH,IAAI,cAAC,UAAU,aAAE,SAAS,EAAC,GAAG,CAAA,GAAA,eAAO,EAAE;IAEvC,oEAAoE;IACpE,IAAI,QACF,YAAY,CAAC;IAGf,qBACE,gCAAC,CAAA,GAAA,eAAO,uBACN,gCAAC,CAAA,GAAA,gBAAQ;QAAE,gBAAgB,CAAA,GAAA,iBAAS,EAAE,CAAA,GAAA,4DAAK,GAAG;qBAC5C,gCAAC;QACE,GAAG,CAAA,GAAA,iBAAS,EAAE,WAAW,WAAW;QACrC,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,GACL;YACE,iCAAiC,CAAC;YAClC,eAAe,CAAC,aAAa;YAC7B,cAAc;QAChB;OAGH,0BAGL,gCAAC,CAAA,GAAA,uCAAgB;QACf,kBACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,4DAAK,GACL,sCACA;YACE,eAAe,cAAc;QAC/B;;AAKZ","sources":["packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.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 {BreadcrumbItemProps} from '@react-types/breadcrumbs';\nimport ChevronRightSmall from '@spectrum-icons/ui/ChevronRightSmall';\nimport {classNames} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, JSX, useRef} from 'react';\nimport styles from '@adobe/spectrum-css-temp/components/breadcrumb/vars.css';\nimport {useBreadcrumbItem} from '@react-aria/breadcrumbs';\nimport {useHover} from '@react-aria/interactions';\nimport {useLocale} from '@react-aria/i18n';\n\ninterface SpectrumBreadcrumbItemProps extends BreadcrumbItemProps {\n isMenu?: boolean\n}\n\nexport function BreadcrumbItem(props: SpectrumBreadcrumbItemProps): JSX.Element {\n let {\n children,\n isCurrent,\n isDisabled,\n isMenu\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef(null);\n let ElementType: React.ElementType = props.href ? 'a' : 'span';\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: ElementType\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n // If this item contains a menu button, then it shouldn't be a link.\n if (isMenu) {\n itemProps = {};\n }\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n <ElementType\n {...mergeProps(itemProps, hoverProps)}\n ref={ref}\n className={\n classNames(\n styles,\n {\n 'spectrum-Breadcrumbs-itemLink': !isMenu,\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }>\n {children}\n </ElementType>\n </FocusRing>\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n </Fragment>\n );\n}\n"],"names":[],"version":3,"file":"BreadcrumbItem.module.js.map"}
|
package/dist/Breadcrumbs.main.js
DELETED
|
@@ -1,204 +0,0 @@
|
|
|
1
|
-
var $d90ab02c74e9be0c$exports = require("./BreadcrumbItem.main.js");
|
|
2
|
-
require("./breadcrumbs.1fc75877.css");
|
|
3
|
-
var $3292ef9f328419fc$exports = require("./breadcrumb_vars_css.main.js");
|
|
4
|
-
var $lykgu$reactspectrumbutton = require("@react-spectrum/button");
|
|
5
|
-
var $lykgu$reactspectrumutils = require("@react-spectrum/utils");
|
|
6
|
-
var $lykgu$spectrumiconsuiFolderBreadcrumb = require("@spectrum-icons/ui/FolderBreadcrumb");
|
|
7
|
-
var $lykgu$reactspectrummenu = require("@react-spectrum/menu");
|
|
8
|
-
var $lykgu$react = require("react");
|
|
9
|
-
var $lykgu$reactariabreadcrumbs = require("@react-aria/breadcrumbs");
|
|
10
|
-
var $lykgu$reactariautils = require("@react-aria/utils");
|
|
11
|
-
var $lykgu$reactspectrumprovider = require("@react-spectrum/provider");
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
function $parcel$interopDefault(a) {
|
|
15
|
-
return a && a.__esModule ? a.default : a;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
function $parcel$export(e, n, v, s) {
|
|
19
|
-
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
$parcel$export(module.exports, "Breadcrumbs", () => $299bf776d9162a05$export$2dc68d50d56fbbd);
|
|
23
|
-
/*
|
|
24
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
25
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
26
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
27
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
28
|
-
*
|
|
29
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
30
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
31
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
32
|
-
* governing permissions and limitations under the License.
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
const $299bf776d9162a05$var$MIN_VISIBLE_ITEMS = 1;
|
|
44
|
-
const $299bf776d9162a05$var$MAX_VISIBLE_ITEMS = 4;
|
|
45
|
-
const $299bf776d9162a05$export$2dc68d50d56fbbd = /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).forwardRef(function Breadcrumbs(props, ref) {
|
|
46
|
-
props = (0, $lykgu$reactspectrumprovider.useProviderProps)(props);
|
|
47
|
-
let { size: size = 'L', isMultiline: isMultiline, children: children, showRoot: showRoot, isDisabled: isDisabled, onAction: onAction, autoFocusCurrent: autoFocusCurrent, ...otherProps } = props;
|
|
48
|
-
// Not using React.Children.toArray because it mutates the key prop.
|
|
49
|
-
let childArray = [];
|
|
50
|
-
(0, ($parcel$interopDefault($lykgu$react))).Children.forEach(children, (child, index)=>{
|
|
51
|
-
if (/*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).isValidElement(child)) {
|
|
52
|
-
if (child.key == null) child = /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).cloneElement(child, {
|
|
53
|
-
key: index
|
|
54
|
-
});
|
|
55
|
-
childArray.push(child);
|
|
56
|
-
}
|
|
57
|
-
});
|
|
58
|
-
let domRef = (0, $lykgu$reactspectrumutils.useDOMRef)(ref);
|
|
59
|
-
let listRef = (0, $lykgu$react.useRef)(null);
|
|
60
|
-
let [visibleItems, setVisibleItems] = (0, $lykgu$reactariautils.useValueEffect)(childArray.length);
|
|
61
|
-
let { navProps: navProps } = (0, $lykgu$reactariabreadcrumbs.useBreadcrumbs)(props);
|
|
62
|
-
let { styleProps: styleProps } = (0, $lykgu$reactspectrumutils.useStyleProps)(otherProps);
|
|
63
|
-
let updateOverflow = (0, $lykgu$react.useCallback)(()=>{
|
|
64
|
-
let computeVisibleItems = (visibleItems)=>{
|
|
65
|
-
// Refs can be null at runtime.
|
|
66
|
-
let currListRef = listRef.current;
|
|
67
|
-
if (!currListRef) return visibleItems;
|
|
68
|
-
let listItems = Array.from(currListRef.children);
|
|
69
|
-
if (listItems.length <= 0) return visibleItems;
|
|
70
|
-
let containerWidth = currListRef.offsetWidth;
|
|
71
|
-
let isShowingMenu = childArray.length > visibleItems;
|
|
72
|
-
let calculatedWidth = 0;
|
|
73
|
-
let newVisibleItems = 0;
|
|
74
|
-
let maxVisibleItems = $299bf776d9162a05$var$MAX_VISIBLE_ITEMS;
|
|
75
|
-
if (showRoot) {
|
|
76
|
-
calculatedWidth += listItems.shift().offsetWidth;
|
|
77
|
-
newVisibleItems++;
|
|
78
|
-
}
|
|
79
|
-
if (isShowingMenu) {
|
|
80
|
-
calculatedWidth += listItems.shift().offsetWidth;
|
|
81
|
-
maxVisibleItems--;
|
|
82
|
-
}
|
|
83
|
-
if (showRoot && calculatedWidth >= containerWidth) newVisibleItems--;
|
|
84
|
-
// TODO: what if multiline and only one breadcrumb??
|
|
85
|
-
if (isMultiline) {
|
|
86
|
-
listItems.pop();
|
|
87
|
-
newVisibleItems++;
|
|
88
|
-
} else if (listItems.length > 0) {
|
|
89
|
-
// Ensure the last breadcrumb isn't truncated when we measure it.
|
|
90
|
-
let last = listItems.pop();
|
|
91
|
-
last.style.overflow = 'visible';
|
|
92
|
-
calculatedWidth += last.offsetWidth;
|
|
93
|
-
if (calculatedWidth < containerWidth) newVisibleItems++;
|
|
94
|
-
last.style.overflow = '';
|
|
95
|
-
}
|
|
96
|
-
for (let breadcrumb of listItems.reverse()){
|
|
97
|
-
calculatedWidth += breadcrumb.offsetWidth;
|
|
98
|
-
if (calculatedWidth < containerWidth) newVisibleItems++;
|
|
99
|
-
}
|
|
100
|
-
return Math.max($299bf776d9162a05$var$MIN_VISIBLE_ITEMS, Math.min(maxVisibleItems, newVisibleItems));
|
|
101
|
-
};
|
|
102
|
-
setVisibleItems(function*() {
|
|
103
|
-
// Update to show all items.
|
|
104
|
-
yield childArray.length;
|
|
105
|
-
// Measure, and update to show the items that fit.
|
|
106
|
-
let newVisibleItems = computeVisibleItems(childArray.length);
|
|
107
|
-
yield newVisibleItems;
|
|
108
|
-
// If the number of items is less than the number of children,
|
|
109
|
-
// then update again to ensure that the menu fits.
|
|
110
|
-
if (newVisibleItems < childArray.length && newVisibleItems > 1) yield computeVisibleItems(newVisibleItems);
|
|
111
|
-
});
|
|
112
|
-
}, [
|
|
113
|
-
childArray.length,
|
|
114
|
-
setVisibleItems,
|
|
115
|
-
showRoot,
|
|
116
|
-
isMultiline
|
|
117
|
-
]);
|
|
118
|
-
(0, $lykgu$reactariautils.useResizeObserver)({
|
|
119
|
-
ref: domRef,
|
|
120
|
-
onResize: updateOverflow
|
|
121
|
-
});
|
|
122
|
-
let lastChildren = (0, $lykgu$react.useRef)(null);
|
|
123
|
-
(0, $lykgu$reactariautils.useLayoutEffect)(()=>{
|
|
124
|
-
if (children !== lastChildren.current) {
|
|
125
|
-
lastChildren.current = children;
|
|
126
|
-
updateOverflow();
|
|
127
|
-
}
|
|
128
|
-
});
|
|
129
|
-
let contents = childArray;
|
|
130
|
-
if (childArray.length > visibleItems) {
|
|
131
|
-
let selectedItem = childArray[childArray.length - 1];
|
|
132
|
-
var _selectedItem_key;
|
|
133
|
-
let selectedKey = (_selectedItem_key = selectedItem.key) !== null && _selectedItem_key !== void 0 ? _selectedItem_key : childArray.length - 1;
|
|
134
|
-
let onMenuAction = (key)=>{
|
|
135
|
-
// Don't fire onAction when clicking on the last item
|
|
136
|
-
if (key !== selectedKey && onAction) onAction(key);
|
|
137
|
-
};
|
|
138
|
-
let menuItem = /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, $d90ab02c74e9be0c$exports.BreadcrumbItem), {
|
|
139
|
-
key: "menu",
|
|
140
|
-
isMenu: true
|
|
141
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, $lykgu$reactspectrummenu.MenuTrigger), null, /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, $lykgu$reactspectrumbutton.ActionButton), {
|
|
142
|
-
UNSAFE_className: (0, $lykgu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), 'spectrum-Breadcrumbs-actionButton'),
|
|
143
|
-
"aria-label": "\u2026",
|
|
144
|
-
isQuiet: true,
|
|
145
|
-
isDisabled: isDisabled
|
|
146
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, ($parcel$interopDefault($lykgu$spectrumiconsuiFolderBreadcrumb))), null)), /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, $lykgu$reactspectrummenu.Menu), {
|
|
147
|
-
selectionMode: "single",
|
|
148
|
-
selectedKeys: [
|
|
149
|
-
selectedKey
|
|
150
|
-
],
|
|
151
|
-
onAction: onMenuAction
|
|
152
|
-
}, childArray)));
|
|
153
|
-
contents = [
|
|
154
|
-
menuItem
|
|
155
|
-
];
|
|
156
|
-
let breadcrumbs = [
|
|
157
|
-
...childArray
|
|
158
|
-
];
|
|
159
|
-
let endItems = visibleItems;
|
|
160
|
-
if (showRoot && visibleItems > 1) {
|
|
161
|
-
let rootItem = breadcrumbs.shift();
|
|
162
|
-
if (rootItem) contents.unshift(rootItem);
|
|
163
|
-
endItems--;
|
|
164
|
-
}
|
|
165
|
-
contents.push(...breadcrumbs.slice(-endItems));
|
|
166
|
-
}
|
|
167
|
-
let lastIndex = contents.length - 1;
|
|
168
|
-
let breadcrumbItems = contents.map((child, index)=>{
|
|
169
|
-
let isCurrent = index === lastIndex;
|
|
170
|
-
var _child_key;
|
|
171
|
-
let key = (_child_key = child.key) !== null && _child_key !== void 0 ? _child_key : index;
|
|
172
|
-
let onPress = ()=>{
|
|
173
|
-
if (onAction) onAction(key);
|
|
174
|
-
};
|
|
175
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement("li", {
|
|
176
|
-
key: index,
|
|
177
|
-
className: (0, $lykgu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), 'spectrum-Breadcrumbs-item')
|
|
178
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement((0, $d90ab02c74e9be0c$exports.BreadcrumbItem), {
|
|
179
|
-
...child.props,
|
|
180
|
-
key: key,
|
|
181
|
-
isCurrent: isCurrent,
|
|
182
|
-
isDisabled: isDisabled,
|
|
183
|
-
onPress: onPress,
|
|
184
|
-
autoFocus: isCurrent && autoFocusCurrent
|
|
185
|
-
}, child.props.children));
|
|
186
|
-
});
|
|
187
|
-
return /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement("nav", {
|
|
188
|
-
...styleProps,
|
|
189
|
-
...navProps,
|
|
190
|
-
ref: domRef
|
|
191
|
-
}, /*#__PURE__*/ (0, ($parcel$interopDefault($lykgu$react))).createElement("ul", {
|
|
192
|
-
ref: listRef,
|
|
193
|
-
className: (0, $lykgu$reactspectrumutils.classNames)((0, ($parcel$interopDefault($3292ef9f328419fc$exports))), 'spectrum-Breadcrumbs', {
|
|
194
|
-
'spectrum-Breadcrumbs--small': size === 'S',
|
|
195
|
-
'spectrum-Breadcrumbs--medium': size === 'M',
|
|
196
|
-
'spectrum-Breadcrumbs--multiline': isMultiline,
|
|
197
|
-
'spectrum-Breadcrumbs--showRoot': showRoot,
|
|
198
|
-
'is-disabled': isDisabled
|
|
199
|
-
}, styleProps.className)
|
|
200
|
-
}, breadcrumbItems));
|
|
201
|
-
});
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
//# sourceMappingURL=Breadcrumbs.main.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"mappings":"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","sources":["packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.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 */\nimport {ActionButton} from '@react-spectrum/button';\nimport {BreadcrumbItem} from './BreadcrumbItem';\nimport {classNames, useDOMRef, useStyleProps} from '@react-spectrum/utils';\nimport {DOMRef, Key} from '@react-types/shared';\nimport FolderBreadcrumb from '@spectrum-icons/ui/FolderBreadcrumb';\nimport {Menu, MenuTrigger} from '@react-spectrum/menu';\nimport React, {ReactElement, useCallback, useRef} from 'react';\nimport {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\nimport styles from '@adobe/spectrum-css-temp/components/breadcrumb/vars.css';\nimport {useBreadcrumbs} from '@react-aria/breadcrumbs';\nimport {useLayoutEffect, useResizeObserver, useValueEffect} from '@react-aria/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\n\nconst MIN_VISIBLE_ITEMS = 1;\nconst MAX_VISIBLE_ITEMS = 4;\n\n/**\n * Breadcrumbs show hierarchy and navigational context for a user’s location within an application.\n */\nexport const Breadcrumbs = React.forwardRef(function Breadcrumbs<T>(props: SpectrumBreadcrumbsProps<T>, ref: DOMRef) {\n props = useProviderProps(props);\n let {\n size = 'L',\n isMultiline,\n children,\n showRoot,\n isDisabled,\n onAction,\n autoFocusCurrent,\n ...otherProps\n } = props;\n\n // Not using React.Children.toArray because it mutates the key prop.\n let childArray: ReactElement<any>[] = [];\n React.Children.forEach(children, (child, index) => {\n if (React.isValidElement(child)) {\n if (child.key == null) {\n child = React.cloneElement(child, {key: index});\n }\n childArray.push(child);\n }\n });\n\n let domRef = useDOMRef(ref);\n let listRef = useRef<HTMLUListElement>(null);\n\n let [visibleItems, setVisibleItems] = useValueEffect(childArray.length);\n\n let {navProps} = useBreadcrumbs(props);\n let {styleProps} = useStyleProps(otherProps);\n\n let updateOverflow = useCallback(() => {\n let computeVisibleItems = (visibleItems: number): number => {\n // Refs can be null at runtime.\n let currListRef: HTMLUListElement | null = listRef.current;\n if (!currListRef) {\n return visibleItems;\n }\n\n let listItems = Array.from(currListRef.children) as HTMLLIElement[];\n if (listItems.length <= 0) {\n return visibleItems;\n }\n let containerWidth = currListRef.offsetWidth;\n let isShowingMenu = childArray.length > visibleItems;\n let calculatedWidth = 0;\n let newVisibleItems = 0;\n let maxVisibleItems = MAX_VISIBLE_ITEMS;\n\n if (showRoot) {\n calculatedWidth += (listItems.shift() as HTMLLIElement).offsetWidth;\n newVisibleItems++;\n }\n\n if (isShowingMenu) {\n calculatedWidth += (listItems.shift() as HTMLLIElement).offsetWidth;\n maxVisibleItems--;\n }\n\n if (showRoot && calculatedWidth >= containerWidth) {\n newVisibleItems--;\n }\n\n // TODO: what if multiline and only one breadcrumb??\n if (isMultiline) {\n listItems.pop();\n newVisibleItems++;\n } else {\n if (listItems.length > 0) {\n // Ensure the last breadcrumb isn't truncated when we measure it.\n let last = (listItems.pop() as HTMLLIElement);\n last.style.overflow = 'visible';\n\n calculatedWidth += last.offsetWidth;\n if (calculatedWidth < containerWidth) {\n newVisibleItems++;\n }\n\n last.style.overflow = '';\n }\n }\n\n for (let breadcrumb of listItems.reverse()) {\n calculatedWidth += breadcrumb.offsetWidth;\n if (calculatedWidth < containerWidth) {\n newVisibleItems++;\n }\n }\n\n return Math.max(MIN_VISIBLE_ITEMS, Math.min(maxVisibleItems, newVisibleItems));\n };\n\n setVisibleItems(function *() {\n // Update to show all items.\n yield childArray.length;\n\n // Measure, and update to show the items that fit.\n let newVisibleItems = computeVisibleItems(childArray.length);\n yield newVisibleItems;\n\n // If the number of items is less than the number of children,\n // then update again to ensure that the menu fits.\n if (newVisibleItems < childArray.length && newVisibleItems > 1) {\n yield computeVisibleItems(newVisibleItems);\n }\n });\n }, [childArray.length, setVisibleItems, showRoot, isMultiline]);\n\n useResizeObserver({ref: domRef, onResize: updateOverflow});\n\n let lastChildren = useRef<typeof children | null>(null);\n useLayoutEffect(() => {\n if (children !== lastChildren.current) {\n lastChildren.current = children;\n updateOverflow();\n }\n });\n\n let contents = childArray;\n if (childArray.length > visibleItems) {\n let selectedItem = childArray[childArray.length - 1];\n let selectedKey = selectedItem.key ?? childArray.length - 1;\n let onMenuAction = (key: Key) => {\n // Don't fire onAction when clicking on the last item\n if (key !== selectedKey && onAction) {\n onAction(key);\n }\n };\n\n let menuItem = (\n <BreadcrumbItem key=\"menu\" isMenu>\n <MenuTrigger>\n <ActionButton\n UNSAFE_className={classNames(styles, 'spectrum-Breadcrumbs-actionButton')}\n aria-label=\"…\"\n isQuiet\n isDisabled={isDisabled}>\n <FolderBreadcrumb />\n </ActionButton>\n <Menu selectionMode=\"single\" selectedKeys={[selectedKey]} onAction={onMenuAction}>\n {childArray}\n </Menu>\n </MenuTrigger>\n </BreadcrumbItem>\n );\n\n contents = [menuItem];\n let breadcrumbs = [...childArray];\n let endItems = visibleItems;\n if (showRoot && visibleItems > 1) {\n let rootItem = breadcrumbs.shift();\n if (rootItem) {\n contents.unshift(rootItem);\n }\n endItems--;\n }\n contents.push(...breadcrumbs.slice(-endItems));\n }\n\n let lastIndex = contents.length - 1;\n let breadcrumbItems = contents.map((child, index) => {\n let isCurrent = index === lastIndex;\n let key = child.key ?? index;\n let onPress = () => {\n if (onAction) {\n onAction(key);\n }\n };\n\n return (\n <li\n key={index}\n className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-item'\n )\n }>\n <BreadcrumbItem\n {...child.props}\n key={key}\n isCurrent={isCurrent}\n isDisabled={isDisabled}\n onPress={onPress}\n autoFocus={isCurrent && autoFocusCurrent}>\n {child.props.children}\n </BreadcrumbItem>\n </li>\n );\n });\n\n return (\n <nav\n {...styleProps}\n {...navProps}\n ref={domRef}>\n <ul\n ref={listRef}\n className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs',\n {\n 'spectrum-Breadcrumbs--small': size === 'S',\n 'spectrum-Breadcrumbs--medium': size === 'M',\n 'spectrum-Breadcrumbs--multiline': isMultiline,\n 'spectrum-Breadcrumbs--showRoot': showRoot,\n 'is-disabled': isDisabled\n },\n styleProps.className\n )\n }>\n {breadcrumbItems}\n </ul>\n </nav>\n );\n});\n"],"names":[],"version":3,"file":"Breadcrumbs.main.js.map"}
|