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