@helpdice/ui 1.8.4 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/CurrencyInput/components/CurrencyInput.d.ts +4 -0
- package/dist/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
- package/dist/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
- package/dist/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
- package/dist/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/formatValue.d.ts +49 -0
- package/dist/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
- package/dist/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
- package/dist/CurrencyInput/components/utils/index.d.ts +8 -0
- package/dist/CurrencyInput/components/utils/isNumber.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
- package/dist/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
- package/dist/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
- package/dist/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
- package/dist/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
- package/dist/CurrencyInput/index.d.ts +5 -0
- package/dist/CurrencyInput/index.js +3 -2122
- package/dist/ITooltip/index.d.ts +13 -0
- package/dist/Loadable/index.js +29 -3
- package/dist/PhoneInput/index.js +21 -2140
- package/dist/Placeholder/index.js +5 -2124
- package/dist/auto-complete/index.js +73 -12092
- package/dist/avatar/index.js +15 -2134
- package/dist/badge/index.js +8 -2127
- package/dist/breadcrumbs/index.js +19 -2138
- package/dist/button/index.js +36 -2229
- package/dist/button-dropdown/index.js +28 -2147
- package/dist/button-group/index.js +9 -2128
- package/dist/capacity/index.js +10 -2129
- package/dist/card/index.js +46 -2165
- package/dist/carousal/index.js +644 -12666
- package/dist/checkbox/index.js +10 -2129
- package/dist/code/index.js +14 -2133
- package/dist/collapse/index.js +16 -2135
- package/dist/description/index.js +9 -2128
- package/dist/display/index.js +11 -2130
- package/dist/divider/index.js +12 -2131
- package/dist/dot/index.js +6 -2125
- package/dist/drawer/index.js +21 -2139
- package/dist/fieldset/index.js +22 -2141
- package/dist/grid/index.js +8 -2127
- package/dist/image/index.js +31 -2150
- package/dist/index.d.ts +4 -0
- package/dist/index.js +2065 -23539
- package/dist/input/index.js +42 -2158
- package/dist/keyboard/index.js +11 -2130
- package/dist/link/index.js +11 -2130
- package/dist/list/index.js +25 -2143
- package/dist/list/list-item.d.ts +1 -0
- package/dist/loading/index.js +14 -2133
- package/dist/menu/index.js +2 -10245
- package/dist/modal/index.js +59 -2177
- package/dist/note/index.js +10 -2129
- package/dist/page/index.js +6 -2125
- package/dist/pagination/index.js +11 -2130
- package/dist/popover/index.js +23 -2141
- package/dist/progress/index.js +10 -2129
- package/dist/radio/index.js +17 -2136
- package/dist/rating/index.js +7 -2126
- package/dist/row/index.js +5 -2124
- package/dist/select/index.js +54 -2173
- package/dist/slider/index.js +21 -2140
- package/dist/snippet/index.js +12 -2131
- package/dist/spacer/index.js +2 -2121
- package/dist/spinner/index.js +5 -2124
- package/dist/table/index.js +910 -12918
- package/dist/tabs/index.js +16 -2135
- package/dist/tag/index.js +5 -2124
- package/dist/text/index.js +5 -2124
- package/dist/textarea/index.js +10 -2129
- package/dist/toggle/index.js +14 -2133
- package/dist/tooltip/index.js +17 -2135
- package/dist/tree/index.js +39 -2158
- package/dist/use-input/index.js +2 -2122
- package/dist/use-modal/index.js +2 -2122
- package/dist/use-scale/index.js +2 -2121
- package/dist/use-tabs/index.js +2 -2122
- package/dist/user/index.js +31 -2150
- package/esm/CurrencyInput/components/CurrencyInput.d.ts +4 -0
- package/esm/CurrencyInput/components/CurrencyInputProps.d.ts +160 -0
- package/esm/CurrencyInput/components/utils/cleanValue.d.ts +8 -0
- package/esm/CurrencyInput/components/utils/escapeRegExp.d.ts +6 -0
- package/esm/CurrencyInput/components/utils/fixedDecimalValue.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/formatValue.d.ts +49 -0
- package/esm/CurrencyInput/components/utils/getLocaleConfig.d.ts +13 -0
- package/esm/CurrencyInput/components/utils/getSuffix.d.ts +6 -0
- package/esm/CurrencyInput/components/utils/index.d.ts +8 -0
- package/esm/CurrencyInput/components/utils/isNumber.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/padTrimValue.d.ts +1 -0
- package/esm/CurrencyInput/components/utils/parseAbbrValue.d.ts +10 -0
- package/esm/CurrencyInput/components/utils/removeInvalidChars.d.ts +4 -0
- package/esm/CurrencyInput/components/utils/removeSeparators.d.ts +4 -0
- package/esm/CurrencyInput/components/utils/repositionCursor.d.ts +16 -0
- package/esm/CurrencyInput/index.d.ts +5 -0
- package/esm/ITooltip/index.d.ts +13 -0
- package/esm/ITooltip/index.js +97 -0
- package/esm/Loadable/loader.js +13 -0
- package/esm/button/button.compact.js +13 -86
- package/esm/index.d.ts +4 -0
- package/esm/index.js +4 -1
- package/esm/input/input.js +13 -10
- package/esm/link/link.js +3 -3
- package/esm/list/list-item.d.ts +1 -0
- package/esm/list/list-item.js +4 -2
- package/esm/login-with/LoginSocialAmazon/index.js +1 -1
- package/esm/login-with/LoginSocialApple/index.js +1 -1
- package/esm/login-with/LoginSocialFacebook/index.js +1 -1
- package/esm/login-with/LoginSocialGoogle/index.js +1 -1
- package/esm/table/table-body.js +14 -4
- package/esm/table/table-cell.js +1 -1
- package/esm/table/table-head.js +13 -13
- package/esm/table/table.js +8 -8
- package/package.json +5 -5
package/dist/PhoneInput/index.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
var React = require('react');
|
|
6
|
-
var
|
|
6
|
+
var theme = require('@helpdice/theme');
|
|
7
7
|
|
|
8
8
|
function _arrayLikeToArray(r, a) {
|
|
9
9
|
(null == a || a > r.length) && (a = r.length);
|
|
@@ -1843,2125 +1843,6 @@ var countries = [
|
|
|
1843
1843
|
}
|
|
1844
1844
|
];
|
|
1845
1845
|
|
|
1846
|
-
var dist = {};
|
|
1847
|
-
|
|
1848
|
-
var hasRequiredDist;
|
|
1849
|
-
|
|
1850
|
-
function requireDist () {
|
|
1851
|
-
if (hasRequiredDist) return dist;
|
|
1852
|
-
hasRequiredDist = 1;
|
|
1853
|
-
|
|
1854
|
-
var React$1 = React;
|
|
1855
|
-
var reactDom = require$$1;
|
|
1856
|
-
|
|
1857
|
-
function _arrayLikeToArray(r, a) {
|
|
1858
|
-
(null == a || a > r.length) && (a = r.length);
|
|
1859
|
-
for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e];
|
|
1860
|
-
return n;
|
|
1861
|
-
}
|
|
1862
|
-
function _arrayWithHoles(r) {
|
|
1863
|
-
if (Array.isArray(r)) return r;
|
|
1864
|
-
}
|
|
1865
|
-
function _arrayWithoutHoles(r) {
|
|
1866
|
-
if (Array.isArray(r)) return _arrayLikeToArray(r);
|
|
1867
|
-
}
|
|
1868
|
-
function _defineProperty(e, r, t) {
|
|
1869
|
-
return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
1870
|
-
value: t,
|
|
1871
|
-
enumerable: true,
|
|
1872
|
-
configurable: true,
|
|
1873
|
-
writable: true
|
|
1874
|
-
}) : e[r] = t, e;
|
|
1875
|
-
}
|
|
1876
|
-
function _extends() {
|
|
1877
|
-
return _extends = Object.assign ? Object.assign.bind() : function (n) {
|
|
1878
|
-
for (var e = 1; e < arguments.length; e++) {
|
|
1879
|
-
var t = arguments[e];
|
|
1880
|
-
for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]);
|
|
1881
|
-
}
|
|
1882
|
-
return n;
|
|
1883
|
-
}, _extends.apply(null, arguments);
|
|
1884
|
-
}
|
|
1885
|
-
function _iterableToArray(r) {
|
|
1886
|
-
if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r);
|
|
1887
|
-
}
|
|
1888
|
-
function _iterableToArrayLimit(r, l) {
|
|
1889
|
-
var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"];
|
|
1890
|
-
if (null != t) {
|
|
1891
|
-
var e,
|
|
1892
|
-
n,
|
|
1893
|
-
i,
|
|
1894
|
-
u,
|
|
1895
|
-
a = [],
|
|
1896
|
-
f = true,
|
|
1897
|
-
o = false;
|
|
1898
|
-
try {
|
|
1899
|
-
if (i = (t = t.call(r)).next, 0 === l) {
|
|
1900
|
-
if (Object(t) !== t) return;
|
|
1901
|
-
f = !1;
|
|
1902
|
-
} else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0);
|
|
1903
|
-
} catch (r) {
|
|
1904
|
-
o = true, n = r;
|
|
1905
|
-
} finally {
|
|
1906
|
-
try {
|
|
1907
|
-
if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return;
|
|
1908
|
-
} finally {
|
|
1909
|
-
if (o) throw n;
|
|
1910
|
-
}
|
|
1911
|
-
}
|
|
1912
|
-
return a;
|
|
1913
|
-
}
|
|
1914
|
-
}
|
|
1915
|
-
function _nonIterableRest() {
|
|
1916
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1917
|
-
}
|
|
1918
|
-
function _nonIterableSpread() {
|
|
1919
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
1920
|
-
}
|
|
1921
|
-
function ownKeys(e, r) {
|
|
1922
|
-
var t = Object.keys(e);
|
|
1923
|
-
if (Object.getOwnPropertySymbols) {
|
|
1924
|
-
var o = Object.getOwnPropertySymbols(e);
|
|
1925
|
-
r && (o = o.filter(function (r) {
|
|
1926
|
-
return Object.getOwnPropertyDescriptor(e, r).enumerable;
|
|
1927
|
-
})), t.push.apply(t, o);
|
|
1928
|
-
}
|
|
1929
|
-
return t;
|
|
1930
|
-
}
|
|
1931
|
-
function _objectSpread2(e) {
|
|
1932
|
-
for (var r = 1; r < arguments.length; r++) {
|
|
1933
|
-
var t = null != arguments[r] ? arguments[r] : {};
|
|
1934
|
-
r % 2 ? ownKeys(Object(t), true).forEach(function (r) {
|
|
1935
|
-
_defineProperty(e, r, t[r]);
|
|
1936
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) {
|
|
1937
|
-
Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r));
|
|
1938
|
-
});
|
|
1939
|
-
}
|
|
1940
|
-
return e;
|
|
1941
|
-
}
|
|
1942
|
-
function _objectWithoutProperties(e, t) {
|
|
1943
|
-
if (null == e) return {};
|
|
1944
|
-
var o,
|
|
1945
|
-
r,
|
|
1946
|
-
i = _objectWithoutPropertiesLoose(e, t);
|
|
1947
|
-
if (Object.getOwnPropertySymbols) {
|
|
1948
|
-
var n = Object.getOwnPropertySymbols(e);
|
|
1949
|
-
for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]);
|
|
1950
|
-
}
|
|
1951
|
-
return i;
|
|
1952
|
-
}
|
|
1953
|
-
function _objectWithoutPropertiesLoose(r, e) {
|
|
1954
|
-
if (null == r) return {};
|
|
1955
|
-
var t = {};
|
|
1956
|
-
for (var n in r) if ({}.hasOwnProperty.call(r, n)) {
|
|
1957
|
-
if (-1 !== e.indexOf(n)) continue;
|
|
1958
|
-
t[n] = r[n];
|
|
1959
|
-
}
|
|
1960
|
-
return t;
|
|
1961
|
-
}
|
|
1962
|
-
function _slicedToArray(r, e) {
|
|
1963
|
-
return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest();
|
|
1964
|
-
}
|
|
1965
|
-
function _toConsumableArray(r) {
|
|
1966
|
-
return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread();
|
|
1967
|
-
}
|
|
1968
|
-
function _toPrimitive(t, r) {
|
|
1969
|
-
if ("object" != typeof t || !t) return t;
|
|
1970
|
-
var e = t[Symbol.toPrimitive];
|
|
1971
|
-
if (void 0 !== e) {
|
|
1972
|
-
var i = e.call(t, r);
|
|
1973
|
-
if ("object" != typeof i) return i;
|
|
1974
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1975
|
-
}
|
|
1976
|
-
return ("string" === r ? String : Number)(t);
|
|
1977
|
-
}
|
|
1978
|
-
function _toPropertyKey(t) {
|
|
1979
|
-
var i = _toPrimitive(t, "string");
|
|
1980
|
-
return "symbol" == typeof i ? i : i + "";
|
|
1981
|
-
}
|
|
1982
|
-
function _typeof(o) {
|
|
1983
|
-
"@babel/helpers - typeof";
|
|
1984
|
-
|
|
1985
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
1986
|
-
return typeof o;
|
|
1987
|
-
} : function (o) {
|
|
1988
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
1989
|
-
}, _typeof(o);
|
|
1990
|
-
}
|
|
1991
|
-
function _unsupportedIterableToArray(r, a) {
|
|
1992
|
-
if (r) {
|
|
1993
|
-
if ("string" == typeof r) return _arrayLikeToArray(r, a);
|
|
1994
|
-
var t = {}.toString.call(r).slice(8, -1);
|
|
1995
|
-
return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0;
|
|
1996
|
-
}
|
|
1997
|
-
}
|
|
1998
|
-
|
|
1999
|
-
var defaultToastLayout = {
|
|
2000
|
-
padding: '12px 16px',
|
|
2001
|
-
margin: '8px 0',
|
|
2002
|
-
width: '420px',
|
|
2003
|
-
maxWidth: '90vw',
|
|
2004
|
-
maxHeight: '75px',
|
|
2005
|
-
placement: 'bottomRight'
|
|
2006
|
-
};
|
|
2007
|
-
var defaultParams = {
|
|
2008
|
-
toasts: [],
|
|
2009
|
-
toastLayout: defaultToastLayout,
|
|
2010
|
-
updateToastLayout: function updateToastLayout(t) {
|
|
2011
|
-
return t;
|
|
2012
|
-
},
|
|
2013
|
-
updateToasts: function updateToasts(t) {
|
|
2014
|
-
return t;
|
|
2015
|
-
},
|
|
2016
|
-
lastUpdateToastId: null,
|
|
2017
|
-
updateLastToastId: function updateLastToastId() {
|
|
2018
|
-
return null;
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
var HUIContent = /*#__PURE__*/React$1.createContext(defaultParams);
|
|
2022
|
-
var useHUIContext = function useHUIContext() {
|
|
2023
|
-
return React$1.useContext(HUIContent);
|
|
2024
|
-
};
|
|
2025
|
-
|
|
2026
|
-
var defaultFont = {
|
|
2027
|
-
sans: '"Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen", "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif',
|
|
2028
|
-
mono: 'Menlo, Monaco, Lucida Console, Liberation Mono, DejaVu Sans Mono, Bitstream Vera Sans Mono, Courier New, monospace',
|
|
2029
|
-
prism: 'ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas,"Liberation Mono", "Courier New", monospace'
|
|
2030
|
-
};
|
|
2031
|
-
var defaultBreakpoints = {
|
|
2032
|
-
xs: {
|
|
2033
|
-
min: '0',
|
|
2034
|
-
max: '650px'
|
|
2035
|
-
},
|
|
2036
|
-
sm: {
|
|
2037
|
-
min: '650px',
|
|
2038
|
-
max: '900px'
|
|
2039
|
-
},
|
|
2040
|
-
md: {
|
|
2041
|
-
min: '900px',
|
|
2042
|
-
max: '1280px'
|
|
2043
|
-
},
|
|
2044
|
-
lg: {
|
|
2045
|
-
min: '1280px',
|
|
2046
|
-
max: '1920px'
|
|
2047
|
-
},
|
|
2048
|
-
xl: {
|
|
2049
|
-
min: '1920px',
|
|
2050
|
-
max: '10000px'
|
|
2051
|
-
}
|
|
2052
|
-
};
|
|
2053
|
-
var defaultLayout = {
|
|
2054
|
-
gap: '16pt',
|
|
2055
|
-
gapNegative: '-16pt',
|
|
2056
|
-
gapHalf: '8pt',
|
|
2057
|
-
gapHalfNegative: '-8pt',
|
|
2058
|
-
gapQuarter: '4pt',
|
|
2059
|
-
gapQuarterNegative: '-4pt',
|
|
2060
|
-
pageMargin: '16pt',
|
|
2061
|
-
pageWidth: '750pt',
|
|
2062
|
-
pageWidthWithMargin: '782pt',
|
|
2063
|
-
breakpointMobile: defaultBreakpoints.xs.max,
|
|
2064
|
-
breakpointTablet: defaultBreakpoints.sm.max,
|
|
2065
|
-
radius: '6px',
|
|
2066
|
-
unit: '16px'
|
|
2067
|
-
};
|
|
2068
|
-
|
|
2069
|
-
var palette$1 = {
|
|
2070
|
-
accents_1: '#fafafa',
|
|
2071
|
-
accents_2: '#eaeaea',
|
|
2072
|
-
accents_3: '#999',
|
|
2073
|
-
accents_4: '#888',
|
|
2074
|
-
accents_5: '#666',
|
|
2075
|
-
accents_6: '#444',
|
|
2076
|
-
accents_7: '#333',
|
|
2077
|
-
accents_8: '#111',
|
|
2078
|
-
background: '#fff',
|
|
2079
|
-
foreground: '#000',
|
|
2080
|
-
selection: '#79ffe1',
|
|
2081
|
-
secondary: '#666',
|
|
2082
|
-
code: '#f81ce5',
|
|
2083
|
-
border: '#eaeaea',
|
|
2084
|
-
error: '#e00',
|
|
2085
|
-
errorLight: '#ff1a1a',
|
|
2086
|
-
errorLighter: '#f7d4d6',
|
|
2087
|
-
errorDark: '#c50000',
|
|
2088
|
-
success: '#0070f3',
|
|
2089
|
-
successLight: '#3291ff',
|
|
2090
|
-
successLighter: '#d3e5ff',
|
|
2091
|
-
successDark: '#0761d1',
|
|
2092
|
-
warning: '#f5a623',
|
|
2093
|
-
warningLight: '#f7b955',
|
|
2094
|
-
warningLighter: '#ffefcf',
|
|
2095
|
-
warningDark: '#ab570a',
|
|
2096
|
-
cyan: '#50e3c2',
|
|
2097
|
-
cyanLighter: '#aaffec',
|
|
2098
|
-
cyanLight: '#79ffe1',
|
|
2099
|
-
cyanDark: '#29bc9b',
|
|
2100
|
-
violet: '#7928ca',
|
|
2101
|
-
violetLighter: '#e3d7fc',
|
|
2102
|
-
violetLight: '#8a63d2',
|
|
2103
|
-
violetDark: '#4c2889',
|
|
2104
|
-
purple: '#f81ce5',
|
|
2105
|
-
alert: '#ff0080',
|
|
2106
|
-
magenta: '#eb367f',
|
|
2107
|
-
link: '#0070f3'
|
|
2108
|
-
};
|
|
2109
|
-
var expressiveness$1 = {
|
|
2110
|
-
linkStyle: 'none',
|
|
2111
|
-
linkHoverStyle: 'none',
|
|
2112
|
-
dropdownBoxShadow: '0 4px 4px 0 rgba(0, 0, 0, 0.02)',
|
|
2113
|
-
scrollerStart: 'rgba(255, 255, 255, 1)',
|
|
2114
|
-
scrollerEnd: 'rgba(255, 255, 255, 0)',
|
|
2115
|
-
shadowSmall: '0 5px 10px rgba(0, 0, 0, 0.12)',
|
|
2116
|
-
shadowMedium: '0 8px 30px rgba(0, 0, 0, 0.12)',
|
|
2117
|
-
shadowLarge: '0 30px 60px rgba(0, 0, 0, 0.12)',
|
|
2118
|
-
portalOpacity: 0.25
|
|
2119
|
-
};
|
|
2120
|
-
var font$1 = defaultFont;
|
|
2121
|
-
var breakpoints$1 = defaultBreakpoints;
|
|
2122
|
-
var layout$1 = defaultLayout;
|
|
2123
|
-
var themes$1 = {
|
|
2124
|
-
type: 'light',
|
|
2125
|
-
font: font$1,
|
|
2126
|
-
layout: layout$1,
|
|
2127
|
-
palette: palette$1,
|
|
2128
|
-
breakpoints: breakpoints$1,
|
|
2129
|
-
expressiveness: expressiveness$1
|
|
2130
|
-
};
|
|
2131
|
-
|
|
2132
|
-
var palette = {
|
|
2133
|
-
accents_1: '#111',
|
|
2134
|
-
accents_2: '#333',
|
|
2135
|
-
accents_3: '#444',
|
|
2136
|
-
accents_4: '#666',
|
|
2137
|
-
accents_5: '#888',
|
|
2138
|
-
accents_6: '#999',
|
|
2139
|
-
accents_7: '#eaeaea',
|
|
2140
|
-
accents_8: '#fafafa',
|
|
2141
|
-
background: '#000',
|
|
2142
|
-
foreground: '#fff',
|
|
2143
|
-
selection: '#f81ce5',
|
|
2144
|
-
secondary: '#888',
|
|
2145
|
-
code: '#79ffe1',
|
|
2146
|
-
border: '#333',
|
|
2147
|
-
error: '#e00',
|
|
2148
|
-
errorLighter: '#f7d4d6',
|
|
2149
|
-
errorLight: '#ff1a1a',
|
|
2150
|
-
errorDark: '#c50000',
|
|
2151
|
-
success: '#0070f3',
|
|
2152
|
-
successLighter: '#d3e5ff',
|
|
2153
|
-
successLight: '#3291ff',
|
|
2154
|
-
successDark: '#0761d1',
|
|
2155
|
-
warning: '#f5a623',
|
|
2156
|
-
warningLighter: '#ffefcf',
|
|
2157
|
-
warningLight: '#f7b955',
|
|
2158
|
-
warningDark: '#ab570a',
|
|
2159
|
-
cyan: '#50e3c2',
|
|
2160
|
-
cyanLighter: '#aaffec',
|
|
2161
|
-
cyanLight: '#79ffe1',
|
|
2162
|
-
cyanDark: '#29bc9b',
|
|
2163
|
-
violet: '#7928ca',
|
|
2164
|
-
violetLighter: '#e3d7fc',
|
|
2165
|
-
violetLight: '#8a63d2',
|
|
2166
|
-
violetDark: '#4c2889',
|
|
2167
|
-
purple: '#f81ce5',
|
|
2168
|
-
alert: '#ff0080',
|
|
2169
|
-
magenta: '#eb367f',
|
|
2170
|
-
link: '#3291ff'
|
|
2171
|
-
};
|
|
2172
|
-
var expressiveness = {
|
|
2173
|
-
linkStyle: 'none',
|
|
2174
|
-
linkHoverStyle: 'none',
|
|
2175
|
-
dropdownBoxShadow: '0 0 0 1px #333',
|
|
2176
|
-
scrollerStart: 'rgba(255, 255, 255, 1)',
|
|
2177
|
-
scrollerEnd: 'rgba(255, 255, 255, 0)',
|
|
2178
|
-
shadowSmall: '0 0 0 1px #333',
|
|
2179
|
-
shadowMedium: '0 0 0 1px #333',
|
|
2180
|
-
shadowLarge: '0 0 0 1px #333',
|
|
2181
|
-
portalOpacity: 0.75
|
|
2182
|
-
};
|
|
2183
|
-
var font = defaultFont;
|
|
2184
|
-
var breakpoints = defaultBreakpoints;
|
|
2185
|
-
var layout = defaultLayout;
|
|
2186
|
-
var themes = {
|
|
2187
|
-
type: 'dark',
|
|
2188
|
-
font: font,
|
|
2189
|
-
layout: layout,
|
|
2190
|
-
palette: palette,
|
|
2191
|
-
breakpoints: breakpoints,
|
|
2192
|
-
expressiveness: expressiveness
|
|
2193
|
-
};
|
|
2194
|
-
|
|
2195
|
-
var isObject = function isObject(target) {
|
|
2196
|
-
return target && _typeof(target) === 'object';
|
|
2197
|
-
};
|
|
2198
|
-
var _deepDuplicable = function deepDuplicable(source, target) {
|
|
2199
|
-
if (!isObject(target) || !isObject(source)) return source;
|
|
2200
|
-
var sourceKeys = Object.keys(source);
|
|
2201
|
-
var result = {};
|
|
2202
|
-
for (var _i = 0, _sourceKeys = sourceKeys; _i < _sourceKeys.length; _i++) {
|
|
2203
|
-
var key = _sourceKeys[_i];
|
|
2204
|
-
var sourceValue = source[key];
|
|
2205
|
-
var targetValue = target[key];
|
|
2206
|
-
if (Array.isArray(sourceValue) && Array.isArray(targetValue)) {
|
|
2207
|
-
result[key] = targetValue.concat(sourceValue);
|
|
2208
|
-
} else if (isObject(sourceValue) && isObject(targetValue)) {
|
|
2209
|
-
result[key] = _deepDuplicable(sourceValue, _objectSpread2({}, targetValue));
|
|
2210
|
-
} else if (targetValue) {
|
|
2211
|
-
result[key] = targetValue;
|
|
2212
|
-
} else {
|
|
2213
|
-
result[key] = sourceValue;
|
|
2214
|
-
}
|
|
2215
|
-
}
|
|
2216
|
-
return result;
|
|
2217
|
-
};
|
|
2218
|
-
var getPresets = function getPresets() {
|
|
2219
|
-
return [themes$1, themes];
|
|
2220
|
-
};
|
|
2221
|
-
var getPresetStaticTheme = function getPresetStaticTheme() {
|
|
2222
|
-
return themes$1;
|
|
2223
|
-
};
|
|
2224
|
-
var isAvailableThemeType = function isAvailableThemeType(type) {
|
|
2225
|
-
if (!type) return false;
|
|
2226
|
-
var presetThemes = getPresets();
|
|
2227
|
-
var hasType = presetThemes.find(function (theme) {
|
|
2228
|
-
return theme.type === type;
|
|
2229
|
-
});
|
|
2230
|
-
return !hasType;
|
|
2231
|
-
};
|
|
2232
|
-
var isPresetTheme = function isPresetTheme(themeOrType) {
|
|
2233
|
-
if (!themeOrType) return false;
|
|
2234
|
-
var isType = typeof themeOrType === 'string';
|
|
2235
|
-
var type = isType ? themeOrType : themeOrType.type;
|
|
2236
|
-
return !isAvailableThemeType(type);
|
|
2237
|
-
};
|
|
2238
|
-
var hasUserCustomTheme = function hasUserCustomTheme() {
|
|
2239
|
-
var themes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
2240
|
-
return !!themes.find(function (item) {
|
|
2241
|
-
return isAvailableThemeType(item.type);
|
|
2242
|
-
});
|
|
2243
|
-
};
|
|
2244
|
-
var create = function create(base, custom) {
|
|
2245
|
-
if (!isAvailableThemeType(custom.type)) {
|
|
2246
|
-
throw new Error('Duplicate or unavailable theme type');
|
|
2247
|
-
}
|
|
2248
|
-
return _deepDuplicable(base, custom);
|
|
2249
|
-
};
|
|
2250
|
-
var createFromDark = function createFromDark(custom) {
|
|
2251
|
-
return create(themes, custom);
|
|
2252
|
-
};
|
|
2253
|
-
var createFromLight = function createFromLight(custom) {
|
|
2254
|
-
return create(themes$1, custom);
|
|
2255
|
-
};
|
|
2256
|
-
var Themes = {
|
|
2257
|
-
isPresetTheme: isPresetTheme,
|
|
2258
|
-
isAvailableThemeType: isAvailableThemeType,
|
|
2259
|
-
hasUserCustomTheme: hasUserCustomTheme,
|
|
2260
|
-
getPresets: getPresets,
|
|
2261
|
-
getPresetStaticTheme: getPresetStaticTheme,
|
|
2262
|
-
create: create,
|
|
2263
|
-
createFromDark: createFromDark,
|
|
2264
|
-
createFromLight: createFromLight
|
|
2265
|
-
};
|
|
2266
|
-
|
|
2267
|
-
/* "use client" */
|
|
2268
|
-
|
|
2269
|
-
var defaultTheme = Themes.getPresetStaticTheme();
|
|
2270
|
-
var ThemeContext = /*#__PURE__*/React$1.createContext(defaultTheme);
|
|
2271
|
-
var useTheme = function useTheme() {
|
|
2272
|
-
return React$1.useContext(ThemeContext);
|
|
2273
|
-
};
|
|
2274
|
-
|
|
2275
|
-
/* "use client" */
|
|
2276
|
-
|
|
2277
|
-
var defaultAllThemesConfig = {
|
|
2278
|
-
themes: Themes.getPresets()
|
|
2279
|
-
};
|
|
2280
|
-
var AllThemesContext = /*#__PURE__*/React$1.createContext(defaultAllThemesConfig);
|
|
2281
|
-
var useAllThemes = function useAllThemes() {
|
|
2282
|
-
return React$1.useContext(AllThemesContext);
|
|
2283
|
-
};
|
|
2284
|
-
|
|
2285
|
-
var ThemeProvider = function ThemeProvider(_ref) {
|
|
2286
|
-
var children = _ref.children,
|
|
2287
|
-
themeType = _ref.themeType,
|
|
2288
|
-
_ref$themes = _ref.themes,
|
|
2289
|
-
themes = _ref$themes === void 0 ? [] : _ref$themes;
|
|
2290
|
-
var _React$useState = React$1.useState({
|
|
2291
|
-
themes: Themes.getPresets()
|
|
2292
|
-
}),
|
|
2293
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
2294
|
-
allThemes = _React$useState2[0],
|
|
2295
|
-
setAllThemes = _React$useState2[1];
|
|
2296
|
-
var currentTheme = React$1.useMemo(function () {
|
|
2297
|
-
var theme = allThemes.themes.find(function (item) {
|
|
2298
|
-
return item.type === themeType;
|
|
2299
|
-
});
|
|
2300
|
-
if (theme) return theme;
|
|
2301
|
-
return Themes.getPresetStaticTheme();
|
|
2302
|
-
}, [allThemes, themeType]);
|
|
2303
|
-
React$1.useEffect(function () {
|
|
2304
|
-
if (!(themes !== null && themes !== void 0 && themes.length)) return;
|
|
2305
|
-
setAllThemes(function (last) {
|
|
2306
|
-
var safeThemes = themes.filter(function (item) {
|
|
2307
|
-
return Themes.isAvailableThemeType(item.type);
|
|
2308
|
-
});
|
|
2309
|
-
var nextThemes = Themes.getPresets().concat(safeThemes);
|
|
2310
|
-
return _objectSpread2(_objectSpread2({}, last), {}, {
|
|
2311
|
-
themes: nextThemes
|
|
2312
|
-
});
|
|
2313
|
-
});
|
|
2314
|
-
}, [themes]);
|
|
2315
|
-
return /*#__PURE__*/React$1.createElement(AllThemesContext.Provider, {
|
|
2316
|
-
value: allThemes
|
|
2317
|
-
}, /*#__PURE__*/React$1.createElement(ThemeContext.Provider, {
|
|
2318
|
-
value: currentTheme
|
|
2319
|
-
}, children));
|
|
2320
|
-
};
|
|
2321
|
-
|
|
2322
|
-
var useCurrentState = function useCurrentState(initialState) {
|
|
2323
|
-
var _useState = React$1.useState(function () {
|
|
2324
|
-
return typeof initialState === 'function' ? initialState() : initialState;
|
|
2325
|
-
}),
|
|
2326
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2327
|
-
state = _useState2[0],
|
|
2328
|
-
setState = _useState2[1];
|
|
2329
|
-
var ref = React$1.useRef(initialState);
|
|
2330
|
-
React$1.useEffect(function () {
|
|
2331
|
-
ref.current = state;
|
|
2332
|
-
}, [state]);
|
|
2333
|
-
var setValue = function setValue(val) {
|
|
2334
|
-
var result = typeof val === 'function' ? val(ref.current) : val;
|
|
2335
|
-
ref.current = result;
|
|
2336
|
-
setState(result);
|
|
2337
|
-
};
|
|
2338
|
-
return [state, setValue, ref];
|
|
2339
|
-
};
|
|
2340
|
-
|
|
2341
|
-
function getDefaultExportFromCjs (x) {
|
|
2342
|
-
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2343
|
-
}
|
|
2344
|
-
|
|
2345
|
-
var index = {};
|
|
2346
|
-
|
|
2347
|
-
var hasRequiredIndex;
|
|
2348
|
-
|
|
2349
|
-
function requireIndex () {
|
|
2350
|
-
if (hasRequiredIndex) return index;
|
|
2351
|
-
hasRequiredIndex = 1;
|
|
2352
|
-
var React$1$1 = React$1;
|
|
2353
|
-
|
|
2354
|
-
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
2355
|
-
|
|
2356
|
-
var React__default = /*#__PURE__*/_interopDefaultLegacy(React$1$1);
|
|
2357
|
-
|
|
2358
|
-
/*
|
|
2359
|
-
Based on Glamor's sheet
|
|
2360
|
-
https://github.com/threepointone/glamor/blob/667b480d31b3721a905021b26e1290ce92ca2879/src/sheet.js
|
|
2361
|
-
*/ function _defineProperties(target, props) {
|
|
2362
|
-
for(var i = 0; i < props.length; i++){
|
|
2363
|
-
var descriptor = props[i];
|
|
2364
|
-
descriptor.enumerable = descriptor.enumerable || false;
|
|
2365
|
-
descriptor.configurable = true;
|
|
2366
|
-
if ("value" in descriptor) descriptor.writable = true;
|
|
2367
|
-
Object.defineProperty(target, descriptor.key, descriptor);
|
|
2368
|
-
}
|
|
2369
|
-
}
|
|
2370
|
-
function _createClass(Constructor, protoProps, staticProps) {
|
|
2371
|
-
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
|
|
2372
|
-
return Constructor;
|
|
2373
|
-
}
|
|
2374
|
-
var isProd = typeof process !== "undefined" && process.env && process.env.NODE_ENV === "production";
|
|
2375
|
-
var isString = function(o) {
|
|
2376
|
-
return Object.prototype.toString.call(o) === "[object String]";
|
|
2377
|
-
};
|
|
2378
|
-
var StyleSheet = /*#__PURE__*/ function() {
|
|
2379
|
-
function StyleSheet(param) {
|
|
2380
|
-
var ref = param === void 0 ? {} : param, _name = ref.name, name = _name === void 0 ? "stylesheet" : _name, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? isProd : _optimizeForSpeed;
|
|
2381
|
-
invariant$1(isString(name), "`name` must be a string");
|
|
2382
|
-
this._name = name;
|
|
2383
|
-
this._deletedRulePlaceholder = "#" + name + "-deleted-rule____{}";
|
|
2384
|
-
invariant$1(typeof optimizeForSpeed === "boolean", "`optimizeForSpeed` must be a boolean");
|
|
2385
|
-
this._optimizeForSpeed = optimizeForSpeed;
|
|
2386
|
-
this._serverSheet = undefined;
|
|
2387
|
-
this._tags = [];
|
|
2388
|
-
this._injected = false;
|
|
2389
|
-
this._rulesCount = 0;
|
|
2390
|
-
var node = typeof window !== "undefined" && document.querySelector('meta[property="csp-nonce"]');
|
|
2391
|
-
this._nonce = node ? node.getAttribute("content") : null;
|
|
2392
|
-
}
|
|
2393
|
-
var _proto = StyleSheet.prototype;
|
|
2394
|
-
_proto.setOptimizeForSpeed = function setOptimizeForSpeed(bool) {
|
|
2395
|
-
invariant$1(typeof bool === "boolean", "`setOptimizeForSpeed` accepts a boolean");
|
|
2396
|
-
invariant$1(this._rulesCount === 0, "optimizeForSpeed cannot be when rules have already been inserted");
|
|
2397
|
-
this.flush();
|
|
2398
|
-
this._optimizeForSpeed = bool;
|
|
2399
|
-
this.inject();
|
|
2400
|
-
};
|
|
2401
|
-
_proto.isOptimizeForSpeed = function isOptimizeForSpeed() {
|
|
2402
|
-
return this._optimizeForSpeed;
|
|
2403
|
-
};
|
|
2404
|
-
_proto.inject = function inject() {
|
|
2405
|
-
var _this = this;
|
|
2406
|
-
invariant$1(!this._injected, "sheet already injected");
|
|
2407
|
-
this._injected = true;
|
|
2408
|
-
if (typeof window !== "undefined" && this._optimizeForSpeed) {
|
|
2409
|
-
this._tags[0] = this.makeStyleTag(this._name);
|
|
2410
|
-
this._optimizeForSpeed = "insertRule" in this.getSheet();
|
|
2411
|
-
if (!this._optimizeForSpeed) {
|
|
2412
|
-
if (!isProd) {
|
|
2413
|
-
console.warn("StyleSheet: optimizeForSpeed mode not supported falling back to standard mode.");
|
|
2414
|
-
}
|
|
2415
|
-
this.flush();
|
|
2416
|
-
this._injected = true;
|
|
2417
|
-
}
|
|
2418
|
-
return;
|
|
2419
|
-
}
|
|
2420
|
-
this._serverSheet = {
|
|
2421
|
-
cssRules: [],
|
|
2422
|
-
insertRule: function(rule, index) {
|
|
2423
|
-
if (typeof index === "number") {
|
|
2424
|
-
_this._serverSheet.cssRules[index] = {
|
|
2425
|
-
cssText: rule
|
|
2426
|
-
};
|
|
2427
|
-
} else {
|
|
2428
|
-
_this._serverSheet.cssRules.push({
|
|
2429
|
-
cssText: rule
|
|
2430
|
-
});
|
|
2431
|
-
}
|
|
2432
|
-
return index;
|
|
2433
|
-
},
|
|
2434
|
-
deleteRule: function(index) {
|
|
2435
|
-
_this._serverSheet.cssRules[index] = null;
|
|
2436
|
-
}
|
|
2437
|
-
};
|
|
2438
|
-
};
|
|
2439
|
-
_proto.getSheetForTag = function getSheetForTag(tag) {
|
|
2440
|
-
if (tag.sheet) {
|
|
2441
|
-
return tag.sheet;
|
|
2442
|
-
}
|
|
2443
|
-
// this weirdness brought to you by firefox
|
|
2444
|
-
for(var i = 0; i < document.styleSheets.length; i++){
|
|
2445
|
-
if (document.styleSheets[i].ownerNode === tag) {
|
|
2446
|
-
return document.styleSheets[i];
|
|
2447
|
-
}
|
|
2448
|
-
}
|
|
2449
|
-
};
|
|
2450
|
-
_proto.getSheet = function getSheet() {
|
|
2451
|
-
return this.getSheetForTag(this._tags[this._tags.length - 1]);
|
|
2452
|
-
};
|
|
2453
|
-
_proto.insertRule = function insertRule(rule, index) {
|
|
2454
|
-
invariant$1(isString(rule), "`insertRule` accepts only strings");
|
|
2455
|
-
if (typeof window === "undefined") {
|
|
2456
|
-
if (typeof index !== "number") {
|
|
2457
|
-
index = this._serverSheet.cssRules.length;
|
|
2458
|
-
}
|
|
2459
|
-
this._serverSheet.insertRule(rule, index);
|
|
2460
|
-
return this._rulesCount++;
|
|
2461
|
-
}
|
|
2462
|
-
if (this._optimizeForSpeed) {
|
|
2463
|
-
var sheet = this.getSheet();
|
|
2464
|
-
if (typeof index !== "number") {
|
|
2465
|
-
index = sheet.cssRules.length;
|
|
2466
|
-
}
|
|
2467
|
-
// this weirdness for perf, and chrome's weird bug
|
|
2468
|
-
// https://stackoverflow.com/questions/20007992/chrome-suddenly-stopped-accepting-insertrule
|
|
2469
|
-
try {
|
|
2470
|
-
sheet.insertRule(rule, index);
|
|
2471
|
-
} catch (error) {
|
|
2472
|
-
if (!isProd) {
|
|
2473
|
-
console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
|
|
2474
|
-
}
|
|
2475
|
-
return -1;
|
|
2476
|
-
}
|
|
2477
|
-
} else {
|
|
2478
|
-
var insertionPoint = this._tags[index];
|
|
2479
|
-
this._tags.push(this.makeStyleTag(this._name, rule, insertionPoint));
|
|
2480
|
-
}
|
|
2481
|
-
return this._rulesCount++;
|
|
2482
|
-
};
|
|
2483
|
-
_proto.replaceRule = function replaceRule(index, rule) {
|
|
2484
|
-
if (this._optimizeForSpeed || typeof window === "undefined") {
|
|
2485
|
-
var sheet = typeof window !== "undefined" ? this.getSheet() : this._serverSheet;
|
|
2486
|
-
if (!rule.trim()) {
|
|
2487
|
-
rule = this._deletedRulePlaceholder;
|
|
2488
|
-
}
|
|
2489
|
-
if (!sheet.cssRules[index]) {
|
|
2490
|
-
// @TBD Should we throw an error?
|
|
2491
|
-
return index;
|
|
2492
|
-
}
|
|
2493
|
-
sheet.deleteRule(index);
|
|
2494
|
-
try {
|
|
2495
|
-
sheet.insertRule(rule, index);
|
|
2496
|
-
} catch (error) {
|
|
2497
|
-
if (!isProd) {
|
|
2498
|
-
console.warn("StyleSheet: illegal rule: \n\n" + rule + "\n\nSee https://stackoverflow.com/q/20007992 for more info");
|
|
2499
|
-
}
|
|
2500
|
-
// In order to preserve the indices we insert a deleteRulePlaceholder
|
|
2501
|
-
sheet.insertRule(this._deletedRulePlaceholder, index);
|
|
2502
|
-
}
|
|
2503
|
-
} else {
|
|
2504
|
-
var tag = this._tags[index];
|
|
2505
|
-
invariant$1(tag, "old rule at index `" + index + "` not found");
|
|
2506
|
-
tag.textContent = rule;
|
|
2507
|
-
}
|
|
2508
|
-
return index;
|
|
2509
|
-
};
|
|
2510
|
-
_proto.deleteRule = function deleteRule(index) {
|
|
2511
|
-
if (typeof window === "undefined") {
|
|
2512
|
-
this._serverSheet.deleteRule(index);
|
|
2513
|
-
return;
|
|
2514
|
-
}
|
|
2515
|
-
if (this._optimizeForSpeed) {
|
|
2516
|
-
this.replaceRule(index, "");
|
|
2517
|
-
} else {
|
|
2518
|
-
var tag = this._tags[index];
|
|
2519
|
-
invariant$1(tag, "rule at index `" + index + "` not found");
|
|
2520
|
-
tag.parentNode.removeChild(tag);
|
|
2521
|
-
this._tags[index] = null;
|
|
2522
|
-
}
|
|
2523
|
-
};
|
|
2524
|
-
_proto.flush = function flush() {
|
|
2525
|
-
this._injected = false;
|
|
2526
|
-
this._rulesCount = 0;
|
|
2527
|
-
if (typeof window !== "undefined") {
|
|
2528
|
-
this._tags.forEach(function(tag) {
|
|
2529
|
-
return tag && tag.parentNode.removeChild(tag);
|
|
2530
|
-
});
|
|
2531
|
-
this._tags = [];
|
|
2532
|
-
} else {
|
|
2533
|
-
// simpler on server
|
|
2534
|
-
this._serverSheet.cssRules = [];
|
|
2535
|
-
}
|
|
2536
|
-
};
|
|
2537
|
-
_proto.cssRules = function cssRules() {
|
|
2538
|
-
var _this = this;
|
|
2539
|
-
if (typeof window === "undefined") {
|
|
2540
|
-
return this._serverSheet.cssRules;
|
|
2541
|
-
}
|
|
2542
|
-
return this._tags.reduce(function(rules, tag) {
|
|
2543
|
-
if (tag) {
|
|
2544
|
-
rules = rules.concat(Array.prototype.map.call(_this.getSheetForTag(tag).cssRules, function(rule) {
|
|
2545
|
-
return rule.cssText === _this._deletedRulePlaceholder ? null : rule;
|
|
2546
|
-
}));
|
|
2547
|
-
} else {
|
|
2548
|
-
rules.push(null);
|
|
2549
|
-
}
|
|
2550
|
-
return rules;
|
|
2551
|
-
}, []);
|
|
2552
|
-
};
|
|
2553
|
-
_proto.makeStyleTag = function makeStyleTag(name, cssString, relativeToTag) {
|
|
2554
|
-
if (cssString) {
|
|
2555
|
-
invariant$1(isString(cssString), "makeStyleTag accepts only strings as second parameter");
|
|
2556
|
-
}
|
|
2557
|
-
var tag = document.createElement("style");
|
|
2558
|
-
if (this._nonce) tag.setAttribute("nonce", this._nonce);
|
|
2559
|
-
tag.type = "text/css";
|
|
2560
|
-
tag.setAttribute("data-" + name, "");
|
|
2561
|
-
if (cssString) {
|
|
2562
|
-
tag.appendChild(document.createTextNode(cssString));
|
|
2563
|
-
}
|
|
2564
|
-
var head = document.head || document.getElementsByTagName("head")[0];
|
|
2565
|
-
if (relativeToTag) {
|
|
2566
|
-
head.insertBefore(tag, relativeToTag);
|
|
2567
|
-
} else {
|
|
2568
|
-
head.appendChild(tag);
|
|
2569
|
-
}
|
|
2570
|
-
return tag;
|
|
2571
|
-
};
|
|
2572
|
-
_createClass(StyleSheet, [
|
|
2573
|
-
{
|
|
2574
|
-
key: "length",
|
|
2575
|
-
get: function get() {
|
|
2576
|
-
return this._rulesCount;
|
|
2577
|
-
}
|
|
2578
|
-
}
|
|
2579
|
-
]);
|
|
2580
|
-
return StyleSheet;
|
|
2581
|
-
}();
|
|
2582
|
-
function invariant$1(condition, message) {
|
|
2583
|
-
if (!condition) {
|
|
2584
|
-
throw new Error("StyleSheet: " + message + ".");
|
|
2585
|
-
}
|
|
2586
|
-
}
|
|
2587
|
-
|
|
2588
|
-
function hash(str) {
|
|
2589
|
-
var _$hash = 5381, i = str.length;
|
|
2590
|
-
while(i){
|
|
2591
|
-
_$hash = _$hash * 33 ^ str.charCodeAt(--i);
|
|
2592
|
-
}
|
|
2593
|
-
/* JavaScript does bitwise operations (like XOR, above) on 32-bit signed
|
|
2594
|
-
* integers. Since we want the results to be always positive, convert the
|
|
2595
|
-
* signed int to an unsigned by doing an unsigned bitshift. */ return _$hash >>> 0;
|
|
2596
|
-
}
|
|
2597
|
-
var stringHash = hash;
|
|
2598
|
-
|
|
2599
|
-
var sanitize = function(rule) {
|
|
2600
|
-
return rule.replace(/\/style/gi, "\\/style");
|
|
2601
|
-
};
|
|
2602
|
-
var cache = {};
|
|
2603
|
-
/**
|
|
2604
|
-
* computeId
|
|
2605
|
-
*
|
|
2606
|
-
* Compute and memoize a jsx id from a basedId and optionally props.
|
|
2607
|
-
*/ function computeId(baseId, props) {
|
|
2608
|
-
if (!props) {
|
|
2609
|
-
return "jsx-" + baseId;
|
|
2610
|
-
}
|
|
2611
|
-
var propsToString = String(props);
|
|
2612
|
-
var key = baseId + propsToString;
|
|
2613
|
-
if (!cache[key]) {
|
|
2614
|
-
cache[key] = "jsx-" + stringHash(baseId + "-" + propsToString);
|
|
2615
|
-
}
|
|
2616
|
-
return cache[key];
|
|
2617
|
-
}
|
|
2618
|
-
/**
|
|
2619
|
-
* computeSelector
|
|
2620
|
-
*
|
|
2621
|
-
* Compute and memoize dynamic selectors.
|
|
2622
|
-
*/ function computeSelector(id, css) {
|
|
2623
|
-
var selectoPlaceholderRegexp = /__jsx-style-dynamic-selector/g;
|
|
2624
|
-
// Sanitize SSR-ed CSS.
|
|
2625
|
-
// Client side code doesn't need to be sanitized since we use
|
|
2626
|
-
// document.createTextNode (dev) and the CSSOM api sheet.insertRule (prod).
|
|
2627
|
-
if (typeof window === "undefined") {
|
|
2628
|
-
css = sanitize(css);
|
|
2629
|
-
}
|
|
2630
|
-
var idcss = id + css;
|
|
2631
|
-
if (!cache[idcss]) {
|
|
2632
|
-
cache[idcss] = css.replace(selectoPlaceholderRegexp, id);
|
|
2633
|
-
}
|
|
2634
|
-
return cache[idcss];
|
|
2635
|
-
}
|
|
2636
|
-
|
|
2637
|
-
function mapRulesToStyle(cssRules, options) {
|
|
2638
|
-
if (options === void 0) options = {};
|
|
2639
|
-
return cssRules.map(function(args) {
|
|
2640
|
-
var id = args[0];
|
|
2641
|
-
var css = args[1];
|
|
2642
|
-
return /*#__PURE__*/ React__default["default"].createElement("style", {
|
|
2643
|
-
id: "__" + id,
|
|
2644
|
-
// Avoid warnings upon render with a key
|
|
2645
|
-
key: "__" + id,
|
|
2646
|
-
nonce: options.nonce ? options.nonce : undefined,
|
|
2647
|
-
dangerouslySetInnerHTML: {
|
|
2648
|
-
__html: css
|
|
2649
|
-
}
|
|
2650
|
-
});
|
|
2651
|
-
});
|
|
2652
|
-
}
|
|
2653
|
-
var StyleSheetRegistry = /*#__PURE__*/ function() {
|
|
2654
|
-
function StyleSheetRegistry(param) {
|
|
2655
|
-
var ref = param === void 0 ? {} : param, _styleSheet = ref.styleSheet, styleSheet = _styleSheet === void 0 ? null : _styleSheet, _optimizeForSpeed = ref.optimizeForSpeed, optimizeForSpeed = _optimizeForSpeed === void 0 ? false : _optimizeForSpeed;
|
|
2656
|
-
this._sheet = styleSheet || new StyleSheet({
|
|
2657
|
-
name: "styled-jsx",
|
|
2658
|
-
optimizeForSpeed: optimizeForSpeed
|
|
2659
|
-
});
|
|
2660
|
-
this._sheet.inject();
|
|
2661
|
-
if (styleSheet && typeof optimizeForSpeed === "boolean") {
|
|
2662
|
-
this._sheet.setOptimizeForSpeed(optimizeForSpeed);
|
|
2663
|
-
this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
|
|
2664
|
-
}
|
|
2665
|
-
this._fromServer = undefined;
|
|
2666
|
-
this._indices = {};
|
|
2667
|
-
this._instancesCounts = {};
|
|
2668
|
-
}
|
|
2669
|
-
var _proto = StyleSheetRegistry.prototype;
|
|
2670
|
-
_proto.add = function add(props) {
|
|
2671
|
-
var _this = this;
|
|
2672
|
-
if (undefined === this._optimizeForSpeed) {
|
|
2673
|
-
this._optimizeForSpeed = Array.isArray(props.children);
|
|
2674
|
-
this._sheet.setOptimizeForSpeed(this._optimizeForSpeed);
|
|
2675
|
-
this._optimizeForSpeed = this._sheet.isOptimizeForSpeed();
|
|
2676
|
-
}
|
|
2677
|
-
if (typeof window !== "undefined" && !this._fromServer) {
|
|
2678
|
-
this._fromServer = this.selectFromServer();
|
|
2679
|
-
this._instancesCounts = Object.keys(this._fromServer).reduce(function(acc, tagName) {
|
|
2680
|
-
acc[tagName] = 0;
|
|
2681
|
-
return acc;
|
|
2682
|
-
}, {});
|
|
2683
|
-
}
|
|
2684
|
-
var ref = this.getIdAndRules(props), styleId = ref.styleId, rules = ref.rules;
|
|
2685
|
-
// Deduping: just increase the instances count.
|
|
2686
|
-
if (styleId in this._instancesCounts) {
|
|
2687
|
-
this._instancesCounts[styleId] += 1;
|
|
2688
|
-
return;
|
|
2689
|
-
}
|
|
2690
|
-
var indices = rules.map(function(rule) {
|
|
2691
|
-
return _this._sheet.insertRule(rule);
|
|
2692
|
-
})// Filter out invalid rules
|
|
2693
|
-
.filter(function(index) {
|
|
2694
|
-
return index !== -1;
|
|
2695
|
-
});
|
|
2696
|
-
this._indices[styleId] = indices;
|
|
2697
|
-
this._instancesCounts[styleId] = 1;
|
|
2698
|
-
};
|
|
2699
|
-
_proto.remove = function remove(props) {
|
|
2700
|
-
var _this = this;
|
|
2701
|
-
var styleId = this.getIdAndRules(props).styleId;
|
|
2702
|
-
invariant(styleId in this._instancesCounts, "styleId: `" + styleId + "` not found");
|
|
2703
|
-
this._instancesCounts[styleId] -= 1;
|
|
2704
|
-
if (this._instancesCounts[styleId] < 1) {
|
|
2705
|
-
var tagFromServer = this._fromServer && this._fromServer[styleId];
|
|
2706
|
-
if (tagFromServer) {
|
|
2707
|
-
tagFromServer.parentNode.removeChild(tagFromServer);
|
|
2708
|
-
delete this._fromServer[styleId];
|
|
2709
|
-
} else {
|
|
2710
|
-
this._indices[styleId].forEach(function(index) {
|
|
2711
|
-
return _this._sheet.deleteRule(index);
|
|
2712
|
-
});
|
|
2713
|
-
delete this._indices[styleId];
|
|
2714
|
-
}
|
|
2715
|
-
delete this._instancesCounts[styleId];
|
|
2716
|
-
}
|
|
2717
|
-
};
|
|
2718
|
-
_proto.update = function update(props, nextProps) {
|
|
2719
|
-
this.add(nextProps);
|
|
2720
|
-
this.remove(props);
|
|
2721
|
-
};
|
|
2722
|
-
_proto.flush = function flush() {
|
|
2723
|
-
this._sheet.flush();
|
|
2724
|
-
this._sheet.inject();
|
|
2725
|
-
this._fromServer = undefined;
|
|
2726
|
-
this._indices = {};
|
|
2727
|
-
this._instancesCounts = {};
|
|
2728
|
-
};
|
|
2729
|
-
_proto.cssRules = function cssRules() {
|
|
2730
|
-
var _this = this;
|
|
2731
|
-
var fromServer = this._fromServer ? Object.keys(this._fromServer).map(function(styleId) {
|
|
2732
|
-
return [
|
|
2733
|
-
styleId,
|
|
2734
|
-
_this._fromServer[styleId]
|
|
2735
|
-
];
|
|
2736
|
-
}) : [];
|
|
2737
|
-
var cssRules = this._sheet.cssRules();
|
|
2738
|
-
return fromServer.concat(Object.keys(this._indices).map(function(styleId) {
|
|
2739
|
-
return [
|
|
2740
|
-
styleId,
|
|
2741
|
-
_this._indices[styleId].map(function(index) {
|
|
2742
|
-
return cssRules[index].cssText;
|
|
2743
|
-
}).join(_this._optimizeForSpeed ? "" : "\n")
|
|
2744
|
-
];
|
|
2745
|
-
})// filter out empty rules
|
|
2746
|
-
.filter(function(rule) {
|
|
2747
|
-
return Boolean(rule[1]);
|
|
2748
|
-
}));
|
|
2749
|
-
};
|
|
2750
|
-
_proto.styles = function styles(options) {
|
|
2751
|
-
return mapRulesToStyle(this.cssRules(), options);
|
|
2752
|
-
};
|
|
2753
|
-
_proto.getIdAndRules = function getIdAndRules(props) {
|
|
2754
|
-
var css = props.children, dynamic = props.dynamic, id = props.id;
|
|
2755
|
-
if (dynamic) {
|
|
2756
|
-
var styleId = computeId(id, dynamic);
|
|
2757
|
-
return {
|
|
2758
|
-
styleId: styleId,
|
|
2759
|
-
rules: Array.isArray(css) ? css.map(function(rule) {
|
|
2760
|
-
return computeSelector(styleId, rule);
|
|
2761
|
-
}) : [
|
|
2762
|
-
computeSelector(styleId, css)
|
|
2763
|
-
]
|
|
2764
|
-
};
|
|
2765
|
-
}
|
|
2766
|
-
return {
|
|
2767
|
-
styleId: computeId(id),
|
|
2768
|
-
rules: Array.isArray(css) ? css : [
|
|
2769
|
-
css
|
|
2770
|
-
]
|
|
2771
|
-
};
|
|
2772
|
-
};
|
|
2773
|
-
/**
|
|
2774
|
-
* selectFromServer
|
|
2775
|
-
*
|
|
2776
|
-
* Collects style tags from the document with id __jsx-XXX
|
|
2777
|
-
*/ _proto.selectFromServer = function selectFromServer() {
|
|
2778
|
-
var elements = Array.prototype.slice.call(document.querySelectorAll('[id^="__jsx-"]'));
|
|
2779
|
-
return elements.reduce(function(acc, element) {
|
|
2780
|
-
var id = element.id.slice(2);
|
|
2781
|
-
acc[id] = element;
|
|
2782
|
-
return acc;
|
|
2783
|
-
}, {});
|
|
2784
|
-
};
|
|
2785
|
-
return StyleSheetRegistry;
|
|
2786
|
-
}();
|
|
2787
|
-
function invariant(condition, message) {
|
|
2788
|
-
if (!condition) {
|
|
2789
|
-
throw new Error("StyleSheetRegistry: " + message + ".");
|
|
2790
|
-
}
|
|
2791
|
-
}
|
|
2792
|
-
var StyleSheetContext = /*#__PURE__*/ React$1$1.createContext(null);
|
|
2793
|
-
StyleSheetContext.displayName = "StyleSheetContext";
|
|
2794
|
-
function createStyleRegistry() {
|
|
2795
|
-
return new StyleSheetRegistry();
|
|
2796
|
-
}
|
|
2797
|
-
function StyleRegistry(param) {
|
|
2798
|
-
var configuredRegistry = param.registry, children = param.children;
|
|
2799
|
-
var rootRegistry = React$1$1.useContext(StyleSheetContext);
|
|
2800
|
-
var ref = React$1$1.useState(function() {
|
|
2801
|
-
return rootRegistry || configuredRegistry || createStyleRegistry();
|
|
2802
|
-
}), registry = ref[0];
|
|
2803
|
-
return /*#__PURE__*/ React__default["default"].createElement(StyleSheetContext.Provider, {
|
|
2804
|
-
value: registry
|
|
2805
|
-
}, children);
|
|
2806
|
-
}
|
|
2807
|
-
function useStyleRegistry() {
|
|
2808
|
-
return React$1$1.useContext(StyleSheetContext);
|
|
2809
|
-
}
|
|
2810
|
-
|
|
2811
|
-
// Opt-into the new `useInsertionEffect` API in React 18, fallback to `useLayoutEffect`.
|
|
2812
|
-
// https://github.com/reactwg/react-18/discussions/110
|
|
2813
|
-
var useInsertionEffect = React__default["default"].useInsertionEffect || React$1$1.useLayoutEffect;
|
|
2814
|
-
var defaultRegistry = typeof window !== "undefined" ? createStyleRegistry() : undefined;
|
|
2815
|
-
function JSXStyle(props) {
|
|
2816
|
-
var registry = defaultRegistry ? defaultRegistry : useStyleRegistry();
|
|
2817
|
-
var insertionEffectCalled = React$1$1.useRef(false);
|
|
2818
|
-
// `registry` might not exist while server-side rendering
|
|
2819
|
-
if (!registry) {
|
|
2820
|
-
return null;
|
|
2821
|
-
}
|
|
2822
|
-
if (typeof window === "undefined") {
|
|
2823
|
-
registry.add(props);
|
|
2824
|
-
return null;
|
|
2825
|
-
}
|
|
2826
|
-
useInsertionEffect(function() {
|
|
2827
|
-
// ReactDOM removes all DOM during hydration in certain cases
|
|
2828
|
-
if (!document.head) {
|
|
2829
|
-
return;
|
|
2830
|
-
}
|
|
2831
|
-
registry.add(props);
|
|
2832
|
-
insertionEffectCalled.current = true;
|
|
2833
|
-
return function() {
|
|
2834
|
-
insertionEffectCalled.current = false;
|
|
2835
|
-
registry.remove(props);
|
|
2836
|
-
};
|
|
2837
|
-
}, [
|
|
2838
|
-
props.id,
|
|
2839
|
-
String(props.dynamic)
|
|
2840
|
-
]);
|
|
2841
|
-
React$1$1.useLayoutEffect(function() {
|
|
2842
|
-
if (!document.head || insertionEffectCalled.current) {
|
|
2843
|
-
return;
|
|
2844
|
-
}
|
|
2845
|
-
registry.add(props);
|
|
2846
|
-
return function() {
|
|
2847
|
-
registry.remove(props);
|
|
2848
|
-
};
|
|
2849
|
-
// props.children can be string[], will be striped since id is identical
|
|
2850
|
-
}, [
|
|
2851
|
-
props.id,
|
|
2852
|
-
String(props.dynamic)
|
|
2853
|
-
]);
|
|
2854
|
-
return null;
|
|
2855
|
-
}
|
|
2856
|
-
JSXStyle.dynamic = function(info) {
|
|
2857
|
-
return info.map(function(tagInfo) {
|
|
2858
|
-
var baseId = tagInfo[0];
|
|
2859
|
-
var props = tagInfo[1];
|
|
2860
|
-
return computeId(baseId, props);
|
|
2861
|
-
}).join(" ");
|
|
2862
|
-
};
|
|
2863
|
-
|
|
2864
|
-
index.StyleRegistry = StyleRegistry;
|
|
2865
|
-
index.createStyleRegistry = createStyleRegistry;
|
|
2866
|
-
index.style = JSXStyle;
|
|
2867
|
-
index.useStyleRegistry = useStyleRegistry;
|
|
2868
|
-
return index;
|
|
2869
|
-
}
|
|
2870
|
-
|
|
2871
|
-
var style;
|
|
2872
|
-
var hasRequiredStyle;
|
|
2873
|
-
|
|
2874
|
-
function requireStyle () {
|
|
2875
|
-
if (hasRequiredStyle) return style;
|
|
2876
|
-
hasRequiredStyle = 1;
|
|
2877
|
-
style = requireIndex().style;
|
|
2878
|
-
return style;
|
|
2879
|
-
}
|
|
2880
|
-
|
|
2881
|
-
var styleExports = requireStyle();
|
|
2882
|
-
var _JSXStyle = /*@__PURE__*/getDefaultExportFromCjs(styleExports);
|
|
2883
|
-
|
|
2884
|
-
/* "use client" */
|
|
2885
|
-
|
|
2886
|
-
var getId = function getId() {
|
|
2887
|
-
return Math.random().toString(32).slice(2, 10);
|
|
2888
|
-
};
|
|
2889
|
-
var isBrowser = function isBrowser() {
|
|
2890
|
-
return Boolean(typeof window !== 'undefined' && window.document && window.document.createElement);
|
|
2891
|
-
};
|
|
2892
|
-
|
|
2893
|
-
var useSSR = function useSSR() {
|
|
2894
|
-
var _useState = React$1.useState(false),
|
|
2895
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2896
|
-
browser = _useState2[0],
|
|
2897
|
-
setBrowser = _useState2[1];
|
|
2898
|
-
React$1.useEffect(function () {
|
|
2899
|
-
setBrowser(isBrowser());
|
|
2900
|
-
}, []);
|
|
2901
|
-
return {
|
|
2902
|
-
isBrowser: browser,
|
|
2903
|
-
isServer: !browser
|
|
2904
|
-
};
|
|
2905
|
-
};
|
|
2906
|
-
|
|
2907
|
-
var createElement = function createElement(id) {
|
|
2908
|
-
var el = document.createElement('div');
|
|
2909
|
-
el.setAttribute('id', id);
|
|
2910
|
-
return el;
|
|
2911
|
-
};
|
|
2912
|
-
var usePortal = function usePortal() {
|
|
2913
|
-
var selectId = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getId();
|
|
2914
|
-
var getContainer = arguments.length > 1 ? arguments[1] : undefined;
|
|
2915
|
-
var id = "helpdice-ui-".concat(selectId);
|
|
2916
|
-
var _useSSR = useSSR(),
|
|
2917
|
-
isBrowser = _useSSR.isBrowser;
|
|
2918
|
-
var _useState = React$1.useState(isBrowser ? createElement(id) : null),
|
|
2919
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2920
|
-
elSnapshot = _useState2[0],
|
|
2921
|
-
setElSnapshot = _useState2[1];
|
|
2922
|
-
React$1.useEffect(function () {
|
|
2923
|
-
var customContainer = getContainer ? getContainer() : null;
|
|
2924
|
-
var parentElement = customContainer || document.body;
|
|
2925
|
-
var hasElement = parentElement.querySelector("#".concat(id));
|
|
2926
|
-
var el = hasElement || createElement(id);
|
|
2927
|
-
if (!hasElement) {
|
|
2928
|
-
parentElement.appendChild(el);
|
|
2929
|
-
}
|
|
2930
|
-
setElSnapshot(el);
|
|
2931
|
-
}, []);
|
|
2932
|
-
return elSnapshot;
|
|
2933
|
-
};
|
|
2934
|
-
|
|
2935
|
-
var _excluded$2 = ["children", "className", "visible", "enterTime", "leaveTime", "clearTime", "name"];
|
|
2936
|
-
var CssTransition = function CssTransition(_ref) {
|
|
2937
|
-
var children = _ref.children,
|
|
2938
|
-
_ref$className = _ref.className,
|
|
2939
|
-
className = _ref$className === void 0 ? '' : _ref$className,
|
|
2940
|
-
_ref$visible = _ref.visible,
|
|
2941
|
-
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
2942
|
-
_ref$enterTime = _ref.enterTime,
|
|
2943
|
-
enterTime = _ref$enterTime === void 0 ? 60 : _ref$enterTime,
|
|
2944
|
-
_ref$leaveTime = _ref.leaveTime,
|
|
2945
|
-
leaveTime = _ref$leaveTime === void 0 ? 60 : _ref$leaveTime,
|
|
2946
|
-
_ref$clearTime = _ref.clearTime,
|
|
2947
|
-
clearTime = _ref$clearTime === void 0 ? 60 : _ref$clearTime,
|
|
2948
|
-
_ref$name = _ref.name,
|
|
2949
|
-
name = _ref$name === void 0 ? 'transition' : _ref$name,
|
|
2950
|
-
props = _objectWithoutProperties(_ref, _excluded$2);
|
|
2951
|
-
var _useState = React$1.useState(''),
|
|
2952
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
2953
|
-
classes = _useState2[0],
|
|
2954
|
-
setClasses = _useState2[1];
|
|
2955
|
-
var _useState3 = React$1.useState(visible),
|
|
2956
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
2957
|
-
renderable = _useState4[0],
|
|
2958
|
-
setRenderable = _useState4[1];
|
|
2959
|
-
React$1.useEffect(function () {
|
|
2960
|
-
var statusClassName = visible ? 'enter' : 'leave';
|
|
2961
|
-
var time = visible ? enterTime : leaveTime;
|
|
2962
|
-
if (visible && !renderable) {
|
|
2963
|
-
setRenderable(true);
|
|
2964
|
-
}
|
|
2965
|
-
setClasses("".concat(name, "-").concat(statusClassName));
|
|
2966
|
-
|
|
2967
|
-
// set class to active
|
|
2968
|
-
var timer = setTimeout(function () {
|
|
2969
|
-
setClasses("".concat(name, "-").concat(statusClassName, " ").concat(name, "-").concat(statusClassName, "-active"));
|
|
2970
|
-
clearTimeout(timer);
|
|
2971
|
-
}, time);
|
|
2972
|
-
|
|
2973
|
-
// remove classess when animation over
|
|
2974
|
-
var clearClassesTimer = setTimeout(function () {
|
|
2975
|
-
if (!visible) {
|
|
2976
|
-
setClasses('');
|
|
2977
|
-
setRenderable(false);
|
|
2978
|
-
}
|
|
2979
|
-
clearTimeout(clearClassesTimer);
|
|
2980
|
-
}, time + clearTime);
|
|
2981
|
-
return function () {
|
|
2982
|
-
clearTimeout(timer);
|
|
2983
|
-
clearTimeout(clearClassesTimer);
|
|
2984
|
-
};
|
|
2985
|
-
}, [visible, renderable]);
|
|
2986
|
-
if (! /*#__PURE__*/React$1.isValidElement(children) || !renderable) return null;
|
|
2987
|
-
var propsTransition = _objectSpread2(_objectSpread2({}, props), {}, {
|
|
2988
|
-
className: "".concat(children.props.className, " ").concat(className, " ").concat(classes)
|
|
2989
|
-
});
|
|
2990
|
-
return /*#__PURE__*/React$1.cloneElement(children, propsTransition);
|
|
2991
|
-
};
|
|
2992
|
-
CssTransition.displayName = 'CssTransition';
|
|
2993
|
-
|
|
2994
|
-
var tuple = function tuple() {
|
|
2995
|
-
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
2996
|
-
args[_key] = arguments[_key];
|
|
2997
|
-
}
|
|
2998
|
-
return args;
|
|
2999
|
-
};
|
|
3000
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'abort', 'secondary-light', 'success-light', 'warning-light', 'error-light');
|
|
3001
|
-
tuple('default', 'secondary', 'success', 'warning', 'error');
|
|
3002
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite');
|
|
3003
|
-
tuple('default', 'secondary', 'success', 'warning', 'error', 'dark', 'lite', 'alert', 'purple', 'violet', 'cyan');
|
|
3004
|
-
tuple('default', 'silent', 'prevent');
|
|
3005
|
-
tuple('hover', 'click');
|
|
3006
|
-
tuple('top', 'topStart', 'topEnd', 'left', 'leftStart', 'leftEnd', 'bottom', 'bottomStart', 'bottomEnd', 'right', 'rightStart', 'rightEnd');
|
|
3007
|
-
tuple('start', 'center', 'end', 'left', 'right');
|
|
3008
|
-
|
|
3009
|
-
var makeToastActions = function makeToastActions(actions, cancelHandle) {
|
|
3010
|
-
var handler = function handler(event, userHandler) {
|
|
3011
|
-
userHandler && userHandler(event, cancelHandle);
|
|
3012
|
-
};
|
|
3013
|
-
if (!actions || !actions.length) return null;
|
|
3014
|
-
return actions.map(function (action, index) {
|
|
3015
|
-
return /*#__PURE__*/React$1.createElement("button", {
|
|
3016
|
-
color: action.passive ? 'default' : 'secondary',
|
|
3017
|
-
key: "action-".concat(index),
|
|
3018
|
-
onClick: function onClick(event) {
|
|
3019
|
-
return handler(event, action.handler);
|
|
3020
|
-
}
|
|
3021
|
-
}, action.name);
|
|
3022
|
-
});
|
|
3023
|
-
};
|
|
3024
|
-
var getColors = function getColors(palette, type) {
|
|
3025
|
-
var colors = {
|
|
3026
|
-
"default": palette.background,
|
|
3027
|
-
secondary: palette.secondary,
|
|
3028
|
-
success: palette.success,
|
|
3029
|
-
warning: palette.warning,
|
|
3030
|
-
error: palette.error
|
|
3031
|
-
};
|
|
3032
|
-
var isDefault = !type || type === 'default';
|
|
3033
|
-
if (isDefault) return {
|
|
3034
|
-
bgColor: colors["default"],
|
|
3035
|
-
color: palette.foreground
|
|
3036
|
-
};
|
|
3037
|
-
/**
|
|
3038
|
-
* Prevent main color change in special types.
|
|
3039
|
-
* The color will only follow the theme when it is in the default type.
|
|
3040
|
-
*/
|
|
3041
|
-
return {
|
|
3042
|
-
bgColor: colors[type],
|
|
3043
|
-
color: 'white'
|
|
3044
|
-
};
|
|
3045
|
-
};
|
|
3046
|
-
tuple('topLeft', 'topRight', 'bottomLeft', 'bottomRight');
|
|
3047
|
-
var isTopPlacement = function isTopPlacement(placement) {
|
|
3048
|
-
return "".concat(placement).toLowerCase().startsWith('top');
|
|
3049
|
-
};
|
|
3050
|
-
var isLeftPlacement = function isLeftPlacement(placement) {
|
|
3051
|
-
return "".concat(placement).toLowerCase().endsWith('left');
|
|
3052
|
-
};
|
|
3053
|
-
var getTranslateByPlacement = function getTranslateByPlacement(placement) {
|
|
3054
|
-
var translateInByPlacement = {
|
|
3055
|
-
topLeft: 'translate(-60px, -60px)',
|
|
3056
|
-
topRight: 'translate(60px, -60px)',
|
|
3057
|
-
bottomLeft: 'translate(-60px, 60px)',
|
|
3058
|
-
bottomRight: 'translate(60px, 60px)'
|
|
3059
|
-
};
|
|
3060
|
-
var translateOutByPlacement = {
|
|
3061
|
-
topLeft: 'translate(-50px, 15px) scale(0.85)',
|
|
3062
|
-
topRight: 'translate(50px, 15px) scale(0.85)',
|
|
3063
|
-
bottomLeft: 'translate(-50px, -15px) scale(0.85)',
|
|
3064
|
-
bottomRight: 'translate(50px, -15px) scale(0.85)'
|
|
3065
|
-
};
|
|
3066
|
-
return {
|
|
3067
|
-
enter: translateInByPlacement[placement],
|
|
3068
|
-
leave: translateOutByPlacement[placement]
|
|
3069
|
-
};
|
|
3070
|
-
};
|
|
3071
|
-
|
|
3072
|
-
var ToastItem = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
3073
|
-
var toast = _ref.toast,
|
|
3074
|
-
layout = _ref.layout;
|
|
3075
|
-
var theme = useTheme();
|
|
3076
|
-
var _useMemo = React$1.useMemo(function () {
|
|
3077
|
-
return getColors(theme.palette, toast.type);
|
|
3078
|
-
}, [theme.palette, toast.type]),
|
|
3079
|
-
color = _useMemo.color,
|
|
3080
|
-
bgColor = _useMemo.bgColor;
|
|
3081
|
-
var isReactNode = typeof toast.text !== 'string';
|
|
3082
|
-
var padding = layout.padding,
|
|
3083
|
-
margin = layout.margin,
|
|
3084
|
-
maxHeight = layout.maxHeight,
|
|
3085
|
-
maxWidth = layout.maxWidth,
|
|
3086
|
-
width = layout.width,
|
|
3087
|
-
placement = layout.placement;
|
|
3088
|
-
var _useMemo2 = React$1.useMemo(function () {
|
|
3089
|
-
return getTranslateByPlacement(placement);
|
|
3090
|
-
}, [placement]),
|
|
3091
|
-
enter = _useMemo2.enter,
|
|
3092
|
-
leave = _useMemo2.leave;
|
|
3093
|
-
return /*#__PURE__*/React$1.createElement(CssTransition, {
|
|
3094
|
-
name: "toast",
|
|
3095
|
-
visible: toast.visible,
|
|
3096
|
-
clearTime: 350
|
|
3097
|
-
}, /*#__PURE__*/React$1.createElement("div", {
|
|
3098
|
-
key: toast.id,
|
|
3099
|
-
className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "toast"
|
|
3100
|
-
}, isReactNode ? toast.text : /*#__PURE__*/React$1.createElement(React$1.Fragment, null, /*#__PURE__*/React$1.createElement("div", {
|
|
3101
|
-
className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "message"
|
|
3102
|
-
}, toast.text), /*#__PURE__*/React$1.createElement("div", {
|
|
3103
|
-
className: _JSXStyle.dynamic([["1407001838", [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]]]) + " " + "action"
|
|
3104
|
-
}, makeToastActions(toast.actions, toast.cancel))), /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3105
|
-
id: "1407001838",
|
|
3106
|
-
dynamic: [width, maxWidth, maxHeight, theme.palette.foreground, bgColor, color, theme.layout.radius, theme.expressiveness.shadowSmall, theme.layout.gapHalf, enter, margin, padding, margin, padding, leave]
|
|
3107
|
-
}, ".toast.__jsx-style-dynamic-selector{width:".concat(width, ";max-width:").concat(maxWidth, ";max-height:").concat(maxHeight, ";display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.foreground, ";background-color:").concat(bgColor, ";color:").concat(color, ";border:0;border-radius:").concat(theme.layout.radius, ";opacity:1;box-shadow:").concat(theme.expressiveness.shadowSmall, ";-webkit-transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);transition:all 350ms cubic-bezier(0.1,0.2,0.1,1);overflow:hidden;}.message.__jsx-style-dynamic-selector{-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;height:100%;font-size:0.875em;display:-webkit-box;word-break:break-all;padding-right:").concat(theme.layout.gapHalf, ";overflow:hidden;max-height:100%;text-overflow:ellipsis;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-height:1.1rem;}.toast-enter.__jsx-style-dynamic-selector{opacity:0;height:0;padding:0;margin:0;-webkit-transform:").concat(enter, ";-ms-transform:").concat(enter, ";transform:").concat(enter, ";}.toast-enter-active.__jsx-style-dynamic-selector{opacity:1;height:auto;margin:").concat(margin, ";padding:").concat(padding, ";-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);}.toast-leave.__jsx-style-dynamic-selector{opacity:1;-webkit-transform:translate(0,0);-ms-transform:translate(0,0);transform:translate(0,0);height:auto;margin:").concat(margin, ";padding:").concat(padding, ";}.toast-leave-active.__jsx-style-dynamic-selector{opacity:0;-webkit-transform:").concat(leave, ";-ms-transform:").concat(leave, ";transform:").concat(leave, ";}"))));
|
|
3108
|
-
});
|
|
3109
|
-
|
|
3110
|
-
/* "use client" */
|
|
3111
|
-
|
|
3112
|
-
var classObjectToString = function classObjectToString(className) {
|
|
3113
|
-
var keys = Object.keys(className);
|
|
3114
|
-
var len = keys.length;
|
|
3115
|
-
var str = '';
|
|
3116
|
-
for (var index = 0; index < len; index++) {
|
|
3117
|
-
var key = keys[index];
|
|
3118
|
-
var val = className[keys[index]];
|
|
3119
|
-
if (!val) continue;
|
|
3120
|
-
str = str ? "".concat(str, " ").concat(String(key)) : String(key);
|
|
3121
|
-
}
|
|
3122
|
-
return str;
|
|
3123
|
-
};
|
|
3124
|
-
var isObjectClassName = function isObjectClassName(value) {
|
|
3125
|
-
return _typeof(value) === 'object' && !Array.isArray(value);
|
|
3126
|
-
};
|
|
3127
|
-
var useClasses = function useClasses() {
|
|
3128
|
-
var len = arguments.length;
|
|
3129
|
-
var classes = '';
|
|
3130
|
-
if (len === 0) return classes;
|
|
3131
|
-
for (var index = 0; index < len; index++) {
|
|
3132
|
-
var val = index < 0 || arguments.length <= index ? undefined : arguments[index];
|
|
3133
|
-
if (!val) continue;
|
|
3134
|
-
if (isObjectClassName(val)) {
|
|
3135
|
-
classes += " ".concat(classObjectToString(val));
|
|
3136
|
-
} else {
|
|
3137
|
-
classes += " ".concat(String(val).trim());
|
|
3138
|
-
}
|
|
3139
|
-
}
|
|
3140
|
-
return classes.trim();
|
|
3141
|
-
};
|
|
3142
|
-
|
|
3143
|
-
var ToastContainer = function ToastContainer() {
|
|
3144
|
-
var theme = useTheme();
|
|
3145
|
-
var portal = usePortal('toast');
|
|
3146
|
-
var _useCurrentState = useCurrentState(false),
|
|
3147
|
-
_useCurrentState2 = _slicedToArray(_useCurrentState, 3),
|
|
3148
|
-
setHovering = _useCurrentState2[1],
|
|
3149
|
-
hoveringRef = _useCurrentState2[2];
|
|
3150
|
-
var _useHUIContext = useHUIContext(),
|
|
3151
|
-
toasts = _useHUIContext.toasts,
|
|
3152
|
-
updateToasts = _useHUIContext.updateToasts,
|
|
3153
|
-
toastLayout = _useHUIContext.toastLayout,
|
|
3154
|
-
lastUpdateToastId = _useHUIContext.lastUpdateToastId;
|
|
3155
|
-
var memoizedLayout = React$1.useMemo(function () {
|
|
3156
|
-
return toastLayout;
|
|
3157
|
-
}, [toastLayout]);
|
|
3158
|
-
var toastElements = React$1.useMemo(function () {
|
|
3159
|
-
return toasts.map(function (toast) {
|
|
3160
|
-
return /*#__PURE__*/React$1.createElement(ToastItem, {
|
|
3161
|
-
toast: toast,
|
|
3162
|
-
layout: memoizedLayout,
|
|
3163
|
-
key: toast._internalIdent
|
|
3164
|
-
});
|
|
3165
|
-
});
|
|
3166
|
-
}, [toasts, memoizedLayout]);
|
|
3167
|
-
var classNames = React$1.useMemo(function () {
|
|
3168
|
-
return useClasses('toasts', {
|
|
3169
|
-
top: isTopPlacement(toastLayout.placement),
|
|
3170
|
-
left: isLeftPlacement(toastLayout.placement)
|
|
3171
|
-
});
|
|
3172
|
-
}, [memoizedLayout]);
|
|
3173
|
-
var hoverHandler = function hoverHandler(isHovering) {
|
|
3174
|
-
setHovering(isHovering);
|
|
3175
|
-
if (isHovering) {
|
|
3176
|
-
return updateToasts(function (last) {
|
|
3177
|
-
return last.map(function (toast) {
|
|
3178
|
-
if (!toast.visible) return toast;
|
|
3179
|
-
toast._timeout && window.clearTimeout(toast._timeout);
|
|
3180
|
-
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
3181
|
-
timeout: null
|
|
3182
|
-
});
|
|
3183
|
-
});
|
|
3184
|
-
});
|
|
3185
|
-
}
|
|
3186
|
-
updateToasts(function (last) {
|
|
3187
|
-
return last.map(function (toast, index) {
|
|
3188
|
-
if (!toast.visible) return toast;
|
|
3189
|
-
toast._timeout && window.clearTimeout(toast._timeout);
|
|
3190
|
-
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
3191
|
-
_timeout: function () {
|
|
3192
|
-
var timer = window.setTimeout(function () {
|
|
3193
|
-
toast.cancel();
|
|
3194
|
-
window.clearTimeout(timer);
|
|
3195
|
-
}, toast.delay + index * 100);
|
|
3196
|
-
return timer;
|
|
3197
|
-
}()
|
|
3198
|
-
});
|
|
3199
|
-
});
|
|
3200
|
-
});
|
|
3201
|
-
};
|
|
3202
|
-
React$1.useEffect(function () {
|
|
3203
|
-
var index = toasts.findIndex(function (r) {
|
|
3204
|
-
return r._internalIdent === lastUpdateToastId;
|
|
3205
|
-
});
|
|
3206
|
-
var toast = toasts[index];
|
|
3207
|
-
if (!toast || toast.visible || !hoveringRef.current) return;
|
|
3208
|
-
var hasVisible = toasts.find(function (r, i) {
|
|
3209
|
-
return i < index && r.visible;
|
|
3210
|
-
});
|
|
3211
|
-
if (hasVisible || !hoveringRef.current) return;
|
|
3212
|
-
hoverHandler(false);
|
|
3213
|
-
}, [toasts, lastUpdateToastId]);
|
|
3214
|
-
React$1.useEffect(function () {
|
|
3215
|
-
var timeout = null;
|
|
3216
|
-
var timer = window.setInterval(function () {
|
|
3217
|
-
if (toasts.length === 0) return;
|
|
3218
|
-
timeout = window.setTimeout(function () {
|
|
3219
|
-
var allInvisible = !toasts.find(function (r) {
|
|
3220
|
-
return r.visible;
|
|
3221
|
-
});
|
|
3222
|
-
allInvisible && updateToasts(function () {
|
|
3223
|
-
return [];
|
|
3224
|
-
});
|
|
3225
|
-
timeout && clearTimeout(timeout);
|
|
3226
|
-
}, 350);
|
|
3227
|
-
}, 5000);
|
|
3228
|
-
return function () {
|
|
3229
|
-
timer && clearInterval(timer);
|
|
3230
|
-
timeout && clearTimeout(timeout);
|
|
3231
|
-
};
|
|
3232
|
-
}, [toasts]);
|
|
3233
|
-
if (!portal) return null;
|
|
3234
|
-
if (!toasts || toasts.length === 0) return null;
|
|
3235
|
-
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement("div", {
|
|
3236
|
-
onMouseEnter: function onMouseEnter() {
|
|
3237
|
-
return hoverHandler(true);
|
|
3238
|
-
},
|
|
3239
|
-
onMouseLeave: function onMouseLeave() {
|
|
3240
|
-
return hoverHandler(false);
|
|
3241
|
-
},
|
|
3242
|
-
className: _JSXStyle.dynamic([["622610754", [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]]]) + " " + (classNames || "")
|
|
3243
|
-
}, toastElements, /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3244
|
-
id: "622610754",
|
|
3245
|
-
dynamic: [theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.layout.gap]
|
|
3246
|
-
}, ".toasts.__jsx-style-dynamic-selector{position:fixed;width:auto;max-width:100%;right:".concat(theme.layout.gap, ";bottom:").concat(theme.layout.gap, ";z-index:2000;-webkit-transition:all 400ms ease;transition:all 400ms ease;box-sizing:border-box;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;}.top.__jsx-style-dynamic-selector{bottom:unset;-webkit-flex-direction:column-reverse;-ms-flex-direction:column-reverse;flex-direction:column-reverse;top:").concat(theme.layout.gap, ";}.left.__jsx-style-dynamic-selector{right:unset;left:").concat(theme.layout.gap, ";}"))), portal);
|
|
3247
|
-
};
|
|
3248
|
-
|
|
3249
|
-
var HuiProvider = function HuiProvider(_ref) {
|
|
3250
|
-
var themes = _ref.themes,
|
|
3251
|
-
themeType = _ref.themeType,
|
|
3252
|
-
children = _ref.children;
|
|
3253
|
-
var _React$useState = React$1.useState(''),
|
|
3254
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
3255
|
-
lastUpdateToastId = _React$useState2[0],
|
|
3256
|
-
setLastUpdateToastId = _React$useState2[1];
|
|
3257
|
-
var _useCurrentState = useCurrentState([]),
|
|
3258
|
-
_useCurrentState2 = _slicedToArray(_useCurrentState, 3),
|
|
3259
|
-
toasts = _useCurrentState2[0],
|
|
3260
|
-
setToasts = _useCurrentState2[1],
|
|
3261
|
-
toastsRef = _useCurrentState2[2];
|
|
3262
|
-
var _useCurrentState3 = useCurrentState(defaultToastLayout),
|
|
3263
|
-
_useCurrentState4 = _slicedToArray(_useCurrentState3, 3),
|
|
3264
|
-
toastLayout = _useCurrentState4[0],
|
|
3265
|
-
setToastLayout = _useCurrentState4[1],
|
|
3266
|
-
toastLayoutRef = _useCurrentState4[2];
|
|
3267
|
-
var updateToasts = function updateToasts(fn) {
|
|
3268
|
-
var nextToasts = fn(toastsRef.current);
|
|
3269
|
-
setToasts(nextToasts);
|
|
3270
|
-
};
|
|
3271
|
-
var updateToastLayout = function updateToastLayout(fn) {
|
|
3272
|
-
var nextLayout = fn(toastLayoutRef.current);
|
|
3273
|
-
setToastLayout(nextLayout);
|
|
3274
|
-
};
|
|
3275
|
-
var updateLastToastId = function updateLastToastId(fn) {
|
|
3276
|
-
setLastUpdateToastId(fn());
|
|
3277
|
-
};
|
|
3278
|
-
var initialValue = React$1.useMemo(function () {
|
|
3279
|
-
return {
|
|
3280
|
-
toasts: toasts,
|
|
3281
|
-
toastLayout: toastLayout,
|
|
3282
|
-
updateToasts: updateToasts,
|
|
3283
|
-
lastUpdateToastId: lastUpdateToastId,
|
|
3284
|
-
updateToastLayout: updateToastLayout,
|
|
3285
|
-
updateLastToastId: updateLastToastId
|
|
3286
|
-
};
|
|
3287
|
-
}, [toasts, toastLayout, lastUpdateToastId]);
|
|
3288
|
-
return /*#__PURE__*/React$1.createElement(HUIContent.Provider, {
|
|
3289
|
-
value: initialValue
|
|
3290
|
-
}, /*#__PURE__*/React$1.createElement(ThemeProvider, {
|
|
3291
|
-
themes: themes,
|
|
3292
|
-
themeType: themeType
|
|
3293
|
-
}, children, /*#__PURE__*/React$1.createElement(ToastContainer, null)));
|
|
3294
|
-
};
|
|
3295
|
-
|
|
3296
|
-
// import flush from 'styled-jsx'
|
|
3297
|
-
|
|
3298
|
-
// export type FlushToReact = <T>(opts?: { nonce?: string }) => Array<ReactElement<T>>
|
|
3299
|
-
|
|
3300
|
-
// export type FlushToHTML = (opts?: { nonce?: string }) => string
|
|
3301
|
-
|
|
3302
|
-
var CssBaseline = function CssBaseline(_ref) {
|
|
3303
|
-
var children = _ref.children;
|
|
3304
|
-
var theme = useTheme();
|
|
3305
|
-
return /*#__PURE__*/React$1.createElement(React$1.Fragment, null, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3306
|
-
id: "3647548829",
|
|
3307
|
-
dynamic: [theme.palette.background, theme.palette.foreground, theme.palette.background, theme.font.sans, theme.font.sans, theme.palette.link, theme.expressiveness.linkStyle, theme.expressiveness.linkHoverStyle, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gapHalf, theme.layout.gap, theme.palette.foreground, theme.palette.code, theme.font.mono, theme.layout.gap, theme.layout.gap, theme.layout.gap, theme.palette.accents_2, theme.layout.radius, theme.font.mono, theme.palette.foreground, theme.palette.accents_2, theme.palette.accents_1, theme.layout.gap, theme.layout.gap, theme.palette.accents_5, theme.palette.accents_1, theme.layout.radius, theme.palette.border, theme.palette.selection, theme.palette.foreground]
|
|
3308
|
-
}, "html,body{background-color:".concat(theme.palette.background, ";color:").concat(theme.palette.foreground, ";}html{font-size:16px;--helpdice-icons-background:").concat(theme.palette.background, ";}body{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-rendering:optimizeLegibility;font-size:1rem;line-height:1.5;margin:0;padding:0;min-height:100%;position:relative;overflow-x:hidden;font-family:").concat(theme.font.sans, ";}#__next{overflow-x:hidden;}*,*:before,*:after{box-sizing:inherit;text-rendering:geometricPrecision;-webkit-tap-highlight-color:transparent;}p,small{font-weight:400;color:inherit;-webkit-letter-spacing:-0.005625em;-moz-letter-spacing:-0.005625em;-ms-letter-spacing:-0.005625em;letter-spacing:-0.005625em;font-family:").concat(theme.font.sans, ";}p{margin:1em 0;font-size:1em;line-height:1.625em;}small{margin:0;line-height:1.5;font-size:0.875em;}b{font-weight:600;}span{font-size:inherit;color:inherit;font-weight:inherit;}img{max-width:100%;}a{cursor:pointer;font-size:inherit;-webkit-touch-callout:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-box-align:center;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;color:").concat(theme.palette.link, ";-webkit-text-decoration:").concat(theme.expressiveness.linkStyle, ";text-decoration:").concat(theme.expressiveness.linkStyle, ";}a:hover{-webkit-text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";text-decoration:").concat(theme.expressiveness.linkHoverStyle, ";}ul,ol{padding:0;list-style-type:none;margin:").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gapHalf, " ").concat(theme.layout.gap, ";color:").concat(theme.palette.foreground, ";}ol{list-style-type:decimal;}li{margin-bottom:0.625em;font-size:1em;line-height:1.625em;}h1,h2,h3,h4,h5,h6{color:inherit;margin:0 0 0.7rem 0;}h1{font-size:3rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;line-height:1.5;font-weight:700;}h2{font-size:2.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h3{font-size:1.5rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h4{font-size:1.25rem;-webkit-letter-spacing:-0.02em;-moz-letter-spacing:-0.02em;-ms-letter-spacing:-0.02em;letter-spacing:-0.02em;font-weight:600;}h5{font-size:1rem;-webkit-letter-spacing:-0.01em;-moz-letter-spacing:-0.01em;-ms-letter-spacing:-0.01em;letter-spacing:-0.01em;font-weight:600;}h6{font-size:0.875rem;-webkit-letter-spacing:-0.005em;-moz-letter-spacing:-0.005em;-ms-letter-spacing:-0.005em;letter-spacing:-0.005em;font-weight:600;}button,input,select,textarea{font-family:inherit;font-size:inherit;line-height:inherit;color:inherit;margin:0;}button:focus,input:focus,select:focus,textarea:focus{outline:none;}code{color:").concat(theme.palette.code, ";font-family:").concat(theme.font.mono, ";font-size:0.9em;white-space:pre-wrap;}code:before,code:after{content:'\\`';}pre{padding:calc(").concat(theme.layout.gap, " * 0.9) ").concat(theme.layout.gap, ";margin:").concat(theme.layout.gap, " 0;border:1px solid ").concat(theme.palette.accents_2, ";border-radius:").concat(theme.layout.radius, ";font-family:").concat(theme.font.mono, ";white-space:pre;overflow:auto;line-height:1.5;text-align:left;font-size:14px;-webkit-overflow-scrolling:touch;}pre code{color:").concat(theme.palette.foreground, ";font-size:1em;line-height:1.25em;white-space:pre;}pre code:before,pre code:after{display:none;}pre p{margin:0;}pre::-webkit-scrollbar{display:none;width:0;height:0;background:transparent;}hr{border-color:").concat(theme.palette.accents_2, ";}details{background-color:").concat(theme.palette.accents_1, ";border:none;}details:focus,details:hover,details:active{outline:none;}summary{cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;list-style:none;outline:none;}summary::marker,summary::before,summary::-webkit-details-marker{display:none;}summary::-moz-list-bullet{font-size:0;}summary:focus,summary:hover,summary:active{outline:none;list-style:none;}blockquote{padding:calc(0.667 * ").concat(theme.layout.gap, ") ").concat(theme.layout.gap, ";color:").concat(theme.palette.accents_5, ";background-color:").concat(theme.palette.accents_1, ";border-radius:").concat(theme.layout.radius, ";margin:1.5em 0;border:1px solid ").concat(theme.palette.border, ";}blockquote *:first-child{margin-top:0;}blockquote *:last-child{margin-bottom:0;}::selection{background-color:").concat(theme.palette.selection, ";color:").concat(theme.palette.foreground, ";}")));
|
|
3309
|
-
};
|
|
3310
|
-
var MemoCssBaseline = /*#__PURE__*/React$1.memo(CssBaseline);
|
|
3311
|
-
|
|
3312
|
-
var getElementOffset = function getElementOffset(el) {
|
|
3313
|
-
if (!el) return {
|
|
3314
|
-
top: 0,
|
|
3315
|
-
left: 0
|
|
3316
|
-
};
|
|
3317
|
-
var _el$getBoundingClient = el.getBoundingClientRect(),
|
|
3318
|
-
top = _el$getBoundingClient.top,
|
|
3319
|
-
left = _el$getBoundingClient.left;
|
|
3320
|
-
return {
|
|
3321
|
-
top: top,
|
|
3322
|
-
left: left
|
|
3323
|
-
};
|
|
3324
|
-
};
|
|
3325
|
-
var defaultRect$1 = {
|
|
3326
|
-
top: -1e3,
|
|
3327
|
-
left: -1e3,
|
|
3328
|
-
right: -1e3,
|
|
3329
|
-
width: 0,
|
|
3330
|
-
height: 0,
|
|
3331
|
-
elementTop: -1e3
|
|
3332
|
-
};
|
|
3333
|
-
var getRectFromDOMWithContainer = function getRectFromDOMWithContainer(domRect, getContainer) {
|
|
3334
|
-
if (!domRect) return defaultRect$1;
|
|
3335
|
-
var container = getContainer ? getContainer() : null;
|
|
3336
|
-
var scrollElement = container || document.documentElement;
|
|
3337
|
-
var _getElementOffset = getElementOffset(container),
|
|
3338
|
-
offsetTop = _getElementOffset.top,
|
|
3339
|
-
offsetLeft = _getElementOffset.left;
|
|
3340
|
-
return _objectSpread2(_objectSpread2({}, domRect), {}, {
|
|
3341
|
-
width: domRect.width || domRect.right - domRect.left,
|
|
3342
|
-
height: domRect.height || domRect.top - domRect.bottom,
|
|
3343
|
-
top: domRect.bottom + scrollElement.scrollTop - offsetTop,
|
|
3344
|
-
left: domRect.left + scrollElement.scrollLeft - offsetLeft,
|
|
3345
|
-
elementTop: domRect.top + scrollElement.scrollTop - offsetTop
|
|
3346
|
-
});
|
|
3347
|
-
};
|
|
3348
|
-
var isUnplacedRect = function isUnplacedRect(rect) {
|
|
3349
|
-
if (!rect) return true;
|
|
3350
|
-
return rect.top === defaultRect$1.top && rect.left === defaultRect$1.left;
|
|
3351
|
-
};
|
|
3352
|
-
var getRefRect = function getRefRect(ref, getContainer) {
|
|
3353
|
-
if (!ref || !ref.current) return defaultRect$1;
|
|
3354
|
-
var rect = ref.current.getBoundingClientRect();
|
|
3355
|
-
return getRectFromDOMWithContainer(rect, getContainer);
|
|
3356
|
-
};
|
|
3357
|
-
var getEventRect = function getEventRect(event, getContainer) {
|
|
3358
|
-
var _event$target;
|
|
3359
|
-
var rect = event === null || event === void 0 || (_event$target = event.target) === null || _event$target === void 0 ? void 0 : _event$target.getBoundingClientRect();
|
|
3360
|
-
if (!rect) return defaultRect$1;
|
|
3361
|
-
return getRectFromDOMWithContainer(rect, getContainer);
|
|
3362
|
-
};
|
|
3363
|
-
var isRefTarget = function isRefTarget(eventOrRef) {
|
|
3364
|
-
return typeof (eventOrRef === null || eventOrRef === void 0 ? void 0 : eventOrRef.target) === 'undefined';
|
|
3365
|
-
};
|
|
3366
|
-
var useRect = function useRect(initialState) {
|
|
3367
|
-
var _useState = React$1.useState(initialState || defaultRect$1),
|
|
3368
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3369
|
-
rect = _useState2[0],
|
|
3370
|
-
setRect = _useState2[1];
|
|
3371
|
-
var updateRect = function updateRect(eventOrRef, getContainer) {
|
|
3372
|
-
if (isRefTarget(eventOrRef)) return setRect(getRefRect(eventOrRef, getContainer));
|
|
3373
|
-
setRect(getEventRect(eventOrRef, getContainer));
|
|
3374
|
-
};
|
|
3375
|
-
return {
|
|
3376
|
-
rect: rect,
|
|
3377
|
-
setRect: updateRect
|
|
3378
|
-
};
|
|
3379
|
-
};
|
|
3380
|
-
|
|
3381
|
-
var defaultToast = {
|
|
3382
|
-
delay: 2000,
|
|
3383
|
-
type: 'default'
|
|
3384
|
-
};
|
|
3385
|
-
var useToasts = function useToasts(layout) {
|
|
3386
|
-
var _useHUIContext = useHUIContext(),
|
|
3387
|
-
updateToasts = _useHUIContext.updateToasts,
|
|
3388
|
-
toasts = _useHUIContext.toasts,
|
|
3389
|
-
updateToastLayout = _useHUIContext.updateToastLayout,
|
|
3390
|
-
updateLastToastId = _useHUIContext.updateLastToastId;
|
|
3391
|
-
React$1.useEffect(function () {
|
|
3392
|
-
if (!layout) return;
|
|
3393
|
-
updateToastLayout(function () {
|
|
3394
|
-
return layout ? _objectSpread2(_objectSpread2({}, defaultToastLayout), layout) : defaultToastLayout;
|
|
3395
|
-
});
|
|
3396
|
-
}, []);
|
|
3397
|
-
var _cancel = function cancel(internalId) {
|
|
3398
|
-
updateToasts(function (currentToasts) {
|
|
3399
|
-
return currentToasts.map(function (item) {
|
|
3400
|
-
if (item._internalIdent !== internalId) return item;
|
|
3401
|
-
return _objectSpread2(_objectSpread2({}, item), {}, {
|
|
3402
|
-
visible: false
|
|
3403
|
-
});
|
|
3404
|
-
});
|
|
3405
|
-
});
|
|
3406
|
-
updateLastToastId(function () {
|
|
3407
|
-
return internalId;
|
|
3408
|
-
});
|
|
3409
|
-
};
|
|
3410
|
-
var removeAll = function removeAll() {
|
|
3411
|
-
updateToasts(function (last) {
|
|
3412
|
-
return last.map(function (toast) {
|
|
3413
|
-
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
3414
|
-
visible: false
|
|
3415
|
-
});
|
|
3416
|
-
});
|
|
3417
|
-
});
|
|
3418
|
-
};
|
|
3419
|
-
var findToastOneByID = function findToastOneByID(id) {
|
|
3420
|
-
return toasts.find(function (t) {
|
|
3421
|
-
return t.id === id;
|
|
3422
|
-
});
|
|
3423
|
-
};
|
|
3424
|
-
var removeToastOneByID = function removeToastOneByID(id) {
|
|
3425
|
-
updateToasts(function (last) {
|
|
3426
|
-
return last.map(function (toast) {
|
|
3427
|
-
if (toast.id !== id) return toast;
|
|
3428
|
-
return _objectSpread2(_objectSpread2({}, toast), {}, {
|
|
3429
|
-
visible: false
|
|
3430
|
-
});
|
|
3431
|
-
});
|
|
3432
|
-
});
|
|
3433
|
-
};
|
|
3434
|
-
var setToast = function setToast(toast) {
|
|
3435
|
-
var internalIdent = "toast-".concat(getId());
|
|
3436
|
-
var delay = toast.delay || defaultToast.delay;
|
|
3437
|
-
if (toast.id) {
|
|
3438
|
-
var hasIdent = toasts.find(function (t) {
|
|
3439
|
-
return t.id === toast.id;
|
|
3440
|
-
});
|
|
3441
|
-
if (hasIdent) {
|
|
3442
|
-
throw new Error('Toast: Already have the same key: "ident"');
|
|
3443
|
-
}
|
|
3444
|
-
}
|
|
3445
|
-
updateToasts(function (last) {
|
|
3446
|
-
var newToast = {
|
|
3447
|
-
delay: delay,
|
|
3448
|
-
text: toast.text,
|
|
3449
|
-
visible: true,
|
|
3450
|
-
type: toast.type || defaultToast.type,
|
|
3451
|
-
id: toast.id || internalIdent,
|
|
3452
|
-
actions: toast.actions || [],
|
|
3453
|
-
_internalIdent: internalIdent,
|
|
3454
|
-
_timeout: window.setTimeout(function () {
|
|
3455
|
-
_cancel(internalIdent);
|
|
3456
|
-
if (newToast._timeout) {
|
|
3457
|
-
window.clearTimeout(newToast._timeout);
|
|
3458
|
-
newToast._timeout = null;
|
|
3459
|
-
}
|
|
3460
|
-
}, delay),
|
|
3461
|
-
cancel: function cancel() {
|
|
3462
|
-
return _cancel(internalIdent);
|
|
3463
|
-
}
|
|
3464
|
-
};
|
|
3465
|
-
return [].concat(_toConsumableArray(last), [newToast]);
|
|
3466
|
-
});
|
|
3467
|
-
};
|
|
3468
|
-
return {
|
|
3469
|
-
toasts: toasts,
|
|
3470
|
-
setToast: setToast,
|
|
3471
|
-
removeAll: removeAll,
|
|
3472
|
-
findToastOneByID: findToastOneByID,
|
|
3473
|
-
removeToastOneByID: removeToastOneByID
|
|
3474
|
-
};
|
|
3475
|
-
};
|
|
3476
|
-
|
|
3477
|
-
tuple('xs', 'sm', 'md', 'lg', 'xl', 'mobile');
|
|
3478
|
-
tuple('up', 'down', 'default');
|
|
3479
|
-
var defaultResponsiveOptions = {
|
|
3480
|
-
match: 'default'
|
|
3481
|
-
};
|
|
3482
|
-
var makeQueries = function makeQueries(bp, up, down) {
|
|
3483
|
-
var queryString = function queryString(item) {
|
|
3484
|
-
var upQuery = "(min-width: ".concat(item.min, ")");
|
|
3485
|
-
var downQuery = "(max-width: ".concat(item.max, ")");
|
|
3486
|
-
return up ? upQuery : down ? downQuery : "".concat(upQuery, " and ").concat(downQuery);
|
|
3487
|
-
};
|
|
3488
|
-
var xs = queryString(bp.xs);
|
|
3489
|
-
return {
|
|
3490
|
-
xs: xs,
|
|
3491
|
-
mobile: xs,
|
|
3492
|
-
sm: queryString(bp.sm),
|
|
3493
|
-
md: queryString(bp.md),
|
|
3494
|
-
lg: queryString(bp.lg),
|
|
3495
|
-
xl: queryString(bp.xl)
|
|
3496
|
-
};
|
|
3497
|
-
};
|
|
3498
|
-
var useMediaQuery = function useMediaQuery(breakpoint) {
|
|
3499
|
-
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : defaultResponsiveOptions;
|
|
3500
|
-
var _options$match = options.match,
|
|
3501
|
-
matchType = _options$match === void 0 ? 'default' : _options$match,
|
|
3502
|
-
_options$ssrMatchMedi = options.ssrMatchMedia,
|
|
3503
|
-
ssrMatchMedia = _options$ssrMatchMedi === void 0 ? null : _options$ssrMatchMedi;
|
|
3504
|
-
var supportMedia = typeof window !== 'undefined' && typeof window.matchMedia !== 'undefined';
|
|
3505
|
-
var theme = useTheme();
|
|
3506
|
-
var mediaQueries = React$1.useMemo(function () {
|
|
3507
|
-
var up = matchType === 'up';
|
|
3508
|
-
var down = matchType === 'down';
|
|
3509
|
-
return makeQueries(theme.breakpoints, up, down);
|
|
3510
|
-
}, [theme.breakpoints, options]);
|
|
3511
|
-
var query = React$1.useMemo(function () {
|
|
3512
|
-
return mediaQueries[breakpoint];
|
|
3513
|
-
}, [mediaQueries, breakpoint]);
|
|
3514
|
-
var matchQuery = function matchQuery(q) {
|
|
3515
|
-
return window.matchMedia(q);
|
|
3516
|
-
};
|
|
3517
|
-
|
|
3518
|
-
/**
|
|
3519
|
-
* Do nothing in the server-side rendering.
|
|
3520
|
-
* If server match query fucntion is simulated, return user-defined value first.
|
|
3521
|
-
*/
|
|
3522
|
-
var _useState = React$1.useState(function () {
|
|
3523
|
-
if (supportMedia) return matchQuery(query).matches;
|
|
3524
|
-
if (ssrMatchMedia && typeof ssrMatchMedia === 'function') {
|
|
3525
|
-
return ssrMatchMedia(query).matches;
|
|
3526
|
-
}
|
|
3527
|
-
return false;
|
|
3528
|
-
}),
|
|
3529
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3530
|
-
state = _useState2[0],
|
|
3531
|
-
setState = _useState2[1];
|
|
3532
|
-
React$1.useEffect(function () {
|
|
3533
|
-
if (!supportMedia) return;
|
|
3534
|
-
var queryList = matchQuery(query);
|
|
3535
|
-
var update = function update() {
|
|
3536
|
-
return setState(matchQuery(query).matches);
|
|
3537
|
-
};
|
|
3538
|
-
update();
|
|
3539
|
-
|
|
3540
|
-
/**
|
|
3541
|
-
* addListener is deprecated. EventTarget.addEventListener is recommended.
|
|
3542
|
-
* But in some old browsers, MediaQueryList does not inherit from EventTarget.
|
|
3543
|
-
*/
|
|
3544
|
-
queryList.addListener(update);
|
|
3545
|
-
return function () {
|
|
3546
|
-
queryList.removeListener(update);
|
|
3547
|
-
};
|
|
3548
|
-
}, [supportMedia]);
|
|
3549
|
-
return state;
|
|
3550
|
-
};
|
|
3551
|
-
|
|
3552
|
-
/* "use client" */
|
|
3553
|
-
|
|
3554
|
-
var usePrevious = function usePrevious(state) {
|
|
3555
|
-
var ref = React$1.useRef(null);
|
|
3556
|
-
React$1.useEffect(function () {
|
|
3557
|
-
ref.current = state;
|
|
3558
|
-
});
|
|
3559
|
-
return ref ? ref.current : null;
|
|
3560
|
-
};
|
|
3561
|
-
|
|
3562
|
-
var _excluded$1 = ["rect", "visible", "hoverHeightRatio", "hoverWidthRatio", "activeOpacity", "className"];
|
|
3563
|
-
var Highlight = function Highlight(_ref) {
|
|
3564
|
-
var rect = _ref.rect,
|
|
3565
|
-
visible = _ref.visible,
|
|
3566
|
-
_ref$hoverHeightRatio = _ref.hoverHeightRatio,
|
|
3567
|
-
hoverHeightRatio = _ref$hoverHeightRatio === void 0 ? 1 : _ref$hoverHeightRatio,
|
|
3568
|
-
_ref$hoverWidthRatio = _ref.hoverWidthRatio,
|
|
3569
|
-
hoverWidthRatio = _ref$hoverWidthRatio === void 0 ? 1 : _ref$hoverWidthRatio,
|
|
3570
|
-
_ref$activeOpacity = _ref.activeOpacity,
|
|
3571
|
-
activeOpacity = _ref$activeOpacity === void 0 ? 0.8 : _ref$activeOpacity,
|
|
3572
|
-
className = _ref.className,
|
|
3573
|
-
props = _objectWithoutProperties(_ref, _excluded$1);
|
|
3574
|
-
var theme = useTheme();
|
|
3575
|
-
var ref = React$1.useRef(null);
|
|
3576
|
-
var isFirstVisible = usePrevious(isUnplacedRect(rect));
|
|
3577
|
-
var position = React$1.useMemo(function () {
|
|
3578
|
-
var width = rect.width * hoverWidthRatio;
|
|
3579
|
-
var height = rect.height * hoverHeightRatio;
|
|
3580
|
-
return {
|
|
3581
|
-
width: "".concat(width, "px"),
|
|
3582
|
-
left: "".concat(rect.left + (rect.width - width) / 2, "px"),
|
|
3583
|
-
height: "".concat(height, "px"),
|
|
3584
|
-
top: "".concat(rect.elementTop + (rect.height - height) / 2, "px"),
|
|
3585
|
-
transition: isFirstVisible ? 'opacity' : 'opacity, width, left, top'
|
|
3586
|
-
};
|
|
3587
|
-
}, [rect, hoverWidthRatio, hoverHeightRatio]);
|
|
3588
|
-
return /*#__PURE__*/React$1.createElement("div", _extends({
|
|
3589
|
-
ref: ref
|
|
3590
|
-
}, props, {
|
|
3591
|
-
className: _JSXStyle.dynamic([["603024321", [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]]]) + " " + (props && props.className != null && props.className || useClasses('highlight', className) || "")
|
|
3592
|
-
}), /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3593
|
-
id: "603024321",
|
|
3594
|
-
dynamic: [theme.palette.accents_2, position.width, position.left, position.height, position.top, visible ? activeOpacity : 0, position.transition]
|
|
3595
|
-
}, ".highlight.__jsx-style-dynamic-selector{background:".concat(theme.palette.accents_2, ";position:absolute;border-radius:5px;width:").concat(position.width, ";left:").concat(position.left, ";height:").concat(position.height, ";top:").concat(position.top, ";opacity:").concat(visible ? activeOpacity : 0, ";-webkit-transition:0.15s ease;transition:0.15s ease;-webkit-transition-property:").concat(position.transition, ";transition-property:").concat(position.transition, ";}")));
|
|
3596
|
-
};
|
|
3597
|
-
|
|
3598
|
-
var Ellipsis = function Ellipsis(_ref) {
|
|
3599
|
-
var children = _ref.children,
|
|
3600
|
-
height = _ref.height;
|
|
3601
|
-
return /*#__PURE__*/React$1.createElement("span", {
|
|
3602
|
-
className: _JSXStyle.dynamic([["822089635", [height]]])
|
|
3603
|
-
}, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3604
|
-
id: "822089635",
|
|
3605
|
-
dynamic: [height]
|
|
3606
|
-
}, "span.__jsx-style-dynamic-selector{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;line-height:".concat(height, ";min-width:0;}")));
|
|
3607
|
-
};
|
|
3608
|
-
var ellipsis = /*#__PURE__*/React$1.memo(Ellipsis);
|
|
3609
|
-
|
|
3610
|
-
var getRealShape = function getRealShape(el) {
|
|
3611
|
-
var defaultShape = {
|
|
3612
|
-
width: 0,
|
|
3613
|
-
height: 0
|
|
3614
|
-
};
|
|
3615
|
-
if (!el || typeof window === 'undefined') return defaultShape;
|
|
3616
|
-
var rect = el.getBoundingClientRect();
|
|
3617
|
-
var _window$getComputedSt = window.getComputedStyle(el),
|
|
3618
|
-
width = _window$getComputedSt.width,
|
|
3619
|
-
height = _window$getComputedSt.height;
|
|
3620
|
-
var getCSSStyleVal = function getCSSStyleVal(str, parentNum) {
|
|
3621
|
-
if (!str) return 0;
|
|
3622
|
-
var strVal = str.includes('px') ? +str.split('px')[0] : str.includes('%') ? +str.split('%')[0] * parentNum * 0.01 : str;
|
|
3623
|
-
return Number.isNaN(+strVal) ? 0 : +strVal;
|
|
3624
|
-
};
|
|
3625
|
-
return {
|
|
3626
|
-
width: getCSSStyleVal("".concat(width), rect.width),
|
|
3627
|
-
height: getCSSStyleVal("".concat(height), rect.height)
|
|
3628
|
-
};
|
|
3629
|
-
};
|
|
3630
|
-
var useRealShape = function useRealShape(ref) {
|
|
3631
|
-
var _useState = React$1.useState({
|
|
3632
|
-
width: 0,
|
|
3633
|
-
height: 0
|
|
3634
|
-
}),
|
|
3635
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3636
|
-
state = _useState2[0],
|
|
3637
|
-
setState = _useState2[1];
|
|
3638
|
-
var update = function update() {
|
|
3639
|
-
var _getRealShape = getRealShape(ref.current),
|
|
3640
|
-
width = _getRealShape.width,
|
|
3641
|
-
height = _getRealShape.height;
|
|
3642
|
-
setState({
|
|
3643
|
-
width: width,
|
|
3644
|
-
height: height
|
|
3645
|
-
});
|
|
3646
|
-
};
|
|
3647
|
-
React$1.useEffect(function () {
|
|
3648
|
-
return update();
|
|
3649
|
-
}, [ref.current]);
|
|
3650
|
-
return [state, update];
|
|
3651
|
-
};
|
|
3652
|
-
|
|
3653
|
-
var Expand = function Expand(_ref) {
|
|
3654
|
-
var _ref$isExpanded = _ref.isExpanded,
|
|
3655
|
-
isExpanded = _ref$isExpanded === void 0 ? false : _ref$isExpanded,
|
|
3656
|
-
_ref$delay = _ref.delay,
|
|
3657
|
-
delay = _ref$delay === void 0 ? 200 : _ref$delay,
|
|
3658
|
-
children = _ref.children;
|
|
3659
|
-
var _useState = React$1.useState(isExpanded ? 'auto' : '0'),
|
|
3660
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3661
|
-
height = _useState2[0],
|
|
3662
|
-
setHeight = _useState2[1];
|
|
3663
|
-
var _useState3 = React$1.useState(isExpanded),
|
|
3664
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
3665
|
-
selfExpanded = _useState4[0],
|
|
3666
|
-
setSelfExpanded = _useState4[1];
|
|
3667
|
-
var _useState5 = React$1.useState(isExpanded),
|
|
3668
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
3669
|
-
visible = _useState6[0],
|
|
3670
|
-
setVisible = _useState6[1];
|
|
3671
|
-
var contentRef = React$1.useRef(null);
|
|
3672
|
-
var entryTimer = React$1.useRef();
|
|
3673
|
-
var leaveTimer = React$1.useRef();
|
|
3674
|
-
var resetTimer = React$1.useRef();
|
|
3675
|
-
var _useRealShape = useRealShape(contentRef),
|
|
3676
|
-
_useRealShape2 = _slicedToArray(_useRealShape, 2),
|
|
3677
|
-
state = _useRealShape2[0],
|
|
3678
|
-
updateShape = _useRealShape2[1];
|
|
3679
|
-
var classes = useClasses('container', {
|
|
3680
|
-
expanded: selfExpanded
|
|
3681
|
-
});
|
|
3682
|
-
React$1.useEffect(function () {
|
|
3683
|
-
return setHeight("".concat(state.height, "px"));
|
|
3684
|
-
}, [state.height]);
|
|
3685
|
-
React$1.useEffect(function () {
|
|
3686
|
-
// show element or reset height.
|
|
3687
|
-
// force an update once manually, even if the element does not change.
|
|
3688
|
-
// (the height of the element might be "auto")
|
|
3689
|
-
if (isExpanded) {
|
|
3690
|
-
setVisible(isExpanded);
|
|
3691
|
-
} else {
|
|
3692
|
-
updateShape();
|
|
3693
|
-
setHeight("".concat(state.height, "px"));
|
|
3694
|
-
}
|
|
3695
|
-
|
|
3696
|
-
// show expand animation
|
|
3697
|
-
entryTimer.current = window.setTimeout(function () {
|
|
3698
|
-
setSelfExpanded(isExpanded);
|
|
3699
|
-
clearTimeout(entryTimer.current);
|
|
3700
|
-
}, 30);
|
|
3701
|
-
|
|
3702
|
-
// Reset height after animation
|
|
3703
|
-
if (isExpanded) {
|
|
3704
|
-
resetTimer.current = window.setTimeout(function () {
|
|
3705
|
-
setHeight('auto');
|
|
3706
|
-
clearTimeout(resetTimer.current);
|
|
3707
|
-
}, delay);
|
|
3708
|
-
} else {
|
|
3709
|
-
leaveTimer.current = window.setTimeout(function () {
|
|
3710
|
-
setVisible(isExpanded);
|
|
3711
|
-
clearTimeout(leaveTimer.current);
|
|
3712
|
-
}, delay / 2);
|
|
3713
|
-
}
|
|
3714
|
-
return function () {
|
|
3715
|
-
clearTimeout(entryTimer.current);
|
|
3716
|
-
clearTimeout(leaveTimer.current);
|
|
3717
|
-
clearTimeout(resetTimer.current);
|
|
3718
|
-
};
|
|
3719
|
-
}, [isExpanded]);
|
|
3720
|
-
return /*#__PURE__*/React$1.createElement("div", {
|
|
3721
|
-
className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + (classes || "")
|
|
3722
|
-
}, /*#__PURE__*/React$1.createElement("div", {
|
|
3723
|
-
ref: contentRef,
|
|
3724
|
-
className: _JSXStyle.dynamic([["1918690829", [visible ? 'visible' : 'hidden', delay, height]]]) + " " + "content"
|
|
3725
|
-
}, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3726
|
-
id: "1918690829",
|
|
3727
|
-
dynamic: [visible ? 'visible' : 'hidden', delay, height]
|
|
3728
|
-
}, ".container.__jsx-style-dynamic-selector{padding:0;margin:0;height:0;overflow:hidden;visibility:".concat(visible ? 'visible' : 'hidden', ";-webkit-transition:height ").concat(delay, "ms ease;transition:height ").concat(delay, "ms ease;}.expanded.__jsx-style-dynamic-selector{height:").concat(height, ";visibility:visible;}")));
|
|
3729
|
-
};
|
|
3730
|
-
Expand.displayName = 'Expand';
|
|
3731
|
-
|
|
3732
|
-
/* "use client" */
|
|
3733
|
-
|
|
3734
|
-
var useResize = function useResize(callback) {
|
|
3735
|
-
var immediatelyInvoke = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
|
|
3736
|
-
React$1.useEffect(function () {
|
|
3737
|
-
var fn = function fn() {
|
|
3738
|
-
return callback();
|
|
3739
|
-
};
|
|
3740
|
-
if (immediatelyInvoke) {
|
|
3741
|
-
fn();
|
|
3742
|
-
}
|
|
3743
|
-
window.addEventListener('resize', fn);
|
|
3744
|
-
return function () {
|
|
3745
|
-
return window.removeEventListener('resize', fn);
|
|
3746
|
-
};
|
|
3747
|
-
}, []);
|
|
3748
|
-
};
|
|
3749
|
-
|
|
3750
|
-
/* "use client" */
|
|
3751
|
-
|
|
3752
|
-
var useClickAnyWhere = function useClickAnyWhere(handler) {
|
|
3753
|
-
React$1.useEffect(function () {
|
|
3754
|
-
var callback = function callback(event) {
|
|
3755
|
-
return handler(event);
|
|
3756
|
-
};
|
|
3757
|
-
document.addEventListener('click', callback);
|
|
3758
|
-
return function () {
|
|
3759
|
-
return document.removeEventListener('click', callback);
|
|
3760
|
-
};
|
|
3761
|
-
}, [handler]);
|
|
3762
|
-
};
|
|
3763
|
-
|
|
3764
|
-
/* "use client" */
|
|
3765
|
-
|
|
3766
|
-
var useDOMObserver = function useDOMObserver(ref) {
|
|
3767
|
-
var callback = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : function () {};
|
|
3768
|
-
var config = {
|
|
3769
|
-
attributes: false,
|
|
3770
|
-
childList: true,
|
|
3771
|
-
subtree: true
|
|
3772
|
-
};
|
|
3773
|
-
React$1.useEffect(function () {
|
|
3774
|
-
if (!ref || !ref.current) return;
|
|
3775
|
-
var unmount = false;
|
|
3776
|
-
var done = function done() {
|
|
3777
|
-
if (unmount) return;
|
|
3778
|
-
callback.apply(void 0, arguments);
|
|
3779
|
-
};
|
|
3780
|
-
var observer = new MutationObserver(done);
|
|
3781
|
-
observer.observe(ref.current, config);
|
|
3782
|
-
return function () {
|
|
3783
|
-
unmount = true;
|
|
3784
|
-
observer.disconnect();
|
|
3785
|
-
};
|
|
3786
|
-
}, [ref]);
|
|
3787
|
-
};
|
|
3788
|
-
|
|
3789
|
-
var warningStack = {};
|
|
3790
|
-
var useWarning = function useWarning(message, component) {
|
|
3791
|
-
var tag = ' ';
|
|
3792
|
-
var log = "[Helpdice UI]".concat(tag, ": ").concat(message);
|
|
3793
|
-
if (typeof console === 'undefined') return;
|
|
3794
|
-
if (warningStack[log]) return;
|
|
3795
|
-
warningStack[log] = true;
|
|
3796
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3797
|
-
return console.error(log);
|
|
3798
|
-
}
|
|
3799
|
-
console.warn(log);
|
|
3800
|
-
};
|
|
3801
|
-
|
|
3802
|
-
var defaultRect = {
|
|
3803
|
-
top: -1e3,
|
|
3804
|
-
left: -1e3,
|
|
3805
|
-
right: -1e3,
|
|
3806
|
-
width: 0
|
|
3807
|
-
};
|
|
3808
|
-
var Dropdown = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
3809
|
-
var children = _ref.children,
|
|
3810
|
-
parent = _ref.parent,
|
|
3811
|
-
visible = _ref.visible,
|
|
3812
|
-
disableMatchWidth = _ref.disableMatchWidth,
|
|
3813
|
-
getPopupContainer = _ref.getPopupContainer;
|
|
3814
|
-
var el = usePortal('dropdown', getPopupContainer);
|
|
3815
|
-
var _useState = React$1.useState(defaultRect),
|
|
3816
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
3817
|
-
rect = _useState2[0],
|
|
3818
|
-
setRect = _useState2[1];
|
|
3819
|
-
var classes = useClasses('dropdown', disableMatchWidth ? 'disable-match' : 'width-match');
|
|
3820
|
-
if (!parent) return null;
|
|
3821
|
-
|
|
3822
|
-
/* istanbul ignore next */
|
|
3823
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
3824
|
-
if (getPopupContainer && getPopupContainer()) {
|
|
3825
|
-
var _el = getPopupContainer();
|
|
3826
|
-
var style = window.getComputedStyle(_el);
|
|
3827
|
-
if (style.position === 'static') {
|
|
3828
|
-
useWarning('The element specified by "getPopupContainer" must have "position" set.');
|
|
3829
|
-
}
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
var updateRect = function updateRect() {
|
|
3833
|
-
var _getRefRect = getRefRect(parent, getPopupContainer),
|
|
3834
|
-
top = _getRefRect.top,
|
|
3835
|
-
left = _getRefRect.left,
|
|
3836
|
-
right = _getRefRect.right,
|
|
3837
|
-
nativeWidth = _getRefRect.width;
|
|
3838
|
-
setRect({
|
|
3839
|
-
top: top,
|
|
3840
|
-
left: left,
|
|
3841
|
-
right: right,
|
|
3842
|
-
width: nativeWidth
|
|
3843
|
-
});
|
|
3844
|
-
};
|
|
3845
|
-
useResize(updateRect);
|
|
3846
|
-
useClickAnyWhere(function () {
|
|
3847
|
-
var _getRefRect2 = getRefRect(parent, getPopupContainer),
|
|
3848
|
-
top = _getRefRect2.top,
|
|
3849
|
-
left = _getRefRect2.left;
|
|
3850
|
-
var shouldUpdatePosition = top !== rect.top || left !== rect.left;
|
|
3851
|
-
if (!shouldUpdatePosition) return;
|
|
3852
|
-
updateRect();
|
|
3853
|
-
});
|
|
3854
|
-
useDOMObserver(parent, function () {
|
|
3855
|
-
updateRect();
|
|
3856
|
-
});
|
|
3857
|
-
React$1.useEffect(function () {
|
|
3858
|
-
if (!parent || !parent.current) return;
|
|
3859
|
-
parent.current.addEventListener('mouseenter', updateRect);
|
|
3860
|
-
/* istanbul ignore next */
|
|
3861
|
-
return function () {
|
|
3862
|
-
if (!parent || !parent.current) return;
|
|
3863
|
-
parent.current.removeEventListener('mouseenter', updateRect);
|
|
3864
|
-
};
|
|
3865
|
-
}, [parent]);
|
|
3866
|
-
var clickHandler = function clickHandler(event) {
|
|
3867
|
-
event.stopPropagation();
|
|
3868
|
-
event.nativeEvent.stopImmediatePropagation();
|
|
3869
|
-
event.preventDefault();
|
|
3870
|
-
};
|
|
3871
|
-
var mouseDownHandler = function mouseDownHandler(event) {
|
|
3872
|
-
event.preventDefault();
|
|
3873
|
-
};
|
|
3874
|
-
if (!el) return null;
|
|
3875
|
-
return /*#__PURE__*/reactDom.createPortal(/*#__PURE__*/React$1.createElement(CssTransition, {
|
|
3876
|
-
visible: visible
|
|
3877
|
-
}, /*#__PURE__*/React$1.createElement("div", {
|
|
3878
|
-
onClick: clickHandler,
|
|
3879
|
-
onMouseDown: mouseDownHandler,
|
|
3880
|
-
className: _JSXStyle.dynamic([["1644673105", [rect.top + 2, rect.left, rect.width, rect.width]]]) + " " + (classes || "")
|
|
3881
|
-
}, children, /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3882
|
-
id: "1644673105",
|
|
3883
|
-
dynamic: [rect.top + 2, rect.left, rect.width, rect.width]
|
|
3884
|
-
}, ".dropdown.__jsx-style-dynamic-selector{position:absolute;top:".concat(rect.top + 2, "px;left:").concat(rect.left, "px;z-index:1100;}.width-match.__jsx-style-dynamic-selector{width:").concat(rect.width, "px;}.disable-match.__jsx-style-dynamic-selector{min-width:").concat(rect.width, "px;}")))), el);
|
|
3885
|
-
});
|
|
3886
|
-
|
|
3887
|
-
var _excluded = ["children", "onClick", "visible", "width", "onContentClick", "backdropClassName", "positionClassName", "layerClassName"];
|
|
3888
|
-
var Backdrop = /*#__PURE__*/React$1.memo(function (_ref) {
|
|
3889
|
-
var children = _ref.children,
|
|
3890
|
-
_ref$onClick = _ref.onClick,
|
|
3891
|
-
onClick = _ref$onClick === void 0 ? function () {} : _ref$onClick,
|
|
3892
|
-
_ref$visible = _ref.visible,
|
|
3893
|
-
visible = _ref$visible === void 0 ? false : _ref$visible,
|
|
3894
|
-
width = _ref.width,
|
|
3895
|
-
_ref$onContentClick = _ref.onContentClick,
|
|
3896
|
-
onContentClick = _ref$onContentClick === void 0 ? function () {} : _ref$onContentClick,
|
|
3897
|
-
_ref$backdropClassNam = _ref.backdropClassName,
|
|
3898
|
-
backdropClassName = _ref$backdropClassNam === void 0 ? '' : _ref$backdropClassNam,
|
|
3899
|
-
_ref$positionClassNam = _ref.positionClassName,
|
|
3900
|
-
positionClassName = _ref$positionClassNam === void 0 ? '' : _ref$positionClassNam,
|
|
3901
|
-
_ref$layerClassName = _ref.layerClassName,
|
|
3902
|
-
layerClassName = _ref$layerClassName === void 0 ? '' : _ref$layerClassName,
|
|
3903
|
-
props = _objectWithoutProperties(_ref, _excluded);
|
|
3904
|
-
var theme = useTheme();
|
|
3905
|
-
var _useCurrentState = useCurrentState(false),
|
|
3906
|
-
_useCurrentState2 = _slicedToArray(_useCurrentState, 3),
|
|
3907
|
-
setIsContentMouseDown = _useCurrentState2[1],
|
|
3908
|
-
IsContentMouseDownRef = _useCurrentState2[2];
|
|
3909
|
-
var clickHandler = function clickHandler(event) {
|
|
3910
|
-
if (IsContentMouseDownRef.current) return;
|
|
3911
|
-
onClick && onClick(event);
|
|
3912
|
-
};
|
|
3913
|
-
var mouseUpHandler = function mouseUpHandler() {
|
|
3914
|
-
if (!IsContentMouseDownRef.current) return;
|
|
3915
|
-
var timer = setTimeout(function () {
|
|
3916
|
-
setIsContentMouseDown(false);
|
|
3917
|
-
clearTimeout(timer);
|
|
3918
|
-
}, 0);
|
|
3919
|
-
};
|
|
3920
|
-
return /*#__PURE__*/React$1.createElement(CssTransition, {
|
|
3921
|
-
name: "backdrop-wrapper",
|
|
3922
|
-
visible: visible,
|
|
3923
|
-
clearTime: 300
|
|
3924
|
-
}, /*#__PURE__*/React$1.createElement("div", _extends({
|
|
3925
|
-
onClick: clickHandler,
|
|
3926
|
-
onMouseUp: mouseUpHandler
|
|
3927
|
-
}, props, {
|
|
3928
|
-
className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (props && props.className != null && props.className || useClasses('backdrop', backdropClassName) || "")
|
|
3929
|
-
}), /*#__PURE__*/React$1.createElement("div", {
|
|
3930
|
-
className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('layer', layerClassName) || "")
|
|
3931
|
-
}), /*#__PURE__*/React$1.createElement("div", {
|
|
3932
|
-
onClick: onContentClick,
|
|
3933
|
-
onMouseDown: function onMouseDown() {
|
|
3934
|
-
return setIsContentMouseDown(true);
|
|
3935
|
-
},
|
|
3936
|
-
className: _JSXStyle.dynamic([["2021762493", [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]]]) + " " + (useClasses('position', positionClassName) || "")
|
|
3937
|
-
}, children), /*#__PURE__*/React$1.createElement(_JSXStyle, {
|
|
3938
|
-
id: "2021762493",
|
|
3939
|
-
dynamic: [width, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity, theme.expressiveness.portalOpacity]
|
|
3940
|
-
}, ".backdrop.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;overflow:auto;z-index:1000;-webkit-overflow-scrolling:touch;box-sizing:border-box;text-align:center;}.position.__jsx-style-dynamic-selector{position:relative;z-index:1001;outline:none;max-width:90%;width:".concat(width, ";margin:20px auto;vertical-align:middle;display:inline-block;}.backdrop.__jsx-style-dynamic-selector:before{display:inline-block;width:0;height:100%;vertical-align:middle;content:'';}.layer.__jsx-style-dynamic-selector{position:fixed;top:0;left:0;right:0;bottom:0;width:100%;height:100%;opacity:").concat(theme.expressiveness.portalOpacity, ";background-color:black;-webkit-transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);transition:opacity 0.35s cubic-bezier(0.4,0,0.2,1);pointer-events:none;z-index:1000;}.backdrop-wrapper-enter.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}.backdrop-wrapper-enter-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:").concat(theme.expressiveness.portalOpacity, ";}.backdrop-wrapper-leave-active.__jsx-style-dynamic-selector .layer.__jsx-style-dynamic-selector{opacity:0;}"))));
|
|
3941
|
-
});
|
|
3942
|
-
Backdrop.displayName = 'Backdrop';
|
|
3943
|
-
|
|
3944
|
-
dist.Backdrop = Backdrop;
|
|
3945
|
-
dist.CssBaseline = MemoCssBaseline;
|
|
3946
|
-
dist.CssTransition = CssTransition;
|
|
3947
|
-
dist.Dropdown = Dropdown;
|
|
3948
|
-
dist.Ellipsis = ellipsis;
|
|
3949
|
-
dist.Expand = Expand;
|
|
3950
|
-
dist.Highlight = Highlight;
|
|
3951
|
-
dist.Themes = Themes;
|
|
3952
|
-
dist.UiProvider = HuiProvider;
|
|
3953
|
-
dist.useAllThemes = useAllThemes;
|
|
3954
|
-
dist.useClasses = useClasses;
|
|
3955
|
-
dist.useCurrentState = useCurrentState;
|
|
3956
|
-
dist.useMediaQuery = useMediaQuery;
|
|
3957
|
-
dist.useRect = useRect;
|
|
3958
|
-
dist.useTheme = useTheme;
|
|
3959
|
-
dist.useToasts = useToasts;
|
|
3960
|
-
return dist;
|
|
3961
|
-
}
|
|
3962
|
-
|
|
3963
|
-
var distExports = /*@__PURE__*/ requireDist();
|
|
3964
|
-
|
|
3965
1846
|
var getColors = function getColors(palette, status) {
|
|
3966
1847
|
var colors = {
|
|
3967
1848
|
"default": {
|
|
@@ -4003,7 +1884,7 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4003
1884
|
placeholder = _ref$placeholder === void 0 ? 'Enter phone number' : _ref$placeholder,
|
|
4004
1885
|
_ref$color = _ref.color,
|
|
4005
1886
|
_color = _ref$color === void 0 ? 'default' : _ref$color;
|
|
4006
|
-
var theme =
|
|
1887
|
+
var theme$1 = theme.useTheme();
|
|
4007
1888
|
var defaultValue = country ? countries.findIndex(function (cn) {
|
|
4008
1889
|
return cn.code == country;
|
|
4009
1890
|
}) : 103;
|
|
@@ -4029,8 +1910,8 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4029
1910
|
setSearchTerm = _useState0[1];
|
|
4030
1911
|
var dropdownRef = React.useRef(null);
|
|
4031
1912
|
var _useMemo = React.useMemo(function () {
|
|
4032
|
-
return getColors(theme.palette, _color);
|
|
4033
|
-
}, [theme.palette]),
|
|
1913
|
+
return getColors(theme$1.palette, _color);
|
|
1914
|
+
}, [theme$1.palette]),
|
|
4034
1915
|
borderColor = _useMemo.borderColor,
|
|
4035
1916
|
hoverBorder = _useMemo.hoverBorder;
|
|
4036
1917
|
var handleSelectCountry = function handleSelectCountry(country) {
|
|
@@ -4061,21 +1942,21 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4061
1942
|
});
|
|
4062
1943
|
return /*#__PURE__*/React.createElement("div", {
|
|
4063
1944
|
ref: dropdownRef,
|
|
4064
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input-container ".concat(isFocused ? 'focused' : '')
|
|
1945
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input-container ".concat(isFocused ? 'focused' : '')
|
|
4065
1946
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4066
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "input-wrapper"
|
|
1947
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "input-wrapper"
|
|
4067
1948
|
}, /*#__PURE__*/React.createElement("div", {
|
|
4068
1949
|
onClick: function onClick() {
|
|
4069
1950
|
return setDropdownOpen(!dropdownOpen);
|
|
4070
1951
|
},
|
|
4071
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-toggle"
|
|
1952
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-toggle"
|
|
4072
1953
|
}, /*#__PURE__*/React.createElement("span", {
|
|
4073
1954
|
style: {
|
|
4074
1955
|
display: 'flex',
|
|
4075
1956
|
alignItems: 'center',
|
|
4076
1957
|
gap: 5
|
|
4077
1958
|
},
|
|
4078
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
1959
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4079
1960
|
}, /*#__PURE__*/React.createElement("img", {
|
|
4080
1961
|
loading: "lazy",
|
|
4081
1962
|
width: "23",
|
|
@@ -4083,9 +1964,9 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4083
1964
|
src: "https://flagcdn.com/w20/".concat(selectedCountry.code.toLowerCase(), ".png"),
|
|
4084
1965
|
srcSet: "https://flagcdn.com/w40/".concat(selectedCountry.code.toLowerCase(), ".png 2x"),
|
|
4085
1966
|
alt: "Flag of ".concat(selectedCountry.label),
|
|
4086
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
1967
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4087
1968
|
}), /*#__PURE__*/React.createElement("span", {
|
|
4088
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
1969
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4089
1970
|
}, selectedCountry.phone))), /*#__PURE__*/React.createElement("input", {
|
|
4090
1971
|
type: "tel",
|
|
4091
1972
|
style: {
|
|
@@ -4100,9 +1981,9 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4100
1981
|
onBlur: function onBlur() {
|
|
4101
1982
|
return setIsFocused(false);
|
|
4102
1983
|
},
|
|
4103
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input"
|
|
1984
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "phone-input"
|
|
4104
1985
|
})), dropdownOpen && /*#__PURE__*/React.createElement("div", {
|
|
4105
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown"
|
|
1986
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown"
|
|
4106
1987
|
}, /*#__PURE__*/React.createElement("input", {
|
|
4107
1988
|
type: "text",
|
|
4108
1989
|
placeholder: "Search country...",
|
|
@@ -4110,23 +1991,23 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4110
1991
|
onChange: function onChange(e) {
|
|
4111
1992
|
return setSearchTerm(e.target.value);
|
|
4112
1993
|
},
|
|
4113
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "search-input"
|
|
1994
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "search-input"
|
|
4114
1995
|
}), /*#__PURE__*/React.createElement("div", {
|
|
4115
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "country-list"
|
|
1996
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "country-list"
|
|
4116
1997
|
}, filteredCountries.length > 0 ? filteredCountries.map(function (c) {
|
|
4117
1998
|
return /*#__PURE__*/React.createElement("div", {
|
|
4118
1999
|
key: c.code,
|
|
4119
2000
|
onClick: function onClick() {
|
|
4120
2001
|
return handleSelectCountry(c);
|
|
4121
2002
|
},
|
|
4122
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item"
|
|
2003
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item"
|
|
4123
2004
|
}, /*#__PURE__*/React.createElement("span", {
|
|
4124
2005
|
style: {
|
|
4125
2006
|
display: 'flex',
|
|
4126
2007
|
alignItems: 'center',
|
|
4127
2008
|
gap: 5
|
|
4128
2009
|
},
|
|
4129
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2010
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4130
2011
|
}, /*#__PURE__*/React.createElement("img", {
|
|
4131
2012
|
loading: "lazy",
|
|
4132
2013
|
width: "23",
|
|
@@ -4134,19 +2015,19 @@ var PhoneInput = function PhoneInput(_ref) {
|
|
|
4134
2015
|
src: "https://flagcdn.com/w20/".concat(c.code.toLowerCase(), ".png"),
|
|
4135
2016
|
srcSet: "https://flagcdn.com/w40/".concat(c.code.toLowerCase(), ".png 2x"),
|
|
4136
2017
|
alt: "Flag of ".concat(c.label),
|
|
4137
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2018
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4138
2019
|
}), c.phone, " ", /*#__PURE__*/React.createElement("span", {
|
|
4139
2020
|
style: {
|
|
4140
2021
|
color: 'grey'
|
|
4141
2022
|
},
|
|
4142
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
2023
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]])
|
|
4143
2024
|
}, c.label)));
|
|
4144
2025
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
4145
|
-
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item disabled"
|
|
2026
|
+
className: _JSXStyle.dynamic([["1313692390", [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']]]) + " " + "dropdown-item disabled"
|
|
4146
2027
|
}, "No results"))), /*#__PURE__*/React.createElement(_JSXStyle, {
|
|
4147
2028
|
id: "1313692390",
|
|
4148
|
-
dynamic: [hoverBorder, borderColor, borderColor, theme.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme.type == 'dark' ? '#3a3d3d' : '#efefef']
|
|
4149
|
-
}, ".phone-input-container.__jsx-style-dynamic-selector{position:relative;min-width:200px;width:auto;}.phone-input-container.focused.__jsx-style-dynamic-selector{outline:1px solid ".concat(hoverBorder, ";border-radius:6px;}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid ").concat(borderColor, ";border-radius:6px;overflow:hidden;}.dropdown-toggle.__jsx-style-dynamic-selector{padding:7px 12px;border-radius:6px 0px 0px 6px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;border-right:1px solid ").concat(borderColor, ";}.phone-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;padding:5px 10px;height:35px;background-color:transparent;font-size:14px;border:none;}.phone-input.__jsx-style-dynamic-selector:focus{outline:none;}.dropdown.__jsx-style-dynamic-selector{position:absolute;top:100%;left:0;width:100%;background:").concat(theme.type == 'dark' ? 'black' : 'white', ";border:1px solid ").concat(borderColor, ";border-radius:6px;margin-top:4px;z-index:999;box-shadow:0 4px 10px rgba(0,0,0,0.1);}.search-input.__jsx-style-dynamic-selector{width:100%;padding:8px 10px;border:none;background-color:transparent;border-bottom:1px solid ").concat(borderColor, ";font-size:14px;}.search-input.__jsx-style-dynamic-selector:focus{outline:none;}.country-list.__jsx-style-dynamic-selector{max-height:200px;overflow-y:auto;}.dropdown-item.__jsx-style-dynamic-selector{padding:10px;cursor:pointer;font-size:14px;}.dropdown-item.__jsx-style-dynamic-selector:hover{background:").concat(theme.type == 'dark' ? '#3a3d3d' : '#efefef', ";}.dropdown-item.disabled.__jsx-style-dynamic-selector{color:#888;cursor:default;}")));
|
|
2029
|
+
dynamic: [hoverBorder, borderColor, borderColor, theme$1.type == 'dark' ? 'black' : 'white', borderColor, borderColor, theme$1.type == 'dark' ? '#3a3d3d' : '#efefef']
|
|
2030
|
+
}, ".phone-input-container.__jsx-style-dynamic-selector{position:relative;min-width:200px;width:auto;}.phone-input-container.focused.__jsx-style-dynamic-selector{outline:1px solid ".concat(hoverBorder, ";border-radius:6px;}.input-wrapper.__jsx-style-dynamic-selector{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-align-items:center;-webkit-box-align:center;-ms-flex-align:center;align-items:center;border:1px solid ").concat(borderColor, ";border-radius:6px;overflow:hidden;}.dropdown-toggle.__jsx-style-dynamic-selector{padding:7px 12px;border-radius:6px 0px 0px 6px;cursor:pointer;-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;font-size:14px;border-right:1px solid ").concat(borderColor, ";}.phone-input.__jsx-style-dynamic-selector{-webkit-flex:1;-ms-flex:1;flex:1;padding:5px 10px;height:35px;background-color:transparent;font-size:14px;border:none;}.phone-input.__jsx-style-dynamic-selector:focus{outline:none;}.dropdown.__jsx-style-dynamic-selector{position:absolute;top:100%;left:0;width:100%;background:").concat(theme$1.type == 'dark' ? 'black' : 'white', ";border:1px solid ").concat(borderColor, ";border-radius:6px;margin-top:4px;z-index:999;box-shadow:0 4px 10px rgba(0,0,0,0.1);}.search-input.__jsx-style-dynamic-selector{width:100%;padding:8px 10px;border:none;background-color:transparent;border-bottom:1px solid ").concat(borderColor, ";font-size:14px;}.search-input.__jsx-style-dynamic-selector:focus{outline:none;}.country-list.__jsx-style-dynamic-selector{max-height:200px;overflow-y:auto;}.dropdown-item.__jsx-style-dynamic-selector{padding:10px;cursor:pointer;font-size:14px;}.dropdown-item.__jsx-style-dynamic-selector:hover{background:").concat(theme$1.type == 'dark' ? '#3a3d3d' : '#efefef', ";}.dropdown-item.disabled.__jsx-style-dynamic-selector{color:#888;cursor:default;}")));
|
|
4150
2031
|
};
|
|
4151
2032
|
|
|
4152
2033
|
exports.default = PhoneInput;
|