@xelto.npm/xc2-lib 0.0.13 → 0.0.14
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/cjs/index.js +3575 -43
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/components/buttons/customButton/CustomButtonComponent.d.ts +15 -0
- package/dist/cjs/types/components/buttons/customButton/index.d.ts +1 -0
- package/dist/cjs/types/components/index.d.ts +1 -0
- package/dist/esm/index.js +3576 -45
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/components/buttons/customButton/CustomButtonComponent.d.ts +15 -0
- package/dist/esm/types/components/buttons/customButton/index.d.ts +1 -0
- package/dist/esm/types/components/index.d.ts +1 -0
- package/dist/index.d.ts +15 -1
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var React = require('react');
|
|
4
|
+
var ReactDOM = require('react-dom');
|
|
4
5
|
|
|
5
6
|
function _interopNamespaceDefault(e) {
|
|
6
7
|
var n = Object.create(null);
|
|
@@ -3463,6 +3464,28 @@ if (process.env.NODE_ENV !== 'production') {
|
|
|
3463
3464
|
Global.displayName = 'EmotionGlobal';
|
|
3464
3465
|
}
|
|
3465
3466
|
|
|
3467
|
+
function css() {
|
|
3468
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
3469
|
+
args[_key] = arguments[_key];
|
|
3470
|
+
}
|
|
3471
|
+
|
|
3472
|
+
return serializeStyles(args);
|
|
3473
|
+
}
|
|
3474
|
+
|
|
3475
|
+
var keyframes = function keyframes() {
|
|
3476
|
+
var insertable = css.apply(void 0, arguments);
|
|
3477
|
+
var name = "animation-" + insertable.name; // $FlowFixMe
|
|
3478
|
+
|
|
3479
|
+
return {
|
|
3480
|
+
name: name,
|
|
3481
|
+
styles: "@keyframes " + name + "{" + insertable.styles + "}",
|
|
3482
|
+
anim: 1,
|
|
3483
|
+
toString: function toString() {
|
|
3484
|
+
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
|
|
3485
|
+
}
|
|
3486
|
+
};
|
|
3487
|
+
};
|
|
3488
|
+
|
|
3466
3489
|
var classnames = function classnames(args) {
|
|
3467
3490
|
var len = args.length;
|
|
3468
3491
|
var i = 0;
|
|
@@ -4932,7 +4955,7 @@ function elementTypeAcceptingRef(props, propName, componentName, location, propF
|
|
|
4932
4955
|
}
|
|
4933
4956
|
return null;
|
|
4934
4957
|
}
|
|
4935
|
-
chainPropTypes(propTypes.exports.elementType, elementTypeAcceptingRef);
|
|
4958
|
+
var elementTypeAcceptingRef$1 = chainPropTypes(propTypes.exports.elementType, elementTypeAcceptingRef);
|
|
4936
4959
|
|
|
4937
4960
|
// This module is based on https://github.com/airbnb/prop-types-exact repository.
|
|
4938
4961
|
// However, in order to reduce the number of dependencies and to remove some extra safe checks
|
|
@@ -5289,7 +5312,7 @@ function getDisplayName(Component) {
|
|
|
5289
5312
|
// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028
|
|
5290
5313
|
typeof window != 'undefined' && window.Math == Math ? window : typeof self != 'undefined' && self.Math == Math ? self : Function('return this')();
|
|
5291
5314
|
|
|
5292
|
-
propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object]);
|
|
5315
|
+
const refType = propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object]);
|
|
5293
5316
|
|
|
5294
5317
|
// It should to be noted that this function isn't equivalent to `text-transform: capitalize`.
|
|
5295
5318
|
//
|
|
@@ -5302,6 +5325,216 @@ function capitalize(string) {
|
|
|
5302
5325
|
return string.charAt(0).toUpperCase() + string.slice(1);
|
|
5303
5326
|
}
|
|
5304
5327
|
|
|
5328
|
+
/**
|
|
5329
|
+
* TODO v5: consider making it private
|
|
5330
|
+
*
|
|
5331
|
+
* passes {value} to {ref}
|
|
5332
|
+
*
|
|
5333
|
+
* WARNING: Be sure to only call this inside a callback that is passed as a ref.
|
|
5334
|
+
* Otherwise, make sure to cleanup the previous {ref} if it changes. See
|
|
5335
|
+
* https://github.com/mui/material-ui/issues/13539
|
|
5336
|
+
*
|
|
5337
|
+
* Useful if you want to expose the ref of an inner component to the public API
|
|
5338
|
+
* while still using it inside the component.
|
|
5339
|
+
* @param ref A ref callback or ref object. If anything falsy, this is a no-op.
|
|
5340
|
+
*/
|
|
5341
|
+
function setRef(ref, value) {
|
|
5342
|
+
if (typeof ref === 'function') {
|
|
5343
|
+
ref(value);
|
|
5344
|
+
} else if (ref) {
|
|
5345
|
+
ref.current = value;
|
|
5346
|
+
}
|
|
5347
|
+
}
|
|
5348
|
+
|
|
5349
|
+
const useEnhancedEffect = typeof window !== 'undefined' ? React__namespace.useLayoutEffect : React__namespace.useEffect;
|
|
5350
|
+
|
|
5351
|
+
/**
|
|
5352
|
+
* https://github.com/facebook/react/issues/14099#issuecomment-440013892
|
|
5353
|
+
*/
|
|
5354
|
+
function useEventCallback(fn) {
|
|
5355
|
+
const ref = React__namespace.useRef(fn);
|
|
5356
|
+
useEnhancedEffect(() => {
|
|
5357
|
+
ref.current = fn;
|
|
5358
|
+
});
|
|
5359
|
+
return React__namespace.useCallback((...args) =>
|
|
5360
|
+
// @ts-expect-error hide `this`
|
|
5361
|
+
// tslint:disable-next-line:ban-comma-operator
|
|
5362
|
+
(0, ref.current)(...args), []);
|
|
5363
|
+
}
|
|
5364
|
+
|
|
5365
|
+
function useForkRef(...refs) {
|
|
5366
|
+
/**
|
|
5367
|
+
* This will create a new function if the refs passed to this hook change and are all defined.
|
|
5368
|
+
* This means react will call the old forkRef with `null` and the new forkRef
|
|
5369
|
+
* with the ref. Cleanup naturally emerges from this behavior.
|
|
5370
|
+
*/
|
|
5371
|
+
return React__namespace.useMemo(() => {
|
|
5372
|
+
if (refs.every(ref => ref == null)) {
|
|
5373
|
+
return null;
|
|
5374
|
+
}
|
|
5375
|
+
return instance => {
|
|
5376
|
+
refs.forEach(ref => {
|
|
5377
|
+
setRef(ref, instance);
|
|
5378
|
+
});
|
|
5379
|
+
};
|
|
5380
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
5381
|
+
}, refs);
|
|
5382
|
+
}
|
|
5383
|
+
|
|
5384
|
+
// based on https://github.com/WICG/focus-visible/blob/v4.1.5/src/focus-visible.js
|
|
5385
|
+
let hadKeyboardEvent = true;
|
|
5386
|
+
let hadFocusVisibleRecently = false;
|
|
5387
|
+
let hadFocusVisibleRecentlyTimeout;
|
|
5388
|
+
const inputTypesWhitelist = {
|
|
5389
|
+
text: true,
|
|
5390
|
+
search: true,
|
|
5391
|
+
url: true,
|
|
5392
|
+
tel: true,
|
|
5393
|
+
email: true,
|
|
5394
|
+
password: true,
|
|
5395
|
+
number: true,
|
|
5396
|
+
date: true,
|
|
5397
|
+
month: true,
|
|
5398
|
+
week: true,
|
|
5399
|
+
time: true,
|
|
5400
|
+
datetime: true,
|
|
5401
|
+
'datetime-local': true
|
|
5402
|
+
};
|
|
5403
|
+
|
|
5404
|
+
/**
|
|
5405
|
+
* Computes whether the given element should automatically trigger the
|
|
5406
|
+
* `focus-visible` class being added, i.e. whether it should always match
|
|
5407
|
+
* `:focus-visible` when focused.
|
|
5408
|
+
* @param {Element} node
|
|
5409
|
+
* @returns {boolean}
|
|
5410
|
+
*/
|
|
5411
|
+
function focusTriggersKeyboardModality(node) {
|
|
5412
|
+
const {
|
|
5413
|
+
type,
|
|
5414
|
+
tagName
|
|
5415
|
+
} = node;
|
|
5416
|
+
if (tagName === 'INPUT' && inputTypesWhitelist[type] && !node.readOnly) {
|
|
5417
|
+
return true;
|
|
5418
|
+
}
|
|
5419
|
+
if (tagName === 'TEXTAREA' && !node.readOnly) {
|
|
5420
|
+
return true;
|
|
5421
|
+
}
|
|
5422
|
+
if (node.isContentEditable) {
|
|
5423
|
+
return true;
|
|
5424
|
+
}
|
|
5425
|
+
return false;
|
|
5426
|
+
}
|
|
5427
|
+
|
|
5428
|
+
/**
|
|
5429
|
+
* Keep track of our keyboard modality state with `hadKeyboardEvent`.
|
|
5430
|
+
* If the most recent user interaction was via the keyboard;
|
|
5431
|
+
* and the key press did not include a meta, alt/option, or control key;
|
|
5432
|
+
* then the modality is keyboard. Otherwise, the modality is not keyboard.
|
|
5433
|
+
* @param {KeyboardEvent} event
|
|
5434
|
+
*/
|
|
5435
|
+
function handleKeyDown(event) {
|
|
5436
|
+
if (event.metaKey || event.altKey || event.ctrlKey) {
|
|
5437
|
+
return;
|
|
5438
|
+
}
|
|
5439
|
+
hadKeyboardEvent = true;
|
|
5440
|
+
}
|
|
5441
|
+
|
|
5442
|
+
/**
|
|
5443
|
+
* If at any point a user clicks with a pointing device, ensure that we change
|
|
5444
|
+
* the modality away from keyboard.
|
|
5445
|
+
* This avoids the situation where a user presses a key on an already focused
|
|
5446
|
+
* element, and then clicks on a different element, focusing it with a
|
|
5447
|
+
* pointing device, while we still think we're in keyboard modality.
|
|
5448
|
+
*/
|
|
5449
|
+
function handlePointerDown() {
|
|
5450
|
+
hadKeyboardEvent = false;
|
|
5451
|
+
}
|
|
5452
|
+
function handleVisibilityChange() {
|
|
5453
|
+
if (this.visibilityState === 'hidden') {
|
|
5454
|
+
// If the tab becomes active again, the browser will handle calling focus
|
|
5455
|
+
// on the element (Safari actually calls it twice).
|
|
5456
|
+
// If this tab change caused a blur on an element with focus-visible,
|
|
5457
|
+
// re-apply the class when the user switches back to the tab.
|
|
5458
|
+
if (hadFocusVisibleRecently) {
|
|
5459
|
+
hadKeyboardEvent = true;
|
|
5460
|
+
}
|
|
5461
|
+
}
|
|
5462
|
+
}
|
|
5463
|
+
function prepare(doc) {
|
|
5464
|
+
doc.addEventListener('keydown', handleKeyDown, true);
|
|
5465
|
+
doc.addEventListener('mousedown', handlePointerDown, true);
|
|
5466
|
+
doc.addEventListener('pointerdown', handlePointerDown, true);
|
|
5467
|
+
doc.addEventListener('touchstart', handlePointerDown, true);
|
|
5468
|
+
doc.addEventListener('visibilitychange', handleVisibilityChange, true);
|
|
5469
|
+
}
|
|
5470
|
+
function isFocusVisible(event) {
|
|
5471
|
+
const {
|
|
5472
|
+
target
|
|
5473
|
+
} = event;
|
|
5474
|
+
try {
|
|
5475
|
+
return target.matches(':focus-visible');
|
|
5476
|
+
} catch (error) {
|
|
5477
|
+
// Browsers not implementing :focus-visible will throw a SyntaxError.
|
|
5478
|
+
// We use our own heuristic for those browsers.
|
|
5479
|
+
// Rethrow might be better if it's not the expected error but do we really
|
|
5480
|
+
// want to crash if focus-visible malfunctioned?
|
|
5481
|
+
}
|
|
5482
|
+
|
|
5483
|
+
// No need for validFocusTarget check. The user does that by attaching it to
|
|
5484
|
+
// focusable events only.
|
|
5485
|
+
return hadKeyboardEvent || focusTriggersKeyboardModality(target);
|
|
5486
|
+
}
|
|
5487
|
+
function useIsFocusVisible() {
|
|
5488
|
+
const ref = React__namespace.useCallback(node => {
|
|
5489
|
+
if (node != null) {
|
|
5490
|
+
prepare(node.ownerDocument);
|
|
5491
|
+
}
|
|
5492
|
+
}, []);
|
|
5493
|
+
const isFocusVisibleRef = React__namespace.useRef(false);
|
|
5494
|
+
|
|
5495
|
+
/**
|
|
5496
|
+
* Should be called if a blur event is fired
|
|
5497
|
+
*/
|
|
5498
|
+
function handleBlurVisible() {
|
|
5499
|
+
// checking against potential state variable does not suffice if we focus and blur synchronously.
|
|
5500
|
+
// React wouldn't have time to trigger a re-render so `focusVisible` would be stale.
|
|
5501
|
+
// Ideally we would adjust `isFocusVisible(event)` to look at `relatedTarget` for blur events.
|
|
5502
|
+
// This doesn't work in IE11 due to https://github.com/facebook/react/issues/3751
|
|
5503
|
+
// TODO: check again if React releases their internal changes to focus event handling (https://github.com/facebook/react/pull/19186).
|
|
5504
|
+
if (isFocusVisibleRef.current) {
|
|
5505
|
+
// To detect a tab/window switch, we look for a blur event followed
|
|
5506
|
+
// rapidly by a visibility change.
|
|
5507
|
+
// If we don't see a visibility change within 100ms, it's probably a
|
|
5508
|
+
// regular focus change.
|
|
5509
|
+
hadFocusVisibleRecently = true;
|
|
5510
|
+
window.clearTimeout(hadFocusVisibleRecentlyTimeout);
|
|
5511
|
+
hadFocusVisibleRecentlyTimeout = window.setTimeout(() => {
|
|
5512
|
+
hadFocusVisibleRecently = false;
|
|
5513
|
+
}, 100);
|
|
5514
|
+
isFocusVisibleRef.current = false;
|
|
5515
|
+
return true;
|
|
5516
|
+
}
|
|
5517
|
+
return false;
|
|
5518
|
+
}
|
|
5519
|
+
|
|
5520
|
+
/**
|
|
5521
|
+
* Should be called if a blur event is fired
|
|
5522
|
+
*/
|
|
5523
|
+
function handleFocusVisible(event) {
|
|
5524
|
+
if (isFocusVisible(event)) {
|
|
5525
|
+
isFocusVisibleRef.current = true;
|
|
5526
|
+
return true;
|
|
5527
|
+
}
|
|
5528
|
+
return false;
|
|
5529
|
+
}
|
|
5530
|
+
return {
|
|
5531
|
+
isFocusVisibleRef,
|
|
5532
|
+
onFocus: handleFocusVisible,
|
|
5533
|
+
onBlur: handleBlurVisible,
|
|
5534
|
+
ref
|
|
5535
|
+
};
|
|
5536
|
+
}
|
|
5537
|
+
|
|
5305
5538
|
function getTypeByValue(value) {
|
|
5306
5539
|
const valueType = typeof value;
|
|
5307
5540
|
switch (valueType) {
|
|
@@ -5442,7 +5675,7 @@ function merge(acc, item) {
|
|
|
5442
5675
|
|
|
5443
5676
|
// The breakpoint **start** at this value.
|
|
5444
5677
|
// For instance with the first breakpoint xs: [xs, sm[.
|
|
5445
|
-
const values = {
|
|
5678
|
+
const values$1 = {
|
|
5446
5679
|
xs: 0,
|
|
5447
5680
|
// phone
|
|
5448
5681
|
sm: 600,
|
|
@@ -5458,7 +5691,7 @@ const defaultBreakpoints = {
|
|
|
5458
5691
|
// Sorted ASC by size. That's important.
|
|
5459
5692
|
// It can't be configured as it's used statically for propTypes.
|
|
5460
5693
|
keys: ['xs', 'sm', 'md', 'lg', 'xl'],
|
|
5461
|
-
up: key => `@media (min-width:${values[key]}px)`
|
|
5694
|
+
up: key => `@media (min-width:${values$1[key]}px)`
|
|
5462
5695
|
};
|
|
5463
5696
|
function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
5464
5697
|
const theme = props.theme || {};
|
|
@@ -5473,7 +5706,7 @@ function handleBreakpoints(props, propValue, styleFromPropValue) {
|
|
|
5473
5706
|
const themeBreakpoints = theme.breakpoints || defaultBreakpoints;
|
|
5474
5707
|
return Object.keys(propValue).reduce((acc, breakpoint) => {
|
|
5475
5708
|
// key is breakpoint
|
|
5476
|
-
if (Object.keys(themeBreakpoints.values || values).indexOf(breakpoint) !== -1) {
|
|
5709
|
+
if (Object.keys(themeBreakpoints.values || values$1).indexOf(breakpoint) !== -1) {
|
|
5477
5710
|
const mediaKey = themeBreakpoints.up(breakpoint);
|
|
5478
5711
|
acc[mediaKey] = styleFromPropValue(propValue[breakpoint], breakpoint);
|
|
5479
5712
|
} else {
|
|
@@ -6059,7 +6292,7 @@ const maxWidth = props => {
|
|
|
6059
6292
|
if (props.maxWidth !== undefined && props.maxWidth !== null) {
|
|
6060
6293
|
const styleFromPropValue = propValue => {
|
|
6061
6294
|
var _props$theme, _props$theme$breakpoi, _props$theme$breakpoi2;
|
|
6062
|
-
const breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || values[propValue];
|
|
6295
|
+
const breakpoint = ((_props$theme = props.theme) == null ? void 0 : (_props$theme$breakpoi = _props$theme.breakpoints) == null ? void 0 : (_props$theme$breakpoi2 = _props$theme$breakpoi.values) == null ? void 0 : _props$theme$breakpoi2[propValue]) || values$1[propValue];
|
|
6063
6296
|
return {
|
|
6064
6297
|
maxWidth: breakpoint || transform(propValue)
|
|
6065
6298
|
};
|
|
@@ -6256,7 +6489,7 @@ function unstable_createStyleFunctionSx(styleFunctionMapping$1 = styleFunctionMa
|
|
|
6256
6489
|
const styleFunctionSx = unstable_createStyleFunctionSx();
|
|
6257
6490
|
styleFunctionSx.filterProps = ['sx'];
|
|
6258
6491
|
|
|
6259
|
-
const _excluded$
|
|
6492
|
+
const _excluded$i = ["sx"];
|
|
6260
6493
|
const splitProps = props => {
|
|
6261
6494
|
const result = {
|
|
6262
6495
|
systemProps: {},
|
|
@@ -6275,7 +6508,7 @@ function extendSxProp(props) {
|
|
|
6275
6508
|
const {
|
|
6276
6509
|
sx: inSx
|
|
6277
6510
|
} = props,
|
|
6278
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
6511
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$i);
|
|
6279
6512
|
const {
|
|
6280
6513
|
systemProps,
|
|
6281
6514
|
otherProps
|
|
@@ -6301,7 +6534,7 @@ function extendSxProp(props) {
|
|
|
6301
6534
|
|
|
6302
6535
|
function r(e){var t,f,n="";if("string"==typeof e||"number"==typeof e)n+=e;else if("object"==typeof e)if(Array.isArray(e))for(t=0;t<e.length;t++)e[t]&&(f=r(e[t]))&&(n&&(n+=" "),n+=f);else for(t in e)e[t]&&(n&&(n+=" "),n+=t);return n}function clsx(){for(var e,t,f=0,n="";f<arguments.length;)(e=arguments[f++])&&(t=r(e))&&(n&&(n+=" "),n+=t);return n}
|
|
6303
6536
|
|
|
6304
|
-
const _excluded$
|
|
6537
|
+
const _excluded$h = ["values", "unit", "step"];
|
|
6305
6538
|
const sortBreakpointsValues = values => {
|
|
6306
6539
|
const breakpointsAsArray = Object.keys(values).map(key => ({
|
|
6307
6540
|
key,
|
|
@@ -6336,7 +6569,7 @@ function createBreakpoints(breakpoints) {
|
|
|
6336
6569
|
unit = 'px',
|
|
6337
6570
|
step = 5
|
|
6338
6571
|
} = breakpoints,
|
|
6339
|
-
other = _objectWithoutPropertiesLoose(breakpoints, _excluded$
|
|
6572
|
+
other = _objectWithoutPropertiesLoose(breakpoints, _excluded$h);
|
|
6340
6573
|
const sortedValues = sortBreakpointsValues(values);
|
|
6341
6574
|
const keys = Object.keys(sortedValues);
|
|
6342
6575
|
function up(key) {
|
|
@@ -6414,7 +6647,7 @@ function createSpacing(spacingInput = 8) {
|
|
|
6414
6647
|
return spacing;
|
|
6415
6648
|
}
|
|
6416
6649
|
|
|
6417
|
-
const _excluded$
|
|
6650
|
+
const _excluded$g = ["breakpoints", "palette", "spacing", "shape"];
|
|
6418
6651
|
function createTheme$1(options = {}, ...args) {
|
|
6419
6652
|
const {
|
|
6420
6653
|
breakpoints: breakpointsInput = {},
|
|
@@ -6422,7 +6655,7 @@ function createTheme$1(options = {}, ...args) {
|
|
|
6422
6655
|
spacing: spacingInput,
|
|
6423
6656
|
shape: shapeInput = {}
|
|
6424
6657
|
} = options,
|
|
6425
|
-
other = _objectWithoutPropertiesLoose(options, _excluded$
|
|
6658
|
+
other = _objectWithoutPropertiesLoose(options, _excluded$g);
|
|
6426
6659
|
const breakpoints = createBreakpoints(breakpointsInput);
|
|
6427
6660
|
const spacing = createSpacing(spacingInput);
|
|
6428
6661
|
let muiTheme = deepmerge({
|
|
@@ -6526,7 +6759,7 @@ function useTheme(defaultTheme = systemDefaultTheme$1) {
|
|
|
6526
6759
|
return useTheme$1(defaultTheme);
|
|
6527
6760
|
}
|
|
6528
6761
|
|
|
6529
|
-
const _excluded$
|
|
6762
|
+
const _excluded$f = ["className", "component"];
|
|
6530
6763
|
function createBox(options = {}) {
|
|
6531
6764
|
const {
|
|
6532
6765
|
defaultTheme,
|
|
@@ -6544,7 +6777,7 @@ function createBox(options = {}) {
|
|
|
6544
6777
|
className,
|
|
6545
6778
|
component = 'div'
|
|
6546
6779
|
} = _extendSxProp,
|
|
6547
|
-
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$
|
|
6780
|
+
other = _objectWithoutPropertiesLoose(_extendSxProp, _excluded$f);
|
|
6548
6781
|
return /*#__PURE__*/jsxRuntime.exports.jsx(BoxRoot, _extends$1({
|
|
6549
6782
|
as: component,
|
|
6550
6783
|
ref: ref,
|
|
@@ -6576,7 +6809,7 @@ process.env.NODE_ENV !== "production" ? Box$1.propTypes /* remove-proptypes */ =
|
|
|
6576
6809
|
sx: propTypes.exports.oneOfType([propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object, propTypes.exports.bool])), propTypes.exports.func, propTypes.exports.object])
|
|
6577
6810
|
} : void 0;
|
|
6578
6811
|
|
|
6579
|
-
const _excluded$
|
|
6812
|
+
const _excluded$e = ["variant"];
|
|
6580
6813
|
function isEmpty$1(string) {
|
|
6581
6814
|
return string.length === 0;
|
|
6582
6815
|
}
|
|
@@ -6590,7 +6823,7 @@ function propsToClassKey(props) {
|
|
|
6590
6823
|
const {
|
|
6591
6824
|
variant
|
|
6592
6825
|
} = props,
|
|
6593
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
6826
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$e);
|
|
6594
6827
|
let classKey = variant || '';
|
|
6595
6828
|
Object.keys(other).sort().forEach(key => {
|
|
6596
6829
|
if (key === 'color') {
|
|
@@ -6602,7 +6835,7 @@ function propsToClassKey(props) {
|
|
|
6602
6835
|
return classKey;
|
|
6603
6836
|
}
|
|
6604
6837
|
|
|
6605
|
-
const _excluded$
|
|
6838
|
+
const _excluded$d = ["name", "slot", "skipVariantsResolver", "skipSx", "overridesResolver"],
|
|
6606
6839
|
_excluded2$1 = ["theme"],
|
|
6607
6840
|
_excluded3 = ["theme"];
|
|
6608
6841
|
function isEmpty(obj) {
|
|
@@ -6690,7 +6923,7 @@ function createStyled(input = {}) {
|
|
|
6690
6923
|
skipSx: inputSkipSx,
|
|
6691
6924
|
overridesResolver
|
|
6692
6925
|
} = inputOptions,
|
|
6693
|
-
options = _objectWithoutPropertiesLoose(inputOptions, _excluded$
|
|
6926
|
+
options = _objectWithoutPropertiesLoose(inputOptions, _excluded$d);
|
|
6694
6927
|
|
|
6695
6928
|
// if skipVariantsResolver option is defined, take the value, otherwise, true for root and false for other slots.
|
|
6696
6929
|
const skipVariantsResolver = inputSkipVariantsResolver !== undefined ? inputSkipVariantsResolver : componentSlot && componentSlot !== 'Root' || false;
|
|
@@ -7555,7 +7788,7 @@ function useCurrentColorScheme(options) {
|
|
|
7555
7788
|
});
|
|
7556
7789
|
}
|
|
7557
7790
|
|
|
7558
|
-
const _excluded$
|
|
7791
|
+
const _excluded$c = ["colorSchemes", "components", "cssVarPrefix"];
|
|
7559
7792
|
const DISABLE_CSS_TRANSITION = '*{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}';
|
|
7560
7793
|
function createCssVarsProvider(options) {
|
|
7561
7794
|
const {
|
|
@@ -7607,7 +7840,7 @@ function createCssVarsProvider(options) {
|
|
|
7607
7840
|
components = {},
|
|
7608
7841
|
cssVarPrefix
|
|
7609
7842
|
} = themeProp,
|
|
7610
|
-
restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded$
|
|
7843
|
+
restThemeProp = _objectWithoutPropertiesLoose(themeProp, _excluded$c);
|
|
7611
7844
|
const allColorSchemes = Object.keys(colorSchemes);
|
|
7612
7845
|
const defaultLightColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.light;
|
|
7613
7846
|
const defaultDarkColorScheme = typeof defaultColorScheme === 'string' ? defaultColorScheme : defaultColorScheme.dark;
|
|
@@ -7905,7 +8138,7 @@ function createGetCssVar$1(prefix = '') {
|
|
|
7905
8138
|
return getCssVar;
|
|
7906
8139
|
}
|
|
7907
8140
|
|
|
7908
|
-
const _excluded$
|
|
8141
|
+
const _excluded$b = ["className", "component", "disableGutters", "fixed", "maxWidth", "classes"];
|
|
7909
8142
|
const defaultTheme$5 = createTheme$1();
|
|
7910
8143
|
const defaultCreateStyledComponent$2 = styled$1('div', {
|
|
7911
8144
|
name: 'MuiContainer',
|
|
@@ -7922,7 +8155,7 @@ const useThemePropsDefault$2 = inProps => useThemeProps$1({
|
|
|
7922
8155
|
name: 'MuiContainer',
|
|
7923
8156
|
defaultTheme: defaultTheme$5
|
|
7924
8157
|
});
|
|
7925
|
-
const useUtilityClasses$
|
|
8158
|
+
const useUtilityClasses$3 = (ownerState, componentName) => {
|
|
7926
8159
|
const getContainerUtilityClass = slot => {
|
|
7927
8160
|
return generateUtilityClass(componentName, slot);
|
|
7928
8161
|
};
|
|
@@ -8001,7 +8234,7 @@ function createContainer(options = {}) {
|
|
|
8001
8234
|
fixed = false,
|
|
8002
8235
|
maxWidth = 'lg'
|
|
8003
8236
|
} = props,
|
|
8004
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
8237
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$b);
|
|
8005
8238
|
const ownerState = _extends$1({}, props, {
|
|
8006
8239
|
component,
|
|
8007
8240
|
disableGutters,
|
|
@@ -8010,7 +8243,7 @@ function createContainer(options = {}) {
|
|
|
8010
8243
|
});
|
|
8011
8244
|
|
|
8012
8245
|
// @ts-ignore module augmentation fails if custom breakpoints are used
|
|
8013
|
-
const classes = useUtilityClasses$
|
|
8246
|
+
const classes = useUtilityClasses$3(ownerState, componentName);
|
|
8014
8247
|
return (
|
|
8015
8248
|
/*#__PURE__*/
|
|
8016
8249
|
// @ts-ignore theme is injected by the styled util
|
|
@@ -8324,7 +8557,7 @@ const generateDirectionClasses = direction => {
|
|
|
8324
8557
|
return [`direction-xs-${String(direction)}`];
|
|
8325
8558
|
};
|
|
8326
8559
|
|
|
8327
|
-
const _excluded$
|
|
8560
|
+
const _excluded$a = ["className", "columns", "container", "component", "direction", "wrap", "spacing", "rowSpacing", "columnSpacing", "disableEqualOverflow"];
|
|
8328
8561
|
const defaultTheme$4 = createTheme$1();
|
|
8329
8562
|
|
|
8330
8563
|
// widening Theme to any so that the consumer can own the theme structure.
|
|
@@ -8382,7 +8615,7 @@ function createGrid(options = {}) {
|
|
|
8382
8615
|
columnSpacing: columnSpacingProp = spacingProp,
|
|
8383
8616
|
disableEqualOverflow: themeDisableEqualOverflow
|
|
8384
8617
|
} = props,
|
|
8385
|
-
rest = _objectWithoutPropertiesLoose(props, _excluded$
|
|
8618
|
+
rest = _objectWithoutPropertiesLoose(props, _excluded$a);
|
|
8386
8619
|
// Because `disableEqualOverflow` can be set from the theme's defaultProps, the **nested** grid should look at the instance props instead.
|
|
8387
8620
|
let disableEqualOverflow = themeDisableEqualOverflow;
|
|
8388
8621
|
if (nested && themeDisableEqualOverflow !== undefined) {
|
|
@@ -8635,7 +8868,7 @@ generateUtilityClasses('MuiGrid', ['root', 'container', 'item',
|
|
|
8635
8868
|
// grid sizes for all breakpoints
|
|
8636
8869
|
...GRID_SIZES.map(size => `grid-xs-${size}`), ...GRID_SIZES.map(size => `grid-sm-${size}`), ...GRID_SIZES.map(size => `grid-md-${size}`), ...GRID_SIZES.map(size => `grid-lg-${size}`), ...GRID_SIZES.map(size => `grid-xl-${size}`)]);
|
|
8637
8870
|
|
|
8638
|
-
const _excluded$
|
|
8871
|
+
const _excluded$9 = ["component", "direction", "spacing", "divider", "children", "className"];
|
|
8639
8872
|
const defaultTheme$3 = createTheme$1();
|
|
8640
8873
|
// widening Theme to any so that the consumer can own the theme structure.
|
|
8641
8874
|
const defaultCreateStyledComponent = styled$1('div', {
|
|
@@ -8758,7 +8991,7 @@ function createStack(options = {}) {
|
|
|
8758
8991
|
children,
|
|
8759
8992
|
className
|
|
8760
8993
|
} = props,
|
|
8761
|
-
other = _objectWithoutPropertiesLoose(props, _excluded$
|
|
8994
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$9);
|
|
8762
8995
|
const ownerState = {
|
|
8763
8996
|
direction,
|
|
8764
8997
|
spacing
|
|
@@ -8967,7 +9200,7 @@ const green = {
|
|
|
8967
9200
|
A700: '#00c853'
|
|
8968
9201
|
};
|
|
8969
9202
|
|
|
8970
|
-
const _excluded$
|
|
9203
|
+
const _excluded$8 = ["mode", "contrastThreshold", "tonalOffset"];
|
|
8971
9204
|
const light = {
|
|
8972
9205
|
// The colors used to style the text.
|
|
8973
9206
|
text: {
|
|
@@ -9136,7 +9369,7 @@ function createPalette(palette) {
|
|
|
9136
9369
|
contrastThreshold = 3,
|
|
9137
9370
|
tonalOffset = 0.2
|
|
9138
9371
|
} = palette,
|
|
9139
|
-
other = _objectWithoutPropertiesLoose(palette, _excluded$
|
|
9372
|
+
other = _objectWithoutPropertiesLoose(palette, _excluded$8);
|
|
9140
9373
|
const primary = palette.primary || getDefaultPrimary(mode);
|
|
9141
9374
|
const secondary = palette.secondary || getDefaultSecondary(mode);
|
|
9142
9375
|
const error = palette.error || getDefaultError(mode);
|
|
@@ -9260,7 +9493,7 @@ const theme2 = createTheme({ palette: {
|
|
|
9260
9493
|
return paletteOutput;
|
|
9261
9494
|
}
|
|
9262
9495
|
|
|
9263
|
-
const _excluded$
|
|
9496
|
+
const _excluded$7 = ["fontFamily", "fontSize", "fontWeightLight", "fontWeightRegular", "fontWeightMedium", "fontWeightBold", "htmlFontSize", "allVariants", "pxToRem"];
|
|
9264
9497
|
function round(value) {
|
|
9265
9498
|
return Math.round(value * 1e5) / 1e5;
|
|
9266
9499
|
}
|
|
@@ -9291,7 +9524,7 @@ function createTypography(palette, typography) {
|
|
|
9291
9524
|
allVariants,
|
|
9292
9525
|
pxToRem: pxToRem2
|
|
9293
9526
|
} = _ref,
|
|
9294
|
-
other = _objectWithoutPropertiesLoose(_ref, _excluded$
|
|
9527
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded$7);
|
|
9295
9528
|
if (process.env.NODE_ENV !== 'production') {
|
|
9296
9529
|
if (typeof fontSize !== 'number') {
|
|
9297
9530
|
console.error('MUI: `fontSize` is required to be a number.');
|
|
@@ -9350,7 +9583,7 @@ function createShadow(...px) {
|
|
|
9350
9583
|
// Values from https://github.com/material-components/material-components-web/blob/be8747f94574669cb5e7add1a7c54fa41a89cec7/packages/mdc-elevation/_variables.scss
|
|
9351
9584
|
const shadows = ['none', createShadow(0, 2, 1, -1, 0, 1, 1, 0, 0, 1, 3, 0), createShadow(0, 3, 1, -2, 0, 2, 2, 0, 0, 1, 5, 0), createShadow(0, 3, 3, -2, 0, 3, 4, 0, 0, 1, 8, 0), createShadow(0, 2, 4, -1, 0, 4, 5, 0, 0, 1, 10, 0), createShadow(0, 3, 5, -1, 0, 5, 8, 0, 0, 1, 14, 0), createShadow(0, 3, 5, -1, 0, 6, 10, 0, 0, 1, 18, 0), createShadow(0, 4, 5, -2, 0, 7, 10, 1, 0, 2, 16, 1), createShadow(0, 5, 5, -3, 0, 8, 10, 1, 0, 3, 14, 2), createShadow(0, 5, 6, -3, 0, 9, 12, 1, 0, 3, 16, 2), createShadow(0, 6, 6, -3, 0, 10, 14, 1, 0, 4, 18, 3), createShadow(0, 6, 7, -4, 0, 11, 15, 1, 0, 4, 20, 3), createShadow(0, 7, 8, -4, 0, 12, 17, 2, 0, 5, 22, 4), createShadow(0, 7, 8, -4, 0, 13, 19, 2, 0, 5, 24, 4), createShadow(0, 7, 9, -4, 0, 14, 21, 2, 0, 5, 26, 4), createShadow(0, 8, 9, -5, 0, 15, 22, 2, 0, 6, 28, 5), createShadow(0, 8, 10, -5, 0, 16, 24, 2, 0, 6, 30, 5), createShadow(0, 8, 11, -5, 0, 17, 26, 2, 0, 6, 32, 5), createShadow(0, 9, 11, -5, 0, 18, 28, 2, 0, 7, 34, 6), createShadow(0, 9, 12, -6, 0, 19, 29, 2, 0, 7, 36, 6), createShadow(0, 10, 13, -6, 0, 20, 31, 3, 0, 8, 38, 7), createShadow(0, 10, 13, -6, 0, 21, 33, 3, 0, 8, 40, 7), createShadow(0, 10, 14, -6, 0, 22, 35, 3, 0, 8, 42, 7), createShadow(0, 11, 14, -7, 0, 23, 36, 3, 0, 9, 44, 8), createShadow(0, 11, 15, -7, 0, 24, 38, 3, 0, 9, 46, 8)];
|
|
9352
9585
|
|
|
9353
|
-
const _excluded$
|
|
9586
|
+
const _excluded$6 = ["duration", "easing", "delay"];
|
|
9354
9587
|
// Follow https://material.google.com/motion/duration-easing.html#duration-easing-natural-easing-curves
|
|
9355
9588
|
// to learn the context in which each easing should be used.
|
|
9356
9589
|
const easing = {
|
|
@@ -9401,7 +9634,7 @@ function createTransitions(inputTransitions) {
|
|
|
9401
9634
|
easing: easingOption = mergedEasing.easeInOut,
|
|
9402
9635
|
delay = 0
|
|
9403
9636
|
} = options,
|
|
9404
|
-
other = _objectWithoutPropertiesLoose(options, _excluded$
|
|
9637
|
+
other = _objectWithoutPropertiesLoose(options, _excluded$6);
|
|
9405
9638
|
if (process.env.NODE_ENV !== 'production') {
|
|
9406
9639
|
const isString = value => typeof value === 'string';
|
|
9407
9640
|
// IE11 support, replace with Number.isNaN
|
|
@@ -9447,7 +9680,7 @@ const zIndex = {
|
|
|
9447
9680
|
tooltip: 1500
|
|
9448
9681
|
};
|
|
9449
9682
|
|
|
9450
|
-
const _excluded$
|
|
9683
|
+
const _excluded$5 = ["breakpoints", "mixins", "spacing", "palette", "transitions", "typography", "shape"];
|
|
9451
9684
|
function createTheme(options = {}, ...args) {
|
|
9452
9685
|
const {
|
|
9453
9686
|
mixins: mixinsInput = {},
|
|
@@ -9455,7 +9688,7 @@ function createTheme(options = {}, ...args) {
|
|
|
9455
9688
|
transitions: transitionsInput = {},
|
|
9456
9689
|
typography: typographyInput = {}
|
|
9457
9690
|
} = options,
|
|
9458
|
-
other = _objectWithoutPropertiesLoose(options, _excluded$
|
|
9691
|
+
other = _objectWithoutPropertiesLoose(options, _excluded$5);
|
|
9459
9692
|
if (options.vars) {
|
|
9460
9693
|
throw new Error(process.env.NODE_ENV !== "production" ? `MUI: \`vars\` is a private field used for CSS variables support.
|
|
9461
9694
|
Please use another name.` : formatMuiErrorMessage(18));
|
|
@@ -9535,7 +9768,7 @@ const getOverlayAlpha = elevation => {
|
|
|
9535
9768
|
return (alphaValue / 100).toFixed(2);
|
|
9536
9769
|
};
|
|
9537
9770
|
|
|
9538
|
-
const _excluded$
|
|
9771
|
+
const _excluded$4 = ["colorSchemes", "cssVarPrefix"],
|
|
9539
9772
|
_excluded2 = ["palette"];
|
|
9540
9773
|
const defaultDarkOverlays = [...Array(25)].map((_, index) => {
|
|
9541
9774
|
if (index === 0) {
|
|
@@ -9571,7 +9804,7 @@ function extendTheme(options = {}, ...args) {
|
|
|
9571
9804
|
colorSchemes: colorSchemesInput = {},
|
|
9572
9805
|
cssVarPrefix = 'mui'
|
|
9573
9806
|
} = options,
|
|
9574
|
-
input = _objectWithoutPropertiesLoose(options, _excluded$
|
|
9807
|
+
input = _objectWithoutPropertiesLoose(options, _excluded$4);
|
|
9575
9808
|
const getCssVar = createGetCssVar(cssVarPrefix);
|
|
9576
9809
|
const _createThemeWithoutVa = createTheme(_extends$1({}, input, colorSchemesInput.light && {
|
|
9577
9810
|
palette: (_colorSchemesInput$li = colorSchemesInput.light) == null ? void 0 : _colorSchemesInput$li.palette
|
|
@@ -9889,8 +10122,8 @@ function getTypographyUtilityClass(slot) {
|
|
|
9889
10122
|
}
|
|
9890
10123
|
generateUtilityClasses('MuiTypography', ['root', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'subtitle1', 'subtitle2', 'body1', 'body2', 'inherit', 'button', 'caption', 'overline', 'alignLeft', 'alignRight', 'alignCenter', 'alignJustify', 'noWrap', 'gutterBottom', 'paragraph']);
|
|
9891
10124
|
|
|
9892
|
-
const _excluded = ["align", "className", "component", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"];
|
|
9893
|
-
const useUtilityClasses = ownerState => {
|
|
10125
|
+
const _excluded$3 = ["align", "className", "component", "gutterBottom", "noWrap", "paragraph", "variant", "variantMapping"];
|
|
10126
|
+
const useUtilityClasses$2 = ownerState => {
|
|
9894
10127
|
const {
|
|
9895
10128
|
align,
|
|
9896
10129
|
gutterBottom,
|
|
@@ -9973,7 +10206,7 @@ const Typography = /*#__PURE__*/React__namespace.forwardRef(function Typography(
|
|
|
9973
10206
|
variant = 'body1',
|
|
9974
10207
|
variantMapping = defaultVariantMapping
|
|
9975
10208
|
} = props,
|
|
9976
|
-
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
10209
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$3);
|
|
9977
10210
|
const ownerState = _extends$1({}, props, {
|
|
9978
10211
|
align,
|
|
9979
10212
|
color,
|
|
@@ -9986,7 +10219,7 @@ const Typography = /*#__PURE__*/React__namespace.forwardRef(function Typography(
|
|
|
9986
10219
|
variantMapping
|
|
9987
10220
|
});
|
|
9988
10221
|
const Component = component || (paragraph ? 'p' : variantMapping[variant] || defaultVariantMapping[variant]) || 'span';
|
|
9989
|
-
const classes = useUtilityClasses(ownerState);
|
|
10222
|
+
const classes = useUtilityClasses$2(ownerState);
|
|
9990
10223
|
return /*#__PURE__*/jsxRuntime.exports.jsx(TypographyRoot, _extends$1({
|
|
9991
10224
|
as: Component,
|
|
9992
10225
|
ref: ref,
|
|
@@ -10084,7 +10317,7 @@ const theme = createTheme({
|
|
|
10084
10317
|
inputsValidation: '#FFF5F5',
|
|
10085
10318
|
buttonBlack: '#000000',
|
|
10086
10319
|
buttonBlue: '#3A44A7',
|
|
10087
|
-
|
|
10320
|
+
specialGreen: '#61CC61',
|
|
10088
10321
|
},
|
|
10089
10322
|
table: {
|
|
10090
10323
|
header: '#E7EAF3',
|
|
@@ -10108,6 +10341,18 @@ const theme = createTheme({
|
|
|
10108
10341
|
fontFamily: [
|
|
10109
10342
|
'"Barlow", sans-serif',
|
|
10110
10343
|
].join(','),
|
|
10344
|
+
scrollbar: {
|
|
10345
|
+
height: 4,
|
|
10346
|
+
width: 4,
|
|
10347
|
+
background: '#B0BAD8',
|
|
10348
|
+
borderRadius: 10,
|
|
10349
|
+
'&-thumb': {
|
|
10350
|
+
height: 4,
|
|
10351
|
+
width: 4,
|
|
10352
|
+
borderRadius: 10,
|
|
10353
|
+
backgroundColor: '#293072',
|
|
10354
|
+
}
|
|
10355
|
+
},
|
|
10111
10356
|
});
|
|
10112
10357
|
|
|
10113
10358
|
var StyledTypography = styled(Typography)(function (_a) {
|
|
@@ -10298,6 +10543,3293 @@ var AppTileComponent = function (_a) {
|
|
|
10298
10543
|
return (jsxRuntime.exports.jsx(StyledAppTileWrapper, { children: jsxRuntime.exports.jsx(StyledHeaderDescriptionWrapper, { children: jsxRuntime.exports.jsx(TypographyComponent, { text: header, type: 'app-tile-header', forwardedRef: forwardedRef }) }) }));
|
|
10299
10544
|
};
|
|
10300
10545
|
|
|
10546
|
+
function _setPrototypeOf(o, p) {
|
|
10547
|
+
_setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) {
|
|
10548
|
+
o.__proto__ = p;
|
|
10549
|
+
return o;
|
|
10550
|
+
};
|
|
10551
|
+
return _setPrototypeOf(o, p);
|
|
10552
|
+
}
|
|
10553
|
+
|
|
10554
|
+
function _inheritsLoose(subClass, superClass) {
|
|
10555
|
+
subClass.prototype = Object.create(superClass.prototype);
|
|
10556
|
+
subClass.prototype.constructor = subClass;
|
|
10557
|
+
_setPrototypeOf(subClass, superClass);
|
|
10558
|
+
}
|
|
10559
|
+
|
|
10560
|
+
/**
|
|
10561
|
+
* Checks if a given element has a CSS class.
|
|
10562
|
+
*
|
|
10563
|
+
* @param element the element
|
|
10564
|
+
* @param className the CSS class name
|
|
10565
|
+
*/
|
|
10566
|
+
function hasClass(element, className) {
|
|
10567
|
+
if (element.classList) return !!className && element.classList.contains(className);
|
|
10568
|
+
return (" " + (element.className.baseVal || element.className) + " ").indexOf(" " + className + " ") !== -1;
|
|
10569
|
+
}
|
|
10570
|
+
|
|
10571
|
+
/**
|
|
10572
|
+
* Adds a CSS class to a given element.
|
|
10573
|
+
*
|
|
10574
|
+
* @param element the element
|
|
10575
|
+
* @param className the CSS class name
|
|
10576
|
+
*/
|
|
10577
|
+
|
|
10578
|
+
function addClass(element, className) {
|
|
10579
|
+
if (element.classList) element.classList.add(className);else if (!hasClass(element, className)) if (typeof element.className === 'string') element.className = element.className + " " + className;else element.setAttribute('class', (element.className && element.className.baseVal || '') + " " + className);
|
|
10580
|
+
}
|
|
10581
|
+
|
|
10582
|
+
function replaceClassName(origClass, classToRemove) {
|
|
10583
|
+
return origClass.replace(new RegExp("(^|\\s)" + classToRemove + "(?:\\s|$)", 'g'), '$1').replace(/\s+/g, ' ').replace(/^\s*|\s*$/g, '');
|
|
10584
|
+
}
|
|
10585
|
+
/**
|
|
10586
|
+
* Removes a CSS class from a given element.
|
|
10587
|
+
*
|
|
10588
|
+
* @param element the element
|
|
10589
|
+
* @param className the CSS class name
|
|
10590
|
+
*/
|
|
10591
|
+
|
|
10592
|
+
|
|
10593
|
+
function removeClass$1(element, className) {
|
|
10594
|
+
if (element.classList) {
|
|
10595
|
+
element.classList.remove(className);
|
|
10596
|
+
} else if (typeof element.className === 'string') {
|
|
10597
|
+
element.className = replaceClassName(element.className, className);
|
|
10598
|
+
} else {
|
|
10599
|
+
element.setAttribute('class', replaceClassName(element.className && element.className.baseVal || '', className));
|
|
10600
|
+
}
|
|
10601
|
+
}
|
|
10602
|
+
|
|
10603
|
+
var config = {
|
|
10604
|
+
disabled: false
|
|
10605
|
+
};
|
|
10606
|
+
|
|
10607
|
+
var timeoutsShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.oneOfType([propTypes.exports.number, propTypes.exports.shape({
|
|
10608
|
+
enter: propTypes.exports.number,
|
|
10609
|
+
exit: propTypes.exports.number,
|
|
10610
|
+
appear: propTypes.exports.number
|
|
10611
|
+
}).isRequired]) : null;
|
|
10612
|
+
var classNamesShape = process.env.NODE_ENV !== 'production' ? propTypes.exports.oneOfType([propTypes.exports.string, propTypes.exports.shape({
|
|
10613
|
+
enter: propTypes.exports.string,
|
|
10614
|
+
exit: propTypes.exports.string,
|
|
10615
|
+
active: propTypes.exports.string
|
|
10616
|
+
}), propTypes.exports.shape({
|
|
10617
|
+
enter: propTypes.exports.string,
|
|
10618
|
+
enterDone: propTypes.exports.string,
|
|
10619
|
+
enterActive: propTypes.exports.string,
|
|
10620
|
+
exit: propTypes.exports.string,
|
|
10621
|
+
exitDone: propTypes.exports.string,
|
|
10622
|
+
exitActive: propTypes.exports.string
|
|
10623
|
+
})]) : null;
|
|
10624
|
+
|
|
10625
|
+
var TransitionGroupContext = React.createContext(null);
|
|
10626
|
+
|
|
10627
|
+
var forceReflow = function forceReflow(node) {
|
|
10628
|
+
return node.scrollTop;
|
|
10629
|
+
};
|
|
10630
|
+
|
|
10631
|
+
var UNMOUNTED = 'unmounted';
|
|
10632
|
+
var EXITED = 'exited';
|
|
10633
|
+
var ENTERING = 'entering';
|
|
10634
|
+
var ENTERED = 'entered';
|
|
10635
|
+
var EXITING = 'exiting';
|
|
10636
|
+
/**
|
|
10637
|
+
* The Transition component lets you describe a transition from one component
|
|
10638
|
+
* state to another _over time_ with a simple declarative API. Most commonly
|
|
10639
|
+
* it's used to animate the mounting and unmounting of a component, but can also
|
|
10640
|
+
* be used to describe in-place transition states as well.
|
|
10641
|
+
*
|
|
10642
|
+
* ---
|
|
10643
|
+
*
|
|
10644
|
+
* **Note**: `Transition` is a platform-agnostic base component. If you're using
|
|
10645
|
+
* transitions in CSS, you'll probably want to use
|
|
10646
|
+
* [`CSSTransition`](https://reactcommunity.org/react-transition-group/css-transition)
|
|
10647
|
+
* instead. It inherits all the features of `Transition`, but contains
|
|
10648
|
+
* additional features necessary to play nice with CSS transitions (hence the
|
|
10649
|
+
* name of the component).
|
|
10650
|
+
*
|
|
10651
|
+
* ---
|
|
10652
|
+
*
|
|
10653
|
+
* By default the `Transition` component does not alter the behavior of the
|
|
10654
|
+
* component it renders, it only tracks "enter" and "exit" states for the
|
|
10655
|
+
* components. It's up to you to give meaning and effect to those states. For
|
|
10656
|
+
* example we can add styles to a component when it enters or exits:
|
|
10657
|
+
*
|
|
10658
|
+
* ```jsx
|
|
10659
|
+
* import { Transition } from 'react-transition-group';
|
|
10660
|
+
*
|
|
10661
|
+
* const duration = 300;
|
|
10662
|
+
*
|
|
10663
|
+
* const defaultStyle = {
|
|
10664
|
+
* transition: `opacity ${duration}ms ease-in-out`,
|
|
10665
|
+
* opacity: 0,
|
|
10666
|
+
* }
|
|
10667
|
+
*
|
|
10668
|
+
* const transitionStyles = {
|
|
10669
|
+
* entering: { opacity: 1 },
|
|
10670
|
+
* entered: { opacity: 1 },
|
|
10671
|
+
* exiting: { opacity: 0 },
|
|
10672
|
+
* exited: { opacity: 0 },
|
|
10673
|
+
* };
|
|
10674
|
+
*
|
|
10675
|
+
* const Fade = ({ in: inProp }) => (
|
|
10676
|
+
* <Transition in={inProp} timeout={duration}>
|
|
10677
|
+
* {state => (
|
|
10678
|
+
* <div style={{
|
|
10679
|
+
* ...defaultStyle,
|
|
10680
|
+
* ...transitionStyles[state]
|
|
10681
|
+
* }}>
|
|
10682
|
+
* I'm a fade Transition!
|
|
10683
|
+
* </div>
|
|
10684
|
+
* )}
|
|
10685
|
+
* </Transition>
|
|
10686
|
+
* );
|
|
10687
|
+
* ```
|
|
10688
|
+
*
|
|
10689
|
+
* There are 4 main states a Transition can be in:
|
|
10690
|
+
* - `'entering'`
|
|
10691
|
+
* - `'entered'`
|
|
10692
|
+
* - `'exiting'`
|
|
10693
|
+
* - `'exited'`
|
|
10694
|
+
*
|
|
10695
|
+
* Transition state is toggled via the `in` prop. When `true` the component
|
|
10696
|
+
* begins the "Enter" stage. During this stage, the component will shift from
|
|
10697
|
+
* its current transition state, to `'entering'` for the duration of the
|
|
10698
|
+
* transition and then to the `'entered'` stage once it's complete. Let's take
|
|
10699
|
+
* the following example (we'll use the
|
|
10700
|
+
* [useState](https://reactjs.org/docs/hooks-reference.html#usestate) hook):
|
|
10701
|
+
*
|
|
10702
|
+
* ```jsx
|
|
10703
|
+
* function App() {
|
|
10704
|
+
* const [inProp, setInProp] = useState(false);
|
|
10705
|
+
* return (
|
|
10706
|
+
* <div>
|
|
10707
|
+
* <Transition in={inProp} timeout={500}>
|
|
10708
|
+
* {state => (
|
|
10709
|
+
* // ...
|
|
10710
|
+
* )}
|
|
10711
|
+
* </Transition>
|
|
10712
|
+
* <button onClick={() => setInProp(true)}>
|
|
10713
|
+
* Click to Enter
|
|
10714
|
+
* </button>
|
|
10715
|
+
* </div>
|
|
10716
|
+
* );
|
|
10717
|
+
* }
|
|
10718
|
+
* ```
|
|
10719
|
+
*
|
|
10720
|
+
* When the button is clicked the component will shift to the `'entering'` state
|
|
10721
|
+
* and stay there for 500ms (the value of `timeout`) before it finally switches
|
|
10722
|
+
* to `'entered'`.
|
|
10723
|
+
*
|
|
10724
|
+
* When `in` is `false` the same thing happens except the state moves from
|
|
10725
|
+
* `'exiting'` to `'exited'`.
|
|
10726
|
+
*/
|
|
10727
|
+
|
|
10728
|
+
var Transition = /*#__PURE__*/function (_React$Component) {
|
|
10729
|
+
_inheritsLoose(Transition, _React$Component);
|
|
10730
|
+
|
|
10731
|
+
function Transition(props, context) {
|
|
10732
|
+
var _this;
|
|
10733
|
+
|
|
10734
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
10735
|
+
var parentGroup = context; // In the context of a TransitionGroup all enters are really appears
|
|
10736
|
+
|
|
10737
|
+
var appear = parentGroup && !parentGroup.isMounting ? props.enter : props.appear;
|
|
10738
|
+
var initialStatus;
|
|
10739
|
+
_this.appearStatus = null;
|
|
10740
|
+
|
|
10741
|
+
if (props.in) {
|
|
10742
|
+
if (appear) {
|
|
10743
|
+
initialStatus = EXITED;
|
|
10744
|
+
_this.appearStatus = ENTERING;
|
|
10745
|
+
} else {
|
|
10746
|
+
initialStatus = ENTERED;
|
|
10747
|
+
}
|
|
10748
|
+
} else {
|
|
10749
|
+
if (props.unmountOnExit || props.mountOnEnter) {
|
|
10750
|
+
initialStatus = UNMOUNTED;
|
|
10751
|
+
} else {
|
|
10752
|
+
initialStatus = EXITED;
|
|
10753
|
+
}
|
|
10754
|
+
}
|
|
10755
|
+
|
|
10756
|
+
_this.state = {
|
|
10757
|
+
status: initialStatus
|
|
10758
|
+
};
|
|
10759
|
+
_this.nextCallback = null;
|
|
10760
|
+
return _this;
|
|
10761
|
+
}
|
|
10762
|
+
|
|
10763
|
+
Transition.getDerivedStateFromProps = function getDerivedStateFromProps(_ref, prevState) {
|
|
10764
|
+
var nextIn = _ref.in;
|
|
10765
|
+
|
|
10766
|
+
if (nextIn && prevState.status === UNMOUNTED) {
|
|
10767
|
+
return {
|
|
10768
|
+
status: EXITED
|
|
10769
|
+
};
|
|
10770
|
+
}
|
|
10771
|
+
|
|
10772
|
+
return null;
|
|
10773
|
+
} // getSnapshotBeforeUpdate(prevProps) {
|
|
10774
|
+
// let nextStatus = null
|
|
10775
|
+
// if (prevProps !== this.props) {
|
|
10776
|
+
// const { status } = this.state
|
|
10777
|
+
// if (this.props.in) {
|
|
10778
|
+
// if (status !== ENTERING && status !== ENTERED) {
|
|
10779
|
+
// nextStatus = ENTERING
|
|
10780
|
+
// }
|
|
10781
|
+
// } else {
|
|
10782
|
+
// if (status === ENTERING || status === ENTERED) {
|
|
10783
|
+
// nextStatus = EXITING
|
|
10784
|
+
// }
|
|
10785
|
+
// }
|
|
10786
|
+
// }
|
|
10787
|
+
// return { nextStatus }
|
|
10788
|
+
// }
|
|
10789
|
+
;
|
|
10790
|
+
|
|
10791
|
+
var _proto = Transition.prototype;
|
|
10792
|
+
|
|
10793
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
10794
|
+
this.updateStatus(true, this.appearStatus);
|
|
10795
|
+
};
|
|
10796
|
+
|
|
10797
|
+
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
|
|
10798
|
+
var nextStatus = null;
|
|
10799
|
+
|
|
10800
|
+
if (prevProps !== this.props) {
|
|
10801
|
+
var status = this.state.status;
|
|
10802
|
+
|
|
10803
|
+
if (this.props.in) {
|
|
10804
|
+
if (status !== ENTERING && status !== ENTERED) {
|
|
10805
|
+
nextStatus = ENTERING;
|
|
10806
|
+
}
|
|
10807
|
+
} else {
|
|
10808
|
+
if (status === ENTERING || status === ENTERED) {
|
|
10809
|
+
nextStatus = EXITING;
|
|
10810
|
+
}
|
|
10811
|
+
}
|
|
10812
|
+
}
|
|
10813
|
+
|
|
10814
|
+
this.updateStatus(false, nextStatus);
|
|
10815
|
+
};
|
|
10816
|
+
|
|
10817
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
10818
|
+
this.cancelNextCallback();
|
|
10819
|
+
};
|
|
10820
|
+
|
|
10821
|
+
_proto.getTimeouts = function getTimeouts() {
|
|
10822
|
+
var timeout = this.props.timeout;
|
|
10823
|
+
var exit, enter, appear;
|
|
10824
|
+
exit = enter = appear = timeout;
|
|
10825
|
+
|
|
10826
|
+
if (timeout != null && typeof timeout !== 'number') {
|
|
10827
|
+
exit = timeout.exit;
|
|
10828
|
+
enter = timeout.enter; // TODO: remove fallback for next major
|
|
10829
|
+
|
|
10830
|
+
appear = timeout.appear !== undefined ? timeout.appear : enter;
|
|
10831
|
+
}
|
|
10832
|
+
|
|
10833
|
+
return {
|
|
10834
|
+
exit: exit,
|
|
10835
|
+
enter: enter,
|
|
10836
|
+
appear: appear
|
|
10837
|
+
};
|
|
10838
|
+
};
|
|
10839
|
+
|
|
10840
|
+
_proto.updateStatus = function updateStatus(mounting, nextStatus) {
|
|
10841
|
+
if (mounting === void 0) {
|
|
10842
|
+
mounting = false;
|
|
10843
|
+
}
|
|
10844
|
+
|
|
10845
|
+
if (nextStatus !== null) {
|
|
10846
|
+
// nextStatus will always be ENTERING or EXITING.
|
|
10847
|
+
this.cancelNextCallback();
|
|
10848
|
+
|
|
10849
|
+
if (nextStatus === ENTERING) {
|
|
10850
|
+
if (this.props.unmountOnExit || this.props.mountOnEnter) {
|
|
10851
|
+
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this); // https://github.com/reactjs/react-transition-group/pull/749
|
|
10852
|
+
// With unmountOnExit or mountOnEnter, the enter animation should happen at the transition between `exited` and `entering`.
|
|
10853
|
+
// To make the animation happen, we have to separate each rendering and avoid being processed as batched.
|
|
10854
|
+
|
|
10855
|
+
if (node) forceReflow(node);
|
|
10856
|
+
}
|
|
10857
|
+
|
|
10858
|
+
this.performEnter(mounting);
|
|
10859
|
+
} else {
|
|
10860
|
+
this.performExit();
|
|
10861
|
+
}
|
|
10862
|
+
} else if (this.props.unmountOnExit && this.state.status === EXITED) {
|
|
10863
|
+
this.setState({
|
|
10864
|
+
status: UNMOUNTED
|
|
10865
|
+
});
|
|
10866
|
+
}
|
|
10867
|
+
};
|
|
10868
|
+
|
|
10869
|
+
_proto.performEnter = function performEnter(mounting) {
|
|
10870
|
+
var _this2 = this;
|
|
10871
|
+
|
|
10872
|
+
var enter = this.props.enter;
|
|
10873
|
+
var appearing = this.context ? this.context.isMounting : mounting;
|
|
10874
|
+
|
|
10875
|
+
var _ref2 = this.props.nodeRef ? [appearing] : [ReactDOM.findDOMNode(this), appearing],
|
|
10876
|
+
maybeNode = _ref2[0],
|
|
10877
|
+
maybeAppearing = _ref2[1];
|
|
10878
|
+
|
|
10879
|
+
var timeouts = this.getTimeouts();
|
|
10880
|
+
var enterTimeout = appearing ? timeouts.appear : timeouts.enter; // no enter animation skip right to ENTERED
|
|
10881
|
+
// if we are mounting and running this it means appear _must_ be set
|
|
10882
|
+
|
|
10883
|
+
if (!mounting && !enter || config.disabled) {
|
|
10884
|
+
this.safeSetState({
|
|
10885
|
+
status: ENTERED
|
|
10886
|
+
}, function () {
|
|
10887
|
+
_this2.props.onEntered(maybeNode);
|
|
10888
|
+
});
|
|
10889
|
+
return;
|
|
10890
|
+
}
|
|
10891
|
+
|
|
10892
|
+
this.props.onEnter(maybeNode, maybeAppearing);
|
|
10893
|
+
this.safeSetState({
|
|
10894
|
+
status: ENTERING
|
|
10895
|
+
}, function () {
|
|
10896
|
+
_this2.props.onEntering(maybeNode, maybeAppearing);
|
|
10897
|
+
|
|
10898
|
+
_this2.onTransitionEnd(enterTimeout, function () {
|
|
10899
|
+
_this2.safeSetState({
|
|
10900
|
+
status: ENTERED
|
|
10901
|
+
}, function () {
|
|
10902
|
+
_this2.props.onEntered(maybeNode, maybeAppearing);
|
|
10903
|
+
});
|
|
10904
|
+
});
|
|
10905
|
+
});
|
|
10906
|
+
};
|
|
10907
|
+
|
|
10908
|
+
_proto.performExit = function performExit() {
|
|
10909
|
+
var _this3 = this;
|
|
10910
|
+
|
|
10911
|
+
var exit = this.props.exit;
|
|
10912
|
+
var timeouts = this.getTimeouts();
|
|
10913
|
+
var maybeNode = this.props.nodeRef ? undefined : ReactDOM.findDOMNode(this); // no exit animation skip right to EXITED
|
|
10914
|
+
|
|
10915
|
+
if (!exit || config.disabled) {
|
|
10916
|
+
this.safeSetState({
|
|
10917
|
+
status: EXITED
|
|
10918
|
+
}, function () {
|
|
10919
|
+
_this3.props.onExited(maybeNode);
|
|
10920
|
+
});
|
|
10921
|
+
return;
|
|
10922
|
+
}
|
|
10923
|
+
|
|
10924
|
+
this.props.onExit(maybeNode);
|
|
10925
|
+
this.safeSetState({
|
|
10926
|
+
status: EXITING
|
|
10927
|
+
}, function () {
|
|
10928
|
+
_this3.props.onExiting(maybeNode);
|
|
10929
|
+
|
|
10930
|
+
_this3.onTransitionEnd(timeouts.exit, function () {
|
|
10931
|
+
_this3.safeSetState({
|
|
10932
|
+
status: EXITED
|
|
10933
|
+
}, function () {
|
|
10934
|
+
_this3.props.onExited(maybeNode);
|
|
10935
|
+
});
|
|
10936
|
+
});
|
|
10937
|
+
});
|
|
10938
|
+
};
|
|
10939
|
+
|
|
10940
|
+
_proto.cancelNextCallback = function cancelNextCallback() {
|
|
10941
|
+
if (this.nextCallback !== null) {
|
|
10942
|
+
this.nextCallback.cancel();
|
|
10943
|
+
this.nextCallback = null;
|
|
10944
|
+
}
|
|
10945
|
+
};
|
|
10946
|
+
|
|
10947
|
+
_proto.safeSetState = function safeSetState(nextState, callback) {
|
|
10948
|
+
// This shouldn't be necessary, but there are weird race conditions with
|
|
10949
|
+
// setState callbacks and unmounting in testing, so always make sure that
|
|
10950
|
+
// we can cancel any pending setState callbacks after we unmount.
|
|
10951
|
+
callback = this.setNextCallback(callback);
|
|
10952
|
+
this.setState(nextState, callback);
|
|
10953
|
+
};
|
|
10954
|
+
|
|
10955
|
+
_proto.setNextCallback = function setNextCallback(callback) {
|
|
10956
|
+
var _this4 = this;
|
|
10957
|
+
|
|
10958
|
+
var active = true;
|
|
10959
|
+
|
|
10960
|
+
this.nextCallback = function (event) {
|
|
10961
|
+
if (active) {
|
|
10962
|
+
active = false;
|
|
10963
|
+
_this4.nextCallback = null;
|
|
10964
|
+
callback(event);
|
|
10965
|
+
}
|
|
10966
|
+
};
|
|
10967
|
+
|
|
10968
|
+
this.nextCallback.cancel = function () {
|
|
10969
|
+
active = false;
|
|
10970
|
+
};
|
|
10971
|
+
|
|
10972
|
+
return this.nextCallback;
|
|
10973
|
+
};
|
|
10974
|
+
|
|
10975
|
+
_proto.onTransitionEnd = function onTransitionEnd(timeout, handler) {
|
|
10976
|
+
this.setNextCallback(handler);
|
|
10977
|
+
var node = this.props.nodeRef ? this.props.nodeRef.current : ReactDOM.findDOMNode(this);
|
|
10978
|
+
var doesNotHaveTimeoutOrListener = timeout == null && !this.props.addEndListener;
|
|
10979
|
+
|
|
10980
|
+
if (!node || doesNotHaveTimeoutOrListener) {
|
|
10981
|
+
setTimeout(this.nextCallback, 0);
|
|
10982
|
+
return;
|
|
10983
|
+
}
|
|
10984
|
+
|
|
10985
|
+
if (this.props.addEndListener) {
|
|
10986
|
+
var _ref3 = this.props.nodeRef ? [this.nextCallback] : [node, this.nextCallback],
|
|
10987
|
+
maybeNode = _ref3[0],
|
|
10988
|
+
maybeNextCallback = _ref3[1];
|
|
10989
|
+
|
|
10990
|
+
this.props.addEndListener(maybeNode, maybeNextCallback);
|
|
10991
|
+
}
|
|
10992
|
+
|
|
10993
|
+
if (timeout != null) {
|
|
10994
|
+
setTimeout(this.nextCallback, timeout);
|
|
10995
|
+
}
|
|
10996
|
+
};
|
|
10997
|
+
|
|
10998
|
+
_proto.render = function render() {
|
|
10999
|
+
var status = this.state.status;
|
|
11000
|
+
|
|
11001
|
+
if (status === UNMOUNTED) {
|
|
11002
|
+
return null;
|
|
11003
|
+
}
|
|
11004
|
+
|
|
11005
|
+
var _this$props = this.props,
|
|
11006
|
+
children = _this$props.children;
|
|
11007
|
+
_this$props.in;
|
|
11008
|
+
_this$props.mountOnEnter;
|
|
11009
|
+
_this$props.unmountOnExit;
|
|
11010
|
+
_this$props.appear;
|
|
11011
|
+
_this$props.enter;
|
|
11012
|
+
_this$props.exit;
|
|
11013
|
+
_this$props.timeout;
|
|
11014
|
+
_this$props.addEndListener;
|
|
11015
|
+
_this$props.onEnter;
|
|
11016
|
+
_this$props.onEntering;
|
|
11017
|
+
_this$props.onEntered;
|
|
11018
|
+
_this$props.onExit;
|
|
11019
|
+
_this$props.onExiting;
|
|
11020
|
+
_this$props.onExited;
|
|
11021
|
+
_this$props.nodeRef;
|
|
11022
|
+
var childProps = _objectWithoutPropertiesLoose(_this$props, ["children", "in", "mountOnEnter", "unmountOnExit", "appear", "enter", "exit", "timeout", "addEndListener", "onEnter", "onEntering", "onEntered", "onExit", "onExiting", "onExited", "nodeRef"]);
|
|
11023
|
+
|
|
11024
|
+
return (
|
|
11025
|
+
/*#__PURE__*/
|
|
11026
|
+
// allows for nested Transitions
|
|
11027
|
+
React.createElement(TransitionGroupContext.Provider, {
|
|
11028
|
+
value: null
|
|
11029
|
+
}, typeof children === 'function' ? children(status, childProps) : React.cloneElement(React.Children.only(children), childProps))
|
|
11030
|
+
);
|
|
11031
|
+
};
|
|
11032
|
+
|
|
11033
|
+
return Transition;
|
|
11034
|
+
}(React.Component);
|
|
11035
|
+
|
|
11036
|
+
Transition.contextType = TransitionGroupContext;
|
|
11037
|
+
Transition.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
11038
|
+
/**
|
|
11039
|
+
* A React reference to DOM element that need to transition:
|
|
11040
|
+
* https://stackoverflow.com/a/51127130/4671932
|
|
11041
|
+
*
|
|
11042
|
+
* - When `nodeRef` prop is used, `node` is not passed to callback functions
|
|
11043
|
+
* (e.g. `onEnter`) because user already has direct access to the node.
|
|
11044
|
+
* - When changing `key` prop of `Transition` in a `TransitionGroup` a new
|
|
11045
|
+
* `nodeRef` need to be provided to `Transition` with changed `key` prop
|
|
11046
|
+
* (see
|
|
11047
|
+
* [test/CSSTransition-test.js](https://github.com/reactjs/react-transition-group/blob/13435f897b3ab71f6e19d724f145596f5910581c/test/CSSTransition-test.js#L362-L437)).
|
|
11048
|
+
*/
|
|
11049
|
+
nodeRef: propTypes.exports.shape({
|
|
11050
|
+
current: typeof Element === 'undefined' ? propTypes.exports.any : function (propValue, key, componentName, location, propFullName, secret) {
|
|
11051
|
+
var value = propValue[key];
|
|
11052
|
+
return propTypes.exports.instanceOf(value && 'ownerDocument' in value ? value.ownerDocument.defaultView.Element : Element)(propValue, key, componentName, location, propFullName, secret);
|
|
11053
|
+
}
|
|
11054
|
+
}),
|
|
11055
|
+
|
|
11056
|
+
/**
|
|
11057
|
+
* A `function` child can be used instead of a React element. This function is
|
|
11058
|
+
* called with the current transition status (`'entering'`, `'entered'`,
|
|
11059
|
+
* `'exiting'`, `'exited'`), which can be used to apply context
|
|
11060
|
+
* specific props to a component.
|
|
11061
|
+
*
|
|
11062
|
+
* ```jsx
|
|
11063
|
+
* <Transition in={this.state.in} timeout={150}>
|
|
11064
|
+
* {state => (
|
|
11065
|
+
* <MyComponent className={`fade fade-${state}`} />
|
|
11066
|
+
* )}
|
|
11067
|
+
* </Transition>
|
|
11068
|
+
* ```
|
|
11069
|
+
*/
|
|
11070
|
+
children: propTypes.exports.oneOfType([propTypes.exports.func.isRequired, propTypes.exports.element.isRequired]).isRequired,
|
|
11071
|
+
|
|
11072
|
+
/**
|
|
11073
|
+
* Show the component; triggers the enter or exit states
|
|
11074
|
+
*/
|
|
11075
|
+
in: propTypes.exports.bool,
|
|
11076
|
+
|
|
11077
|
+
/**
|
|
11078
|
+
* By default the child component is mounted immediately along with
|
|
11079
|
+
* the parent `Transition` component. If you want to "lazy mount" the component on the
|
|
11080
|
+
* first `in={true}` you can set `mountOnEnter`. After the first enter transition the component will stay
|
|
11081
|
+
* mounted, even on "exited", unless you also specify `unmountOnExit`.
|
|
11082
|
+
*/
|
|
11083
|
+
mountOnEnter: propTypes.exports.bool,
|
|
11084
|
+
|
|
11085
|
+
/**
|
|
11086
|
+
* By default the child component stays mounted after it reaches the `'exited'` state.
|
|
11087
|
+
* Set `unmountOnExit` if you'd prefer to unmount the component after it finishes exiting.
|
|
11088
|
+
*/
|
|
11089
|
+
unmountOnExit: propTypes.exports.bool,
|
|
11090
|
+
|
|
11091
|
+
/**
|
|
11092
|
+
* By default the child component does not perform the enter transition when
|
|
11093
|
+
* it first mounts, regardless of the value of `in`. If you want this
|
|
11094
|
+
* behavior, set both `appear` and `in` to `true`.
|
|
11095
|
+
*
|
|
11096
|
+
* > **Note**: there are no special appear states like `appearing`/`appeared`, this prop
|
|
11097
|
+
* > only adds an additional enter transition. However, in the
|
|
11098
|
+
* > `<CSSTransition>` component that first enter transition does result in
|
|
11099
|
+
* > additional `.appear-*` classes, that way you can choose to style it
|
|
11100
|
+
* > differently.
|
|
11101
|
+
*/
|
|
11102
|
+
appear: propTypes.exports.bool,
|
|
11103
|
+
|
|
11104
|
+
/**
|
|
11105
|
+
* Enable or disable enter transitions.
|
|
11106
|
+
*/
|
|
11107
|
+
enter: propTypes.exports.bool,
|
|
11108
|
+
|
|
11109
|
+
/**
|
|
11110
|
+
* Enable or disable exit transitions.
|
|
11111
|
+
*/
|
|
11112
|
+
exit: propTypes.exports.bool,
|
|
11113
|
+
|
|
11114
|
+
/**
|
|
11115
|
+
* The duration of the transition, in milliseconds.
|
|
11116
|
+
* Required unless `addEndListener` is provided.
|
|
11117
|
+
*
|
|
11118
|
+
* You may specify a single timeout for all transitions:
|
|
11119
|
+
*
|
|
11120
|
+
* ```jsx
|
|
11121
|
+
* timeout={500}
|
|
11122
|
+
* ```
|
|
11123
|
+
*
|
|
11124
|
+
* or individually:
|
|
11125
|
+
*
|
|
11126
|
+
* ```jsx
|
|
11127
|
+
* timeout={{
|
|
11128
|
+
* appear: 500,
|
|
11129
|
+
* enter: 300,
|
|
11130
|
+
* exit: 500,
|
|
11131
|
+
* }}
|
|
11132
|
+
* ```
|
|
11133
|
+
*
|
|
11134
|
+
* - `appear` defaults to the value of `enter`
|
|
11135
|
+
* - `enter` defaults to `0`
|
|
11136
|
+
* - `exit` defaults to `0`
|
|
11137
|
+
*
|
|
11138
|
+
* @type {number | { enter?: number, exit?: number, appear?: number }}
|
|
11139
|
+
*/
|
|
11140
|
+
timeout: function timeout(props) {
|
|
11141
|
+
var pt = timeoutsShape;
|
|
11142
|
+
if (!props.addEndListener) pt = pt.isRequired;
|
|
11143
|
+
|
|
11144
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
11145
|
+
args[_key - 1] = arguments[_key];
|
|
11146
|
+
}
|
|
11147
|
+
|
|
11148
|
+
return pt.apply(void 0, [props].concat(args));
|
|
11149
|
+
},
|
|
11150
|
+
|
|
11151
|
+
/**
|
|
11152
|
+
* Add a custom transition end trigger. Called with the transitioning
|
|
11153
|
+
* DOM node and a `done` callback. Allows for more fine grained transition end
|
|
11154
|
+
* logic. Timeouts are still used as a fallback if provided.
|
|
11155
|
+
*
|
|
11156
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11157
|
+
*
|
|
11158
|
+
* ```jsx
|
|
11159
|
+
* addEndListener={(node, done) => {
|
|
11160
|
+
* // use the css transitionend event to mark the finish of a transition
|
|
11161
|
+
* node.addEventListener('transitionend', done, false);
|
|
11162
|
+
* }}
|
|
11163
|
+
* ```
|
|
11164
|
+
*/
|
|
11165
|
+
addEndListener: propTypes.exports.func,
|
|
11166
|
+
|
|
11167
|
+
/**
|
|
11168
|
+
* Callback fired before the "entering" status is applied. An extra parameter
|
|
11169
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
11170
|
+
*
|
|
11171
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11172
|
+
*
|
|
11173
|
+
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
11174
|
+
*/
|
|
11175
|
+
onEnter: propTypes.exports.func,
|
|
11176
|
+
|
|
11177
|
+
/**
|
|
11178
|
+
* Callback fired after the "entering" status is applied. An extra parameter
|
|
11179
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
11180
|
+
*
|
|
11181
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11182
|
+
*
|
|
11183
|
+
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
11184
|
+
*/
|
|
11185
|
+
onEntering: propTypes.exports.func,
|
|
11186
|
+
|
|
11187
|
+
/**
|
|
11188
|
+
* Callback fired after the "entered" status is applied. An extra parameter
|
|
11189
|
+
* `isAppearing` is supplied to indicate if the enter stage is occurring on the initial mount
|
|
11190
|
+
*
|
|
11191
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11192
|
+
*
|
|
11193
|
+
* @type Function(node: HtmlElement, isAppearing: bool) -> void
|
|
11194
|
+
*/
|
|
11195
|
+
onEntered: propTypes.exports.func,
|
|
11196
|
+
|
|
11197
|
+
/**
|
|
11198
|
+
* Callback fired before the "exiting" status is applied.
|
|
11199
|
+
*
|
|
11200
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11201
|
+
*
|
|
11202
|
+
* @type Function(node: HtmlElement) -> void
|
|
11203
|
+
*/
|
|
11204
|
+
onExit: propTypes.exports.func,
|
|
11205
|
+
|
|
11206
|
+
/**
|
|
11207
|
+
* Callback fired after the "exiting" status is applied.
|
|
11208
|
+
*
|
|
11209
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11210
|
+
*
|
|
11211
|
+
* @type Function(node: HtmlElement) -> void
|
|
11212
|
+
*/
|
|
11213
|
+
onExiting: propTypes.exports.func,
|
|
11214
|
+
|
|
11215
|
+
/**
|
|
11216
|
+
* Callback fired after the "exited" status is applied.
|
|
11217
|
+
*
|
|
11218
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
11219
|
+
*
|
|
11220
|
+
* @type Function(node: HtmlElement) -> void
|
|
11221
|
+
*/
|
|
11222
|
+
onExited: propTypes.exports.func
|
|
11223
|
+
} : {}; // Name the function so it is clearer in the documentation
|
|
11224
|
+
|
|
11225
|
+
function noop() {}
|
|
11226
|
+
|
|
11227
|
+
Transition.defaultProps = {
|
|
11228
|
+
in: false,
|
|
11229
|
+
mountOnEnter: false,
|
|
11230
|
+
unmountOnExit: false,
|
|
11231
|
+
appear: false,
|
|
11232
|
+
enter: true,
|
|
11233
|
+
exit: true,
|
|
11234
|
+
onEnter: noop,
|
|
11235
|
+
onEntering: noop,
|
|
11236
|
+
onEntered: noop,
|
|
11237
|
+
onExit: noop,
|
|
11238
|
+
onExiting: noop,
|
|
11239
|
+
onExited: noop
|
|
11240
|
+
};
|
|
11241
|
+
Transition.UNMOUNTED = UNMOUNTED;
|
|
11242
|
+
Transition.EXITED = EXITED;
|
|
11243
|
+
Transition.ENTERING = ENTERING;
|
|
11244
|
+
Transition.ENTERED = ENTERED;
|
|
11245
|
+
Transition.EXITING = EXITING;
|
|
11246
|
+
|
|
11247
|
+
var _addClass = function addClass$1(node, classes) {
|
|
11248
|
+
return node && classes && classes.split(' ').forEach(function (c) {
|
|
11249
|
+
return addClass(node, c);
|
|
11250
|
+
});
|
|
11251
|
+
};
|
|
11252
|
+
|
|
11253
|
+
var removeClass = function removeClass(node, classes) {
|
|
11254
|
+
return node && classes && classes.split(' ').forEach(function (c) {
|
|
11255
|
+
return removeClass$1(node, c);
|
|
11256
|
+
});
|
|
11257
|
+
};
|
|
11258
|
+
/**
|
|
11259
|
+
* A transition component inspired by the excellent
|
|
11260
|
+
* [ng-animate](https://docs.angularjs.org/api/ngAnimate) library, you should
|
|
11261
|
+
* use it if you're using CSS transitions or animations. It's built upon the
|
|
11262
|
+
* [`Transition`](https://reactcommunity.org/react-transition-group/transition)
|
|
11263
|
+
* component, so it inherits all of its props.
|
|
11264
|
+
*
|
|
11265
|
+
* `CSSTransition` applies a pair of class names during the `appear`, `enter`,
|
|
11266
|
+
* and `exit` states of the transition. The first class is applied and then a
|
|
11267
|
+
* second `*-active` class in order to activate the CSS transition. After the
|
|
11268
|
+
* transition, matching `*-done` class names are applied to persist the
|
|
11269
|
+
* transition state.
|
|
11270
|
+
*
|
|
11271
|
+
* ```jsx
|
|
11272
|
+
* function App() {
|
|
11273
|
+
* const [inProp, setInProp] = useState(false);
|
|
11274
|
+
* return (
|
|
11275
|
+
* <div>
|
|
11276
|
+
* <CSSTransition in={inProp} timeout={200} classNames="my-node">
|
|
11277
|
+
* <div>
|
|
11278
|
+
* {"I'll receive my-node-* classes"}
|
|
11279
|
+
* </div>
|
|
11280
|
+
* </CSSTransition>
|
|
11281
|
+
* <button type="button" onClick={() => setInProp(true)}>
|
|
11282
|
+
* Click to Enter
|
|
11283
|
+
* </button>
|
|
11284
|
+
* </div>
|
|
11285
|
+
* );
|
|
11286
|
+
* }
|
|
11287
|
+
* ```
|
|
11288
|
+
*
|
|
11289
|
+
* When the `in` prop is set to `true`, the child component will first receive
|
|
11290
|
+
* the class `example-enter`, then the `example-enter-active` will be added in
|
|
11291
|
+
* the next tick. `CSSTransition` [forces a
|
|
11292
|
+
* reflow](https://github.com/reactjs/react-transition-group/blob/5007303e729a74be66a21c3e2205e4916821524b/src/CSSTransition.js#L208-L215)
|
|
11293
|
+
* between before adding the `example-enter-active`. This is an important trick
|
|
11294
|
+
* because it allows us to transition between `example-enter` and
|
|
11295
|
+
* `example-enter-active` even though they were added immediately one after
|
|
11296
|
+
* another. Most notably, this is what makes it possible for us to animate
|
|
11297
|
+
* _appearance_.
|
|
11298
|
+
*
|
|
11299
|
+
* ```css
|
|
11300
|
+
* .my-node-enter {
|
|
11301
|
+
* opacity: 0;
|
|
11302
|
+
* }
|
|
11303
|
+
* .my-node-enter-active {
|
|
11304
|
+
* opacity: 1;
|
|
11305
|
+
* transition: opacity 200ms;
|
|
11306
|
+
* }
|
|
11307
|
+
* .my-node-exit {
|
|
11308
|
+
* opacity: 1;
|
|
11309
|
+
* }
|
|
11310
|
+
* .my-node-exit-active {
|
|
11311
|
+
* opacity: 0;
|
|
11312
|
+
* transition: opacity 200ms;
|
|
11313
|
+
* }
|
|
11314
|
+
* ```
|
|
11315
|
+
*
|
|
11316
|
+
* `*-active` classes represent which styles you want to animate **to**, so it's
|
|
11317
|
+
* important to add `transition` declaration only to them, otherwise transitions
|
|
11318
|
+
* might not behave as intended! This might not be obvious when the transitions
|
|
11319
|
+
* are symmetrical, i.e. when `*-enter-active` is the same as `*-exit`, like in
|
|
11320
|
+
* the example above (minus `transition`), but it becomes apparent in more
|
|
11321
|
+
* complex transitions.
|
|
11322
|
+
*
|
|
11323
|
+
* **Note**: If you're using the
|
|
11324
|
+
* [`appear`](http://reactcommunity.org/react-transition-group/transition#Transition-prop-appear)
|
|
11325
|
+
* prop, make sure to define styles for `.appear-*` classes as well.
|
|
11326
|
+
*/
|
|
11327
|
+
|
|
11328
|
+
|
|
11329
|
+
var CSSTransition = /*#__PURE__*/function (_React$Component) {
|
|
11330
|
+
_inheritsLoose(CSSTransition, _React$Component);
|
|
11331
|
+
|
|
11332
|
+
function CSSTransition() {
|
|
11333
|
+
var _this;
|
|
11334
|
+
|
|
11335
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11336
|
+
args[_key] = arguments[_key];
|
|
11337
|
+
}
|
|
11338
|
+
|
|
11339
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
11340
|
+
_this.appliedClasses = {
|
|
11341
|
+
appear: {},
|
|
11342
|
+
enter: {},
|
|
11343
|
+
exit: {}
|
|
11344
|
+
};
|
|
11345
|
+
|
|
11346
|
+
_this.onEnter = function (maybeNode, maybeAppearing) {
|
|
11347
|
+
var _this$resolveArgument = _this.resolveArguments(maybeNode, maybeAppearing),
|
|
11348
|
+
node = _this$resolveArgument[0],
|
|
11349
|
+
appearing = _this$resolveArgument[1];
|
|
11350
|
+
|
|
11351
|
+
_this.removeClasses(node, 'exit');
|
|
11352
|
+
|
|
11353
|
+
_this.addClass(node, appearing ? 'appear' : 'enter', 'base');
|
|
11354
|
+
|
|
11355
|
+
if (_this.props.onEnter) {
|
|
11356
|
+
_this.props.onEnter(maybeNode, maybeAppearing);
|
|
11357
|
+
}
|
|
11358
|
+
};
|
|
11359
|
+
|
|
11360
|
+
_this.onEntering = function (maybeNode, maybeAppearing) {
|
|
11361
|
+
var _this$resolveArgument2 = _this.resolveArguments(maybeNode, maybeAppearing),
|
|
11362
|
+
node = _this$resolveArgument2[0],
|
|
11363
|
+
appearing = _this$resolveArgument2[1];
|
|
11364
|
+
|
|
11365
|
+
var type = appearing ? 'appear' : 'enter';
|
|
11366
|
+
|
|
11367
|
+
_this.addClass(node, type, 'active');
|
|
11368
|
+
|
|
11369
|
+
if (_this.props.onEntering) {
|
|
11370
|
+
_this.props.onEntering(maybeNode, maybeAppearing);
|
|
11371
|
+
}
|
|
11372
|
+
};
|
|
11373
|
+
|
|
11374
|
+
_this.onEntered = function (maybeNode, maybeAppearing) {
|
|
11375
|
+
var _this$resolveArgument3 = _this.resolveArguments(maybeNode, maybeAppearing),
|
|
11376
|
+
node = _this$resolveArgument3[0],
|
|
11377
|
+
appearing = _this$resolveArgument3[1];
|
|
11378
|
+
|
|
11379
|
+
var type = appearing ? 'appear' : 'enter';
|
|
11380
|
+
|
|
11381
|
+
_this.removeClasses(node, type);
|
|
11382
|
+
|
|
11383
|
+
_this.addClass(node, type, 'done');
|
|
11384
|
+
|
|
11385
|
+
if (_this.props.onEntered) {
|
|
11386
|
+
_this.props.onEntered(maybeNode, maybeAppearing);
|
|
11387
|
+
}
|
|
11388
|
+
};
|
|
11389
|
+
|
|
11390
|
+
_this.onExit = function (maybeNode) {
|
|
11391
|
+
var _this$resolveArgument4 = _this.resolveArguments(maybeNode),
|
|
11392
|
+
node = _this$resolveArgument4[0];
|
|
11393
|
+
|
|
11394
|
+
_this.removeClasses(node, 'appear');
|
|
11395
|
+
|
|
11396
|
+
_this.removeClasses(node, 'enter');
|
|
11397
|
+
|
|
11398
|
+
_this.addClass(node, 'exit', 'base');
|
|
11399
|
+
|
|
11400
|
+
if (_this.props.onExit) {
|
|
11401
|
+
_this.props.onExit(maybeNode);
|
|
11402
|
+
}
|
|
11403
|
+
};
|
|
11404
|
+
|
|
11405
|
+
_this.onExiting = function (maybeNode) {
|
|
11406
|
+
var _this$resolveArgument5 = _this.resolveArguments(maybeNode),
|
|
11407
|
+
node = _this$resolveArgument5[0];
|
|
11408
|
+
|
|
11409
|
+
_this.addClass(node, 'exit', 'active');
|
|
11410
|
+
|
|
11411
|
+
if (_this.props.onExiting) {
|
|
11412
|
+
_this.props.onExiting(maybeNode);
|
|
11413
|
+
}
|
|
11414
|
+
};
|
|
11415
|
+
|
|
11416
|
+
_this.onExited = function (maybeNode) {
|
|
11417
|
+
var _this$resolveArgument6 = _this.resolveArguments(maybeNode),
|
|
11418
|
+
node = _this$resolveArgument6[0];
|
|
11419
|
+
|
|
11420
|
+
_this.removeClasses(node, 'exit');
|
|
11421
|
+
|
|
11422
|
+
_this.addClass(node, 'exit', 'done');
|
|
11423
|
+
|
|
11424
|
+
if (_this.props.onExited) {
|
|
11425
|
+
_this.props.onExited(maybeNode);
|
|
11426
|
+
}
|
|
11427
|
+
};
|
|
11428
|
+
|
|
11429
|
+
_this.resolveArguments = function (maybeNode, maybeAppearing) {
|
|
11430
|
+
return _this.props.nodeRef ? [_this.props.nodeRef.current, maybeNode] // here `maybeNode` is actually `appearing`
|
|
11431
|
+
: [maybeNode, maybeAppearing];
|
|
11432
|
+
};
|
|
11433
|
+
|
|
11434
|
+
_this.getClassNames = function (type) {
|
|
11435
|
+
var classNames = _this.props.classNames;
|
|
11436
|
+
var isStringClassNames = typeof classNames === 'string';
|
|
11437
|
+
var prefix = isStringClassNames && classNames ? classNames + "-" : '';
|
|
11438
|
+
var baseClassName = isStringClassNames ? "" + prefix + type : classNames[type];
|
|
11439
|
+
var activeClassName = isStringClassNames ? baseClassName + "-active" : classNames[type + "Active"];
|
|
11440
|
+
var doneClassName = isStringClassNames ? baseClassName + "-done" : classNames[type + "Done"];
|
|
11441
|
+
return {
|
|
11442
|
+
baseClassName: baseClassName,
|
|
11443
|
+
activeClassName: activeClassName,
|
|
11444
|
+
doneClassName: doneClassName
|
|
11445
|
+
};
|
|
11446
|
+
};
|
|
11447
|
+
|
|
11448
|
+
return _this;
|
|
11449
|
+
}
|
|
11450
|
+
|
|
11451
|
+
var _proto = CSSTransition.prototype;
|
|
11452
|
+
|
|
11453
|
+
_proto.addClass = function addClass(node, type, phase) {
|
|
11454
|
+
var className = this.getClassNames(type)[phase + "ClassName"];
|
|
11455
|
+
|
|
11456
|
+
var _this$getClassNames = this.getClassNames('enter'),
|
|
11457
|
+
doneClassName = _this$getClassNames.doneClassName;
|
|
11458
|
+
|
|
11459
|
+
if (type === 'appear' && phase === 'done' && doneClassName) {
|
|
11460
|
+
className += " " + doneClassName;
|
|
11461
|
+
} // This is to force a repaint,
|
|
11462
|
+
// which is necessary in order to transition styles when adding a class name.
|
|
11463
|
+
|
|
11464
|
+
|
|
11465
|
+
if (phase === 'active') {
|
|
11466
|
+
if (node) forceReflow(node);
|
|
11467
|
+
}
|
|
11468
|
+
|
|
11469
|
+
if (className) {
|
|
11470
|
+
this.appliedClasses[type][phase] = className;
|
|
11471
|
+
|
|
11472
|
+
_addClass(node, className);
|
|
11473
|
+
}
|
|
11474
|
+
};
|
|
11475
|
+
|
|
11476
|
+
_proto.removeClasses = function removeClasses(node, type) {
|
|
11477
|
+
var _this$appliedClasses$ = this.appliedClasses[type],
|
|
11478
|
+
baseClassName = _this$appliedClasses$.base,
|
|
11479
|
+
activeClassName = _this$appliedClasses$.active,
|
|
11480
|
+
doneClassName = _this$appliedClasses$.done;
|
|
11481
|
+
this.appliedClasses[type] = {};
|
|
11482
|
+
|
|
11483
|
+
if (baseClassName) {
|
|
11484
|
+
removeClass(node, baseClassName);
|
|
11485
|
+
}
|
|
11486
|
+
|
|
11487
|
+
if (activeClassName) {
|
|
11488
|
+
removeClass(node, activeClassName);
|
|
11489
|
+
}
|
|
11490
|
+
|
|
11491
|
+
if (doneClassName) {
|
|
11492
|
+
removeClass(node, doneClassName);
|
|
11493
|
+
}
|
|
11494
|
+
};
|
|
11495
|
+
|
|
11496
|
+
_proto.render = function render() {
|
|
11497
|
+
var _this$props = this.props;
|
|
11498
|
+
_this$props.classNames;
|
|
11499
|
+
var props = _objectWithoutPropertiesLoose(_this$props, ["classNames"]);
|
|
11500
|
+
|
|
11501
|
+
return /*#__PURE__*/React.createElement(Transition, _extends$1({}, props, {
|
|
11502
|
+
onEnter: this.onEnter,
|
|
11503
|
+
onEntered: this.onEntered,
|
|
11504
|
+
onEntering: this.onEntering,
|
|
11505
|
+
onExit: this.onExit,
|
|
11506
|
+
onExiting: this.onExiting,
|
|
11507
|
+
onExited: this.onExited
|
|
11508
|
+
}));
|
|
11509
|
+
};
|
|
11510
|
+
|
|
11511
|
+
return CSSTransition;
|
|
11512
|
+
}(React.Component);
|
|
11513
|
+
|
|
11514
|
+
CSSTransition.defaultProps = {
|
|
11515
|
+
classNames: ''
|
|
11516
|
+
};
|
|
11517
|
+
CSSTransition.propTypes = process.env.NODE_ENV !== "production" ? _extends$1({}, Transition.propTypes, {
|
|
11518
|
+
/**
|
|
11519
|
+
* The animation classNames applied to the component as it appears, enters,
|
|
11520
|
+
* exits or has finished the transition. A single name can be provided, which
|
|
11521
|
+
* will be suffixed for each stage, e.g. `classNames="fade"` applies:
|
|
11522
|
+
*
|
|
11523
|
+
* - `fade-appear`, `fade-appear-active`, `fade-appear-done`
|
|
11524
|
+
* - `fade-enter`, `fade-enter-active`, `fade-enter-done`
|
|
11525
|
+
* - `fade-exit`, `fade-exit-active`, `fade-exit-done`
|
|
11526
|
+
*
|
|
11527
|
+
* A few details to note about how these classes are applied:
|
|
11528
|
+
*
|
|
11529
|
+
* 1. They are _joined_ with the ones that are already defined on the child
|
|
11530
|
+
* component, so if you want to add some base styles, you can use
|
|
11531
|
+
* `className` without worrying that it will be overridden.
|
|
11532
|
+
*
|
|
11533
|
+
* 2. If the transition component mounts with `in={false}`, no classes are
|
|
11534
|
+
* applied yet. You might be expecting `*-exit-done`, but if you think
|
|
11535
|
+
* about it, a component cannot finish exiting if it hasn't entered yet.
|
|
11536
|
+
*
|
|
11537
|
+
* 2. `fade-appear-done` and `fade-enter-done` will _both_ be applied. This
|
|
11538
|
+
* allows you to define different behavior for when appearing is done and
|
|
11539
|
+
* when regular entering is done, using selectors like
|
|
11540
|
+
* `.fade-enter-done:not(.fade-appear-done)`. For example, you could apply
|
|
11541
|
+
* an epic entrance animation when element first appears in the DOM using
|
|
11542
|
+
* [Animate.css](https://daneden.github.io/animate.css/). Otherwise you can
|
|
11543
|
+
* simply use `fade-enter-done` for defining both cases.
|
|
11544
|
+
*
|
|
11545
|
+
* Each individual classNames can also be specified independently like:
|
|
11546
|
+
*
|
|
11547
|
+
* ```js
|
|
11548
|
+
* classNames={{
|
|
11549
|
+
* appear: 'my-appear',
|
|
11550
|
+
* appearActive: 'my-active-appear',
|
|
11551
|
+
* appearDone: 'my-done-appear',
|
|
11552
|
+
* enter: 'my-enter',
|
|
11553
|
+
* enterActive: 'my-active-enter',
|
|
11554
|
+
* enterDone: 'my-done-enter',
|
|
11555
|
+
* exit: 'my-exit',
|
|
11556
|
+
* exitActive: 'my-active-exit',
|
|
11557
|
+
* exitDone: 'my-done-exit',
|
|
11558
|
+
* }}
|
|
11559
|
+
* ```
|
|
11560
|
+
*
|
|
11561
|
+
* If you want to set these classes using CSS Modules:
|
|
11562
|
+
*
|
|
11563
|
+
* ```js
|
|
11564
|
+
* import styles from './styles.css';
|
|
11565
|
+
* ```
|
|
11566
|
+
*
|
|
11567
|
+
* you might want to use camelCase in your CSS file, that way could simply
|
|
11568
|
+
* spread them instead of listing them one by one:
|
|
11569
|
+
*
|
|
11570
|
+
* ```js
|
|
11571
|
+
* classNames={{ ...styles }}
|
|
11572
|
+
* ```
|
|
11573
|
+
*
|
|
11574
|
+
* @type {string | {
|
|
11575
|
+
* appear?: string,
|
|
11576
|
+
* appearActive?: string,
|
|
11577
|
+
* appearDone?: string,
|
|
11578
|
+
* enter?: string,
|
|
11579
|
+
* enterActive?: string,
|
|
11580
|
+
* enterDone?: string,
|
|
11581
|
+
* exit?: string,
|
|
11582
|
+
* exitActive?: string,
|
|
11583
|
+
* exitDone?: string,
|
|
11584
|
+
* }}
|
|
11585
|
+
*/
|
|
11586
|
+
classNames: classNamesShape,
|
|
11587
|
+
|
|
11588
|
+
/**
|
|
11589
|
+
* A `<Transition>` callback fired immediately after the 'enter' or 'appear' class is
|
|
11590
|
+
* applied.
|
|
11591
|
+
*
|
|
11592
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11593
|
+
*
|
|
11594
|
+
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
11595
|
+
*/
|
|
11596
|
+
onEnter: propTypes.exports.func,
|
|
11597
|
+
|
|
11598
|
+
/**
|
|
11599
|
+
* A `<Transition>` callback fired immediately after the 'enter-active' or
|
|
11600
|
+
* 'appear-active' class is applied.
|
|
11601
|
+
*
|
|
11602
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11603
|
+
*
|
|
11604
|
+
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
11605
|
+
*/
|
|
11606
|
+
onEntering: propTypes.exports.func,
|
|
11607
|
+
|
|
11608
|
+
/**
|
|
11609
|
+
* A `<Transition>` callback fired immediately after the 'enter' or
|
|
11610
|
+
* 'appear' classes are **removed** and the `done` class is added to the DOM node.
|
|
11611
|
+
*
|
|
11612
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed.
|
|
11613
|
+
*
|
|
11614
|
+
* @type Function(node: HtmlElement, isAppearing: bool)
|
|
11615
|
+
*/
|
|
11616
|
+
onEntered: propTypes.exports.func,
|
|
11617
|
+
|
|
11618
|
+
/**
|
|
11619
|
+
* A `<Transition>` callback fired immediately after the 'exit' class is
|
|
11620
|
+
* applied.
|
|
11621
|
+
*
|
|
11622
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
11623
|
+
*
|
|
11624
|
+
* @type Function(node: HtmlElement)
|
|
11625
|
+
*/
|
|
11626
|
+
onExit: propTypes.exports.func,
|
|
11627
|
+
|
|
11628
|
+
/**
|
|
11629
|
+
* A `<Transition>` callback fired immediately after the 'exit-active' is applied.
|
|
11630
|
+
*
|
|
11631
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
11632
|
+
*
|
|
11633
|
+
* @type Function(node: HtmlElement)
|
|
11634
|
+
*/
|
|
11635
|
+
onExiting: propTypes.exports.func,
|
|
11636
|
+
|
|
11637
|
+
/**
|
|
11638
|
+
* A `<Transition>` callback fired immediately after the 'exit' classes
|
|
11639
|
+
* are **removed** and the `exit-done` class is added to the DOM node.
|
|
11640
|
+
*
|
|
11641
|
+
* **Note**: when `nodeRef` prop is passed, `node` is not passed
|
|
11642
|
+
*
|
|
11643
|
+
* @type Function(node: HtmlElement)
|
|
11644
|
+
*/
|
|
11645
|
+
onExited: propTypes.exports.func
|
|
11646
|
+
}) : {};
|
|
11647
|
+
|
|
11648
|
+
function _assertThisInitialized(self) {
|
|
11649
|
+
if (self === void 0) {
|
|
11650
|
+
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
11651
|
+
}
|
|
11652
|
+
return self;
|
|
11653
|
+
}
|
|
11654
|
+
|
|
11655
|
+
/**
|
|
11656
|
+
* Given `this.props.children`, return an object mapping key to child.
|
|
11657
|
+
*
|
|
11658
|
+
* @param {*} children `this.props.children`
|
|
11659
|
+
* @return {object} Mapping of key to child
|
|
11660
|
+
*/
|
|
11661
|
+
|
|
11662
|
+
function getChildMapping(children, mapFn) {
|
|
11663
|
+
var mapper = function mapper(child) {
|
|
11664
|
+
return mapFn && React.isValidElement(child) ? mapFn(child) : child;
|
|
11665
|
+
};
|
|
11666
|
+
|
|
11667
|
+
var result = Object.create(null);
|
|
11668
|
+
if (children) React.Children.map(children, function (c) {
|
|
11669
|
+
return c;
|
|
11670
|
+
}).forEach(function (child) {
|
|
11671
|
+
// run the map function here instead so that the key is the computed one
|
|
11672
|
+
result[child.key] = mapper(child);
|
|
11673
|
+
});
|
|
11674
|
+
return result;
|
|
11675
|
+
}
|
|
11676
|
+
/**
|
|
11677
|
+
* When you're adding or removing children some may be added or removed in the
|
|
11678
|
+
* same render pass. We want to show *both* since we want to simultaneously
|
|
11679
|
+
* animate elements in and out. This function takes a previous set of keys
|
|
11680
|
+
* and a new set of keys and merges them with its best guess of the correct
|
|
11681
|
+
* ordering. In the future we may expose some of the utilities in
|
|
11682
|
+
* ReactMultiChild to make this easy, but for now React itself does not
|
|
11683
|
+
* directly have this concept of the union of prevChildren and nextChildren
|
|
11684
|
+
* so we implement it here.
|
|
11685
|
+
*
|
|
11686
|
+
* @param {object} prev prev children as returned from
|
|
11687
|
+
* `ReactTransitionChildMapping.getChildMapping()`.
|
|
11688
|
+
* @param {object} next next children as returned from
|
|
11689
|
+
* `ReactTransitionChildMapping.getChildMapping()`.
|
|
11690
|
+
* @return {object} a key set that contains all keys in `prev` and all keys
|
|
11691
|
+
* in `next` in a reasonable order.
|
|
11692
|
+
*/
|
|
11693
|
+
|
|
11694
|
+
function mergeChildMappings(prev, next) {
|
|
11695
|
+
prev = prev || {};
|
|
11696
|
+
next = next || {};
|
|
11697
|
+
|
|
11698
|
+
function getValueForKey(key) {
|
|
11699
|
+
return key in next ? next[key] : prev[key];
|
|
11700
|
+
} // For each key of `next`, the list of keys to insert before that key in
|
|
11701
|
+
// the combined list
|
|
11702
|
+
|
|
11703
|
+
|
|
11704
|
+
var nextKeysPending = Object.create(null);
|
|
11705
|
+
var pendingKeys = [];
|
|
11706
|
+
|
|
11707
|
+
for (var prevKey in prev) {
|
|
11708
|
+
if (prevKey in next) {
|
|
11709
|
+
if (pendingKeys.length) {
|
|
11710
|
+
nextKeysPending[prevKey] = pendingKeys;
|
|
11711
|
+
pendingKeys = [];
|
|
11712
|
+
}
|
|
11713
|
+
} else {
|
|
11714
|
+
pendingKeys.push(prevKey);
|
|
11715
|
+
}
|
|
11716
|
+
}
|
|
11717
|
+
|
|
11718
|
+
var i;
|
|
11719
|
+
var childMapping = {};
|
|
11720
|
+
|
|
11721
|
+
for (var nextKey in next) {
|
|
11722
|
+
if (nextKeysPending[nextKey]) {
|
|
11723
|
+
for (i = 0; i < nextKeysPending[nextKey].length; i++) {
|
|
11724
|
+
var pendingNextKey = nextKeysPending[nextKey][i];
|
|
11725
|
+
childMapping[nextKeysPending[nextKey][i]] = getValueForKey(pendingNextKey);
|
|
11726
|
+
}
|
|
11727
|
+
}
|
|
11728
|
+
|
|
11729
|
+
childMapping[nextKey] = getValueForKey(nextKey);
|
|
11730
|
+
} // Finally, add the keys which didn't appear before any key in `next`
|
|
11731
|
+
|
|
11732
|
+
|
|
11733
|
+
for (i = 0; i < pendingKeys.length; i++) {
|
|
11734
|
+
childMapping[pendingKeys[i]] = getValueForKey(pendingKeys[i]);
|
|
11735
|
+
}
|
|
11736
|
+
|
|
11737
|
+
return childMapping;
|
|
11738
|
+
}
|
|
11739
|
+
|
|
11740
|
+
function getProp(child, prop, props) {
|
|
11741
|
+
return props[prop] != null ? props[prop] : child.props[prop];
|
|
11742
|
+
}
|
|
11743
|
+
|
|
11744
|
+
function getInitialChildMapping(props, onExited) {
|
|
11745
|
+
return getChildMapping(props.children, function (child) {
|
|
11746
|
+
return React.cloneElement(child, {
|
|
11747
|
+
onExited: onExited.bind(null, child),
|
|
11748
|
+
in: true,
|
|
11749
|
+
appear: getProp(child, 'appear', props),
|
|
11750
|
+
enter: getProp(child, 'enter', props),
|
|
11751
|
+
exit: getProp(child, 'exit', props)
|
|
11752
|
+
});
|
|
11753
|
+
});
|
|
11754
|
+
}
|
|
11755
|
+
function getNextChildMapping(nextProps, prevChildMapping, onExited) {
|
|
11756
|
+
var nextChildMapping = getChildMapping(nextProps.children);
|
|
11757
|
+
var children = mergeChildMappings(prevChildMapping, nextChildMapping);
|
|
11758
|
+
Object.keys(children).forEach(function (key) {
|
|
11759
|
+
var child = children[key];
|
|
11760
|
+
if (!React.isValidElement(child)) return;
|
|
11761
|
+
var hasPrev = (key in prevChildMapping);
|
|
11762
|
+
var hasNext = (key in nextChildMapping);
|
|
11763
|
+
var prevChild = prevChildMapping[key];
|
|
11764
|
+
var isLeaving = React.isValidElement(prevChild) && !prevChild.props.in; // item is new (entering)
|
|
11765
|
+
|
|
11766
|
+
if (hasNext && (!hasPrev || isLeaving)) {
|
|
11767
|
+
// console.log('entering', key)
|
|
11768
|
+
children[key] = React.cloneElement(child, {
|
|
11769
|
+
onExited: onExited.bind(null, child),
|
|
11770
|
+
in: true,
|
|
11771
|
+
exit: getProp(child, 'exit', nextProps),
|
|
11772
|
+
enter: getProp(child, 'enter', nextProps)
|
|
11773
|
+
});
|
|
11774
|
+
} else if (!hasNext && hasPrev && !isLeaving) {
|
|
11775
|
+
// item is old (exiting)
|
|
11776
|
+
// console.log('leaving', key)
|
|
11777
|
+
children[key] = React.cloneElement(child, {
|
|
11778
|
+
in: false
|
|
11779
|
+
});
|
|
11780
|
+
} else if (hasNext && hasPrev && React.isValidElement(prevChild)) {
|
|
11781
|
+
// item hasn't changed transition states
|
|
11782
|
+
// copy over the last transition props;
|
|
11783
|
+
// console.log('unchanged', key)
|
|
11784
|
+
children[key] = React.cloneElement(child, {
|
|
11785
|
+
onExited: onExited.bind(null, child),
|
|
11786
|
+
in: prevChild.props.in,
|
|
11787
|
+
exit: getProp(child, 'exit', nextProps),
|
|
11788
|
+
enter: getProp(child, 'enter', nextProps)
|
|
11789
|
+
});
|
|
11790
|
+
}
|
|
11791
|
+
});
|
|
11792
|
+
return children;
|
|
11793
|
+
}
|
|
11794
|
+
|
|
11795
|
+
var values = Object.values || function (obj) {
|
|
11796
|
+
return Object.keys(obj).map(function (k) {
|
|
11797
|
+
return obj[k];
|
|
11798
|
+
});
|
|
11799
|
+
};
|
|
11800
|
+
|
|
11801
|
+
var defaultProps = {
|
|
11802
|
+
component: 'div',
|
|
11803
|
+
childFactory: function childFactory(child) {
|
|
11804
|
+
return child;
|
|
11805
|
+
}
|
|
11806
|
+
};
|
|
11807
|
+
/**
|
|
11808
|
+
* The `<TransitionGroup>` component manages a set of transition components
|
|
11809
|
+
* (`<Transition>` and `<CSSTransition>`) in a list. Like with the transition
|
|
11810
|
+
* components, `<TransitionGroup>` is a state machine for managing the mounting
|
|
11811
|
+
* and unmounting of components over time.
|
|
11812
|
+
*
|
|
11813
|
+
* Consider the example below. As items are removed or added to the TodoList the
|
|
11814
|
+
* `in` prop is toggled automatically by the `<TransitionGroup>`.
|
|
11815
|
+
*
|
|
11816
|
+
* Note that `<TransitionGroup>` does not define any animation behavior!
|
|
11817
|
+
* Exactly _how_ a list item animates is up to the individual transition
|
|
11818
|
+
* component. This means you can mix and match animations across different list
|
|
11819
|
+
* items.
|
|
11820
|
+
*/
|
|
11821
|
+
|
|
11822
|
+
var TransitionGroup = /*#__PURE__*/function (_React$Component) {
|
|
11823
|
+
_inheritsLoose(TransitionGroup, _React$Component);
|
|
11824
|
+
|
|
11825
|
+
function TransitionGroup(props, context) {
|
|
11826
|
+
var _this;
|
|
11827
|
+
|
|
11828
|
+
_this = _React$Component.call(this, props, context) || this;
|
|
11829
|
+
|
|
11830
|
+
var handleExited = _this.handleExited.bind(_assertThisInitialized(_this)); // Initial children should all be entering, dependent on appear
|
|
11831
|
+
|
|
11832
|
+
|
|
11833
|
+
_this.state = {
|
|
11834
|
+
contextValue: {
|
|
11835
|
+
isMounting: true
|
|
11836
|
+
},
|
|
11837
|
+
handleExited: handleExited,
|
|
11838
|
+
firstRender: true
|
|
11839
|
+
};
|
|
11840
|
+
return _this;
|
|
11841
|
+
}
|
|
11842
|
+
|
|
11843
|
+
var _proto = TransitionGroup.prototype;
|
|
11844
|
+
|
|
11845
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
11846
|
+
this.mounted = true;
|
|
11847
|
+
this.setState({
|
|
11848
|
+
contextValue: {
|
|
11849
|
+
isMounting: false
|
|
11850
|
+
}
|
|
11851
|
+
});
|
|
11852
|
+
};
|
|
11853
|
+
|
|
11854
|
+
_proto.componentWillUnmount = function componentWillUnmount() {
|
|
11855
|
+
this.mounted = false;
|
|
11856
|
+
};
|
|
11857
|
+
|
|
11858
|
+
TransitionGroup.getDerivedStateFromProps = function getDerivedStateFromProps(nextProps, _ref) {
|
|
11859
|
+
var prevChildMapping = _ref.children,
|
|
11860
|
+
handleExited = _ref.handleExited,
|
|
11861
|
+
firstRender = _ref.firstRender;
|
|
11862
|
+
return {
|
|
11863
|
+
children: firstRender ? getInitialChildMapping(nextProps, handleExited) : getNextChildMapping(nextProps, prevChildMapping, handleExited),
|
|
11864
|
+
firstRender: false
|
|
11865
|
+
};
|
|
11866
|
+
} // node is `undefined` when user provided `nodeRef` prop
|
|
11867
|
+
;
|
|
11868
|
+
|
|
11869
|
+
_proto.handleExited = function handleExited(child, node) {
|
|
11870
|
+
var currentChildMapping = getChildMapping(this.props.children);
|
|
11871
|
+
if (child.key in currentChildMapping) return;
|
|
11872
|
+
|
|
11873
|
+
if (child.props.onExited) {
|
|
11874
|
+
child.props.onExited(node);
|
|
11875
|
+
}
|
|
11876
|
+
|
|
11877
|
+
if (this.mounted) {
|
|
11878
|
+
this.setState(function (state) {
|
|
11879
|
+
var children = _extends$1({}, state.children);
|
|
11880
|
+
|
|
11881
|
+
delete children[child.key];
|
|
11882
|
+
return {
|
|
11883
|
+
children: children
|
|
11884
|
+
};
|
|
11885
|
+
});
|
|
11886
|
+
}
|
|
11887
|
+
};
|
|
11888
|
+
|
|
11889
|
+
_proto.render = function render() {
|
|
11890
|
+
var _this$props = this.props,
|
|
11891
|
+
Component = _this$props.component,
|
|
11892
|
+
childFactory = _this$props.childFactory,
|
|
11893
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["component", "childFactory"]);
|
|
11894
|
+
|
|
11895
|
+
var contextValue = this.state.contextValue;
|
|
11896
|
+
var children = values(this.state.children).map(childFactory);
|
|
11897
|
+
delete props.appear;
|
|
11898
|
+
delete props.enter;
|
|
11899
|
+
delete props.exit;
|
|
11900
|
+
|
|
11901
|
+
if (Component === null) {
|
|
11902
|
+
return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
|
|
11903
|
+
value: contextValue
|
|
11904
|
+
}, children);
|
|
11905
|
+
}
|
|
11906
|
+
|
|
11907
|
+
return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
|
|
11908
|
+
value: contextValue
|
|
11909
|
+
}, /*#__PURE__*/React.createElement(Component, props, children));
|
|
11910
|
+
};
|
|
11911
|
+
|
|
11912
|
+
return TransitionGroup;
|
|
11913
|
+
}(React.Component);
|
|
11914
|
+
|
|
11915
|
+
TransitionGroup.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
11916
|
+
/**
|
|
11917
|
+
* `<TransitionGroup>` renders a `<div>` by default. You can change this
|
|
11918
|
+
* behavior by providing a `component` prop.
|
|
11919
|
+
* If you use React v16+ and would like to avoid a wrapping `<div>` element
|
|
11920
|
+
* you can pass in `component={null}`. This is useful if the wrapping div
|
|
11921
|
+
* borks your css styles.
|
|
11922
|
+
*/
|
|
11923
|
+
component: propTypes.exports.any,
|
|
11924
|
+
|
|
11925
|
+
/**
|
|
11926
|
+
* A set of `<Transition>` components, that are toggled `in` and out as they
|
|
11927
|
+
* leave. the `<TransitionGroup>` will inject specific transition props, so
|
|
11928
|
+
* remember to spread them through if you are wrapping the `<Transition>` as
|
|
11929
|
+
* with our `<Fade>` example.
|
|
11930
|
+
*
|
|
11931
|
+
* While this component is meant for multiple `Transition` or `CSSTransition`
|
|
11932
|
+
* children, sometimes you may want to have a single transition child with
|
|
11933
|
+
* content that you want to be transitioned out and in when you change it
|
|
11934
|
+
* (e.g. routes, images etc.) In that case you can change the `key` prop of
|
|
11935
|
+
* the transition child as you change its content, this will cause
|
|
11936
|
+
* `TransitionGroup` to transition the child out and back in.
|
|
11937
|
+
*/
|
|
11938
|
+
children: propTypes.exports.node,
|
|
11939
|
+
|
|
11940
|
+
/**
|
|
11941
|
+
* A convenience prop that enables or disables appear animations
|
|
11942
|
+
* for all children. Note that specifying this will override any defaults set
|
|
11943
|
+
* on individual children Transitions.
|
|
11944
|
+
*/
|
|
11945
|
+
appear: propTypes.exports.bool,
|
|
11946
|
+
|
|
11947
|
+
/**
|
|
11948
|
+
* A convenience prop that enables or disables enter animations
|
|
11949
|
+
* for all children. Note that specifying this will override any defaults set
|
|
11950
|
+
* on individual children Transitions.
|
|
11951
|
+
*/
|
|
11952
|
+
enter: propTypes.exports.bool,
|
|
11953
|
+
|
|
11954
|
+
/**
|
|
11955
|
+
* A convenience prop that enables or disables exit animations
|
|
11956
|
+
* for all children. Note that specifying this will override any defaults set
|
|
11957
|
+
* on individual children Transitions.
|
|
11958
|
+
*/
|
|
11959
|
+
exit: propTypes.exports.bool,
|
|
11960
|
+
|
|
11961
|
+
/**
|
|
11962
|
+
* You may need to apply reactive updates to a child as it is exiting.
|
|
11963
|
+
* This is generally done by using `cloneElement` however in the case of an exiting
|
|
11964
|
+
* child the element has already been removed and not accessible to the consumer.
|
|
11965
|
+
*
|
|
11966
|
+
* If you do need to update a child as it leaves you can provide a `childFactory`
|
|
11967
|
+
* to wrap every child, even the ones that are leaving.
|
|
11968
|
+
*
|
|
11969
|
+
* @type Function(child: ReactElement) -> ReactElement
|
|
11970
|
+
*/
|
|
11971
|
+
childFactory: propTypes.exports.func
|
|
11972
|
+
} : {};
|
|
11973
|
+
TransitionGroup.defaultProps = defaultProps;
|
|
11974
|
+
|
|
11975
|
+
/**
|
|
11976
|
+
* The `<ReplaceTransition>` component is a specialized `Transition` component
|
|
11977
|
+
* that animates between two children.
|
|
11978
|
+
*
|
|
11979
|
+
* ```jsx
|
|
11980
|
+
* <ReplaceTransition in>
|
|
11981
|
+
* <Fade><div>I appear first</div></Fade>
|
|
11982
|
+
* <Fade><div>I replace the above</div></Fade>
|
|
11983
|
+
* </ReplaceTransition>
|
|
11984
|
+
* ```
|
|
11985
|
+
*/
|
|
11986
|
+
|
|
11987
|
+
var ReplaceTransition = /*#__PURE__*/function (_React$Component) {
|
|
11988
|
+
_inheritsLoose(ReplaceTransition, _React$Component);
|
|
11989
|
+
|
|
11990
|
+
function ReplaceTransition() {
|
|
11991
|
+
var _this;
|
|
11992
|
+
|
|
11993
|
+
for (var _len = arguments.length, _args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
11994
|
+
_args[_key] = arguments[_key];
|
|
11995
|
+
}
|
|
11996
|
+
|
|
11997
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(_args)) || this;
|
|
11998
|
+
|
|
11999
|
+
_this.handleEnter = function () {
|
|
12000
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
12001
|
+
args[_key2] = arguments[_key2];
|
|
12002
|
+
}
|
|
12003
|
+
|
|
12004
|
+
return _this.handleLifecycle('onEnter', 0, args);
|
|
12005
|
+
};
|
|
12006
|
+
|
|
12007
|
+
_this.handleEntering = function () {
|
|
12008
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
|
12009
|
+
args[_key3] = arguments[_key3];
|
|
12010
|
+
}
|
|
12011
|
+
|
|
12012
|
+
return _this.handleLifecycle('onEntering', 0, args);
|
|
12013
|
+
};
|
|
12014
|
+
|
|
12015
|
+
_this.handleEntered = function () {
|
|
12016
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
|
12017
|
+
args[_key4] = arguments[_key4];
|
|
12018
|
+
}
|
|
12019
|
+
|
|
12020
|
+
return _this.handleLifecycle('onEntered', 0, args);
|
|
12021
|
+
};
|
|
12022
|
+
|
|
12023
|
+
_this.handleExit = function () {
|
|
12024
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
|
12025
|
+
args[_key5] = arguments[_key5];
|
|
12026
|
+
}
|
|
12027
|
+
|
|
12028
|
+
return _this.handleLifecycle('onExit', 1, args);
|
|
12029
|
+
};
|
|
12030
|
+
|
|
12031
|
+
_this.handleExiting = function () {
|
|
12032
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
|
12033
|
+
args[_key6] = arguments[_key6];
|
|
12034
|
+
}
|
|
12035
|
+
|
|
12036
|
+
return _this.handleLifecycle('onExiting', 1, args);
|
|
12037
|
+
};
|
|
12038
|
+
|
|
12039
|
+
_this.handleExited = function () {
|
|
12040
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
|
12041
|
+
args[_key7] = arguments[_key7];
|
|
12042
|
+
}
|
|
12043
|
+
|
|
12044
|
+
return _this.handleLifecycle('onExited', 1, args);
|
|
12045
|
+
};
|
|
12046
|
+
|
|
12047
|
+
return _this;
|
|
12048
|
+
}
|
|
12049
|
+
|
|
12050
|
+
var _proto = ReplaceTransition.prototype;
|
|
12051
|
+
|
|
12052
|
+
_proto.handleLifecycle = function handleLifecycle(handler, idx, originalArgs) {
|
|
12053
|
+
var _child$props;
|
|
12054
|
+
|
|
12055
|
+
var children = this.props.children;
|
|
12056
|
+
var child = React.Children.toArray(children)[idx];
|
|
12057
|
+
if (child.props[handler]) (_child$props = child.props)[handler].apply(_child$props, originalArgs);
|
|
12058
|
+
|
|
12059
|
+
if (this.props[handler]) {
|
|
12060
|
+
var maybeNode = child.props.nodeRef ? undefined : ReactDOM.findDOMNode(this);
|
|
12061
|
+
this.props[handler](maybeNode);
|
|
12062
|
+
}
|
|
12063
|
+
};
|
|
12064
|
+
|
|
12065
|
+
_proto.render = function render() {
|
|
12066
|
+
var _this$props = this.props,
|
|
12067
|
+
children = _this$props.children,
|
|
12068
|
+
inProp = _this$props.in,
|
|
12069
|
+
props = _objectWithoutPropertiesLoose(_this$props, ["children", "in"]);
|
|
12070
|
+
|
|
12071
|
+
var _React$Children$toArr = React.Children.toArray(children),
|
|
12072
|
+
first = _React$Children$toArr[0],
|
|
12073
|
+
second = _React$Children$toArr[1];
|
|
12074
|
+
|
|
12075
|
+
delete props.onEnter;
|
|
12076
|
+
delete props.onEntering;
|
|
12077
|
+
delete props.onEntered;
|
|
12078
|
+
delete props.onExit;
|
|
12079
|
+
delete props.onExiting;
|
|
12080
|
+
delete props.onExited;
|
|
12081
|
+
return /*#__PURE__*/React.createElement(TransitionGroup, props, inProp ? React.cloneElement(first, {
|
|
12082
|
+
key: 'first',
|
|
12083
|
+
onEnter: this.handleEnter,
|
|
12084
|
+
onEntering: this.handleEntering,
|
|
12085
|
+
onEntered: this.handleEntered
|
|
12086
|
+
}) : React.cloneElement(second, {
|
|
12087
|
+
key: 'second',
|
|
12088
|
+
onEnter: this.handleExit,
|
|
12089
|
+
onEntering: this.handleExiting,
|
|
12090
|
+
onEntered: this.handleExited
|
|
12091
|
+
}));
|
|
12092
|
+
};
|
|
12093
|
+
|
|
12094
|
+
return ReplaceTransition;
|
|
12095
|
+
}(React.Component);
|
|
12096
|
+
|
|
12097
|
+
ReplaceTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
12098
|
+
in: propTypes.exports.bool.isRequired,
|
|
12099
|
+
children: function children(props, propName) {
|
|
12100
|
+
if (React.Children.count(props[propName]) !== 2) return new Error("\"" + propName + "\" must be exactly two transition components.");
|
|
12101
|
+
return null;
|
|
12102
|
+
}
|
|
12103
|
+
} : {};
|
|
12104
|
+
|
|
12105
|
+
var _leaveRenders, _enterRenders;
|
|
12106
|
+
|
|
12107
|
+
function areChildrenDifferent(oldChildren, newChildren) {
|
|
12108
|
+
if (oldChildren === newChildren) return false;
|
|
12109
|
+
|
|
12110
|
+
if (React.isValidElement(oldChildren) && React.isValidElement(newChildren) && oldChildren.key != null && oldChildren.key === newChildren.key) {
|
|
12111
|
+
return false;
|
|
12112
|
+
}
|
|
12113
|
+
|
|
12114
|
+
return true;
|
|
12115
|
+
}
|
|
12116
|
+
/**
|
|
12117
|
+
* Enum of modes for SwitchTransition component
|
|
12118
|
+
* @enum { string }
|
|
12119
|
+
*/
|
|
12120
|
+
|
|
12121
|
+
|
|
12122
|
+
var modes = {
|
|
12123
|
+
out: 'out-in',
|
|
12124
|
+
in: 'in-out'
|
|
12125
|
+
};
|
|
12126
|
+
|
|
12127
|
+
var callHook = function callHook(element, name, cb) {
|
|
12128
|
+
return function () {
|
|
12129
|
+
var _element$props;
|
|
12130
|
+
|
|
12131
|
+
element.props[name] && (_element$props = element.props)[name].apply(_element$props, arguments);
|
|
12132
|
+
cb();
|
|
12133
|
+
};
|
|
12134
|
+
};
|
|
12135
|
+
|
|
12136
|
+
var leaveRenders = (_leaveRenders = {}, _leaveRenders[modes.out] = function (_ref) {
|
|
12137
|
+
var current = _ref.current,
|
|
12138
|
+
changeState = _ref.changeState;
|
|
12139
|
+
return React.cloneElement(current, {
|
|
12140
|
+
in: false,
|
|
12141
|
+
onExited: callHook(current, 'onExited', function () {
|
|
12142
|
+
changeState(ENTERING, null);
|
|
12143
|
+
})
|
|
12144
|
+
});
|
|
12145
|
+
}, _leaveRenders[modes.in] = function (_ref2) {
|
|
12146
|
+
var current = _ref2.current,
|
|
12147
|
+
changeState = _ref2.changeState,
|
|
12148
|
+
children = _ref2.children;
|
|
12149
|
+
return [current, React.cloneElement(children, {
|
|
12150
|
+
in: true,
|
|
12151
|
+
onEntered: callHook(children, 'onEntered', function () {
|
|
12152
|
+
changeState(ENTERING);
|
|
12153
|
+
})
|
|
12154
|
+
})];
|
|
12155
|
+
}, _leaveRenders);
|
|
12156
|
+
var enterRenders = (_enterRenders = {}, _enterRenders[modes.out] = function (_ref3) {
|
|
12157
|
+
var children = _ref3.children,
|
|
12158
|
+
changeState = _ref3.changeState;
|
|
12159
|
+
return React.cloneElement(children, {
|
|
12160
|
+
in: true,
|
|
12161
|
+
onEntered: callHook(children, 'onEntered', function () {
|
|
12162
|
+
changeState(ENTERED, React.cloneElement(children, {
|
|
12163
|
+
in: true
|
|
12164
|
+
}));
|
|
12165
|
+
})
|
|
12166
|
+
});
|
|
12167
|
+
}, _enterRenders[modes.in] = function (_ref4) {
|
|
12168
|
+
var current = _ref4.current,
|
|
12169
|
+
children = _ref4.children,
|
|
12170
|
+
changeState = _ref4.changeState;
|
|
12171
|
+
return [React.cloneElement(current, {
|
|
12172
|
+
in: false,
|
|
12173
|
+
onExited: callHook(current, 'onExited', function () {
|
|
12174
|
+
changeState(ENTERED, React.cloneElement(children, {
|
|
12175
|
+
in: true
|
|
12176
|
+
}));
|
|
12177
|
+
})
|
|
12178
|
+
}), React.cloneElement(children, {
|
|
12179
|
+
in: true
|
|
12180
|
+
})];
|
|
12181
|
+
}, _enterRenders);
|
|
12182
|
+
/**
|
|
12183
|
+
* A transition component inspired by the [vue transition modes](https://vuejs.org/v2/guide/transitions.html#Transition-Modes).
|
|
12184
|
+
* You can use it when you want to control the render between state transitions.
|
|
12185
|
+
* Based on the selected mode and the child's key which is the `Transition` or `CSSTransition` component, the `SwitchTransition` makes a consistent transition between them.
|
|
12186
|
+
*
|
|
12187
|
+
* If the `out-in` mode is selected, the `SwitchTransition` waits until the old child leaves and then inserts a new child.
|
|
12188
|
+
* If the `in-out` mode is selected, the `SwitchTransition` inserts a new child first, waits for the new child to enter and then removes the old child.
|
|
12189
|
+
*
|
|
12190
|
+
* **Note**: If you want the animation to happen simultaneously
|
|
12191
|
+
* (that is, to have the old child removed and a new child inserted **at the same time**),
|
|
12192
|
+
* you should use
|
|
12193
|
+
* [`TransitionGroup`](https://reactcommunity.org/react-transition-group/transition-group)
|
|
12194
|
+
* instead.
|
|
12195
|
+
*
|
|
12196
|
+
* ```jsx
|
|
12197
|
+
* function App() {
|
|
12198
|
+
* const [state, setState] = useState(false);
|
|
12199
|
+
* return (
|
|
12200
|
+
* <SwitchTransition>
|
|
12201
|
+
* <CSSTransition
|
|
12202
|
+
* key={state ? "Goodbye, world!" : "Hello, world!"}
|
|
12203
|
+
* addEndListener={(node, done) => node.addEventListener("transitionend", done, false)}
|
|
12204
|
+
* classNames='fade'
|
|
12205
|
+
* >
|
|
12206
|
+
* <button onClick={() => setState(state => !state)}>
|
|
12207
|
+
* {state ? "Goodbye, world!" : "Hello, world!"}
|
|
12208
|
+
* </button>
|
|
12209
|
+
* </CSSTransition>
|
|
12210
|
+
* </SwitchTransition>
|
|
12211
|
+
* );
|
|
12212
|
+
* }
|
|
12213
|
+
* ```
|
|
12214
|
+
*
|
|
12215
|
+
* ```css
|
|
12216
|
+
* .fade-enter{
|
|
12217
|
+
* opacity: 0;
|
|
12218
|
+
* }
|
|
12219
|
+
* .fade-exit{
|
|
12220
|
+
* opacity: 1;
|
|
12221
|
+
* }
|
|
12222
|
+
* .fade-enter-active{
|
|
12223
|
+
* opacity: 1;
|
|
12224
|
+
* }
|
|
12225
|
+
* .fade-exit-active{
|
|
12226
|
+
* opacity: 0;
|
|
12227
|
+
* }
|
|
12228
|
+
* .fade-enter-active,
|
|
12229
|
+
* .fade-exit-active{
|
|
12230
|
+
* transition: opacity 500ms;
|
|
12231
|
+
* }
|
|
12232
|
+
* ```
|
|
12233
|
+
*/
|
|
12234
|
+
|
|
12235
|
+
var SwitchTransition = /*#__PURE__*/function (_React$Component) {
|
|
12236
|
+
_inheritsLoose(SwitchTransition, _React$Component);
|
|
12237
|
+
|
|
12238
|
+
function SwitchTransition() {
|
|
12239
|
+
var _this;
|
|
12240
|
+
|
|
12241
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
12242
|
+
args[_key] = arguments[_key];
|
|
12243
|
+
}
|
|
12244
|
+
|
|
12245
|
+
_this = _React$Component.call.apply(_React$Component, [this].concat(args)) || this;
|
|
12246
|
+
_this.state = {
|
|
12247
|
+
status: ENTERED,
|
|
12248
|
+
current: null
|
|
12249
|
+
};
|
|
12250
|
+
_this.appeared = false;
|
|
12251
|
+
|
|
12252
|
+
_this.changeState = function (status, current) {
|
|
12253
|
+
if (current === void 0) {
|
|
12254
|
+
current = _this.state.current;
|
|
12255
|
+
}
|
|
12256
|
+
|
|
12257
|
+
_this.setState({
|
|
12258
|
+
status: status,
|
|
12259
|
+
current: current
|
|
12260
|
+
});
|
|
12261
|
+
};
|
|
12262
|
+
|
|
12263
|
+
return _this;
|
|
12264
|
+
}
|
|
12265
|
+
|
|
12266
|
+
var _proto = SwitchTransition.prototype;
|
|
12267
|
+
|
|
12268
|
+
_proto.componentDidMount = function componentDidMount() {
|
|
12269
|
+
this.appeared = true;
|
|
12270
|
+
};
|
|
12271
|
+
|
|
12272
|
+
SwitchTransition.getDerivedStateFromProps = function getDerivedStateFromProps(props, state) {
|
|
12273
|
+
if (props.children == null) {
|
|
12274
|
+
return {
|
|
12275
|
+
current: null
|
|
12276
|
+
};
|
|
12277
|
+
}
|
|
12278
|
+
|
|
12279
|
+
if (state.status === ENTERING && props.mode === modes.in) {
|
|
12280
|
+
return {
|
|
12281
|
+
status: ENTERING
|
|
12282
|
+
};
|
|
12283
|
+
}
|
|
12284
|
+
|
|
12285
|
+
if (state.current && areChildrenDifferent(state.current, props.children)) {
|
|
12286
|
+
return {
|
|
12287
|
+
status: EXITING
|
|
12288
|
+
};
|
|
12289
|
+
}
|
|
12290
|
+
|
|
12291
|
+
return {
|
|
12292
|
+
current: React.cloneElement(props.children, {
|
|
12293
|
+
in: true
|
|
12294
|
+
})
|
|
12295
|
+
};
|
|
12296
|
+
};
|
|
12297
|
+
|
|
12298
|
+
_proto.render = function render() {
|
|
12299
|
+
var _this$props = this.props,
|
|
12300
|
+
children = _this$props.children,
|
|
12301
|
+
mode = _this$props.mode,
|
|
12302
|
+
_this$state = this.state,
|
|
12303
|
+
status = _this$state.status,
|
|
12304
|
+
current = _this$state.current;
|
|
12305
|
+
var data = {
|
|
12306
|
+
children: children,
|
|
12307
|
+
current: current,
|
|
12308
|
+
changeState: this.changeState,
|
|
12309
|
+
status: status
|
|
12310
|
+
};
|
|
12311
|
+
var component;
|
|
12312
|
+
|
|
12313
|
+
switch (status) {
|
|
12314
|
+
case ENTERING:
|
|
12315
|
+
component = enterRenders[mode](data);
|
|
12316
|
+
break;
|
|
12317
|
+
|
|
12318
|
+
case EXITING:
|
|
12319
|
+
component = leaveRenders[mode](data);
|
|
12320
|
+
break;
|
|
12321
|
+
|
|
12322
|
+
case ENTERED:
|
|
12323
|
+
component = current;
|
|
12324
|
+
}
|
|
12325
|
+
|
|
12326
|
+
return /*#__PURE__*/React.createElement(TransitionGroupContext.Provider, {
|
|
12327
|
+
value: {
|
|
12328
|
+
isMounting: !this.appeared
|
|
12329
|
+
}
|
|
12330
|
+
}, component);
|
|
12331
|
+
};
|
|
12332
|
+
|
|
12333
|
+
return SwitchTransition;
|
|
12334
|
+
}(React.Component);
|
|
12335
|
+
|
|
12336
|
+
SwitchTransition.propTypes = process.env.NODE_ENV !== "production" ? {
|
|
12337
|
+
/**
|
|
12338
|
+
* Transition modes.
|
|
12339
|
+
* `out-in`: Current element transitions out first, then when complete, the new element transitions in.
|
|
12340
|
+
* `in-out`: New element transitions in first, then when complete, the current element transitions out.
|
|
12341
|
+
*
|
|
12342
|
+
* @type {'out-in'|'in-out'}
|
|
12343
|
+
*/
|
|
12344
|
+
mode: propTypes.exports.oneOf([modes.in, modes.out]),
|
|
12345
|
+
|
|
12346
|
+
/**
|
|
12347
|
+
* Any `Transition` or `CSSTransition` component.
|
|
12348
|
+
*/
|
|
12349
|
+
children: propTypes.exports.oneOfType([propTypes.exports.element.isRequired])
|
|
12350
|
+
} : {};
|
|
12351
|
+
SwitchTransition.defaultProps = {
|
|
12352
|
+
mode: modes.out
|
|
12353
|
+
};
|
|
12354
|
+
|
|
12355
|
+
function Ripple(props) {
|
|
12356
|
+
const {
|
|
12357
|
+
className,
|
|
12358
|
+
classes,
|
|
12359
|
+
pulsate = false,
|
|
12360
|
+
rippleX,
|
|
12361
|
+
rippleY,
|
|
12362
|
+
rippleSize,
|
|
12363
|
+
in: inProp,
|
|
12364
|
+
onExited,
|
|
12365
|
+
timeout
|
|
12366
|
+
} = props;
|
|
12367
|
+
const [leaving, setLeaving] = React__namespace.useState(false);
|
|
12368
|
+
const rippleClassName = clsx(className, classes.ripple, classes.rippleVisible, pulsate && classes.ripplePulsate);
|
|
12369
|
+
const rippleStyles = {
|
|
12370
|
+
width: rippleSize,
|
|
12371
|
+
height: rippleSize,
|
|
12372
|
+
top: -(rippleSize / 2) + rippleY,
|
|
12373
|
+
left: -(rippleSize / 2) + rippleX
|
|
12374
|
+
};
|
|
12375
|
+
const childClassName = clsx(classes.child, leaving && classes.childLeaving, pulsate && classes.childPulsate);
|
|
12376
|
+
if (!inProp && !leaving) {
|
|
12377
|
+
setLeaving(true);
|
|
12378
|
+
}
|
|
12379
|
+
React__namespace.useEffect(() => {
|
|
12380
|
+
if (!inProp && onExited != null) {
|
|
12381
|
+
// react-transition-group#onExited
|
|
12382
|
+
const timeoutId = setTimeout(onExited, timeout);
|
|
12383
|
+
return () => {
|
|
12384
|
+
clearTimeout(timeoutId);
|
|
12385
|
+
};
|
|
12386
|
+
}
|
|
12387
|
+
return undefined;
|
|
12388
|
+
}, [onExited, inProp, timeout]);
|
|
12389
|
+
return /*#__PURE__*/jsxRuntime.exports.jsx("span", {
|
|
12390
|
+
className: rippleClassName,
|
|
12391
|
+
style: rippleStyles,
|
|
12392
|
+
children: /*#__PURE__*/jsxRuntime.exports.jsx("span", {
|
|
12393
|
+
className: childClassName
|
|
12394
|
+
})
|
|
12395
|
+
});
|
|
12396
|
+
}
|
|
12397
|
+
process.env.NODE_ENV !== "production" ? Ripple.propTypes = {
|
|
12398
|
+
/**
|
|
12399
|
+
* Override or extend the styles applied to the component.
|
|
12400
|
+
* See [CSS API](#css) below for more details.
|
|
12401
|
+
*/
|
|
12402
|
+
classes: propTypes.exports.object.isRequired,
|
|
12403
|
+
className: propTypes.exports.string,
|
|
12404
|
+
/**
|
|
12405
|
+
* @ignore - injected from TransitionGroup
|
|
12406
|
+
*/
|
|
12407
|
+
in: propTypes.exports.bool,
|
|
12408
|
+
/**
|
|
12409
|
+
* @ignore - injected from TransitionGroup
|
|
12410
|
+
*/
|
|
12411
|
+
onExited: propTypes.exports.func,
|
|
12412
|
+
/**
|
|
12413
|
+
* If `true`, the ripple pulsates, typically indicating the keyboard focus state of an element.
|
|
12414
|
+
*/
|
|
12415
|
+
pulsate: propTypes.exports.bool,
|
|
12416
|
+
/**
|
|
12417
|
+
* Diameter of the ripple.
|
|
12418
|
+
*/
|
|
12419
|
+
rippleSize: propTypes.exports.number,
|
|
12420
|
+
/**
|
|
12421
|
+
* Horizontal position of the ripple center.
|
|
12422
|
+
*/
|
|
12423
|
+
rippleX: propTypes.exports.number,
|
|
12424
|
+
/**
|
|
12425
|
+
* Vertical position of the ripple center.
|
|
12426
|
+
*/
|
|
12427
|
+
rippleY: propTypes.exports.number,
|
|
12428
|
+
/**
|
|
12429
|
+
* exit delay
|
|
12430
|
+
*/
|
|
12431
|
+
timeout: propTypes.exports.number.isRequired
|
|
12432
|
+
} : void 0;
|
|
12433
|
+
|
|
12434
|
+
const touchRippleClasses = generateUtilityClasses('MuiTouchRipple', ['root', 'ripple', 'rippleVisible', 'ripplePulsate', 'child', 'childLeaving', 'childPulsate']);
|
|
12435
|
+
|
|
12436
|
+
const _excluded$2 = ["center", "classes", "className"];
|
|
12437
|
+
let _ = t => t,
|
|
12438
|
+
_t,
|
|
12439
|
+
_t2,
|
|
12440
|
+
_t3,
|
|
12441
|
+
_t4;
|
|
12442
|
+
const DURATION = 550;
|
|
12443
|
+
const DELAY_RIPPLE = 80;
|
|
12444
|
+
const enterKeyframe = keyframes(_t || (_t = _`
|
|
12445
|
+
0% {
|
|
12446
|
+
transform: scale(0);
|
|
12447
|
+
opacity: 0.1;
|
|
12448
|
+
}
|
|
12449
|
+
|
|
12450
|
+
100% {
|
|
12451
|
+
transform: scale(1);
|
|
12452
|
+
opacity: 0.3;
|
|
12453
|
+
}
|
|
12454
|
+
`));
|
|
12455
|
+
const exitKeyframe = keyframes(_t2 || (_t2 = _`
|
|
12456
|
+
0% {
|
|
12457
|
+
opacity: 1;
|
|
12458
|
+
}
|
|
12459
|
+
|
|
12460
|
+
100% {
|
|
12461
|
+
opacity: 0;
|
|
12462
|
+
}
|
|
12463
|
+
`));
|
|
12464
|
+
const pulsateKeyframe = keyframes(_t3 || (_t3 = _`
|
|
12465
|
+
0% {
|
|
12466
|
+
transform: scale(1);
|
|
12467
|
+
}
|
|
12468
|
+
|
|
12469
|
+
50% {
|
|
12470
|
+
transform: scale(0.92);
|
|
12471
|
+
}
|
|
12472
|
+
|
|
12473
|
+
100% {
|
|
12474
|
+
transform: scale(1);
|
|
12475
|
+
}
|
|
12476
|
+
`));
|
|
12477
|
+
const TouchRippleRoot = styled('span', {
|
|
12478
|
+
name: 'MuiTouchRipple',
|
|
12479
|
+
slot: 'Root'
|
|
12480
|
+
})({
|
|
12481
|
+
overflow: 'hidden',
|
|
12482
|
+
pointerEvents: 'none',
|
|
12483
|
+
position: 'absolute',
|
|
12484
|
+
zIndex: 0,
|
|
12485
|
+
top: 0,
|
|
12486
|
+
right: 0,
|
|
12487
|
+
bottom: 0,
|
|
12488
|
+
left: 0,
|
|
12489
|
+
borderRadius: 'inherit'
|
|
12490
|
+
});
|
|
12491
|
+
|
|
12492
|
+
// This `styled()` function invokes keyframes. `styled-components` only supports keyframes
|
|
12493
|
+
// in string templates. Do not convert these styles in JS object as it will break.
|
|
12494
|
+
const TouchRippleRipple = styled(Ripple, {
|
|
12495
|
+
name: 'MuiTouchRipple',
|
|
12496
|
+
slot: 'Ripple'
|
|
12497
|
+
})(_t4 || (_t4 = _`
|
|
12498
|
+
opacity: 0;
|
|
12499
|
+
position: absolute;
|
|
12500
|
+
|
|
12501
|
+
&.${0} {
|
|
12502
|
+
opacity: 0.3;
|
|
12503
|
+
transform: scale(1);
|
|
12504
|
+
animation-name: ${0};
|
|
12505
|
+
animation-duration: ${0}ms;
|
|
12506
|
+
animation-timing-function: ${0};
|
|
12507
|
+
}
|
|
12508
|
+
|
|
12509
|
+
&.${0} {
|
|
12510
|
+
animation-duration: ${0}ms;
|
|
12511
|
+
}
|
|
12512
|
+
|
|
12513
|
+
& .${0} {
|
|
12514
|
+
opacity: 1;
|
|
12515
|
+
display: block;
|
|
12516
|
+
width: 100%;
|
|
12517
|
+
height: 100%;
|
|
12518
|
+
border-radius: 50%;
|
|
12519
|
+
background-color: currentColor;
|
|
12520
|
+
}
|
|
12521
|
+
|
|
12522
|
+
& .${0} {
|
|
12523
|
+
opacity: 0;
|
|
12524
|
+
animation-name: ${0};
|
|
12525
|
+
animation-duration: ${0}ms;
|
|
12526
|
+
animation-timing-function: ${0};
|
|
12527
|
+
}
|
|
12528
|
+
|
|
12529
|
+
& .${0} {
|
|
12530
|
+
position: absolute;
|
|
12531
|
+
/* @noflip */
|
|
12532
|
+
left: 0px;
|
|
12533
|
+
top: 0;
|
|
12534
|
+
animation-name: ${0};
|
|
12535
|
+
animation-duration: 2500ms;
|
|
12536
|
+
animation-timing-function: ${0};
|
|
12537
|
+
animation-iteration-count: infinite;
|
|
12538
|
+
animation-delay: 200ms;
|
|
12539
|
+
}
|
|
12540
|
+
`), touchRippleClasses.rippleVisible, enterKeyframe, DURATION, ({
|
|
12541
|
+
theme
|
|
12542
|
+
}) => theme.transitions.easing.easeInOut, touchRippleClasses.ripplePulsate, ({
|
|
12543
|
+
theme
|
|
12544
|
+
}) => theme.transitions.duration.shorter, touchRippleClasses.child, touchRippleClasses.childLeaving, exitKeyframe, DURATION, ({
|
|
12545
|
+
theme
|
|
12546
|
+
}) => theme.transitions.easing.easeInOut, touchRippleClasses.childPulsate, pulsateKeyframe, ({
|
|
12547
|
+
theme
|
|
12548
|
+
}) => theme.transitions.easing.easeInOut);
|
|
12549
|
+
|
|
12550
|
+
/**
|
|
12551
|
+
* @ignore - internal component.
|
|
12552
|
+
*
|
|
12553
|
+
* TODO v5: Make private
|
|
12554
|
+
*/
|
|
12555
|
+
const TouchRipple = /*#__PURE__*/React__namespace.forwardRef(function TouchRipple(inProps, ref) {
|
|
12556
|
+
const props = useThemeProps({
|
|
12557
|
+
props: inProps,
|
|
12558
|
+
name: 'MuiTouchRipple'
|
|
12559
|
+
});
|
|
12560
|
+
const {
|
|
12561
|
+
center: centerProp = false,
|
|
12562
|
+
classes = {},
|
|
12563
|
+
className
|
|
12564
|
+
} = props,
|
|
12565
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$2);
|
|
12566
|
+
const [ripples, setRipples] = React__namespace.useState([]);
|
|
12567
|
+
const nextKey = React__namespace.useRef(0);
|
|
12568
|
+
const rippleCallback = React__namespace.useRef(null);
|
|
12569
|
+
React__namespace.useEffect(() => {
|
|
12570
|
+
if (rippleCallback.current) {
|
|
12571
|
+
rippleCallback.current();
|
|
12572
|
+
rippleCallback.current = null;
|
|
12573
|
+
}
|
|
12574
|
+
}, [ripples]);
|
|
12575
|
+
|
|
12576
|
+
// Used to filter out mouse emulated events on mobile.
|
|
12577
|
+
const ignoringMouseDown = React__namespace.useRef(false);
|
|
12578
|
+
// We use a timer in order to only show the ripples for touch "click" like events.
|
|
12579
|
+
// We don't want to display the ripple for touch scroll events.
|
|
12580
|
+
const startTimer = React__namespace.useRef(null);
|
|
12581
|
+
|
|
12582
|
+
// This is the hook called once the previous timeout is ready.
|
|
12583
|
+
const startTimerCommit = React__namespace.useRef(null);
|
|
12584
|
+
const container = React__namespace.useRef(null);
|
|
12585
|
+
React__namespace.useEffect(() => {
|
|
12586
|
+
return () => {
|
|
12587
|
+
clearTimeout(startTimer.current);
|
|
12588
|
+
};
|
|
12589
|
+
}, []);
|
|
12590
|
+
const startCommit = React__namespace.useCallback(params => {
|
|
12591
|
+
const {
|
|
12592
|
+
pulsate,
|
|
12593
|
+
rippleX,
|
|
12594
|
+
rippleY,
|
|
12595
|
+
rippleSize,
|
|
12596
|
+
cb
|
|
12597
|
+
} = params;
|
|
12598
|
+
setRipples(oldRipples => [...oldRipples, /*#__PURE__*/jsxRuntime.exports.jsx(TouchRippleRipple, {
|
|
12599
|
+
classes: {
|
|
12600
|
+
ripple: clsx(classes.ripple, touchRippleClasses.ripple),
|
|
12601
|
+
rippleVisible: clsx(classes.rippleVisible, touchRippleClasses.rippleVisible),
|
|
12602
|
+
ripplePulsate: clsx(classes.ripplePulsate, touchRippleClasses.ripplePulsate),
|
|
12603
|
+
child: clsx(classes.child, touchRippleClasses.child),
|
|
12604
|
+
childLeaving: clsx(classes.childLeaving, touchRippleClasses.childLeaving),
|
|
12605
|
+
childPulsate: clsx(classes.childPulsate, touchRippleClasses.childPulsate)
|
|
12606
|
+
},
|
|
12607
|
+
timeout: DURATION,
|
|
12608
|
+
pulsate: pulsate,
|
|
12609
|
+
rippleX: rippleX,
|
|
12610
|
+
rippleY: rippleY,
|
|
12611
|
+
rippleSize: rippleSize
|
|
12612
|
+
}, nextKey.current)]);
|
|
12613
|
+
nextKey.current += 1;
|
|
12614
|
+
rippleCallback.current = cb;
|
|
12615
|
+
}, [classes]);
|
|
12616
|
+
const start = React__namespace.useCallback((event = {}, options = {}, cb = () => {}) => {
|
|
12617
|
+
const {
|
|
12618
|
+
pulsate = false,
|
|
12619
|
+
center = centerProp || options.pulsate,
|
|
12620
|
+
fakeElement = false // For test purposes
|
|
12621
|
+
} = options;
|
|
12622
|
+
if ((event == null ? void 0 : event.type) === 'mousedown' && ignoringMouseDown.current) {
|
|
12623
|
+
ignoringMouseDown.current = false;
|
|
12624
|
+
return;
|
|
12625
|
+
}
|
|
12626
|
+
if ((event == null ? void 0 : event.type) === 'touchstart') {
|
|
12627
|
+
ignoringMouseDown.current = true;
|
|
12628
|
+
}
|
|
12629
|
+
const element = fakeElement ? null : container.current;
|
|
12630
|
+
const rect = element ? element.getBoundingClientRect() : {
|
|
12631
|
+
width: 0,
|
|
12632
|
+
height: 0,
|
|
12633
|
+
left: 0,
|
|
12634
|
+
top: 0
|
|
12635
|
+
};
|
|
12636
|
+
|
|
12637
|
+
// Get the size of the ripple
|
|
12638
|
+
let rippleX;
|
|
12639
|
+
let rippleY;
|
|
12640
|
+
let rippleSize;
|
|
12641
|
+
if (center || event === undefined || event.clientX === 0 && event.clientY === 0 || !event.clientX && !event.touches) {
|
|
12642
|
+
rippleX = Math.round(rect.width / 2);
|
|
12643
|
+
rippleY = Math.round(rect.height / 2);
|
|
12644
|
+
} else {
|
|
12645
|
+
const {
|
|
12646
|
+
clientX,
|
|
12647
|
+
clientY
|
|
12648
|
+
} = event.touches && event.touches.length > 0 ? event.touches[0] : event;
|
|
12649
|
+
rippleX = Math.round(clientX - rect.left);
|
|
12650
|
+
rippleY = Math.round(clientY - rect.top);
|
|
12651
|
+
}
|
|
12652
|
+
if (center) {
|
|
12653
|
+
rippleSize = Math.sqrt((2 * rect.width ** 2 + rect.height ** 2) / 3);
|
|
12654
|
+
|
|
12655
|
+
// For some reason the animation is broken on Mobile Chrome if the size is even.
|
|
12656
|
+
if (rippleSize % 2 === 0) {
|
|
12657
|
+
rippleSize += 1;
|
|
12658
|
+
}
|
|
12659
|
+
} else {
|
|
12660
|
+
const sizeX = Math.max(Math.abs((element ? element.clientWidth : 0) - rippleX), rippleX) * 2 + 2;
|
|
12661
|
+
const sizeY = Math.max(Math.abs((element ? element.clientHeight : 0) - rippleY), rippleY) * 2 + 2;
|
|
12662
|
+
rippleSize = Math.sqrt(sizeX ** 2 + sizeY ** 2);
|
|
12663
|
+
}
|
|
12664
|
+
|
|
12665
|
+
// Touche devices
|
|
12666
|
+
if (event != null && event.touches) {
|
|
12667
|
+
// check that this isn't another touchstart due to multitouch
|
|
12668
|
+
// otherwise we will only clear a single timer when unmounting while two
|
|
12669
|
+
// are running
|
|
12670
|
+
if (startTimerCommit.current === null) {
|
|
12671
|
+
// Prepare the ripple effect.
|
|
12672
|
+
startTimerCommit.current = () => {
|
|
12673
|
+
startCommit({
|
|
12674
|
+
pulsate,
|
|
12675
|
+
rippleX,
|
|
12676
|
+
rippleY,
|
|
12677
|
+
rippleSize,
|
|
12678
|
+
cb
|
|
12679
|
+
});
|
|
12680
|
+
};
|
|
12681
|
+
// Delay the execution of the ripple effect.
|
|
12682
|
+
startTimer.current = setTimeout(() => {
|
|
12683
|
+
if (startTimerCommit.current) {
|
|
12684
|
+
startTimerCommit.current();
|
|
12685
|
+
startTimerCommit.current = null;
|
|
12686
|
+
}
|
|
12687
|
+
}, DELAY_RIPPLE); // We have to make a tradeoff with this value.
|
|
12688
|
+
}
|
|
12689
|
+
} else {
|
|
12690
|
+
startCommit({
|
|
12691
|
+
pulsate,
|
|
12692
|
+
rippleX,
|
|
12693
|
+
rippleY,
|
|
12694
|
+
rippleSize,
|
|
12695
|
+
cb
|
|
12696
|
+
});
|
|
12697
|
+
}
|
|
12698
|
+
}, [centerProp, startCommit]);
|
|
12699
|
+
const pulsate = React__namespace.useCallback(() => {
|
|
12700
|
+
start({}, {
|
|
12701
|
+
pulsate: true
|
|
12702
|
+
});
|
|
12703
|
+
}, [start]);
|
|
12704
|
+
const stop = React__namespace.useCallback((event, cb) => {
|
|
12705
|
+
clearTimeout(startTimer.current);
|
|
12706
|
+
|
|
12707
|
+
// The touch interaction occurs too quickly.
|
|
12708
|
+
// We still want to show ripple effect.
|
|
12709
|
+
if ((event == null ? void 0 : event.type) === 'touchend' && startTimerCommit.current) {
|
|
12710
|
+
startTimerCommit.current();
|
|
12711
|
+
startTimerCommit.current = null;
|
|
12712
|
+
startTimer.current = setTimeout(() => {
|
|
12713
|
+
stop(event, cb);
|
|
12714
|
+
});
|
|
12715
|
+
return;
|
|
12716
|
+
}
|
|
12717
|
+
startTimerCommit.current = null;
|
|
12718
|
+
setRipples(oldRipples => {
|
|
12719
|
+
if (oldRipples.length > 0) {
|
|
12720
|
+
return oldRipples.slice(1);
|
|
12721
|
+
}
|
|
12722
|
+
return oldRipples;
|
|
12723
|
+
});
|
|
12724
|
+
rippleCallback.current = cb;
|
|
12725
|
+
}, []);
|
|
12726
|
+
React__namespace.useImperativeHandle(ref, () => ({
|
|
12727
|
+
pulsate,
|
|
12728
|
+
start,
|
|
12729
|
+
stop
|
|
12730
|
+
}), [pulsate, start, stop]);
|
|
12731
|
+
return /*#__PURE__*/jsxRuntime.exports.jsx(TouchRippleRoot, _extends$1({
|
|
12732
|
+
className: clsx(touchRippleClasses.root, classes.root, className),
|
|
12733
|
+
ref: container
|
|
12734
|
+
}, other, {
|
|
12735
|
+
children: /*#__PURE__*/jsxRuntime.exports.jsx(TransitionGroup, {
|
|
12736
|
+
component: null,
|
|
12737
|
+
exit: true,
|
|
12738
|
+
children: ripples
|
|
12739
|
+
})
|
|
12740
|
+
}));
|
|
12741
|
+
});
|
|
12742
|
+
process.env.NODE_ENV !== "production" ? TouchRipple.propTypes = {
|
|
12743
|
+
/**
|
|
12744
|
+
* If `true`, the ripple starts at the center of the component
|
|
12745
|
+
* rather than at the point of interaction.
|
|
12746
|
+
*/
|
|
12747
|
+
center: propTypes.exports.bool,
|
|
12748
|
+
/**
|
|
12749
|
+
* Override or extend the styles applied to the component.
|
|
12750
|
+
* See [CSS API](#css) below for more details.
|
|
12751
|
+
*/
|
|
12752
|
+
classes: propTypes.exports.object,
|
|
12753
|
+
/**
|
|
12754
|
+
* @ignore
|
|
12755
|
+
*/
|
|
12756
|
+
className: propTypes.exports.string
|
|
12757
|
+
} : void 0;
|
|
12758
|
+
|
|
12759
|
+
function getButtonBaseUtilityClass(slot) {
|
|
12760
|
+
return generateUtilityClass('MuiButtonBase', slot);
|
|
12761
|
+
}
|
|
12762
|
+
const buttonBaseClasses = generateUtilityClasses('MuiButtonBase', ['root', 'disabled', 'focusVisible']);
|
|
12763
|
+
|
|
12764
|
+
const _excluded$1 = ["action", "centerRipple", "children", "className", "component", "disabled", "disableRipple", "disableTouchRipple", "focusRipple", "focusVisibleClassName", "LinkComponent", "onBlur", "onClick", "onContextMenu", "onDragLeave", "onFocus", "onFocusVisible", "onKeyDown", "onKeyUp", "onMouseDown", "onMouseLeave", "onMouseUp", "onTouchEnd", "onTouchMove", "onTouchStart", "tabIndex", "TouchRippleProps", "touchRippleRef", "type"];
|
|
12765
|
+
const useUtilityClasses$1 = ownerState => {
|
|
12766
|
+
const {
|
|
12767
|
+
disabled,
|
|
12768
|
+
focusVisible,
|
|
12769
|
+
focusVisibleClassName,
|
|
12770
|
+
classes
|
|
12771
|
+
} = ownerState;
|
|
12772
|
+
const slots = {
|
|
12773
|
+
root: ['root', disabled && 'disabled', focusVisible && 'focusVisible']
|
|
12774
|
+
};
|
|
12775
|
+
const composedClasses = composeClasses(slots, getButtonBaseUtilityClass, classes);
|
|
12776
|
+
if (focusVisible && focusVisibleClassName) {
|
|
12777
|
+
composedClasses.root += ` ${focusVisibleClassName}`;
|
|
12778
|
+
}
|
|
12779
|
+
return composedClasses;
|
|
12780
|
+
};
|
|
12781
|
+
const ButtonBaseRoot = styled('button', {
|
|
12782
|
+
name: 'MuiButtonBase',
|
|
12783
|
+
slot: 'Root',
|
|
12784
|
+
overridesResolver: (props, styles) => styles.root
|
|
12785
|
+
})({
|
|
12786
|
+
display: 'inline-flex',
|
|
12787
|
+
alignItems: 'center',
|
|
12788
|
+
justifyContent: 'center',
|
|
12789
|
+
position: 'relative',
|
|
12790
|
+
boxSizing: 'border-box',
|
|
12791
|
+
WebkitTapHighlightColor: 'transparent',
|
|
12792
|
+
backgroundColor: 'transparent',
|
|
12793
|
+
// Reset default value
|
|
12794
|
+
// We disable the focus ring for mouse, touch and keyboard users.
|
|
12795
|
+
outline: 0,
|
|
12796
|
+
border: 0,
|
|
12797
|
+
margin: 0,
|
|
12798
|
+
// Remove the margin in Safari
|
|
12799
|
+
borderRadius: 0,
|
|
12800
|
+
padding: 0,
|
|
12801
|
+
// Remove the padding in Firefox
|
|
12802
|
+
cursor: 'pointer',
|
|
12803
|
+
userSelect: 'none',
|
|
12804
|
+
verticalAlign: 'middle',
|
|
12805
|
+
MozAppearance: 'none',
|
|
12806
|
+
// Reset
|
|
12807
|
+
WebkitAppearance: 'none',
|
|
12808
|
+
// Reset
|
|
12809
|
+
textDecoration: 'none',
|
|
12810
|
+
// So we take precedent over the style of a native <a /> element.
|
|
12811
|
+
color: 'inherit',
|
|
12812
|
+
'&::-moz-focus-inner': {
|
|
12813
|
+
borderStyle: 'none' // Remove Firefox dotted outline.
|
|
12814
|
+
},
|
|
12815
|
+
|
|
12816
|
+
[`&.${buttonBaseClasses.disabled}`]: {
|
|
12817
|
+
pointerEvents: 'none',
|
|
12818
|
+
// Disable link interactions
|
|
12819
|
+
cursor: 'default'
|
|
12820
|
+
},
|
|
12821
|
+
'@media print': {
|
|
12822
|
+
colorAdjust: 'exact'
|
|
12823
|
+
}
|
|
12824
|
+
});
|
|
12825
|
+
|
|
12826
|
+
/**
|
|
12827
|
+
* `ButtonBase` contains as few styles as possible.
|
|
12828
|
+
* It aims to be a simple building block for creating a button.
|
|
12829
|
+
* It contains a load of style reset and some focus/ripple logic.
|
|
12830
|
+
*/
|
|
12831
|
+
const ButtonBase = /*#__PURE__*/React__namespace.forwardRef(function ButtonBase(inProps, ref) {
|
|
12832
|
+
const props = useThemeProps({
|
|
12833
|
+
props: inProps,
|
|
12834
|
+
name: 'MuiButtonBase'
|
|
12835
|
+
});
|
|
12836
|
+
const {
|
|
12837
|
+
action,
|
|
12838
|
+
centerRipple = false,
|
|
12839
|
+
children,
|
|
12840
|
+
className,
|
|
12841
|
+
component = 'button',
|
|
12842
|
+
disabled = false,
|
|
12843
|
+
disableRipple = false,
|
|
12844
|
+
disableTouchRipple = false,
|
|
12845
|
+
focusRipple = false,
|
|
12846
|
+
LinkComponent = 'a',
|
|
12847
|
+
onBlur,
|
|
12848
|
+
onClick,
|
|
12849
|
+
onContextMenu,
|
|
12850
|
+
onDragLeave,
|
|
12851
|
+
onFocus,
|
|
12852
|
+
onFocusVisible,
|
|
12853
|
+
onKeyDown,
|
|
12854
|
+
onKeyUp,
|
|
12855
|
+
onMouseDown,
|
|
12856
|
+
onMouseLeave,
|
|
12857
|
+
onMouseUp,
|
|
12858
|
+
onTouchEnd,
|
|
12859
|
+
onTouchMove,
|
|
12860
|
+
onTouchStart,
|
|
12861
|
+
tabIndex = 0,
|
|
12862
|
+
TouchRippleProps,
|
|
12863
|
+
touchRippleRef,
|
|
12864
|
+
type
|
|
12865
|
+
} = props,
|
|
12866
|
+
other = _objectWithoutPropertiesLoose(props, _excluded$1);
|
|
12867
|
+
const buttonRef = React__namespace.useRef(null);
|
|
12868
|
+
const rippleRef = React__namespace.useRef(null);
|
|
12869
|
+
const handleRippleRef = useForkRef(rippleRef, touchRippleRef);
|
|
12870
|
+
const {
|
|
12871
|
+
isFocusVisibleRef,
|
|
12872
|
+
onFocus: handleFocusVisible,
|
|
12873
|
+
onBlur: handleBlurVisible,
|
|
12874
|
+
ref: focusVisibleRef
|
|
12875
|
+
} = useIsFocusVisible();
|
|
12876
|
+
const [focusVisible, setFocusVisible] = React__namespace.useState(false);
|
|
12877
|
+
if (disabled && focusVisible) {
|
|
12878
|
+
setFocusVisible(false);
|
|
12879
|
+
}
|
|
12880
|
+
React__namespace.useImperativeHandle(action, () => ({
|
|
12881
|
+
focusVisible: () => {
|
|
12882
|
+
setFocusVisible(true);
|
|
12883
|
+
buttonRef.current.focus();
|
|
12884
|
+
}
|
|
12885
|
+
}), []);
|
|
12886
|
+
const [mountedState, setMountedState] = React__namespace.useState(false);
|
|
12887
|
+
React__namespace.useEffect(() => {
|
|
12888
|
+
setMountedState(true);
|
|
12889
|
+
}, []);
|
|
12890
|
+
const enableTouchRipple = mountedState && !disableRipple && !disabled;
|
|
12891
|
+
React__namespace.useEffect(() => {
|
|
12892
|
+
if (focusVisible && focusRipple && !disableRipple && mountedState) {
|
|
12893
|
+
rippleRef.current.pulsate();
|
|
12894
|
+
}
|
|
12895
|
+
}, [disableRipple, focusRipple, focusVisible, mountedState]);
|
|
12896
|
+
function useRippleHandler(rippleAction, eventCallback, skipRippleAction = disableTouchRipple) {
|
|
12897
|
+
return useEventCallback(event => {
|
|
12898
|
+
if (eventCallback) {
|
|
12899
|
+
eventCallback(event);
|
|
12900
|
+
}
|
|
12901
|
+
const ignore = skipRippleAction;
|
|
12902
|
+
if (!ignore && rippleRef.current) {
|
|
12903
|
+
rippleRef.current[rippleAction](event);
|
|
12904
|
+
}
|
|
12905
|
+
return true;
|
|
12906
|
+
});
|
|
12907
|
+
}
|
|
12908
|
+
const handleMouseDown = useRippleHandler('start', onMouseDown);
|
|
12909
|
+
const handleContextMenu = useRippleHandler('stop', onContextMenu);
|
|
12910
|
+
const handleDragLeave = useRippleHandler('stop', onDragLeave);
|
|
12911
|
+
const handleMouseUp = useRippleHandler('stop', onMouseUp);
|
|
12912
|
+
const handleMouseLeave = useRippleHandler('stop', event => {
|
|
12913
|
+
if (focusVisible) {
|
|
12914
|
+
event.preventDefault();
|
|
12915
|
+
}
|
|
12916
|
+
if (onMouseLeave) {
|
|
12917
|
+
onMouseLeave(event);
|
|
12918
|
+
}
|
|
12919
|
+
});
|
|
12920
|
+
const handleTouchStart = useRippleHandler('start', onTouchStart);
|
|
12921
|
+
const handleTouchEnd = useRippleHandler('stop', onTouchEnd);
|
|
12922
|
+
const handleTouchMove = useRippleHandler('stop', onTouchMove);
|
|
12923
|
+
const handleBlur = useRippleHandler('stop', event => {
|
|
12924
|
+
handleBlurVisible(event);
|
|
12925
|
+
if (isFocusVisibleRef.current === false) {
|
|
12926
|
+
setFocusVisible(false);
|
|
12927
|
+
}
|
|
12928
|
+
if (onBlur) {
|
|
12929
|
+
onBlur(event);
|
|
12930
|
+
}
|
|
12931
|
+
}, false);
|
|
12932
|
+
const handleFocus = useEventCallback(event => {
|
|
12933
|
+
// Fix for https://github.com/facebook/react/issues/7769
|
|
12934
|
+
if (!buttonRef.current) {
|
|
12935
|
+
buttonRef.current = event.currentTarget;
|
|
12936
|
+
}
|
|
12937
|
+
handleFocusVisible(event);
|
|
12938
|
+
if (isFocusVisibleRef.current === true) {
|
|
12939
|
+
setFocusVisible(true);
|
|
12940
|
+
if (onFocusVisible) {
|
|
12941
|
+
onFocusVisible(event);
|
|
12942
|
+
}
|
|
12943
|
+
}
|
|
12944
|
+
if (onFocus) {
|
|
12945
|
+
onFocus(event);
|
|
12946
|
+
}
|
|
12947
|
+
});
|
|
12948
|
+
const isNonNativeButton = () => {
|
|
12949
|
+
const button = buttonRef.current;
|
|
12950
|
+
return component && component !== 'button' && !(button.tagName === 'A' && button.href);
|
|
12951
|
+
};
|
|
12952
|
+
|
|
12953
|
+
/**
|
|
12954
|
+
* IE11 shim for https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/repeat
|
|
12955
|
+
*/
|
|
12956
|
+
const keydownRef = React__namespace.useRef(false);
|
|
12957
|
+
const handleKeyDown = useEventCallback(event => {
|
|
12958
|
+
// Check if key is already down to avoid repeats being counted as multiple activations
|
|
12959
|
+
if (focusRipple && !keydownRef.current && focusVisible && rippleRef.current && event.key === ' ') {
|
|
12960
|
+
keydownRef.current = true;
|
|
12961
|
+
rippleRef.current.stop(event, () => {
|
|
12962
|
+
rippleRef.current.start(event);
|
|
12963
|
+
});
|
|
12964
|
+
}
|
|
12965
|
+
if (event.target === event.currentTarget && isNonNativeButton() && event.key === ' ') {
|
|
12966
|
+
event.preventDefault();
|
|
12967
|
+
}
|
|
12968
|
+
if (onKeyDown) {
|
|
12969
|
+
onKeyDown(event);
|
|
12970
|
+
}
|
|
12971
|
+
|
|
12972
|
+
// Keyboard accessibility for non interactive elements
|
|
12973
|
+
if (event.target === event.currentTarget && isNonNativeButton() && event.key === 'Enter' && !disabled) {
|
|
12974
|
+
event.preventDefault();
|
|
12975
|
+
if (onClick) {
|
|
12976
|
+
onClick(event);
|
|
12977
|
+
}
|
|
12978
|
+
}
|
|
12979
|
+
});
|
|
12980
|
+
const handleKeyUp = useEventCallback(event => {
|
|
12981
|
+
// calling preventDefault in keyUp on a <button> will not dispatch a click event if Space is pressed
|
|
12982
|
+
// https://codesandbox.io/s/button-keyup-preventdefault-dn7f0
|
|
12983
|
+
if (focusRipple && event.key === ' ' && rippleRef.current && focusVisible && !event.defaultPrevented) {
|
|
12984
|
+
keydownRef.current = false;
|
|
12985
|
+
rippleRef.current.stop(event, () => {
|
|
12986
|
+
rippleRef.current.pulsate(event);
|
|
12987
|
+
});
|
|
12988
|
+
}
|
|
12989
|
+
if (onKeyUp) {
|
|
12990
|
+
onKeyUp(event);
|
|
12991
|
+
}
|
|
12992
|
+
|
|
12993
|
+
// Keyboard accessibility for non interactive elements
|
|
12994
|
+
if (onClick && event.target === event.currentTarget && isNonNativeButton() && event.key === ' ' && !event.defaultPrevented) {
|
|
12995
|
+
onClick(event);
|
|
12996
|
+
}
|
|
12997
|
+
});
|
|
12998
|
+
let ComponentProp = component;
|
|
12999
|
+
if (ComponentProp === 'button' && (other.href || other.to)) {
|
|
13000
|
+
ComponentProp = LinkComponent;
|
|
13001
|
+
}
|
|
13002
|
+
const buttonProps = {};
|
|
13003
|
+
if (ComponentProp === 'button') {
|
|
13004
|
+
buttonProps.type = type === undefined ? 'button' : type;
|
|
13005
|
+
buttonProps.disabled = disabled;
|
|
13006
|
+
} else {
|
|
13007
|
+
if (!other.href && !other.to) {
|
|
13008
|
+
buttonProps.role = 'button';
|
|
13009
|
+
}
|
|
13010
|
+
if (disabled) {
|
|
13011
|
+
buttonProps['aria-disabled'] = disabled;
|
|
13012
|
+
}
|
|
13013
|
+
}
|
|
13014
|
+
const handleRef = useForkRef(ref, focusVisibleRef, buttonRef);
|
|
13015
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13016
|
+
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
13017
|
+
React__namespace.useEffect(() => {
|
|
13018
|
+
if (enableTouchRipple && !rippleRef.current) {
|
|
13019
|
+
console.error(['MUI: The `component` prop provided to ButtonBase is invalid.', 'Please make sure the children prop is rendered in this custom component.'].join('\n'));
|
|
13020
|
+
}
|
|
13021
|
+
}, [enableTouchRipple]);
|
|
13022
|
+
}
|
|
13023
|
+
const ownerState = _extends$1({}, props, {
|
|
13024
|
+
centerRipple,
|
|
13025
|
+
component,
|
|
13026
|
+
disabled,
|
|
13027
|
+
disableRipple,
|
|
13028
|
+
disableTouchRipple,
|
|
13029
|
+
focusRipple,
|
|
13030
|
+
tabIndex,
|
|
13031
|
+
focusVisible
|
|
13032
|
+
});
|
|
13033
|
+
const classes = useUtilityClasses$1(ownerState);
|
|
13034
|
+
return /*#__PURE__*/jsxRuntime.exports.jsxs(ButtonBaseRoot, _extends$1({
|
|
13035
|
+
as: ComponentProp,
|
|
13036
|
+
className: clsx(classes.root, className),
|
|
13037
|
+
ownerState: ownerState,
|
|
13038
|
+
onBlur: handleBlur,
|
|
13039
|
+
onClick: onClick,
|
|
13040
|
+
onContextMenu: handleContextMenu,
|
|
13041
|
+
onFocus: handleFocus,
|
|
13042
|
+
onKeyDown: handleKeyDown,
|
|
13043
|
+
onKeyUp: handleKeyUp,
|
|
13044
|
+
onMouseDown: handleMouseDown,
|
|
13045
|
+
onMouseLeave: handleMouseLeave,
|
|
13046
|
+
onMouseUp: handleMouseUp,
|
|
13047
|
+
onDragLeave: handleDragLeave,
|
|
13048
|
+
onTouchEnd: handleTouchEnd,
|
|
13049
|
+
onTouchMove: handleTouchMove,
|
|
13050
|
+
onTouchStart: handleTouchStart,
|
|
13051
|
+
ref: handleRef,
|
|
13052
|
+
tabIndex: disabled ? -1 : tabIndex,
|
|
13053
|
+
type: type
|
|
13054
|
+
}, buttonProps, other, {
|
|
13055
|
+
children: [children, enableTouchRipple ?
|
|
13056
|
+
/*#__PURE__*/
|
|
13057
|
+
/* TouchRipple is only needed client-side, x2 boost on the server. */
|
|
13058
|
+
jsxRuntime.exports.jsx(TouchRipple, _extends$1({
|
|
13059
|
+
ref: handleRippleRef,
|
|
13060
|
+
center: centerRipple
|
|
13061
|
+
}, TouchRippleProps)) : null]
|
|
13062
|
+
}));
|
|
13063
|
+
});
|
|
13064
|
+
process.env.NODE_ENV !== "production" ? ButtonBase.propTypes /* remove-proptypes */ = {
|
|
13065
|
+
// ----------------------------- Warning --------------------------------
|
|
13066
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
13067
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
13068
|
+
// ----------------------------------------------------------------------
|
|
13069
|
+
/**
|
|
13070
|
+
* A ref for imperative actions.
|
|
13071
|
+
* It currently only supports `focusVisible()` action.
|
|
13072
|
+
*/
|
|
13073
|
+
action: refType,
|
|
13074
|
+
/**
|
|
13075
|
+
* If `true`, the ripples are centered.
|
|
13076
|
+
* They won't start at the cursor interaction position.
|
|
13077
|
+
* @default false
|
|
13078
|
+
*/
|
|
13079
|
+
centerRipple: propTypes.exports.bool,
|
|
13080
|
+
/**
|
|
13081
|
+
* The content of the component.
|
|
13082
|
+
*/
|
|
13083
|
+
children: propTypes.exports.node,
|
|
13084
|
+
/**
|
|
13085
|
+
* Override or extend the styles applied to the component.
|
|
13086
|
+
*/
|
|
13087
|
+
classes: propTypes.exports.object,
|
|
13088
|
+
/**
|
|
13089
|
+
* @ignore
|
|
13090
|
+
*/
|
|
13091
|
+
className: propTypes.exports.string,
|
|
13092
|
+
/**
|
|
13093
|
+
* The component used for the root node.
|
|
13094
|
+
* Either a string to use a HTML element or a component.
|
|
13095
|
+
*/
|
|
13096
|
+
component: elementTypeAcceptingRef$1,
|
|
13097
|
+
/**
|
|
13098
|
+
* If `true`, the component is disabled.
|
|
13099
|
+
* @default false
|
|
13100
|
+
*/
|
|
13101
|
+
disabled: propTypes.exports.bool,
|
|
13102
|
+
/**
|
|
13103
|
+
* If `true`, the ripple effect is disabled.
|
|
13104
|
+
*
|
|
13105
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
13106
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
13107
|
+
* @default false
|
|
13108
|
+
*/
|
|
13109
|
+
disableRipple: propTypes.exports.bool,
|
|
13110
|
+
/**
|
|
13111
|
+
* If `true`, the touch ripple effect is disabled.
|
|
13112
|
+
* @default false
|
|
13113
|
+
*/
|
|
13114
|
+
disableTouchRipple: propTypes.exports.bool,
|
|
13115
|
+
/**
|
|
13116
|
+
* If `true`, the base button will have a keyboard focus ripple.
|
|
13117
|
+
* @default false
|
|
13118
|
+
*/
|
|
13119
|
+
focusRipple: propTypes.exports.bool,
|
|
13120
|
+
/**
|
|
13121
|
+
* This prop can help identify which element has keyboard focus.
|
|
13122
|
+
* The class name will be applied when the element gains the focus through keyboard interaction.
|
|
13123
|
+
* It's a polyfill for the [CSS :focus-visible selector](https://drafts.csswg.org/selectors-4/#the-focus-visible-pseudo).
|
|
13124
|
+
* The rationale for using this feature [is explained here](https://github.com/WICG/focus-visible/blob/HEAD/explainer.md).
|
|
13125
|
+
* A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
|
|
13126
|
+
* if needed.
|
|
13127
|
+
*/
|
|
13128
|
+
focusVisibleClassName: propTypes.exports.string,
|
|
13129
|
+
/**
|
|
13130
|
+
* @ignore
|
|
13131
|
+
*/
|
|
13132
|
+
href: propTypes.exports /* @typescript-to-proptypes-ignore */.any,
|
|
13133
|
+
/**
|
|
13134
|
+
* The component used to render a link when the `href` prop is provided.
|
|
13135
|
+
* @default 'a'
|
|
13136
|
+
*/
|
|
13137
|
+
LinkComponent: propTypes.exports.elementType,
|
|
13138
|
+
/**
|
|
13139
|
+
* @ignore
|
|
13140
|
+
*/
|
|
13141
|
+
onBlur: propTypes.exports.func,
|
|
13142
|
+
/**
|
|
13143
|
+
* @ignore
|
|
13144
|
+
*/
|
|
13145
|
+
onClick: propTypes.exports.func,
|
|
13146
|
+
/**
|
|
13147
|
+
* @ignore
|
|
13148
|
+
*/
|
|
13149
|
+
onContextMenu: propTypes.exports.func,
|
|
13150
|
+
/**
|
|
13151
|
+
* @ignore
|
|
13152
|
+
*/
|
|
13153
|
+
onDragLeave: propTypes.exports.func,
|
|
13154
|
+
/**
|
|
13155
|
+
* @ignore
|
|
13156
|
+
*/
|
|
13157
|
+
onFocus: propTypes.exports.func,
|
|
13158
|
+
/**
|
|
13159
|
+
* Callback fired when the component is focused with a keyboard.
|
|
13160
|
+
* We trigger a `onFocus` callback too.
|
|
13161
|
+
*/
|
|
13162
|
+
onFocusVisible: propTypes.exports.func,
|
|
13163
|
+
/**
|
|
13164
|
+
* @ignore
|
|
13165
|
+
*/
|
|
13166
|
+
onKeyDown: propTypes.exports.func,
|
|
13167
|
+
/**
|
|
13168
|
+
* @ignore
|
|
13169
|
+
*/
|
|
13170
|
+
onKeyUp: propTypes.exports.func,
|
|
13171
|
+
/**
|
|
13172
|
+
* @ignore
|
|
13173
|
+
*/
|
|
13174
|
+
onMouseDown: propTypes.exports.func,
|
|
13175
|
+
/**
|
|
13176
|
+
* @ignore
|
|
13177
|
+
*/
|
|
13178
|
+
onMouseLeave: propTypes.exports.func,
|
|
13179
|
+
/**
|
|
13180
|
+
* @ignore
|
|
13181
|
+
*/
|
|
13182
|
+
onMouseUp: propTypes.exports.func,
|
|
13183
|
+
/**
|
|
13184
|
+
* @ignore
|
|
13185
|
+
*/
|
|
13186
|
+
onTouchEnd: propTypes.exports.func,
|
|
13187
|
+
/**
|
|
13188
|
+
* @ignore
|
|
13189
|
+
*/
|
|
13190
|
+
onTouchMove: propTypes.exports.func,
|
|
13191
|
+
/**
|
|
13192
|
+
* @ignore
|
|
13193
|
+
*/
|
|
13194
|
+
onTouchStart: propTypes.exports.func,
|
|
13195
|
+
/**
|
|
13196
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
13197
|
+
*/
|
|
13198
|
+
sx: propTypes.exports.oneOfType([propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object, propTypes.exports.bool])), propTypes.exports.func, propTypes.exports.object]),
|
|
13199
|
+
/**
|
|
13200
|
+
* @default 0
|
|
13201
|
+
*/
|
|
13202
|
+
tabIndex: propTypes.exports.number,
|
|
13203
|
+
/**
|
|
13204
|
+
* Props applied to the `TouchRipple` element.
|
|
13205
|
+
*/
|
|
13206
|
+
TouchRippleProps: propTypes.exports.object,
|
|
13207
|
+
/**
|
|
13208
|
+
* A ref that points to the `TouchRipple` element.
|
|
13209
|
+
*/
|
|
13210
|
+
touchRippleRef: propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.shape({
|
|
13211
|
+
current: propTypes.exports.shape({
|
|
13212
|
+
pulsate: propTypes.exports.func.isRequired,
|
|
13213
|
+
start: propTypes.exports.func.isRequired,
|
|
13214
|
+
stop: propTypes.exports.func.isRequired
|
|
13215
|
+
})
|
|
13216
|
+
})]),
|
|
13217
|
+
/**
|
|
13218
|
+
* @ignore
|
|
13219
|
+
*/
|
|
13220
|
+
type: propTypes.exports.oneOfType([propTypes.exports.oneOf(['button', 'reset', 'submit']), propTypes.exports.string])
|
|
13221
|
+
} : void 0;
|
|
13222
|
+
|
|
13223
|
+
function getButtonUtilityClass(slot) {
|
|
13224
|
+
return generateUtilityClass('MuiButton', slot);
|
|
13225
|
+
}
|
|
13226
|
+
const buttonClasses = generateUtilityClasses('MuiButton', ['root', 'text', 'textInherit', 'textPrimary', 'textSecondary', 'textSuccess', 'textError', 'textInfo', 'textWarning', 'outlined', 'outlinedInherit', 'outlinedPrimary', 'outlinedSecondary', 'outlinedSuccess', 'outlinedError', 'outlinedInfo', 'outlinedWarning', 'contained', 'containedInherit', 'containedPrimary', 'containedSecondary', 'containedSuccess', 'containedError', 'containedInfo', 'containedWarning', 'disableElevation', 'focusVisible', 'disabled', 'colorInherit', 'textSizeSmall', 'textSizeMedium', 'textSizeLarge', 'outlinedSizeSmall', 'outlinedSizeMedium', 'outlinedSizeLarge', 'containedSizeSmall', 'containedSizeMedium', 'containedSizeLarge', 'sizeMedium', 'sizeSmall', 'sizeLarge', 'fullWidth', 'startIcon', 'endIcon', 'iconSizeSmall', 'iconSizeMedium', 'iconSizeLarge']);
|
|
13227
|
+
|
|
13228
|
+
/**
|
|
13229
|
+
* @ignore - internal component.
|
|
13230
|
+
*/
|
|
13231
|
+
const ButtonGroupContext = /*#__PURE__*/React__namespace.createContext({});
|
|
13232
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
13233
|
+
ButtonGroupContext.displayName = 'ButtonGroupContext';
|
|
13234
|
+
}
|
|
13235
|
+
|
|
13236
|
+
const _excluded = ["children", "color", "component", "className", "disabled", "disableElevation", "disableFocusRipple", "endIcon", "focusVisibleClassName", "fullWidth", "size", "startIcon", "type", "variant"];
|
|
13237
|
+
const useUtilityClasses = ownerState => {
|
|
13238
|
+
const {
|
|
13239
|
+
color,
|
|
13240
|
+
disableElevation,
|
|
13241
|
+
fullWidth,
|
|
13242
|
+
size,
|
|
13243
|
+
variant,
|
|
13244
|
+
classes
|
|
13245
|
+
} = ownerState;
|
|
13246
|
+
const slots = {
|
|
13247
|
+
root: ['root', variant, `${variant}${capitalize(color)}`, `size${capitalize(size)}`, `${variant}Size${capitalize(size)}`, color === 'inherit' && 'colorInherit', disableElevation && 'disableElevation', fullWidth && 'fullWidth'],
|
|
13248
|
+
label: ['label'],
|
|
13249
|
+
startIcon: ['startIcon', `iconSize${capitalize(size)}`],
|
|
13250
|
+
endIcon: ['endIcon', `iconSize${capitalize(size)}`]
|
|
13251
|
+
};
|
|
13252
|
+
const composedClasses = composeClasses(slots, getButtonUtilityClass, classes);
|
|
13253
|
+
return _extends$1({}, classes, composedClasses);
|
|
13254
|
+
};
|
|
13255
|
+
const commonIconStyles = ownerState => _extends$1({}, ownerState.size === 'small' && {
|
|
13256
|
+
'& > *:nth-of-type(1)': {
|
|
13257
|
+
fontSize: 18
|
|
13258
|
+
}
|
|
13259
|
+
}, ownerState.size === 'medium' && {
|
|
13260
|
+
'& > *:nth-of-type(1)': {
|
|
13261
|
+
fontSize: 20
|
|
13262
|
+
}
|
|
13263
|
+
}, ownerState.size === 'large' && {
|
|
13264
|
+
'& > *:nth-of-type(1)': {
|
|
13265
|
+
fontSize: 22
|
|
13266
|
+
}
|
|
13267
|
+
});
|
|
13268
|
+
const ButtonRoot = styled(ButtonBase, {
|
|
13269
|
+
shouldForwardProp: prop => rootShouldForwardProp(prop) || prop === 'classes',
|
|
13270
|
+
name: 'MuiButton',
|
|
13271
|
+
slot: 'Root',
|
|
13272
|
+
overridesResolver: (props, styles) => {
|
|
13273
|
+
const {
|
|
13274
|
+
ownerState
|
|
13275
|
+
} = props;
|
|
13276
|
+
return [styles.root, styles[ownerState.variant], styles[`${ownerState.variant}${capitalize(ownerState.color)}`], styles[`size${capitalize(ownerState.size)}`], styles[`${ownerState.variant}Size${capitalize(ownerState.size)}`], ownerState.color === 'inherit' && styles.colorInherit, ownerState.disableElevation && styles.disableElevation, ownerState.fullWidth && styles.fullWidth];
|
|
13277
|
+
}
|
|
13278
|
+
})(({
|
|
13279
|
+
theme,
|
|
13280
|
+
ownerState
|
|
13281
|
+
}) => {
|
|
13282
|
+
var _theme$palette$getCon, _theme$palette;
|
|
13283
|
+
return _extends$1({}, theme.typography.button, {
|
|
13284
|
+
minWidth: 64,
|
|
13285
|
+
padding: '6px 16px',
|
|
13286
|
+
borderRadius: (theme.vars || theme).shape.borderRadius,
|
|
13287
|
+
transition: theme.transitions.create(['background-color', 'box-shadow', 'border-color', 'color'], {
|
|
13288
|
+
duration: theme.transitions.duration.short
|
|
13289
|
+
}),
|
|
13290
|
+
'&:hover': _extends$1({
|
|
13291
|
+
textDecoration: 'none',
|
|
13292
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette.text.primaryChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette.text.primary, theme.palette.action.hoverOpacity),
|
|
13293
|
+
// Reset on touch devices, it doesn't add specificity
|
|
13294
|
+
'@media (hover: none)': {
|
|
13295
|
+
backgroundColor: 'transparent'
|
|
13296
|
+
}
|
|
13297
|
+
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
13298
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
|
|
13299
|
+
// Reset on touch devices, it doesn't add specificity
|
|
13300
|
+
'@media (hover: none)': {
|
|
13301
|
+
backgroundColor: 'transparent'
|
|
13302
|
+
}
|
|
13303
|
+
}, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
|
|
13304
|
+
border: `1px solid ${(theme.vars || theme).palette[ownerState.color].main}`,
|
|
13305
|
+
backgroundColor: theme.vars ? `rgba(${theme.vars.palette[ownerState.color].mainChannel} / ${theme.vars.palette.action.hoverOpacity})` : alpha(theme.palette[ownerState.color].main, theme.palette.action.hoverOpacity),
|
|
13306
|
+
// Reset on touch devices, it doesn't add specificity
|
|
13307
|
+
'@media (hover: none)': {
|
|
13308
|
+
backgroundColor: 'transparent'
|
|
13309
|
+
}
|
|
13310
|
+
}, ownerState.variant === 'contained' && {
|
|
13311
|
+
backgroundColor: (theme.vars || theme).palette.grey.A100,
|
|
13312
|
+
boxShadow: (theme.vars || theme).shadows[4],
|
|
13313
|
+
// Reset on touch devices, it doesn't add specificity
|
|
13314
|
+
'@media (hover: none)': {
|
|
13315
|
+
boxShadow: (theme.vars || theme).shadows[2],
|
|
13316
|
+
backgroundColor: (theme.vars || theme).palette.grey[300]
|
|
13317
|
+
}
|
|
13318
|
+
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
13319
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].dark,
|
|
13320
|
+
// Reset on touch devices, it doesn't add specificity
|
|
13321
|
+
'@media (hover: none)': {
|
|
13322
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
13323
|
+
}
|
|
13324
|
+
}),
|
|
13325
|
+
'&:active': _extends$1({}, ownerState.variant === 'contained' && {
|
|
13326
|
+
boxShadow: (theme.vars || theme).shadows[8]
|
|
13327
|
+
}),
|
|
13328
|
+
[`&.${buttonClasses.focusVisible}`]: _extends$1({}, ownerState.variant === 'contained' && {
|
|
13329
|
+
boxShadow: (theme.vars || theme).shadows[6]
|
|
13330
|
+
}),
|
|
13331
|
+
[`&.${buttonClasses.disabled}`]: _extends$1({
|
|
13332
|
+
color: (theme.vars || theme).palette.action.disabled
|
|
13333
|
+
}, ownerState.variant === 'outlined' && {
|
|
13334
|
+
border: `1px solid ${(theme.vars || theme).palette.action.disabledBackground}`
|
|
13335
|
+
}, ownerState.variant === 'outlined' && ownerState.color === 'secondary' && {
|
|
13336
|
+
border: `1px solid ${(theme.vars || theme).palette.action.disabled}`
|
|
13337
|
+
}, ownerState.variant === 'contained' && {
|
|
13338
|
+
color: (theme.vars || theme).palette.action.disabled,
|
|
13339
|
+
boxShadow: (theme.vars || theme).shadows[0],
|
|
13340
|
+
backgroundColor: (theme.vars || theme).palette.action.disabledBackground
|
|
13341
|
+
})
|
|
13342
|
+
}, ownerState.variant === 'text' && {
|
|
13343
|
+
padding: '6px 8px'
|
|
13344
|
+
}, ownerState.variant === 'text' && ownerState.color !== 'inherit' && {
|
|
13345
|
+
color: (theme.vars || theme).palette[ownerState.color].main
|
|
13346
|
+
}, ownerState.variant === 'outlined' && {
|
|
13347
|
+
padding: '5px 15px',
|
|
13348
|
+
border: '1px solid currentColor'
|
|
13349
|
+
}, ownerState.variant === 'outlined' && ownerState.color !== 'inherit' && {
|
|
13350
|
+
color: (theme.vars || theme).palette[ownerState.color].main,
|
|
13351
|
+
border: theme.vars ? `1px solid rgba(${theme.vars.palette[ownerState.color].mainChannel} / 0.5)` : `1px solid ${alpha(theme.palette[ownerState.color].main, 0.5)}`
|
|
13352
|
+
}, ownerState.variant === 'contained' && {
|
|
13353
|
+
color: theme.vars ?
|
|
13354
|
+
// this is safe because grey does not change between default light/dark mode
|
|
13355
|
+
theme.vars.palette.text.primary : (_theme$palette$getCon = (_theme$palette = theme.palette).getContrastText) == null ? void 0 : _theme$palette$getCon.call(_theme$palette, theme.palette.grey[300]),
|
|
13356
|
+
backgroundColor: (theme.vars || theme).palette.grey[300],
|
|
13357
|
+
boxShadow: (theme.vars || theme).shadows[2]
|
|
13358
|
+
}, ownerState.variant === 'contained' && ownerState.color !== 'inherit' && {
|
|
13359
|
+
color: (theme.vars || theme).palette[ownerState.color].contrastText,
|
|
13360
|
+
backgroundColor: (theme.vars || theme).palette[ownerState.color].main
|
|
13361
|
+
}, ownerState.color === 'inherit' && {
|
|
13362
|
+
color: 'inherit',
|
|
13363
|
+
borderColor: 'currentColor'
|
|
13364
|
+
}, ownerState.size === 'small' && ownerState.variant === 'text' && {
|
|
13365
|
+
padding: '4px 5px',
|
|
13366
|
+
fontSize: theme.typography.pxToRem(13)
|
|
13367
|
+
}, ownerState.size === 'large' && ownerState.variant === 'text' && {
|
|
13368
|
+
padding: '8px 11px',
|
|
13369
|
+
fontSize: theme.typography.pxToRem(15)
|
|
13370
|
+
}, ownerState.size === 'small' && ownerState.variant === 'outlined' && {
|
|
13371
|
+
padding: '3px 9px',
|
|
13372
|
+
fontSize: theme.typography.pxToRem(13)
|
|
13373
|
+
}, ownerState.size === 'large' && ownerState.variant === 'outlined' && {
|
|
13374
|
+
padding: '7px 21px',
|
|
13375
|
+
fontSize: theme.typography.pxToRem(15)
|
|
13376
|
+
}, ownerState.size === 'small' && ownerState.variant === 'contained' && {
|
|
13377
|
+
padding: '4px 10px',
|
|
13378
|
+
fontSize: theme.typography.pxToRem(13)
|
|
13379
|
+
}, ownerState.size === 'large' && ownerState.variant === 'contained' && {
|
|
13380
|
+
padding: '8px 22px',
|
|
13381
|
+
fontSize: theme.typography.pxToRem(15)
|
|
13382
|
+
}, ownerState.fullWidth && {
|
|
13383
|
+
width: '100%'
|
|
13384
|
+
});
|
|
13385
|
+
}, ({
|
|
13386
|
+
ownerState
|
|
13387
|
+
}) => ownerState.disableElevation && {
|
|
13388
|
+
boxShadow: 'none',
|
|
13389
|
+
'&:hover': {
|
|
13390
|
+
boxShadow: 'none'
|
|
13391
|
+
},
|
|
13392
|
+
[`&.${buttonClasses.focusVisible}`]: {
|
|
13393
|
+
boxShadow: 'none'
|
|
13394
|
+
},
|
|
13395
|
+
'&:active': {
|
|
13396
|
+
boxShadow: 'none'
|
|
13397
|
+
},
|
|
13398
|
+
[`&.${buttonClasses.disabled}`]: {
|
|
13399
|
+
boxShadow: 'none'
|
|
13400
|
+
}
|
|
13401
|
+
});
|
|
13402
|
+
const ButtonStartIcon = styled('span', {
|
|
13403
|
+
name: 'MuiButton',
|
|
13404
|
+
slot: 'StartIcon',
|
|
13405
|
+
overridesResolver: (props, styles) => {
|
|
13406
|
+
const {
|
|
13407
|
+
ownerState
|
|
13408
|
+
} = props;
|
|
13409
|
+
return [styles.startIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
|
|
13410
|
+
}
|
|
13411
|
+
})(({
|
|
13412
|
+
ownerState
|
|
13413
|
+
}) => _extends$1({
|
|
13414
|
+
display: 'inherit',
|
|
13415
|
+
marginRight: 8,
|
|
13416
|
+
marginLeft: -4
|
|
13417
|
+
}, ownerState.size === 'small' && {
|
|
13418
|
+
marginLeft: -2
|
|
13419
|
+
}, commonIconStyles(ownerState)));
|
|
13420
|
+
const ButtonEndIcon = styled('span', {
|
|
13421
|
+
name: 'MuiButton',
|
|
13422
|
+
slot: 'EndIcon',
|
|
13423
|
+
overridesResolver: (props, styles) => {
|
|
13424
|
+
const {
|
|
13425
|
+
ownerState
|
|
13426
|
+
} = props;
|
|
13427
|
+
return [styles.endIcon, styles[`iconSize${capitalize(ownerState.size)}`]];
|
|
13428
|
+
}
|
|
13429
|
+
})(({
|
|
13430
|
+
ownerState
|
|
13431
|
+
}) => _extends$1({
|
|
13432
|
+
display: 'inherit',
|
|
13433
|
+
marginRight: -4,
|
|
13434
|
+
marginLeft: 8
|
|
13435
|
+
}, ownerState.size === 'small' && {
|
|
13436
|
+
marginRight: -2
|
|
13437
|
+
}, commonIconStyles(ownerState)));
|
|
13438
|
+
const Button = /*#__PURE__*/React__namespace.forwardRef(function Button(inProps, ref) {
|
|
13439
|
+
// props priority: `inProps` > `contextProps` > `themeDefaultProps`
|
|
13440
|
+
const contextProps = React__namespace.useContext(ButtonGroupContext);
|
|
13441
|
+
const resolvedProps = resolveProps(contextProps, inProps);
|
|
13442
|
+
const props = useThemeProps({
|
|
13443
|
+
props: resolvedProps,
|
|
13444
|
+
name: 'MuiButton'
|
|
13445
|
+
});
|
|
13446
|
+
const {
|
|
13447
|
+
children,
|
|
13448
|
+
color = 'primary',
|
|
13449
|
+
component = 'button',
|
|
13450
|
+
className,
|
|
13451
|
+
disabled = false,
|
|
13452
|
+
disableElevation = false,
|
|
13453
|
+
disableFocusRipple = false,
|
|
13454
|
+
endIcon: endIconProp,
|
|
13455
|
+
focusVisibleClassName,
|
|
13456
|
+
fullWidth = false,
|
|
13457
|
+
size = 'medium',
|
|
13458
|
+
startIcon: startIconProp,
|
|
13459
|
+
type,
|
|
13460
|
+
variant = 'text'
|
|
13461
|
+
} = props,
|
|
13462
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
13463
|
+
const ownerState = _extends$1({}, props, {
|
|
13464
|
+
color,
|
|
13465
|
+
component,
|
|
13466
|
+
disabled,
|
|
13467
|
+
disableElevation,
|
|
13468
|
+
disableFocusRipple,
|
|
13469
|
+
fullWidth,
|
|
13470
|
+
size,
|
|
13471
|
+
type,
|
|
13472
|
+
variant
|
|
13473
|
+
});
|
|
13474
|
+
const classes = useUtilityClasses(ownerState);
|
|
13475
|
+
const startIcon = startIconProp && /*#__PURE__*/jsxRuntime.exports.jsx(ButtonStartIcon, {
|
|
13476
|
+
className: classes.startIcon,
|
|
13477
|
+
ownerState: ownerState,
|
|
13478
|
+
children: startIconProp
|
|
13479
|
+
});
|
|
13480
|
+
const endIcon = endIconProp && /*#__PURE__*/jsxRuntime.exports.jsx(ButtonEndIcon, {
|
|
13481
|
+
className: classes.endIcon,
|
|
13482
|
+
ownerState: ownerState,
|
|
13483
|
+
children: endIconProp
|
|
13484
|
+
});
|
|
13485
|
+
return /*#__PURE__*/jsxRuntime.exports.jsxs(ButtonRoot, _extends$1({
|
|
13486
|
+
ownerState: ownerState,
|
|
13487
|
+
className: clsx(contextProps.className, classes.root, className),
|
|
13488
|
+
component: component,
|
|
13489
|
+
disabled: disabled,
|
|
13490
|
+
focusRipple: !disableFocusRipple,
|
|
13491
|
+
focusVisibleClassName: clsx(classes.focusVisible, focusVisibleClassName),
|
|
13492
|
+
ref: ref,
|
|
13493
|
+
type: type
|
|
13494
|
+
}, other, {
|
|
13495
|
+
classes: classes,
|
|
13496
|
+
children: [startIcon, children, endIcon]
|
|
13497
|
+
}));
|
|
13498
|
+
});
|
|
13499
|
+
process.env.NODE_ENV !== "production" ? Button.propTypes /* remove-proptypes */ = {
|
|
13500
|
+
// ----------------------------- Warning --------------------------------
|
|
13501
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
13502
|
+
// | To update them edit the d.ts file and run "yarn proptypes" |
|
|
13503
|
+
// ----------------------------------------------------------------------
|
|
13504
|
+
/**
|
|
13505
|
+
* The content of the component.
|
|
13506
|
+
*/
|
|
13507
|
+
children: propTypes.exports.node,
|
|
13508
|
+
/**
|
|
13509
|
+
* Override or extend the styles applied to the component.
|
|
13510
|
+
*/
|
|
13511
|
+
classes: propTypes.exports.object,
|
|
13512
|
+
/**
|
|
13513
|
+
* @ignore
|
|
13514
|
+
*/
|
|
13515
|
+
className: propTypes.exports.string,
|
|
13516
|
+
/**
|
|
13517
|
+
* The color of the component.
|
|
13518
|
+
* It supports both default and custom theme colors, which can be added as shown in the
|
|
13519
|
+
* [palette customization guide](https://mui.com/material-ui/customization/palette/#adding-new-colors).
|
|
13520
|
+
* @default 'primary'
|
|
13521
|
+
*/
|
|
13522
|
+
color: propTypes.exports /* @typescript-to-proptypes-ignore */.oneOfType([propTypes.exports.oneOf(['inherit', 'primary', 'secondary', 'success', 'error', 'info', 'warning']), propTypes.exports.string]),
|
|
13523
|
+
/**
|
|
13524
|
+
* The component used for the root node.
|
|
13525
|
+
* Either a string to use a HTML element or a component.
|
|
13526
|
+
*/
|
|
13527
|
+
component: propTypes.exports.elementType,
|
|
13528
|
+
/**
|
|
13529
|
+
* If `true`, the component is disabled.
|
|
13530
|
+
* @default false
|
|
13531
|
+
*/
|
|
13532
|
+
disabled: propTypes.exports.bool,
|
|
13533
|
+
/**
|
|
13534
|
+
* If `true`, no elevation is used.
|
|
13535
|
+
* @default false
|
|
13536
|
+
*/
|
|
13537
|
+
disableElevation: propTypes.exports.bool,
|
|
13538
|
+
/**
|
|
13539
|
+
* If `true`, the keyboard focus ripple is disabled.
|
|
13540
|
+
* @default false
|
|
13541
|
+
*/
|
|
13542
|
+
disableFocusRipple: propTypes.exports.bool,
|
|
13543
|
+
/**
|
|
13544
|
+
* If `true`, the ripple effect is disabled.
|
|
13545
|
+
*
|
|
13546
|
+
* ⚠️ Without a ripple there is no styling for :focus-visible by default. Be sure
|
|
13547
|
+
* to highlight the element by applying separate styles with the `.Mui-focusVisible` class.
|
|
13548
|
+
* @default false
|
|
13549
|
+
*/
|
|
13550
|
+
disableRipple: propTypes.exports.bool,
|
|
13551
|
+
/**
|
|
13552
|
+
* Element placed after the children.
|
|
13553
|
+
*/
|
|
13554
|
+
endIcon: propTypes.exports.node,
|
|
13555
|
+
/**
|
|
13556
|
+
* @ignore
|
|
13557
|
+
*/
|
|
13558
|
+
focusVisibleClassName: propTypes.exports.string,
|
|
13559
|
+
/**
|
|
13560
|
+
* If `true`, the button will take up the full width of its container.
|
|
13561
|
+
* @default false
|
|
13562
|
+
*/
|
|
13563
|
+
fullWidth: propTypes.exports.bool,
|
|
13564
|
+
/**
|
|
13565
|
+
* The URL to link to when the button is clicked.
|
|
13566
|
+
* If defined, an `a` element will be used as the root node.
|
|
13567
|
+
*/
|
|
13568
|
+
href: propTypes.exports.string,
|
|
13569
|
+
/**
|
|
13570
|
+
* The size of the component.
|
|
13571
|
+
* `small` is equivalent to the dense button styling.
|
|
13572
|
+
* @default 'medium'
|
|
13573
|
+
*/
|
|
13574
|
+
size: propTypes.exports /* @typescript-to-proptypes-ignore */.oneOfType([propTypes.exports.oneOf(['small', 'medium', 'large']), propTypes.exports.string]),
|
|
13575
|
+
/**
|
|
13576
|
+
* Element placed before the children.
|
|
13577
|
+
*/
|
|
13578
|
+
startIcon: propTypes.exports.node,
|
|
13579
|
+
/**
|
|
13580
|
+
* The system prop that allows defining system overrides as well as additional CSS styles.
|
|
13581
|
+
*/
|
|
13582
|
+
sx: propTypes.exports.oneOfType([propTypes.exports.arrayOf(propTypes.exports.oneOfType([propTypes.exports.func, propTypes.exports.object, propTypes.exports.bool])), propTypes.exports.func, propTypes.exports.object]),
|
|
13583
|
+
/**
|
|
13584
|
+
* @ignore
|
|
13585
|
+
*/
|
|
13586
|
+
type: propTypes.exports.oneOfType([propTypes.exports.oneOf(['button', 'reset', 'submit']), propTypes.exports.string]),
|
|
13587
|
+
/**
|
|
13588
|
+
* The variant to use.
|
|
13589
|
+
* @default 'text'
|
|
13590
|
+
*/
|
|
13591
|
+
variant: propTypes.exports /* @typescript-to-proptypes-ignore */.oneOfType([propTypes.exports.oneOf(['contained', 'outlined', 'text']), propTypes.exports.string])
|
|
13592
|
+
} : void 0;
|
|
13593
|
+
|
|
13594
|
+
var CustomButton = styled(Button)(function (_a) {
|
|
13595
|
+
var fluid = _a.fluid;
|
|
13596
|
+
return ({
|
|
13597
|
+
width: fluid ? '100%' : 'auto',
|
|
13598
|
+
// fontSize: '16px',
|
|
13599
|
+
// lineHeight: '15px',
|
|
13600
|
+
borderRadius: '24px',
|
|
13601
|
+
fontWeight: 'bold',
|
|
13602
|
+
boxShadow: 'none',
|
|
13603
|
+
// padding: props => props.size === 'big' ? '34px 60px' : '4px 24px',
|
|
13604
|
+
border: '2px solid #293072',
|
|
13605
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13606
|
+
color: theme.mainPallete.primary.blue,
|
|
13607
|
+
textTransform: 'uppercase',
|
|
13608
|
+
fontFamily: [
|
|
13609
|
+
'"Barlow", sans-serif',
|
|
13610
|
+
],
|
|
13611
|
+
// backgroundColor: theme.mainPallete.primary.red,
|
|
13612
|
+
'&:hover': {
|
|
13613
|
+
boxShadow: 'none'
|
|
13614
|
+
},
|
|
13615
|
+
'&.primary': {
|
|
13616
|
+
'&.navy-blue': {
|
|
13617
|
+
backgroundColor: theme.mainPallete.primary.blue,
|
|
13618
|
+
borderColor: theme.mainPallete.primary.blue,
|
|
13619
|
+
color: theme.mainPallete.primary.white,
|
|
13620
|
+
'&:hover': {
|
|
13621
|
+
borderColor: '#3A44A7',
|
|
13622
|
+
color: theme.mainPallete.primary.white,
|
|
13623
|
+
backgroundColor: '#3A44A7'
|
|
13624
|
+
},
|
|
13625
|
+
},
|
|
13626
|
+
'&.red': {
|
|
13627
|
+
backgroundColor: theme.mainPallete.primary.red,
|
|
13628
|
+
borderColor: theme.mainPallete.primary.red,
|
|
13629
|
+
color: theme.mainPallete.primary.white,
|
|
13630
|
+
'&:hover': {
|
|
13631
|
+
borderColor: '#FA676B',
|
|
13632
|
+
color: theme.mainPallete.primary.white,
|
|
13633
|
+
backgroundColor: '#FA676B'
|
|
13634
|
+
},
|
|
13635
|
+
},
|
|
13636
|
+
'&.black': {
|
|
13637
|
+
backgroundColor: '#000',
|
|
13638
|
+
borderColor: '#000',
|
|
13639
|
+
color: theme.mainPallete.primary.white,
|
|
13640
|
+
'&:hover': {
|
|
13641
|
+
borderColor: '#707070',
|
|
13642
|
+
color: theme.mainPallete.primary.white,
|
|
13643
|
+
backgroundColor: '#707070',
|
|
13644
|
+
},
|
|
13645
|
+
},
|
|
13646
|
+
'&.grey': {
|
|
13647
|
+
backgroundColor: '#F5F7F9',
|
|
13648
|
+
borderColor: '#F5F7F9',
|
|
13649
|
+
color: theme.mainPallete.primary.placeholderText,
|
|
13650
|
+
'&:hover': {
|
|
13651
|
+
borderColor: '#FAFAFA',
|
|
13652
|
+
color: theme.mainPallete.primary.placeholderText,
|
|
13653
|
+
backgroundColor: '#FAFAFA'
|
|
13654
|
+
},
|
|
13655
|
+
},
|
|
13656
|
+
'&.special-green': {
|
|
13657
|
+
backgroundColor: theme.mainPallete.secondary.specialGreen,
|
|
13658
|
+
borderColor: theme.mainPallete.secondary.specialGreen,
|
|
13659
|
+
color: theme.mainPallete.primary.white,
|
|
13660
|
+
'&:hover': {
|
|
13661
|
+
borderColor: '#87DB87',
|
|
13662
|
+
backgroundColor: '#87DB87',
|
|
13663
|
+
color: theme.mainPallete.primary.white
|
|
13664
|
+
},
|
|
13665
|
+
},
|
|
13666
|
+
},
|
|
13667
|
+
'&.secondary': {
|
|
13668
|
+
'&.navy-blue': {
|
|
13669
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13670
|
+
borderColor: theme.mainPallete.primary.blue,
|
|
13671
|
+
color: theme.mainPallete.primary.blue,
|
|
13672
|
+
'&:hover': {
|
|
13673
|
+
borderColor: '#3A44A7',
|
|
13674
|
+
color: '#3A44A7'
|
|
13675
|
+
},
|
|
13676
|
+
},
|
|
13677
|
+
'&.red': {
|
|
13678
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13679
|
+
borderColor: theme.mainPallete.primary.red,
|
|
13680
|
+
color: theme.mainPallete.primary.red,
|
|
13681
|
+
'&:hover': {
|
|
13682
|
+
borderColor: '#FA676B',
|
|
13683
|
+
color: '#FA676B'
|
|
13684
|
+
},
|
|
13685
|
+
},
|
|
13686
|
+
'&.black': {
|
|
13687
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13688
|
+
borderColor: '#000',
|
|
13689
|
+
color: '#000',
|
|
13690
|
+
'&:hover': {
|
|
13691
|
+
borderColor: '#707070',
|
|
13692
|
+
color: '#707070'
|
|
13693
|
+
},
|
|
13694
|
+
},
|
|
13695
|
+
'&.grey': {
|
|
13696
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13697
|
+
borderColor: theme.mainPallete.primary.placeholderText,
|
|
13698
|
+
color: theme.mainPallete.primary.placeholderText,
|
|
13699
|
+
'&:hover': {
|
|
13700
|
+
borderColor: '#F3F6F8',
|
|
13701
|
+
color: theme.mainPallete.primary.placeholderText
|
|
13702
|
+
},
|
|
13703
|
+
},
|
|
13704
|
+
'&.special-green': {
|
|
13705
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13706
|
+
borderColor: theme.mainPallete.secondary.specialGreen,
|
|
13707
|
+
color: theme.mainPallete.secondary.specialGreen,
|
|
13708
|
+
'&:hover': {
|
|
13709
|
+
borderColor: '#87DB87',
|
|
13710
|
+
color: '#87DB87'
|
|
13711
|
+
},
|
|
13712
|
+
},
|
|
13713
|
+
},
|
|
13714
|
+
'&.ghost': {
|
|
13715
|
+
border: 'none',
|
|
13716
|
+
borderRadius: 0,
|
|
13717
|
+
backgroundColor: theme.mainPallete.primary.white,
|
|
13718
|
+
color: theme.mainPallete.primary.blue,
|
|
13719
|
+
textTransform: 'none',
|
|
13720
|
+
'&.white': {
|
|
13721
|
+
backgroundColor: 'transparent',
|
|
13722
|
+
color: theme.mainPallete.primary.white,
|
|
13723
|
+
'&:hover': {
|
|
13724
|
+
color: theme.mainPallete.primary.white,
|
|
13725
|
+
backgroundColor: 'transparent',
|
|
13726
|
+
},
|
|
13727
|
+
},
|
|
13728
|
+
'&.navy-blue': {
|
|
13729
|
+
backgroundColor: 'transparent',
|
|
13730
|
+
borderColor: theme.mainPallete.primary.blue,
|
|
13731
|
+
color: theme.mainPallete.primary.blue,
|
|
13732
|
+
'&:hover': {
|
|
13733
|
+
borderColor: '#3A44A7',
|
|
13734
|
+
color: '#3A44A7',
|
|
13735
|
+
backgroundColor: 'transparent',
|
|
13736
|
+
},
|
|
13737
|
+
},
|
|
13738
|
+
'&.red': {
|
|
13739
|
+
backgroundColor: 'transparent',
|
|
13740
|
+
borderColor: theme.mainPallete.primary.red,
|
|
13741
|
+
color: theme.mainPallete.primary.red,
|
|
13742
|
+
'&:hover': {
|
|
13743
|
+
borderColor: '#FA676B',
|
|
13744
|
+
color: '#FA676B',
|
|
13745
|
+
backgroundColor: 'transparent',
|
|
13746
|
+
},
|
|
13747
|
+
},
|
|
13748
|
+
'&.black': {
|
|
13749
|
+
backgroundColor: 'transparent',
|
|
13750
|
+
borderColor: '#000',
|
|
13751
|
+
color: '#000',
|
|
13752
|
+
'&:hover': {
|
|
13753
|
+
borderColor: '#707070',
|
|
13754
|
+
color: '#707070',
|
|
13755
|
+
backgroundColor: 'transparent',
|
|
13756
|
+
},
|
|
13757
|
+
},
|
|
13758
|
+
'&.grey': {
|
|
13759
|
+
backgroundColor: 'transparent',
|
|
13760
|
+
borderColor: theme.mainPallete.primary.placeholderText,
|
|
13761
|
+
color: theme.mainPallete.primary.placeholderText,
|
|
13762
|
+
'&:hover': {
|
|
13763
|
+
borderColor: '#F3F6F8',
|
|
13764
|
+
color: theme.mainPallete.primary.placeholderText,
|
|
13765
|
+
backgroundColor: 'transparent',
|
|
13766
|
+
},
|
|
13767
|
+
},
|
|
13768
|
+
'&.special-green': {
|
|
13769
|
+
backgroundColor: 'transparent',
|
|
13770
|
+
borderColor: theme.mainPallete.secondary.specialGreen,
|
|
13771
|
+
color: theme.mainPallete.secondary.specialGreen,
|
|
13772
|
+
'&:hover': {
|
|
13773
|
+
borderColor: '#87DB87',
|
|
13774
|
+
color: '#87DB87',
|
|
13775
|
+
backgroundColor: 'transparent',
|
|
13776
|
+
},
|
|
13777
|
+
},
|
|
13778
|
+
},
|
|
13779
|
+
'&.big': {
|
|
13780
|
+
padding: '21px',
|
|
13781
|
+
fontSize: '16px',
|
|
13782
|
+
lineHeight: '15px',
|
|
13783
|
+
borderRadius: '31px',
|
|
13784
|
+
fontWeight: 'bold',
|
|
13785
|
+
'@media(min-width: 720px)': {
|
|
13786
|
+
padding: '34px 30px',
|
|
13787
|
+
fontSize: '24px',
|
|
13788
|
+
lineHeight: '25px',
|
|
13789
|
+
borderRadius: '49px'
|
|
13790
|
+
},
|
|
13791
|
+
'@media(min-width: 1024px)': {
|
|
13792
|
+
padding: '9px 25px 10px 25px',
|
|
13793
|
+
fontSize: '12px',
|
|
13794
|
+
lineHeight: '16px',
|
|
13795
|
+
borderRadius: '31px'
|
|
13796
|
+
},
|
|
13797
|
+
},
|
|
13798
|
+
'&.small': {
|
|
13799
|
+
padding: '14px 21px',
|
|
13800
|
+
fontSize: '16px',
|
|
13801
|
+
lineHeight: '15px',
|
|
13802
|
+
borderRadius: '24px',
|
|
13803
|
+
fontWeight: 'bold',
|
|
13804
|
+
'@media(min-width: 720px)': {
|
|
13805
|
+
padding: '19px 30px',
|
|
13806
|
+
fontSize: '24px',
|
|
13807
|
+
lineHeight: '25px',
|
|
13808
|
+
borderRadius: '34px'
|
|
13809
|
+
},
|
|
13810
|
+
'@media(min-width: 1024px)': {
|
|
13811
|
+
padding: '3px 25px 4px 25px',
|
|
13812
|
+
fontSize: '12px',
|
|
13813
|
+
lineHeight: '16px',
|
|
13814
|
+
borderRadius: '24px'
|
|
13815
|
+
},
|
|
13816
|
+
}
|
|
13817
|
+
});
|
|
13818
|
+
});
|
|
13819
|
+
// @ts-ignore
|
|
13820
|
+
var CustomButtonComponent = function (_a) {
|
|
13821
|
+
var type = _a.type, text = _a.text, size = _a.size, fluid = _a.fluid, color = _a.color; _a.resolution; _a.width; var onClick = _a.onClick, disabled = _a.disabled, forwardedRef = _a.forwardedRef, props = __rest(_a, ["type", "text", "size", "fluid", "color", "resolution", "width", "onClick", "disabled", "forwardedRef"]);
|
|
13822
|
+
var colorClassName = disabled ? 'grey' : color ? color : 'navy-blue'; // navy-blue / red / black / grey / special-green
|
|
13823
|
+
var typeClassName = type || 'primary'; // primary / secondary / ghost
|
|
13824
|
+
var sizeClassName = size || 'big'; // null / big / small
|
|
13825
|
+
// const behaviourClassName = behaviour || '';
|
|
13826
|
+
// const resolutionClassName = resolution === '480x800' ? 'regular' : resolution === '720x1280' ? 'big' :resolution === '1024x768/1440x960/1920x1080' ? 'small' : ''
|
|
13827
|
+
// const widthClassName = width === '100%' ? 'width100' : width === '50%' ? 'width50' : width === '33%' ? 'width33' : '';
|
|
13828
|
+
var finalClassName = "".concat(typeClassName, " ").concat(colorClassName, " ").concat(sizeClassName);
|
|
13829
|
+
return (jsxRuntime.exports.jsx(CustomButton, __assign({ disabled: disabled, onClick: onClick, className: finalClassName, fluid: fluid, variant: "contained", disableRipple: true, ref: forwardedRef }, props, { children: text })));
|
|
13830
|
+
};
|
|
13831
|
+
|
|
10301
13832
|
exports.AppTile = AppTileComponent;
|
|
13833
|
+
exports.Button = CustomButtonComponent;
|
|
10302
13834
|
exports.Typography = TypographyComponent;
|
|
10303
13835
|
//# sourceMappingURL=index.js.map
|