@react-spectrum/breadcrumbs 3.5.2 → 3.6.1
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.css +1 -1
- package/dist/main.js +88 -56
- package/dist/main.js.map +1 -1
- package/dist/module.js +88 -56
- package/dist/module.js.map +1 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/Breadcrumbs.tsx +1 -0
package/dist/main.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.spectrum-Breadcrumbs_3fe6e8{flex-wrap:nowrap;flex:1 0;justify-content:flex-start;margin:0;padding:0;list-style-type:none;display:flex}.spectrum-Breadcrumbs-itemSeparator_3fe6e8{top:var(--spectrum-global-dimension-size-10);width:var(--spectrum-breadcrumb-ui-icon-width,var(--spectrum-global-dimension-size-75));height:var(--spectrum-breadcrumb-ui-icon-height,var(--spectrum-global-dimension-size-100));opacity:1;position:relative;transform:scale(1)}.spectrum-Breadcrumbs-itemSeparator_3fe6e8.is-reversed_3fe6e8{transform:scale(-1)}.spectrum-Breadcrumbs-item_3fe6e8{box-sizing:border-box;height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));white-space:nowrap;font-size:var(--spectrum-breadcrumb-item-text-size,var(--spectrum-global-dimension-font-size-200));font-weight:var(--spectrum-breadcrumb-item-text-font-weight,var(--spectrum-alias-body-text-font-weight));line-height:var(--spectrum-breadcrumb-item-text-line-height,var(--spectrum-alias-body-text-line-height));justify-content:flex-start;align-items:center;display:inline-flex;position:relative}.spectrum-Breadcrumbs-item_3fe6e8:last-of-type{font-weight:var(--spectrum-breadcrumb-title-text-font-weight,var(--spectrum-alias-body-text-font-weight-strong))}.spectrum-Breadcrumbs-item_3fe6e8:last-of-type .spectrum-Breadcrumbs-itemSeparator_3fe6e8{display:none}[dir=ltr] .spectrum-Breadcrumbs-item_3fe6e8>.spectrum-ActionButton_3fe6e8{margin-right:var(--spectrum-breadcrumb-button-gap,var(--spectrum-global-dimension-static-size-10))}[dir=rtl] .spectrum-Breadcrumbs-item_3fe6e8>.spectrum-ActionButton_3fe6e8{margin-left:var(--spectrum-breadcrumb-button-gap,var(--spectrum-global-dimension-static-size-10))}.spectrum-Breadcrumbs-item_3fe6e8:last-child{overflow:hidden}.spectrum-Breadcrumbs-item_3fe6e8:last-child .spectrum-Breadcrumbs-itemLink_3fe6e8{text-overflow:ellipsis;overflow:hidden}[dir=ltr] .spectrum-Breadcrumbs-itemLink_3fe6e8{margin-right:var(--spectrum-breadcrumb-item-margin-right,var(--spectrum-global-dimension-static-size-10))}[dir=rtl] .spectrum-Breadcrumbs-itemLink_3fe6e8{margin-left:var(--spectrum-breadcrumb-item-margin-right,var(--spectrum-global-dimension-static-size-10))}.spectrum-Breadcrumbs-itemLink_3fe6e8{cursor:default;line-height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));vertical-align:middle;padding:0 var(--spectrum-breadcrumb-item-padding-x,var(--spectrum-global-dimension-size-100));height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));border-radius:var(--spectrum-breadcrumb-item-border-radius,var(--spectrum-alias-border-radius-regular));font-size:inherit;outline:
|
|
1
|
+
.spectrum-Breadcrumbs_3fe6e8{flex-wrap:nowrap;flex:1 0;justify-content:flex-start;margin:0;padding:0;list-style-type:none;display:flex}.spectrum-Breadcrumbs-itemSeparator_3fe6e8{top:var(--spectrum-global-dimension-size-10);width:var(--spectrum-breadcrumb-ui-icon-width,var(--spectrum-global-dimension-size-75));height:var(--spectrum-breadcrumb-ui-icon-height,var(--spectrum-global-dimension-size-100));opacity:1;position:relative;transform:scale(1)}.spectrum-Breadcrumbs-itemSeparator_3fe6e8.is-reversed_3fe6e8{transform:scale(-1)}.spectrum-Breadcrumbs-item_3fe6e8{box-sizing:border-box;height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));white-space:nowrap;font-size:var(--spectrum-breadcrumb-item-text-size,var(--spectrum-global-dimension-font-size-200));font-weight:var(--spectrum-breadcrumb-item-text-font-weight,var(--spectrum-alias-body-text-font-weight));line-height:var(--spectrum-breadcrumb-item-text-line-height,var(--spectrum-alias-body-text-line-height));justify-content:flex-start;align-items:center;display:inline-flex;position:relative}.spectrum-Breadcrumbs-item_3fe6e8:last-of-type{font-weight:var(--spectrum-breadcrumb-title-text-font-weight,var(--spectrum-alias-body-text-font-weight-strong))}.spectrum-Breadcrumbs-item_3fe6e8:last-of-type .spectrum-Breadcrumbs-itemSeparator_3fe6e8{display:none}[dir=ltr] .spectrum-Breadcrumbs-item_3fe6e8>.spectrum-ActionButton_3fe6e8{margin-right:var(--spectrum-breadcrumb-button-gap,var(--spectrum-global-dimension-static-size-10))}[dir=rtl] .spectrum-Breadcrumbs-item_3fe6e8>.spectrum-ActionButton_3fe6e8{margin-left:var(--spectrum-breadcrumb-button-gap,var(--spectrum-global-dimension-static-size-10))}.spectrum-Breadcrumbs-item_3fe6e8:last-child{overflow:hidden}.spectrum-Breadcrumbs-item_3fe6e8:last-child .spectrum-Breadcrumbs-itemLink_3fe6e8{text-overflow:ellipsis;overflow:hidden}[dir=ltr] .spectrum-Breadcrumbs-itemLink_3fe6e8{margin-right:var(--spectrum-breadcrumb-item-margin-right,var(--spectrum-global-dimension-static-size-10))}[dir=rtl] .spectrum-Breadcrumbs-itemLink_3fe6e8{margin-left:var(--spectrum-breadcrumb-item-margin-right,var(--spectrum-global-dimension-static-size-10))}.spectrum-Breadcrumbs-itemLink_3fe6e8{cursor:default;line-height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));vertical-align:middle;padding:0 var(--spectrum-breadcrumb-item-padding-x,var(--spectrum-global-dimension-size-100));height:var(--spectrum-breadcrumb-list-height,var(--spectrum-global-dimension-size-400));border-radius:var(--spectrum-breadcrumb-item-border-radius,var(--spectrum-alias-border-radius-regular));font-size:inherit;outline:none;margin-top:0;margin-bottom:0;text-decoration:none;position:relative}.spectrum-Breadcrumbs-itemLink_3fe6e8[href],.spectrum-Breadcrumbs-itemLink_3fe6e8[tabindex="0"]{cursor:pointer}.spectrum-Breadcrumbs-itemLink_3fe6e8[href].is-hovered_3fe6e8,.spectrum-Breadcrumbs-itemLink_3fe6e8[href].focus-ring_3fe6e8,.spectrum-Breadcrumbs-itemLink_3fe6e8[tabindex="0"].is-hovered_3fe6e8,.spectrum-Breadcrumbs-itemLink_3fe6e8[tabindex="0"].focus-ring_3fe6e8{text-decoration:underline}[dir=ltr] .spectrum-Breadcrumbs-item_3fe6e8.is-dragged_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:before,[dir=ltr] .spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8:before{left:0}[dir=rtl] .spectrum-Breadcrumbs-item_3fe6e8.is-dragged_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:before,[dir=rtl] .spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8:before{right:0}.spectrum-Breadcrumbs-item_3fe6e8.is-dragged_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:before,.spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8:before{box-sizing:border-box;width:100%;height:100%;border-width:var(--spectrum-breadcrumb-item-border-size-key-focus,var(--spectrum-alias-border-size-thick));border-radius:var(--spectrum-breadcrumb-item-border-radius,var(--spectrum-alias-border-radius-regular));content:"";pointer-events:none;border-style:solid;display:block;position:absolute;top:0}.spectrum-Breadcrumbs--small_3fe6e8 .spectrum-Breadcrumbs-item_3fe6e8{font-size:var(--spectrum-breadcrumb-multiline-item-text-size,var(--spectrum-global-dimension-font-size-75))}.spectrum-Breadcrumbs--medium_3fe6e8 .spectrum-Breadcrumbs-item_3fe6e8{font-size:var(--spectrum-breadcrumb-compact-item-text-size,var(--spectrum-global-dimension-font-size-100))}.spectrum-Breadcrumbs--multiline_3fe6e8{flex-wrap:wrap}.spectrum-Breadcrumbs--multiline_3fe6e8 .spectrum-Breadcrumbs-item_3fe6e8:last-of-type{height:auto;margin-top:var(--spectrum-breadcrumb-multiline-title-margin-top,var(--spectrum-global-dimension-static-size-0));font-size:var(--spectrum-breadcrumb-multiline-title-text-size,var(--spectrum-global-dimension-font-size-300));font-weight:var(--spectrum-breadcrumb-multiline-title-text-font-weight,var(--spectrum-alias-body-text-font-weight-strong));line-height:var(--spectrum-breadcrumb-multiline-title-text-line-height,var(--spectrum-alias-heading-text-line-height));flex:0 100%}.spectrum-Breadcrumbs--multiline_3fe6e8 .spectrum-Breadcrumbs-item_3fe6e8:last-of-type .spectrum-Breadcrumbs-itemLink_3fe6e8{height:auto;text-decoration:none}.spectrum-Breadcrumbs--multiline_3fe6e8 .spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Heading--pageTitle_3fe6e8{font-size:inherit;font-weight:inherit;margin:0}.spectrum-Breadcrumbs-item_3fe6e8{color:var(--spectrum-breadcrumb-text-color,var(--spectrum-alias-label-text-color))}.spectrum-Breadcrumbs-item_3fe6e8.is-dragged_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8{color:var(--spectrum-breadcrumb-item-text-color-drop,var(--spectrum-alias-text-color-hover));background-color:var(--spectrum-breadcrumb-item-background-color-drop,var(--spectrum-alias-highlight-selected))}.spectrum-Breadcrumbs-item_3fe6e8.is-dragged_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:before{border-color:var(--spectrum-breadcrumb-item-border-color-drop,var(--spectrum-global-color-blue-500))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemSeparator_3fe6e8{color:var(--spectrum-breadcrumb-ui-icon-color,var(--spectrum-global-color-gray-500))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8{color:inherit}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.is-hovered_3fe6e8{color:var(--spectrum-breadcrumb-text-color-hover,var(--spectrum-alias-text-color-hover))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8{color:var(--spectrum-breadcrumb-text-color-key-focus,var(--spectrum-alias-text-color-hover))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8:before{border-color:var(--spectrum-breadcrumb-item-border-color-key-focus,var(--spectrum-alias-border-color-focus))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:active{color:var(--spectrum-breadcrumb-text-color-down,var(--spectrum-alias-text-color-down));border-bottom:0}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.is-disabled_3fe6e8{color:var(--spectrum-label-text-color-disabled,var(--spectrum-alias-text-color-disabled))}.spectrum-Breadcrumbs-item_3fe6e8.is-selected_3fe6e8,.spectrum-Breadcrumbs-item_3fe6e8:last-of-type{color:var(--spectrum-breadcrumb-text-color-down,var(--spectrum-alias-text-color-down))}.spectrum-Breadcrumbs-item_3fe6e8.is-selected_3fe6e8~.spectrum-Breadcrumb_3fe6e8:last-of-type{color:var(--spectrum-breadcrumb-text-color,var(--spectrum-alias-label-text-color))}.spectrum-Breadcrumbs-item_3fe6e8.is-selected_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.focus-ring_3fe6e8{color:var(--spectrum-breadcrumb-text-color-down,var(--spectrum-alias-text-color-down));border-bottom:0}@media (forced-colors:active){.spectrum-Breadcrumbs-item_3fe6e8{--spectrum-breadcrumb-item-border-color-drop:LinkText;--spectrum-breadcrumb-item-border-color-key-focus:CanvasText;--spectrum-breadcrumb-item-text-color-drop:LinkText;--spectrum-breadcrumb-text-color:LinkText;--spectrum-breadcrumb-text-color-down:CanvasText;--spectrum-breadcrumb-text-color-hover:LinkText;--spectrum-breadcrumb-text-color-key-focus:LinkText;--spectrum-breadcrumb-ui-icon-color:CanvasText;--spectrum-label-text-color-disabled:GrayText}.spectrum-Breadcrumbs-item_3fe6e8.is-selected_3fe6e8,.spectrum-Breadcrumbs-item_3fe6e8:last-of-type,.spectrum-Breadcrumbs-item_3fe6e8.is-selected_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.is-hovered_3fe6e8,.spectrum-Breadcrumbs-item_3fe6e8:last-of-type .spectrum-Breadcrumbs-itemLink_3fe6e8.is-hovered_3fe6e8{color:var(--spectrum-breadcrumb-text-color-down,var(--spectrum-alias-text-color-down))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8:active{color:var(--spectrum-breadcrumb-text-color,var(--spectrum-alias-label-text-color))}.spectrum-Breadcrumbs-item_3fe6e8 .spectrum-Breadcrumbs-itemLink_3fe6e8.is-disabled_3fe6e8:active{color:var(--spectrum-label-text-color-disabled,var(--spectrum-alias-text-color-disabled))}}
|
package/dist/main.js
CHANGED
|
@@ -22,8 +22,39 @@ function $parcel$interopDefault(a) {
|
|
|
22
22
|
|
|
23
23
|
$parcel$export(module.exports, "Breadcrumbs", () => $299bf776d9162a05$export$2dc68d50d56fbbd);
|
|
24
24
|
$parcel$export(module.exports, "Item", () => $8bWUw$reactstatelycollections.Item);
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
/*
|
|
26
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
27
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
28
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
29
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
30
|
+
*
|
|
31
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
32
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
33
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
34
|
+
* governing permissions and limitations under the License.
|
|
35
|
+
*/ /// <reference types="css-module-types" />
|
|
36
|
+
/*
|
|
37
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
38
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
39
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
40
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
41
|
+
*
|
|
42
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
43
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
44
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
45
|
+
* governing permissions and limitations under the License.
|
|
46
|
+
*/
|
|
47
|
+
/*
|
|
48
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
49
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
50
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
51
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
52
|
+
*
|
|
53
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
54
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
55
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
56
|
+
* governing permissions and limitations under the License.
|
|
57
|
+
*/
|
|
27
58
|
|
|
28
59
|
|
|
29
60
|
|
|
@@ -85,28 +116,28 @@ $3292ef9f328419fc$export$45a5316056cfac3c = "spectrum-Breadcrumb_3fe6e8";
|
|
|
85
116
|
|
|
86
117
|
function $d90ab02c74e9be0c$export$c13f210c706eb549(props) {
|
|
87
118
|
let { children: children , isCurrent: isCurrent , isDisabled: isDisabled } = props;
|
|
88
|
-
let { direction: direction } = $8bWUw$reactariai18n.useLocale();
|
|
89
|
-
let ref = $8bWUw$react.useRef();
|
|
90
|
-
let { itemProps: itemProps } = $8bWUw$reactariabreadcrumbs.useBreadcrumbItem({
|
|
119
|
+
let { direction: direction } = (0, $8bWUw$reactariai18n.useLocale)();
|
|
120
|
+
let ref = (0, $8bWUw$react.useRef)();
|
|
121
|
+
let { itemProps: itemProps } = (0, $8bWUw$reactariabreadcrumbs.useBreadcrumbItem)({
|
|
91
122
|
...props,
|
|
92
|
-
elementType: typeof children ===
|
|
123
|
+
elementType: typeof children === "string" ? "span" : "a"
|
|
93
124
|
}, ref);
|
|
94
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $8bWUw$reactariainteractions.useHover(props);
|
|
95
|
-
let element = /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).cloneElement($8bWUw$reactspectrumutils.getWrappedElement(children), {
|
|
96
|
-
|
|
125
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $8bWUw$reactariainteractions.useHover)(props);
|
|
126
|
+
let element = /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).cloneElement((0, $8bWUw$reactspectrumutils.getWrappedElement)(children), {
|
|
127
|
+
...(0, $8bWUw$reactariautils.mergeProps)(itemProps, hoverProps),
|
|
97
128
|
ref: ref,
|
|
98
|
-
className: $8bWUw$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports)),
|
|
99
|
-
|
|
100
|
-
|
|
129
|
+
className: (0, $8bWUw$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports))), "spectrum-Breadcrumbs-itemLink", {
|
|
130
|
+
"is-disabled": !isCurrent && isDisabled,
|
|
131
|
+
"is-hovered": isHovered
|
|
101
132
|
})
|
|
102
133
|
});
|
|
103
|
-
return
|
|
104
|
-
focusRingClass: $8bWUw$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports)),
|
|
105
|
-
}, element), isCurrent === false && /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement(($parcel$interopDefault($8bWUw$spectrumiconsuiChevronRightSmall)), {
|
|
106
|
-
UNSAFE_className: $8bWUw$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports)),
|
|
107
|
-
|
|
134
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $8bWUw$react.Fragment), null, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $8bWUw$reactariafocus.FocusRing), {
|
|
135
|
+
focusRingClass: (0, $8bWUw$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports))), "focus-ring")
|
|
136
|
+
}, element), isCurrent === false && /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, ($parcel$interopDefault($8bWUw$spectrumiconsuiChevronRightSmall))), {
|
|
137
|
+
UNSAFE_className: (0, $8bWUw$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports))), "spectrum-Breadcrumbs-itemSeparator", {
|
|
138
|
+
"is-reversed": direction === "rtl"
|
|
108
139
|
})
|
|
109
|
-
}))
|
|
140
|
+
}));
|
|
110
141
|
}
|
|
111
142
|
|
|
112
143
|
|
|
@@ -122,19 +153,19 @@ function $d90ab02c74e9be0c$export$c13f210c706eb549(props) {
|
|
|
122
153
|
const $299bf776d9162a05$var$MIN_VISIBLE_ITEMS = 1;
|
|
123
154
|
const $299bf776d9162a05$var$MAX_VISIBLE_ITEMS = 4;
|
|
124
155
|
function $299bf776d9162a05$var$Breadcrumbs(props, ref) {
|
|
125
|
-
props = $8bWUw$reactspectrumprovider.useProviderProps(props);
|
|
126
|
-
let { size: size =
|
|
156
|
+
props = (0, $8bWUw$reactspectrumprovider.useProviderProps)(props);
|
|
157
|
+
let { size: size = "L" , isMultiline: isMultiline , children: children , showRoot: showRoot , isDisabled: isDisabled , onAction: onAction , autoFocusCurrent: autoFocusCurrent , ...otherProps } = props;
|
|
127
158
|
// Not using React.Children.toArray because it mutates the key prop.
|
|
128
159
|
let childArray = [];
|
|
129
|
-
($parcel$interopDefault($8bWUw$react)).Children.forEach(children, (child)=>{
|
|
130
|
-
if (/*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).isValidElement(child)) childArray.push(child);
|
|
160
|
+
(0, ($parcel$interopDefault($8bWUw$react))).Children.forEach(children, (child)=>{
|
|
161
|
+
if (/*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).isValidElement(child)) childArray.push(child);
|
|
131
162
|
});
|
|
132
|
-
let domRef = $8bWUw$reactspectrumutils.useDOMRef(ref);
|
|
133
|
-
let listRef = $8bWUw$react.useRef(null);
|
|
134
|
-
let [
|
|
135
|
-
let { navProps: navProps } = $8bWUw$reactariabreadcrumbs.useBreadcrumbs(props);
|
|
136
|
-
let { styleProps: styleProps } = $8bWUw$reactspectrumutils.useStyleProps(otherProps);
|
|
137
|
-
let updateOverflow = $8bWUw$react.useCallback(()=>{
|
|
163
|
+
let domRef = (0, $8bWUw$reactspectrumutils.useDOMRef)(ref);
|
|
164
|
+
let listRef = (0, $8bWUw$react.useRef)(null);
|
|
165
|
+
let [visibleItems, setVisibleItems] = (0, $8bWUw$reactariautils.useValueEffect)(childArray.length);
|
|
166
|
+
let { navProps: navProps } = (0, $8bWUw$reactariabreadcrumbs.useBreadcrumbs)(props);
|
|
167
|
+
let { styleProps: styleProps } = (0, $8bWUw$reactspectrumutils.useStyleProps)(otherProps);
|
|
168
|
+
let updateOverflow = (0, $8bWUw$react.useCallback)(()=>{
|
|
138
169
|
let computeVisibleItems = (visibleItems)=>{
|
|
139
170
|
// Refs can be null at runtime.
|
|
140
171
|
let currListRef = listRef.current;
|
|
@@ -161,10 +192,10 @@ function $299bf776d9162a05$var$Breadcrumbs(props, ref) {
|
|
|
161
192
|
} else if (listItems.length > 0) {
|
|
162
193
|
// Ensure the last breadcrumb isn't truncated when we measure it.
|
|
163
194
|
let last = listItems.pop();
|
|
164
|
-
last.style.overflow =
|
|
195
|
+
last.style.overflow = "visible";
|
|
165
196
|
calculatedWidth += last.offsetWidth;
|
|
166
197
|
if (calculatedWidth < containerWidth) newVisibleItems++;
|
|
167
|
-
last.style.overflow =
|
|
198
|
+
last.style.overflow = "";
|
|
168
199
|
}
|
|
169
200
|
for (let breadcrumb of listItems.reverse()){
|
|
170
201
|
calculatedWidth += breadcrumb.offsetWidth;
|
|
@@ -188,29 +219,30 @@ function $299bf776d9162a05$var$Breadcrumbs(props, ref) {
|
|
|
188
219
|
showRoot,
|
|
189
220
|
isMultiline
|
|
190
221
|
]);
|
|
191
|
-
$8bWUw$reactariautils.useResizeObserver({
|
|
222
|
+
(0, $8bWUw$reactariautils.useResizeObserver)({
|
|
192
223
|
ref: domRef,
|
|
193
224
|
onResize: updateOverflow
|
|
194
225
|
});
|
|
195
|
-
|
|
226
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
227
|
+
(0, $8bWUw$reactariautils.useLayoutEffect)(updateOverflow, [
|
|
196
228
|
children
|
|
197
229
|
]);
|
|
198
230
|
let contents = childArray;
|
|
199
|
-
if (childArray.length >
|
|
231
|
+
if (childArray.length > visibleItems) {
|
|
200
232
|
let selectedItem = childArray[childArray.length - 1];
|
|
201
|
-
var
|
|
202
|
-
let selectedKey = (
|
|
233
|
+
var _selectedItem_key;
|
|
234
|
+
let selectedKey = (_selectedItem_key = selectedItem.key) !== null && _selectedItem_key !== void 0 ? _selectedItem_key : childArray.length - 1;
|
|
203
235
|
let onMenuAction = (key)=>{
|
|
204
236
|
// Don't fire onAction when clicking on the last item
|
|
205
237
|
if (key !== selectedKey && onAction) onAction(key);
|
|
206
238
|
};
|
|
207
|
-
let menuItem = /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement($d90ab02c74e9be0c$export$c13f210c706eb549, {
|
|
239
|
+
let menuItem = /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $d90ab02c74e9be0c$export$c13f210c706eb549), {
|
|
208
240
|
key: "menu"
|
|
209
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement($8bWUw$reactspectrummenu.MenuTrigger, null, /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement($8bWUw$reactspectrumbutton.ActionButton, {
|
|
241
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $8bWUw$reactspectrummenu.MenuTrigger), null, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $8bWUw$reactspectrumbutton.ActionButton), {
|
|
210
242
|
"aria-label": "…",
|
|
211
243
|
isQuiet: true,
|
|
212
244
|
isDisabled: isDisabled
|
|
213
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement(($parcel$interopDefault($8bWUw$spectrumiconsuiFolderBreadcrumb)), null)), /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement($8bWUw$reactspectrummenu.Menu, {
|
|
245
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, ($parcel$interopDefault($8bWUw$spectrumiconsuiFolderBreadcrumb))), null)), /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $8bWUw$reactspectrummenu.Menu), {
|
|
214
246
|
selectionMode: "single",
|
|
215
247
|
selectedKeys: [
|
|
216
248
|
selectedKey
|
|
@@ -223,8 +255,8 @@ function $299bf776d9162a05$var$Breadcrumbs(props, ref) {
|
|
|
223
255
|
let breadcrumbs = [
|
|
224
256
|
...childArray
|
|
225
257
|
];
|
|
226
|
-
let endItems =
|
|
227
|
-
if (showRoot &&
|
|
258
|
+
let endItems = visibleItems;
|
|
259
|
+
if (showRoot && visibleItems > 1) {
|
|
228
260
|
contents.unshift(breadcrumbs.shift());
|
|
229
261
|
endItems--;
|
|
230
262
|
}
|
|
@@ -233,40 +265,40 @@ function $299bf776d9162a05$var$Breadcrumbs(props, ref) {
|
|
|
233
265
|
let lastIndex = contents.length - 1;
|
|
234
266
|
let breadcrumbItems = contents.map((child, index)=>{
|
|
235
267
|
let isCurrent = index === lastIndex;
|
|
236
|
-
var
|
|
237
|
-
let key = (
|
|
268
|
+
var _child_key;
|
|
269
|
+
let key = (_child_key = child.key) !== null && _child_key !== void 0 ? _child_key : index;
|
|
238
270
|
let onPress = ()=>{
|
|
239
271
|
if (onAction) onAction(key);
|
|
240
272
|
};
|
|
241
|
-
return
|
|
273
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement("li", {
|
|
242
274
|
key: index,
|
|
243
|
-
className: $8bWUw$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports)),
|
|
244
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement($d90ab02c74e9be0c$export$c13f210c706eb549, {
|
|
275
|
+
className: (0, $8bWUw$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports))), "spectrum-Breadcrumbs-item")
|
|
276
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement((0, $d90ab02c74e9be0c$export$c13f210c706eb549), {
|
|
245
277
|
key: key,
|
|
246
278
|
isCurrent: isCurrent,
|
|
247
279
|
isDisabled: isDisabled,
|
|
248
280
|
onPress: onPress,
|
|
249
281
|
autoFocus: isCurrent && autoFocusCurrent
|
|
250
|
-
}, child.props.children))
|
|
282
|
+
}, child.props.children));
|
|
251
283
|
});
|
|
252
|
-
return
|
|
284
|
+
return /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement("nav", {
|
|
253
285
|
...styleProps,
|
|
254
286
|
...navProps,
|
|
255
287
|
ref: domRef
|
|
256
|
-
}, /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).createElement("ul", {
|
|
288
|
+
}, /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).createElement("ul", {
|
|
257
289
|
ref: listRef,
|
|
258
|
-
className: $8bWUw$reactspectrumutils.classNames((/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports)),
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
290
|
+
className: (0, $8bWUw$reactspectrumutils.classNames)((0, (/*@__PURE__*/$parcel$interopDefault($3292ef9f328419fc$exports))), "spectrum-Breadcrumbs", {
|
|
291
|
+
"spectrum-Breadcrumbs--small": size === "S",
|
|
292
|
+
"spectrum-Breadcrumbs--medium": size === "M",
|
|
293
|
+
"spectrum-Breadcrumbs--multiline": isMultiline,
|
|
294
|
+
"spectrum-Breadcrumbs--showRoot": showRoot,
|
|
295
|
+
"is-disabled": isDisabled
|
|
264
296
|
}, styleProps.className)
|
|
265
|
-
}, breadcrumbItems))
|
|
297
|
+
}, breadcrumbItems));
|
|
266
298
|
}
|
|
267
299
|
/**
|
|
268
300
|
* Breadcrumbs show hierarchy and navigational context for a user’s location within an application.
|
|
269
|
-
*/ let $299bf776d9162a05$export$2dc68d50d56fbbd = /*#__PURE__*/ ($parcel$interopDefault($8bWUw$react)).forwardRef($299bf776d9162a05$var$Breadcrumbs);
|
|
301
|
+
*/ let $299bf776d9162a05$export$2dc68d50d56fbbd = /*#__PURE__*/ (0, ($parcel$interopDefault($8bWUw$react))).forwardRef($299bf776d9162a05$var$Breadcrumbs);
|
|
270
302
|
|
|
271
303
|
|
|
272
304
|
|
package/dist/main.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGAA,GAAsC;AACtC,GAAoD;AACpD,GAA6B;AAC7B,GAA2C;AAC3C,GAAuC;AACvC,GAA+C;AAC/C,GAA4B;AAC5B,GAA4B;AAC5B,GAA4B;AAC5B,GAA6C;AAC7C,GAA8C;AAC9C,GAAiD;AACjD,GAA6C;AAC7C,GAA6B;AAC7B,GAA6B;AAC7B,GAAqC;AAfrC,yCAAsC,GAAG,CAA6B;AACtE,yCAAoD,GAAG,CAA2C;AAClG,yCAA6B,GAAG,CAAoB;AACpD,yCAA2C,GAAG,CAAkC;AAChF,wCAAuC,GAAG,CAA8B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;YAChB,SAAS,EAAE,SAAS,IAAI,gBAAgB;WACvC,KAAK,CAAC,KAAK,CAAC,QAAQ;IAI7B,CAAC;IAED,MAAM,oEACH,CAAG;WACE,UAAU;WACV,QAAQ;QACZ,GAAG,EAAE,MAAM;0EACV,CAAE;QACD,GAAG,EAAE,OAAO;QACZ,SAAS,EACP,oCAAU,CACR,gEAAM,EACN,CAAsB,uBACtB,CAAC;YACC,CAA6B,8BAAE,IAAI,KAAK,CAAG;YAC3C,CAA8B,+BAAE,IAAI,KAAK,CAAG;YAC5C,CAAiC,kCAAE,WAAW;YAC9C,CAAgC,iCAAE,QAAQ;YAC1C,CAAa,cAAE,UAAU;QAC3B,CAAC,EACD,UAAU,CAAC,SAAS;OAGvB,eAAe;AAIxB,CAAC;AAED,EAEG,AAFH;;CAEG,AAFH,EAEG,CACH,GAAG,CAAC,wCAAY,iBAAG,sCAAK,CAAC,UAAU,CAAC,iCAAW","sources":["packages/@react-spectrum/breadcrumbs/src/index.ts","packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.tsx","packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.tsx","packages/@adobe/spectrum-css-temp/components/breadcrumb/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Breadcrumbs} from './Breadcrumbs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\n","/*\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} from '@react-types/shared';\nimport FolderBreadcrumb from '@spectrum-icons/ui/FolderBreadcrumb';\nimport {Menu, MenuTrigger} from '@react-spectrum/menu';\nimport React, {Key, 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, useValueEffect} from '@react-aria/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useResizeObserver} from '@react-aria/utils';\n\nconst MIN_VISIBLE_ITEMS = 1;\nconst MAX_VISIBLE_ITEMS = 4;\n\nfunction 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[] = [];\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\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) => {\n // Refs can be null at runtime.\n let currListRef: HTMLUListElement | null = listRef.current;\n if (!currListRef) {\n return;\n }\n\n let listItems = Array.from(currListRef.children) as HTMLLIElement[];\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().offsetWidth;\n newVisibleItems++;\n }\n\n if (isShowingMenu) {\n calculatedWidth += listItems.shift().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();\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 useLayoutEffect(updateOverflow, [children]);\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\">\n <MenuTrigger>\n <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 contents.unshift(breadcrumbs.shift());\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 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\n/**\n * Breadcrumbs show hierarchy and navigational context for a user’s location within an application.\n */\nlet _Breadcrumbs = React.forwardRef(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n","/*\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, getWrappedElement} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, 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\nexport function BreadcrumbItem(props: BreadcrumbItemProps) {\n let {\n children,\n isCurrent,\n isDisabled\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef();\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: typeof children === 'string' ? 'span' : 'a'\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n let element = React.cloneElement(\n getWrappedElement(children),\n {\n ...mergeProps(itemProps, hoverProps),\n ref,\n className:\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemLink',\n {\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }\n );\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {element}\n </FocusRing>\n {isCurrent === false &&\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n }\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"main.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;CAUC,GACD;ACXA;;;;;;;;;;CAUC,GAED;;;;;;;;;;;;;;;;;;;;;;;ACZA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAfA,4CAAyC;AACzC,4CAAuD;AACvD,4CAAgC;AAChC,4CAA8C;AAC9C,2CAA0C;AAC1C,4CAAkD;AAClD,4CAA+B;AAC/B,4CAA+B;AAC/B,4CAA+B;AAC/B,4CAAgD;AAChD,4CAAiD;AACjD,4CAAoD;AACpD,4CAAgD;AAChD,4CAAgC;AAChC,4CAAgC;AAChC,4CAAwC;;;;;;ADQjC,SAAS,0CAAe,KAA0B,EAAE;IACzD,IAAI,YACF,SAAQ,aACR,UAAS,cACT,WAAU,EACX,GAAG;IAEJ,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,8BAAS,AAAD;IAC1B,IAAI,MAAM,CAAA,GAAA,mBAAM,AAAD;IACf,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,6CAAiB,AAAD,EAAE;QAClC,GAAG,KAAK;QACR,aAAa,OAAO,aAAa,WAAW,SAAS,GAAG;IAC1D,GAAG;IACH,IAAI,cAAC,WAAU,aAAE,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AAI,kBAAkB,SAAS,GAAG,CAAC,CAAC,OAAO,QAAU;QACnD,IAAI,YAAY,UAAU;YAChB;QAAV,IAAI,MAAM,CAAA,aAAA,MAAM,GAAG,cAAT,wBAAA,aAAa,KAAK;QAC5B,IAAI,UAAU,IAAM;YAClB,IAAI,UACF,SAAS;QAEb;QAEA,qBACE,0DAAC;YACC,KAAK;YACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,gEAAM,AAAD,GACL;yBAGJ,0DAAC,CAAA,GAAA,yCAAa;YACZ,KAAK;YACL,WAAW;YACX,YAAY;YACZ,SAAS;YACT,WAAW,aAAa;WACvB,MAAM,KAAK,CAAC,QAAQ;IAI7B;IAEA,qBACE,0DAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;qBACL,0DAAC;QACC,KAAK;QACL,WACE,CAAA,GAAA,oCAAS,EACP,CAAA,GAAA,yDAAM,OAAD,GACL,wBACA;YACE,+BAA+B,SAAS;YACxC,gCAAgC,SAAS;YACzC,mCAAmC;YACnC,kCAAkC;YAClC,eAAe;QACjB,GACA,WAAW,SAAS;OAGvB;AAIT;AAEA;;CAEC,GACD,IAAI,yDAAe,CAAA,GAAA,sCAAI,EAAE,UAAU,CAAC;;AD9NpC","sources":["packages/@react-spectrum/breadcrumbs/src/index.ts","packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.tsx","packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.tsx","packages/@adobe/spectrum-css-temp/components/breadcrumb/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Breadcrumbs} from './Breadcrumbs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\n","/*\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} from '@react-types/shared';\nimport FolderBreadcrumb from '@spectrum-icons/ui/FolderBreadcrumb';\nimport {Menu, MenuTrigger} from '@react-spectrum/menu';\nimport React, {Key, 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, useValueEffect} from '@react-aria/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useResizeObserver} from '@react-aria/utils';\n\nconst MIN_VISIBLE_ITEMS = 1;\nconst MAX_VISIBLE_ITEMS = 4;\n\nfunction 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[] = [];\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\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) => {\n // Refs can be null at runtime.\n let currListRef: HTMLUListElement | null = listRef.current;\n if (!currListRef) {\n return;\n }\n\n let listItems = Array.from(currListRef.children) as HTMLLIElement[];\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().offsetWidth;\n newVisibleItems++;\n }\n\n if (isShowingMenu) {\n calculatedWidth += listItems.shift().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();\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 // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateOverflow, [children]);\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\">\n <MenuTrigger>\n <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 contents.unshift(breadcrumbs.shift());\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 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\n/**\n * Breadcrumbs show hierarchy and navigational context for a user’s location within an application.\n */\nlet _Breadcrumbs = React.forwardRef(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n","/*\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, getWrappedElement} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, 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\nexport function BreadcrumbItem(props: BreadcrumbItemProps) {\n let {\n children,\n isCurrent,\n isDisabled\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef();\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: typeof children === 'string' ? 'span' : 'a'\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n let element = React.cloneElement(\n getWrappedElement(children),\n {\n ...mergeProps(itemProps, hoverProps),\n ref,\n className:\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemLink',\n {\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }\n );\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {element}\n </FocusRing>\n {isCurrent === false &&\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n }\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"main.js.map"}
|
package/dist/module.js
CHANGED
|
@@ -19,8 +19,39 @@ function $parcel$interopDefault(a) {
|
|
|
19
19
|
function $parcel$export(e, n, v, s) {
|
|
20
20
|
Object.defineProperty(e, n, {get: v, set: s, enumerable: true, configurable: true});
|
|
21
21
|
}
|
|
22
|
-
|
|
23
|
-
|
|
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
|
+
*/ /// <reference types="css-module-types" />
|
|
33
|
+
/*
|
|
34
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
35
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
36
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
37
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
38
|
+
*
|
|
39
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
40
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
41
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
42
|
+
* governing permissions and limitations under the License.
|
|
43
|
+
*/
|
|
44
|
+
/*
|
|
45
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
46
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
47
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
48
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
49
|
+
*
|
|
50
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
51
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
52
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
53
|
+
* governing permissions and limitations under the License.
|
|
54
|
+
*/
|
|
24
55
|
|
|
25
56
|
|
|
26
57
|
|
|
@@ -82,28 +113,28 @@ $48e85557f3729e3d$export$45a5316056cfac3c = "spectrum-Breadcrumb_3fe6e8";
|
|
|
82
113
|
|
|
83
114
|
function $2bfa2c84c665c457$export$c13f210c706eb549(props) {
|
|
84
115
|
let { children: children , isCurrent: isCurrent , isDisabled: isDisabled } = props;
|
|
85
|
-
let { direction: direction } = $koRP3$useLocale();
|
|
86
|
-
let ref = $koRP3$useRef();
|
|
87
|
-
let { itemProps: itemProps } = $koRP3$useBreadcrumbItem({
|
|
116
|
+
let { direction: direction } = (0, $koRP3$useLocale)();
|
|
117
|
+
let ref = (0, $koRP3$useRef)();
|
|
118
|
+
let { itemProps: itemProps } = (0, $koRP3$useBreadcrumbItem)({
|
|
88
119
|
...props,
|
|
89
|
-
elementType: typeof children ===
|
|
120
|
+
elementType: typeof children === "string" ? "span" : "a"
|
|
90
121
|
}, ref);
|
|
91
|
-
let { hoverProps: hoverProps , isHovered: isHovered } = $koRP3$useHover(props);
|
|
92
|
-
let element = /*#__PURE__*/ $koRP3$react.cloneElement($koRP3$getWrappedElement(children), {
|
|
93
|
-
|
|
122
|
+
let { hoverProps: hoverProps , isHovered: isHovered } = (0, $koRP3$useHover)(props);
|
|
123
|
+
let element = /*#__PURE__*/ (0, $koRP3$react).cloneElement((0, $koRP3$getWrappedElement)(children), {
|
|
124
|
+
...(0, $koRP3$mergeProps)(itemProps, hoverProps),
|
|
94
125
|
ref: ref,
|
|
95
|
-
className: $koRP3$classNames((/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports)),
|
|
96
|
-
|
|
97
|
-
|
|
126
|
+
className: (0, $koRP3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports))), "spectrum-Breadcrumbs-itemLink", {
|
|
127
|
+
"is-disabled": !isCurrent && isDisabled,
|
|
128
|
+
"is-hovered": isHovered
|
|
98
129
|
})
|
|
99
130
|
});
|
|
100
|
-
return
|
|
101
|
-
focusRingClass: $koRP3$classNames((/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports)),
|
|
102
|
-
}, element), isCurrent === false && /*#__PURE__*/ $koRP3$react.createElement($koRP3$spectrumiconsuiChevronRightSmall, {
|
|
103
|
-
UNSAFE_className: $koRP3$classNames((/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports)),
|
|
104
|
-
|
|
131
|
+
return /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$Fragment), null, /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$FocusRing), {
|
|
132
|
+
focusRingClass: (0, $koRP3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports))), "focus-ring")
|
|
133
|
+
}, element), isCurrent === false && /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$spectrumiconsuiChevronRightSmall), {
|
|
134
|
+
UNSAFE_className: (0, $koRP3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports))), "spectrum-Breadcrumbs-itemSeparator", {
|
|
135
|
+
"is-reversed": direction === "rtl"
|
|
105
136
|
})
|
|
106
|
-
}))
|
|
137
|
+
}));
|
|
107
138
|
}
|
|
108
139
|
|
|
109
140
|
|
|
@@ -119,19 +150,19 @@ function $2bfa2c84c665c457$export$c13f210c706eb549(props) {
|
|
|
119
150
|
const $2adaf67aabd3300b$var$MIN_VISIBLE_ITEMS = 1;
|
|
120
151
|
const $2adaf67aabd3300b$var$MAX_VISIBLE_ITEMS = 4;
|
|
121
152
|
function $2adaf67aabd3300b$var$Breadcrumbs(props, ref) {
|
|
122
|
-
props = $koRP3$useProviderProps(props);
|
|
123
|
-
let { size: size =
|
|
153
|
+
props = (0, $koRP3$useProviderProps)(props);
|
|
154
|
+
let { size: size = "L" , isMultiline: isMultiline , children: children , showRoot: showRoot , isDisabled: isDisabled , onAction: onAction , autoFocusCurrent: autoFocusCurrent , ...otherProps } = props;
|
|
124
155
|
// Not using React.Children.toArray because it mutates the key prop.
|
|
125
156
|
let childArray = [];
|
|
126
|
-
$koRP3$react.Children.forEach(children, (child)=>{
|
|
127
|
-
if (/*#__PURE__*/ $koRP3$react.isValidElement(child)) childArray.push(child);
|
|
157
|
+
(0, $koRP3$react).Children.forEach(children, (child)=>{
|
|
158
|
+
if (/*#__PURE__*/ (0, $koRP3$react).isValidElement(child)) childArray.push(child);
|
|
128
159
|
});
|
|
129
|
-
let domRef = $koRP3$useDOMRef(ref);
|
|
130
|
-
let listRef = $koRP3$useRef(null);
|
|
131
|
-
let [
|
|
132
|
-
let { navProps: navProps } = $koRP3$useBreadcrumbs(props);
|
|
133
|
-
let { styleProps: styleProps } = $koRP3$useStyleProps(otherProps);
|
|
134
|
-
let updateOverflow = $koRP3$useCallback(()=>{
|
|
160
|
+
let domRef = (0, $koRP3$useDOMRef)(ref);
|
|
161
|
+
let listRef = (0, $koRP3$useRef)(null);
|
|
162
|
+
let [visibleItems, setVisibleItems] = (0, $koRP3$useValueEffect)(childArray.length);
|
|
163
|
+
let { navProps: navProps } = (0, $koRP3$useBreadcrumbs)(props);
|
|
164
|
+
let { styleProps: styleProps } = (0, $koRP3$useStyleProps)(otherProps);
|
|
165
|
+
let updateOverflow = (0, $koRP3$useCallback)(()=>{
|
|
135
166
|
let computeVisibleItems = (visibleItems)=>{
|
|
136
167
|
// Refs can be null at runtime.
|
|
137
168
|
let currListRef = listRef.current;
|
|
@@ -158,10 +189,10 @@ function $2adaf67aabd3300b$var$Breadcrumbs(props, ref) {
|
|
|
158
189
|
} else if (listItems.length > 0) {
|
|
159
190
|
// Ensure the last breadcrumb isn't truncated when we measure it.
|
|
160
191
|
let last = listItems.pop();
|
|
161
|
-
last.style.overflow =
|
|
192
|
+
last.style.overflow = "visible";
|
|
162
193
|
calculatedWidth += last.offsetWidth;
|
|
163
194
|
if (calculatedWidth < containerWidth) newVisibleItems++;
|
|
164
|
-
last.style.overflow =
|
|
195
|
+
last.style.overflow = "";
|
|
165
196
|
}
|
|
166
197
|
for (let breadcrumb of listItems.reverse()){
|
|
167
198
|
calculatedWidth += breadcrumb.offsetWidth;
|
|
@@ -185,29 +216,30 @@ function $2adaf67aabd3300b$var$Breadcrumbs(props, ref) {
|
|
|
185
216
|
showRoot,
|
|
186
217
|
isMultiline
|
|
187
218
|
]);
|
|
188
|
-
$koRP3$useResizeObserver({
|
|
219
|
+
(0, $koRP3$useResizeObserver)({
|
|
189
220
|
ref: domRef,
|
|
190
221
|
onResize: updateOverflow
|
|
191
222
|
});
|
|
192
|
-
|
|
223
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
224
|
+
(0, $koRP3$useLayoutEffect)(updateOverflow, [
|
|
193
225
|
children
|
|
194
226
|
]);
|
|
195
227
|
let contents = childArray;
|
|
196
|
-
if (childArray.length >
|
|
228
|
+
if (childArray.length > visibleItems) {
|
|
197
229
|
let selectedItem = childArray[childArray.length - 1];
|
|
198
|
-
var
|
|
199
|
-
let selectedKey = (
|
|
230
|
+
var _selectedItem_key;
|
|
231
|
+
let selectedKey = (_selectedItem_key = selectedItem.key) !== null && _selectedItem_key !== void 0 ? _selectedItem_key : childArray.length - 1;
|
|
200
232
|
let onMenuAction = (key)=>{
|
|
201
233
|
// Don't fire onAction when clicking on the last item
|
|
202
234
|
if (key !== selectedKey && onAction) onAction(key);
|
|
203
235
|
};
|
|
204
|
-
let menuItem = /*#__PURE__*/ $koRP3$react.createElement($2bfa2c84c665c457$export$c13f210c706eb549, {
|
|
236
|
+
let menuItem = /*#__PURE__*/ (0, $koRP3$react).createElement((0, $2bfa2c84c665c457$export$c13f210c706eb549), {
|
|
205
237
|
key: "menu"
|
|
206
|
-
}, /*#__PURE__*/ $koRP3$react.createElement($koRP3$MenuTrigger, null, /*#__PURE__*/ $koRP3$react.createElement($koRP3$ActionButton, {
|
|
238
|
+
}, /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$MenuTrigger), null, /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$ActionButton), {
|
|
207
239
|
"aria-label": "…",
|
|
208
240
|
isQuiet: true,
|
|
209
241
|
isDisabled: isDisabled
|
|
210
|
-
}, /*#__PURE__*/ $koRP3$react.createElement($koRP3$spectrumiconsuiFolderBreadcrumb, null)), /*#__PURE__*/ $koRP3$react.createElement($koRP3$Menu, {
|
|
242
|
+
}, /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$spectrumiconsuiFolderBreadcrumb), null)), /*#__PURE__*/ (0, $koRP3$react).createElement((0, $koRP3$Menu), {
|
|
211
243
|
selectionMode: "single",
|
|
212
244
|
selectedKeys: [
|
|
213
245
|
selectedKey
|
|
@@ -220,8 +252,8 @@ function $2adaf67aabd3300b$var$Breadcrumbs(props, ref) {
|
|
|
220
252
|
let breadcrumbs = [
|
|
221
253
|
...childArray
|
|
222
254
|
];
|
|
223
|
-
let endItems =
|
|
224
|
-
if (showRoot &&
|
|
255
|
+
let endItems = visibleItems;
|
|
256
|
+
if (showRoot && visibleItems > 1) {
|
|
225
257
|
contents.unshift(breadcrumbs.shift());
|
|
226
258
|
endItems--;
|
|
227
259
|
}
|
|
@@ -230,40 +262,40 @@ function $2adaf67aabd3300b$var$Breadcrumbs(props, ref) {
|
|
|
230
262
|
let lastIndex = contents.length - 1;
|
|
231
263
|
let breadcrumbItems = contents.map((child, index)=>{
|
|
232
264
|
let isCurrent = index === lastIndex;
|
|
233
|
-
var
|
|
234
|
-
let key = (
|
|
265
|
+
var _child_key;
|
|
266
|
+
let key = (_child_key = child.key) !== null && _child_key !== void 0 ? _child_key : index;
|
|
235
267
|
let onPress = ()=>{
|
|
236
268
|
if (onAction) onAction(key);
|
|
237
269
|
};
|
|
238
|
-
return
|
|
270
|
+
return /*#__PURE__*/ (0, $koRP3$react).createElement("li", {
|
|
239
271
|
key: index,
|
|
240
|
-
className: $koRP3$classNames((/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports)),
|
|
241
|
-
}, /*#__PURE__*/ $koRP3$react.createElement($2bfa2c84c665c457$export$c13f210c706eb549, {
|
|
272
|
+
className: (0, $koRP3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports))), "spectrum-Breadcrumbs-item")
|
|
273
|
+
}, /*#__PURE__*/ (0, $koRP3$react).createElement((0, $2bfa2c84c665c457$export$c13f210c706eb549), {
|
|
242
274
|
key: key,
|
|
243
275
|
isCurrent: isCurrent,
|
|
244
276
|
isDisabled: isDisabled,
|
|
245
277
|
onPress: onPress,
|
|
246
278
|
autoFocus: isCurrent && autoFocusCurrent
|
|
247
|
-
}, child.props.children))
|
|
279
|
+
}, child.props.children));
|
|
248
280
|
});
|
|
249
|
-
return
|
|
281
|
+
return /*#__PURE__*/ (0, $koRP3$react).createElement("nav", {
|
|
250
282
|
...styleProps,
|
|
251
283
|
...navProps,
|
|
252
284
|
ref: domRef
|
|
253
|
-
}, /*#__PURE__*/ $koRP3$react.createElement("ul", {
|
|
285
|
+
}, /*#__PURE__*/ (0, $koRP3$react).createElement("ul", {
|
|
254
286
|
ref: listRef,
|
|
255
|
-
className: $koRP3$classNames((/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports)),
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
287
|
+
className: (0, $koRP3$classNames)((0, (/*@__PURE__*/$parcel$interopDefault($48e85557f3729e3d$exports))), "spectrum-Breadcrumbs", {
|
|
288
|
+
"spectrum-Breadcrumbs--small": size === "S",
|
|
289
|
+
"spectrum-Breadcrumbs--medium": size === "M",
|
|
290
|
+
"spectrum-Breadcrumbs--multiline": isMultiline,
|
|
291
|
+
"spectrum-Breadcrumbs--showRoot": showRoot,
|
|
292
|
+
"is-disabled": isDisabled
|
|
261
293
|
}, styleProps.className)
|
|
262
|
-
}, breadcrumbItems))
|
|
294
|
+
}, breadcrumbItems));
|
|
263
295
|
}
|
|
264
296
|
/**
|
|
265
297
|
* Breadcrumbs show hierarchy and navigational context for a user’s location within an application.
|
|
266
|
-
*/ let $2adaf67aabd3300b$export$2dc68d50d56fbbd = /*#__PURE__*/ $koRP3$react.forwardRef($2adaf67aabd3300b$var$Breadcrumbs);
|
|
298
|
+
*/ let $2adaf67aabd3300b$export$2dc68d50d56fbbd = /*#__PURE__*/ (0, $koRP3$react).forwardRef($2adaf67aabd3300b$var$Breadcrumbs);
|
|
267
299
|
|
|
268
300
|
|
|
269
301
|
|
package/dist/module.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AGAA,GAAsC;AACtC,GAAoD;AACpD,GAA6B;AAC7B,GAA2C;AAC3C,GAAuC;AACvC,GAA+C;AAC/C,GAA4B;AAC5B,GAA4B;AAC5B,GAA4B;AAC5B,GAA6C;AAC7C,GAA8C;A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ED,MAAM,0CACH,CAAE;YACD,GAAG,EAAE,KAAK;YACV,SAAS,EACP,iBAAU,CACR,gEAAM,EACN,CAA2B;oDAG9B,yCAAc;YACb,GAAG,EAAE,GAAG;YACR,SAAS,EAAE,SAAS;YACpB,UAAU,EAAE,UAAU;YACtB,OAAO,EAAE,OAAO;YAChB,SAAS,EAAE,SAAS,IAAI,gBAAgB;WACvC,KAAK,CAAC,KAAK,CAAC,QAAQ;IAI7B,CAAC;IAED,MAAM,0CACH,CAAG;WACE,UAAU;WACV,QAAQ;QACZ,GAAG,EAAE,MAAM;gDACV,CAAE;QACD,GAAG,EAAE,OAAO;QACZ,SAAS,EACP,iBAAU,CACR,gEAAM,EACN,CAAsB,uBACtB,CAAC;YACC,CAA6B,8BAAE,IAAI,KAAK,CAAG;YAC3C,CAA8B,+BAAE,IAAI,KAAK,CAAG;YAC5C,CAAiC,kCAAE,WAAW;YAC9C,CAAgC,iCAAE,QAAQ;YAC1C,CAAa,cAAE,UAAU;QAC3B,CAAC,EACD,UAAU,CAAC,SAAS;OAGvB,eAAe;AAIxB,CAAC;AAED,EAEG,AAFH;;CAEG,AAFH,EAEG,CACH,GAAG,CAAC,wCAAY,iBAAG,YAAK,CAAC,UAAU,CAAC,iCAAW","sources":["packages/@react-spectrum/breadcrumbs/src/index.ts","packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.tsx","packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.tsx","packages/@adobe/spectrum-css-temp/components/breadcrumb/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Breadcrumbs} from './Breadcrumbs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\n","/*\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} from '@react-types/shared';\nimport FolderBreadcrumb from '@spectrum-icons/ui/FolderBreadcrumb';\nimport {Menu, MenuTrigger} from '@react-spectrum/menu';\nimport React, {Key, 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, useValueEffect} from '@react-aria/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useResizeObserver} from '@react-aria/utils';\n\nconst MIN_VISIBLE_ITEMS = 1;\nconst MAX_VISIBLE_ITEMS = 4;\n\nfunction 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[] = [];\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\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) => {\n // Refs can be null at runtime.\n let currListRef: HTMLUListElement | null = listRef.current;\n if (!currListRef) {\n return;\n }\n\n let listItems = Array.from(currListRef.children) as HTMLLIElement[];\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().offsetWidth;\n newVisibleItems++;\n }\n\n if (isShowingMenu) {\n calculatedWidth += listItems.shift().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();\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 useLayoutEffect(updateOverflow, [children]);\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\">\n <MenuTrigger>\n <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 contents.unshift(breadcrumbs.shift());\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 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\n/**\n * Breadcrumbs show hierarchy and navigational context for a user’s location within an application.\n */\nlet _Breadcrumbs = React.forwardRef(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n","/*\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, getWrappedElement} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, 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\nexport function BreadcrumbItem(props: BreadcrumbItemProps) {\n let {\n children,\n isCurrent,\n isDisabled\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef();\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: typeof children === 'string' ? 'span' : 'a'\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n let element = React.cloneElement(\n getWrappedElement(children),\n {\n ...mergeProps(itemProps, hoverProps),\n ref,\n className:\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemLink',\n {\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }\n );\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {element}\n </FocusRing>\n {isCurrent === false &&\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n }\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"module.js.map"}
|
|
1
|
+
{"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;;;;CAUC,GACD,0CAA0C;ACX1C;;;;;;;;;;CAUC,GACD;ACXA;;;;;;;;;;CAUC,GAED;;;;;;;;;;;;;;;;;;;;;;;ACZA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAfA,4CAAyC;AACzC,4CAAuD;AACvD,4CAAgC;AAChC,4CAA8C;AAC9C,2CAA0C;AAC1C,4CAAkD;AAClD,4CAA+B;AAC/B,4CAA+B;AAC/B,4CAA+B;AAC/B,4CAAgD;AAChD,4CAAiD;AACjD,4CAAoD;AACpD,4CAAgD;AAChD,4CAAgC;AAChC,4CAAgC;AAChC,4CAAwC;;;;;;ADQjC,SAAS,0CAAe,KAA0B,EAAE;IACzD,IAAI,YACF,SAAQ,aACR,UAAS,cACT,WAAU,EACX,GAAG;IAEJ,IAAI,aAAC,UAAS,EAAC,GAAG,CAAA,GAAA,gBAAS,AAAD;IAC1B,IAAI,MAAM,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AAI,YAAY,eAAe,GAAG;YAChC,SAAS,OAAO,CAAC,YAAY,KAAK;YAClC;QACF,CAAC;QACD,SAAS,IAAI,IAAI,YAAY,KAAK,CAAC,CAAC;IACtC,CAAC;IAED,IAAI,YAAY,SAAS,MAAM,GAAG;IAClC,IAAI,kBAAkB,SAAS,GAAG,CAAC,CAAC,OAAO,QAAU;QACnD,IAAI,YAAY,UAAU;YAChB;QAAV,IAAI,MAAM,CAAA,aAAA,MAAM,GAAG,cAAT,wBAAA,aAAa,KAAK;QAC5B,IAAI,UAAU,IAAM;YAClB,IAAI,UACF,SAAS;QAEb;QAEA,qBACE,gCAAC;YACC,KAAK;YACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,gEAAM,AAAD,GACL;yBAGJ,gCAAC,CAAA,GAAA,yCAAa;YACZ,KAAK;YACL,WAAW;YACX,YAAY;YACZ,SAAS;YACT,WAAW,aAAa;WACvB,MAAM,KAAK,CAAC,QAAQ;IAI7B;IAEA,qBACE,gCAAC;QACE,GAAG,UAAU;QACb,GAAG,QAAQ;QACZ,KAAK;qBACL,gCAAC;QACC,KAAK;QACL,WACE,CAAA,GAAA,iBAAS,EACP,CAAA,GAAA,yDAAM,OAAD,GACL,wBACA;YACE,+BAA+B,SAAS;YACxC,gCAAgC,SAAS;YACzC,mCAAmC;YACnC,kCAAkC;YAClC,eAAe;QACjB,GACA,WAAW,SAAS;OAGvB;AAIT;AAEA;;CAEC,GACD,IAAI,yDAAe,CAAA,GAAA,YAAI,EAAE,UAAU,CAAC;;AD9NpC","sources":["packages/@react-spectrum/breadcrumbs/src/index.ts","packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.tsx","packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.tsx","packages/@adobe/spectrum-css-temp/components/breadcrumb/vars.css"],"sourcesContent":["/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Breadcrumbs} from './Breadcrumbs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\n","/*\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} from '@react-types/shared';\nimport FolderBreadcrumb from '@spectrum-icons/ui/FolderBreadcrumb';\nimport {Menu, MenuTrigger} from '@react-spectrum/menu';\nimport React, {Key, 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, useValueEffect} from '@react-aria/utils';\nimport {useProviderProps} from '@react-spectrum/provider';\nimport {useResizeObserver} from '@react-aria/utils';\n\nconst MIN_VISIBLE_ITEMS = 1;\nconst MAX_VISIBLE_ITEMS = 4;\n\nfunction 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[] = [];\n React.Children.forEach(children, child => {\n if (React.isValidElement(child)) {\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) => {\n // Refs can be null at runtime.\n let currListRef: HTMLUListElement | null = listRef.current;\n if (!currListRef) {\n return;\n }\n\n let listItems = Array.from(currListRef.children) as HTMLLIElement[];\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().offsetWidth;\n newVisibleItems++;\n }\n\n if (isShowingMenu) {\n calculatedWidth += listItems.shift().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();\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 // eslint-disable-next-line react-hooks/exhaustive-deps\n useLayoutEffect(updateOverflow, [children]);\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\">\n <MenuTrigger>\n <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 contents.unshift(breadcrumbs.shift());\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 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\n/**\n * Breadcrumbs show hierarchy and navigational context for a user’s location within an application.\n */\nlet _Breadcrumbs = React.forwardRef(Breadcrumbs);\nexport {_Breadcrumbs as Breadcrumbs};\n","/*\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, getWrappedElement} from '@react-spectrum/utils';\nimport {FocusRing} from '@react-aria/focus';\nimport {mergeProps} from '@react-aria/utils';\nimport React, {Fragment, 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\nexport function BreadcrumbItem(props: BreadcrumbItemProps) {\n let {\n children,\n isCurrent,\n isDisabled\n } = props;\n\n let {direction} = useLocale();\n let ref = useRef();\n let {itemProps} = useBreadcrumbItem({\n ...props,\n elementType: typeof children === 'string' ? 'span' : 'a'\n }, ref);\n let {hoverProps, isHovered} = useHover(props);\n\n let element = React.cloneElement(\n getWrappedElement(children),\n {\n ...mergeProps(itemProps, hoverProps),\n ref,\n className:\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemLink',\n {\n 'is-disabled': !isCurrent && isDisabled,\n 'is-hovered': isHovered\n }\n )\n }\n );\n\n return (\n <Fragment>\n <FocusRing focusRingClass={classNames(styles, 'focus-ring')}>\n {element}\n </FocusRing>\n {isCurrent === false &&\n <ChevronRightSmall\n UNSAFE_className={\n classNames(\n styles,\n 'spectrum-Breadcrumbs-itemSeparator',\n {\n 'is-reversed': direction === 'rtl'\n }\n )\n } />\n }\n </Fragment>\n );\n}\n","/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\n@import './index.css';\n@import './skin.css';\n"],"names":[],"version":3,"file":"module.js.map"}
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"mappings":";;
|
|
1
|
+
{"mappings":";;ACuOA;;GAEG;AACH,OAAA,IAAI,6JAA4C,CAAC;AC7NjD,OAAO,EAAC,IAAI,EAAC,MAAM,4BAA4B,CAAC;AAChD,YAAY,EAAC,wBAAwB,EAAC,MAAM,0BAA0B,CAAC","sources":["packages/@react-spectrum/breadcrumbs/src/packages/@react-spectrum/breadcrumbs/src/BreadcrumbItem.tsx","packages/@react-spectrum/breadcrumbs/src/packages/@react-spectrum/breadcrumbs/src/Breadcrumbs.tsx","packages/@react-spectrum/breadcrumbs/src/packages/@react-spectrum/breadcrumbs/src/index.ts","packages/@react-spectrum/breadcrumbs/src/index.ts"],"sourcesContent":[null,null,null,"/*\n * Copyright 2020 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n/// <reference types=\"css-module-types\" />\nexport {Breadcrumbs} from './Breadcrumbs';\nexport {Item} from '@react-stately/collections';\nexport type {SpectrumBreadcrumbsProps} from '@react-types/breadcrumbs';\n"],"names":[],"version":3,"file":"types.d.ts.map"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-spectrum/breadcrumbs",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.1",
|
|
4
4
|
"description": "Spectrum UI components in React",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"main": "dist/main.js",
|
|
@@ -31,19 +31,19 @@
|
|
|
31
31
|
"url": "https://github.com/adobe/react-spectrum"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@react-aria/
|
|
36
|
-
"@react-aria/
|
|
37
|
-
"@react-aria/
|
|
38
|
-
"@react-aria/
|
|
39
|
-
"@react-
|
|
40
|
-
"@react-spectrum/
|
|
41
|
-
"@react-spectrum/
|
|
42
|
-
"@react-
|
|
43
|
-
"@react-
|
|
44
|
-
"@react-types/
|
|
45
|
-
"@
|
|
46
|
-
"@
|
|
34
|
+
"@react-aria/breadcrumbs": "^3.4.1",
|
|
35
|
+
"@react-aria/focus": "^3.10.1",
|
|
36
|
+
"@react-aria/i18n": "^3.6.3",
|
|
37
|
+
"@react-aria/interactions": "^3.13.1",
|
|
38
|
+
"@react-aria/utils": "^3.14.2",
|
|
39
|
+
"@react-spectrum/button": "^3.11.1",
|
|
40
|
+
"@react-spectrum/menu": "^3.9.1",
|
|
41
|
+
"@react-spectrum/utils": "^3.8.1",
|
|
42
|
+
"@react-stately/collections": "^3.5.1",
|
|
43
|
+
"@react-types/breadcrumbs": "^3.4.6",
|
|
44
|
+
"@react-types/shared": "^3.16.0",
|
|
45
|
+
"@spectrum-icons/ui": "^3.4.1",
|
|
46
|
+
"@swc/helpers": "^0.4.14"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@adobe/spectrum-css-temp": "3.0.0-alpha.1"
|
|
@@ -56,5 +56,5 @@
|
|
|
56
56
|
"publishConfig": {
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
|
-
"gitHead": "
|
|
59
|
+
"gitHead": "5480d76bd815e239366f92852c76b6831ad2a4fd"
|
|
60
60
|
}
|
package/src/Breadcrumbs.tsx
CHANGED
|
@@ -131,6 +131,7 @@ function Breadcrumbs<T>(props: SpectrumBreadcrumbsProps<T>, ref: DOMRef) {
|
|
|
131
131
|
|
|
132
132
|
useResizeObserver({ref: domRef, onResize: updateOverflow});
|
|
133
133
|
|
|
134
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
134
135
|
useLayoutEffect(updateOverflow, [children]);
|
|
135
136
|
|
|
136
137
|
let contents = childArray;
|