@trafilea/afrodita-components 4.4.0-beta.4 → 4.4.0-beta.7
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/build/index.d.ts +8 -1
- package/build/index.esm.js +388 -2670
- package/build/index.esm.js.map +1 -1
- package/build/index.js +388 -2670
- package/build/index.js.map +1 -1
- package/build/theme/shapermint.theme.d.ts +6 -0
- package/build/theme/shapermint.theme.js +18 -4
- package/build/theme/truekind.theme.d.ts +6 -0
- package/build/theme/truekind.theme.js +18 -4
- package/package.json +2 -1
package/build/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs as jsxs$1, jsx as jsx$1, Fragment as Fragment$1 } from 'react/jsx-runtime';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import React__default, { forwardRef, useContext, createElement, createContext, Fragment as Fragment$2, useRef, useLayoutEffect, useMemo, useState, useEffect,
|
|
3
|
+
import React__default, { forwardRef, useContext, createElement, createContext, Fragment as Fragment$2, useRef, useLayoutEffect, useMemo, useState, useEffect, useCallback, useReducer, createRef, isValidElement, cloneElement } from 'react';
|
|
4
4
|
import { createPortal } from 'react-dom';
|
|
5
5
|
|
|
6
6
|
/*! *****************************************************************************
|
|
@@ -461,8 +461,8 @@ var Icon = {
|
|
|
461
461
|
SlideDots: SlideDots$1,
|
|
462
462
|
};
|
|
463
463
|
|
|
464
|
-
function _extends$
|
|
465
|
-
_extends$
|
|
464
|
+
function _extends$1() {
|
|
465
|
+
_extends$1 = Object.assign || function (target) {
|
|
466
466
|
for (var i = 1; i < arguments.length; i++) {
|
|
467
467
|
var source = arguments[i];
|
|
468
468
|
|
|
@@ -476,7 +476,7 @@ function _extends$2() {
|
|
|
476
476
|
return target;
|
|
477
477
|
};
|
|
478
478
|
|
|
479
|
-
return _extends$
|
|
479
|
+
return _extends$1.apply(this, arguments);
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
function memoize(fn) {
|
|
@@ -487,7 +487,7 @@ function memoize(fn) {
|
|
|
487
487
|
};
|
|
488
488
|
}
|
|
489
489
|
|
|
490
|
-
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
490
|
+
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
|
|
491
491
|
|
|
492
492
|
var isPropValid = /* #__PURE__ */memoize(function (prop) {
|
|
493
493
|
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
|
|
@@ -701,7 +701,7 @@ function trim (value) {
|
|
|
701
701
|
* @param {RegExp} pattern
|
|
702
702
|
* @return {string?}
|
|
703
703
|
*/
|
|
704
|
-
function match
|
|
704
|
+
function match (value, pattern) {
|
|
705
705
|
return (value = pattern.exec(value)) ? value[0] : value
|
|
706
706
|
}
|
|
707
707
|
|
|
@@ -1381,7 +1381,7 @@ function prefixer (element, index, children, callback) {
|
|
|
1381
1381
|
case RULESET:
|
|
1382
1382
|
if (element.length)
|
|
1383
1383
|
return combine(element.props, function (value) {
|
|
1384
|
-
switch (match
|
|
1384
|
+
switch (match(value, /(::plac\w+|:read-\w+)/)) {
|
|
1385
1385
|
// :read-(only|write)
|
|
1386
1386
|
case ':read-only': case ':read-write':
|
|
1387
1387
|
return serialize([copy(element, {props: [replace(value, /:(read-\w+)/, ':' + MOZ + '$1')]})], callback)
|
|
@@ -1819,12 +1819,12 @@ var reactIs_production_min = {};
|
|
|
1819
1819
|
* This source code is licensed under the MIT license found in the
|
|
1820
1820
|
* LICENSE file in the root directory of this source tree.
|
|
1821
1821
|
*/
|
|
1822
|
-
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
|
|
1823
|
-
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
1824
|
-
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
1825
|
-
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A;reactIs_production_min.isContextConsumer=function(a){return z(a)===k};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
1822
|
+
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k$1=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q$1=b?
|
|
1823
|
+
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w$1=b?Symbol.for("react.fundamental"):60117,x$1=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
|
|
1824
|
+
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k$1:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A$1(a){return z(a)===m}reactIs_production_min.AsyncMode=l;reactIs_production_min.ConcurrentMode=m;reactIs_production_min.ContextConsumer=k$1;reactIs_production_min.ContextProvider=h;reactIs_production_min.Element=c;reactIs_production_min.ForwardRef=n;reactIs_production_min.Fragment=e;reactIs_production_min.Lazy=t;reactIs_production_min.Memo=r;reactIs_production_min.Portal=d;
|
|
1825
|
+
reactIs_production_min.Profiler=g;reactIs_production_min.StrictMode=f;reactIs_production_min.Suspense=p;reactIs_production_min.isAsyncMode=function(a){return A$1(a)||z(a)===l};reactIs_production_min.isConcurrentMode=A$1;reactIs_production_min.isContextConsumer=function(a){return z(a)===k$1};reactIs_production_min.isContextProvider=function(a){return z(a)===h};reactIs_production_min.isElement=function(a){return "object"===typeof a&&null!==a&&a.$$typeof===c};reactIs_production_min.isForwardRef=function(a){return z(a)===n};reactIs_production_min.isFragment=function(a){return z(a)===e};reactIs_production_min.isLazy=function(a){return z(a)===t};
|
|
1826
1826
|
reactIs_production_min.isMemo=function(a){return z(a)===r};reactIs_production_min.isPortal=function(a){return z(a)===d};reactIs_production_min.isProfiler=function(a){return z(a)===g};reactIs_production_min.isStrictMode=function(a){return z(a)===f};reactIs_production_min.isSuspense=function(a){return z(a)===p};
|
|
1827
|
-
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
1827
|
+
reactIs_production_min.isValidElementType=function(a){return "string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q$1||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k$1||a.$$typeof===n||a.$$typeof===w$1||a.$$typeof===x$1||a.$$typeof===y||a.$$typeof===v)};reactIs_production_min.typeOf=z;
|
|
1828
1828
|
|
|
1829
1829
|
var reactIs_development = {};
|
|
1830
1830
|
|
|
@@ -2045,7 +2045,7 @@ function getRegisteredStyles(registered, registeredStyles, classNames) {
|
|
|
2045
2045
|
});
|
|
2046
2046
|
return rawClassName;
|
|
2047
2047
|
}
|
|
2048
|
-
var
|
|
2048
|
+
var registerStyles = function registerStyles(cache, serialized, isStringTag) {
|
|
2049
2049
|
var className = cache.key + "-" + serialized.name;
|
|
2050
2050
|
|
|
2051
2051
|
if ( // we only need to add the styles to the registered cache if the
|
|
@@ -2060,6 +2060,10 @@ var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
|
2060
2060
|
isBrowser$4 === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
|
|
2061
2061
|
cache.registered[className] = serialized.styles;
|
|
2062
2062
|
}
|
|
2063
|
+
};
|
|
2064
|
+
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
|
|
2065
|
+
registerStyles(cache, serialized, isStringTag);
|
|
2066
|
+
var className = cache.key + "-" + serialized.name;
|
|
2063
2067
|
|
|
2064
2068
|
if (cache.inserted[serialized.name] === undefined) {
|
|
2065
2069
|
var stylesForSSR = '';
|
|
@@ -2570,7 +2574,7 @@ var getTheme = function getTheme(outerTheme, theme) {
|
|
|
2570
2574
|
throw new Error('[ThemeProvider] Please make your theme prop a plain object');
|
|
2571
2575
|
}
|
|
2572
2576
|
|
|
2573
|
-
return _extends$
|
|
2577
|
+
return _extends$1({}, outerTheme, theme);
|
|
2574
2578
|
};
|
|
2575
2579
|
|
|
2576
2580
|
var createCacheWithTheme = /* #__PURE__ */weakMemoize(function (outerTheme) {
|
|
@@ -2590,19 +2594,20 @@ var ThemeProvider$1 = function ThemeProvider(props) {
|
|
|
2590
2594
|
}, props.children);
|
|
2591
2595
|
};
|
|
2592
2596
|
|
|
2597
|
+
var getLastPart = function getLastPart(functionName) {
|
|
2598
|
+
// The match may be something like 'Object.createEmotionProps' or
|
|
2599
|
+
// 'Loader.prototype.render'
|
|
2600
|
+
var parts = functionName.split('.');
|
|
2601
|
+
return parts[parts.length - 1];
|
|
2602
|
+
};
|
|
2603
|
+
|
|
2593
2604
|
var getFunctionNameFromStackTraceLine = function getFunctionNameFromStackTraceLine(line) {
|
|
2594
2605
|
// V8
|
|
2595
2606
|
var match = /^\s+at\s+([A-Za-z0-9$.]+)\s/.exec(line);
|
|
2596
|
-
|
|
2597
|
-
if (match) {
|
|
2598
|
-
// The match may be something like 'Object.createEmotionProps'
|
|
2599
|
-
var parts = match[1].split('.');
|
|
2600
|
-
return parts[parts.length - 1];
|
|
2601
|
-
} // Safari / Firefox
|
|
2602
|
-
|
|
2607
|
+
if (match) return getLastPart(match[1]); // Safari / Firefox
|
|
2603
2608
|
|
|
2604
2609
|
match = /^([A-Za-z0-9$.]+)@/.exec(line);
|
|
2605
|
-
if (match) return match[1];
|
|
2610
|
+
if (match) return getLastPart(match[1]);
|
|
2606
2611
|
return undefined;
|
|
2607
2612
|
};
|
|
2608
2613
|
|
|
@@ -2632,6 +2637,18 @@ var getLabelFromStackTrace = function getLabelFromStackTrace(stackTrace) {
|
|
|
2632
2637
|
return undefined;
|
|
2633
2638
|
};
|
|
2634
2639
|
|
|
2640
|
+
var isBrowser$1$2 = typeof document !== 'undefined';
|
|
2641
|
+
var useInsertionEffect$2 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
|
|
2642
|
+
create();
|
|
2643
|
+
};
|
|
2644
|
+
function useInsertionEffectMaybe$1(create) {
|
|
2645
|
+
if (!isBrowser$1$2) {
|
|
2646
|
+
return create();
|
|
2647
|
+
}
|
|
2648
|
+
|
|
2649
|
+
useInsertionEffect$2(create);
|
|
2650
|
+
}
|
|
2651
|
+
|
|
2635
2652
|
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
|
|
2636
2653
|
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
|
|
2637
2654
|
var createEmotionProps = function createEmotionProps(type, props) {
|
|
@@ -2659,7 +2676,31 @@ var createEmotionProps = function createEmotionProps(type, props) {
|
|
|
2659
2676
|
return newProps;
|
|
2660
2677
|
};
|
|
2661
2678
|
|
|
2662
|
-
var
|
|
2679
|
+
var Insertion$2 = function Insertion(_ref) {
|
|
2680
|
+
var cache = _ref.cache,
|
|
2681
|
+
serialized = _ref.serialized,
|
|
2682
|
+
isStringTag = _ref.isStringTag;
|
|
2683
|
+
registerStyles(cache, serialized, isStringTag);
|
|
2684
|
+
var rules = useInsertionEffectMaybe$1(function () {
|
|
2685
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
2686
|
+
});
|
|
2687
|
+
|
|
2688
|
+
if (!isBrowser$3 && rules !== undefined) {
|
|
2689
|
+
var _ref2;
|
|
2690
|
+
|
|
2691
|
+
var serializedNames = serialized.name;
|
|
2692
|
+
var next = serialized.next;
|
|
2693
|
+
|
|
2694
|
+
while (next !== undefined) {
|
|
2695
|
+
serializedNames += ' ' + next.name;
|
|
2696
|
+
next = next.next;
|
|
2697
|
+
}
|
|
2698
|
+
|
|
2699
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
2700
|
+
__html: rules
|
|
2701
|
+
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
2702
|
+
}
|
|
2703
|
+
|
|
2663
2704
|
return null;
|
|
2664
2705
|
};
|
|
2665
2706
|
|
|
@@ -2672,7 +2713,7 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2672
2713
|
cssProp = cache.registered[cssProp];
|
|
2673
2714
|
}
|
|
2674
2715
|
|
|
2675
|
-
var
|
|
2716
|
+
var WrappedComponent = props[typePropName];
|
|
2676
2717
|
var registeredStyles = [cssProp];
|
|
2677
2718
|
var className = '';
|
|
2678
2719
|
|
|
@@ -2692,7 +2733,6 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2692
2733
|
}
|
|
2693
2734
|
}
|
|
2694
2735
|
|
|
2695
|
-
var rules = insertStyles(cache, serialized, typeof type === 'string');
|
|
2696
2736
|
className += cache.key + "-" + serialized.name;
|
|
2697
2737
|
var newProps = {};
|
|
2698
2738
|
|
|
@@ -2704,27 +2744,11 @@ var Emotion = /* #__PURE__ */withEmotionCache(function (props, cache, ref) {
|
|
|
2704
2744
|
|
|
2705
2745
|
newProps.ref = ref;
|
|
2706
2746
|
newProps.className = className;
|
|
2707
|
-
|
|
2708
|
-
|
|
2709
|
-
|
|
2710
|
-
|
|
2711
|
-
|
|
2712
|
-
|
|
2713
|
-
var serializedNames = serialized.name;
|
|
2714
|
-
var next = serialized.next;
|
|
2715
|
-
|
|
2716
|
-
while (next !== undefined) {
|
|
2717
|
-
serializedNames += ' ' + next.name;
|
|
2718
|
-
next = next.next;
|
|
2719
|
-
}
|
|
2720
|
-
|
|
2721
|
-
possiblyStyleElement = /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + " " + serializedNames, _ref.dangerouslySetInnerHTML = {
|
|
2722
|
-
__html: rules
|
|
2723
|
-
}, _ref.nonce = cache.sheet.nonce, _ref));
|
|
2724
|
-
} // Need to return the same number of siblings or else `React.useId` will cause hydration mismatches.
|
|
2725
|
-
|
|
2726
|
-
|
|
2727
|
-
return /*#__PURE__*/createElement(Fragment$2, null, possiblyStyleElement, ele);
|
|
2747
|
+
return /*#__PURE__*/createElement(Fragment$2, null, /*#__PURE__*/createElement(Insertion$2, {
|
|
2748
|
+
cache: cache,
|
|
2749
|
+
serialized: serialized,
|
|
2750
|
+
isStringTag: typeof WrappedComponent === 'string'
|
|
2751
|
+
}), /*#__PURE__*/createElement(WrappedComponent, newProps));
|
|
2728
2752
|
});
|
|
2729
2753
|
|
|
2730
2754
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -2733,7 +2757,7 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
2733
2757
|
|
|
2734
2758
|
var pkg = {
|
|
2735
2759
|
name: "@emotion/react",
|
|
2736
|
-
version: "11.
|
|
2760
|
+
version: "11.8.1",
|
|
2737
2761
|
main: "dist/emotion-react.cjs.js",
|
|
2738
2762
|
module: "dist/emotion-react.esm.js",
|
|
2739
2763
|
browser: {
|
|
@@ -2753,17 +2777,18 @@ var pkg = {
|
|
|
2753
2777
|
"macro.js.flow"
|
|
2754
2778
|
],
|
|
2755
2779
|
sideEffects: false,
|
|
2756
|
-
author: "
|
|
2780
|
+
author: "Emotion Contributors",
|
|
2757
2781
|
license: "MIT",
|
|
2758
2782
|
scripts: {
|
|
2759
2783
|
"test:typescript": "dtslint types"
|
|
2760
2784
|
},
|
|
2761
2785
|
dependencies: {
|
|
2762
2786
|
"@babel/runtime": "^7.13.10",
|
|
2787
|
+
"@emotion/babel-plugin": "^11.7.1",
|
|
2763
2788
|
"@emotion/cache": "^11.7.1",
|
|
2764
2789
|
"@emotion/serialize": "^1.0.2",
|
|
2765
2790
|
"@emotion/sheet": "^1.1.0",
|
|
2766
|
-
"@emotion/utils": "^1.
|
|
2791
|
+
"@emotion/utils": "^1.1.0",
|
|
2767
2792
|
"@emotion/weak-memoize": "^0.2.5",
|
|
2768
2793
|
"hoist-non-react-statics": "^3.3.1"
|
|
2769
2794
|
},
|
|
@@ -2784,7 +2809,7 @@ var pkg = {
|
|
|
2784
2809
|
"@emotion/css": "11.7.1",
|
|
2785
2810
|
"@emotion/css-prettifier": "1.0.1",
|
|
2786
2811
|
"@emotion/server": "11.4.0",
|
|
2787
|
-
"@emotion/styled": "11.
|
|
2812
|
+
"@emotion/styled": "11.8.1",
|
|
2788
2813
|
"@types/react": "^16.9.11",
|
|
2789
2814
|
dtslint: "^0.3.0",
|
|
2790
2815
|
"html-tag-names": "^1.1.2",
|
|
@@ -2807,6 +2832,7 @@ var pkg = {
|
|
|
2807
2832
|
}
|
|
2808
2833
|
};
|
|
2809
2834
|
|
|
2835
|
+
var useInsertionEffect$1 = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : useLayoutEffect;
|
|
2810
2836
|
var warnedAboutCssPropForGlobal = false; // maintain place over rerenders.
|
|
2811
2837
|
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
|
|
2812
2838
|
// initial client-side render from SSR, use place of hydrating tag
|
|
@@ -2857,7 +2883,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
2857
2883
|
|
|
2858
2884
|
|
|
2859
2885
|
var sheetRef = useRef();
|
|
2860
|
-
|
|
2886
|
+
useInsertionEffect$1(function () {
|
|
2861
2887
|
var key = cache.key + "-global";
|
|
2862
2888
|
var sheet = new StyleSheet({
|
|
2863
2889
|
key: key,
|
|
@@ -2885,7 +2911,7 @@ var Global = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
2885
2911
|
sheet.flush();
|
|
2886
2912
|
};
|
|
2887
2913
|
}, [cache]);
|
|
2888
|
-
|
|
2914
|
+
useInsertionEffect$1(function () {
|
|
2889
2915
|
var sheetRefCurrent = sheetRef.current;
|
|
2890
2916
|
var sheet = sheetRefCurrent[0],
|
|
2891
2917
|
rehydrating = sheetRefCurrent[1];
|
|
@@ -2986,14 +3012,41 @@ function merge(registered, css, className) {
|
|
|
2986
3012
|
return rawClassName + css(registeredStyles);
|
|
2987
3013
|
}
|
|
2988
3014
|
|
|
2989
|
-
var
|
|
3015
|
+
var Insertion$1 = function Insertion(_ref) {
|
|
3016
|
+
var cache = _ref.cache,
|
|
3017
|
+
serializedArr = _ref.serializedArr;
|
|
3018
|
+
var rules = useInsertionEffectMaybe$1(function () {
|
|
3019
|
+
var rules = '';
|
|
3020
|
+
|
|
3021
|
+
for (var i = 0; i < serializedArr.length; i++) {
|
|
3022
|
+
var res = insertStyles(cache, serializedArr[i], false);
|
|
3023
|
+
|
|
3024
|
+
if (!isBrowser$3 && res !== undefined) {
|
|
3025
|
+
rules += res;
|
|
3026
|
+
}
|
|
3027
|
+
}
|
|
3028
|
+
|
|
3029
|
+
if (!isBrowser$3) {
|
|
3030
|
+
return rules;
|
|
3031
|
+
}
|
|
3032
|
+
});
|
|
3033
|
+
|
|
3034
|
+
if (!isBrowser$3 && rules.length !== 0) {
|
|
3035
|
+
var _ref2;
|
|
3036
|
+
|
|
3037
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedArr.map(function (serialized) {
|
|
3038
|
+
return serialized.name;
|
|
3039
|
+
}).join(' '), _ref2.dangerouslySetInnerHTML = {
|
|
3040
|
+
__html: rules
|
|
3041
|
+
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
3042
|
+
}
|
|
3043
|
+
|
|
2990
3044
|
return null;
|
|
2991
3045
|
};
|
|
2992
3046
|
|
|
2993
3047
|
var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
2994
|
-
var rules = '';
|
|
2995
|
-
var serializedHashes = '';
|
|
2996
3048
|
var hasRendered = false;
|
|
3049
|
+
var serializedArr = [];
|
|
2997
3050
|
|
|
2998
3051
|
var css = function css() {
|
|
2999
3052
|
if (hasRendered && process.env.NODE_ENV !== 'production') {
|
|
@@ -3005,21 +3058,9 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3005
3058
|
}
|
|
3006
3059
|
|
|
3007
3060
|
var serialized = serializeStyles(args, cache.registered);
|
|
3061
|
+
serializedArr.push(serialized); // registration has to happen here as the result of this might get consumed by `cx`
|
|
3008
3062
|
|
|
3009
|
-
|
|
3010
|
-
insertStyles(cache, serialized, false);
|
|
3011
|
-
} else {
|
|
3012
|
-
var res = insertStyles(cache, serialized, false);
|
|
3013
|
-
|
|
3014
|
-
if (res !== undefined) {
|
|
3015
|
-
rules += res;
|
|
3016
|
-
}
|
|
3017
|
-
}
|
|
3018
|
-
|
|
3019
|
-
if (!isBrowser$3) {
|
|
3020
|
-
serializedHashes += " " + serialized.name;
|
|
3021
|
-
}
|
|
3022
|
-
|
|
3063
|
+
registerStyles(cache, serialized, false);
|
|
3023
3064
|
return cache.key + "-" + serialized.name;
|
|
3024
3065
|
};
|
|
3025
3066
|
|
|
@@ -3042,18 +3083,10 @@ var ClassNames = /* #__PURE__ */withEmotionCache(function (props, cache) {
|
|
|
3042
3083
|
};
|
|
3043
3084
|
var ele = props.children(content);
|
|
3044
3085
|
hasRendered = true;
|
|
3045
|
-
|
|
3046
|
-
|
|
3047
|
-
|
|
3048
|
-
|
|
3049
|
-
|
|
3050
|
-
possiblyStyleElement = /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + " " + serializedHashes.substring(1), _ref.dangerouslySetInnerHTML = {
|
|
3051
|
-
__html: rules
|
|
3052
|
-
}, _ref.nonce = cache.sheet.nonce, _ref));
|
|
3053
|
-
} // Need to return the same number of siblings or else `React.useId` will cause hydration mismatches.
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
return /*#__PURE__*/createElement(Fragment$2, null, possiblyStyleElement, ele);
|
|
3086
|
+
return /*#__PURE__*/createElement(Fragment$2, null, /*#__PURE__*/createElement(Insertion$1, {
|
|
3087
|
+
cache: cache,
|
|
3088
|
+
serializedArr: serializedArr
|
|
3089
|
+
}), ele);
|
|
3057
3090
|
});
|
|
3058
3091
|
|
|
3059
3092
|
if (process.env.NODE_ENV !== 'production') {
|
|
@@ -3109,10 +3142,46 @@ var composeShouldForwardProps = function composeShouldForwardProps(tag, options,
|
|
|
3109
3142
|
return shouldForwardProp;
|
|
3110
3143
|
};
|
|
3111
3144
|
|
|
3112
|
-
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
|
|
3113
3145
|
var isBrowser$1 = typeof document !== 'undefined';
|
|
3146
|
+
var useInsertionEffect = React['useInsertion' + 'Effect'] ? React['useInsertion' + 'Effect'] : function useInsertionEffect(create) {
|
|
3147
|
+
create();
|
|
3148
|
+
};
|
|
3149
|
+
function useInsertionEffectMaybe(create) {
|
|
3150
|
+
if (!isBrowser$1) {
|
|
3151
|
+
return create();
|
|
3152
|
+
}
|
|
3153
|
+
|
|
3154
|
+
useInsertionEffect(create);
|
|
3155
|
+
}
|
|
3156
|
+
|
|
3157
|
+
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
|
|
3158
|
+
var isBrowser$1$1 = typeof document !== 'undefined';
|
|
3159
|
+
|
|
3160
|
+
var Insertion = function Insertion(_ref) {
|
|
3161
|
+
var cache = _ref.cache,
|
|
3162
|
+
serialized = _ref.serialized,
|
|
3163
|
+
isStringTag = _ref.isStringTag;
|
|
3164
|
+
registerStyles(cache, serialized, isStringTag);
|
|
3165
|
+
var rules = useInsertionEffectMaybe(function () {
|
|
3166
|
+
return insertStyles(cache, serialized, isStringTag);
|
|
3167
|
+
});
|
|
3168
|
+
|
|
3169
|
+
if (!isBrowser$1$1 && rules !== undefined) {
|
|
3170
|
+
var _ref2;
|
|
3171
|
+
|
|
3172
|
+
var serializedNames = serialized.name;
|
|
3173
|
+
var next = serialized.next;
|
|
3174
|
+
|
|
3175
|
+
while (next !== undefined) {
|
|
3176
|
+
serializedNames += ' ' + next.name;
|
|
3177
|
+
next = next.next;
|
|
3178
|
+
}
|
|
3179
|
+
|
|
3180
|
+
return /*#__PURE__*/createElement("style", (_ref2 = {}, _ref2["data-emotion"] = cache.key + " " + serializedNames, _ref2.dangerouslySetInnerHTML = {
|
|
3181
|
+
__html: rules
|
|
3182
|
+
}, _ref2.nonce = cache.sheet.nonce, _ref2));
|
|
3183
|
+
}
|
|
3114
3184
|
|
|
3115
|
-
var Noop = function Noop() {
|
|
3116
3185
|
return null;
|
|
3117
3186
|
};
|
|
3118
3187
|
|
|
@@ -3166,7 +3235,7 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3166
3235
|
|
|
3167
3236
|
|
|
3168
3237
|
var Styled = withEmotionCache(function (props, cache, ref) {
|
|
3169
|
-
var
|
|
3238
|
+
var FinalTag = shouldUseAs && props.as || baseTag;
|
|
3170
3239
|
var className = '';
|
|
3171
3240
|
var classInterpolations = [];
|
|
3172
3241
|
var mergedProps = props;
|
|
@@ -3188,14 +3257,13 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3188
3257
|
}
|
|
3189
3258
|
|
|
3190
3259
|
var serialized = serializeStyles(styles.concat(classInterpolations), cache.registered, mergedProps);
|
|
3191
|
-
var rules = insertStyles(cache, serialized, typeof finalTag === 'string');
|
|
3192
3260
|
className += cache.key + "-" + serialized.name;
|
|
3193
3261
|
|
|
3194
3262
|
if (targetClassName !== undefined) {
|
|
3195
3263
|
className += " " + targetClassName;
|
|
3196
3264
|
}
|
|
3197
3265
|
|
|
3198
|
-
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(
|
|
3266
|
+
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(FinalTag) : defaultShouldForwardProp;
|
|
3199
3267
|
var newProps = {};
|
|
3200
3268
|
|
|
3201
3269
|
for (var _key in props) {
|
|
@@ -3209,27 +3277,11 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3209
3277
|
|
|
3210
3278
|
newProps.className = className;
|
|
3211
3279
|
newProps.ref = ref;
|
|
3212
|
-
|
|
3213
|
-
|
|
3214
|
-
|
|
3215
|
-
|
|
3216
|
-
|
|
3217
|
-
|
|
3218
|
-
var serializedNames = serialized.name;
|
|
3219
|
-
var next = serialized.next;
|
|
3220
|
-
|
|
3221
|
-
while (next !== undefined) {
|
|
3222
|
-
serializedNames += ' ' + next.name;
|
|
3223
|
-
next = next.next;
|
|
3224
|
-
}
|
|
3225
|
-
|
|
3226
|
-
possiblyStyleElement = /*#__PURE__*/createElement("style", (_ref = {}, _ref["data-emotion"] = cache.key + " " + serializedNames, _ref.dangerouslySetInnerHTML = {
|
|
3227
|
-
__html: rules
|
|
3228
|
-
}, _ref.nonce = cache.sheet.nonce, _ref));
|
|
3229
|
-
} // Need to return the same number of siblings or else `React.useId` will cause hydration mismatches.
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
return /*#__PURE__*/createElement(Fragment$2, null, possiblyStyleElement, ele);
|
|
3280
|
+
return /*#__PURE__*/createElement(Fragment$2, null, /*#__PURE__*/createElement(Insertion, {
|
|
3281
|
+
cache: cache,
|
|
3282
|
+
serialized: serialized,
|
|
3283
|
+
isStringTag: typeof FinalTag === 'string'
|
|
3284
|
+
}), /*#__PURE__*/createElement(FinalTag, newProps));
|
|
3233
3285
|
});
|
|
3234
3286
|
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
|
|
3235
3287
|
Styled.defaultProps = tag.defaultProps;
|
|
@@ -3249,7 +3301,7 @@ var createStyled = function createStyled(tag, options) {
|
|
|
3249
3301
|
});
|
|
3250
3302
|
|
|
3251
3303
|
Styled.withComponent = function (nextTag, nextOptions) {
|
|
3252
|
-
return createStyled(nextTag, _extends$
|
|
3304
|
+
return createStyled(nextTag, _extends$1({}, options, nextOptions, {
|
|
3253
3305
|
shouldForwardProp: composeShouldForwardProps(Styled, nextOptions, true)
|
|
3254
3306
|
})).apply(void 0, styles);
|
|
3255
3307
|
};
|
|
@@ -3381,2580 +3433,241 @@ var stringify = function (variables) {
|
|
|
3381
3433
|
var key = _a[0], value = _a[1];
|
|
3382
3434
|
return "".concat(key, ": ").concat(value, ";");
|
|
3383
3435
|
})
|
|
3384
|
-
.join('\n'), "\n }\n "));
|
|
3385
|
-
};
|
|
3386
|
-
var transformThemeIntoVariables = function (_a) {
|
|
3387
|
-
// eslint-disable-next-line
|
|
3388
|
-
_a.name; var _b = _a.fonts, fonts = _b === void 0 ? { url: '', config: [] } : _b, theme = __rest(_a, ["name", "fonts"]);
|
|
3389
|
-
var variables = {};
|
|
3390
|
-
var pending = {};
|
|
3391
|
-
transformToVariables('-', variables, __assign({}, theme), pending);
|
|
3392
|
-
for (var key in pending) {
|
|
3393
|
-
var valueKey = pending[key];
|
|
3394
|
-
if (valueKey in variables === false) {
|
|
3395
|
-
delete variables[key];
|
|
3396
|
-
continue;
|
|
3397
|
-
}
|
|
3398
|
-
variables[key] = "var(".concat(valueKey, ")");
|
|
3399
|
-
}
|
|
3400
|
-
return stringify(variables) + transformFonts(fonts);
|
|
3401
|
-
};
|
|
3402
|
-
var transformFonts = function (fonts) {
|
|
3403
|
-
if (fonts.config.length === 0) {
|
|
3404
|
-
return '';
|
|
3405
|
-
}
|
|
3406
|
-
var css = fonts.config
|
|
3407
|
-
.map(function (font) {
|
|
3408
|
-
var css = [
|
|
3409
|
-
"font-family: \"".concat(font.family, "\""),
|
|
3410
|
-
"src: url(\"".concat(fonts.url, "/").concat(font.src, "\") format(\"opentype\")"),
|
|
3411
|
-
];
|
|
3412
|
-
if (font.weight) {
|
|
3413
|
-
css.push("font-weight: ".concat(font.weight));
|
|
3414
|
-
}
|
|
3415
|
-
if (font.stretch) {
|
|
3416
|
-
css.push("font-stretch: ".concat(font.stretch));
|
|
3417
|
-
}
|
|
3418
|
-
if (font.style) {
|
|
3419
|
-
css.push("font-style: ".concat(font.style));
|
|
3420
|
-
}
|
|
3421
|
-
return inline("@font-face { ".concat(css.join(';\n'), "; }"));
|
|
3422
|
-
})
|
|
3423
|
-
.join('\n');
|
|
3424
|
-
return inline("\n ".concat(css, "\n body {\n font-family: \"").concat(fonts.config[0].family, "\";\n }\n "));
|
|
3425
|
-
};
|
|
3426
|
-
var inline = function (text) {
|
|
3427
|
-
return text.trim().replace(/\s+/g, ' ').replace(/\n/g, '');
|
|
3428
|
-
};
|
|
3429
|
-
|
|
3430
|
-
var ThemeProvider = function (_a) {
|
|
3431
|
-
var theme = _a.theme, children = _a.children;
|
|
3432
|
-
var parsedTheme = useMemo(function () { return applyVariablesIntoTheme(theme); }, [theme]);
|
|
3433
|
-
return (jsx$1(ThemeProvider$1, __assign({ theme: parsedTheme }, { children: jsx$1(AssetsProvider, __assign({ assets: parsedTheme.assets }, { children: children }), void 0) }), void 0));
|
|
3434
|
-
};
|
|
3435
|
-
var useTheme = function () { return useTheme$1(); };
|
|
3436
|
-
var DefaultContainer = function (props) { return jsx$1("div", __assign({}, props), void 0); };
|
|
3437
|
-
var ThemeVariables = function (_a) {
|
|
3438
|
-
var _b;
|
|
3439
|
-
var theme = _a.theme, _c = _a.Container, Container = _c === void 0 ? DefaultContainer : _c;
|
|
3440
|
-
var _d = useState(function () { return transformThemeIntoVariables(theme); }), variables = _d[0], setVariables = _d[1];
|
|
3441
|
-
useEffect(function () {
|
|
3442
|
-
setVariables(transformThemeIntoVariables(theme));
|
|
3443
|
-
}, [theme]);
|
|
3444
|
-
return (jsx$1(Container, { children: jsx$1("style", { "data-theme-name": ((_b = theme.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || 'unamed-theme', dangerouslySetInnerHTML: { __html: variables } }, void 0) }, void 0));
|
|
3445
|
-
};
|
|
3446
|
-
var AssetsContext = createContext({
|
|
3447
|
-
images: {
|
|
3448
|
-
favicon: '',
|
|
3449
|
-
logo: '',
|
|
3450
|
-
},
|
|
3451
|
-
});
|
|
3452
|
-
var AssetsProvider = function (_a) {
|
|
3453
|
-
var assets = _a.assets, children = _a.children;
|
|
3454
|
-
var context = useMemo(function () { return assets; }, [assets]);
|
|
3455
|
-
return jsx$1(AssetsContext.Provider, __assign({ value: context }, { children: children }), void 0);
|
|
3456
|
-
};
|
|
3457
|
-
var useThemeAssets = function () { return useContext(AssetsContext); };
|
|
3458
|
-
|
|
3459
|
-
var Container$F = newStyled.div(templateObject_1$13 || (templateObject_1$13 = __makeTemplateObject(["\n ", "\n width: ", ";\n background: ", ";\n border-radius: ", ";\n border: ", ";\n"], ["\n ", "\n width: ", ";\n background: ", ";\n border-radius: ", ";\n border: ", ";\n"])), function (_a) {
|
|
3460
|
-
var flex = _a.flex;
|
|
3461
|
-
return flex &&
|
|
3462
|
-
"display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;";
|
|
3463
|
-
}, function (_a) {
|
|
3464
|
-
var widthAuto = _a.widthAuto;
|
|
3465
|
-
return (widthAuto ? 'auto' : 'fit-content');
|
|
3466
|
-
}, function (props) { return props.backgroundColor; }, function (props) { return props.theme.component.card.borderRadius; }, function (props) {
|
|
3467
|
-
return props.border ? "".concat(props.border.borderWidth, " solid ").concat(props.border.borderColor) : 'none';
|
|
3468
|
-
});
|
|
3469
|
-
var Card = function (_a) {
|
|
3470
|
-
var children = _a.children, backgroundColor = _a.backgroundColor, _b = _a.widthAuto, widthAuto = _b === void 0 ? true : _b, border = _a.border, _c = _a.flex, flex = _c === void 0 ? true : _c;
|
|
3471
|
-
var theme = useTheme();
|
|
3472
|
-
return (jsx$1(Container$F, __assign({ backgroundColor: backgroundColor, widthAuto: widthAuto, border: border, flex: flex, "data-testid": "CardContainer", theme: theme }, { children: children }), void 0));
|
|
3473
|
-
};
|
|
3474
|
-
var Card$1 = Object.assign(Card, {
|
|
3475
|
-
Header: CardHeader,
|
|
3476
|
-
Footer: CardFooter,
|
|
3477
|
-
Body: CardBody,
|
|
3478
|
-
});
|
|
3479
|
-
var templateObject_1$13;
|
|
3480
|
-
|
|
3481
|
-
var Fragment = Fragment$1;
|
|
3482
|
-
function jsx(type, props, key) {
|
|
3483
|
-
if (!hasOwnProperty$1.call(props, 'css')) {
|
|
3484
|
-
return jsx$1(type, props, key);
|
|
3485
|
-
}
|
|
3486
|
-
|
|
3487
|
-
return jsx$1(Emotion, createEmotionProps(type, props), key);
|
|
3488
|
-
}
|
|
3489
|
-
function jsxs(type, props, key) {
|
|
3490
|
-
if (!hasOwnProperty$1.call(props, 'css')) {
|
|
3491
|
-
return jsxs$1(type, props, key);
|
|
3492
|
-
}
|
|
3493
|
-
|
|
3494
|
-
return jsxs$1(Emotion, createEmotionProps(type, props), key);
|
|
3495
|
-
}
|
|
3496
|
-
|
|
3497
|
-
var BaseButton = function (_a) {
|
|
3498
|
-
var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className, inline = _a.inline, _c = _a.testId, testId = _c === void 0 ? 'base-button' : _c;
|
|
3499
|
-
return (jsxs("button", __assign({ onClick: onClick, disabled: disabled, className: className, type: type, "data-testid": testId, css: {
|
|
3500
|
-
display: inline ? 'inline-flex' : 'flex',
|
|
3501
|
-
justifyContent: 'center',
|
|
3502
|
-
alignItems: 'center',
|
|
3503
|
-
padding: '0.75rem 2rem',
|
|
3504
|
-
textDecoration: 'none',
|
|
3505
|
-
textTransform: 'uppercase',
|
|
3506
|
-
boxSizing: 'border-box',
|
|
3507
|
-
cursor: 'pointer',
|
|
3508
|
-
} }, { children: [renderLeading, children, renderTrailing] }), void 0));
|
|
3509
|
-
};
|
|
3510
|
-
|
|
3511
|
-
var getStylesBySize$9 = function (size, theme) {
|
|
3512
|
-
switch (size) {
|
|
3513
|
-
case ComponentSize.Large:
|
|
3514
|
-
return {
|
|
3515
|
-
fontSize: theme.component.button.size.large.fontSize,
|
|
3516
|
-
padding: theme.component.button.size.large.padding,
|
|
3517
|
-
};
|
|
3518
|
-
case ComponentSize.Medium:
|
|
3519
|
-
return {
|
|
3520
|
-
fontSize: theme.component.button.size.medium.fontSize,
|
|
3521
|
-
padding: theme.component.button.size.medium.padding,
|
|
3522
|
-
};
|
|
3523
|
-
case ComponentSize.Small:
|
|
3524
|
-
return {
|
|
3525
|
-
fontSize: theme.component.button.size.small.fontSize,
|
|
3526
|
-
padding: theme.component.button.size.small.padding,
|
|
3527
|
-
};
|
|
3528
|
-
default:
|
|
3529
|
-
return {
|
|
3530
|
-
fontSize: theme.component.button.size.small.fontSize,
|
|
3531
|
-
padding: theme.component.button.size.small.padding,
|
|
3532
|
-
};
|
|
3533
|
-
}
|
|
3534
|
-
};
|
|
3535
|
-
var BaseCTA = function (_a) {
|
|
3536
|
-
var text = _a.text, _b = _a.wide, wide = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, props = __rest(_a, ["text", "wide", "size"]);
|
|
3537
|
-
var theme = useTheme();
|
|
3538
|
-
var stylesBySize = getStylesBySize$9(size, theme);
|
|
3539
|
-
return (jsx(BaseButton, __assign({}, props, { css: __assign(__assign({ width: wide ? '100%' : 'fit-content' }, stylesBySize), { fontWeight: theme.component.button.fontWeight, borderRadius: "".concat(theme.component.button.borderRadius), cursor: 'pointer', '&:disabled': {
|
|
3540
|
-
backgroundColor: theme.colors.background.disabled,
|
|
3541
|
-
color: theme.colors.text.disabled,
|
|
3542
|
-
cursor: 'not-allowed',
|
|
3543
|
-
} }) }, { children: text }), void 0));
|
|
3544
|
-
};
|
|
3545
|
-
|
|
3546
|
-
var ButtonPrimary = function (_a) {
|
|
3547
|
-
_a.testId; var props = __rest(_a, ["testId"]);
|
|
3548
|
-
var theme = useTheme();
|
|
3549
|
-
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3550
|
-
backgroundColor: theme.component.button.primary.active.backgroundColor,
|
|
3551
|
-
color: theme.component.button.primary.active.color,
|
|
3552
|
-
border: theme.component.button.border,
|
|
3553
|
-
'&:hover': {
|
|
3554
|
-
backgroundColor: theme.component.button.primary.hover.backgroundColor,
|
|
3555
|
-
color: theme.component.button.primary.hover.color,
|
|
3556
|
-
},
|
|
3557
|
-
'&:disabled': {
|
|
3558
|
-
backgroundColor: theme.colors.background.disabled,
|
|
3559
|
-
color: theme.colors.text.disabled,
|
|
3560
|
-
},
|
|
3561
|
-
} }), void 0));
|
|
3562
|
-
};
|
|
3563
|
-
|
|
3564
|
-
var ButtonSecondary = function (props) {
|
|
3565
|
-
var theme = useTheme();
|
|
3566
|
-
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3567
|
-
backgroundColor: theme.component.button.secondary.active.backgroundColor,
|
|
3568
|
-
color: theme.component.button.secondary.active.color,
|
|
3569
|
-
border: theme.component.button.border,
|
|
3570
|
-
'&:hover': {
|
|
3571
|
-
backgroundColor: theme.component.button.secondary.hover.backgroundColor,
|
|
3572
|
-
},
|
|
3573
|
-
'&:disabled': {
|
|
3574
|
-
backgroundColor: theme.colors.shades['50'].color,
|
|
3575
|
-
color: theme.colors.shades['250'].color,
|
|
3576
|
-
},
|
|
3577
|
-
} }), void 0));
|
|
3578
|
-
};
|
|
3579
|
-
|
|
3580
|
-
var ButtonSecondaryOutline = function (props) {
|
|
3581
|
-
var theme = useTheme();
|
|
3582
|
-
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3583
|
-
backgroundColor: theme.component.button.secondary.active.color,
|
|
3584
|
-
color: theme.component.button.secondary.active.backgroundColor,
|
|
3585
|
-
border: "1px solid ".concat(theme.component.button.secondary.active.backgroundColor),
|
|
3586
|
-
'&:hover': {
|
|
3587
|
-
backgroundColor: theme.component.button.secondary.active.backgroundColor,
|
|
3588
|
-
color: theme.component.button.secondary.active.color,
|
|
3589
|
-
},
|
|
3590
|
-
'&:disabled': {
|
|
3591
|
-
backgroundColor: theme.colors.background.disabled,
|
|
3592
|
-
color: theme.colors.text.disabled,
|
|
3593
|
-
border: 'none',
|
|
3594
|
-
},
|
|
3595
|
-
} }), void 0));
|
|
3596
|
-
};
|
|
3597
|
-
|
|
3598
|
-
function _extends$1() {
|
|
3599
|
-
_extends$1 = Object.assign || function (target) {
|
|
3600
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
3601
|
-
var source = arguments[i];
|
|
3602
|
-
|
|
3603
|
-
for (var key in source) {
|
|
3604
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
3605
|
-
target[key] = source[key];
|
|
3606
|
-
}
|
|
3607
|
-
}
|
|
3608
|
-
}
|
|
3609
|
-
|
|
3610
|
-
return target;
|
|
3611
|
-
};
|
|
3612
|
-
|
|
3613
|
-
return _extends$1.apply(this, arguments);
|
|
3614
|
-
}
|
|
3615
|
-
|
|
3616
|
-
function _objectWithoutPropertiesLoose$1(source, excluded) {
|
|
3617
|
-
if (source == null) return {};
|
|
3618
|
-
var target = {};
|
|
3619
|
-
var sourceKeys = Object.keys(source);
|
|
3620
|
-
var key, i;
|
|
3621
|
-
|
|
3622
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
3623
|
-
key = sourceKeys[i];
|
|
3624
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
3625
|
-
target[key] = source[key];
|
|
3626
|
-
}
|
|
3627
|
-
|
|
3628
|
-
return target;
|
|
3629
|
-
}
|
|
3630
|
-
|
|
3631
|
-
function _unsupportedIterableToArray(o, minLen) {
|
|
3632
|
-
if (!o) return;
|
|
3633
|
-
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
3634
|
-
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
3635
|
-
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
3636
|
-
if (n === "Map" || n === "Set") return Array.from(o);
|
|
3637
|
-
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
3638
|
-
}
|
|
3639
|
-
|
|
3640
|
-
function _arrayLikeToArray(arr, len) {
|
|
3641
|
-
if (len == null || len > arr.length) len = arr.length;
|
|
3642
|
-
|
|
3643
|
-
for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
|
|
3644
|
-
|
|
3645
|
-
return arr2;
|
|
3646
|
-
}
|
|
3647
|
-
|
|
3648
|
-
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
|
|
3649
|
-
var it;
|
|
3650
|
-
|
|
3651
|
-
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
|
|
3652
|
-
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
|
|
3653
|
-
if (it) o = it;
|
|
3654
|
-
var i = 0;
|
|
3655
|
-
return function () {
|
|
3656
|
-
if (i >= o.length) return {
|
|
3657
|
-
done: true
|
|
3658
|
-
};
|
|
3659
|
-
return {
|
|
3660
|
-
done: false,
|
|
3661
|
-
value: o[i++]
|
|
3662
|
-
};
|
|
3663
|
-
};
|
|
3664
|
-
}
|
|
3665
|
-
|
|
3666
|
-
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
3667
|
-
}
|
|
3668
|
-
|
|
3669
|
-
it = o[Symbol.iterator]();
|
|
3670
|
-
return it.next.bind(it);
|
|
3671
|
-
}
|
|
3672
|
-
|
|
3673
|
-
function match(value, lookup) {
|
|
3674
|
-
if (value in lookup) {
|
|
3675
|
-
var returnValue = lookup[value];
|
|
3676
|
-
|
|
3677
|
-
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
|
|
3678
|
-
args[_key - 2] = arguments[_key];
|
|
3679
|
-
}
|
|
3680
|
-
|
|
3681
|
-
return typeof returnValue === 'function' ? returnValue.apply(void 0, args) : returnValue;
|
|
3682
|
-
}
|
|
3683
|
-
|
|
3684
|
-
var error = new Error("Tried to handle \"" + value + "\" but there is no handler defined. Only defined handlers are: " + Object.keys(lookup).map(function (key) {
|
|
3685
|
-
return "\"" + key + "\"";
|
|
3686
|
-
}).join(', ') + ".");
|
|
3687
|
-
if (Error.captureStackTrace) Error.captureStackTrace(error, match);
|
|
3688
|
-
throw error;
|
|
3689
|
-
}
|
|
3690
|
-
|
|
3691
|
-
var Features;
|
|
3692
|
-
|
|
3693
|
-
(function (Features) {
|
|
3694
|
-
/** No features at all */
|
|
3695
|
-
Features[Features["None"] = 0] = "None";
|
|
3696
|
-
/**
|
|
3697
|
-
* When used, this will allow us to use one of the render strategies.
|
|
3698
|
-
*
|
|
3699
|
-
* **The render strategies are:**
|
|
3700
|
-
* - **Unmount** _(Will unmount the component.)_
|
|
3701
|
-
* - **Hidden** _(Will hide the component using the [hidden] attribute.)_
|
|
3702
|
-
*/
|
|
3703
|
-
|
|
3704
|
-
Features[Features["RenderStrategy"] = 1] = "RenderStrategy";
|
|
3705
|
-
/**
|
|
3706
|
-
* When used, this will allow the user of our component to be in control. This can be used when
|
|
3707
|
-
* you want to transition based on some state.
|
|
3708
|
-
*/
|
|
3709
|
-
|
|
3710
|
-
Features[Features["Static"] = 2] = "Static";
|
|
3711
|
-
})(Features || (Features = {}));
|
|
3712
|
-
|
|
3713
|
-
var RenderStrategy;
|
|
3714
|
-
|
|
3715
|
-
(function (RenderStrategy) {
|
|
3716
|
-
RenderStrategy[RenderStrategy["Unmount"] = 0] = "Unmount";
|
|
3717
|
-
RenderStrategy[RenderStrategy["Hidden"] = 1] = "Hidden";
|
|
3718
|
-
})(RenderStrategy || (RenderStrategy = {}));
|
|
3719
|
-
|
|
3720
|
-
function render(_ref) {
|
|
3721
|
-
var props = _ref.props,
|
|
3722
|
-
slot = _ref.slot,
|
|
3723
|
-
defaultTag = _ref.defaultTag,
|
|
3724
|
-
features = _ref.features,
|
|
3725
|
-
_ref$visible = _ref.visible,
|
|
3726
|
-
visible = _ref$visible === void 0 ? true : _ref$visible,
|
|
3727
|
-
name = _ref.name;
|
|
3728
|
-
// Visible always render
|
|
3729
|
-
if (visible) return _render(props, slot, defaultTag, name);
|
|
3730
|
-
var featureFlags = features != null ? features : Features.None;
|
|
3731
|
-
|
|
3732
|
-
if (featureFlags & Features.Static) {
|
|
3733
|
-
var _props$static = props["static"],
|
|
3734
|
-
isStatic = _props$static === void 0 ? false : _props$static,
|
|
3735
|
-
rest = _objectWithoutPropertiesLoose$1(props, ["static"]); // When the `static` prop is passed as `true`, then the user is in control, thus we don't care about anything else
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
if (isStatic) return _render(rest, slot, defaultTag, name);
|
|
3739
|
-
}
|
|
3740
|
-
|
|
3741
|
-
if (featureFlags & Features.RenderStrategy) {
|
|
3742
|
-
var _match;
|
|
3743
|
-
|
|
3744
|
-
var _props$unmount = props.unmount,
|
|
3745
|
-
unmount = _props$unmount === void 0 ? true : _props$unmount,
|
|
3746
|
-
_rest = _objectWithoutPropertiesLoose$1(props, ["unmount"]);
|
|
3747
|
-
|
|
3748
|
-
var strategy = unmount ? RenderStrategy.Unmount : RenderStrategy.Hidden;
|
|
3749
|
-
return match(strategy, (_match = {}, _match[RenderStrategy.Unmount] = function () {
|
|
3750
|
-
return null;
|
|
3751
|
-
}, _match[RenderStrategy.Hidden] = function () {
|
|
3752
|
-
return _render(_extends$1({}, _rest, {
|
|
3753
|
-
hidden: true,
|
|
3754
|
-
style: {
|
|
3755
|
-
display: 'none'
|
|
3756
|
-
}
|
|
3757
|
-
}), slot, defaultTag, name);
|
|
3758
|
-
}, _match));
|
|
3759
|
-
} // No features enabled, just render
|
|
3760
|
-
|
|
3761
|
-
|
|
3762
|
-
return _render(props, slot, defaultTag, name);
|
|
3763
|
-
}
|
|
3764
|
-
|
|
3765
|
-
function _render(props, slot, tag, name) {
|
|
3766
|
-
var _ref2;
|
|
3767
|
-
|
|
3768
|
-
if (slot === void 0) {
|
|
3769
|
-
slot = {};
|
|
3770
|
-
}
|
|
3771
|
-
|
|
3772
|
-
var _omit = omit(props, ['unmount', 'static']),
|
|
3773
|
-
_omit$as = _omit.as,
|
|
3774
|
-
Component = _omit$as === void 0 ? tag : _omit$as,
|
|
3775
|
-
children = _omit.children,
|
|
3776
|
-
_omit$refName = _omit.refName,
|
|
3777
|
-
refName = _omit$refName === void 0 ? 'ref' : _omit$refName,
|
|
3778
|
-
passThroughProps = _objectWithoutPropertiesLoose$1(_omit, ["as", "children", "refName"]); // This allows us to use `<HeadlessUIComponent as={MyComponent} refName="innerRef" />`
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
var refRelatedProps = props.ref !== undefined ? (_ref2 = {}, _ref2[refName] = props.ref, _ref2) : {};
|
|
3782
|
-
var resolvedChildren = typeof children === 'function' ? children(slot) : children; // Allow for className to be a function with the slot as the contents
|
|
3783
|
-
|
|
3784
|
-
if (passThroughProps.className && typeof passThroughProps.className === 'function') {
|
|
3785
|
-
passThroughProps.className = passThroughProps.className(slot);
|
|
3786
|
-
}
|
|
3787
|
-
|
|
3788
|
-
if (Component === Fragment$2) {
|
|
3789
|
-
if (Object.keys(passThroughProps).length > 0) {
|
|
3790
|
-
if (!isValidElement(resolvedChildren) || Array.isArray(resolvedChildren) && resolvedChildren.length > 1) {
|
|
3791
|
-
throw new Error(['Passing props on "Fragment"!', '', "The current component <" + name + " /> is rendering a \"Fragment\".", "However we need to passthrough the following props:", Object.keys(passThroughProps).map(function (line) {
|
|
3792
|
-
return " - " + line;
|
|
3793
|
-
}).join('\n'), '', 'You can apply a few solutions:', ['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".', 'Render a single element as the child so that we can forward the props onto that element.'].map(function (line) {
|
|
3794
|
-
return " - " + line;
|
|
3795
|
-
}).join('\n')].join('\n'));
|
|
3796
|
-
}
|
|
3797
|
-
|
|
3798
|
-
return cloneElement(resolvedChildren, Object.assign({}, // Filter out undefined values so that they don't override the existing values
|
|
3799
|
-
mergeEventFunctions(compact(omit(passThroughProps, ['ref'])), resolvedChildren.props, ['onClick']), refRelatedProps));
|
|
3800
|
-
}
|
|
3801
|
-
}
|
|
3802
|
-
|
|
3803
|
-
return createElement(Component, Object.assign({}, omit(passThroughProps, ['ref']), Component !== Fragment$2 && refRelatedProps), resolvedChildren);
|
|
3804
|
-
}
|
|
3805
|
-
/**
|
|
3806
|
-
* We can use this function for the following useCase:
|
|
3807
|
-
*
|
|
3808
|
-
* <Menu.Item> <button onClick={console.log} /> </Menu.Item>
|
|
3809
|
-
*
|
|
3810
|
-
* Our `Menu.Item` will have an internal `onClick`, if you passthrough an `onClick` to the actual
|
|
3811
|
-
* `Menu.Item` component we will call it correctly. However, when we have an `onClick` on the actual
|
|
3812
|
-
* first child, that one should _also_ be called (but before this implementation, it was just
|
|
3813
|
-
* overriding the `onClick`). But it is only when we *render* that we have access to the existing
|
|
3814
|
-
* props of this component.
|
|
3815
|
-
*
|
|
3816
|
-
* It's a bit hacky, and not that clean, but it is something internal and we have tests to rely on
|
|
3817
|
-
* so that we can refactor this later (if needed).
|
|
3818
|
-
*/
|
|
3819
|
-
|
|
3820
|
-
|
|
3821
|
-
function mergeEventFunctions(passThroughProps, existingProps, functionsToMerge) {
|
|
3822
|
-
var clone = Object.assign({}, passThroughProps);
|
|
3823
|
-
|
|
3824
|
-
var _loop = function _loop() {
|
|
3825
|
-
var func = _step.value;
|
|
3826
|
-
|
|
3827
|
-
if (passThroughProps[func] !== undefined && existingProps[func] !== undefined) {
|
|
3828
|
-
var _Object$assign;
|
|
3829
|
-
|
|
3830
|
-
Object.assign(clone, (_Object$assign = {}, _Object$assign[func] = function (event) {
|
|
3831
|
-
// Props we control
|
|
3832
|
-
if (!event.defaultPrevented) passThroughProps[func](event); // Existing props on the component
|
|
3833
|
-
|
|
3834
|
-
if (!event.defaultPrevented) existingProps[func](event);
|
|
3835
|
-
}, _Object$assign));
|
|
3836
|
-
}
|
|
3837
|
-
};
|
|
3838
|
-
|
|
3839
|
-
for (var _iterator = _createForOfIteratorHelperLoose(functionsToMerge), _step; !(_step = _iterator()).done;) {
|
|
3840
|
-
_loop();
|
|
3841
|
-
}
|
|
3842
|
-
|
|
3843
|
-
return clone;
|
|
3844
|
-
}
|
|
3845
|
-
/**
|
|
3846
|
-
* This is a hack, but basically we want to keep the full 'API' of the component, but we do want to
|
|
3847
|
-
* wrap it in a forwardRef so that we _can_ passthrough the ref
|
|
3848
|
-
*/
|
|
3849
|
-
|
|
3850
|
-
|
|
3851
|
-
function forwardRefWithAs(component) {
|
|
3852
|
-
var _component$displayNam;
|
|
3853
|
-
|
|
3854
|
-
return Object.assign(forwardRef(component), {
|
|
3855
|
-
displayName: (_component$displayNam = component.displayName) != null ? _component$displayNam : component.name
|
|
3856
|
-
});
|
|
3857
|
-
}
|
|
3858
|
-
|
|
3859
|
-
function compact(object) {
|
|
3860
|
-
var clone = Object.assign({}, object);
|
|
3861
|
-
|
|
3862
|
-
for (var key in clone) {
|
|
3863
|
-
if (clone[key] === undefined) delete clone[key];
|
|
3864
|
-
}
|
|
3865
|
-
|
|
3866
|
-
return clone;
|
|
3867
|
-
}
|
|
3868
|
-
|
|
3869
|
-
function omit(object, keysToOmit) {
|
|
3870
|
-
if (keysToOmit === void 0) {
|
|
3871
|
-
keysToOmit = [];
|
|
3872
|
-
}
|
|
3873
|
-
|
|
3874
|
-
var clone = Object.assign({}, object);
|
|
3875
|
-
|
|
3876
|
-
for (var _iterator2 = _createForOfIteratorHelperLoose(keysToOmit), _step2; !(_step2 = _iterator2()).done;) {
|
|
3877
|
-
var key = _step2.value;
|
|
3878
|
-
if (key in clone) delete clone[key];
|
|
3879
|
-
}
|
|
3880
|
-
|
|
3881
|
-
return clone;
|
|
3882
|
-
}
|
|
3883
|
-
|
|
3884
|
-
var useIsoMorphicEffect = typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
3885
|
-
|
|
3886
|
-
var state = {
|
|
3887
|
-
serverHandoffComplete: false
|
|
3888
|
-
};
|
|
3889
|
-
function useServerHandoffComplete() {
|
|
3890
|
-
var _useState = useState(state.serverHandoffComplete),
|
|
3891
|
-
serverHandoffComplete = _useState[0],
|
|
3892
|
-
setServerHandoffComplete = _useState[1];
|
|
3893
|
-
|
|
3894
|
-
useEffect(function () {
|
|
3895
|
-
if (serverHandoffComplete === true) return;
|
|
3896
|
-
setServerHandoffComplete(true);
|
|
3897
|
-
}, [serverHandoffComplete]);
|
|
3898
|
-
useEffect(function () {
|
|
3899
|
-
if (state.serverHandoffComplete === false) state.serverHandoffComplete = true;
|
|
3900
|
-
}, []);
|
|
3901
|
-
return serverHandoffComplete;
|
|
3902
|
-
}
|
|
3903
|
-
|
|
3904
|
-
function useSyncRefs() {
|
|
3905
|
-
for (var _len = arguments.length, refs = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3906
|
-
refs[_key] = arguments[_key];
|
|
3907
|
-
}
|
|
3908
|
-
|
|
3909
|
-
var cache = useRef(refs);
|
|
3910
|
-
useEffect(function () {
|
|
3911
|
-
cache.current = refs;
|
|
3912
|
-
}, [refs]);
|
|
3913
|
-
return useCallback(function (value) {
|
|
3914
|
-
for (var _iterator = _createForOfIteratorHelperLoose(cache.current), _step; !(_step = _iterator()).done;) {
|
|
3915
|
-
var ref = _step.value;
|
|
3916
|
-
if (ref == null) continue;
|
|
3917
|
-
if (typeof ref === 'function') ref(value);else ref.current = value;
|
|
3918
|
-
}
|
|
3919
|
-
}, [cache]);
|
|
3920
|
-
}
|
|
3921
|
-
|
|
3922
|
-
// TODO: This must already exist somewhere, right? 🤔
|
|
3923
|
-
// Ref: https://www.w3.org/TR/uievents-key/#named-key-attribute-values
|
|
3924
|
-
var Keys;
|
|
3925
|
-
|
|
3926
|
-
(function (Keys) {
|
|
3927
|
-
Keys["Space"] = " ";
|
|
3928
|
-
Keys["Enter"] = "Enter";
|
|
3929
|
-
Keys["Escape"] = "Escape";
|
|
3930
|
-
Keys["Backspace"] = "Backspace";
|
|
3931
|
-
Keys["ArrowLeft"] = "ArrowLeft";
|
|
3932
|
-
Keys["ArrowUp"] = "ArrowUp";
|
|
3933
|
-
Keys["ArrowRight"] = "ArrowRight";
|
|
3934
|
-
Keys["ArrowDown"] = "ArrowDown";
|
|
3935
|
-
Keys["Home"] = "Home";
|
|
3936
|
-
Keys["End"] = "End";
|
|
3937
|
-
Keys["PageUp"] = "PageUp";
|
|
3938
|
-
Keys["PageDown"] = "PageDown";
|
|
3939
|
-
Keys["Tab"] = "Tab";
|
|
3940
|
-
})(Keys || (Keys = {}));
|
|
3941
|
-
|
|
3942
|
-
// See: https://github.com/facebook/react/issues/7711
|
|
3943
|
-
// See: https://github.com/facebook/react/pull/20612
|
|
3944
|
-
// See: https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#concept-fe-disabled (2.)
|
|
3945
|
-
function isDisabledReactIssue7711(element) {
|
|
3946
|
-
var _ref, _parent;
|
|
3947
|
-
|
|
3948
|
-
var parent = element.parentElement;
|
|
3949
|
-
var legend = null;
|
|
3950
|
-
|
|
3951
|
-
while (parent && !(parent instanceof HTMLFieldSetElement)) {
|
|
3952
|
-
if (parent instanceof HTMLLegendElement) legend = parent;
|
|
3953
|
-
parent = parent.parentElement;
|
|
3954
|
-
}
|
|
3955
|
-
|
|
3956
|
-
var isParentDisabled = (_ref = ((_parent = parent) == null ? void 0 : _parent.getAttribute('disabled')) === '') != null ? _ref : false;
|
|
3957
|
-
if (isParentDisabled && isFirstLegend(legend)) return false;
|
|
3958
|
-
return isParentDisabled;
|
|
3959
|
-
}
|
|
3960
|
-
|
|
3961
|
-
function isFirstLegend(element) {
|
|
3962
|
-
if (!element) return false;
|
|
3963
|
-
var previous = element.previousElementSibling;
|
|
3964
|
-
|
|
3965
|
-
while (previous !== null) {
|
|
3966
|
-
if (previous instanceof HTMLLegendElement) return false;
|
|
3967
|
-
previous = previous.previousElementSibling;
|
|
3968
|
-
}
|
|
3969
|
-
|
|
3970
|
-
return true;
|
|
3971
|
-
}
|
|
3972
|
-
|
|
3973
|
-
// didn't take care of the Suspense case. To fix this we used the approach the @reach-ui/auto-id
|
|
3974
|
-
// uses.
|
|
3975
|
-
//
|
|
3976
|
-
// Credits: https://github.com/reach/reach-ui/blob/develop/packages/auto-id/src/index.tsx
|
|
3977
|
-
|
|
3978
|
-
var id = 0;
|
|
3979
|
-
|
|
3980
|
-
function generateId() {
|
|
3981
|
-
return ++id;
|
|
3982
|
-
}
|
|
3983
|
-
|
|
3984
|
-
function useId() {
|
|
3985
|
-
var ready = useServerHandoffComplete();
|
|
3986
|
-
|
|
3987
|
-
var _useState = useState(ready ? generateId : null),
|
|
3988
|
-
id = _useState[0],
|
|
3989
|
-
setId = _useState[1];
|
|
3990
|
-
|
|
3991
|
-
useIsoMorphicEffect(function () {
|
|
3992
|
-
if (id === null) setId(generateId());
|
|
3993
|
-
}, [id]);
|
|
3994
|
-
return id != null ? '' + id : undefined;
|
|
3995
|
-
}
|
|
3996
|
-
|
|
3997
|
-
function useWindowEvent(type, listener, options) {
|
|
3998
|
-
var listenerRef = useRef(listener);
|
|
3999
|
-
listenerRef.current = listener;
|
|
4000
|
-
useEffect(function () {
|
|
4001
|
-
function handler(event) {
|
|
4002
|
-
listenerRef.current.call(window, event);
|
|
4003
|
-
}
|
|
4004
|
-
|
|
4005
|
-
window.addEventListener(type, handler, options);
|
|
4006
|
-
return function () {
|
|
4007
|
-
return window.removeEventListener(type, handler, options);
|
|
4008
|
-
};
|
|
4009
|
-
}, [type, options]);
|
|
4010
|
-
}
|
|
4011
|
-
|
|
4012
|
-
// - https://stackoverflow.com/a/30753870
|
|
4013
|
-
|
|
4014
|
-
var focusableSelector = /*#__PURE__*/['[contentEditable=true]', '[tabindex]', 'a[href]', 'area[href]', 'button:not([disabled])', 'iframe', 'input:not([disabled])', 'select:not([disabled])', 'textarea:not([disabled])'].map(process.env.NODE_ENV === 'test' ? // TODO: Remove this once JSDOM fixes the issue where an element that is
|
|
4015
|
-
// "hidden" can be the document.activeElement, because this is not possible
|
|
4016
|
-
// in real browsers.
|
|
4017
|
-
// TODO: Remove this once JSDOM fixes the issue where an element that is
|
|
4018
|
-
function (selector) {
|
|
4019
|
-
return selector + ":not([tabindex='-1']):not([style*='display: none'])";
|
|
4020
|
-
} : function (selector) {
|
|
4021
|
-
return selector + ":not([tabindex='-1'])";
|
|
4022
|
-
}).join(',');
|
|
4023
|
-
var Focus$1;
|
|
4024
|
-
|
|
4025
|
-
(function (Focus) {
|
|
4026
|
-
/** Focus the first non-disabled element */
|
|
4027
|
-
Focus[Focus["First"] = 1] = "First";
|
|
4028
|
-
/** Focus the previous non-disabled element */
|
|
4029
|
-
|
|
4030
|
-
Focus[Focus["Previous"] = 2] = "Previous";
|
|
4031
|
-
/** Focus the next non-disabled element */
|
|
4032
|
-
|
|
4033
|
-
Focus[Focus["Next"] = 4] = "Next";
|
|
4034
|
-
/** Focus the last non-disabled element */
|
|
4035
|
-
|
|
4036
|
-
Focus[Focus["Last"] = 8] = "Last";
|
|
4037
|
-
/** Wrap tab around */
|
|
4038
|
-
|
|
4039
|
-
Focus[Focus["WrapAround"] = 16] = "WrapAround";
|
|
4040
|
-
/** Prevent scrolling the focusable elements into view */
|
|
4041
|
-
|
|
4042
|
-
Focus[Focus["NoScroll"] = 32] = "NoScroll";
|
|
4043
|
-
})(Focus$1 || (Focus$1 = {}));
|
|
4044
|
-
|
|
4045
|
-
var FocusResult;
|
|
4046
|
-
|
|
4047
|
-
(function (FocusResult) {
|
|
4048
|
-
/** Something went wrong while trying to focus. */
|
|
4049
|
-
FocusResult[FocusResult["Error"] = 0] = "Error";
|
|
4050
|
-
/** When `Focus.WrapAround` is enabled, going from position `N` to `N+1` where `N` is the last index in the array, then we overflow. */
|
|
4051
|
-
|
|
4052
|
-
FocusResult[FocusResult["Overflow"] = 1] = "Overflow";
|
|
4053
|
-
/** Focus was successful. */
|
|
4054
|
-
|
|
4055
|
-
FocusResult[FocusResult["Success"] = 2] = "Success";
|
|
4056
|
-
/** When `Focus.WrapAround` is enabled, going from position `N` to `N-1` where `N` is the first index in the array, then we underflow. */
|
|
4057
|
-
|
|
4058
|
-
FocusResult[FocusResult["Underflow"] = 3] = "Underflow";
|
|
4059
|
-
})(FocusResult || (FocusResult = {}));
|
|
4060
|
-
|
|
4061
|
-
var Direction$1;
|
|
4062
|
-
|
|
4063
|
-
(function (Direction) {
|
|
4064
|
-
Direction[Direction["Previous"] = -1] = "Previous";
|
|
4065
|
-
Direction[Direction["Next"] = 1] = "Next";
|
|
4066
|
-
})(Direction$1 || (Direction$1 = {}));
|
|
4067
|
-
|
|
4068
|
-
function getFocusableElements(container) {
|
|
4069
|
-
if (container === void 0) {
|
|
4070
|
-
container = document.body;
|
|
4071
|
-
}
|
|
4072
|
-
|
|
4073
|
-
if (container == null) return [];
|
|
4074
|
-
return Array.from(container.querySelectorAll(focusableSelector));
|
|
4075
|
-
}
|
|
4076
|
-
var FocusableMode;
|
|
4077
|
-
|
|
4078
|
-
(function (FocusableMode) {
|
|
4079
|
-
/** The element itself must be focusable. */
|
|
4080
|
-
FocusableMode[FocusableMode["Strict"] = 0] = "Strict";
|
|
4081
|
-
/** The element should be inside of a focusable element. */
|
|
4082
|
-
|
|
4083
|
-
FocusableMode[FocusableMode["Loose"] = 1] = "Loose";
|
|
4084
|
-
})(FocusableMode || (FocusableMode = {}));
|
|
4085
|
-
|
|
4086
|
-
function isFocusableElement(element, mode) {
|
|
4087
|
-
var _match;
|
|
4088
|
-
|
|
4089
|
-
if (mode === void 0) {
|
|
4090
|
-
mode = FocusableMode.Strict;
|
|
4091
|
-
}
|
|
4092
|
-
|
|
4093
|
-
if (element === document.body) return false;
|
|
4094
|
-
return match(mode, (_match = {}, _match[FocusableMode.Strict] = function () {
|
|
4095
|
-
return element.matches(focusableSelector);
|
|
4096
|
-
}, _match[FocusableMode.Loose] = function () {
|
|
4097
|
-
var next = element;
|
|
4098
|
-
|
|
4099
|
-
while (next !== null) {
|
|
4100
|
-
if (next.matches(focusableSelector)) return true;
|
|
4101
|
-
next = next.parentElement;
|
|
4102
|
-
}
|
|
4103
|
-
|
|
4104
|
-
return false;
|
|
4105
|
-
}, _match));
|
|
4106
|
-
}
|
|
4107
|
-
function focusIn(container, focus) {
|
|
4108
|
-
var elements = Array.isArray(container) ? container.slice().sort(function (a, b) {
|
|
4109
|
-
var position = a.compareDocumentPosition(b);
|
|
4110
|
-
if (position & Node.DOCUMENT_POSITION_FOLLOWING) return -1;
|
|
4111
|
-
if (position & Node.DOCUMENT_POSITION_PRECEDING) return 1;
|
|
4112
|
-
return 0;
|
|
4113
|
-
}) : getFocusableElements(container);
|
|
4114
|
-
var active = document.activeElement;
|
|
4115
|
-
|
|
4116
|
-
var direction = function () {
|
|
4117
|
-
if (focus & (Focus$1.First | Focus$1.Next)) return Direction$1.Next;
|
|
4118
|
-
if (focus & (Focus$1.Previous | Focus$1.Last)) return Direction$1.Previous;
|
|
4119
|
-
throw new Error('Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last');
|
|
4120
|
-
}();
|
|
4121
|
-
|
|
4122
|
-
var startIndex = function () {
|
|
4123
|
-
if (focus & Focus$1.First) return 0;
|
|
4124
|
-
if (focus & Focus$1.Previous) return Math.max(0, elements.indexOf(active)) - 1;
|
|
4125
|
-
if (focus & Focus$1.Next) return Math.max(0, elements.indexOf(active)) + 1;
|
|
4126
|
-
if (focus & Focus$1.Last) return elements.length - 1;
|
|
4127
|
-
throw new Error('Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last');
|
|
4128
|
-
}();
|
|
4129
|
-
|
|
4130
|
-
var focusOptions = focus & Focus$1.NoScroll ? {
|
|
4131
|
-
preventScroll: true
|
|
4132
|
-
} : {};
|
|
4133
|
-
var offset = 0;
|
|
4134
|
-
var total = elements.length;
|
|
4135
|
-
var next = undefined;
|
|
4136
|
-
|
|
4137
|
-
do {
|
|
4138
|
-
var _next;
|
|
4139
|
-
|
|
4140
|
-
// Guard against infinite loops
|
|
4141
|
-
if (offset >= total || offset + total <= 0) return FocusResult.Error;
|
|
4142
|
-
var nextIdx = startIndex + offset;
|
|
4143
|
-
|
|
4144
|
-
if (focus & Focus$1.WrapAround) {
|
|
4145
|
-
nextIdx = (nextIdx + total) % total;
|
|
4146
|
-
} else {
|
|
4147
|
-
if (nextIdx < 0) return FocusResult.Underflow;
|
|
4148
|
-
if (nextIdx >= total) return FocusResult.Overflow;
|
|
4149
|
-
}
|
|
4150
|
-
|
|
4151
|
-
next = elements[nextIdx]; // Try the focus the next element, might not work if it is "hidden" to the user.
|
|
4152
|
-
|
|
4153
|
-
(_next = next) == null ? void 0 : _next.focus(focusOptions); // Try the next one in line
|
|
4154
|
-
|
|
4155
|
-
offset += direction;
|
|
4156
|
-
} while (next !== document.activeElement); // This is a little weird, but let me try and explain: There are a few scenario's
|
|
4157
|
-
// in chrome for example where a focused `<a>` tag does not get the default focus
|
|
4158
|
-
// styles and sometimes they do. This highly depends on whether you started by
|
|
4159
|
-
// clicking or by using your keyboard. When you programmatically add focus `anchor.focus()`
|
|
4160
|
-
// then the active element (document.activeElement) is this anchor, which is expected.
|
|
4161
|
-
// However in that case the default focus styles are not applied *unless* you
|
|
4162
|
-
// also add this tabindex.
|
|
4163
|
-
|
|
4164
|
-
|
|
4165
|
-
if (!next.hasAttribute('tabindex')) next.setAttribute('tabindex', '0');
|
|
4166
|
-
return FocusResult.Success;
|
|
4167
|
-
}
|
|
4168
|
-
|
|
4169
|
-
var DescriptionContext = /*#__PURE__*/createContext(null);
|
|
4170
|
-
|
|
4171
|
-
function useDescriptionContext() {
|
|
4172
|
-
var context = useContext(DescriptionContext);
|
|
4173
|
-
|
|
4174
|
-
if (context === null) {
|
|
4175
|
-
var err = new Error('You used a <Description /> component, but it is not inside a relevant parent.');
|
|
4176
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, useDescriptionContext);
|
|
4177
|
-
throw err;
|
|
4178
|
-
}
|
|
4179
|
-
|
|
4180
|
-
return context;
|
|
4181
|
-
}
|
|
4182
|
-
|
|
4183
|
-
function useDescriptions() {
|
|
4184
|
-
var _useState = useState([]),
|
|
4185
|
-
descriptionIds = _useState[0],
|
|
4186
|
-
setDescriptionIds = _useState[1];
|
|
4187
|
-
|
|
4188
|
-
return [// The actual id's as string or undefined
|
|
4189
|
-
descriptionIds.length > 0 ? descriptionIds.join(' ') : undefined, // The provider component
|
|
4190
|
-
useMemo(function () {
|
|
4191
|
-
return function DescriptionProvider(props) {
|
|
4192
|
-
var register = useCallback(function (value) {
|
|
4193
|
-
setDescriptionIds(function (existing) {
|
|
4194
|
-
return [].concat(existing, [value]);
|
|
4195
|
-
});
|
|
4196
|
-
return function () {
|
|
4197
|
-
return setDescriptionIds(function (existing) {
|
|
4198
|
-
var clone = existing.slice();
|
|
4199
|
-
var idx = clone.indexOf(value);
|
|
4200
|
-
if (idx !== -1) clone.splice(idx, 1);
|
|
4201
|
-
return clone;
|
|
4202
|
-
});
|
|
4203
|
-
};
|
|
4204
|
-
}, []);
|
|
4205
|
-
var contextBag = useMemo(function () {
|
|
4206
|
-
return {
|
|
4207
|
-
register: register,
|
|
4208
|
-
slot: props.slot,
|
|
4209
|
-
name: props.name,
|
|
4210
|
-
props: props.props
|
|
4211
|
-
};
|
|
4212
|
-
}, [register, props.slot, props.name, props.props]);
|
|
4213
|
-
return React__default.createElement(DescriptionContext.Provider, {
|
|
4214
|
-
value: contextBag
|
|
4215
|
-
}, props.children);
|
|
4216
|
-
};
|
|
4217
|
-
}, [setDescriptionIds])];
|
|
4218
|
-
} // ---
|
|
4219
|
-
|
|
4220
|
-
var DEFAULT_DESCRIPTION_TAG = 'p';
|
|
4221
|
-
function Description$2(props) {
|
|
4222
|
-
var context = useDescriptionContext();
|
|
4223
|
-
var id = "headlessui-description-" + useId();
|
|
4224
|
-
useIsoMorphicEffect(function () {
|
|
4225
|
-
return context.register(id);
|
|
4226
|
-
}, [id, context.register]);
|
|
4227
|
-
var passThroughProps = props;
|
|
4228
|
-
|
|
4229
|
-
var propsWeControl = _extends$1({}, context.props, {
|
|
4230
|
-
id: id
|
|
4231
|
-
});
|
|
4232
|
-
|
|
4233
|
-
return render({
|
|
4234
|
-
props: _extends$1({}, passThroughProps, propsWeControl),
|
|
4235
|
-
slot: context.slot || {},
|
|
4236
|
-
defaultTag: DEFAULT_DESCRIPTION_TAG,
|
|
4237
|
-
name: context.name || 'Description'
|
|
4238
|
-
});
|
|
4239
|
-
}
|
|
4240
|
-
|
|
4241
|
-
var Context = /*#__PURE__*/createContext(null);
|
|
4242
|
-
Context.displayName = 'OpenClosedContext';
|
|
4243
|
-
var State;
|
|
4244
|
-
|
|
4245
|
-
(function (State) {
|
|
4246
|
-
State[State["Open"] = 0] = "Open";
|
|
4247
|
-
State[State["Closed"] = 1] = "Closed";
|
|
4248
|
-
})(State || (State = {}));
|
|
4249
|
-
|
|
4250
|
-
function useOpenClosed() {
|
|
4251
|
-
return useContext(Context);
|
|
4252
|
-
}
|
|
4253
|
-
function OpenClosedProvider(_ref) {
|
|
4254
|
-
var value = _ref.value,
|
|
4255
|
-
children = _ref.children;
|
|
4256
|
-
return React__default.createElement(Context.Provider, {
|
|
4257
|
-
value: value
|
|
4258
|
-
}, children);
|
|
4259
|
-
}
|
|
4260
|
-
|
|
4261
|
-
function resolveType(props) {
|
|
4262
|
-
var _props$as;
|
|
4263
|
-
|
|
4264
|
-
if (props.type) return props.type;
|
|
4265
|
-
var tag = (_props$as = props.as) != null ? _props$as : 'button';
|
|
4266
|
-
if (typeof tag === 'string' && tag.toLowerCase() === 'button') return 'button';
|
|
4267
|
-
return undefined;
|
|
4268
|
-
}
|
|
4269
|
-
|
|
4270
|
-
function useResolveButtonType(props, ref) {
|
|
4271
|
-
var _useState = useState(function () {
|
|
4272
|
-
return resolveType(props);
|
|
4273
|
-
}),
|
|
4274
|
-
type = _useState[0],
|
|
4275
|
-
setType = _useState[1];
|
|
4276
|
-
|
|
4277
|
-
useIsoMorphicEffect(function () {
|
|
4278
|
-
setType(resolveType(props));
|
|
4279
|
-
}, [props.type, props.as]);
|
|
4280
|
-
useIsoMorphicEffect(function () {
|
|
4281
|
-
if (type) return;
|
|
4282
|
-
if (!ref.current) return;
|
|
4283
|
-
|
|
4284
|
-
if (ref.current instanceof HTMLButtonElement && !ref.current.hasAttribute('type')) {
|
|
4285
|
-
setType('button');
|
|
4286
|
-
}
|
|
4287
|
-
}, [type, ref]);
|
|
4288
|
-
return type;
|
|
4289
|
-
}
|
|
4290
|
-
|
|
4291
|
-
var _reducers$2;
|
|
4292
|
-
var DisclosureStates;
|
|
4293
|
-
|
|
4294
|
-
(function (DisclosureStates) {
|
|
4295
|
-
DisclosureStates[DisclosureStates["Open"] = 0] = "Open";
|
|
4296
|
-
DisclosureStates[DisclosureStates["Closed"] = 1] = "Closed";
|
|
4297
|
-
})(DisclosureStates || (DisclosureStates = {}));
|
|
4298
|
-
|
|
4299
|
-
var ActionTypes$2;
|
|
4300
|
-
|
|
4301
|
-
(function (ActionTypes) {
|
|
4302
|
-
ActionTypes[ActionTypes["ToggleDisclosure"] = 0] = "ToggleDisclosure";
|
|
4303
|
-
ActionTypes[ActionTypes["CloseDisclosure"] = 1] = "CloseDisclosure";
|
|
4304
|
-
ActionTypes[ActionTypes["SetButtonId"] = 2] = "SetButtonId";
|
|
4305
|
-
ActionTypes[ActionTypes["SetPanelId"] = 3] = "SetPanelId";
|
|
4306
|
-
ActionTypes[ActionTypes["LinkPanel"] = 4] = "LinkPanel";
|
|
4307
|
-
ActionTypes[ActionTypes["UnlinkPanel"] = 5] = "UnlinkPanel";
|
|
4308
|
-
})(ActionTypes$2 || (ActionTypes$2 = {}));
|
|
4309
|
-
|
|
4310
|
-
var reducers$2 = (_reducers$2 = {}, _reducers$2[ActionTypes$2.ToggleDisclosure] = function (state) {
|
|
4311
|
-
var _match;
|
|
4312
|
-
|
|
4313
|
-
return _extends$1({}, state, {
|
|
4314
|
-
disclosureState: match(state.disclosureState, (_match = {}, _match[DisclosureStates.Open] = DisclosureStates.Closed, _match[DisclosureStates.Closed] = DisclosureStates.Open, _match))
|
|
4315
|
-
});
|
|
4316
|
-
}, _reducers$2[ActionTypes$2.CloseDisclosure] = function (state) {
|
|
4317
|
-
if (state.disclosureState === DisclosureStates.Closed) return state;
|
|
4318
|
-
return _extends$1({}, state, {
|
|
4319
|
-
disclosureState: DisclosureStates.Closed
|
|
4320
|
-
});
|
|
4321
|
-
}, _reducers$2[ActionTypes$2.LinkPanel] = function (state) {
|
|
4322
|
-
if (state.linkedPanel === true) return state;
|
|
4323
|
-
return _extends$1({}, state, {
|
|
4324
|
-
linkedPanel: true
|
|
4325
|
-
});
|
|
4326
|
-
}, _reducers$2[ActionTypes$2.UnlinkPanel] = function (state) {
|
|
4327
|
-
if (state.linkedPanel === false) return state;
|
|
4328
|
-
return _extends$1({}, state, {
|
|
4329
|
-
linkedPanel: false
|
|
4330
|
-
});
|
|
4331
|
-
}, _reducers$2[ActionTypes$2.SetButtonId] = function (state, action) {
|
|
4332
|
-
if (state.buttonId === action.buttonId) return state;
|
|
4333
|
-
return _extends$1({}, state, {
|
|
4334
|
-
buttonId: action.buttonId
|
|
4335
|
-
});
|
|
4336
|
-
}, _reducers$2[ActionTypes$2.SetPanelId] = function (state, action) {
|
|
4337
|
-
if (state.panelId === action.panelId) return state;
|
|
4338
|
-
return _extends$1({}, state, {
|
|
4339
|
-
panelId: action.panelId
|
|
4340
|
-
});
|
|
4341
|
-
}, _reducers$2);
|
|
4342
|
-
var DisclosureContext = /*#__PURE__*/createContext(null);
|
|
4343
|
-
DisclosureContext.displayName = 'DisclosureContext';
|
|
4344
|
-
|
|
4345
|
-
function useDisclosureContext(component) {
|
|
4346
|
-
var context = useContext(DisclosureContext);
|
|
4347
|
-
|
|
4348
|
-
if (context === null) {
|
|
4349
|
-
var err = new Error("<" + component + " /> is missing a parent <" + Disclosure.name + " /> component.");
|
|
4350
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, useDisclosureContext);
|
|
4351
|
-
throw err;
|
|
4352
|
-
}
|
|
4353
|
-
|
|
4354
|
-
return context;
|
|
4355
|
-
}
|
|
4356
|
-
|
|
4357
|
-
var DisclosureAPIContext = /*#__PURE__*/createContext(null);
|
|
4358
|
-
DisclosureAPIContext.displayName = 'DisclosureAPIContext';
|
|
4359
|
-
|
|
4360
|
-
function useDisclosureAPIContext(component) {
|
|
4361
|
-
var context = useContext(DisclosureAPIContext);
|
|
4362
|
-
|
|
4363
|
-
if (context === null) {
|
|
4364
|
-
var err = new Error("<" + component + " /> is missing a parent <" + Disclosure.name + " /> component.");
|
|
4365
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, useDisclosureAPIContext);
|
|
4366
|
-
throw err;
|
|
4367
|
-
}
|
|
4368
|
-
|
|
4369
|
-
return context;
|
|
4370
|
-
}
|
|
4371
|
-
|
|
4372
|
-
var DisclosurePanelContext = /*#__PURE__*/createContext(null);
|
|
4373
|
-
DisclosurePanelContext.displayName = 'DisclosurePanelContext';
|
|
4374
|
-
|
|
4375
|
-
function useDisclosurePanelContext() {
|
|
4376
|
-
return useContext(DisclosurePanelContext);
|
|
4377
|
-
}
|
|
4378
|
-
|
|
4379
|
-
function stateReducer$2(state, action) {
|
|
4380
|
-
return match(action.type, reducers$2, state, action);
|
|
4381
|
-
} // ---
|
|
4382
|
-
|
|
4383
|
-
|
|
4384
|
-
var DEFAULT_DISCLOSURE_TAG = Fragment$2;
|
|
4385
|
-
function Disclosure(props) {
|
|
4386
|
-
var _match2;
|
|
4387
|
-
|
|
4388
|
-
var _props$defaultOpen = props.defaultOpen,
|
|
4389
|
-
defaultOpen = _props$defaultOpen === void 0 ? false : _props$defaultOpen,
|
|
4390
|
-
passthroughProps = _objectWithoutPropertiesLoose$1(props, ["defaultOpen"]);
|
|
4391
|
-
|
|
4392
|
-
var buttonId = "headlessui-disclosure-button-" + useId();
|
|
4393
|
-
var panelId = "headlessui-disclosure-panel-" + useId();
|
|
4394
|
-
var reducerBag = useReducer(stateReducer$2, {
|
|
4395
|
-
disclosureState: defaultOpen ? DisclosureStates.Open : DisclosureStates.Closed,
|
|
4396
|
-
linkedPanel: false,
|
|
4397
|
-
buttonId: buttonId,
|
|
4398
|
-
panelId: panelId
|
|
4399
|
-
});
|
|
4400
|
-
var disclosureState = reducerBag[0].disclosureState,
|
|
4401
|
-
dispatch = reducerBag[1];
|
|
4402
|
-
useEffect(function () {
|
|
4403
|
-
return dispatch({
|
|
4404
|
-
type: ActionTypes$2.SetButtonId,
|
|
4405
|
-
buttonId: buttonId
|
|
4406
|
-
});
|
|
4407
|
-
}, [buttonId, dispatch]);
|
|
4408
|
-
useEffect(function () {
|
|
4409
|
-
return dispatch({
|
|
4410
|
-
type: ActionTypes$2.SetPanelId,
|
|
4411
|
-
panelId: panelId
|
|
4412
|
-
});
|
|
4413
|
-
}, [panelId, dispatch]);
|
|
4414
|
-
var close = useCallback(function (focusableElement) {
|
|
4415
|
-
dispatch({
|
|
4416
|
-
type: ActionTypes$2.CloseDisclosure
|
|
4417
|
-
});
|
|
4418
|
-
|
|
4419
|
-
var restoreElement = function () {
|
|
4420
|
-
if (!focusableElement) return document.getElementById(buttonId);
|
|
4421
|
-
if (focusableElement instanceof HTMLElement) return focusableElement;
|
|
4422
|
-
if (focusableElement.current instanceof HTMLElement) return focusableElement.current;
|
|
4423
|
-
return document.getElementById(buttonId);
|
|
4424
|
-
}();
|
|
4425
|
-
|
|
4426
|
-
restoreElement == null ? void 0 : restoreElement.focus();
|
|
4427
|
-
}, [dispatch, buttonId]);
|
|
4428
|
-
var api = useMemo(function () {
|
|
4429
|
-
return {
|
|
4430
|
-
close: close
|
|
4431
|
-
};
|
|
4432
|
-
}, [close]);
|
|
4433
|
-
var slot = useMemo(function () {
|
|
4434
|
-
return {
|
|
4435
|
-
open: disclosureState === DisclosureStates.Open,
|
|
4436
|
-
close: close
|
|
4437
|
-
};
|
|
4438
|
-
}, [disclosureState, close]);
|
|
4439
|
-
return React__default.createElement(DisclosureContext.Provider, {
|
|
4440
|
-
value: reducerBag
|
|
4441
|
-
}, React__default.createElement(DisclosureAPIContext.Provider, {
|
|
4442
|
-
value: api
|
|
4443
|
-
}, React__default.createElement(OpenClosedProvider, {
|
|
4444
|
-
value: match(disclosureState, (_match2 = {}, _match2[DisclosureStates.Open] = State.Open, _match2[DisclosureStates.Closed] = State.Closed, _match2))
|
|
4445
|
-
}, render({
|
|
4446
|
-
props: passthroughProps,
|
|
4447
|
-
slot: slot,
|
|
4448
|
-
defaultTag: DEFAULT_DISCLOSURE_TAG,
|
|
4449
|
-
name: 'Disclosure'
|
|
4450
|
-
}))));
|
|
4451
|
-
} // ---
|
|
4452
|
-
|
|
4453
|
-
var DEFAULT_BUTTON_TAG$1 = 'button';
|
|
4454
|
-
var Button$7 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
|
|
4455
|
-
var _useDisclosureContext = useDisclosureContext([Disclosure.name, Button.name].join('.')),
|
|
4456
|
-
state = _useDisclosureContext[0],
|
|
4457
|
-
dispatch = _useDisclosureContext[1];
|
|
4458
|
-
|
|
4459
|
-
var internalButtonRef = useRef(null);
|
|
4460
|
-
var buttonRef = useSyncRefs(internalButtonRef, ref);
|
|
4461
|
-
var panelContext = useDisclosurePanelContext();
|
|
4462
|
-
var isWithinPanel = panelContext === null ? false : panelContext === state.panelId;
|
|
4463
|
-
var handleKeyDown = useCallback(function (event) {
|
|
4464
|
-
var _document$getElementB;
|
|
4465
|
-
|
|
4466
|
-
if (isWithinPanel) {
|
|
4467
|
-
if (state.disclosureState === DisclosureStates.Closed) return;
|
|
4468
|
-
|
|
4469
|
-
switch (event.key) {
|
|
4470
|
-
case Keys.Space:
|
|
4471
|
-
case Keys.Enter:
|
|
4472
|
-
event.preventDefault();
|
|
4473
|
-
event.stopPropagation();
|
|
4474
|
-
dispatch({
|
|
4475
|
-
type: ActionTypes$2.ToggleDisclosure
|
|
4476
|
-
});
|
|
4477
|
-
(_document$getElementB = document.getElementById(state.buttonId)) == null ? void 0 : _document$getElementB.focus();
|
|
4478
|
-
break;
|
|
4479
|
-
}
|
|
4480
|
-
} else {
|
|
4481
|
-
switch (event.key) {
|
|
4482
|
-
case Keys.Space:
|
|
4483
|
-
case Keys.Enter:
|
|
4484
|
-
event.preventDefault();
|
|
4485
|
-
event.stopPropagation();
|
|
4486
|
-
dispatch({
|
|
4487
|
-
type: ActionTypes$2.ToggleDisclosure
|
|
4488
|
-
});
|
|
4489
|
-
break;
|
|
4490
|
-
}
|
|
4491
|
-
}
|
|
4492
|
-
}, [dispatch, isWithinPanel, state.disclosureState]);
|
|
4493
|
-
var handleKeyUp = useCallback(function (event) {
|
|
4494
|
-
switch (event.key) {
|
|
4495
|
-
case Keys.Space:
|
|
4496
|
-
// Required for firefox, event.preventDefault() in handleKeyDown for
|
|
4497
|
-
// the Space key doesn't cancel the handleKeyUp, which in turn
|
|
4498
|
-
// triggers a *click*.
|
|
4499
|
-
event.preventDefault();
|
|
4500
|
-
break;
|
|
4501
|
-
}
|
|
4502
|
-
}, []);
|
|
4503
|
-
var handleClick = useCallback(function (event) {
|
|
4504
|
-
if (isDisabledReactIssue7711(event.currentTarget)) return;
|
|
4505
|
-
if (props.disabled) return;
|
|
4506
|
-
|
|
4507
|
-
if (isWithinPanel) {
|
|
4508
|
-
var _document$getElementB2;
|
|
4509
|
-
|
|
4510
|
-
dispatch({
|
|
4511
|
-
type: ActionTypes$2.ToggleDisclosure
|
|
4512
|
-
});
|
|
4513
|
-
(_document$getElementB2 = document.getElementById(state.buttonId)) == null ? void 0 : _document$getElementB2.focus();
|
|
4514
|
-
} else {
|
|
4515
|
-
dispatch({
|
|
4516
|
-
type: ActionTypes$2.ToggleDisclosure
|
|
4517
|
-
});
|
|
4518
|
-
}
|
|
4519
|
-
}, [dispatch, props.disabled, state.buttonId, isWithinPanel]);
|
|
4520
|
-
var slot = useMemo(function () {
|
|
4521
|
-
return {
|
|
4522
|
-
open: state.disclosureState === DisclosureStates.Open
|
|
4523
|
-
};
|
|
4524
|
-
}, [state]);
|
|
4525
|
-
var type = useResolveButtonType(props, internalButtonRef);
|
|
4526
|
-
var passthroughProps = props;
|
|
4527
|
-
var propsWeControl = isWithinPanel ? {
|
|
4528
|
-
ref: buttonRef,
|
|
4529
|
-
type: type,
|
|
4530
|
-
onKeyDown: handleKeyDown,
|
|
4531
|
-
onClick: handleClick
|
|
4532
|
-
} : {
|
|
4533
|
-
ref: buttonRef,
|
|
4534
|
-
id: state.buttonId,
|
|
4535
|
-
type: type,
|
|
4536
|
-
'aria-expanded': props.disabled ? undefined : state.disclosureState === DisclosureStates.Open,
|
|
4537
|
-
'aria-controls': state.linkedPanel ? state.panelId : undefined,
|
|
4538
|
-
onKeyDown: handleKeyDown,
|
|
4539
|
-
onKeyUp: handleKeyUp,
|
|
4540
|
-
onClick: handleClick
|
|
4541
|
-
};
|
|
4542
|
-
return render({
|
|
4543
|
-
props: _extends$1({}, passthroughProps, propsWeControl),
|
|
4544
|
-
slot: slot,
|
|
4545
|
-
defaultTag: DEFAULT_BUTTON_TAG$1,
|
|
4546
|
-
name: 'Disclosure.Button'
|
|
4547
|
-
});
|
|
4548
|
-
}); // ---
|
|
4549
|
-
|
|
4550
|
-
var DEFAULT_PANEL_TAG = 'div';
|
|
4551
|
-
var PanelRenderFeatures = Features.RenderStrategy | Features.Static;
|
|
4552
|
-
var Panel = /*#__PURE__*/forwardRefWithAs(function Panel(props, ref) {
|
|
4553
|
-
var _useDisclosureContext2 = useDisclosureContext([Disclosure.name, Panel.name].join('.')),
|
|
4554
|
-
state = _useDisclosureContext2[0],
|
|
4555
|
-
dispatch = _useDisclosureContext2[1];
|
|
4556
|
-
|
|
4557
|
-
var _useDisclosureAPICont = useDisclosureAPIContext([Disclosure.name, Panel.name].join('.')),
|
|
4558
|
-
close = _useDisclosureAPICont.close;
|
|
4559
|
-
|
|
4560
|
-
var panelRef = useSyncRefs(ref, function () {
|
|
4561
|
-
if (state.linkedPanel) return;
|
|
4562
|
-
dispatch({
|
|
4563
|
-
type: ActionTypes$2.LinkPanel
|
|
4564
|
-
});
|
|
4565
|
-
});
|
|
4566
|
-
var usesOpenClosedState = useOpenClosed();
|
|
4567
|
-
|
|
4568
|
-
var visible = function () {
|
|
4569
|
-
if (usesOpenClosedState !== null) {
|
|
4570
|
-
return usesOpenClosedState === State.Open;
|
|
4571
|
-
}
|
|
4572
|
-
|
|
4573
|
-
return state.disclosureState === DisclosureStates.Open;
|
|
4574
|
-
}(); // Unlink on "unmount" myself
|
|
4575
|
-
|
|
4576
|
-
|
|
4577
|
-
useEffect(function () {
|
|
4578
|
-
return function () {
|
|
4579
|
-
return dispatch({
|
|
4580
|
-
type: ActionTypes$2.UnlinkPanel
|
|
4581
|
-
});
|
|
4582
|
-
};
|
|
4583
|
-
}, [dispatch]); // Unlink on "unmount" children
|
|
4584
|
-
|
|
4585
|
-
useEffect(function () {
|
|
4586
|
-
var _props$unmount;
|
|
4587
|
-
|
|
4588
|
-
if (state.disclosureState === DisclosureStates.Closed && ((_props$unmount = props.unmount) != null ? _props$unmount : true)) {
|
|
4589
|
-
dispatch({
|
|
4590
|
-
type: ActionTypes$2.UnlinkPanel
|
|
4591
|
-
});
|
|
4592
|
-
}
|
|
4593
|
-
}, [state.disclosureState, props.unmount, dispatch]);
|
|
4594
|
-
var slot = useMemo(function () {
|
|
4595
|
-
return {
|
|
4596
|
-
open: state.disclosureState === DisclosureStates.Open,
|
|
4597
|
-
close: close
|
|
4598
|
-
};
|
|
4599
|
-
}, [state, close]);
|
|
4600
|
-
var propsWeControl = {
|
|
4601
|
-
ref: panelRef,
|
|
4602
|
-
id: state.panelId
|
|
4603
|
-
};
|
|
4604
|
-
var passthroughProps = props;
|
|
4605
|
-
return React__default.createElement(DisclosurePanelContext.Provider, {
|
|
4606
|
-
value: state.panelId
|
|
4607
|
-
}, render({
|
|
4608
|
-
props: _extends$1({}, passthroughProps, propsWeControl),
|
|
4609
|
-
slot: slot,
|
|
4610
|
-
defaultTag: DEFAULT_PANEL_TAG,
|
|
4611
|
-
features: PanelRenderFeatures,
|
|
4612
|
-
visible: visible,
|
|
4613
|
-
name: 'Disclosure.Panel'
|
|
4614
|
-
}));
|
|
4615
|
-
}); // ---
|
|
4616
|
-
|
|
4617
|
-
Disclosure.Button = Button$7;
|
|
4618
|
-
Disclosure.Panel = Panel;
|
|
4619
|
-
|
|
4620
|
-
function disposables() {
|
|
4621
|
-
var disposables = [];
|
|
4622
|
-
var api = {
|
|
4623
|
-
requestAnimationFrame: function (_requestAnimationFrame) {
|
|
4624
|
-
function requestAnimationFrame() {
|
|
4625
|
-
return _requestAnimationFrame.apply(this, arguments);
|
|
4626
|
-
}
|
|
4627
|
-
|
|
4628
|
-
requestAnimationFrame.toString = function () {
|
|
4629
|
-
return _requestAnimationFrame.toString();
|
|
4630
|
-
};
|
|
4631
|
-
|
|
4632
|
-
return requestAnimationFrame;
|
|
4633
|
-
}(function () {
|
|
4634
|
-
var raf = requestAnimationFrame.apply(void 0, arguments);
|
|
4635
|
-
api.add(function () {
|
|
4636
|
-
return cancelAnimationFrame(raf);
|
|
4637
|
-
});
|
|
4638
|
-
}),
|
|
4639
|
-
nextFrame: function nextFrame() {
|
|
4640
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
4641
|
-
args[_key] = arguments[_key];
|
|
4642
|
-
}
|
|
4643
|
-
|
|
4644
|
-
api.requestAnimationFrame(function () {
|
|
4645
|
-
api.requestAnimationFrame.apply(api, args);
|
|
4646
|
-
});
|
|
4647
|
-
},
|
|
4648
|
-
setTimeout: function (_setTimeout) {
|
|
4649
|
-
function setTimeout() {
|
|
4650
|
-
return _setTimeout.apply(this, arguments);
|
|
4651
|
-
}
|
|
4652
|
-
|
|
4653
|
-
setTimeout.toString = function () {
|
|
4654
|
-
return _setTimeout.toString();
|
|
4655
|
-
};
|
|
4656
|
-
|
|
4657
|
-
return setTimeout;
|
|
4658
|
-
}(function () {
|
|
4659
|
-
var timer = setTimeout.apply(void 0, arguments);
|
|
4660
|
-
api.add(function () {
|
|
4661
|
-
return clearTimeout(timer);
|
|
4662
|
-
});
|
|
4663
|
-
}),
|
|
4664
|
-
add: function add(cb) {
|
|
4665
|
-
disposables.push(cb);
|
|
4666
|
-
},
|
|
4667
|
-
dispose: function dispose() {
|
|
4668
|
-
for (var _iterator = _createForOfIteratorHelperLoose(disposables.splice(0)), _step; !(_step = _iterator()).done;) {
|
|
4669
|
-
var dispose = _step.value;
|
|
4670
|
-
dispose();
|
|
4671
|
-
}
|
|
4672
|
-
}
|
|
4673
|
-
};
|
|
4674
|
-
return api;
|
|
4675
|
-
}
|
|
4676
|
-
|
|
4677
|
-
function useDisposables() {
|
|
4678
|
-
// Using useState instead of useRef so that we can use the initializer function.
|
|
4679
|
-
var _useState = useState(disposables),
|
|
4680
|
-
d = _useState[0];
|
|
4681
|
-
|
|
4682
|
-
useEffect(function () {
|
|
4683
|
-
return function () {
|
|
4684
|
-
return d.dispose();
|
|
4685
|
-
};
|
|
4686
|
-
}, [d]);
|
|
4687
|
-
return d;
|
|
4688
|
-
}
|
|
4689
|
-
|
|
4690
|
-
function useComputed(cb, dependencies) {
|
|
4691
|
-
var _useState = useState(cb),
|
|
4692
|
-
value = _useState[0],
|
|
4693
|
-
setValue = _useState[1];
|
|
4694
|
-
|
|
4695
|
-
var cbRef = useRef(cb);
|
|
4696
|
-
useIsoMorphicEffect(function () {
|
|
4697
|
-
cbRef.current = cb;
|
|
4698
|
-
}, [cb]);
|
|
4699
|
-
useIsoMorphicEffect(function () {
|
|
4700
|
-
return setValue(cbRef.current);
|
|
4701
|
-
}, [cbRef, setValue].concat(dependencies));
|
|
4702
|
-
return value;
|
|
4703
|
-
}
|
|
4704
|
-
|
|
4705
|
-
function assertNever(x) {
|
|
4706
|
-
throw new Error('Unexpected object: ' + x);
|
|
4707
|
-
}
|
|
4708
|
-
|
|
4709
|
-
var Focus;
|
|
4710
|
-
|
|
4711
|
-
(function (Focus) {
|
|
4712
|
-
/** Focus the first non-disabled item. */
|
|
4713
|
-
Focus[Focus["First"] = 0] = "First";
|
|
4714
|
-
/** Focus the previous non-disabled item. */
|
|
4715
|
-
|
|
4716
|
-
Focus[Focus["Previous"] = 1] = "Previous";
|
|
4717
|
-
/** Focus the next non-disabled item. */
|
|
4718
|
-
|
|
4719
|
-
Focus[Focus["Next"] = 2] = "Next";
|
|
4720
|
-
/** Focus the last non-disabled item. */
|
|
4721
|
-
|
|
4722
|
-
Focus[Focus["Last"] = 3] = "Last";
|
|
4723
|
-
/** Focus a specific item based on the `id` of the item. */
|
|
4724
|
-
|
|
4725
|
-
Focus[Focus["Specific"] = 4] = "Specific";
|
|
4726
|
-
/** Focus no items at all. */
|
|
4727
|
-
|
|
4728
|
-
Focus[Focus["Nothing"] = 5] = "Nothing";
|
|
4729
|
-
})(Focus || (Focus = {}));
|
|
4730
|
-
|
|
4731
|
-
function calculateActiveIndex(action, resolvers) {
|
|
4732
|
-
var items = resolvers.resolveItems();
|
|
4733
|
-
if (items.length <= 0) return null;
|
|
4734
|
-
var currentActiveIndex = resolvers.resolveActiveIndex();
|
|
4735
|
-
var activeIndex = currentActiveIndex != null ? currentActiveIndex : -1;
|
|
4736
|
-
|
|
4737
|
-
var nextActiveIndex = function () {
|
|
4738
|
-
switch (action.focus) {
|
|
4739
|
-
case Focus.First:
|
|
4740
|
-
return items.findIndex(function (item) {
|
|
4741
|
-
return !resolvers.resolveDisabled(item);
|
|
4742
|
-
});
|
|
4743
|
-
|
|
4744
|
-
case Focus.Previous:
|
|
4745
|
-
{
|
|
4746
|
-
var idx = items.slice().reverse().findIndex(function (item, idx, all) {
|
|
4747
|
-
if (activeIndex !== -1 && all.length - idx - 1 >= activeIndex) return false;
|
|
4748
|
-
return !resolvers.resolveDisabled(item);
|
|
4749
|
-
});
|
|
4750
|
-
if (idx === -1) return idx;
|
|
4751
|
-
return items.length - 1 - idx;
|
|
4752
|
-
}
|
|
4753
|
-
|
|
4754
|
-
case Focus.Next:
|
|
4755
|
-
return items.findIndex(function (item, idx) {
|
|
4756
|
-
if (idx <= activeIndex) return false;
|
|
4757
|
-
return !resolvers.resolveDisabled(item);
|
|
4758
|
-
});
|
|
4759
|
-
|
|
4760
|
-
case Focus.Last:
|
|
4761
|
-
{
|
|
4762
|
-
var _idx = items.slice().reverse().findIndex(function (item) {
|
|
4763
|
-
return !resolvers.resolveDisabled(item);
|
|
4764
|
-
});
|
|
4765
|
-
|
|
4766
|
-
if (_idx === -1) return _idx;
|
|
4767
|
-
return items.length - 1 - _idx;
|
|
4768
|
-
}
|
|
4769
|
-
|
|
4770
|
-
case Focus.Specific:
|
|
4771
|
-
return items.findIndex(function (item) {
|
|
4772
|
-
return resolvers.resolveId(item) === action.id;
|
|
4773
|
-
});
|
|
4774
|
-
|
|
4775
|
-
case Focus.Nothing:
|
|
4776
|
-
return null;
|
|
4777
|
-
|
|
4778
|
-
default:
|
|
4779
|
-
assertNever(action);
|
|
4780
|
-
}
|
|
4781
|
-
}();
|
|
4782
|
-
|
|
4783
|
-
return nextActiveIndex === -1 ? currentActiveIndex : nextActiveIndex;
|
|
4784
|
-
}
|
|
4785
|
-
|
|
4786
|
-
var _reducers$1;
|
|
4787
|
-
var ListboxStates;
|
|
4788
|
-
|
|
4789
|
-
(function (ListboxStates) {
|
|
4790
|
-
ListboxStates[ListboxStates["Open"] = 0] = "Open";
|
|
4791
|
-
ListboxStates[ListboxStates["Closed"] = 1] = "Closed";
|
|
4792
|
-
})(ListboxStates || (ListboxStates = {}));
|
|
4793
|
-
|
|
4794
|
-
var ActionTypes$1;
|
|
4795
|
-
|
|
4796
|
-
(function (ActionTypes) {
|
|
4797
|
-
ActionTypes[ActionTypes["OpenListbox"] = 0] = "OpenListbox";
|
|
4798
|
-
ActionTypes[ActionTypes["CloseListbox"] = 1] = "CloseListbox";
|
|
4799
|
-
ActionTypes[ActionTypes["SetDisabled"] = 2] = "SetDisabled";
|
|
4800
|
-
ActionTypes[ActionTypes["SetOrientation"] = 3] = "SetOrientation";
|
|
4801
|
-
ActionTypes[ActionTypes["GoToOption"] = 4] = "GoToOption";
|
|
4802
|
-
ActionTypes[ActionTypes["Search"] = 5] = "Search";
|
|
4803
|
-
ActionTypes[ActionTypes["ClearSearch"] = 6] = "ClearSearch";
|
|
4804
|
-
ActionTypes[ActionTypes["RegisterOption"] = 7] = "RegisterOption";
|
|
4805
|
-
ActionTypes[ActionTypes["UnregisterOption"] = 8] = "UnregisterOption";
|
|
4806
|
-
})(ActionTypes$1 || (ActionTypes$1 = {}));
|
|
4807
|
-
|
|
4808
|
-
var reducers$1 = (_reducers$1 = {}, _reducers$1[ActionTypes$1.CloseListbox] = function (state) {
|
|
4809
|
-
if (state.disabled) return state;
|
|
4810
|
-
if (state.listboxState === ListboxStates.Closed) return state;
|
|
4811
|
-
return _extends$1({}, state, {
|
|
4812
|
-
activeOptionIndex: null,
|
|
4813
|
-
listboxState: ListboxStates.Closed
|
|
4814
|
-
});
|
|
4815
|
-
}, _reducers$1[ActionTypes$1.OpenListbox] = function (state) {
|
|
4816
|
-
if (state.disabled) return state;
|
|
4817
|
-
if (state.listboxState === ListboxStates.Open) return state;
|
|
4818
|
-
return _extends$1({}, state, {
|
|
4819
|
-
listboxState: ListboxStates.Open
|
|
4820
|
-
});
|
|
4821
|
-
}, _reducers$1[ActionTypes$1.SetDisabled] = function (state, action) {
|
|
4822
|
-
if (state.disabled === action.disabled) return state;
|
|
4823
|
-
return _extends$1({}, state, {
|
|
4824
|
-
disabled: action.disabled
|
|
4825
|
-
});
|
|
4826
|
-
}, _reducers$1[ActionTypes$1.SetOrientation] = function (state, action) {
|
|
4827
|
-
if (state.orientation === action.orientation) return state;
|
|
4828
|
-
return _extends$1({}, state, {
|
|
4829
|
-
orientation: action.orientation
|
|
4830
|
-
});
|
|
4831
|
-
}, _reducers$1[ActionTypes$1.GoToOption] = function (state, action) {
|
|
4832
|
-
if (state.disabled) return state;
|
|
4833
|
-
if (state.listboxState === ListboxStates.Closed) return state;
|
|
4834
|
-
var activeOptionIndex = calculateActiveIndex(action, {
|
|
4835
|
-
resolveItems: function resolveItems() {
|
|
4836
|
-
return state.options;
|
|
4837
|
-
},
|
|
4838
|
-
resolveActiveIndex: function resolveActiveIndex() {
|
|
4839
|
-
return state.activeOptionIndex;
|
|
4840
|
-
},
|
|
4841
|
-
resolveId: function resolveId(item) {
|
|
4842
|
-
return item.id;
|
|
4843
|
-
},
|
|
4844
|
-
resolveDisabled: function resolveDisabled(item) {
|
|
4845
|
-
return item.dataRef.current.disabled;
|
|
4846
|
-
}
|
|
4847
|
-
});
|
|
4848
|
-
if (state.searchQuery === '' && state.activeOptionIndex === activeOptionIndex) return state;
|
|
4849
|
-
return _extends$1({}, state, {
|
|
4850
|
-
searchQuery: '',
|
|
4851
|
-
activeOptionIndex: activeOptionIndex
|
|
4852
|
-
});
|
|
4853
|
-
}, _reducers$1[ActionTypes$1.Search] = function (state, action) {
|
|
4854
|
-
if (state.disabled) return state;
|
|
4855
|
-
if (state.listboxState === ListboxStates.Closed) return state;
|
|
4856
|
-
var searchQuery = state.searchQuery + action.value.toLowerCase();
|
|
4857
|
-
var match = state.options.findIndex(function (option) {
|
|
4858
|
-
var _option$dataRef$curre;
|
|
4859
|
-
|
|
4860
|
-
return !option.dataRef.current.disabled && ((_option$dataRef$curre = option.dataRef.current.textValue) == null ? void 0 : _option$dataRef$curre.startsWith(searchQuery));
|
|
4861
|
-
});
|
|
4862
|
-
if (match === -1 || match === state.activeOptionIndex) return _extends$1({}, state, {
|
|
4863
|
-
searchQuery: searchQuery
|
|
4864
|
-
});
|
|
4865
|
-
return _extends$1({}, state, {
|
|
4866
|
-
searchQuery: searchQuery,
|
|
4867
|
-
activeOptionIndex: match
|
|
4868
|
-
});
|
|
4869
|
-
}, _reducers$1[ActionTypes$1.ClearSearch] = function (state) {
|
|
4870
|
-
if (state.disabled) return state;
|
|
4871
|
-
if (state.listboxState === ListboxStates.Closed) return state;
|
|
4872
|
-
if (state.searchQuery === '') return state;
|
|
4873
|
-
return _extends$1({}, state, {
|
|
4874
|
-
searchQuery: ''
|
|
4875
|
-
});
|
|
4876
|
-
}, _reducers$1[ActionTypes$1.RegisterOption] = function (state, action) {
|
|
4877
|
-
return _extends$1({}, state, {
|
|
4878
|
-
options: [].concat(state.options, [{
|
|
4879
|
-
id: action.id,
|
|
4880
|
-
dataRef: action.dataRef
|
|
4881
|
-
}])
|
|
4882
|
-
});
|
|
4883
|
-
}, _reducers$1[ActionTypes$1.UnregisterOption] = function (state, action) {
|
|
4884
|
-
var nextOptions = state.options.slice();
|
|
4885
|
-
var currentActiveOption = state.activeOptionIndex !== null ? nextOptions[state.activeOptionIndex] : null;
|
|
4886
|
-
var idx = nextOptions.findIndex(function (a) {
|
|
4887
|
-
return a.id === action.id;
|
|
4888
|
-
});
|
|
4889
|
-
if (idx !== -1) nextOptions.splice(idx, 1);
|
|
4890
|
-
return _extends$1({}, state, {
|
|
4891
|
-
options: nextOptions,
|
|
4892
|
-
activeOptionIndex: function () {
|
|
4893
|
-
if (idx === state.activeOptionIndex) return null;
|
|
4894
|
-
if (currentActiveOption === null) return null; // If we removed the option before the actual active index, then it would be out of sync. To
|
|
4895
|
-
// fix this, we will find the correct (new) index position.
|
|
4896
|
-
|
|
4897
|
-
return nextOptions.indexOf(currentActiveOption);
|
|
4898
|
-
}()
|
|
4899
|
-
});
|
|
4900
|
-
}, _reducers$1);
|
|
4901
|
-
var ListboxContext = /*#__PURE__*/createContext(null);
|
|
4902
|
-
ListboxContext.displayName = 'ListboxContext';
|
|
4903
|
-
|
|
4904
|
-
function useListboxContext(component) {
|
|
4905
|
-
var context = useContext(ListboxContext);
|
|
4906
|
-
|
|
4907
|
-
if (context === null) {
|
|
4908
|
-
var err = new Error("<" + component + " /> is missing a parent <" + Listbox.name + " /> component.");
|
|
4909
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, useListboxContext);
|
|
4910
|
-
throw err;
|
|
4911
|
-
}
|
|
4912
|
-
|
|
4913
|
-
return context;
|
|
4914
|
-
}
|
|
4915
|
-
|
|
4916
|
-
function stateReducer$1(state, action) {
|
|
4917
|
-
return match(action.type, reducers$1, state, action);
|
|
4918
|
-
} // ---
|
|
4919
|
-
|
|
4920
|
-
|
|
4921
|
-
var DEFAULT_LISTBOX_TAG = Fragment$2;
|
|
4922
|
-
function Listbox(props) {
|
|
4923
|
-
var _match;
|
|
4924
|
-
|
|
4925
|
-
var value = props.value,
|
|
4926
|
-
onChange = props.onChange,
|
|
4927
|
-
_props$disabled = props.disabled,
|
|
4928
|
-
disabled = _props$disabled === void 0 ? false : _props$disabled,
|
|
4929
|
-
_props$horizontal = props.horizontal,
|
|
4930
|
-
horizontal = _props$horizontal === void 0 ? false : _props$horizontal,
|
|
4931
|
-
passThroughProps = _objectWithoutPropertiesLoose$1(props, ["value", "onChange", "disabled", "horizontal"]);
|
|
4932
|
-
|
|
4933
|
-
var orientation = horizontal ? 'horizontal' : 'vertical';
|
|
4934
|
-
var reducerBag = useReducer(stateReducer$1, {
|
|
4935
|
-
listboxState: ListboxStates.Closed,
|
|
4936
|
-
propsRef: {
|
|
4937
|
-
current: {
|
|
4938
|
-
value: value,
|
|
4939
|
-
onChange: onChange
|
|
4940
|
-
}
|
|
4941
|
-
},
|
|
4942
|
-
labelRef: createRef(),
|
|
4943
|
-
buttonRef: createRef(),
|
|
4944
|
-
optionsRef: createRef(),
|
|
4945
|
-
disabled: disabled,
|
|
4946
|
-
orientation: orientation,
|
|
4947
|
-
options: [],
|
|
4948
|
-
searchQuery: '',
|
|
4949
|
-
activeOptionIndex: null
|
|
4950
|
-
});
|
|
4951
|
-
var _reducerBag$ = reducerBag[0],
|
|
4952
|
-
listboxState = _reducerBag$.listboxState,
|
|
4953
|
-
propsRef = _reducerBag$.propsRef,
|
|
4954
|
-
optionsRef = _reducerBag$.optionsRef,
|
|
4955
|
-
buttonRef = _reducerBag$.buttonRef,
|
|
4956
|
-
dispatch = reducerBag[1];
|
|
4957
|
-
useIsoMorphicEffect(function () {
|
|
4958
|
-
propsRef.current.value = value;
|
|
4959
|
-
}, [value, propsRef]);
|
|
4960
|
-
useIsoMorphicEffect(function () {
|
|
4961
|
-
propsRef.current.onChange = onChange;
|
|
4962
|
-
}, [onChange, propsRef]);
|
|
4963
|
-
useIsoMorphicEffect(function () {
|
|
4964
|
-
return dispatch({
|
|
4965
|
-
type: ActionTypes$1.SetDisabled,
|
|
4966
|
-
disabled: disabled
|
|
4967
|
-
});
|
|
4968
|
-
}, [disabled]);
|
|
4969
|
-
useIsoMorphicEffect(function () {
|
|
4970
|
-
return dispatch({
|
|
4971
|
-
type: ActionTypes$1.SetOrientation,
|
|
4972
|
-
orientation: orientation
|
|
4973
|
-
});
|
|
4974
|
-
}, [orientation]); // Handle outside click
|
|
4975
|
-
|
|
4976
|
-
useWindowEvent('mousedown', function (event) {
|
|
4977
|
-
var _buttonRef$current, _optionsRef$current;
|
|
4978
|
-
|
|
4979
|
-
var target = event.target;
|
|
4980
|
-
if (listboxState !== ListboxStates.Open) return;
|
|
4981
|
-
if ((_buttonRef$current = buttonRef.current) == null ? void 0 : _buttonRef$current.contains(target)) return;
|
|
4982
|
-
if ((_optionsRef$current = optionsRef.current) == null ? void 0 : _optionsRef$current.contains(target)) return;
|
|
4983
|
-
dispatch({
|
|
4984
|
-
type: ActionTypes$1.CloseListbox
|
|
4985
|
-
});
|
|
4986
|
-
|
|
4987
|
-
if (!isFocusableElement(target, FocusableMode.Loose)) {
|
|
4988
|
-
var _buttonRef$current2;
|
|
4989
|
-
|
|
4990
|
-
event.preventDefault();
|
|
4991
|
-
(_buttonRef$current2 = buttonRef.current) == null ? void 0 : _buttonRef$current2.focus();
|
|
4992
|
-
}
|
|
4993
|
-
});
|
|
4994
|
-
var slot = useMemo(function () {
|
|
4995
|
-
return {
|
|
4996
|
-
open: listboxState === ListboxStates.Open,
|
|
4997
|
-
disabled: disabled
|
|
4998
|
-
};
|
|
4999
|
-
}, [listboxState, disabled]);
|
|
5000
|
-
return React__default.createElement(ListboxContext.Provider, {
|
|
5001
|
-
value: reducerBag
|
|
5002
|
-
}, React__default.createElement(OpenClosedProvider, {
|
|
5003
|
-
value: match(listboxState, (_match = {}, _match[ListboxStates.Open] = State.Open, _match[ListboxStates.Closed] = State.Closed, _match))
|
|
5004
|
-
}, render({
|
|
5005
|
-
props: passThroughProps,
|
|
5006
|
-
slot: slot,
|
|
5007
|
-
defaultTag: DEFAULT_LISTBOX_TAG,
|
|
5008
|
-
name: 'Listbox'
|
|
5009
|
-
})));
|
|
5010
|
-
} // ---
|
|
5011
|
-
|
|
5012
|
-
var DEFAULT_BUTTON_TAG = 'button';
|
|
5013
|
-
var Button$6 = /*#__PURE__*/forwardRefWithAs(function Button(props, ref) {
|
|
5014
|
-
var _state$optionsRef$cur;
|
|
5015
|
-
|
|
5016
|
-
var _useListboxContext = useListboxContext([Listbox.name, Button.name].join('.')),
|
|
5017
|
-
state = _useListboxContext[0],
|
|
5018
|
-
dispatch = _useListboxContext[1];
|
|
5019
|
-
|
|
5020
|
-
var buttonRef = useSyncRefs(state.buttonRef, ref);
|
|
5021
|
-
var id = "headlessui-listbox-button-" + useId();
|
|
5022
|
-
var d = useDisposables();
|
|
5023
|
-
var handleKeyDown = useCallback(function (event) {
|
|
5024
|
-
switch (event.key) {
|
|
5025
|
-
// Ref: https://www.w3.org/TR/wai-aria-practices-1.2/#keyboard-interaction-13
|
|
5026
|
-
case Keys.Space:
|
|
5027
|
-
case Keys.Enter:
|
|
5028
|
-
case Keys.ArrowDown:
|
|
5029
|
-
event.preventDefault();
|
|
5030
|
-
dispatch({
|
|
5031
|
-
type: ActionTypes$1.OpenListbox
|
|
5032
|
-
});
|
|
5033
|
-
d.nextFrame(function () {
|
|
5034
|
-
if (!state.propsRef.current.value) dispatch({
|
|
5035
|
-
type: ActionTypes$1.GoToOption,
|
|
5036
|
-
focus: Focus.First
|
|
5037
|
-
});
|
|
5038
|
-
});
|
|
5039
|
-
break;
|
|
5040
|
-
|
|
5041
|
-
case Keys.ArrowUp:
|
|
5042
|
-
event.preventDefault();
|
|
5043
|
-
dispatch({
|
|
5044
|
-
type: ActionTypes$1.OpenListbox
|
|
5045
|
-
});
|
|
5046
|
-
d.nextFrame(function () {
|
|
5047
|
-
if (!state.propsRef.current.value) dispatch({
|
|
5048
|
-
type: ActionTypes$1.GoToOption,
|
|
5049
|
-
focus: Focus.Last
|
|
5050
|
-
});
|
|
5051
|
-
});
|
|
5052
|
-
break;
|
|
5053
|
-
}
|
|
5054
|
-
}, [dispatch, state, d]);
|
|
5055
|
-
var handleKeyUp = useCallback(function (event) {
|
|
5056
|
-
switch (event.key) {
|
|
5057
|
-
case Keys.Space:
|
|
5058
|
-
// Required for firefox, event.preventDefault() in handleKeyDown for
|
|
5059
|
-
// the Space key doesn't cancel the handleKeyUp, which in turn
|
|
5060
|
-
// triggers a *click*.
|
|
5061
|
-
event.preventDefault();
|
|
5062
|
-
break;
|
|
5063
|
-
}
|
|
5064
|
-
}, []);
|
|
5065
|
-
var handleClick = useCallback(function (event) {
|
|
5066
|
-
if (isDisabledReactIssue7711(event.currentTarget)) return event.preventDefault();
|
|
5067
|
-
|
|
5068
|
-
if (state.listboxState === ListboxStates.Open) {
|
|
5069
|
-
dispatch({
|
|
5070
|
-
type: ActionTypes$1.CloseListbox
|
|
5071
|
-
});
|
|
5072
|
-
d.nextFrame(function () {
|
|
5073
|
-
var _state$buttonRef$curr;
|
|
5074
|
-
|
|
5075
|
-
return (_state$buttonRef$curr = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr.focus({
|
|
5076
|
-
preventScroll: true
|
|
5077
|
-
});
|
|
5078
|
-
});
|
|
5079
|
-
} else {
|
|
5080
|
-
event.preventDefault();
|
|
5081
|
-
dispatch({
|
|
5082
|
-
type: ActionTypes$1.OpenListbox
|
|
5083
|
-
});
|
|
5084
|
-
}
|
|
5085
|
-
}, [dispatch, d, state]);
|
|
5086
|
-
var labelledby = useComputed(function () {
|
|
5087
|
-
if (!state.labelRef.current) return undefined;
|
|
5088
|
-
return [state.labelRef.current.id, id].join(' ');
|
|
5089
|
-
}, [state.labelRef.current, id]);
|
|
5090
|
-
var slot = useMemo(function () {
|
|
5091
|
-
return {
|
|
5092
|
-
open: state.listboxState === ListboxStates.Open,
|
|
5093
|
-
disabled: state.disabled
|
|
5094
|
-
};
|
|
5095
|
-
}, [state]);
|
|
5096
|
-
var passthroughProps = props;
|
|
5097
|
-
var propsWeControl = {
|
|
5098
|
-
ref: buttonRef,
|
|
5099
|
-
id: id,
|
|
5100
|
-
type: useResolveButtonType(props, state.buttonRef),
|
|
5101
|
-
'aria-haspopup': true,
|
|
5102
|
-
'aria-controls': (_state$optionsRef$cur = state.optionsRef.current) == null ? void 0 : _state$optionsRef$cur.id,
|
|
5103
|
-
'aria-expanded': state.disabled ? undefined : state.listboxState === ListboxStates.Open,
|
|
5104
|
-
'aria-labelledby': labelledby,
|
|
5105
|
-
disabled: state.disabled,
|
|
5106
|
-
onKeyDown: handleKeyDown,
|
|
5107
|
-
onKeyUp: handleKeyUp,
|
|
5108
|
-
onClick: handleClick
|
|
5109
|
-
};
|
|
5110
|
-
return render({
|
|
5111
|
-
props: _extends$1({}, passthroughProps, propsWeControl),
|
|
5112
|
-
slot: slot,
|
|
5113
|
-
defaultTag: DEFAULT_BUTTON_TAG,
|
|
5114
|
-
name: 'Listbox.Button'
|
|
5115
|
-
});
|
|
5116
|
-
}); // ---
|
|
5117
|
-
|
|
5118
|
-
var DEFAULT_LABEL_TAG$1 = 'label';
|
|
5119
|
-
|
|
5120
|
-
function Label$4(props) {
|
|
5121
|
-
var _useListboxContext2 = useListboxContext([Listbox.name, Label$4.name].join('.')),
|
|
5122
|
-
state = _useListboxContext2[0];
|
|
5123
|
-
|
|
5124
|
-
var id = "headlessui-listbox-label-" + useId();
|
|
5125
|
-
var handleClick = useCallback(function () {
|
|
5126
|
-
var _state$buttonRef$curr2;
|
|
5127
|
-
|
|
5128
|
-
return (_state$buttonRef$curr2 = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr2.focus({
|
|
5129
|
-
preventScroll: true
|
|
5130
|
-
});
|
|
5131
|
-
}, [state.buttonRef]);
|
|
5132
|
-
var slot = useMemo(function () {
|
|
5133
|
-
return {
|
|
5134
|
-
open: state.listboxState === ListboxStates.Open,
|
|
5135
|
-
disabled: state.disabled
|
|
5136
|
-
};
|
|
5137
|
-
}, [state]);
|
|
5138
|
-
var propsWeControl = {
|
|
5139
|
-
ref: state.labelRef,
|
|
5140
|
-
id: id,
|
|
5141
|
-
onClick: handleClick
|
|
5142
|
-
};
|
|
5143
|
-
return render({
|
|
5144
|
-
props: _extends$1({}, props, propsWeControl),
|
|
5145
|
-
slot: slot,
|
|
5146
|
-
defaultTag: DEFAULT_LABEL_TAG$1,
|
|
5147
|
-
name: 'Listbox.Label'
|
|
5148
|
-
});
|
|
5149
|
-
} // ---
|
|
5150
|
-
|
|
5151
|
-
|
|
5152
|
-
var DEFAULT_OPTIONS_TAG = 'ul';
|
|
5153
|
-
var OptionsRenderFeatures = Features.RenderStrategy | Features.Static;
|
|
5154
|
-
var Options = /*#__PURE__*/forwardRefWithAs(function Options(props, ref) {
|
|
5155
|
-
var _state$options$state$;
|
|
5156
|
-
|
|
5157
|
-
var _useListboxContext3 = useListboxContext([Listbox.name, Options.name].join('.')),
|
|
5158
|
-
state = _useListboxContext3[0],
|
|
5159
|
-
dispatch = _useListboxContext3[1];
|
|
5160
|
-
|
|
5161
|
-
var optionsRef = useSyncRefs(state.optionsRef, ref);
|
|
5162
|
-
var id = "headlessui-listbox-options-" + useId();
|
|
5163
|
-
var d = useDisposables();
|
|
5164
|
-
var searchDisposables = useDisposables();
|
|
5165
|
-
var usesOpenClosedState = useOpenClosed();
|
|
5166
|
-
|
|
5167
|
-
var visible = function () {
|
|
5168
|
-
if (usesOpenClosedState !== null) {
|
|
5169
|
-
return usesOpenClosedState === State.Open;
|
|
5170
|
-
}
|
|
5171
|
-
|
|
5172
|
-
return state.listboxState === ListboxStates.Open;
|
|
5173
|
-
}();
|
|
5174
|
-
|
|
5175
|
-
useIsoMorphicEffect(function () {
|
|
5176
|
-
var container = state.optionsRef.current;
|
|
5177
|
-
if (!container) return;
|
|
5178
|
-
if (state.listboxState !== ListboxStates.Open) return;
|
|
5179
|
-
if (container === document.activeElement) return;
|
|
5180
|
-
container.focus({
|
|
5181
|
-
preventScroll: true
|
|
5182
|
-
});
|
|
5183
|
-
}, [state.listboxState, state.optionsRef]);
|
|
5184
|
-
var handleKeyDown = useCallback(function (event) {
|
|
5185
|
-
searchDisposables.dispose();
|
|
5186
|
-
|
|
5187
|
-
switch (event.key) {
|
|
5188
|
-
// Ref: https://www.w3.org/TR/wai-aria-practices-1.2/#keyboard-interaction-12
|
|
5189
|
-
// @ts-expect-error Fallthrough is expected here
|
|
5190
|
-
case Keys.Space:
|
|
5191
|
-
if (state.searchQuery !== '') {
|
|
5192
|
-
event.preventDefault();
|
|
5193
|
-
event.stopPropagation();
|
|
5194
|
-
return dispatch({
|
|
5195
|
-
type: ActionTypes$1.Search,
|
|
5196
|
-
value: event.key
|
|
5197
|
-
});
|
|
5198
|
-
}
|
|
5199
|
-
|
|
5200
|
-
// When in type ahead mode, fallthrough
|
|
5201
|
-
|
|
5202
|
-
case Keys.Enter:
|
|
5203
|
-
event.preventDefault();
|
|
5204
|
-
event.stopPropagation();
|
|
5205
|
-
dispatch({
|
|
5206
|
-
type: ActionTypes$1.CloseListbox
|
|
5207
|
-
});
|
|
5208
|
-
|
|
5209
|
-
if (state.activeOptionIndex !== null) {
|
|
5210
|
-
var dataRef = state.options[state.activeOptionIndex].dataRef;
|
|
5211
|
-
state.propsRef.current.onChange(dataRef.current.value);
|
|
5212
|
-
}
|
|
5213
|
-
|
|
5214
|
-
disposables().nextFrame(function () {
|
|
5215
|
-
var _state$buttonRef$curr3;
|
|
5216
|
-
|
|
5217
|
-
return (_state$buttonRef$curr3 = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr3.focus({
|
|
5218
|
-
preventScroll: true
|
|
5219
|
-
});
|
|
5220
|
-
});
|
|
5221
|
-
break;
|
|
5222
|
-
|
|
5223
|
-
case match(state.orientation, {
|
|
5224
|
-
vertical: Keys.ArrowDown,
|
|
5225
|
-
horizontal: Keys.ArrowRight
|
|
5226
|
-
}):
|
|
5227
|
-
event.preventDefault();
|
|
5228
|
-
event.stopPropagation();
|
|
5229
|
-
return dispatch({
|
|
5230
|
-
type: ActionTypes$1.GoToOption,
|
|
5231
|
-
focus: Focus.Next
|
|
5232
|
-
});
|
|
5233
|
-
|
|
5234
|
-
case match(state.orientation, {
|
|
5235
|
-
vertical: Keys.ArrowUp,
|
|
5236
|
-
horizontal: Keys.ArrowLeft
|
|
5237
|
-
}):
|
|
5238
|
-
event.preventDefault();
|
|
5239
|
-
event.stopPropagation();
|
|
5240
|
-
return dispatch({
|
|
5241
|
-
type: ActionTypes$1.GoToOption,
|
|
5242
|
-
focus: Focus.Previous
|
|
5243
|
-
});
|
|
5244
|
-
|
|
5245
|
-
case Keys.Home:
|
|
5246
|
-
case Keys.PageUp:
|
|
5247
|
-
event.preventDefault();
|
|
5248
|
-
event.stopPropagation();
|
|
5249
|
-
return dispatch({
|
|
5250
|
-
type: ActionTypes$1.GoToOption,
|
|
5251
|
-
focus: Focus.First
|
|
5252
|
-
});
|
|
5253
|
-
|
|
5254
|
-
case Keys.End:
|
|
5255
|
-
case Keys.PageDown:
|
|
5256
|
-
event.preventDefault();
|
|
5257
|
-
event.stopPropagation();
|
|
5258
|
-
return dispatch({
|
|
5259
|
-
type: ActionTypes$1.GoToOption,
|
|
5260
|
-
focus: Focus.Last
|
|
5261
|
-
});
|
|
5262
|
-
|
|
5263
|
-
case Keys.Escape:
|
|
5264
|
-
event.preventDefault();
|
|
5265
|
-
event.stopPropagation();
|
|
5266
|
-
dispatch({
|
|
5267
|
-
type: ActionTypes$1.CloseListbox
|
|
5268
|
-
});
|
|
5269
|
-
return d.nextFrame(function () {
|
|
5270
|
-
var _state$buttonRef$curr4;
|
|
5271
|
-
|
|
5272
|
-
return (_state$buttonRef$curr4 = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr4.focus({
|
|
5273
|
-
preventScroll: true
|
|
5274
|
-
});
|
|
5275
|
-
});
|
|
5276
|
-
|
|
5277
|
-
case Keys.Tab:
|
|
5278
|
-
event.preventDefault();
|
|
5279
|
-
event.stopPropagation();
|
|
5280
|
-
break;
|
|
5281
|
-
|
|
5282
|
-
default:
|
|
5283
|
-
if (event.key.length === 1) {
|
|
5284
|
-
dispatch({
|
|
5285
|
-
type: ActionTypes$1.Search,
|
|
5286
|
-
value: event.key
|
|
5287
|
-
});
|
|
5288
|
-
searchDisposables.setTimeout(function () {
|
|
5289
|
-
return dispatch({
|
|
5290
|
-
type: ActionTypes$1.ClearSearch
|
|
5291
|
-
});
|
|
5292
|
-
}, 350);
|
|
5293
|
-
}
|
|
5294
|
-
|
|
5295
|
-
break;
|
|
5296
|
-
}
|
|
5297
|
-
}, [d, dispatch, searchDisposables, state]);
|
|
5298
|
-
var labelledby = useComputed(function () {
|
|
5299
|
-
var _state$labelRef$curre, _state$labelRef$curre2, _state$buttonRef$curr5;
|
|
5300
|
-
|
|
5301
|
-
return (_state$labelRef$curre = (_state$labelRef$curre2 = state.labelRef.current) == null ? void 0 : _state$labelRef$curre2.id) != null ? _state$labelRef$curre : (_state$buttonRef$curr5 = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr5.id;
|
|
5302
|
-
}, [state.labelRef.current, state.buttonRef.current]);
|
|
5303
|
-
var slot = useMemo(function () {
|
|
5304
|
-
return {
|
|
5305
|
-
open: state.listboxState === ListboxStates.Open
|
|
5306
|
-
};
|
|
5307
|
-
}, [state]);
|
|
5308
|
-
var propsWeControl = {
|
|
5309
|
-
'aria-activedescendant': state.activeOptionIndex === null ? undefined : (_state$options$state$ = state.options[state.activeOptionIndex]) == null ? void 0 : _state$options$state$.id,
|
|
5310
|
-
'aria-labelledby': labelledby,
|
|
5311
|
-
'aria-orientation': state.orientation,
|
|
5312
|
-
id: id,
|
|
5313
|
-
onKeyDown: handleKeyDown,
|
|
5314
|
-
role: 'listbox',
|
|
5315
|
-
tabIndex: 0,
|
|
5316
|
-
ref: optionsRef
|
|
5317
|
-
};
|
|
5318
|
-
var passthroughProps = props;
|
|
5319
|
-
return render({
|
|
5320
|
-
props: _extends$1({}, passthroughProps, propsWeControl),
|
|
5321
|
-
slot: slot,
|
|
5322
|
-
defaultTag: DEFAULT_OPTIONS_TAG,
|
|
5323
|
-
features: OptionsRenderFeatures,
|
|
5324
|
-
visible: visible,
|
|
5325
|
-
name: 'Listbox.Options'
|
|
5326
|
-
});
|
|
5327
|
-
}); // ---
|
|
5328
|
-
|
|
5329
|
-
var DEFAULT_OPTION_TAG$1 = 'li';
|
|
5330
|
-
|
|
5331
|
-
function Option$2(props) {
|
|
5332
|
-
var _props$disabled2 = props.disabled,
|
|
5333
|
-
disabled = _props$disabled2 === void 0 ? false : _props$disabled2,
|
|
5334
|
-
value = props.value,
|
|
5335
|
-
passthroughProps = _objectWithoutPropertiesLoose$1(props, ["disabled", "value"]);
|
|
5336
|
-
|
|
5337
|
-
var _useListboxContext4 = useListboxContext([Listbox.name, Option$2.name].join('.')),
|
|
5338
|
-
state = _useListboxContext4[0],
|
|
5339
|
-
dispatch = _useListboxContext4[1];
|
|
5340
|
-
|
|
5341
|
-
var id = "headlessui-listbox-option-" + useId();
|
|
5342
|
-
var active = state.activeOptionIndex !== null ? state.options[state.activeOptionIndex].id === id : false;
|
|
5343
|
-
var selected = state.propsRef.current.value === value;
|
|
5344
|
-
var bag = useRef({
|
|
5345
|
-
disabled: disabled,
|
|
5346
|
-
value: value
|
|
5347
|
-
});
|
|
5348
|
-
useIsoMorphicEffect(function () {
|
|
5349
|
-
bag.current.disabled = disabled;
|
|
5350
|
-
}, [bag, disabled]);
|
|
5351
|
-
useIsoMorphicEffect(function () {
|
|
5352
|
-
bag.current.value = value;
|
|
5353
|
-
}, [bag, value]);
|
|
5354
|
-
useIsoMorphicEffect(function () {
|
|
5355
|
-
var _document$getElementB, _document$getElementB2;
|
|
5356
|
-
|
|
5357
|
-
bag.current.textValue = (_document$getElementB = document.getElementById(id)) == null ? void 0 : (_document$getElementB2 = _document$getElementB.textContent) == null ? void 0 : _document$getElementB2.toLowerCase();
|
|
5358
|
-
}, [bag, id]);
|
|
5359
|
-
var select = useCallback(function () {
|
|
5360
|
-
return state.propsRef.current.onChange(value);
|
|
5361
|
-
}, [state.propsRef, value]);
|
|
5362
|
-
useIsoMorphicEffect(function () {
|
|
5363
|
-
dispatch({
|
|
5364
|
-
type: ActionTypes$1.RegisterOption,
|
|
5365
|
-
id: id,
|
|
5366
|
-
dataRef: bag
|
|
5367
|
-
});
|
|
5368
|
-
return function () {
|
|
5369
|
-
return dispatch({
|
|
5370
|
-
type: ActionTypes$1.UnregisterOption,
|
|
5371
|
-
id: id
|
|
5372
|
-
});
|
|
5373
|
-
};
|
|
5374
|
-
}, [bag, id]);
|
|
5375
|
-
useIsoMorphicEffect(function () {
|
|
5376
|
-
var _document$getElementB3;
|
|
5377
|
-
|
|
5378
|
-
if (state.listboxState !== ListboxStates.Open) return;
|
|
5379
|
-
if (!selected) return;
|
|
5380
|
-
dispatch({
|
|
5381
|
-
type: ActionTypes$1.GoToOption,
|
|
5382
|
-
focus: Focus.Specific,
|
|
5383
|
-
id: id
|
|
5384
|
-
});
|
|
5385
|
-
(_document$getElementB3 = document.getElementById(id)) == null ? void 0 : _document$getElementB3.focus == null ? void 0 : _document$getElementB3.focus();
|
|
5386
|
-
}, [state.listboxState]);
|
|
5387
|
-
useIsoMorphicEffect(function () {
|
|
5388
|
-
if (state.listboxState !== ListboxStates.Open) return;
|
|
5389
|
-
if (!active) return;
|
|
5390
|
-
var d = disposables();
|
|
5391
|
-
d.nextFrame(function () {
|
|
5392
|
-
var _document$getElementB4;
|
|
5393
|
-
|
|
5394
|
-
return (_document$getElementB4 = document.getElementById(id)) == null ? void 0 : _document$getElementB4.scrollIntoView == null ? void 0 : _document$getElementB4.scrollIntoView({
|
|
5395
|
-
block: 'nearest'
|
|
5396
|
-
});
|
|
5397
|
-
});
|
|
5398
|
-
return d.dispose;
|
|
5399
|
-
}, [id, active, state.listboxState]);
|
|
5400
|
-
var handleClick = useCallback(function (event) {
|
|
5401
|
-
if (disabled) return event.preventDefault();
|
|
5402
|
-
select();
|
|
5403
|
-
dispatch({
|
|
5404
|
-
type: ActionTypes$1.CloseListbox
|
|
5405
|
-
});
|
|
5406
|
-
disposables().nextFrame(function () {
|
|
5407
|
-
var _state$buttonRef$curr6;
|
|
5408
|
-
|
|
5409
|
-
return (_state$buttonRef$curr6 = state.buttonRef.current) == null ? void 0 : _state$buttonRef$curr6.focus({
|
|
5410
|
-
preventScroll: true
|
|
5411
|
-
});
|
|
5412
|
-
});
|
|
5413
|
-
}, [dispatch, state.buttonRef, disabled, select]);
|
|
5414
|
-
var handleFocus = useCallback(function () {
|
|
5415
|
-
if (disabled) return dispatch({
|
|
5416
|
-
type: ActionTypes$1.GoToOption,
|
|
5417
|
-
focus: Focus.Nothing
|
|
5418
|
-
});
|
|
5419
|
-
dispatch({
|
|
5420
|
-
type: ActionTypes$1.GoToOption,
|
|
5421
|
-
focus: Focus.Specific,
|
|
5422
|
-
id: id
|
|
5423
|
-
});
|
|
5424
|
-
}, [disabled, id, dispatch]);
|
|
5425
|
-
var handleMove = useCallback(function () {
|
|
5426
|
-
if (disabled) return;
|
|
5427
|
-
if (active) return;
|
|
5428
|
-
dispatch({
|
|
5429
|
-
type: ActionTypes$1.GoToOption,
|
|
5430
|
-
focus: Focus.Specific,
|
|
5431
|
-
id: id
|
|
5432
|
-
});
|
|
5433
|
-
}, [disabled, active, id, dispatch]);
|
|
5434
|
-
var handleLeave = useCallback(function () {
|
|
5435
|
-
if (disabled) return;
|
|
5436
|
-
if (!active) return;
|
|
5437
|
-
dispatch({
|
|
5438
|
-
type: ActionTypes$1.GoToOption,
|
|
5439
|
-
focus: Focus.Nothing
|
|
5440
|
-
});
|
|
5441
|
-
}, [disabled, active, dispatch]);
|
|
5442
|
-
var slot = useMemo(function () {
|
|
5443
|
-
return {
|
|
5444
|
-
active: active,
|
|
5445
|
-
selected: selected,
|
|
5446
|
-
disabled: disabled
|
|
5447
|
-
};
|
|
5448
|
-
}, [active, selected, disabled]);
|
|
5449
|
-
var propsWeControl = {
|
|
5450
|
-
id: id,
|
|
5451
|
-
role: 'option',
|
|
5452
|
-
tabIndex: disabled === true ? undefined : -1,
|
|
5453
|
-
'aria-disabled': disabled === true ? true : undefined,
|
|
5454
|
-
'aria-selected': selected === true ? true : undefined,
|
|
5455
|
-
disabled: undefined,
|
|
5456
|
-
onClick: handleClick,
|
|
5457
|
-
onFocus: handleFocus,
|
|
5458
|
-
onPointerMove: handleMove,
|
|
5459
|
-
onMouseMove: handleMove,
|
|
5460
|
-
onPointerLeave: handleLeave,
|
|
5461
|
-
onMouseLeave: handleLeave
|
|
5462
|
-
};
|
|
5463
|
-
return render({
|
|
5464
|
-
props: _extends$1({}, passthroughProps, propsWeControl),
|
|
5465
|
-
slot: slot,
|
|
5466
|
-
defaultTag: DEFAULT_OPTION_TAG$1,
|
|
5467
|
-
name: 'Listbox.Option'
|
|
5468
|
-
});
|
|
5469
|
-
} // ---
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
Listbox.Button = Button$6;
|
|
5473
|
-
Listbox.Label = Label$4;
|
|
5474
|
-
Listbox.Options = Options;
|
|
5475
|
-
Listbox.Option = Option$2;
|
|
5476
|
-
|
|
5477
|
-
function useTreeWalker(_ref) {
|
|
5478
|
-
var container = _ref.container,
|
|
5479
|
-
accept = _ref.accept,
|
|
5480
|
-
walk = _ref.walk,
|
|
5481
|
-
_ref$enabled = _ref.enabled,
|
|
5482
|
-
enabled = _ref$enabled === void 0 ? true : _ref$enabled;
|
|
5483
|
-
var acceptRef = useRef(accept);
|
|
5484
|
-
var walkRef = useRef(walk);
|
|
5485
|
-
useEffect(function () {
|
|
5486
|
-
acceptRef.current = accept;
|
|
5487
|
-
walkRef.current = walk;
|
|
5488
|
-
}, [accept, walk]);
|
|
5489
|
-
useIsoMorphicEffect(function () {
|
|
5490
|
-
if (!container) return;
|
|
5491
|
-
if (!enabled) return;
|
|
5492
|
-
var accept = acceptRef.current;
|
|
5493
|
-
var walk = walkRef.current;
|
|
5494
|
-
var acceptNode = Object.assign(function (node) {
|
|
5495
|
-
return accept(node);
|
|
5496
|
-
}, {
|
|
5497
|
-
acceptNode: accept
|
|
5498
|
-
});
|
|
5499
|
-
var walker = document.createTreeWalker(container, NodeFilter.SHOW_ELEMENT, acceptNode, false);
|
|
5500
|
-
|
|
5501
|
-
while (walker.nextNode()) {
|
|
5502
|
-
walk(walker.currentNode);
|
|
5503
|
-
}
|
|
5504
|
-
}, [container, enabled, acceptRef, walkRef]);
|
|
5505
|
-
}
|
|
5506
|
-
|
|
5507
|
-
function useFlags(initialFlags) {
|
|
5508
|
-
if (initialFlags === void 0) {
|
|
5509
|
-
initialFlags = 0;
|
|
5510
|
-
}
|
|
5511
|
-
|
|
5512
|
-
var _useState = useState(initialFlags),
|
|
5513
|
-
flags = _useState[0],
|
|
5514
|
-
setFlags = _useState[1];
|
|
5515
|
-
|
|
5516
|
-
var addFlag = useCallback(function (flag) {
|
|
5517
|
-
return setFlags(function (flags) {
|
|
5518
|
-
return flags | flag;
|
|
5519
|
-
});
|
|
5520
|
-
}, [setFlags]);
|
|
5521
|
-
var hasFlag = useCallback(function (flag) {
|
|
5522
|
-
return Boolean(flags & flag);
|
|
5523
|
-
}, [flags]);
|
|
5524
|
-
var removeFlag = useCallback(function (flag) {
|
|
5525
|
-
return setFlags(function (flags) {
|
|
5526
|
-
return flags & ~flag;
|
|
5527
|
-
});
|
|
5528
|
-
}, [setFlags]);
|
|
5529
|
-
var toggleFlag = useCallback(function (flag) {
|
|
5530
|
-
return setFlags(function (flags) {
|
|
5531
|
-
return flags ^ flag;
|
|
5532
|
-
});
|
|
5533
|
-
}, [setFlags]);
|
|
5534
|
-
return {
|
|
5535
|
-
addFlag: addFlag,
|
|
5536
|
-
hasFlag: hasFlag,
|
|
5537
|
-
removeFlag: removeFlag,
|
|
5538
|
-
toggleFlag: toggleFlag
|
|
5539
|
-
};
|
|
5540
|
-
}
|
|
3436
|
+
.join('\n'), "\n }\n "));
|
|
3437
|
+
};
|
|
3438
|
+
var transformThemeIntoVariables = function (_a) {
|
|
3439
|
+
// eslint-disable-next-line
|
|
3440
|
+
_a.name; var _b = _a.fonts, fonts = _b === void 0 ? { url: '', config: [] } : _b, theme = __rest(_a, ["name", "fonts"]);
|
|
3441
|
+
var variables = {};
|
|
3442
|
+
var pending = {};
|
|
3443
|
+
transformToVariables('-', variables, __assign({}, theme), pending);
|
|
3444
|
+
for (var key in pending) {
|
|
3445
|
+
var valueKey = pending[key];
|
|
3446
|
+
if (valueKey in variables === false) {
|
|
3447
|
+
delete variables[key];
|
|
3448
|
+
continue;
|
|
3449
|
+
}
|
|
3450
|
+
variables[key] = "var(".concat(valueKey, ")");
|
|
3451
|
+
}
|
|
3452
|
+
return stringify(variables) + transformFonts(fonts);
|
|
3453
|
+
};
|
|
3454
|
+
var transformFonts = function (fonts) {
|
|
3455
|
+
if (fonts.config.length === 0) {
|
|
3456
|
+
return '';
|
|
3457
|
+
}
|
|
3458
|
+
var css = fonts.config
|
|
3459
|
+
.map(function (font) {
|
|
3460
|
+
var css = [
|
|
3461
|
+
"font-family: \"".concat(font.family, "\""),
|
|
3462
|
+
"src: url(\"".concat(fonts.url, "/").concat(font.src, "\") format(\"opentype\")"),
|
|
3463
|
+
];
|
|
3464
|
+
if (font.weight) {
|
|
3465
|
+
css.push("font-weight: ".concat(font.weight));
|
|
3466
|
+
}
|
|
3467
|
+
if (font.stretch) {
|
|
3468
|
+
css.push("font-stretch: ".concat(font.stretch));
|
|
3469
|
+
}
|
|
3470
|
+
if (font.style) {
|
|
3471
|
+
css.push("font-style: ".concat(font.style));
|
|
3472
|
+
}
|
|
3473
|
+
return inline("@font-face { ".concat(css.join(';\n'), "; }"));
|
|
3474
|
+
})
|
|
3475
|
+
.join('\n');
|
|
3476
|
+
return inline("\n ".concat(css, "\n body {\n font-family: \"").concat(fonts.config[0].family, "\";\n }\n "));
|
|
3477
|
+
};
|
|
3478
|
+
var inline = function (text) {
|
|
3479
|
+
return text.trim().replace(/\s+/g, ' ').replace(/\n/g, '');
|
|
3480
|
+
};
|
|
5541
3481
|
|
|
5542
|
-
var
|
|
3482
|
+
var ThemeProvider = function (_a) {
|
|
3483
|
+
var theme = _a.theme, children = _a.children;
|
|
3484
|
+
var parsedTheme = useMemo(function () { return applyVariablesIntoTheme(theme); }, [theme]);
|
|
3485
|
+
return (jsx$1(ThemeProvider$1, __assign({ theme: parsedTheme }, { children: jsx$1(AssetsProvider, __assign({ assets: parsedTheme.assets }, { children: children }), void 0) }), void 0));
|
|
3486
|
+
};
|
|
3487
|
+
var useTheme = function () { return useTheme$1(); };
|
|
3488
|
+
var DefaultContainer = function (props) { return jsx$1("div", __assign({}, props), void 0); };
|
|
3489
|
+
var ThemeVariables = function (_a) {
|
|
3490
|
+
var _b;
|
|
3491
|
+
var theme = _a.theme, _c = _a.Container, Container = _c === void 0 ? DefaultContainer : _c;
|
|
3492
|
+
var _d = useState(function () { return transformThemeIntoVariables(theme); }), variables = _d[0], setVariables = _d[1];
|
|
3493
|
+
useEffect(function () {
|
|
3494
|
+
setVariables(transformThemeIntoVariables(theme));
|
|
3495
|
+
}, [theme]);
|
|
3496
|
+
return (jsx$1(Container, { children: jsx$1("style", { "data-theme-name": ((_b = theme.name) === null || _b === void 0 ? void 0 : _b.toLowerCase()) || 'unamed-theme', dangerouslySetInnerHTML: { __html: variables } }, void 0) }, void 0));
|
|
3497
|
+
};
|
|
3498
|
+
var AssetsContext = createContext({
|
|
3499
|
+
images: {
|
|
3500
|
+
favicon: '',
|
|
3501
|
+
logo: '',
|
|
3502
|
+
},
|
|
3503
|
+
});
|
|
3504
|
+
var AssetsProvider = function (_a) {
|
|
3505
|
+
var assets = _a.assets, children = _a.children;
|
|
3506
|
+
var context = useMemo(function () { return assets; }, [assets]);
|
|
3507
|
+
return jsx$1(AssetsContext.Provider, __assign({ value: context }, { children: children }), void 0);
|
|
3508
|
+
};
|
|
3509
|
+
var useThemeAssets = function () { return useContext(AssetsContext); };
|
|
5543
3510
|
|
|
5544
|
-
function
|
|
5545
|
-
|
|
3511
|
+
var Container$F = newStyled.div(templateObject_1$13 || (templateObject_1$13 = __makeTemplateObject(["\n ", "\n width: ", ";\n background: ", ";\n border-radius: ", ";\n border: ", ";\n"], ["\n ", "\n width: ", ";\n background: ", ";\n border-radius: ", ";\n border: ", ";\n"])), function (_a) {
|
|
3512
|
+
var flex = _a.flex;
|
|
3513
|
+
return flex &&
|
|
3514
|
+
"display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;";
|
|
3515
|
+
}, function (_a) {
|
|
3516
|
+
var widthAuto = _a.widthAuto;
|
|
3517
|
+
return (widthAuto ? 'auto' : 'fit-content');
|
|
3518
|
+
}, function (props) { return props.backgroundColor; }, function (props) { return props.theme.component.card.borderRadius; }, function (props) {
|
|
3519
|
+
return props.border ? "".concat(props.border.borderWidth, " solid ").concat(props.border.borderColor) : 'none';
|
|
3520
|
+
});
|
|
3521
|
+
var Card = function (_a) {
|
|
3522
|
+
var children = _a.children, backgroundColor = _a.backgroundColor, _b = _a.widthAuto, widthAuto = _b === void 0 ? true : _b, border = _a.border, _c = _a.flex, flex = _c === void 0 ? true : _c;
|
|
3523
|
+
var theme = useTheme();
|
|
3524
|
+
return (jsx$1(Container$F, __assign({ backgroundColor: backgroundColor, widthAuto: widthAuto, border: border, flex: flex, "data-testid": "CardContainer", theme: theme }, { children: children }), void 0));
|
|
3525
|
+
};
|
|
3526
|
+
var Card$1 = Object.assign(Card, {
|
|
3527
|
+
Header: CardHeader,
|
|
3528
|
+
Footer: CardFooter,
|
|
3529
|
+
Body: CardBody,
|
|
3530
|
+
});
|
|
3531
|
+
var templateObject_1$13;
|
|
5546
3532
|
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
|
|
3533
|
+
var Fragment = Fragment$1;
|
|
3534
|
+
function jsx(type, props, key) {
|
|
3535
|
+
if (!hasOwnProperty$1.call(props, 'css')) {
|
|
3536
|
+
return jsx$1(type, props, key);
|
|
5551
3537
|
}
|
|
5552
3538
|
|
|
5553
|
-
return
|
|
5554
|
-
}
|
|
5555
|
-
|
|
5556
|
-
function useLabels() {
|
|
5557
|
-
var _useState = useState([]),
|
|
5558
|
-
labelIds = _useState[0],
|
|
5559
|
-
setLabelIds = _useState[1];
|
|
5560
|
-
|
|
5561
|
-
return [// The actual id's as string or undefined.
|
|
5562
|
-
labelIds.length > 0 ? labelIds.join(' ') : undefined, // The provider component
|
|
5563
|
-
useMemo(function () {
|
|
5564
|
-
return function LabelProvider(props) {
|
|
5565
|
-
var register = useCallback(function (value) {
|
|
5566
|
-
setLabelIds(function (existing) {
|
|
5567
|
-
return [].concat(existing, [value]);
|
|
5568
|
-
});
|
|
5569
|
-
return function () {
|
|
5570
|
-
return setLabelIds(function (existing) {
|
|
5571
|
-
var clone = existing.slice();
|
|
5572
|
-
var idx = clone.indexOf(value);
|
|
5573
|
-
if (idx !== -1) clone.splice(idx, 1);
|
|
5574
|
-
return clone;
|
|
5575
|
-
});
|
|
5576
|
-
};
|
|
5577
|
-
}, []);
|
|
5578
|
-
var contextBag = useMemo(function () {
|
|
5579
|
-
return {
|
|
5580
|
-
register: register,
|
|
5581
|
-
slot: props.slot,
|
|
5582
|
-
name: props.name,
|
|
5583
|
-
props: props.props
|
|
5584
|
-
};
|
|
5585
|
-
}, [register, props.slot, props.name, props.props]);
|
|
5586
|
-
return React__default.createElement(LabelContext.Provider, {
|
|
5587
|
-
value: contextBag
|
|
5588
|
-
}, props.children);
|
|
5589
|
-
};
|
|
5590
|
-
}, [setLabelIds])];
|
|
5591
|
-
} // ---
|
|
5592
|
-
|
|
5593
|
-
var DEFAULT_LABEL_TAG = 'label';
|
|
5594
|
-
function Label$3(props) {
|
|
5595
|
-
var _props$passive = props.passive,
|
|
5596
|
-
passive = _props$passive === void 0 ? false : _props$passive,
|
|
5597
|
-
passThroughProps = _objectWithoutPropertiesLoose$1(props, ["passive"]);
|
|
5598
|
-
|
|
5599
|
-
var context = useLabelContext();
|
|
5600
|
-
var id = "headlessui-label-" + useId();
|
|
5601
|
-
useIsoMorphicEffect(function () {
|
|
5602
|
-
return context.register(id);
|
|
5603
|
-
}, [id, context.register]);
|
|
5604
|
-
|
|
5605
|
-
var propsWeControl = _extends$1({}, context.props, {
|
|
5606
|
-
id: id
|
|
5607
|
-
});
|
|
5608
|
-
|
|
5609
|
-
var allProps = _extends$1({}, passThroughProps, propsWeControl); // @ts-expect-error props are dynamic via context, some components will
|
|
5610
|
-
// provide an onClick then we can delete it.
|
|
5611
|
-
|
|
5612
|
-
|
|
5613
|
-
if (passive) delete allProps['onClick'];
|
|
5614
|
-
return render({
|
|
5615
|
-
props: allProps,
|
|
5616
|
-
slot: context.slot || {},
|
|
5617
|
-
defaultTag: DEFAULT_LABEL_TAG,
|
|
5618
|
-
name: context.name || 'Label'
|
|
5619
|
-
});
|
|
3539
|
+
return jsx$1(Emotion, createEmotionProps(type, props), key);
|
|
5620
3540
|
}
|
|
5621
|
-
|
|
5622
|
-
|
|
5623
|
-
|
|
5624
|
-
|
|
5625
|
-
(function (ActionTypes) {
|
|
5626
|
-
ActionTypes[ActionTypes["RegisterOption"] = 0] = "RegisterOption";
|
|
5627
|
-
ActionTypes[ActionTypes["UnregisterOption"] = 1] = "UnregisterOption";
|
|
5628
|
-
})(ActionTypes || (ActionTypes = {}));
|
|
5629
|
-
|
|
5630
|
-
var reducers = (_reducers = {}, _reducers[ActionTypes.RegisterOption] = function (state, action) {
|
|
5631
|
-
return _extends$1({}, state, {
|
|
5632
|
-
options: [].concat(state.options, [{
|
|
5633
|
-
id: action.id,
|
|
5634
|
-
element: action.element,
|
|
5635
|
-
propsRef: action.propsRef
|
|
5636
|
-
}])
|
|
5637
|
-
});
|
|
5638
|
-
}, _reducers[ActionTypes.UnregisterOption] = function (state, action) {
|
|
5639
|
-
var options = state.options.slice();
|
|
5640
|
-
var idx = state.options.findIndex(function (radio) {
|
|
5641
|
-
return radio.id === action.id;
|
|
5642
|
-
});
|
|
5643
|
-
if (idx === -1) return state;
|
|
5644
|
-
options.splice(idx, 1);
|
|
5645
|
-
return _extends$1({}, state, {
|
|
5646
|
-
options: options
|
|
5647
|
-
});
|
|
5648
|
-
}, _reducers);
|
|
5649
|
-
var RadioGroupContext = /*#__PURE__*/createContext(null);
|
|
5650
|
-
RadioGroupContext.displayName = 'RadioGroupContext';
|
|
5651
|
-
|
|
5652
|
-
function useRadioGroupContext(component) {
|
|
5653
|
-
var context = useContext(RadioGroupContext);
|
|
5654
|
-
|
|
5655
|
-
if (context === null) {
|
|
5656
|
-
var err = new Error("<" + component + " /> is missing a parent <" + RadioGroup.name + " /> component.");
|
|
5657
|
-
if (Error.captureStackTrace) Error.captureStackTrace(err, useRadioGroupContext);
|
|
5658
|
-
throw err;
|
|
3541
|
+
function jsxs(type, props, key) {
|
|
3542
|
+
if (!hasOwnProperty$1.call(props, 'css')) {
|
|
3543
|
+
return jsxs$1(type, props, key);
|
|
5659
3544
|
}
|
|
5660
3545
|
|
|
5661
|
-
return
|
|
3546
|
+
return jsxs$1(Emotion, createEmotionProps(type, props), key);
|
|
5662
3547
|
}
|
|
5663
3548
|
|
|
5664
|
-
function
|
|
5665
|
-
|
|
5666
|
-
|
|
5667
|
-
|
|
5668
|
-
|
|
5669
|
-
|
|
5670
|
-
|
|
5671
|
-
|
|
5672
|
-
|
|
5673
|
-
|
|
5674
|
-
|
|
5675
|
-
|
|
5676
|
-
|
|
5677
|
-
var _useReducer = useReducer(stateReducer, {
|
|
5678
|
-
options: []
|
|
5679
|
-
}),
|
|
5680
|
-
options = _useReducer[0].options,
|
|
5681
|
-
dispatch = _useReducer[1];
|
|
5682
|
-
|
|
5683
|
-
var _useLabels = useLabels(),
|
|
5684
|
-
labelledby = _useLabels[0],
|
|
5685
|
-
LabelProvider = _useLabels[1];
|
|
5686
|
-
|
|
5687
|
-
var _useDescriptions = useDescriptions(),
|
|
5688
|
-
describedby = _useDescriptions[0],
|
|
5689
|
-
DescriptionProvider = _useDescriptions[1];
|
|
5690
|
-
|
|
5691
|
-
var id = "headlessui-radiogroup-" + useId();
|
|
5692
|
-
var radioGroupRef = useRef(null);
|
|
5693
|
-
var firstOption = useMemo(function () {
|
|
5694
|
-
return options.find(function (option) {
|
|
5695
|
-
if (option.propsRef.current.disabled) return false;
|
|
5696
|
-
return true;
|
|
5697
|
-
});
|
|
5698
|
-
}, [options]);
|
|
5699
|
-
var containsCheckedOption = useMemo(function () {
|
|
5700
|
-
return options.some(function (option) {
|
|
5701
|
-
return option.propsRef.current.value === value;
|
|
5702
|
-
});
|
|
5703
|
-
}, [options, value]);
|
|
5704
|
-
var triggerChange = useCallback(function (nextValue) {
|
|
5705
|
-
var _options$find;
|
|
5706
|
-
|
|
5707
|
-
if (disabled) return false;
|
|
5708
|
-
if (nextValue === value) return false;
|
|
5709
|
-
var nextOption = (_options$find = options.find(function (option) {
|
|
5710
|
-
return option.propsRef.current.value === nextValue;
|
|
5711
|
-
})) == null ? void 0 : _options$find.propsRef.current;
|
|
5712
|
-
if (nextOption == null ? void 0 : nextOption.disabled) return false;
|
|
5713
|
-
onChange(nextValue);
|
|
5714
|
-
return true;
|
|
5715
|
-
}, [onChange, value, disabled, options]);
|
|
5716
|
-
useTreeWalker({
|
|
5717
|
-
container: radioGroupRef.current,
|
|
5718
|
-
accept: function accept(node) {
|
|
5719
|
-
if (node.getAttribute('role') === 'radio') return NodeFilter.FILTER_REJECT;
|
|
5720
|
-
if (node.hasAttribute('role')) return NodeFilter.FILTER_SKIP;
|
|
5721
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
5722
|
-
},
|
|
5723
|
-
walk: function walk(node) {
|
|
5724
|
-
node.setAttribute('role', 'none');
|
|
5725
|
-
}
|
|
5726
|
-
});
|
|
5727
|
-
var handleKeyDown = useCallback(function (event) {
|
|
5728
|
-
var container = radioGroupRef.current;
|
|
5729
|
-
if (!container) return;
|
|
5730
|
-
var all = options.filter(function (option) {
|
|
5731
|
-
return option.propsRef.current.disabled === false;
|
|
5732
|
-
}).map(function (radio) {
|
|
5733
|
-
return radio.element.current;
|
|
5734
|
-
});
|
|
5735
|
-
|
|
5736
|
-
switch (event.key) {
|
|
5737
|
-
case Keys.ArrowLeft:
|
|
5738
|
-
case Keys.ArrowUp:
|
|
5739
|
-
{
|
|
5740
|
-
event.preventDefault();
|
|
5741
|
-
event.stopPropagation();
|
|
5742
|
-
var result = focusIn(all, Focus$1.Previous | Focus$1.WrapAround);
|
|
5743
|
-
|
|
5744
|
-
if (result === FocusResult.Success) {
|
|
5745
|
-
var activeOption = options.find(function (option) {
|
|
5746
|
-
return option.element.current === document.activeElement;
|
|
5747
|
-
});
|
|
5748
|
-
if (activeOption) triggerChange(activeOption.propsRef.current.value);
|
|
5749
|
-
}
|
|
5750
|
-
}
|
|
5751
|
-
break;
|
|
5752
|
-
|
|
5753
|
-
case Keys.ArrowRight:
|
|
5754
|
-
case Keys.ArrowDown:
|
|
5755
|
-
{
|
|
5756
|
-
event.preventDefault();
|
|
5757
|
-
event.stopPropagation();
|
|
5758
|
-
|
|
5759
|
-
var _result = focusIn(all, Focus$1.Next | Focus$1.WrapAround);
|
|
3549
|
+
var BaseButton = function (_a) {
|
|
3550
|
+
var children = _a.children, renderLeading = _a.renderLeading, renderTrailing = _a.renderTrailing, disabled = _a.disabled, _b = _a.type, type = _b === void 0 ? 'button' : _b, onClick = _a.onClick, className = _a.className, inline = _a.inline, _c = _a.testId, testId = _c === void 0 ? 'base-button' : _c;
|
|
3551
|
+
return (jsxs("button", __assign({ onClick: onClick, disabled: disabled, className: className, type: type, "data-testid": testId, css: {
|
|
3552
|
+
display: inline ? 'inline-flex' : 'flex',
|
|
3553
|
+
justifyContent: 'center',
|
|
3554
|
+
alignItems: 'center',
|
|
3555
|
+
padding: '0.75rem 2rem',
|
|
3556
|
+
textDecoration: 'none',
|
|
3557
|
+
textTransform: 'uppercase',
|
|
3558
|
+
boxSizing: 'border-box',
|
|
3559
|
+
cursor: 'pointer',
|
|
3560
|
+
} }, { children: [renderLeading, children, renderTrailing] }), void 0));
|
|
3561
|
+
};
|
|
5760
3562
|
|
|
5761
|
-
|
|
5762
|
-
|
|
5763
|
-
|
|
5764
|
-
|
|
3563
|
+
var getStylesBySize$9 = function (size, theme) {
|
|
3564
|
+
switch (size) {
|
|
3565
|
+
case ComponentSize.Large:
|
|
3566
|
+
return {
|
|
3567
|
+
fontSize: theme.component.button.size.large.fontSize,
|
|
3568
|
+
padding: theme.component.button.size.large.padding,
|
|
3569
|
+
};
|
|
3570
|
+
case ComponentSize.Medium:
|
|
3571
|
+
return {
|
|
3572
|
+
fontSize: theme.component.button.size.medium.fontSize,
|
|
3573
|
+
padding: theme.component.button.size.medium.padding,
|
|
3574
|
+
};
|
|
3575
|
+
case ComponentSize.Small:
|
|
3576
|
+
return {
|
|
3577
|
+
fontSize: theme.component.button.size.small.fontSize,
|
|
3578
|
+
padding: theme.component.button.size.small.padding,
|
|
3579
|
+
};
|
|
3580
|
+
default:
|
|
3581
|
+
return {
|
|
3582
|
+
fontSize: theme.component.button.size.small.fontSize,
|
|
3583
|
+
padding: theme.component.button.size.small.padding,
|
|
3584
|
+
};
|
|
3585
|
+
}
|
|
3586
|
+
};
|
|
3587
|
+
var BaseCTA = function (_a) {
|
|
3588
|
+
var text = _a.text, _b = _a.wide, wide = _b === void 0 ? false : _b, _c = _a.size, size = _c === void 0 ? ComponentSize.Medium : _c, props = __rest(_a, ["text", "wide", "size"]);
|
|
3589
|
+
var theme = useTheme();
|
|
3590
|
+
var stylesBySize = getStylesBySize$9(size, theme);
|
|
3591
|
+
return (jsx(BaseButton, __assign({}, props, { css: __assign(__assign({ width: wide ? '100%' : 'fit-content' }, stylesBySize), { fontWeight: theme.component.button.fontWeight, borderRadius: "".concat(theme.component.button.borderRadius), cursor: 'pointer', '&:disabled': {
|
|
3592
|
+
backgroundColor: theme.colors.background.disabled,
|
|
3593
|
+
color: theme.colors.text.disabled,
|
|
3594
|
+
cursor: 'not-allowed',
|
|
3595
|
+
} }) }, { children: text }), void 0));
|
|
3596
|
+
};
|
|
5765
3597
|
|
|
5766
|
-
|
|
5767
|
-
|
|
5768
|
-
|
|
5769
|
-
|
|
3598
|
+
var ButtonPrimary = function (_a) {
|
|
3599
|
+
_a.testId; var props = __rest(_a, ["testId"]);
|
|
3600
|
+
var theme = useTheme();
|
|
3601
|
+
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3602
|
+
backgroundColor: theme.component.button.primary.active.backgroundColor,
|
|
3603
|
+
color: theme.component.button.primary.active.color,
|
|
3604
|
+
border: theme.component.button.border,
|
|
3605
|
+
'&:hover': {
|
|
3606
|
+
backgroundColor: theme.component.button.primary.hover.backgroundColor,
|
|
3607
|
+
color: theme.component.button.primary.hover.color,
|
|
3608
|
+
},
|
|
3609
|
+
'&:disabled': {
|
|
3610
|
+
backgroundColor: theme.colors.background.disabled,
|
|
3611
|
+
color: theme.colors.text.disabled,
|
|
3612
|
+
},
|
|
3613
|
+
} }), void 0));
|
|
3614
|
+
};
|
|
5770
3615
|
|
|
5771
|
-
|
|
5772
|
-
|
|
5773
|
-
|
|
5774
|
-
|
|
3616
|
+
var ButtonSecondary = function (props) {
|
|
3617
|
+
var theme = useTheme();
|
|
3618
|
+
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3619
|
+
backgroundColor: theme.component.button.secondary.active.backgroundColor,
|
|
3620
|
+
color: theme.component.button.secondary.active.color,
|
|
3621
|
+
border: theme.component.button.border,
|
|
3622
|
+
'&:hover': {
|
|
3623
|
+
backgroundColor: theme.component.button.secondary.hover.backgroundColor,
|
|
3624
|
+
},
|
|
3625
|
+
'&:disabled': {
|
|
3626
|
+
backgroundColor: theme.colors.shades['50'].color,
|
|
3627
|
+
color: theme.colors.shades['250'].color,
|
|
3628
|
+
},
|
|
3629
|
+
} }), void 0));
|
|
3630
|
+
};
|
|
5775
3631
|
|
|
5776
|
-
|
|
5777
|
-
|
|
5778
|
-
|
|
3632
|
+
var ButtonSecondaryOutline = function (props) {
|
|
3633
|
+
var theme = useTheme();
|
|
3634
|
+
return (jsx(BaseCTA, __assign({}, props, { css: {
|
|
3635
|
+
backgroundColor: theme.component.button.secondary.active.color,
|
|
3636
|
+
color: theme.component.button.secondary.active.backgroundColor,
|
|
3637
|
+
border: "1px solid ".concat(theme.component.button.secondary.active.backgroundColor),
|
|
3638
|
+
'&:hover': {
|
|
3639
|
+
backgroundColor: theme.component.button.secondary.active.backgroundColor,
|
|
3640
|
+
color: theme.component.button.secondary.active.color,
|
|
3641
|
+
},
|
|
3642
|
+
'&:disabled': {
|
|
3643
|
+
backgroundColor: theme.colors.background.disabled,
|
|
3644
|
+
color: theme.colors.text.disabled,
|
|
3645
|
+
border: 'none',
|
|
3646
|
+
},
|
|
3647
|
+
} }), void 0));
|
|
3648
|
+
};
|
|
5779
3649
|
|
|
5780
|
-
|
|
5781
|
-
|
|
5782
|
-
|
|
5783
|
-
}
|
|
5784
|
-
}, [radioGroupRef, options, triggerChange]);
|
|
5785
|
-
var registerOption = useCallback(function (option) {
|
|
5786
|
-
dispatch(_extends$1({
|
|
5787
|
-
type: ActionTypes.RegisterOption
|
|
5788
|
-
}, option));
|
|
5789
|
-
return function () {
|
|
5790
|
-
return dispatch({
|
|
5791
|
-
type: ActionTypes.UnregisterOption,
|
|
5792
|
-
id: option.id
|
|
5793
|
-
});
|
|
5794
|
-
};
|
|
5795
|
-
}, [dispatch]);
|
|
5796
|
-
var api = useMemo(function () {
|
|
5797
|
-
return {
|
|
5798
|
-
registerOption: registerOption,
|
|
5799
|
-
firstOption: firstOption,
|
|
5800
|
-
containsCheckedOption: containsCheckedOption,
|
|
5801
|
-
change: triggerChange,
|
|
5802
|
-
disabled: disabled,
|
|
5803
|
-
value: value
|
|
5804
|
-
};
|
|
5805
|
-
}, [registerOption, firstOption, containsCheckedOption, triggerChange, disabled, value]);
|
|
5806
|
-
var propsWeControl = {
|
|
5807
|
-
ref: radioGroupRef,
|
|
5808
|
-
id: id,
|
|
5809
|
-
role: 'radiogroup',
|
|
5810
|
-
'aria-labelledby': labelledby,
|
|
5811
|
-
'aria-describedby': describedby,
|
|
5812
|
-
onKeyDown: handleKeyDown
|
|
5813
|
-
};
|
|
5814
|
-
return React__default.createElement(DescriptionProvider, {
|
|
5815
|
-
name: "RadioGroup.Description"
|
|
5816
|
-
}, React__default.createElement(LabelProvider, {
|
|
5817
|
-
name: "RadioGroup.Label"
|
|
5818
|
-
}, React__default.createElement(RadioGroupContext.Provider, {
|
|
5819
|
-
value: api
|
|
5820
|
-
}, render({
|
|
5821
|
-
props: _extends$1({}, passThroughProps, propsWeControl),
|
|
5822
|
-
defaultTag: DEFAULT_RADIO_GROUP_TAG,
|
|
5823
|
-
name: 'RadioGroup'
|
|
5824
|
-
}))));
|
|
5825
|
-
} // ---
|
|
5826
|
-
|
|
5827
|
-
var OptionState;
|
|
5828
|
-
|
|
5829
|
-
(function (OptionState) {
|
|
5830
|
-
OptionState[OptionState["Empty"] = 1] = "Empty";
|
|
5831
|
-
OptionState[OptionState["Active"] = 2] = "Active";
|
|
5832
|
-
})(OptionState || (OptionState = {}));
|
|
5833
|
-
|
|
5834
|
-
var DEFAULT_OPTION_TAG = 'div';
|
|
5835
|
-
|
|
5836
|
-
function Option$1(props) {
|
|
5837
|
-
var optionRef = useRef(null);
|
|
5838
|
-
var id = "headlessui-radiogroup-option-" + useId();
|
|
5839
|
-
|
|
5840
|
-
var _useLabels2 = useLabels(),
|
|
5841
|
-
labelledby = _useLabels2[0],
|
|
5842
|
-
LabelProvider = _useLabels2[1];
|
|
5843
|
-
|
|
5844
|
-
var _useDescriptions2 = useDescriptions(),
|
|
5845
|
-
describedby = _useDescriptions2[0],
|
|
5846
|
-
DescriptionProvider = _useDescriptions2[1];
|
|
5847
|
-
|
|
5848
|
-
var _useFlags = useFlags(OptionState.Empty),
|
|
5849
|
-
addFlag = _useFlags.addFlag,
|
|
5850
|
-
removeFlag = _useFlags.removeFlag,
|
|
5851
|
-
hasFlag = _useFlags.hasFlag;
|
|
5852
|
-
|
|
5853
|
-
var value = props.value,
|
|
5854
|
-
_props$disabled2 = props.disabled,
|
|
5855
|
-
disabled = _props$disabled2 === void 0 ? false : _props$disabled2,
|
|
5856
|
-
passThroughProps = _objectWithoutPropertiesLoose$1(props, ["value", "disabled"]);
|
|
5857
|
-
|
|
5858
|
-
var propsRef = useRef({
|
|
5859
|
-
value: value,
|
|
5860
|
-
disabled: disabled
|
|
5861
|
-
});
|
|
5862
|
-
useIsoMorphicEffect(function () {
|
|
5863
|
-
propsRef.current.value = value;
|
|
5864
|
-
}, [value, propsRef]);
|
|
5865
|
-
useIsoMorphicEffect(function () {
|
|
5866
|
-
propsRef.current.disabled = disabled;
|
|
5867
|
-
}, [disabled, propsRef]);
|
|
5868
|
-
|
|
5869
|
-
var _useRadioGroupContext = useRadioGroupContext([RadioGroup.name, Option$1.name].join('.')),
|
|
5870
|
-
registerOption = _useRadioGroupContext.registerOption,
|
|
5871
|
-
radioGroupDisabled = _useRadioGroupContext.disabled,
|
|
5872
|
-
change = _useRadioGroupContext.change,
|
|
5873
|
-
firstOption = _useRadioGroupContext.firstOption,
|
|
5874
|
-
containsCheckedOption = _useRadioGroupContext.containsCheckedOption,
|
|
5875
|
-
radioGroupValue = _useRadioGroupContext.value;
|
|
5876
|
-
|
|
5877
|
-
useIsoMorphicEffect(function () {
|
|
5878
|
-
return registerOption({
|
|
5879
|
-
id: id,
|
|
5880
|
-
element: optionRef,
|
|
5881
|
-
propsRef: propsRef
|
|
5882
|
-
});
|
|
5883
|
-
}, [id, registerOption, optionRef, props]);
|
|
5884
|
-
var handleClick = useCallback(function () {
|
|
5885
|
-
var _optionRef$current;
|
|
5886
|
-
|
|
5887
|
-
if (!change(value)) return;
|
|
5888
|
-
addFlag(OptionState.Active);
|
|
5889
|
-
(_optionRef$current = optionRef.current) == null ? void 0 : _optionRef$current.focus();
|
|
5890
|
-
}, [addFlag, change, value]);
|
|
5891
|
-
var handleFocus = useCallback(function () {
|
|
5892
|
-
return addFlag(OptionState.Active);
|
|
5893
|
-
}, [addFlag]);
|
|
5894
|
-
var handleBlur = useCallback(function () {
|
|
5895
|
-
return removeFlag(OptionState.Active);
|
|
5896
|
-
}, [removeFlag]);
|
|
5897
|
-
var isFirstOption = (firstOption == null ? void 0 : firstOption.id) === id;
|
|
5898
|
-
var isDisabled = radioGroupDisabled || disabled;
|
|
5899
|
-
var checked = radioGroupValue === value;
|
|
5900
|
-
var propsWeControl = {
|
|
5901
|
-
ref: optionRef,
|
|
5902
|
-
id: id,
|
|
5903
|
-
role: 'radio',
|
|
5904
|
-
'aria-checked': checked ? 'true' : 'false',
|
|
5905
|
-
'aria-labelledby': labelledby,
|
|
5906
|
-
'aria-describedby': describedby,
|
|
5907
|
-
'aria-disabled': isDisabled ? true : undefined,
|
|
5908
|
-
tabIndex: function () {
|
|
5909
|
-
if (isDisabled) return -1;
|
|
5910
|
-
if (checked) return 0;
|
|
5911
|
-
if (!containsCheckedOption && isFirstOption) return 0;
|
|
5912
|
-
return -1;
|
|
5913
|
-
}(),
|
|
5914
|
-
onClick: isDisabled ? undefined : handleClick,
|
|
5915
|
-
onFocus: isDisabled ? undefined : handleFocus,
|
|
5916
|
-
onBlur: isDisabled ? undefined : handleBlur
|
|
5917
|
-
};
|
|
5918
|
-
var slot = useMemo(function () {
|
|
5919
|
-
return {
|
|
5920
|
-
checked: checked,
|
|
5921
|
-
disabled: isDisabled,
|
|
5922
|
-
active: hasFlag(OptionState.Active)
|
|
5923
|
-
};
|
|
5924
|
-
}, [checked, isDisabled, hasFlag]);
|
|
5925
|
-
return React__default.createElement(DescriptionProvider, {
|
|
5926
|
-
name: "RadioGroup.Description"
|
|
5927
|
-
}, React__default.createElement(LabelProvider, {
|
|
5928
|
-
name: "RadioGroup.Label"
|
|
5929
|
-
}, render({
|
|
5930
|
-
props: _extends$1({}, passThroughProps, propsWeControl),
|
|
5931
|
-
slot: slot,
|
|
5932
|
-
defaultTag: DEFAULT_OPTION_TAG,
|
|
5933
|
-
name: 'RadioGroup.Option'
|
|
5934
|
-
})));
|
|
5935
|
-
} // ---
|
|
5936
|
-
|
|
5937
|
-
|
|
5938
|
-
RadioGroup.Option = Option$1;
|
|
5939
|
-
RadioGroup.Label = Label$3;
|
|
5940
|
-
RadioGroup.Description = Description$2;
|
|
3650
|
+
function k(){let e=[],t=[],r={enqueue(o){t.push(o);},requestAnimationFrame(...o){let n=requestAnimationFrame(...o);r.add(()=>cancelAnimationFrame(n));},nextFrame(...o){r.requestAnimationFrame(()=>{r.requestAnimationFrame(...o);});},setTimeout(...o){let n=setTimeout(...o);r.add(()=>clearTimeout(n));},add(o){e.push(o);},dispose(){for(let o of e.splice(0))o();},async workQueue(){for(let o of t.splice(0))await o();}};return r}function Q(){let[e]=useState(k);return useEffect(()=>()=>e.dispose(),[e]),e}var x=typeof window!="undefined"?useLayoutEffect:useEffect;var yt={serverHandoffComplete:!1};function q(){let[e,t]=useState(yt.serverHandoffComplete);return useEffect(()=>{e!==!0&&t(!0);},[e]),useEffect(()=>{yt.serverHandoffComplete===!1&&(yt.serverHandoffComplete=!0);},[]),e}var or=0;function to(){return ++or}function A(){let e=q(),[t,r]=useState(e?to:null);return x(()=>{t===null&&r(to());},[t]),t!=null?""+t:void 0}function ke(e){let t=useRef(e);return useEffect(()=>{t.current=e;},[e]),t}function ee(e,t){let[r,o]=useState(e),n=ke(e);return x(()=>o(n.current),[n,o,...t]),r}function I(...e){let t=useRef(e);return useEffect(()=>{t.current=e;},[e]),useCallback(r=>{for(let o of t.current)o!=null&&(typeof o=="function"?o(r):o.current=r);},[t])}function S(e,t,...r){if(e in t){let n=t[e];return typeof n=="function"?n(...r):n}let o=new Error(`Tried to handle "${e}" but there is no handler defined. Only defined handlers are: ${Object.keys(t).map(n=>`"${n}"`).join(", ")}.`);throw Error.captureStackTrace&&Error.captureStackTrace(o,S),o}function E({props:e,slot:t,defaultTag:r,features:o,visible:n=!0,name:i}){if(n)return _e(e,t,r,i);let a=o!=null?o:0;if(a&2){let{static:l=!1,...s}=e;if(l)return _e(s,t,r,i)}if(a&1){let{unmount:l=!0,...s}=e;return S(l?0:1,{[0](){return null},[1](){return _e({...s,hidden:!0,style:{display:"none"}},t,r,i)}})}return _e(e,t,r,i)}function _e(e,t={},r,o){let{as:n=r,children:i,refName:a="ref",...l}=gt(e,["unmount","static"]),s=e.ref!==void 0?{[a]:e.ref}:{},u=typeof i=="function"?i(t):i;if(l.className&&typeof l.className=="function"&&(l.className=l.className(t)),n===Fragment$2&&Object.keys(l).length>0){if(!isValidElement(u)||Array.isArray(u)&&u.length>1)throw new Error(['Passing props on "Fragment"!',"",`The current component <${o} /> is rendering a "Fragment".`,"However we need to passthrough the following props:",Object.keys(l).map(c=>` - ${c}`).join(`
|
|
3651
|
+
`),"","You can apply a few solutions:",['Add an `as="..."` prop, to ensure that we render an actual element instead of a "Fragment".',"Render a single element as the child so that we can forward the props onto that element."].map(c=>` - ${c}`).join(`
|
|
3652
|
+
`)].join(`
|
|
3653
|
+
`));return cloneElement(u,Object.assign({},fr(mr(gt(l,["ref"])),u.props,["onClick"]),s))}return createElement(n,Object.assign({},gt(l,["ref"]),n!==Fragment$2&&s),u)}function fr(e,t,r){let o=Object.assign({},e);for(let n of r)e[n]!==void 0&&t[n]!==void 0&&Object.assign(o,{[n](i){i.defaultPrevented||e[n](i),i.defaultPrevented||t[n](i);}});return o}function D(e){var t;return Object.assign(forwardRef(e),{displayName:(t=e.displayName)!=null?t:e.name})}function mr(e){let t=Object.assign({},e);for(let r in t)t[r]===void 0&&delete t[r];return t}function gt(e,t=[]){let r=Object.assign({},e);for(let o of t)o in r&&delete r[o];return r}function br(e){throw new Error("Unexpected object: "+e)}function ae(e,t){let r=t.resolveItems();if(r.length<=0)return null;let o=t.resolveActiveIndex(),n=o!=null?o:-1,i=(()=>{switch(e.focus){case 0:return r.findIndex(a=>!t.resolveDisabled(a));case 1:{let a=r.slice().reverse().findIndex((l,s,u)=>n!==-1&&u.length-s-1>=n?!1:!t.resolveDisabled(l));return a===-1?a:r.length-1-a}case 2:return r.findIndex((a,l)=>l<=n?!1:!t.resolveDisabled(a));case 3:{let a=r.slice().reverse().findIndex(l=>!t.resolveDisabled(l));return a===-1?a:r.length-1-a}case 4:return r.findIndex(a=>t.resolveId(a)===e.id);case 5:return null;default:br(e);}})();return i===-1?o:i}function G(e){let t=e.parentElement,r=null;for(;t&&!(t instanceof HTMLFieldSetElement);)t instanceof HTMLLegendElement&&(r=t),t=t.parentElement;let o=(t==null?void 0:t.getAttribute("disabled"))==="";return o&&Tr(r)?!1:o}function Tr(e){if(!e)return !1;let t=e.previousElementSibling;for(;t!==null;){if(t instanceof HTMLLegendElement)return !1;t=t.previousElementSibling;}return !0}function w(e,t,r){let o=useRef(t);o.current=t,useEffect(()=>{function n(i){o.current.call(window,i);}return window.addEventListener(e,n,r),()=>window.removeEventListener(e,n,r)},[e,r]);}var Pt=createContext(null);Pt.displayName="OpenClosedContext";function _(){return useContext(Pt)}function W({value:e,children:t}){return React__default.createElement(Pt.Provider,{value:e},t)}function ro(e){var r;if(e.type)return e.type;let t=(r=e.as)!=null?r:"button";if(typeof t=="string"&&t.toLowerCase()==="button")return "button"}function U(e,t){let[r,o]=useState(()=>ro(e));return x(()=>{o(ro(e));},[e.type,e.as]),x(()=>{r||!t.current||t.current instanceof HTMLButtonElement&&!t.current.hasAttribute("type")&&o("button");},[r,t]),r}function se({container:e,accept:t,walk:r,enabled:o=!0}){let n=useRef(t),i=useRef(r);useEffect(()=>{n.current=t,i.current=r;},[t,r]),x(()=>{if(!e||!o)return;let a=n.current,l=i.current,s=Object.assign(c=>a(c),{acceptNode:a}),u=document.createTreeWalker(e,NodeFilter.SHOW_ELEMENT,s,!1);for(;u.nextNode();)l(u.currentNode);},[e,o,n,i]);}var Ar={[1](e){return e.disabled||e.comboboxState===1?e:{...e,activeOptionIndex:null,comboboxState:1}},[0](e){return e.disabled||e.comboboxState===0?e:{...e,comboboxState:0}},[2](e,t){return e.disabled===t.disabled?e:{...e,disabled:t.disabled}},[3](e,t){if(e.disabled||e.optionsRef.current&&!e.optionsPropsRef.current.static&&e.comboboxState===1)return e;let r=ae(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.activeOptionIndex===r?e:{...e,activeOptionIndex:r}},[4]:(e,t)=>{var i;let r=e.activeOptionIndex!==null?e.options[e.activeOptionIndex]:null,o=Array.from((i=e.optionsRef.current)==null?void 0:i.querySelectorAll('[id^="headlessui-combobox-option-"]')).reduce((a,l,s)=>Object.assign(a,{[l.id]:s}),{}),n=[...e.options,{id:t.id,dataRef:t.dataRef}].sort((a,l)=>o[a.id]-o[l.id]);return {...e,options:n,activeOptionIndex:(()=>r===null?null:n.indexOf(r))()}},[5]:(e,t)=>{let r=e.options.slice(),o=e.activeOptionIndex!==null?r[e.activeOptionIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,options:r,activeOptionIndex:(()=>n===e.activeOptionIndex||o===null?null:r.indexOf(o))()}}},vt=createContext(null);vt.displayName="ComboboxContext";function pe(e){let t=useContext(vt);if(t===null){let r=new Error(`<${e} /> is missing a parent <Combobox /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,pe),r}return t}var Rt=createContext(null);Rt.displayName="ComboboxActions";function Ue(){let e=useContext(Rt);if(e===null){let t=new Error("ComboboxActions is missing a parent <Combobox /> component.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ue),t}return e}function hr(e,t){return S(t.type,Ar,e,t)}var Or=Fragment$2,Ir=D(function(t,r){let{value:o,onChange:n,disabled:i=!1,...a}=t,l=useRef({value:o,onChange:n}),s=useRef({static:!1,hold:!1}),u=useRef({displayValue:void 0}),c=useReducer(hr,{comboboxState:1,comboboxPropsRef:l,optionsPropsRef:s,inputPropsRef:u,labelRef:createRef(),inputRef:createRef(),buttonRef:createRef(),optionsRef:createRef(),disabled:i,options:[],activeOptionIndex:null}),[{comboboxState:m,options:b,activeOptionIndex:T,optionsRef:y,inputRef:p,buttonRef:f},d]=c;x(()=>{l.current.value=o;},[o,l]),x(()=>{l.current.onChange=n;},[n,l]),x(()=>d({type:2,disabled:i}),[i]),w("mousedown",O=>{var N,K,V;let L=O.target;m===0&&(((N=f.current)==null?void 0:N.contains(L))||((K=p.current)==null?void 0:K.contains(L))||((V=y.current)==null?void 0:V.contains(L))||d({type:1}));});let P=T===null?null:b[T].dataRef.current.value,C=useMemo(()=>({open:m===0,disabled:i,activeIndex:T,activeOption:P}),[m,i,b,T]),R=useCallback(()=>{if(!p.current||o===void 0)return;let O=u.current.displayValue;typeof O=="function"?p.current.value=O(o):typeof o=="string"&&(p.current.value=o);},[o,p,u]),g=useCallback(O=>{let L=b.find(K=>K.id===O);if(!L)return;let{dataRef:N}=L;l.current.onChange(N.current.value),R();},[b,l,p]),v=useCallback(()=>{if(T!==null){let{dataRef:O}=b[T];l.current.onChange(O.current.value),R();}},[T,b,l,p]),h=useMemo(()=>({selectOption:g,selectActiveOption:v}),[g,v]);return x(()=>{m===1&&R();},[R,m]),x(R,[R]),React__default.createElement(Rt.Provider,{value:h},React__default.createElement(vt.Provider,{value:c},React__default.createElement(W,{value:S(m,{[0]:0,[1]:1})},E({props:r===null?a:{...a,ref:r},slot:C,defaultTag:Or,name:"Combobox"}))))}),Lr="input",Dr=D(function(t,r){var R,g;let{value:o,onChange:n,displayValue:i,...a}=t,[l,s]=pe("Combobox.Input"),u=Ue(),c=I(l.inputRef,r),m=l.inputPropsRef,b=`headlessui-combobox-input-${A()}`,T=Q(),y=ke(n);x(()=>{m.current.displayValue=i;},[i,m]);let p=useCallback(v=>{switch(v.key){case"Enter":v.preventDefault(),v.stopPropagation(),u.selectActiveOption(),s({type:1});break;case"ArrowDown":return v.preventDefault(),v.stopPropagation(),S(l.comboboxState,{[0]:()=>s({type:3,focus:2}),[1]:()=>{s({type:0}),T.nextFrame(()=>{l.comboboxPropsRef.current.value||s({type:3,focus:0});});}});case"ArrowUp":return v.preventDefault(),v.stopPropagation(),S(l.comboboxState,{[0]:()=>s({type:3,focus:1}),[1]:()=>{s({type:0}),T.nextFrame(()=>{l.comboboxPropsRef.current.value||s({type:3,focus:3});});}});case"Home":case"PageUp":return v.preventDefault(),v.stopPropagation(),s({type:3,focus:0});case"End":case"PageDown":return v.preventDefault(),v.stopPropagation(),s({type:3,focus:3});case"Escape":return v.preventDefault(),l.optionsRef.current&&!l.optionsPropsRef.current.static&&v.stopPropagation(),s({type:1});case"Tab":u.selectActiveOption(),s({type:1});break}},[T,s,l,u]),f=useCallback(v=>{var h;s({type:0}),(h=y.current)==null||h.call(y,v);},[s,y]),d=ee(()=>{if(!!l.labelRef.current)return [l.labelRef.current.id].join(" ")},[l.labelRef.current]),P=useMemo(()=>({open:l.comboboxState===0,disabled:l.disabled}),[l]),C={ref:c,id:b,role:"combobox",type:"text","aria-controls":(R=l.optionsRef.current)==null?void 0:R.id,"aria-expanded":l.disabled?void 0:l.comboboxState===0,"aria-activedescendant":l.activeOptionIndex===null||(g=l.options[l.activeOptionIndex])==null?void 0:g.id,"aria-labelledby":d,disabled:l.disabled,onKeyDown:p,onChange:f};return E({props:{...a,...C},slot:P,defaultTag:Lr,name:"Combobox.Input"})}),Mr="button",Fr=D(function(t,r){var p;let[o,n]=pe("Combobox.Button"),i=Ue(),a=I(o.buttonRef,r),l=`headlessui-combobox-button-${A()}`,s=Q(),u=useCallback(f=>{switch(f.key){case"ArrowDown":return f.preventDefault(),f.stopPropagation(),o.comboboxState===1&&(n({type:0}),s.nextFrame(()=>{o.comboboxPropsRef.current.value||n({type:3,focus:0});})),s.nextFrame(()=>{var d;return (d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})});case"ArrowUp":return f.preventDefault(),f.stopPropagation(),o.comboboxState===1&&(n({type:0}),s.nextFrame(()=>{o.comboboxPropsRef.current.value||n({type:3,focus:3});})),s.nextFrame(()=>{var d;return (d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})});case"Escape":return f.preventDefault(),o.optionsRef.current&&!o.optionsPropsRef.current.static&&f.stopPropagation(),n({type:1}),s.nextFrame(()=>{var d;return (d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})})}},[s,n,o,i]),c=useCallback(f=>{if(G(f.currentTarget))return f.preventDefault();o.comboboxState===0?n({type:1}):(f.preventDefault(),n({type:0})),s.nextFrame(()=>{var d;return (d=o.inputRef.current)==null?void 0:d.focus({preventScroll:!0})});},[n,s,o]),m=ee(()=>{if(!!o.labelRef.current)return [o.labelRef.current.id,l].join(" ")},[o.labelRef.current,l]),b=useMemo(()=>({open:o.comboboxState===0,disabled:o.disabled}),[o]),T=t,y={ref:a,id:l,type:U(t,o.buttonRef),tabIndex:-1,"aria-haspopup":!0,"aria-controls":(p=o.optionsRef.current)==null?void 0:p.id,"aria-expanded":o.disabled?void 0:o.comboboxState===0,"aria-labelledby":m,disabled:o.disabled,onClick:c,onKeyDown:u};return E({props:{...T,...y},slot:b,defaultTag:Mr,name:"Combobox.Button"})}),wr="label";function kr(e){let[t]=pe("Combobox.Label"),r=`headlessui-combobox-label-${A()}`,o=useCallback(()=>{var a;return (a=t.inputRef.current)==null?void 0:a.focus({preventScroll:!0})},[t.inputRef]),n=useMemo(()=>({open:t.comboboxState===0,disabled:t.disabled}),[t]),i={ref:t.labelRef,id:r,onClick:o};return E({props:{...e,...i},slot:n,defaultTag:wr,name:"Combobox.Label"})}var _r="ul",Gr=1|2,Hr=D(function(t,r){var y;let{hold:o=!1,...n}=t,[i]=pe("Combobox.Options"),{optionsPropsRef:a}=i,l=I(i.optionsRef,r),s=`headlessui-combobox-options-${A()}`,u=_(),c=(()=>u!==null?u===0:i.comboboxState===0)();x(()=>{var p;a.current.static=(p=t.static)!=null?p:!1;},[a,t.static]),x(()=>{a.current.hold=o;},[o,a]),se({container:i.optionsRef.current,enabled:i.comboboxState===0,accept(p){return p.getAttribute("role")==="option"?NodeFilter.FILTER_REJECT:p.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(p){p.setAttribute("role","none");}});let m=ee(()=>{var p,f,d;return (d=(p=i.labelRef.current)==null?void 0:p.id)!=null?d:(f=i.buttonRef.current)==null?void 0:f.id},[i.labelRef.current,i.buttonRef.current]),b=useMemo(()=>({open:i.comboboxState===0}),[i]),T={"aria-activedescendant":i.activeOptionIndex===null||(y=i.options[i.activeOptionIndex])==null?void 0:y.id,"aria-labelledby":m,role:"listbox",id:s,ref:l};return E({props:{...n,...T},slot:b,defaultTag:_r,features:Gr,visible:c,name:"Combobox.Options"})}),Ur="li";function Br(e){let{disabled:t=!1,value:r,...o}=e,[n,i]=pe("Combobox.Option"),a=Ue(),l=`headlessui-combobox-option-${A()}`,s=n.activeOptionIndex!==null?n.options[n.activeOptionIndex].id===l:!1,u=n.comboboxPropsRef.current.value===r,c=useRef({disabled:t,value:r});x(()=>{c.current.disabled=t;},[c,t]),x(()=>{c.current.value=r;},[c,r]),x(()=>{var P,C;c.current.textValue=(C=(P=document.getElementById(l))==null?void 0:P.textContent)==null?void 0:C.toLowerCase();},[c,l]);let m=useCallback(()=>a.selectOption(l),[a,l]);x(()=>(i({type:4,id:l,dataRef:c}),()=>i({type:5,id:l})),[c,l]),x(()=>{n.comboboxState===0&&(!u||i({type:3,focus:4,id:l}));},[n.comboboxState,u,l]),x(()=>{if(n.comboboxState!==0||!s)return;let P=k();return P.requestAnimationFrame(()=>{var C,R;(R=(C=document.getElementById(l))==null?void 0:C.scrollIntoView)==null||R.call(C,{block:"nearest"});}),P.dispose},[l,s,n.comboboxState,n.activeOptionIndex]);let b=useCallback(P=>{if(t)return P.preventDefault();m(),i({type:1}),k().nextFrame(()=>{var C;return (C=n.inputRef.current)==null?void 0:C.focus({preventScroll:!0})});},[i,n.inputRef,t,m]),T=useCallback(()=>{if(t)return i({type:3,focus:5});i({type:3,focus:4,id:l});},[t,l,i]),y=useCallback(()=>{t||s||i({type:3,focus:4,id:l});},[t,s,l,i]),p=useCallback(()=>{t||!s||n.optionsPropsRef.current.hold||i({type:3,focus:5});},[t,s,i,n.comboboxState,n.comboboxPropsRef]),f=useMemo(()=>({active:s,selected:u,disabled:t}),[s,u,t]);return E({props:{...o,...{id:l,role:"option",tabIndex:t===!0?void 0:-1,"aria-disabled":t===!0?!0:void 0,"aria-selected":u===!0?!0:void 0,disabled:void 0,onClick:b,onFocus:T,onPointerMove:y,onMouseMove:y,onPointerLeave:p,onMouseLeave:p}},slot:f,defaultTag:Ur,name:"Combobox.Option"})}Object.assign(Ir,{Input:Dr,Button:Fr,Label:kr,Options:Hr,Option:Br});var Et=["[contentEditable=true]","[tabindex]","a[href]","area[href]","button:not([disabled])","iframe","input:not([disabled])","select:not([disabled])","textarea:not([disabled])"].map(e=>`${e}:not([tabindex='-1'])`).join(",");function xe(e=document.body){return e==null?[]:Array.from(e.querySelectorAll(Et))}function de(e,t=0){return e===document.body?!1:S(t,{[0](){return e.matches(Et)},[1](){let r=e;for(;r!==null;){if(r.matches(Et))return !0;r=r.parentElement;}return !1}})}function ce(e){e==null||e.focus({preventScroll:!0});}function M(e,t){let r=Array.isArray(e)?e.slice().sort((c,m)=>{let b=c.compareDocumentPosition(m);return b&Node.DOCUMENT_POSITION_FOLLOWING?-1:b&Node.DOCUMENT_POSITION_PRECEDING?1:0}):xe(e),o=document.activeElement,n=(()=>{if(t&(1|4))return 1;if(t&(2|8))return -1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),i=(()=>{if(t&1)return 0;if(t&2)return Math.max(0,r.indexOf(o))-1;if(t&4)return Math.max(0,r.indexOf(o))+1;if(t&8)return r.length-1;throw new Error("Missing Focus.First, Focus.Previous, Focus.Next or Focus.Last")})(),a=t&32?{preventScroll:!0}:{},l=0,s=r.length,u;do{if(l>=s||l+s<=0)return 0;let c=i+l;if(t&16)c=(c+s)%s;else {if(c<0)return 3;if(c>=s)return 1}u=r[c],u==null||u.focus(a),l+=n;}while(u!==document.activeElement);return u.hasAttribute("tabindex")||u.setAttribute("tabindex","0"),2}function Be(){let e=useRef(!1);return useEffect(()=>(e.current=!0,()=>{e.current=!1;}),[]),e}function Ne(e,t=30,{initialFocus:r,containers:o}={}){let n=useRef(typeof window!="undefined"?document.activeElement:null),i=useRef(null),a=Be(),l=Boolean(t&16),s=Boolean(t&2);useEffect(()=>{!l||(n.current=document.activeElement);},[l]),useEffect(()=>{if(!!l)return ()=>{ce(n.current),n.current=null;}},[l]),useEffect(()=>{if(!s||!e.current)return;let u=document.activeElement;if(r==null?void 0:r.current){if((r==null?void 0:r.current)===u){i.current=u;return}}else if(e.current.contains(u)){i.current=u;return}(r==null?void 0:r.current)?ce(r.current):M(e.current,1)===0&&console.warn("There are no focusable elements inside the <FocusTrap />"),i.current=document.activeElement;},[e,r,s]),w("keydown",u=>{!(t&4)||!e.current||u.key==="Tab"&&(u.preventDefault(),M(e.current,(u.shiftKey?2:4)|16)===2&&(i.current=document.activeElement));}),w("focus",u=>{if(!(t&8))return;let c=new Set(o==null?void 0:o.current);if(c.add(e),!c.size)return;let m=i.current;if(!m||!a.current)return;let b=u.target;b&&b instanceof HTMLElement?Kr(c,b)?(i.current=b,ce(b)):(u.preventDefault(),u.stopPropagation(),ce(m)):ce(i.current);},!0);}function Kr(e,t){var r;for(let o of e)if((r=o.current)==null?void 0:r.contains(t))return !0;return !1}var fe=new Set,J=new Map;function po(e){e.setAttribute("aria-hidden","true"),e.inert=!0;}function co(e){let t=J.get(e);!t||(t["aria-hidden"]===null?e.removeAttribute("aria-hidden"):e.setAttribute("aria-hidden",t["aria-hidden"]),e.inert=t.inert);}function fo(e,t=!0){x(()=>{if(!t||!e.current)return;let r=e.current;fe.add(r);for(let o of J.keys())o.contains(r)&&(co(o),J.delete(o));return document.querySelectorAll("body > *").forEach(o=>{if(o instanceof HTMLElement){for(let n of fe)if(o.contains(n))return;fe.size===1&&(J.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),po(o));}}),()=>{if(fe.delete(r),fe.size>0)document.querySelectorAll("body > *").forEach(o=>{if(o instanceof HTMLElement&&!J.has(o)){for(let n of fe)if(o.contains(n))return;J.set(o,{"aria-hidden":o.getAttribute("aria-hidden"),inert:o.inert}),po(o);}});else for(let o of J.keys())co(o),J.delete(o);}},[t]);}var mo=createContext(!1);function bo(){return useContext(mo)}function At(e){return React__default.createElement(mo.Provider,{value:e.force},e.children)}function Xr(){let e=bo(),t=useContext(Po),[r,o]=useState(()=>{if(!e&&t!==null||typeof window=="undefined")return null;let n=document.getElementById("headlessui-portal-root");if(n)return n;let i=document.createElement("div");return i.setAttribute("id","headlessui-portal-root"),document.body.appendChild(i)});return useEffect(()=>{r!==null&&(document.body.contains(r)||document.body.appendChild(r));},[r]),useEffect(()=>{e||t!==null&&o(t.current);},[t,o,e]),r}var Jr=Fragment$2;function We(e){let t=e,r=Xr(),[o]=useState(()=>typeof window=="undefined"?null:document.createElement("div")),n=q();return x(()=>{if(!!r&&!!o)return r.appendChild(o),()=>{var i;!r||!o||(r.removeChild(o),r.childNodes.length<=0&&((i=r.parentElement)==null||i.removeChild(r)));}},[r,o]),n?!r||!o?null:createPortal(E({props:t,defaultTag:Jr,name:"Portal"}),o):null}var Zr=Fragment$2,Po=createContext(null);function en(e){let{target:t,...r}=e;return React__default.createElement(Po.Provider,{value:t},E({props:r,defaultTag:Zr,name:"Popover.Group"}))}We.Group=en;var vo=createContext(null);function Ro(){let e=useContext(vo);if(e===null){let t=new Error("You used a <Description /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Ro),t}return e}function re(){let[e,t]=useState([]);return [e.length>0?e.join(" "):void 0,useMemo(()=>function(o){let n=useCallback(a=>(t(l=>[...l,a]),()=>t(l=>{let s=l.slice(),u=s.indexOf(a);return u!==-1&&s.splice(u,1),s})),[]),i=useMemo(()=>({register:n,slot:o.slot,name:o.name,props:o.props}),[n,o.slot,o.name,o.props]);return React__default.createElement(vo.Provider,{value:i},o.children)},[t])]}var an="p";function me(e){let t=Ro(),r=`headlessui-description-${A()}`;x(()=>t.register(r),[r,t.register]);let o=e,n={...t.props,id:r};return E({props:{...o,...n},slot:t.slot||{},defaultTag:an,name:t.name||"Description"})}var ht=createContext(()=>{});ht.displayName="StackContext";function cn(){return useContext(ht)}function Eo({children:e,onUpdate:t,type:r,element:o}){let n=cn(),i=useCallback((...a)=>{t==null||t(...a),n(...a);},[n,t]);return x(()=>(i(0,r,o),()=>i(1,r,o)),[i,r,o]),React__default.createElement(ht.Provider,{value:i},e)}var yn={[0](e,t){return e.titleId===t.id?e:{...e,titleId:t.id}}},Ve=createContext(null);Ve.displayName="DialogContext";function It(e){let t=useContext(Ve);if(t===null){let r=new Error(`<${e} /> is missing a parent <${An.displayName} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,It),r}return t}function gn(e,t){return S(t.type,yn,e,t)}var Pn="div",xn=1|2,vn=D(function(t,r){let{open:o,onClose:n,initialFocus:i,...a}=t,[l,s]=useState(0),u=_();o===void 0&&u!==null&&(o=S(u,{[0]:!0,[1]:!1}));let c=useRef(new Set),m=useRef(null),b=I(m,r),T=t.hasOwnProperty("open")||u!==null,y=t.hasOwnProperty("onClose");if(!T&&!y)throw new Error("You have to provide an `open` and an `onClose` prop to the `Dialog` component.");if(!T)throw new Error("You provided an `onClose` prop to the `Dialog`, but forgot an `open` prop.");if(!y)throw new Error("You provided an `open` prop to the `Dialog`, but forgot an `onClose` prop.");if(typeof o!="boolean")throw new Error(`You provided an \`open\` prop to the \`Dialog\`, but the value is not a boolean. Received: ${o}`);if(typeof n!="function")throw new Error(`You provided an \`onClose\` prop to the \`Dialog\`, but the value is not a function. Received: ${n}`);let p=o?0:1,f=(()=>u!==null?u===0:p===0)(),[d,P]=useReducer(gn,{titleId:null,descriptionId:null}),C=useCallback(()=>n(!1),[n]),R=useCallback(F=>P({type:0,id:F}),[P]),v=q()&&p===0,h=l>1,O=useContext(Ve)!==null;Ne(m,v?S(h?"parent":"leaf",{parent:16,leaf:30}):1,{initialFocus:i,containers:c}),fo(m,h?v:!1),w("mousedown",F=>{var H;let $=F.target;p===0&&(h||((H=m.current)==null?void 0:H.contains($))||C());}),w("keydown",F=>{F.key==="Escape"&&p===0&&(h||(F.preventDefault(),F.stopPropagation(),C()));}),useEffect(()=>{if(p!==0||O)return;let F=document.documentElement.style.overflow,$=document.documentElement.style.paddingRight,H=window.innerWidth-document.documentElement.clientWidth;return document.documentElement.style.overflow="hidden",document.documentElement.style.paddingRight=`${H}px`,()=>{document.documentElement.style.overflow=F,document.documentElement.style.paddingRight=$;}},[p,O]),useEffect(()=>{if(p!==0||!m.current)return;let F=new IntersectionObserver($=>{for(let H of $)H.boundingClientRect.x===0&&H.boundingClientRect.y===0&&H.boundingClientRect.width===0&&H.boundingClientRect.height===0&&C();});return F.observe(m.current),()=>F.disconnect()},[p,m,C]);let[N,K]=re(),V=`headlessui-dialog-${A()}`,Fe=useMemo(()=>[{dialogState:p,close:C,setTitleId:R},d],[p,d,C,R]),ge=useMemo(()=>({open:p===0}),[p]),we={ref:b,id:V,role:"dialog","aria-modal":p===0?!0:void 0,"aria-labelledby":d.titleId,"aria-describedby":N,onClick(F){F.stopPropagation();}},X=a;return React__default.createElement(Eo,{type:"Dialog",element:m,onUpdate:useCallback((F,$,H)=>{$==="Dialog"&&S(F,{[0](){c.current.add(H),s(Pe=>Pe+1);},[1](){c.current.add(H),s(Pe=>Pe-1);}});},[])},React__default.createElement(At,{force:!0},React__default.createElement(We,null,React__default.createElement(Ve.Provider,{value:Fe},React__default.createElement(We.Group,{target:m},React__default.createElement(At,{force:!1},React__default.createElement(K,{slot:ge,name:"Dialog.Description"},E({props:{...X,...we},slot:ge,defaultTag:Pn,features:xn,visible:f,name:"Dialog"}))))))))}),Rn="div",En=D(function(t,r){let[{dialogState:o,close:n}]=It("Dialog.Overlay"),i=I(r),a=`headlessui-dialog-overlay-${A()}`,l=useCallback(m=>{if(m.target===m.currentTarget){if(G(m.currentTarget))return m.preventDefault();m.preventDefault(),m.stopPropagation(),n();}},[n]),s=useMemo(()=>({open:o===0}),[o]);return E({props:{...t,...{ref:i,id:a,"aria-hidden":!0,onClick:l}},slot:s,defaultTag:Rn,name:"Dialog.Overlay"})}),Cn="h2";function Sn(e){let[{dialogState:t,setTitleId:r}]=It("Dialog.Title"),o=`headlessui-dialog-title-${A()}`;useEffect(()=>(r(o),()=>r(null)),[o,r]);let n=useMemo(()=>({open:t===0}),[t]);return E({props:{...e,...{id:o}},slot:n,defaultTag:Cn,name:"Dialog.Title"})}var An=Object.assign(vn,{Overlay:En,Title:Sn,Description:me});var Ln={[0]:e=>({...e,disclosureState:S(e.disclosureState,{[0]:1,[1]:0})}),[1]:e=>e.disclosureState===1?e:{...e,disclosureState:1},[4](e){return e.linkedPanel===!0?e:{...e,linkedPanel:!0}},[5](e){return e.linkedPanel===!1?e:{...e,linkedPanel:!1}},[2](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[3](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Mt=createContext(null);Mt.displayName="DisclosureContext";function Ft(e){let t=useContext(Mt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ft),r}return t}var wt=createContext(null);wt.displayName="DisclosureAPIContext";function Ao(e){let t=useContext(wt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ye.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ao),r}return t}var kt=createContext(null);kt.displayName="DisclosurePanelContext";function Dn(){return useContext(kt)}function Mn(e,t){return S(t.type,Ln,e,t)}var Fn=Fragment$2;function Ye(e){let{defaultOpen:t=!1,...r}=e,o=`headlessui-disclosure-button-${A()}`,n=`headlessui-disclosure-panel-${A()}`,i=useReducer(Mn,{disclosureState:t?0:1,linkedPanel:!1,buttonId:o,panelId:n}),[{disclosureState:a},l]=i;useEffect(()=>l({type:2,buttonId:o}),[o,l]),useEffect(()=>l({type:3,panelId:n}),[n,l]);let s=useCallback(m=>{l({type:1});let b=(()=>m?m instanceof HTMLElement?m:m.current instanceof HTMLElement?m.current:document.getElementById(o):document.getElementById(o))();b==null||b.focus();},[l,o]),u=useMemo(()=>({close:s}),[s]),c=useMemo(()=>({open:a===0,close:s}),[a,s]);return React__default.createElement(Mt.Provider,{value:i},React__default.createElement(wt.Provider,{value:u},React__default.createElement(W,{value:S(a,{[0]:0,[1]:1})},E({props:r,slot:c,defaultTag:Fn,name:"Disclosure"}))))}var wn="button",kn=D(function(t,r){let[o,n]=Ft("Disclosure.Button"),i=useRef(null),a=I(i,r),l=Dn(),s=l===null?!1:l===o.panelId,u=useCallback(f=>{var d;if(s){if(o.disclosureState===1)return;switch(f.key){case" ":case"Enter":f.preventDefault(),f.stopPropagation(),n({type:0}),(d=document.getElementById(o.buttonId))==null||d.focus();break}}else switch(f.key){case" ":case"Enter":f.preventDefault(),f.stopPropagation(),n({type:0});break}},[n,s,o.disclosureState,o.buttonId]),c=useCallback(f=>{switch(f.key){case" ":f.preventDefault();break}},[]),m=useCallback(f=>{var d;G(f.currentTarget)||t.disabled||(s?(n({type:0}),(d=document.getElementById(o.buttonId))==null||d.focus()):n({type:0}));},[n,t.disabled,o.buttonId,s]),b=useMemo(()=>({open:o.disclosureState===0}),[o]),T=U(t,i),y=t,p=s?{ref:a,type:T,onKeyDown:u,onClick:m}:{ref:a,id:o.buttonId,type:T,"aria-expanded":t.disabled?void 0:o.disclosureState===0,"aria-controls":o.linkedPanel?o.panelId:void 0,onKeyDown:u,onKeyUp:c,onClick:m};return E({props:{...y,...p},slot:b,defaultTag:wn,name:"Disclosure.Button"})}),_n="div",Gn=1|2,Hn=D(function(t,r){let[o,n]=Ft("Disclosure.Panel"),{close:i}=Ao("Disclosure.Panel"),a=I(r,()=>{o.linkedPanel||n({type:4});}),l=_(),s=(()=>l!==null?l===0:o.disclosureState===0)();useEffect(()=>()=>n({type:5}),[n]),useEffect(()=>{var b;o.disclosureState===1&&((b=t.unmount)!=null?b:!0)&&n({type:5});},[o.disclosureState,t.unmount,n]);let u=useMemo(()=>({open:o.disclosureState===0,close:i}),[o,i]),c={ref:a,id:o.panelId},m=t;return React__default.createElement(kt.Provider,{value:o.panelId},E({props:{...m,...c},slot:u,defaultTag:_n,features:Gn,visible:s,name:"Disclosure.Panel"}))});Ye.Button=kn;Ye.Panel=Hn;var $n={[1](e){return e.disabled||e.listboxState===1?e:{...e,activeOptionIndex:null,listboxState:1}},[0](e){return e.disabled||e.listboxState===0?e:{...e,listboxState:0}},[2](e,t){return e.disabled===t.disabled?e:{...e,disabled:t.disabled}},[3](e,t){return e.orientation===t.orientation?e:{...e,orientation:t.orientation}},[4](e,t){if(e.disabled||e.listboxState===1)return e;let r=ae(t,{resolveItems:()=>e.options,resolveActiveIndex:()=>e.activeOptionIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.searchQuery===""&&e.activeOptionIndex===r?e:{...e,searchQuery:"",activeOptionIndex:r}},[5]:(e,t)=>{if(e.disabled||e.listboxState===1)return e;let o=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeOptionIndex!==null?e.options.slice(e.activeOptionIndex+o).concat(e.options.slice(0,e.activeOptionIndex+o)):e.options).find(s=>{var u;return !s.dataRef.current.disabled&&((u=s.dataRef.current.textValue)==null?void 0:u.startsWith(n))}),l=a?e.options.indexOf(a):-1;return l===-1||l===e.activeOptionIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeOptionIndex:l}},[6](e){return e.disabled||e.listboxState===1||e.searchQuery===""?e:{...e,searchQuery:""}},[7]:(e,t)=>{var n;let r=Array.from((n=e.optionsRef.current)==null?void 0:n.querySelectorAll('[id^="headlessui-listbox-option-"]')).reduce((i,a,l)=>Object.assign(i,{[a.id]:l}),{}),o=[...e.options,{id:t.id,dataRef:t.dataRef}].sort((i,a)=>r[i.id]-r[a.id]);return {...e,options:o}},[8]:(e,t)=>{let r=e.options.slice(),o=e.activeOptionIndex!==null?r[e.activeOptionIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,options:r,activeOptionIndex:(()=>n===e.activeOptionIndex||o===null?null:r.indexOf(o))()}}},Gt=createContext(null);Gt.displayName="ListboxContext";function Re(e){let t=useContext(Gt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ee.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Re),r}return t}function Qn(e,t){return S(t.type,$n,e,t)}var qn=Fragment$2;function Ee(e){let{value:t,onChange:r,disabled:o=!1,horizontal:n=!1,...i}=e,a=n?"horizontal":"vertical",l=useReducer(Qn,{listboxState:1,propsRef:{current:{value:t,onChange:r}},labelRef:createRef(),buttonRef:createRef(),optionsRef:createRef(),disabled:o,orientation:a,options:[],searchQuery:"",activeOptionIndex:null}),[{listboxState:s,propsRef:u,optionsRef:c,buttonRef:m},b]=l;x(()=>{u.current.value=t;},[t,u]),x(()=>{u.current.onChange=r;},[r,u]),x(()=>b({type:2,disabled:o}),[o]),x(()=>b({type:3,orientation:a}),[a]),w("mousedown",y=>{var f,d,P;let p=y.target;s===0&&(((f=m.current)==null?void 0:f.contains(p))||((d=c.current)==null?void 0:d.contains(p))||(b({type:1}),de(p,1)||(y.preventDefault(),(P=m.current)==null||P.focus())));});let T=useMemo(()=>({open:s===0,disabled:o}),[s,o]);return React__default.createElement(Gt.Provider,{value:l},React__default.createElement(W,{value:S(s,{[0]:0,[1]:1})},E({props:i,slot:T,defaultTag:qn,name:"Listbox"})))}var zn="button",Yn=D(function(t,r){var p;let[o,n]=Re("Listbox.Button"),i=I(o.buttonRef,r),a=`headlessui-listbox-button-${A()}`,l=Q(),s=useCallback(f=>{switch(f.key){case" ":case"Enter":case"ArrowDown":f.preventDefault(),n({type:0}),l.nextFrame(()=>{o.propsRef.current.value||n({type:4,focus:0});});break;case"ArrowUp":f.preventDefault(),n({type:0}),l.nextFrame(()=>{o.propsRef.current.value||n({type:4,focus:3});});break}},[n,o,l]),u=useCallback(f=>{switch(f.key){case" ":f.preventDefault();break}},[]),c=useCallback(f=>{if(G(f.currentTarget))return f.preventDefault();o.listboxState===0?(n({type:1}),l.nextFrame(()=>{var d;return (d=o.buttonRef.current)==null?void 0:d.focus({preventScroll:!0})})):(f.preventDefault(),n({type:0}));},[n,l,o]),m=ee(()=>{if(!!o.labelRef.current)return [o.labelRef.current.id,a].join(" ")},[o.labelRef.current,a]),b=useMemo(()=>({open:o.listboxState===0,disabled:o.disabled}),[o]),T=t,y={ref:i,id:a,type:U(t,o.buttonRef),"aria-haspopup":!0,"aria-controls":(p=o.optionsRef.current)==null?void 0:p.id,"aria-expanded":o.disabled?void 0:o.listboxState===0,"aria-labelledby":m,disabled:o.disabled,onKeyDown:s,onKeyUp:u,onClick:c};return E({props:{...T,...y},slot:b,defaultTag:zn,name:"Listbox.Button"})}),Xn="label";function Jn(e){let[t]=Re("Listbox.Label"),r=`headlessui-listbox-label-${A()}`,o=useCallback(()=>{var a;return (a=t.buttonRef.current)==null?void 0:a.focus({preventScroll:!0})},[t.buttonRef]),n=useMemo(()=>({open:t.listboxState===0,disabled:t.disabled}),[t]),i={ref:t.labelRef,id:r,onClick:o};return E({props:{...e,...i},slot:n,defaultTag:Xn,name:"Listbox.Label"})}var Zn="ul",ei=1|2,ti=D(function(t,r){var f;let[o,n]=Re("Listbox.Options"),i=I(o.optionsRef,r),a=`headlessui-listbox-options-${A()}`,l=Q(),s=Q(),u=_(),c=(()=>u!==null?u===0:o.listboxState===0)();x(()=>{let d=o.optionsRef.current;!d||o.listboxState===0&&d!==document.activeElement&&d.focus({preventScroll:!0});},[o.listboxState,o.optionsRef]);let m=useCallback(d=>{switch(s.dispose(),d.key){case" ":if(o.searchQuery!=="")return d.preventDefault(),d.stopPropagation(),n({type:5,value:d.key});case"Enter":if(d.preventDefault(),d.stopPropagation(),n({type:1}),o.activeOptionIndex!==null){let{dataRef:P}=o.options[o.activeOptionIndex];o.propsRef.current.onChange(P.current.value);}k().nextFrame(()=>{var P;return (P=o.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})});break;case S(o.orientation,{vertical:"ArrowDown",horizontal:"ArrowRight"}):return d.preventDefault(),d.stopPropagation(),n({type:4,focus:2});case S(o.orientation,{vertical:"ArrowUp",horizontal:"ArrowLeft"}):return d.preventDefault(),d.stopPropagation(),n({type:4,focus:1});case"Home":case"PageUp":return d.preventDefault(),d.stopPropagation(),n({type:4,focus:0});case"End":case"PageDown":return d.preventDefault(),d.stopPropagation(),n({type:4,focus:3});case"Escape":return d.preventDefault(),d.stopPropagation(),n({type:1}),l.nextFrame(()=>{var P;return (P=o.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})});case"Tab":d.preventDefault(),d.stopPropagation();break;default:d.key.length===1&&(n({type:5,value:d.key}),s.setTimeout(()=>n({type:6}),350));break}},[l,n,s,o]),b=ee(()=>{var d,P,C;return (C=(d=o.labelRef.current)==null?void 0:d.id)!=null?C:(P=o.buttonRef.current)==null?void 0:P.id},[o.labelRef.current,o.buttonRef.current]),T=useMemo(()=>({open:o.listboxState===0}),[o]),y={"aria-activedescendant":o.activeOptionIndex===null||(f=o.options[o.activeOptionIndex])==null?void 0:f.id,"aria-labelledby":b,"aria-orientation":o.orientation,id:a,onKeyDown:m,role:"listbox",tabIndex:0,ref:i};return E({props:{...t,...y},slot:T,defaultTag:Zn,features:ei,visible:c,name:"Listbox.Options"})}),oi="li";function ri(e){let{disabled:t=!1,value:r,...o}=e,[n,i]=Re("Listbox.Option"),a=`headlessui-listbox-option-${A()}`,l=n.activeOptionIndex!==null?n.options[n.activeOptionIndex].id===a:!1,s=n.propsRef.current.value===r,u=useRef({disabled:t,value:r});x(()=>{u.current.disabled=t;},[u,t]),x(()=>{u.current.value=r;},[u,r]),x(()=>{var d,P;u.current.textValue=(P=(d=document.getElementById(a))==null?void 0:d.textContent)==null?void 0:P.toLowerCase();},[u,a]);let c=useCallback(()=>n.propsRef.current.onChange(r),[n.propsRef,r]);x(()=>(i({type:7,id:a,dataRef:u}),()=>i({type:8,id:a})),[u,a]),x(()=>{var d,P;n.listboxState===0&&(!s||(i({type:4,focus:4,id:a}),(P=(d=document.getElementById(a))==null?void 0:d.focus)==null||P.call(d)));},[n.listboxState]),x(()=>{if(n.listboxState!==0||!l)return;let d=k();return d.requestAnimationFrame(()=>{var P,C;(C=(P=document.getElementById(a))==null?void 0:P.scrollIntoView)==null||C.call(P,{block:"nearest"});}),d.dispose},[a,l,n.listboxState,n.activeOptionIndex]);let m=useCallback(d=>{if(t)return d.preventDefault();c(),i({type:1}),k().nextFrame(()=>{var P;return (P=n.buttonRef.current)==null?void 0:P.focus({preventScroll:!0})});},[i,n.buttonRef,t,c]),b=useCallback(()=>{if(t)return i({type:4,focus:5});i({type:4,focus:4,id:a});},[t,a,i]),T=useCallback(()=>{t||l||i({type:4,focus:4,id:a});},[t,l,a,i]),y=useCallback(()=>{t||!l||i({type:4,focus:5});},[t,l,i]),p=useMemo(()=>({active:l,selected:s,disabled:t}),[l,s,t]);return E({props:{...o,...{id:a,role:"option",tabIndex:t===!0?void 0:-1,"aria-disabled":t===!0?!0:void 0,"aria-selected":s===!0?!0:void 0,disabled:void 0,onClick:m,onFocus:b,onPointerMove:T,onMouseMove:T,onPointerLeave:y,onMouseLeave:y}},slot:p,defaultTag:oi,name:"Listbox.Option"})}Ee.Button=Yn;Ee.Label=Jn;Ee.Options=ti;Ee.Option=ri;var ui={[1](e){return e.menuState===1?e:{...e,activeItemIndex:null,menuState:1}},[0](e){return e.menuState===0?e:{...e,menuState:0}},[2]:(e,t)=>{let r=ae(t,{resolveItems:()=>e.items,resolveActiveIndex:()=>e.activeItemIndex,resolveId:o=>o.id,resolveDisabled:o=>o.dataRef.current.disabled});return e.searchQuery===""&&e.activeItemIndex===r?e:{...e,searchQuery:"",activeItemIndex:r}},[3]:(e,t)=>{let o=e.searchQuery!==""?0:1,n=e.searchQuery+t.value.toLowerCase(),a=(e.activeItemIndex!==null?e.items.slice(e.activeItemIndex+o).concat(e.items.slice(0,e.activeItemIndex+o)):e.items).find(s=>{var u;return ((u=s.dataRef.current.textValue)==null?void 0:u.startsWith(n))&&!s.dataRef.current.disabled}),l=a?e.items.indexOf(a):-1;return l===-1||l===e.activeItemIndex?{...e,searchQuery:n}:{...e,searchQuery:n,activeItemIndex:l}},[4](e){return e.searchQuery===""?e:{...e,searchQuery:"",searchActiveItemIndex:null}},[5]:(e,t)=>{var n;let r=Array.from((n=e.itemsRef.current)==null?void 0:n.querySelectorAll('[id^="headlessui-menu-item-"]')).reduce((i,a,l)=>Object.assign(i,{[a.id]:l}),{}),o=[...e.items,{id:t.id,dataRef:t.dataRef}].sort((i,a)=>r[i.id]-r[a.id]);return {...e,items:o}},[6]:(e,t)=>{let r=e.items.slice(),o=e.activeItemIndex!==null?r[e.activeItemIndex]:null,n=r.findIndex(i=>i.id===t.id);return n!==-1&&r.splice(n,1),{...e,items:r,activeItemIndex:(()=>n===e.activeItemIndex||o===null?null:r.indexOf(o))()}}},Ht=createContext(null);Ht.displayName="MenuContext";function Je(e){let t=useContext(Ht);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Ze.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Je),r}return t}function pi(e,t){return S(t.type,ui,e,t)}var di=Fragment$2;function Ze(e){let t=useReducer(pi,{menuState:1,buttonRef:createRef(),itemsRef:createRef(),items:[],searchQuery:"",activeItemIndex:null}),[{menuState:r,itemsRef:o,buttonRef:n},i]=t;w("mousedown",l=>{var u,c,m;let s=l.target;r===0&&(((u=n.current)==null?void 0:u.contains(s))||((c=o.current)==null?void 0:c.contains(s))||(i({type:1}),de(s,1)||(l.preventDefault(),(m=n.current)==null||m.focus())));});let a=useMemo(()=>({open:r===0}),[r]);return React__default.createElement(Ht.Provider,{value:t},React__default.createElement(W,{value:S(r,{[0]:0,[1]:1})},E({props:e,slot:a,defaultTag:di,name:"Menu"})))}var ci="button",fi=D(function(t,r){var y;let[o,n]=Je("Menu.Button"),i=I(o.buttonRef,r),a=`headlessui-menu-button-${A()}`,l=Q(),s=useCallback(p=>{switch(p.key){case" ":case"Enter":case"ArrowDown":p.preventDefault(),p.stopPropagation(),n({type:0}),l.nextFrame(()=>n({type:2,focus:0}));break;case"ArrowUp":p.preventDefault(),p.stopPropagation(),n({type:0}),l.nextFrame(()=>n({type:2,focus:3}));break}},[n,l]),u=useCallback(p=>{switch(p.key){case" ":p.preventDefault();break}},[]),c=useCallback(p=>{if(G(p.currentTarget))return p.preventDefault();t.disabled||(o.menuState===0?(n({type:1}),l.nextFrame(()=>{var f;return (f=o.buttonRef.current)==null?void 0:f.focus({preventScroll:!0})})):(p.preventDefault(),p.stopPropagation(),n({type:0})));},[n,l,o,t.disabled]),m=useMemo(()=>({open:o.menuState===0}),[o]),b=t,T={ref:i,id:a,type:U(t,o.buttonRef),"aria-haspopup":!0,"aria-controls":(y=o.itemsRef.current)==null?void 0:y.id,"aria-expanded":t.disabled?void 0:o.menuState===0,onKeyDown:s,onKeyUp:u,onClick:c};return E({props:{...b,...T},slot:m,defaultTag:ci,name:"Menu.Button"})}),mi="div",bi=1|2,Ti=D(function(t,r){var p,f;let[o,n]=Je("Menu.Items"),i=I(o.itemsRef,r),a=`headlessui-menu-items-${A()}`,l=Q(),s=_(),u=(()=>s!==null?s===0:o.menuState===0)();useEffect(()=>{let d=o.itemsRef.current;!d||o.menuState===0&&d!==document.activeElement&&d.focus({preventScroll:!0});},[o.menuState,o.itemsRef]),se({container:o.itemsRef.current,enabled:o.menuState===0,accept(d){return d.getAttribute("role")==="menuitem"?NodeFilter.FILTER_REJECT:d.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(d){d.setAttribute("role","none");}});let c=useCallback(d=>{var P;switch(l.dispose(),d.key){case" ":if(o.searchQuery!=="")return d.preventDefault(),d.stopPropagation(),n({type:3,value:d.key});case"Enter":if(d.preventDefault(),d.stopPropagation(),n({type:1}),o.activeItemIndex!==null){let{id:C}=o.items[o.activeItemIndex];(P=document.getElementById(C))==null||P.click();}k().nextFrame(()=>{var C;return (C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})});break;case"ArrowDown":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:2});case"ArrowUp":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:1});case"Home":case"PageUp":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:0});case"End":case"PageDown":return d.preventDefault(),d.stopPropagation(),n({type:2,focus:3});case"Escape":d.preventDefault(),d.stopPropagation(),n({type:1}),k().nextFrame(()=>{var C;return (C=o.buttonRef.current)==null?void 0:C.focus({preventScroll:!0})});break;case"Tab":d.preventDefault(),d.stopPropagation();break;default:d.key.length===1&&(n({type:3,value:d.key}),l.setTimeout(()=>n({type:4}),350));break}},[n,l,o]),m=useCallback(d=>{switch(d.key){case" ":d.preventDefault();break}},[]),b=useMemo(()=>({open:o.menuState===0}),[o]),T={"aria-activedescendant":o.activeItemIndex===null||(p=o.items[o.activeItemIndex])==null?void 0:p.id,"aria-labelledby":(f=o.buttonRef.current)==null?void 0:f.id,id:a,onKeyDown:c,onKeyUp:m,role:"menu",tabIndex:0,ref:i};return E({props:{...t,...T},slot:b,defaultTag:mi,features:bi,visible:u,name:"Menu.Items"})}),yi=Fragment$2;function gi(e){let{disabled:t=!1,onClick:r,...o}=e,[n,i]=Je("Menu.Item"),a=`headlessui-menu-item-${A()}`,l=n.activeItemIndex!==null?n.items[n.activeItemIndex].id===a:!1;x(()=>{if(n.menuState!==0||!l)return;let p=k();return p.requestAnimationFrame(()=>{var f,d;(d=(f=document.getElementById(a))==null?void 0:f.scrollIntoView)==null||d.call(f,{block:"nearest"});}),p.dispose},[a,l,n.menuState,n.activeItemIndex]);let s=useRef({disabled:t});x(()=>{s.current.disabled=t;},[s,t]),x(()=>{var p,f;s.current.textValue=(f=(p=document.getElementById(a))==null?void 0:p.textContent)==null?void 0:f.toLowerCase();},[s,a]),x(()=>(i({type:5,id:a,dataRef:s}),()=>i({type:6,id:a})),[s,a]);let u=useCallback(p=>{if(t)return p.preventDefault();if(i({type:1}),k().nextFrame(()=>{var f;return (f=n.buttonRef.current)==null?void 0:f.focus({preventScroll:!0})}),r)return r(p)},[i,n.buttonRef,t,r]),c=useCallback(()=>{if(t)return i({type:2,focus:5});i({type:2,focus:4,id:a});},[t,a,i]),m=useCallback(()=>{t||l||i({type:2,focus:4,id:a});},[t,l,a,i]),b=useCallback(()=>{t||!l||i({type:2,focus:5});},[t,l,i]),T=useMemo(()=>({active:l,disabled:t}),[l,t]);return E({props:{...o,...{id:a,role:"menuitem",tabIndex:t===!0?void 0:-1,"aria-disabled":t===!0?!0:void 0,disabled:void 0,onClick:u,onFocus:c,onPointerMove:m,onMouseMove:m,onPointerLeave:b,onMouseLeave:b}},slot:T,defaultTag:yi,name:"Menu.Item"})}Ze.Button=fi;Ze.Items=Ti;Ze.Item=gi;var vi={[0]:e=>({...e,popoverState:S(e.popoverState,{[0]:1,[1]:0})}),[1](e){return e.popoverState===1?e:{...e,popoverState:1}},[2](e,t){return e.button===t.button?e:{...e,button:t.button}},[3](e,t){return e.buttonId===t.buttonId?e:{...e,buttonId:t.buttonId}},[4](e,t){return e.panel===t.panel?e:{...e,panel:t.panel}},[5](e,t){return e.panelId===t.panelId?e:{...e,panelId:t.panelId}}},Ut=createContext(null);Ut.displayName="PopoverContext";function ot(e){let t=useContext(Ut);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Te.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,ot),r}return t}var Bt=createContext(null);Bt.displayName="PopoverAPIContext";function Mo(e){let t=useContext(Bt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${Te.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Mo),r}return t}var Nt=createContext(null);Nt.displayName="PopoverGroupContext";function Fo(){return useContext(Nt)}var Wt=createContext(null);Wt.displayName="PopoverPanelContext";function Ri(){return useContext(Wt)}function Ei(e,t){return S(t.type,vi,e,t)}var Ci="div";function Te(e){let t=`headlessui-popover-button-${A()}`,r=`headlessui-popover-panel-${A()}`,o=useReducer(Ei,{popoverState:1,button:null,buttonId:t,panel:null,panelId:r}),[{popoverState:n,button:i,panel:a},l]=o;useEffect(()=>l({type:3,buttonId:t}),[t,l]),useEffect(()=>l({type:5,panelId:r}),[r,l]);let s=useMemo(()=>({buttonId:t,panelId:r,close:()=>l({type:1})}),[t,r,l]),u=Fo(),c=u==null?void 0:u.registerPopover,m=useCallback(()=>{var p;return (p=u==null?void 0:u.isFocusWithinPopoverGroup())!=null?p:(i==null?void 0:i.contains(document.activeElement))||(a==null?void 0:a.contains(document.activeElement))},[u,i,a]);useEffect(()=>c==null?void 0:c(s),[c,s]),w("focus",()=>{n===0&&(m()||!i||!a||l({type:1}));},!0),w("mousedown",p=>{let f=p.target;n===0&&((i==null?void 0:i.contains(f))||(a==null?void 0:a.contains(f))||(l({type:1}),de(f,1)||(p.preventDefault(),i==null||i.focus())));});let b=useCallback(p=>{l({type:1});let f=(()=>p?p instanceof HTMLElement?p:p.current instanceof HTMLElement?p.current:i:i)();f==null||f.focus();},[l,i]),T=useMemo(()=>({close:b}),[b]),y=useMemo(()=>({open:n===0,close:b}),[n,b]);return React__default.createElement(Ut.Provider,{value:o},React__default.createElement(Bt.Provider,{value:T},React__default.createElement(W,{value:S(n,{[0]:0,[1]:1})},E({props:e,slot:y,defaultTag:Ci,name:"Popover"}))))}var Si="button",Ai=D(function(t,r){let[o,n]=ot("Popover.Button"),i=useRef(null),a=Fo(),l=a==null?void 0:a.closeOthers,s=Ri(),u=s===null?!1:s===o.panelId,c=I(i,r,u?null:g=>n({type:2,button:g})),m=I(i,r),b=useRef(null),T=useRef(typeof window=="undefined"?null:document.activeElement);w("focus",()=>{T.current=b.current,b.current=document.activeElement;},!0);let y=useCallback(g=>{var v,h;if(u){if(o.popoverState===1)return;switch(g.key){case" ":case"Enter":g.preventDefault(),g.stopPropagation(),n({type:1}),(v=o.button)==null||v.focus();break}}else switch(g.key){case" ":case"Enter":g.preventDefault(),g.stopPropagation(),o.popoverState===1&&(l==null||l(o.buttonId)),n({type:0});break;case"Escape":if(o.popoverState!==0)return l==null?void 0:l(o.buttonId);if(!i.current||!i.current.contains(document.activeElement))return;g.preventDefault(),g.stopPropagation(),n({type:1});break;case"Tab":if(o.popoverState!==0||!o.panel||!o.button)return;if(g.shiftKey){if(!T.current||((h=o.button)==null?void 0:h.contains(T.current))||o.panel.contains(T.current))return;let O=xe(),L=O.indexOf(T.current);if(O.indexOf(o.button)>L)return;g.preventDefault(),g.stopPropagation(),M(o.panel,8);}else g.preventDefault(),g.stopPropagation(),M(o.panel,1);break}},[n,o.popoverState,o.buttonId,o.button,o.panel,i,l,u]),p=useCallback(g=>{var v;if(!u&&(g.key===" "&&g.preventDefault(),o.popoverState===0&&!!o.panel&&!!o.button))switch(g.key){case"Tab":if(!T.current||((v=o.button)==null?void 0:v.contains(T.current))||o.panel.contains(T.current))return;let h=xe(),O=h.indexOf(T.current);if(h.indexOf(o.button)>O)return;g.preventDefault(),g.stopPropagation(),M(o.panel,8);break}},[o.popoverState,o.panel,o.button,u]),f=useCallback(g=>{var v,h;G(g.currentTarget)||t.disabled||(u?(n({type:1}),(v=o.button)==null||v.focus()):(o.popoverState===1&&(l==null||l(o.buttonId)),(h=o.button)==null||h.focus(),n({type:0})));},[n,o.button,o.popoverState,o.buttonId,t.disabled,l,u]),d=useMemo(()=>({open:o.popoverState===0}),[o]),P=U(t,i),C=t,R=u?{ref:m,type:P,onKeyDown:y,onClick:f}:{ref:c,id:o.buttonId,type:P,"aria-expanded":t.disabled?void 0:o.popoverState===0,"aria-controls":o.panel?o.panelId:void 0,onKeyDown:y,onKeyUp:p,onClick:f};return E({props:{...C,...R},slot:d,defaultTag:Si,name:"Popover.Button"})}),hi="div",Oi=1|2,Ii=D(function(t,r){let[{popoverState:o},n]=ot("Popover.Overlay"),i=I(r),a=`headlessui-popover-overlay-${A()}`,l=_(),s=(()=>l!==null?l===0:o===0)(),u=useCallback(T=>{if(G(T.currentTarget))return T.preventDefault();n({type:1});},[n]),c=useMemo(()=>({open:o===0}),[o]);return E({props:{...t,...{ref:i,id:a,"aria-hidden":!0,onClick:u}},slot:c,defaultTag:hi,features:Oi,visible:s,name:"Popover.Overlay"})}),Li$1="div",Di=1|2,Mi=D(function(t,r){let{focus:o=!1,...n}=t,[i,a]=ot("Popover.Panel"),{close:l}=Mo("Popover.Panel"),s=useRef(null),u=I(s,r,p=>{a({type:4,panel:p});}),c=_(),m=(()=>c!==null?c===0:i.popoverState===0)(),b=useCallback(p=>{var f;switch(p.key){case"Escape":if(i.popoverState!==0||!s.current||!s.current.contains(document.activeElement))return;p.preventDefault(),p.stopPropagation(),a({type:1}),(f=i.button)==null||f.focus();break}},[i,s,a]);useEffect(()=>()=>a({type:4,panel:null}),[a]),useEffect(()=>{var p;t.static||i.popoverState===1&&((p=t.unmount)!=null?p:!0)&&a({type:4,panel:null});},[i.popoverState,t.unmount,t.static,a]),useEffect(()=>{if(!o||i.popoverState!==0||!s.current)return;let p=document.activeElement;s.current.contains(p)||M(s.current,1);},[o,s,i.popoverState]),w("keydown",p=>{var d;if(i.popoverState!==0||!s.current||p.key!=="Tab"||!document.activeElement||!s.current||!s.current.contains(document.activeElement))return;p.preventDefault();let f=M(s.current,p.shiftKey?2:4);if(f===3)return (d=i.button)==null?void 0:d.focus();if(f===1){if(!i.button)return;let P=xe(),C=P.indexOf(i.button),R=P.splice(C+1).filter(g=>{var v;return !((v=s.current)==null?void 0:v.contains(g))});M(R,1)===0&&M(document.body,1);}}),w("focus",()=>{var p;!o||i.popoverState===0&&(!s.current||((p=s.current)==null?void 0:p.contains(document.activeElement))||a({type:1}));},!0);let T=useMemo(()=>({open:i.popoverState===0,close:l}),[i,l]),y={ref:u,id:i.panelId,onKeyDown:b};return React__default.createElement(Wt.Provider,{value:i.panelId},E({props:{...n,...y},slot:T,defaultTag:Li$1,features:Di,visible:m,name:"Popover.Panel"}))}),Fi="div";function wi(e){let t=useRef(null),[r,o]=useState([]),n=useCallback(b=>{o(T=>{let y=T.indexOf(b);if(y!==-1){let p=T.slice();return p.splice(y,1),p}return T});},[o]),i=useCallback(b=>(o(T=>[...T,b]),()=>n(b)),[o,n]),a=useCallback(()=>{var T;let b=document.activeElement;return ((T=t.current)==null?void 0:T.contains(b))?!0:r.some(y=>{var p,f;return ((p=document.getElementById(y.buttonId))==null?void 0:p.contains(b))||((f=document.getElementById(y.panelId))==null?void 0:f.contains(b))})},[t,r]),l=useCallback(b=>{for(let T of r)T.buttonId!==b&&T.close();},[r]),s=useMemo(()=>({registerPopover:i,unregisterPopover:n,isFocusWithinPopoverGroup:a,closeOthers:l}),[i,n,a,l]),u=useMemo(()=>({}),[]),c={ref:t},m=e;return React__default.createElement(Nt.Provider,{value:s},E({props:{...m,...c},slot:u,defaultTag:Fi,name:"Popover.Group"}))}Te.Button=Ai;Te.Overlay=Ii;Te.Panel=Mi;Te.Group=wi;function wo(e=0){let[t,r]=useState(e),o=useCallback(l=>r(s=>s|l),[r]),n=useCallback(l=>Boolean(t&l),[t]),i=useCallback(l=>r(s=>s&~l),[r]),a=useCallback(l=>r(s=>s^l),[r]);return {addFlag:o,hasFlag:n,removeFlag:i,toggleFlag:a}}var _o=createContext(null);function Go(){let e=useContext(_o);if(e===null){let t=new Error("You used a <Label /> component, but it is not inside a relevant parent.");throw Error.captureStackTrace&&Error.captureStackTrace(t,Go),t}return e}function Ae(){let[e,t]=useState([]);return [e.length>0?e.join(" "):void 0,useMemo(()=>function(o){let n=useCallback(a=>(t(l=>[...l,a]),()=>t(l=>{let s=l.slice(),u=s.indexOf(a);return u!==-1&&s.splice(u,1),s})),[]),i=useMemo(()=>({register:n,slot:o.slot,name:o.name,props:o.props}),[n,o.slot,o.name,o.props]);return React__default.createElement(_o.Provider,{value:i},o.children)},[t])]}var Ni="label";function nt(e){let{passive:t=!1,...r}=e,o=Go(),n=`headlessui-label-${A()}`;x(()=>o.register(n),[n,o.register]);let i={...o.props,id:n},a={...r,...i};return t&&delete a.onClick,E({props:a,slot:o.slot||{},defaultTag:Ni,name:o.name||"Label"})}var Vi={[0](e,t){return {...e,options:[...e.options,{id:t.id,element:t.element,propsRef:t.propsRef}]}},[1](e,t){let r=e.options.slice(),o=e.options.findIndex(n=>n.id===t.id);return o===-1?e:(r.splice(o,1),{...e,options:r})}},jt=createContext(null);jt.displayName="RadioGroupContext";function Ho(e){let t=useContext(jt);if(t===null){let r=new Error(`<${e} /> is missing a parent <${lt.name} /> component.`);throw Error.captureStackTrace&&Error.captureStackTrace(r,Ho),r}return t}function $i(e,t){return S(t.type,Vi,e,t)}var Qi="div";function lt(e){let{value:t,onChange:r,disabled:o=!1,...n}=e,[{options:i},a]=useReducer($i,{options:[]}),[l,s]=Ae(),[u,c]=re(),m=`headlessui-radiogroup-${A()}`,b=useRef(null),T=useMemo(()=>i.find(R=>!R.propsRef.current.disabled),[i]),y=useMemo(()=>i.some(R=>R.propsRef.current.value===t),[i,t]),p=useCallback(R=>{var v;if(o||R===t)return !1;let g=(v=i.find(h=>h.propsRef.current.value===R))==null?void 0:v.propsRef.current;return (g==null?void 0:g.disabled)?!1:(r(R),!0)},[r,t,o,i]);se({container:b.current,accept(R){return R.getAttribute("role")==="radio"?NodeFilter.FILTER_REJECT:R.hasAttribute("role")?NodeFilter.FILTER_SKIP:NodeFilter.FILTER_ACCEPT},walk(R){R.setAttribute("role","none");}});let f=useCallback(R=>{if(!b.current)return;let v=i.filter(h=>h.propsRef.current.disabled===!1).map(h=>h.element.current);switch(R.key){case"ArrowLeft":case"ArrowUp":if(R.preventDefault(),R.stopPropagation(),M(v,2|16)===2){let O=i.find(L=>L.element.current===document.activeElement);O&&p(O.propsRef.current.value);}break;case"ArrowRight":case"ArrowDown":if(R.preventDefault(),R.stopPropagation(),M(v,4|16)===2){let O=i.find(L=>L.element.current===document.activeElement);O&&p(O.propsRef.current.value);}break;case" ":{R.preventDefault(),R.stopPropagation();let h=i.find(O=>O.element.current===document.activeElement);h&&p(h.propsRef.current.value);}break}},[b,i,p]),d=useCallback(R=>(a({type:0,...R}),()=>a({type:1,id:R.id})),[a]),P=useMemo(()=>({registerOption:d,firstOption:T,containsCheckedOption:y,change:p,disabled:o,value:t}),[d,T,y,p,o,t]),C={ref:b,id:m,role:"radiogroup","aria-labelledby":l,"aria-describedby":u,onKeyDown:f};return React__default.createElement(c,{name:"RadioGroup.Description"},React__default.createElement(s,{name:"RadioGroup.Label"},React__default.createElement(jt.Provider,{value:P},E({props:{...n,...C},defaultTag:Qi,name:"RadioGroup"}))))}var qi="div";function zi(e){let t=useRef(null),r=`headlessui-radiogroup-option-${A()}`,[o,n]=Ae(),[i,a]=re(),{addFlag:l,removeFlag:s,hasFlag:u}=wo(1),{value:c,disabled:m=!1,...b}=e,T=useRef({value:c,disabled:m});x(()=>{T.current.value=c;},[c,T]),x(()=>{T.current.disabled=m;},[m,T]);let{registerOption:y,disabled:p,change:f,firstOption:d,containsCheckedOption:P,value:C}=Ho("RadioGroup.Option");x(()=>y({id:r,element:t,propsRef:T}),[r,y,t,e]);let R=useCallback(()=>{var V;!f(c)||(l(2),(V=t.current)==null||V.focus());},[l,f,c]),g=useCallback(()=>l(2),[l]),v=useCallback(()=>s(2),[s]),h=(d==null?void 0:d.id)===r,O=p||m,L=C===c,N={ref:t,id:r,role:"radio","aria-checked":L?"true":"false","aria-labelledby":o,"aria-describedby":i,"aria-disabled":O?!0:void 0,tabIndex:(()=>O?-1:L||!P&&h?0:-1)(),onClick:O?void 0:R,onFocus:O?void 0:g,onBlur:O?void 0:v},K=useMemo(()=>({checked:L,disabled:O,active:u(2)}),[L,O,u]);return React__default.createElement(a,{name:"RadioGroup.Description"},React__default.createElement(n,{name:"RadioGroup.Label"},E({props:{...b,...N},slot:K,defaultTag:qi,name:"RadioGroup.Option"})))}lt.Option=zi;lt.Label=nt;lt.Description=me;var $t=createContext(null);$t.displayName="GroupContext";var zt=createContext(null);zt.displayName="TabsContext";var dt=createContext(null);dt.displayName="TransitionContext";var ct=createContext(null);ct.displayName="NestingContext";
|
|
5941
3654
|
|
|
5942
3655
|
var BaseSelectButton = function (_a) {
|
|
5943
3656
|
var children = _a.children, as = _a.as;
|
|
5944
|
-
return jsx$1(
|
|
3657
|
+
return jsx$1(Ee.Button, __assign({ as: as }, { children: children }), void 0);
|
|
5945
3658
|
};
|
|
5946
3659
|
|
|
5947
3660
|
var BaseSelectOptions = function (_a) {
|
|
5948
3661
|
var children = _a.children, className = _a.className;
|
|
5949
|
-
return jsx$1(
|
|
3662
|
+
return jsx$1(Ee.Options, __assign({ className: className }, { children: children }), void 0);
|
|
5950
3663
|
};
|
|
5951
3664
|
|
|
5952
3665
|
function BaseSelectOption(_a) {
|
|
5953
3666
|
var value = _a.value, disabled = _a.disabled, children = _a.children, className = _a.className, as = _a.as;
|
|
5954
|
-
return (jsx$1(
|
|
3667
|
+
return (jsx$1(Ee.Option, __assign({ className: className, as: as, value: value, disabled: disabled }, { children: children }), void 0));
|
|
5955
3668
|
}
|
|
5956
3669
|
|
|
5957
|
-
var CustomListBox = newStyled(
|
|
3670
|
+
var CustomListBox = newStyled(Ee)(templateObject_1$12 || (templateObject_1$12 = __makeTemplateObject(["\n position: relative;\n"], ["\n position: relative;\n"])));
|
|
5958
3671
|
function BaseSelect(_a) {
|
|
5959
3672
|
var value = _a.value, onChange = _a.onChange, disabled = _a.disabled, children = _a.children, className = _a.className;
|
|
5960
3673
|
return (jsx$1(CustomListBox, __assign({ disabled: disabled, as: "div", value: value, onChange: onChange, className: className }, { children: children }), void 0));
|
|
@@ -6700,9 +4413,9 @@ var OutOfStock = function (_a) {
|
|
|
6700
4413
|
return (jsxs$1("svg", __assign({ width: "32", height: "33", viewBox: "0 0 32 33", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [jsx$1("title", { children: title }, void 0), jsx$1("mask", __assign({ id: "path-1-inside-1", fill: "white" }, { children: jsx$1("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.89435 9.60565C8.40619 10.0938 8.40619 10.8853 8.89435 11.3734L14.0209 16.5L8.89433 21.6266C8.40617 22.1147 8.40617 22.9062 8.89433 23.3943C9.38248 23.8825 10.1739 23.8825 10.6621 23.3943L15.7887 18.2677L21.2687 23.7478C21.7569 24.2359 22.5483 24.2359 23.0365 23.7478C23.5246 23.2596 23.5246 22.4682 23.0365 21.98L17.5564 16.5L23.0365 11.02C23.5246 10.5318 23.5246 9.74035 23.0365 9.25219C22.5483 8.76404 21.7568 8.76404 21.2687 9.25219L15.7887 14.7322L10.6621 9.60565C10.174 9.1175 9.3825 9.1175 8.89435 9.60565Z" }, void 0) }), void 0), jsx$1("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M8.89435 9.60565C8.40619 10.0938 8.40619 10.8853 8.89435 11.3734L14.0209 16.5L8.89433 21.6266C8.40617 22.1147 8.40617 22.9062 8.89433 23.3943C9.38248 23.8825 10.1739 23.8825 10.6621 23.3943L15.7887 18.2677L21.2687 23.7478C21.7569 24.2359 22.5483 24.2359 23.0365 23.7478C23.5246 23.2596 23.5246 22.4682 23.0365 21.98L17.5564 16.5L23.0365 11.02C23.5246 10.5318 23.5246 9.74035 23.0365 9.25219C22.5483 8.76404 21.7568 8.76404 21.2687 9.25219L15.7887 14.7322L10.6621 9.60565C10.174 9.1175 9.3825 9.1175 8.89435 9.60565Z", fill: theme.colors.shades['300'].color }, void 0), jsx$1("path", { d: "M14.0209 16.5L14.5866 17.0657L15.1523 16.5L14.5866 15.9343L14.0209 16.5ZM8.89433 21.6266L9.46001 22.1922L8.89433 21.6266ZM10.6621 23.3943L11.2278 23.96L10.6621 23.3943ZM15.7887 18.2677L16.3544 17.7021L15.7887 17.1364L15.223 17.7021L15.7887 18.2677ZM17.5564 16.5L16.9908 15.9343L16.4251 16.5L16.9908 17.0657L17.5564 16.5ZM23.0365 11.02L23.6021 11.5856L23.0365 11.02ZM21.2687 9.25219L21.8344 9.81788L21.2687 9.25219ZM15.7887 14.7322L15.223 15.2979L15.7887 15.8636L16.3544 15.2979L15.7887 14.7322ZM9.46003 10.8077C9.2843 10.632 9.2843 10.3471 9.46003 10.1713L8.32866 9.03997C7.52809 9.84054 7.52809 11.1385 8.32866 11.9391L9.46003 10.8077ZM14.5866 15.9343L9.46003 10.8077L8.32866 11.9391L13.4552 17.0657L14.5866 15.9343ZM9.46001 22.1922L14.5866 17.0657L13.4552 15.9343L8.32864 21.0609L9.46001 22.1922ZM9.46001 22.8286C9.28428 22.6529 9.28428 22.368 9.46001 22.1922L8.32864 21.0609C7.52807 21.8614 7.52807 23.1594 8.32864 23.96L9.46001 22.8286ZM10.0964 22.8286C9.92067 23.0044 9.63575 23.0044 9.46001 22.8286L8.32864 23.96C9.12922 24.7606 10.4272 24.7606 11.2278 23.96L10.0964 22.8286ZM15.223 17.7021L10.0964 22.8286L11.2278 23.96L16.3544 18.8334L15.223 17.7021ZM21.8344 23.1821L16.3544 17.7021L15.223 18.8334L20.703 24.3135L21.8344 23.1821ZM22.4708 23.1821C22.2951 23.3578 22.0101 23.3578 21.8344 23.1821L20.703 24.3135C21.5036 25.114 22.8016 25.114 23.6022 24.3135L22.4708 23.1821ZM22.4708 22.5457C22.6465 22.7214 22.6465 23.0064 22.4708 23.1821L23.6022 24.3135C24.4027 23.5129 24.4027 22.2149 23.6022 21.4143L22.4708 22.5457ZM16.9908 17.0657L22.4708 22.5457L23.6022 21.4143L18.1221 15.9343L16.9908 17.0657ZM22.4708 10.4543L16.9908 15.9343L18.1221 17.0657L23.6021 11.5856L22.4708 10.4543ZM22.4708 9.81788C22.6465 9.99361 22.6465 10.2785 22.4708 10.4543L23.6021 11.5856C24.4027 10.7851 24.4027 9.48708 23.6021 8.68651L22.4708 9.81788ZM21.8344 9.81788C22.0101 9.64214 22.295 9.64214 22.4708 9.81788L23.6021 8.68651C22.8016 7.88593 21.5036 7.88593 20.703 8.68651L21.8344 9.81788ZM16.3544 15.2979L21.8344 9.81788L20.703 8.68651L15.223 14.1665L16.3544 15.2979ZM10.0964 10.1713L15.223 15.2979L16.3544 14.1665L11.2278 9.03997L10.0964 10.1713ZM9.46003 10.1713C9.63577 9.9956 9.92069 9.9956 10.0964 10.1713L11.2278 9.03997C10.4272 8.23939 9.12924 8.23939 8.32866 9.03997L9.46003 10.1713Z", fill: "white", mask: "url(#path-1-inside-1)" }, void 0), jsx$1("circle", { cx: "16", cy: "16.5", r: "12", stroke: theme.colors.shades['300'].color, strokeWidth: "0.5" }, void 0)] }), void 0));
|
|
6701
4414
|
};
|
|
6702
4415
|
|
|
6703
|
-
var CustomRadioGroup = newStyled(
|
|
6704
|
-
newStyled(
|
|
6705
|
-
var CustomRadioGroupOption = newStyled(
|
|
4416
|
+
var CustomRadioGroup = newStyled(lt)(templateObject_1$W || (templateObject_1$W = __makeTemplateObject(["\n display: flex;\n flex-direction: column;\n"], ["\n display: flex;\n flex-direction: column;\n"])));
|
|
4417
|
+
newStyled(lt.Label)(templateObject_2$z || (templateObject_2$z = __makeTemplateObject(["\n font-size: 0.88rem;\n"], ["\n font-size: 0.88rem;\n"])));
|
|
4418
|
+
var CustomRadioGroupOption = newStyled(lt.Option)(templateObject_3$m || (templateObject_3$m = __makeTemplateObject(["\n margin-right: 8px;\n\n svg {\n cursor: pointer;\n }\n"], ["\n margin-right: 8px;\n\n svg {\n cursor: pointer;\n }\n"])));
|
|
6706
4419
|
var Span = newStyled.span(templateObject_4$e || (templateObject_4$e = __makeTemplateObject(["\n font-weight: 600;\n"], ["\n font-weight: 600;\n"])));
|
|
6707
4420
|
var OptionsContainer = newStyled.div(templateObject_5$7 || (templateObject_5$7 = __makeTemplateObject(["\n display: flex;\n margin-top: 0.63rem;\n flex-wrap: wrap;\n"], ["\n display: flex;\n margin-top: 0.63rem;\n flex-wrap: wrap;\n"])));
|
|
6708
4421
|
var Label$1 = function (_a) {
|
|
@@ -7265,6 +4978,7 @@ var AccordionSummaryStyles = {
|
|
|
7265
4978
|
cursor: 'pointer',
|
|
7266
4979
|
justifyContent: 'space-between',
|
|
7267
4980
|
alignItems: 'center',
|
|
4981
|
+
padding: '0',
|
|
7268
4982
|
}),
|
|
7269
4983
|
simple: function (theme, disabled) {
|
|
7270
4984
|
return css(__assign(__assign({}, theme.component.accordion.variant.simple.summary), { color: disabled
|
|
@@ -7292,9 +5006,9 @@ var AccordionDetailsStyles = {
|
|
|
7292
5006
|
},
|
|
7293
5007
|
};
|
|
7294
5008
|
|
|
7295
|
-
var StyledDisclosure = newStyled(
|
|
7296
|
-
var StyledButton$1 = newStyled(
|
|
7297
|
-
var StyledPanel = newStyled(
|
|
5009
|
+
var StyledDisclosure = newStyled(Ye)(AccordionStyles.baseStyles, function (props) { return [AccordionStyles[props.variant](props.theme, props.disabled)]; });
|
|
5010
|
+
var StyledButton$1 = newStyled(Ye.Button)(AccordionSummaryStyles.baseStyles, function (props) { return [AccordionSummaryStyles[props.variant](props.theme, props.disabled)]; });
|
|
5011
|
+
var StyledPanel = newStyled(Ye.Panel)(AccordionDetailsStyles.baseStyles, function (props) { return [AccordionDetailsStyles[props.variant](props.theme)]; });
|
|
7298
5012
|
var Accordion = function (_a) {
|
|
7299
5013
|
var header = _a.header, content = _a.content, defaultOpen = _a.defaultOpen, variant = _a.variant, _b = _a.disabled, disabled = _b === void 0 ? false : _b, openIcon = _a.openIcon, closeIcon = _a.closeIcon;
|
|
7300
5014
|
var theme = useTheme();
|
|
@@ -7599,10 +5313,14 @@ var sliceString = function (str, maxLength) {
|
|
|
7599
5313
|
|
|
7600
5314
|
var formatPrice = function (value, _a) {
|
|
7601
5315
|
var _b = _a === void 0 ? {} : _a, _c = _b.locale, locale = _c === void 0 ? 'en-US' : _c, _d = _b.currency, currency = _d === void 0 ? 'USD' : _d;
|
|
5316
|
+
var _e = value.toFixed(3).split('.'), integer = _e[0], fraction = _e[1];
|
|
5317
|
+
// this prevents `Intl.NumberFormat` from rounding the number
|
|
5318
|
+
var valueToFormat = parseFloat("".concat(integer, ".").concat(fraction.slice(0, 2)));
|
|
7602
5319
|
return new Intl.NumberFormat(locale, {
|
|
7603
5320
|
style: 'currency',
|
|
7604
5321
|
currency: currency,
|
|
7605
|
-
|
|
5322
|
+
maximumFractionDigits: 3,
|
|
5323
|
+
}).format(valueToFormat);
|
|
7606
5324
|
};
|
|
7607
5325
|
|
|
7608
5326
|
var ErrorText = newStyled.h3(templateObject_1$E || (templateObject_1$E = __makeTemplateObject(["\n color: ", " !important;\n font-size: 0.75rem;\n font-weight: 600;\n margin: 0;\n font-height: 1rem;\n margin-left: 0.313rem;\n"], ["\n color: ", " !important;\n font-size: 0.75rem;\n font-weight: 600;\n margin: 0;\n font-height: 1rem;\n margin-left: 0.313rem;\n"])), function (props) { return props.color; });
|
|
@@ -10034,7 +7752,7 @@ var Track = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
10034
7752
|
onMouseOver: onMouseOver,
|
|
10035
7753
|
onMouseLeave: onMouseLeave
|
|
10036
7754
|
};
|
|
10037
|
-
return /*#__PURE__*/React__default.createElement("div", _extends$
|
|
7755
|
+
return /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
10038
7756
|
ref: this.handleRef,
|
|
10039
7757
|
className: "slick-track",
|
|
10040
7758
|
style: this.props.trackStyle
|
|
@@ -10190,7 +7908,7 @@ var PrevArrow = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
10190
7908
|
if (this.props.prevArrow) {
|
|
10191
7909
|
prevArrow = /*#__PURE__*/React__default.cloneElement(this.props.prevArrow, _objectSpread2(_objectSpread2({}, prevArrowProps), customProps));
|
|
10192
7910
|
} else {
|
|
10193
|
-
prevArrow = /*#__PURE__*/React__default.createElement("button", _extends$
|
|
7911
|
+
prevArrow = /*#__PURE__*/React__default.createElement("button", _extends$1({
|
|
10194
7912
|
key: "0",
|
|
10195
7913
|
type: "button"
|
|
10196
7914
|
}, prevArrowProps), " ", "Previous");
|
|
@@ -10256,7 +7974,7 @@ var NextArrow = /*#__PURE__*/function (_React$PureComponent2) {
|
|
|
10256
7974
|
if (this.props.nextArrow) {
|
|
10257
7975
|
nextArrow = /*#__PURE__*/React__default.cloneElement(this.props.nextArrow, _objectSpread2(_objectSpread2({}, nextArrowProps), customProps));
|
|
10258
7976
|
} else {
|
|
10259
|
-
nextArrow = /*#__PURE__*/React__default.createElement("button", _extends$
|
|
7977
|
+
nextArrow = /*#__PURE__*/React__default.createElement("button", _extends$1({
|
|
10260
7978
|
key: "1",
|
|
10261
7979
|
type: "button"
|
|
10262
7980
|
}, nextArrowProps), " ", "Next");
|
|
@@ -11959,9 +9677,9 @@ var InnerSlider = /*#__PURE__*/function (_React$Component) {
|
|
|
11959
9677
|
};
|
|
11960
9678
|
}
|
|
11961
9679
|
|
|
11962
|
-
return /*#__PURE__*/React__default.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/React__default.createElement("div", _extends$
|
|
9680
|
+
return /*#__PURE__*/React__default.createElement("div", innerSliderProps, !_this.props.unslick ? prevArrow : "", /*#__PURE__*/React__default.createElement("div", _extends$1({
|
|
11963
9681
|
ref: _this.listRefHandler
|
|
11964
|
-
}, listProps), /*#__PURE__*/React__default.createElement(Track, _extends$
|
|
9682
|
+
}, listProps), /*#__PURE__*/React__default.createElement(Track, _extends$1({
|
|
11965
9683
|
ref: _this.trackRefHandler
|
|
11966
9684
|
}, trackProps), _this.props.children)), !_this.props.unslick ? nextArrow : "", !_this.props.unslick ? dots : "");
|
|
11967
9685
|
});
|
|
@@ -12374,7 +10092,7 @@ var Slider = /*#__PURE__*/function (_React$Component) {
|
|
|
12374
10092
|
settings.unslick = true;
|
|
12375
10093
|
}
|
|
12376
10094
|
|
|
12377
|
-
return /*#__PURE__*/React__default.createElement(InnerSlider, _extends$
|
|
10095
|
+
return /*#__PURE__*/React__default.createElement(InnerSlider, _extends$1({
|
|
12378
10096
|
style: this.props.style,
|
|
12379
10097
|
ref: this.innerSliderRefHandler
|
|
12380
10098
|
}, settings), newChildren);
|
|
@@ -13459,11 +11177,11 @@ var Description = function (_a) {
|
|
|
13459
11177
|
};
|
|
13460
11178
|
var templateObject_1$2;
|
|
13461
11179
|
|
|
13462
|
-
var Container$1 = newStyled.div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n margin: 0;\n padding: 0.25rem;\n background-color: ", ";\n display: inline-flex;\n border-radius: 50%;\n cursor: pointer;\n"], ["\n margin: 0;\n padding: 0.25rem;\n background-color: ", ";\n display: inline-flex;\n border-radius: 50%;\n cursor: pointer;\n"])), function (props) { return props.backgroundColor; });
|
|
11180
|
+
var Container$1 = newStyled.div(templateObject_1$1 || (templateObject_1$1 = __makeTemplateObject(["\n margin: 0;\n padding: 0.25rem;\n background-color: ", ";\n display: inline-flex;\n border-radius: 50%;\n cursor: pointer;\n width: ", ";\n height: ", ";\n justify-content: center;\n align-items: center;\n"], ["\n margin: 0;\n padding: 0.25rem;\n background-color: ", ";\n display: inline-flex;\n border-radius: 50%;\n cursor: pointer;\n width: ", ";\n height: ", ";\n justify-content: center;\n align-items: center;\n"])), function (props) { return props.backgroundColor; }, function (props) { return "".concat(props.size, "em"); }, function (props) { return "".concat(props.size, "em"); });
|
|
13463
11181
|
var CloseButton = function (_a) {
|
|
13464
|
-
var onClick = _a.onClick;
|
|
11182
|
+
var onClick = _a.onClick, size = _a.size;
|
|
13465
11183
|
var theme = useTheme();
|
|
13466
|
-
return (jsx$1(Container$1, __assign({ backgroundColor: theme.colors.shades['700'].color, onClick: onClick, "data-testid": "CartProductItemCloseBtn" }, { children: jsx$1(Icon.Actions.Close, { width:
|
|
11184
|
+
return (jsx$1(Container$1, __assign({ backgroundColor: theme.colors.shades['700'].color, onClick: onClick, "data-testid": "CartProductItemCloseBtn", size: size }, { children: jsx$1(Icon.Actions.Close, { width: size - 1, height: size - 1, fill: "#fff" }, void 0) }), void 0));
|
|
13467
11185
|
};
|
|
13468
11186
|
var templateObject_1$1;
|
|
13469
11187
|
|