@beweco/aurora-ui 0.1.47 → 0.1.48
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/index.cjs.js
CHANGED
|
@@ -1964,264 +1964,6 @@ var ImagePreview = function (_a) {
|
|
|
1964
1964
|
: undefined, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, "aria-label": isClickable ? t.clickableImageAriaLabel : undefined }), showRemoveButton && onRemove && (jsxRuntime.jsx("button", { type: "button", onClick: function () { return handleRemove(image.id || "", index); }, "aria-label": t.removeButtonAriaLabel, className: "\n\t\t\t\t\t\t\t\t\tabsolute -top-2 -right-2 \n\t\t\t\t\t\t\t\t\tp-1 rounded-full \n\t\t\t\t\t\t\t\t\tbg-danger-500 hover:bg-danger-600 \n\t\t\t\t\t\t\t\t\ttext-white \n\t\t\t\t\t\t\t\t\tcursor-pointer \n\t\t\t\t\t\t\t\t\ttransition-colors\n\t\t\t\t\t\t\t\t\tfocus:outline-none \n\t\t\t\t\t\t\t\t\tfocus:ring-2 \n\t\t\t\t\t\t\t\t\tfocus:ring-danger-400 \n\t\t\t\t\t\t\t\t\tfocus:ring-offset-2\n\t\t\t\t\t\t\t\t", children: jsxRuntime.jsx(IconComponent, { size: size === "micro" ? "sm" : "md", icon: "solar:trash-bin-minimalistic-outline" }) }))] }) }, image.id || index)); }) }));
|
|
1965
1965
|
};
|
|
1966
1966
|
|
|
1967
|
-
/*
|
|
1968
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1969
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1970
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1971
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1972
|
-
*
|
|
1973
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1974
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1975
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1976
|
-
* governing permissions and limitations under the License.
|
|
1977
|
-
*/ function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
|
|
1978
|
-
if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({
|
|
1979
|
-
preventScroll: true
|
|
1980
|
-
});
|
|
1981
|
-
else {
|
|
1982
|
-
let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
|
|
1983
|
-
element.focus();
|
|
1984
|
-
$7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
|
|
1985
|
-
}
|
|
1986
|
-
}
|
|
1987
|
-
let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
|
|
1988
|
-
function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
1989
|
-
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
1990
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
1991
|
-
try {
|
|
1992
|
-
let focusElem = document.createElement('div');
|
|
1993
|
-
focusElem.focus({
|
|
1994
|
-
get preventScroll () {
|
|
1995
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
1996
|
-
return true;
|
|
1997
|
-
}
|
|
1998
|
-
});
|
|
1999
|
-
} catch {
|
|
2000
|
-
// Ignore
|
|
2001
|
-
}
|
|
2002
|
-
}
|
|
2003
|
-
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
2004
|
-
}
|
|
2005
|
-
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
2006
|
-
let parent = element.parentNode;
|
|
2007
|
-
let scrollableElements = [];
|
|
2008
|
-
let rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
2009
|
-
while(parent instanceof HTMLElement && parent !== rootScrollingElement){
|
|
2010
|
-
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
|
|
2011
|
-
element: parent,
|
|
2012
|
-
scrollTop: parent.scrollTop,
|
|
2013
|
-
scrollLeft: parent.scrollLeft
|
|
2014
|
-
});
|
|
2015
|
-
parent = parent.parentNode;
|
|
2016
|
-
}
|
|
2017
|
-
if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
|
|
2018
|
-
element: rootScrollingElement,
|
|
2019
|
-
scrollTop: rootScrollingElement.scrollTop,
|
|
2020
|
-
scrollLeft: rootScrollingElement.scrollLeft
|
|
2021
|
-
});
|
|
2022
|
-
return scrollableElements;
|
|
2023
|
-
}
|
|
2024
|
-
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
2025
|
-
for (let { element: element, scrollTop: scrollTop, scrollLeft: scrollLeft } of scrollableElements){
|
|
2026
|
-
element.scrollTop = scrollTop;
|
|
2027
|
-
element.scrollLeft = scrollLeft;
|
|
2028
|
-
}
|
|
2029
|
-
}
|
|
2030
|
-
|
|
2031
|
-
/*
|
|
2032
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
2033
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2034
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2035
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2036
|
-
*
|
|
2037
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2038
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2039
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2040
|
-
* governing permissions and limitations under the License.
|
|
2041
|
-
*/ function $c87311424ea30a05$var$testUserAgent(re) {
|
|
2042
|
-
var _window_navigator_userAgentData;
|
|
2043
|
-
if (typeof window === 'undefined' || window.navigator == null) return false;
|
|
2044
|
-
return ((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
2045
|
-
}
|
|
2046
|
-
function $c87311424ea30a05$var$testPlatform(re) {
|
|
2047
|
-
var _window_navigator_userAgentData;
|
|
2048
|
-
return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
|
|
2049
|
-
}
|
|
2050
|
-
function $c87311424ea30a05$var$cached(fn) {
|
|
2051
|
-
if (process.env.NODE_ENV === 'test') return fn;
|
|
2052
|
-
let res = null;
|
|
2053
|
-
return ()=>{
|
|
2054
|
-
if (res == null) res = fn();
|
|
2055
|
-
return res;
|
|
2056
|
-
};
|
|
2057
|
-
}
|
|
2058
|
-
const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
|
|
2059
|
-
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
2060
|
-
});
|
|
2061
|
-
const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() {
|
|
2062
|
-
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
2063
|
-
});
|
|
2064
|
-
const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() {
|
|
2065
|
-
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
2066
|
-
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
2067
|
-
});
|
|
2068
|
-
const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() {
|
|
2069
|
-
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
2070
|
-
});
|
|
2071
|
-
$c87311424ea30a05$var$cached(function() {
|
|
2072
|
-
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
2073
|
-
});
|
|
2074
|
-
const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() {
|
|
2075
|
-
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
2076
|
-
});
|
|
2077
|
-
const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() {
|
|
2078
|
-
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
2079
|
-
});
|
|
2080
|
-
$c87311424ea30a05$var$cached(function() {
|
|
2081
|
-
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
2082
|
-
});
|
|
2083
|
-
const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() {
|
|
2084
|
-
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
2085
|
-
});
|
|
2086
|
-
|
|
2087
|
-
/*
|
|
2088
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
2089
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2090
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2091
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2092
|
-
*
|
|
2093
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2094
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2095
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2096
|
-
* governing permissions and limitations under the License.
|
|
2097
|
-
*/
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (React.createContext)({
|
|
2101
|
-
isNative: true,
|
|
2102
|
-
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
|
|
2103
|
-
useHref: (href)=>href
|
|
2104
|
-
});
|
|
2105
|
-
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
|
|
2106
|
-
return (React.useContext)($ea8dcbcb9ea1b556$var$RouterContext);
|
|
2107
|
-
}
|
|
2108
|
-
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
2109
|
-
var _window_event_type, _window_event;
|
|
2110
|
-
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
2111
|
-
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
2112
|
-
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
2113
|
-
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
2114
|
-
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
2115
|
-
if (($c87311424ea30a05$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith('key')) && target.target === '_blank') {
|
|
2116
|
-
if (($c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
|
|
2117
|
-
else ctrlKey = true;
|
|
2118
|
-
}
|
|
2119
|
-
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
2120
|
-
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
2121
|
-
let event = ($c87311424ea30a05$export$78551043582a6a98)() && ($c87311424ea30a05$export$9ac100e40613ea10)() && !($c87311424ea30a05$export$7bef049ce92e4224)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
2122
|
-
keyIdentifier: 'Enter',
|
|
2123
|
-
metaKey: metaKey,
|
|
2124
|
-
ctrlKey: ctrlKey,
|
|
2125
|
-
altKey: altKey,
|
|
2126
|
-
shiftKey: shiftKey
|
|
2127
|
-
}) : new MouseEvent('click', {
|
|
2128
|
-
metaKey: metaKey,
|
|
2129
|
-
ctrlKey: ctrlKey,
|
|
2130
|
-
altKey: altKey,
|
|
2131
|
-
shiftKey: shiftKey,
|
|
2132
|
-
bubbles: true,
|
|
2133
|
-
cancelable: true
|
|
2134
|
-
});
|
|
2135
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
|
|
2136
|
-
($7215afc6de606d6b$export$de79e2c695e052f3)(target);
|
|
2137
|
-
target.dispatchEvent(event);
|
|
2138
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
2139
|
-
}
|
|
2140
|
-
// https://github.com/parcel-bundler/parcel/issues/8724
|
|
2141
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
2142
|
-
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
2143
|
-
if (target instanceof HTMLAnchorElement) open(target);
|
|
2144
|
-
else if (target.hasAttribute('data-href')) {
|
|
2145
|
-
let link = document.createElement('a');
|
|
2146
|
-
link.href = target.getAttribute('data-href');
|
|
2147
|
-
if (target.hasAttribute('data-target')) link.target = target.getAttribute('data-target');
|
|
2148
|
-
if (target.hasAttribute('data-rel')) link.rel = target.getAttribute('data-rel');
|
|
2149
|
-
if (target.hasAttribute('data-download')) link.download = target.getAttribute('data-download');
|
|
2150
|
-
if (target.hasAttribute('data-ping')) link.ping = target.getAttribute('data-ping');
|
|
2151
|
-
if (target.hasAttribute('data-referrer-policy')) link.referrerPolicy = target.getAttribute('data-referrer-policy');
|
|
2152
|
-
target.appendChild(link);
|
|
2153
|
-
open(link);
|
|
2154
|
-
target.removeChild(link);
|
|
2155
|
-
}
|
|
2156
|
-
}
|
|
2157
|
-
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
2158
|
-
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
2159
|
-
}
|
|
2160
|
-
|
|
2161
|
-
/*
|
|
2162
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
2163
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2164
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2165
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2166
|
-
*
|
|
2167
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2168
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2169
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2170
|
-
* governing permissions and limitations under the License.
|
|
2171
|
-
*/
|
|
2172
|
-
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
2173
|
-
let [stateValue, setStateValue] = (React.useState)(value || defaultValue);
|
|
2174
|
-
let isControlledRef = (React.useRef)(value !== undefined);
|
|
2175
|
-
let isControlled = value !== undefined;
|
|
2176
|
-
(React.useEffect)(()=>{
|
|
2177
|
-
let wasControlled = isControlledRef.current;
|
|
2178
|
-
if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
|
|
2179
|
-
isControlledRef.current = isControlled;
|
|
2180
|
-
}, [
|
|
2181
|
-
isControlled
|
|
2182
|
-
]);
|
|
2183
|
-
let currentValue = isControlled ? value : stateValue;
|
|
2184
|
-
let setValue = (React.useCallback)((value, ...args)=>{
|
|
2185
|
-
let onChangeCaller = (value, ...onChangeArgs)=>{
|
|
2186
|
-
if (onChange) {
|
|
2187
|
-
if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
|
|
2188
|
-
}
|
|
2189
|
-
if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
|
|
2190
|
-
// calling setState multiple times with the same value only emits onChange once.
|
|
2191
|
-
// We do not use a ref for this because we specifically _do_ want the value to
|
|
2192
|
-
// reset every render, and assigning to a ref in render breaks aborted suspended renders.
|
|
2193
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2194
|
-
currentValue = value;
|
|
2195
|
-
};
|
|
2196
|
-
if (typeof value === 'function') {
|
|
2197
|
-
if (process.env.NODE_ENV !== 'production') console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
|
|
2198
|
-
// this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
|
|
2199
|
-
// when someone using useControlledState calls setControlledState(myFunc)
|
|
2200
|
-
// this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
|
|
2201
|
-
// if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
|
|
2202
|
-
// otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
|
|
2203
|
-
let updateFunction = (oldValue, ...functionArgs)=>{
|
|
2204
|
-
let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
2205
|
-
onChangeCaller(interceptedValue, ...args);
|
|
2206
|
-
if (!isControlled) return interceptedValue;
|
|
2207
|
-
return oldValue;
|
|
2208
|
-
};
|
|
2209
|
-
setStateValue(updateFunction);
|
|
2210
|
-
} else {
|
|
2211
|
-
if (!isControlled) setStateValue(value);
|
|
2212
|
-
onChangeCaller(value, ...args);
|
|
2213
|
-
}
|
|
2214
|
-
}, [
|
|
2215
|
-
isControlled,
|
|
2216
|
-
currentValue,
|
|
2217
|
-
onChange
|
|
2218
|
-
]);
|
|
2219
|
-
return [
|
|
2220
|
-
currentValue,
|
|
2221
|
-
setValue
|
|
2222
|
-
];
|
|
2223
|
-
}
|
|
2224
|
-
|
|
2225
1967
|
function normalizeClass(value) {
|
|
2226
1968
|
if (typeof value === "string") {
|
|
2227
1969
|
return value || undefined;
|
|
@@ -2279,37 +2021,25 @@ var EnumMenuNavListItem;
|
|
|
2279
2021
|
* @forwardRef
|
|
2280
2022
|
*/
|
|
2281
2023
|
var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
2282
|
-
var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey
|
|
2024
|
+
var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey; _a.onSelect; var hideEndContent = _a.hideEndContent, _b = _a.sectionClasses, sectionClassesProp = _b === void 0 ? {} : _b, _c = _a.itemClasses, itemClassesProp = _c === void 0 ? {} : _c, iconClassName = _a.iconClassName, classNames = _a.classNames, className = _a.className, props = __rest(_a, ["items", "isCollapsed", "defaultSelectedKey", "onSelect", "hideEndContent", "sectionClasses", "itemClasses", "iconClassName", "classNames", "className"]);
|
|
2283
2025
|
var _d = React.useState(defaultSelectedKey), selected = _d[0], setSelected = _d[1];
|
|
2284
|
-
var router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
2285
2026
|
// Component styles
|
|
2286
2027
|
var sectionClasses = getSectionClasses(isCollapsed, sectionClassesProp);
|
|
2287
2028
|
var itemClasses = getItemClasses(isCollapsed, itemClassesProp);
|
|
2288
|
-
// Handles the click event on an item, updating the selection state
|
|
2029
|
+
// Handles the click event on an item, updating the selection state.
|
|
2289
2030
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
2290
2031
|
var handleItemPress = React.useCallback(function (item, parentKey) {
|
|
2291
2032
|
var keySelected = typeof parentKey === "string" ? parentKey : item.key;
|
|
2292
2033
|
setSelected(keySelected);
|
|
2293
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(keySelected);
|
|
2294
|
-
// Use the router provider for client-side navigation (avoids full page reload)
|
|
2295
|
-
if (item.href && item.href !== "#") {
|
|
2296
|
-
if (!router.isNative) {
|
|
2297
|
-
router.open(document.activeElement, new MouseEvent("click"), item.href);
|
|
2298
|
-
}
|
|
2299
|
-
else {
|
|
2300
|
-
window.location.href = item.href;
|
|
2301
|
-
}
|
|
2302
|
-
}
|
|
2303
2034
|
// Force blur to remove hover state after click.
|
|
2304
2035
|
if (document.activeElement instanceof HTMLElement) {
|
|
2305
2036
|
document.activeElement.blur();
|
|
2306
2037
|
}
|
|
2307
|
-
}, [setSelected
|
|
2038
|
+
}, [setSelected]);
|
|
2308
2039
|
// Renders the item displayed inside the Popover when the menu is collapsed.
|
|
2309
2040
|
var renderCompactItem = React.useCallback(function (item, parentKey) {
|
|
2310
2041
|
var _a, _b;
|
|
2311
|
-
item.
|
|
2312
|
-
return (React.createElement(react.ListboxItem, __assign({}, itemWithoutHref, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
|
|
2042
|
+
return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
|
|
2313
2043
|
}, [handleItemPress, iconClassName]);
|
|
2314
2044
|
// Renders a nested item, i.e., an item that has sub-items.
|
|
2315
2045
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
@@ -2318,8 +2048,10 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2318
2048
|
var isNestType = item.items &&
|
|
2319
2049
|
((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
2320
2050
|
(item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
|
|
2321
|
-
|
|
2322
|
-
|
|
2051
|
+
if (isNestType) {
|
|
2052
|
+
item.href = undefined;
|
|
2053
|
+
}
|
|
2054
|
+
return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, classNames: {
|
|
2323
2055
|
base: react.cn({
|
|
2324
2056
|
"h-auto p-0": !isCollapsed && isNestType,
|
|
2325
2057
|
}, {
|
|
@@ -2356,8 +2088,7 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2356
2088
|
return renderNestItem(item);
|
|
2357
2089
|
}
|
|
2358
2090
|
var isItemSelected = selected === item.key;
|
|
2359
|
-
item.
|
|
2360
|
-
return (React.createElement(react.ListboxItem, __assign({}, itemWithoutHref, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
|
|
2091
|
+
return (React.createElement(react.ListboxItem, __assign({}, item, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsxRuntime.jsx(react.Tooltip, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
|
|
2361
2092
|
base: "text-default-500",
|
|
2362
2093
|
}, children: jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center", "aria-hidden": "true", children: item.icon ? (jsxRuntime.jsx(IconComponent, { className: react.cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) })) : null));
|
|
2363
2094
|
},
|
|
@@ -2429,6 +2160,70 @@ var StepIndicator = function (_a) {
|
|
|
2429
2160
|
return (jsxRuntime.jsxs("div", __assign({ className: react.cn("w-full", className) }, props, { children: [showStepText && (jsxRuntime.jsx("div", { className: "text-center text-sm font-medium text-default-400 mb-3", children: stepText })), jsxRuntime.jsx("div", { className: "w-full bg-content2 rounded-full h-2 overflow-hidden", children: jsxRuntime.jsx("div", { className: react.cn("h-full transition-all duration-300 ease-out rounded-full", colorClasses[color]), style: { width: "".concat(progressPercentage, "%") } }) })] })));
|
|
2430
2161
|
};
|
|
2431
2162
|
|
|
2163
|
+
/*
|
|
2164
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
2165
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2166
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2167
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2168
|
+
*
|
|
2169
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2170
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2171
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2172
|
+
* governing permissions and limitations under the License.
|
|
2173
|
+
*/
|
|
2174
|
+
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
2175
|
+
let [stateValue, setStateValue] = (React.useState)(value || defaultValue);
|
|
2176
|
+
let isControlledRef = (React.useRef)(value !== undefined);
|
|
2177
|
+
let isControlled = value !== undefined;
|
|
2178
|
+
(React.useEffect)(()=>{
|
|
2179
|
+
let wasControlled = isControlledRef.current;
|
|
2180
|
+
if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
|
|
2181
|
+
isControlledRef.current = isControlled;
|
|
2182
|
+
}, [
|
|
2183
|
+
isControlled
|
|
2184
|
+
]);
|
|
2185
|
+
let currentValue = isControlled ? value : stateValue;
|
|
2186
|
+
let setValue = (React.useCallback)((value, ...args)=>{
|
|
2187
|
+
let onChangeCaller = (value, ...onChangeArgs)=>{
|
|
2188
|
+
if (onChange) {
|
|
2189
|
+
if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
|
|
2190
|
+
}
|
|
2191
|
+
if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
|
|
2192
|
+
// calling setState multiple times with the same value only emits onChange once.
|
|
2193
|
+
// We do not use a ref for this because we specifically _do_ want the value to
|
|
2194
|
+
// reset every render, and assigning to a ref in render breaks aborted suspended renders.
|
|
2195
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2196
|
+
currentValue = value;
|
|
2197
|
+
};
|
|
2198
|
+
if (typeof value === 'function') {
|
|
2199
|
+
if (process.env.NODE_ENV !== 'production') console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
|
|
2200
|
+
// this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
|
|
2201
|
+
// when someone using useControlledState calls setControlledState(myFunc)
|
|
2202
|
+
// this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
|
|
2203
|
+
// if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
|
|
2204
|
+
// otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
|
|
2205
|
+
let updateFunction = (oldValue, ...functionArgs)=>{
|
|
2206
|
+
let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
2207
|
+
onChangeCaller(interceptedValue, ...args);
|
|
2208
|
+
if (!isControlled) return interceptedValue;
|
|
2209
|
+
return oldValue;
|
|
2210
|
+
};
|
|
2211
|
+
setStateValue(updateFunction);
|
|
2212
|
+
} else {
|
|
2213
|
+
if (!isControlled) setStateValue(value);
|
|
2214
|
+
onChangeCaller(value, ...args);
|
|
2215
|
+
}
|
|
2216
|
+
}, [
|
|
2217
|
+
isControlled,
|
|
2218
|
+
currentValue,
|
|
2219
|
+
onChange
|
|
2220
|
+
]);
|
|
2221
|
+
return [
|
|
2222
|
+
currentValue,
|
|
2223
|
+
setValue
|
|
2224
|
+
];
|
|
2225
|
+
}
|
|
2226
|
+
|
|
2432
2227
|
var defaultTranslations$7 = {
|
|
2433
2228
|
checkIconTitle: "Check",
|
|
2434
2229
|
};
|
package/dist/index.esm.js
CHANGED
|
@@ -1965,264 +1965,6 @@ var ImagePreview = function (_a) {
|
|
|
1965
1965
|
: undefined, role: isClickable ? "button" : undefined, tabIndex: isClickable ? 0 : undefined, "aria-label": isClickable ? t.clickableImageAriaLabel : undefined }), showRemoveButton && onRemove && (jsx("button", { type: "button", onClick: function () { return handleRemove(image.id || "", index); }, "aria-label": t.removeButtonAriaLabel, className: "\n\t\t\t\t\t\t\t\t\tabsolute -top-2 -right-2 \n\t\t\t\t\t\t\t\t\tp-1 rounded-full \n\t\t\t\t\t\t\t\t\tbg-danger-500 hover:bg-danger-600 \n\t\t\t\t\t\t\t\t\ttext-white \n\t\t\t\t\t\t\t\t\tcursor-pointer \n\t\t\t\t\t\t\t\t\ttransition-colors\n\t\t\t\t\t\t\t\t\tfocus:outline-none \n\t\t\t\t\t\t\t\t\tfocus:ring-2 \n\t\t\t\t\t\t\t\t\tfocus:ring-danger-400 \n\t\t\t\t\t\t\t\t\tfocus:ring-offset-2\n\t\t\t\t\t\t\t\t", children: jsx(IconComponent, { size: size === "micro" ? "sm" : "md", icon: "solar:trash-bin-minimalistic-outline" }) }))] }) }, image.id || index)); }) }));
|
|
1966
1966
|
};
|
|
1967
1967
|
|
|
1968
|
-
/*
|
|
1969
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
1970
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
1971
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
1972
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
1973
|
-
*
|
|
1974
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
1975
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
1976
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
1977
|
-
* governing permissions and limitations under the License.
|
|
1978
|
-
*/ function $7215afc6de606d6b$export$de79e2c695e052f3(element) {
|
|
1979
|
-
if ($7215afc6de606d6b$var$supportsPreventScroll()) element.focus({
|
|
1980
|
-
preventScroll: true
|
|
1981
|
-
});
|
|
1982
|
-
else {
|
|
1983
|
-
let scrollableElements = $7215afc6de606d6b$var$getScrollableElements(element);
|
|
1984
|
-
element.focus();
|
|
1985
|
-
$7215afc6de606d6b$var$restoreScrollPosition(scrollableElements);
|
|
1986
|
-
}
|
|
1987
|
-
}
|
|
1988
|
-
let $7215afc6de606d6b$var$supportsPreventScrollCached = null;
|
|
1989
|
-
function $7215afc6de606d6b$var$supportsPreventScroll() {
|
|
1990
|
-
if ($7215afc6de606d6b$var$supportsPreventScrollCached == null) {
|
|
1991
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = false;
|
|
1992
|
-
try {
|
|
1993
|
-
let focusElem = document.createElement('div');
|
|
1994
|
-
focusElem.focus({
|
|
1995
|
-
get preventScroll () {
|
|
1996
|
-
$7215afc6de606d6b$var$supportsPreventScrollCached = true;
|
|
1997
|
-
return true;
|
|
1998
|
-
}
|
|
1999
|
-
});
|
|
2000
|
-
} catch {
|
|
2001
|
-
// Ignore
|
|
2002
|
-
}
|
|
2003
|
-
}
|
|
2004
|
-
return $7215afc6de606d6b$var$supportsPreventScrollCached;
|
|
2005
|
-
}
|
|
2006
|
-
function $7215afc6de606d6b$var$getScrollableElements(element) {
|
|
2007
|
-
let parent = element.parentNode;
|
|
2008
|
-
let scrollableElements = [];
|
|
2009
|
-
let rootScrollingElement = document.scrollingElement || document.documentElement;
|
|
2010
|
-
while(parent instanceof HTMLElement && parent !== rootScrollingElement){
|
|
2011
|
-
if (parent.offsetHeight < parent.scrollHeight || parent.offsetWidth < parent.scrollWidth) scrollableElements.push({
|
|
2012
|
-
element: parent,
|
|
2013
|
-
scrollTop: parent.scrollTop,
|
|
2014
|
-
scrollLeft: parent.scrollLeft
|
|
2015
|
-
});
|
|
2016
|
-
parent = parent.parentNode;
|
|
2017
|
-
}
|
|
2018
|
-
if (rootScrollingElement instanceof HTMLElement) scrollableElements.push({
|
|
2019
|
-
element: rootScrollingElement,
|
|
2020
|
-
scrollTop: rootScrollingElement.scrollTop,
|
|
2021
|
-
scrollLeft: rootScrollingElement.scrollLeft
|
|
2022
|
-
});
|
|
2023
|
-
return scrollableElements;
|
|
2024
|
-
}
|
|
2025
|
-
function $7215afc6de606d6b$var$restoreScrollPosition(scrollableElements) {
|
|
2026
|
-
for (let { element: element, scrollTop: scrollTop, scrollLeft: scrollLeft } of scrollableElements){
|
|
2027
|
-
element.scrollTop = scrollTop;
|
|
2028
|
-
element.scrollLeft = scrollLeft;
|
|
2029
|
-
}
|
|
2030
|
-
}
|
|
2031
|
-
|
|
2032
|
-
/*
|
|
2033
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
2034
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2035
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2036
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2037
|
-
*
|
|
2038
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2039
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2040
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2041
|
-
* governing permissions and limitations under the License.
|
|
2042
|
-
*/ function $c87311424ea30a05$var$testUserAgent(re) {
|
|
2043
|
-
var _window_navigator_userAgentData;
|
|
2044
|
-
if (typeof window === 'undefined' || window.navigator == null) return false;
|
|
2045
|
-
return ((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.brands.some((brand)=>re.test(brand.brand))) || re.test(window.navigator.userAgent);
|
|
2046
|
-
}
|
|
2047
|
-
function $c87311424ea30a05$var$testPlatform(re) {
|
|
2048
|
-
var _window_navigator_userAgentData;
|
|
2049
|
-
return typeof window !== 'undefined' && window.navigator != null ? re.test(((_window_navigator_userAgentData = window.navigator['userAgentData']) === null || _window_navigator_userAgentData === void 0 ? void 0 : _window_navigator_userAgentData.platform) || window.navigator.platform) : false;
|
|
2050
|
-
}
|
|
2051
|
-
function $c87311424ea30a05$var$cached(fn) {
|
|
2052
|
-
if (process.env.NODE_ENV === 'test') return fn;
|
|
2053
|
-
let res = null;
|
|
2054
|
-
return ()=>{
|
|
2055
|
-
if (res == null) res = fn();
|
|
2056
|
-
return res;
|
|
2057
|
-
};
|
|
2058
|
-
}
|
|
2059
|
-
const $c87311424ea30a05$export$9ac100e40613ea10 = $c87311424ea30a05$var$cached(function() {
|
|
2060
|
-
return $c87311424ea30a05$var$testPlatform(/^Mac/i);
|
|
2061
|
-
});
|
|
2062
|
-
const $c87311424ea30a05$export$186c6964ca17d99 = $c87311424ea30a05$var$cached(function() {
|
|
2063
|
-
return $c87311424ea30a05$var$testPlatform(/^iPhone/i);
|
|
2064
|
-
});
|
|
2065
|
-
const $c87311424ea30a05$export$7bef049ce92e4224 = $c87311424ea30a05$var$cached(function() {
|
|
2066
|
-
return $c87311424ea30a05$var$testPlatform(/^iPad/i) || // iPadOS 13 lies and says it's a Mac, but we can distinguish by detecting touch support.
|
|
2067
|
-
$c87311424ea30a05$export$9ac100e40613ea10() && navigator.maxTouchPoints > 1;
|
|
2068
|
-
});
|
|
2069
|
-
const $c87311424ea30a05$export$fedb369cb70207f1 = $c87311424ea30a05$var$cached(function() {
|
|
2070
|
-
return $c87311424ea30a05$export$186c6964ca17d99() || $c87311424ea30a05$export$7bef049ce92e4224();
|
|
2071
|
-
});
|
|
2072
|
-
$c87311424ea30a05$var$cached(function() {
|
|
2073
|
-
return $c87311424ea30a05$export$9ac100e40613ea10() || $c87311424ea30a05$export$fedb369cb70207f1();
|
|
2074
|
-
});
|
|
2075
|
-
const $c87311424ea30a05$export$78551043582a6a98 = $c87311424ea30a05$var$cached(function() {
|
|
2076
|
-
return $c87311424ea30a05$var$testUserAgent(/AppleWebKit/i) && !$c87311424ea30a05$export$6446a186d09e379e();
|
|
2077
|
-
});
|
|
2078
|
-
const $c87311424ea30a05$export$6446a186d09e379e = $c87311424ea30a05$var$cached(function() {
|
|
2079
|
-
return $c87311424ea30a05$var$testUserAgent(/Chrome/i);
|
|
2080
|
-
});
|
|
2081
|
-
$c87311424ea30a05$var$cached(function() {
|
|
2082
|
-
return $c87311424ea30a05$var$testUserAgent(/Android/i);
|
|
2083
|
-
});
|
|
2084
|
-
const $c87311424ea30a05$export$b7d78993b74f766d = $c87311424ea30a05$var$cached(function() {
|
|
2085
|
-
return $c87311424ea30a05$var$testUserAgent(/Firefox/i);
|
|
2086
|
-
});
|
|
2087
|
-
|
|
2088
|
-
/*
|
|
2089
|
-
* Copyright 2023 Adobe. All rights reserved.
|
|
2090
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2091
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2092
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2093
|
-
*
|
|
2094
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2095
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2096
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2097
|
-
* governing permissions and limitations under the License.
|
|
2098
|
-
*/
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
const $ea8dcbcb9ea1b556$var$RouterContext = /*#__PURE__*/ (createContext)({
|
|
2102
|
-
isNative: true,
|
|
2103
|
-
open: $ea8dcbcb9ea1b556$var$openSyntheticLink,
|
|
2104
|
-
useHref: (href)=>href
|
|
2105
|
-
});
|
|
2106
|
-
function $ea8dcbcb9ea1b556$export$9a302a45f65d0572() {
|
|
2107
|
-
return (useContext)($ea8dcbcb9ea1b556$var$RouterContext);
|
|
2108
|
-
}
|
|
2109
|
-
function $ea8dcbcb9ea1b556$export$95185d699e05d4d7(target, modifiers, setOpening = true) {
|
|
2110
|
-
var _window_event_type, _window_event;
|
|
2111
|
-
let { metaKey: metaKey, ctrlKey: ctrlKey, altKey: altKey, shiftKey: shiftKey } = modifiers;
|
|
2112
|
-
// Firefox does not recognize keyboard events as a user action by default, and the popup blocker
|
|
2113
|
-
// will prevent links with target="_blank" from opening. However, it does allow the event if the
|
|
2114
|
-
// Command/Control key is held, which opens the link in a background tab. This seems like the best we can do.
|
|
2115
|
-
// See https://bugzilla.mozilla.org/show_bug.cgi?id=257870 and https://bugzilla.mozilla.org/show_bug.cgi?id=746640.
|
|
2116
|
-
if (($c87311424ea30a05$export$b7d78993b74f766d)() && ((_window_event = window.event) === null || _window_event === void 0 ? void 0 : (_window_event_type = _window_event.type) === null || _window_event_type === void 0 ? void 0 : _window_event_type.startsWith('key')) && target.target === '_blank') {
|
|
2117
|
-
if (($c87311424ea30a05$export$9ac100e40613ea10)()) metaKey = true;
|
|
2118
|
-
else ctrlKey = true;
|
|
2119
|
-
}
|
|
2120
|
-
// WebKit does not support firing click events with modifier keys, but does support keyboard events.
|
|
2121
|
-
// https://github.com/WebKit/WebKit/blob/c03d0ac6e6db178f90923a0a63080b5ca210d25f/Source/WebCore/html/HTMLAnchorElement.cpp#L184
|
|
2122
|
-
let event = ($c87311424ea30a05$export$78551043582a6a98)() && ($c87311424ea30a05$export$9ac100e40613ea10)() && !($c87311424ea30a05$export$7bef049ce92e4224)() && process.env.NODE_ENV !== 'test' ? new KeyboardEvent('keydown', {
|
|
2123
|
-
keyIdentifier: 'Enter',
|
|
2124
|
-
metaKey: metaKey,
|
|
2125
|
-
ctrlKey: ctrlKey,
|
|
2126
|
-
altKey: altKey,
|
|
2127
|
-
shiftKey: shiftKey
|
|
2128
|
-
}) : new MouseEvent('click', {
|
|
2129
|
-
metaKey: metaKey,
|
|
2130
|
-
ctrlKey: ctrlKey,
|
|
2131
|
-
altKey: altKey,
|
|
2132
|
-
shiftKey: shiftKey,
|
|
2133
|
-
bubbles: true,
|
|
2134
|
-
cancelable: true
|
|
2135
|
-
});
|
|
2136
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = setOpening;
|
|
2137
|
-
($7215afc6de606d6b$export$de79e2c695e052f3)(target);
|
|
2138
|
-
target.dispatchEvent(event);
|
|
2139
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
2140
|
-
}
|
|
2141
|
-
// https://github.com/parcel-bundler/parcel/issues/8724
|
|
2142
|
-
$ea8dcbcb9ea1b556$export$95185d699e05d4d7.isOpening = false;
|
|
2143
|
-
function $ea8dcbcb9ea1b556$var$getSyntheticLink(target, open) {
|
|
2144
|
-
if (target instanceof HTMLAnchorElement) open(target);
|
|
2145
|
-
else if (target.hasAttribute('data-href')) {
|
|
2146
|
-
let link = document.createElement('a');
|
|
2147
|
-
link.href = target.getAttribute('data-href');
|
|
2148
|
-
if (target.hasAttribute('data-target')) link.target = target.getAttribute('data-target');
|
|
2149
|
-
if (target.hasAttribute('data-rel')) link.rel = target.getAttribute('data-rel');
|
|
2150
|
-
if (target.hasAttribute('data-download')) link.download = target.getAttribute('data-download');
|
|
2151
|
-
if (target.hasAttribute('data-ping')) link.ping = target.getAttribute('data-ping');
|
|
2152
|
-
if (target.hasAttribute('data-referrer-policy')) link.referrerPolicy = target.getAttribute('data-referrer-policy');
|
|
2153
|
-
target.appendChild(link);
|
|
2154
|
-
open(link);
|
|
2155
|
-
target.removeChild(link);
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
function $ea8dcbcb9ea1b556$var$openSyntheticLink(target, modifiers) {
|
|
2159
|
-
$ea8dcbcb9ea1b556$var$getSyntheticLink(target, (link)=>$ea8dcbcb9ea1b556$export$95185d699e05d4d7(link, modifiers));
|
|
2160
|
-
}
|
|
2161
|
-
|
|
2162
|
-
/*
|
|
2163
|
-
* Copyright 2020 Adobe. All rights reserved.
|
|
2164
|
-
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2165
|
-
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2166
|
-
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2167
|
-
*
|
|
2168
|
-
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2169
|
-
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2170
|
-
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2171
|
-
* governing permissions and limitations under the License.
|
|
2172
|
-
*/
|
|
2173
|
-
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
2174
|
-
let [stateValue, setStateValue] = (useState)(value || defaultValue);
|
|
2175
|
-
let isControlledRef = (useRef)(value !== undefined);
|
|
2176
|
-
let isControlled = value !== undefined;
|
|
2177
|
-
(useEffect)(()=>{
|
|
2178
|
-
let wasControlled = isControlledRef.current;
|
|
2179
|
-
if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
|
|
2180
|
-
isControlledRef.current = isControlled;
|
|
2181
|
-
}, [
|
|
2182
|
-
isControlled
|
|
2183
|
-
]);
|
|
2184
|
-
let currentValue = isControlled ? value : stateValue;
|
|
2185
|
-
let setValue = (useCallback)((value, ...args)=>{
|
|
2186
|
-
let onChangeCaller = (value, ...onChangeArgs)=>{
|
|
2187
|
-
if (onChange) {
|
|
2188
|
-
if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
|
|
2189
|
-
}
|
|
2190
|
-
if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
|
|
2191
|
-
// calling setState multiple times with the same value only emits onChange once.
|
|
2192
|
-
// We do not use a ref for this because we specifically _do_ want the value to
|
|
2193
|
-
// reset every render, and assigning to a ref in render breaks aborted suspended renders.
|
|
2194
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2195
|
-
currentValue = value;
|
|
2196
|
-
};
|
|
2197
|
-
if (typeof value === 'function') {
|
|
2198
|
-
if (process.env.NODE_ENV !== 'production') console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
|
|
2199
|
-
// this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
|
|
2200
|
-
// when someone using useControlledState calls setControlledState(myFunc)
|
|
2201
|
-
// this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
|
|
2202
|
-
// if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
|
|
2203
|
-
// otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
|
|
2204
|
-
let updateFunction = (oldValue, ...functionArgs)=>{
|
|
2205
|
-
let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
2206
|
-
onChangeCaller(interceptedValue, ...args);
|
|
2207
|
-
if (!isControlled) return interceptedValue;
|
|
2208
|
-
return oldValue;
|
|
2209
|
-
};
|
|
2210
|
-
setStateValue(updateFunction);
|
|
2211
|
-
} else {
|
|
2212
|
-
if (!isControlled) setStateValue(value);
|
|
2213
|
-
onChangeCaller(value, ...args);
|
|
2214
|
-
}
|
|
2215
|
-
}, [
|
|
2216
|
-
isControlled,
|
|
2217
|
-
currentValue,
|
|
2218
|
-
onChange
|
|
2219
|
-
]);
|
|
2220
|
-
return [
|
|
2221
|
-
currentValue,
|
|
2222
|
-
setValue
|
|
2223
|
-
];
|
|
2224
|
-
}
|
|
2225
|
-
|
|
2226
1968
|
function normalizeClass(value) {
|
|
2227
1969
|
if (typeof value === "string") {
|
|
2228
1970
|
return value || undefined;
|
|
@@ -2280,37 +2022,25 @@ var EnumMenuNavListItem;
|
|
|
2280
2022
|
* @forwardRef
|
|
2281
2023
|
*/
|
|
2282
2024
|
var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
2283
|
-
var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey
|
|
2025
|
+
var items = _a.items, isCollapsed = _a.isCollapsed, defaultSelectedKey = _a.defaultSelectedKey; _a.onSelect; var hideEndContent = _a.hideEndContent, _b = _a.sectionClasses, sectionClassesProp = _b === void 0 ? {} : _b, _c = _a.itemClasses, itemClassesProp = _c === void 0 ? {} : _c, iconClassName = _a.iconClassName, classNames = _a.classNames, className = _a.className, props = __rest(_a, ["items", "isCollapsed", "defaultSelectedKey", "onSelect", "hideEndContent", "sectionClasses", "itemClasses", "iconClassName", "classNames", "className"]);
|
|
2284
2026
|
var _d = useState(defaultSelectedKey), selected = _d[0], setSelected = _d[1];
|
|
2285
|
-
var router = $ea8dcbcb9ea1b556$export$9a302a45f65d0572();
|
|
2286
2027
|
// Component styles
|
|
2287
2028
|
var sectionClasses = getSectionClasses(isCollapsed, sectionClassesProp);
|
|
2288
2029
|
var itemClasses = getItemClasses(isCollapsed, itemClassesProp);
|
|
2289
|
-
// Handles the click event on an item, updating the selection state
|
|
2030
|
+
// Handles the click event on an item, updating the selection state.
|
|
2290
2031
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
2291
2032
|
var handleItemPress = React.useCallback(function (item, parentKey) {
|
|
2292
2033
|
var keySelected = typeof parentKey === "string" ? parentKey : item.key;
|
|
2293
2034
|
setSelected(keySelected);
|
|
2294
|
-
onSelect === null || onSelect === void 0 ? void 0 : onSelect(keySelected);
|
|
2295
|
-
// Use the router provider for client-side navigation (avoids full page reload)
|
|
2296
|
-
if (item.href && item.href !== "#") {
|
|
2297
|
-
if (!router.isNative) {
|
|
2298
|
-
router.open(document.activeElement, new MouseEvent("click"), item.href);
|
|
2299
|
-
}
|
|
2300
|
-
else {
|
|
2301
|
-
window.location.href = item.href;
|
|
2302
|
-
}
|
|
2303
|
-
}
|
|
2304
2035
|
// Force blur to remove hover state after click.
|
|
2305
2036
|
if (document.activeElement instanceof HTMLElement) {
|
|
2306
2037
|
document.activeElement.blur();
|
|
2307
2038
|
}
|
|
2308
|
-
}, [setSelected
|
|
2039
|
+
}, [setSelected]);
|
|
2309
2040
|
// Renders the item displayed inside the Popover when the menu is collapsed.
|
|
2310
2041
|
var renderCompactItem = React.useCallback(function (item, parentKey) {
|
|
2311
2042
|
var _a, _b;
|
|
2312
|
-
item.
|
|
2313
|
-
return (createElement(ListboxItem, __assign({}, itemWithoutHref, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsx(IconComponent, { className: cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
|
|
2043
|
+
return (createElement(ListboxItem, __assign({}, item, { key: item.key, endContent: (_a = item.endContent) !== null && _a !== void 0 ? _a : null, startContent: item.icon ? (jsx(IconComponent, { className: cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_b = item.startContent) !== null && _b !== void 0 ? _b : null)), textValue: item.title, title: item.title, className: "data-[hover=true]:text-default-600", onPress: function () { return handleItemPress(item, parentKey); } })));
|
|
2314
2044
|
}, [handleItemPress, iconClassName]);
|
|
2315
2045
|
// Renders a nested item, i.e., an item that has sub-items.
|
|
2316
2046
|
// biome-ignore lint/correctness/useExhaustiveDependencies: <explanation>
|
|
@@ -2319,8 +2049,10 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2319
2049
|
var isNestType = item.items &&
|
|
2320
2050
|
((_a = item.items) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
2321
2051
|
(item === null || item === void 0 ? void 0 : item.type) === EnumMenuNavListItem.Nest;
|
|
2322
|
-
|
|
2323
|
-
|
|
2052
|
+
if (isNestType) {
|
|
2053
|
+
item.href = undefined;
|
|
2054
|
+
}
|
|
2055
|
+
return (createElement(ListboxItem, __assign({}, item, { key: item.key, classNames: {
|
|
2324
2056
|
base: cn({
|
|
2325
2057
|
"h-auto p-0": !isCollapsed && isNestType,
|
|
2326
2058
|
}, {
|
|
@@ -2357,8 +2089,7 @@ var MenuNavList = React.forwardRef(function (_a, ref) {
|
|
|
2357
2089
|
return renderNestItem(item);
|
|
2358
2090
|
}
|
|
2359
2091
|
var isItemSelected = selected === item.key;
|
|
2360
|
-
item.
|
|
2361
|
-
return (createElement(ListboxItem, __assign({}, itemWithoutHref, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsx(IconComponent, { className: cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsx(Tooltip$1, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
|
|
2092
|
+
return (createElement(ListboxItem, __assign({}, item, { key: item.key, endContent: isCollapsed || hideEndContent ? null : ((_b = item.endContent) !== null && _b !== void 0 ? _b : null), startContent: isCollapsed ? null : item.icon ? (jsx(IconComponent, { className: cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_c = item.startContent) !== null && _c !== void 0 ? _c : null)), textValue: item.title, title: isCollapsed ? null : item.title, onPress: function () { return handleItemPress(item, parentKey); }, "aria-selected": isItemSelected, "aria-label": item.title || "Menu item ".concat(item.key) }), isCollapsed ? (jsx(Tooltip$1, { content: item.title, placement: "right", closeDelay: 200, shouldCloseOnBlur: false, classNames: {
|
|
2362
2093
|
base: "text-default-500",
|
|
2363
2094
|
}, children: jsx("div", { className: "flex w-full items-center justify-center", "aria-hidden": "true", children: item.icon ? (jsx(IconComponent, { className: cn("text-default-500", "group-data-[selected=true]:text-default-600", iconClassName), icon: item.icon, size: "lg" })) : (((_d = item.startContent) !== null && _d !== void 0 ? _d : null)) }) })) : null));
|
|
2364
2095
|
},
|
|
@@ -2430,6 +2161,70 @@ var StepIndicator = function (_a) {
|
|
|
2430
2161
|
return (jsxs("div", __assign({ className: cn("w-full", className) }, props, { children: [showStepText && (jsx("div", { className: "text-center text-sm font-medium text-default-400 mb-3", children: stepText })), jsx("div", { className: "w-full bg-content2 rounded-full h-2 overflow-hidden", children: jsx("div", { className: cn("h-full transition-all duration-300 ease-out rounded-full", colorClasses[color]), style: { width: "".concat(progressPercentage, "%") } }) })] })));
|
|
2431
2162
|
};
|
|
2432
2163
|
|
|
2164
|
+
/*
|
|
2165
|
+
* Copyright 2020 Adobe. All rights reserved.
|
|
2166
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
2167
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
2168
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
2169
|
+
*
|
|
2170
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
2171
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
2172
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
2173
|
+
* governing permissions and limitations under the License.
|
|
2174
|
+
*/
|
|
2175
|
+
function $458b0a5536c1a7cf$export$40bfa8c7b0832715(value, defaultValue, onChange) {
|
|
2176
|
+
let [stateValue, setStateValue] = (useState)(value || defaultValue);
|
|
2177
|
+
let isControlledRef = (useRef)(value !== undefined);
|
|
2178
|
+
let isControlled = value !== undefined;
|
|
2179
|
+
(useEffect)(()=>{
|
|
2180
|
+
let wasControlled = isControlledRef.current;
|
|
2181
|
+
if (wasControlled !== isControlled && process.env.NODE_ENV !== 'production') console.warn(`WARN: A component changed from ${wasControlled ? 'controlled' : 'uncontrolled'} to ${isControlled ? 'controlled' : 'uncontrolled'}.`);
|
|
2182
|
+
isControlledRef.current = isControlled;
|
|
2183
|
+
}, [
|
|
2184
|
+
isControlled
|
|
2185
|
+
]);
|
|
2186
|
+
let currentValue = isControlled ? value : stateValue;
|
|
2187
|
+
let setValue = (useCallback)((value, ...args)=>{
|
|
2188
|
+
let onChangeCaller = (value, ...onChangeArgs)=>{
|
|
2189
|
+
if (onChange) {
|
|
2190
|
+
if (!Object.is(currentValue, value)) onChange(value, ...onChangeArgs);
|
|
2191
|
+
}
|
|
2192
|
+
if (!isControlled) // If uncontrolled, mutate the currentValue local variable so that
|
|
2193
|
+
// calling setState multiple times with the same value only emits onChange once.
|
|
2194
|
+
// We do not use a ref for this because we specifically _do_ want the value to
|
|
2195
|
+
// reset every render, and assigning to a ref in render breaks aborted suspended renders.
|
|
2196
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
2197
|
+
currentValue = value;
|
|
2198
|
+
};
|
|
2199
|
+
if (typeof value === 'function') {
|
|
2200
|
+
if (process.env.NODE_ENV !== 'production') console.warn('We can not support a function callback. See Github Issues for details https://github.com/adobe/react-spectrum/issues/2320');
|
|
2201
|
+
// this supports functional updates https://reactjs.org/docs/hooks-reference.html#functional-updates
|
|
2202
|
+
// when someone using useControlledState calls setControlledState(myFunc)
|
|
2203
|
+
// this will call our useState setState with a function as well which invokes myFunc and calls onChange with the value from myFunc
|
|
2204
|
+
// if we're in an uncontrolled state, then we also return the value of myFunc which to setState looks as though it was just called with myFunc from the beginning
|
|
2205
|
+
// otherwise we just return the controlled value, which won't cause a rerender because React knows to bail out when the value is the same
|
|
2206
|
+
let updateFunction = (oldValue, ...functionArgs)=>{
|
|
2207
|
+
let interceptedValue = value(isControlled ? currentValue : oldValue, ...functionArgs);
|
|
2208
|
+
onChangeCaller(interceptedValue, ...args);
|
|
2209
|
+
if (!isControlled) return interceptedValue;
|
|
2210
|
+
return oldValue;
|
|
2211
|
+
};
|
|
2212
|
+
setStateValue(updateFunction);
|
|
2213
|
+
} else {
|
|
2214
|
+
if (!isControlled) setStateValue(value);
|
|
2215
|
+
onChangeCaller(value, ...args);
|
|
2216
|
+
}
|
|
2217
|
+
}, [
|
|
2218
|
+
isControlled,
|
|
2219
|
+
currentValue,
|
|
2220
|
+
onChange
|
|
2221
|
+
]);
|
|
2222
|
+
return [
|
|
2223
|
+
currentValue,
|
|
2224
|
+
setValue
|
|
2225
|
+
];
|
|
2226
|
+
}
|
|
2227
|
+
|
|
2433
2228
|
var defaultTranslations$7 = {
|
|
2434
2229
|
checkIconTitle: "Check",
|
|
2435
2230
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MenuNavList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/_internal/menu-nav-list/MenuNavList.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"MenuNavList.d.ts","sourceRoot":"","sources":["../../../../../../src/components/menu/_internal/menu-nav-list/MenuNavList.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAGxC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,mGAuWvB,CAAC"}
|