UNPKG

cdbreact

Version:

Elegant UI kit and reusable components for building mobile-first, responsive websites and web apps

2,222 lines (2,205 loc) 318 kB
import 'bootstrap/dist/css/bootstrap.min.css'; import '@fortawesome/fontawesome-free/css/all.min.css'; import React, { useState, useRef, useCallback, useEffect, Children, createContext, Fragment, useContext, useMemo, forwardRef } from 'react'; import PropTypes from 'prop-types'; import classNames from 'classnames'; import styled, { ThemeProvider, css, keyframes } from 'styled-components'; import { colorStyle, space, variant, color } from 'styled-system'; import tinycolor from 'tinycolor2'; import { createPopper } from '@popperjs/core'; import { Link as Link$1, NavLink as NavLink$1 } from 'react-router-dom'; import { Transition } from 'react-transition-group'; import FocusTrap from 'focus-trap-react'; import { Link as Link$2 } from 'react-scroll'; import ReactTooltip from 'react-tooltip'; const Component = styled.div``; const colors = { white: "#FFFFFF", info: "#17A2B8", light: "#EEEEEE", primary: "#3b82f6", primary50: "#eff6ff", primary100: "#dbeafe", primary200: "#bfdbfe", primary300: "#93c5fd", primary400: "#60a5fa", primary500: "#3b82f6", primary600: "#2563eb", primary700: "#1d4ed8", primary800: "#1e40af", primary900: "#1e3a8a", secondary: "#6366f1", secondary50: "#eef2ff", secondary100: "#e0e7ff", secondary200: "#c7d2fe", secondary300: "#a5b4fc", secondary400: "#818cf8", secondary500: "#6366f1", secondary600: "#4f46e5", secondary700: "#4338ca", secondary800: "#3730a3", secondary900: "#312e81", danger: "#ef4444", danger50: "#fef2f2", danger100: "#fee2e2", danger200: "#fecaca", danger300: "#fca5a5", danger400: "#f87171", danger500: "#ef4444", danger600: "#dc2626", danger700: "#b91c1c", danger800: "#991b1b", danger900: "#7f1d1d", success: "#22c55e", success50: "#f0fdf4", success100: "#dcfce7", success200: "#bbf7d0", success300: "#86efac", success400: "#4ade80", success500: "#22c55e", success600: "#16a34a", success700: "#15803d", success800: "#166534", success900: "#14532d", warning: "#eab308", warning50: "#fefce8", warning100: "#fef9c3", warning200: "#fef08a", warning300: "#fde047", warning400: "#facc15", warning500: "#eab308", warning600: "#ca8a04", warning700: "#a16207", warning800: "#854d0e", warning900: "#713f12", brown: "#bfa094", brown50: "#fdf8f6", brown100: "#f2e8e5", brown200: "#eaddd7", brown300: "#e0cec7", brown400: "#d2bab0", brown500: "#bfa094", brown600: "#a18072", brown700: "#977669", brown800: "#846358", brown900: "#43302b", dark: "#111827", dark50: "#f9fafb", dark100: "#f3f4f6", dark200: "#e5e7eb", dark300: "#d1d5db", dark400: "#9ca3af", dark500: "#6b7280", dark600: "#4b5563", dark700: "#374151", dark800: "#1f2937", dark900: "#111827", primaryHover: "#276EF1BD", secondaryHover: "#7356BFBD", successHover: "#05944FBD", warningHover: "#FFE975BD", dangerHover: "#E11900BD", whiteHover: "#FFFFFFD5", darkHover: "#000000BD", infoHover: "#17A2B8BD", lightHover: "#EEEEEEBD" }; const theme = { colors, colorStyles: { primary: { color: colors.white, borderColor: colors.primary, backgroundColor: colors.primary, "&:hover": { color: colors.white, backgroundColor: colors.primaryHover } }, secondary: { color: colors.white, borderColor: colors.secondary, backgroundColor: colors.secondary, "&:hover": { color: colors.white, backgroundColor: colors.secondaryHover } }, light: { color: colors.dark, borderColor: colors.light, backgroundColor: colors.light, "&:hover": { color: colors.dark, backgroundColor: colors.lightHover } }, success: { color: colors.white, borderColor: colors.success, backgroundColor: colors.success, "&:hover": { color: colors.white, backgroundColor: colors.successHover } }, danger: { color: colors.white, borderColor: colors.danger, backgroundColor: colors.danger, "&:hover": { color: colors.white, backgroundColor: colors.dangerHover } }, warning: { color: colors.dark, borderColor: colors.warning, backgroundColor: colors.warning, "&:hover": { color: colors.dark, backgroundColor: colors.warningHover } }, dark: { color: colors.white, borderColor: colors.dark, backgroundColor: colors.dark, "&:hover": { color: colors.white, backgroundColor: colors.darkHover } }, white: { color: colors.dark, borderColor: colors.white, backgroundColor: colors.white, "&:hover": { color: colors.dark, backgroundColor: colors.whiteHover } }, info: { color: colors.white, borderColor: colors.info, backgroundColor: colors.info, "&:hover": { color: colors.white, backgroundColor: colors.infoHover } } }, buttonStyle: { primary: { color: colors.white, borderColor: colors.primary, backgroundColor: colors.primary }, secondary: { color: colors.white, borderColor: colors.secondary, backgroundColor: colors.secondary }, light: { color: colors.dark, borderColor: colors.light, backgroundColor: colors.light }, success: { color: colors.white, borderColor: colors.success, backgroundColor: colors.success }, danger: { color: colors.white, borderColor: colors.danger, backgroundColor: colors.danger }, warning: { color: colors.dark, borderColor: colors.warning, backgroundColor: colors.warning }, dark: { color: colors.white, borderColor: colors.dark, backgroundColor: colors.dark }, white: { color: colors.dark, borderColor: colors.white, backgroundColor: colors.white }, info: { color: colors.white, borderColor: colors.info, backgroundColor: colors.info } }, lightStyle: { primary: { color: colors.primary, borderColor: colors.primary, backgroundColor: "#E6E6FF" }, secondary: { color: colors.secondary, borderColor: colors.secondary, backgroundColor: "#F0EDF8" }, success: { color: colors.success, borderColor: colors.success, backgroundColor: "#E7FAE7" }, danger: { color: colors.danger, borderColor: colors.danger, backgroundColor: "#FCE9E9" }, warning: { color: colors.dark, borderColor: colors.warning, backgroundColor: "#FFFBE6" }, dark: { color: colors.white, borderColor: colors.dark, backgroundColor: "#333333" }, white: { color: colors.dark, borderColor: colors.dark, backgroundColor: "#F9F9F9" }, light: { color: colors.dark, borderColor: colors.light, backgroundColor: colors.light }, info: { color: colors.white, borderColor: colors.info, backgroundColor: colors.info } } }; const AccordionItem = props => { const [opened, setOpened] = useState(false); const { title, content, style } = props; const accordionItemClassName = classNames("accordion", opened ? "accordion-item--opened" : false); const handleAccordionToggle = () => { setOpened(!opened); }; let accordionItemComp = React.createElement(ThemeProvider, { theme: theme }, React.createElement(Component, { className: accordionItemClassName, onClick: handleAccordionToggle, style: style }, React.createElement("div", { className: "accordion-item__line" }, React.createElement("h3", { className: "accordion-item__title" }, title), React.createElement("span", { className: "accordion-item__icon" })), React.createElement("div", { className: "accordion-item__inner" }, React.createElement("div", { className: "accordion-item__content" }, React.createElement("p", { className: "accordion-item__paragraph" }, content))))); return accordionItemComp; }; AccordionItem.defaultProps = { tag: "div" }; AccordionItem.propTypes = { className: PropTypes.string, onClick: PropTypes.func, accordionClass: PropTypes.string, accordionHeaderClass: PropTypes.string, accordionBodyClass: PropTypes.string, hideIcon: PropTypes.bool, tag: PropTypes.string }; const Component$1 = styled.div` width: 100%; ${props => props.hideIcon ? css` .accordion-item__icon { display: none; } ` : null}; .accordion-list { list-style: none; margin: 0; padding: 0; overflow: hidden; border: 1px solid #f4f4f4; } .accordion-list__item + .accordion-list__item { border-top: 1px solid #f4f4f4; } .accordion-item--opened .accordion-item__icon { transform: rotate(180deg); } .accordion-item--opened .accordion-item__inner { max-height: 100rem; transition-timing-function: cubic-bezier(0.895, 0.03, 0.685, 0.22); transition-duration: 0.5s; transition-property: max-height; } .accordion-item--opened .accordion-item__content { opacity: 1; transform: translateY(0); transition-delay: 0.2s; transition-timing-function: ease-in-out; transition-duration: 0.2s; transition-property: opacity, transform; } .accordion-item__line { display: block; padding: 0.8rem 1.2rem; display: flex; justify-content: space-between; align-items: center; background-color: #fff; z-index: 2; position: relative; } .accordion-item__title { font-size: 1.2rem; margin: 0; font-weight: 500; color: #121212; } .accordion-item__icon { width: 1.5rem; height: 1.5rem; transition: transform 0.3s ease-in-out; background-size: contain; background-repeat: no-repeat; background-image: url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAGAAAABgCAQAAABIkb+zAAABGklEQVR4Ae3RAcZCQRiF4buDfwshBGi+2UQgcIGAVtpSIuS/KyilG+UTcbk6zIH3GQBm3mM6AAAAAAAAAACA+eqf/yZBXcV/2XeCVPYx1FXj/FjGUMd45AQp/1HHGGLZNL+e61jHnKDmv8652YT1IvPfE2LX/Sh27/ycsF60yT/lk58JYn6eU4MJccjnlAmZ/33i0OAH4jg9Qcw/5g9YJpS+m6n0xvzpCfVe+nn59S7kGyYo+YYJWz3fO+E2PaFs9XzPhMy/6fmWCXq+YUJs9HzrhLh+JsQmrnq+bYKeb52g53snXPR88wQ93z9Bz/dP0PP9E/R89wQ93zpBz7dO0POtE/R86wQ93zpBzzdP+MoHAAAAAAAAAADAExTnTW20AtjhAAAAAElFTkSuQmCC); opacity: 0.6; } .accordion-item__inner { max-height: 0; overflow: hidden; text-transform: cubic-bezier(0.95, 0.05, 0.795, 0.035); transition-duration: 0.5s; transition-property: max-height; z-index: 1; position: relative; } .accordion-item__content { opacity: 0; transform: translateY(-1rem); transition-timing-function: linear, ease; transition-duration: 0.1s; transition-property: opacity, transform; transition-delay: 0.5s; padding: 0 1.2rem 1.2rem; } .accordion-item__paragraph { margin: 0; font-size: 1rem; color: #333; font-weight: 300; line-height: 1.3; } `; const Accordion = props => { const { data, accordionClass, accordionHeaderClass, accordionBodyClass, hideIcon = false } = props; const accordionClassName = classNames("wrapper", accordionClass); return React.createElement(ThemeProvider, { theme: theme }, React.createElement(Component$1, { className: accordionClassName, hideIcon: hideIcon }, React.createElement("ul", { className: "accordion-list" }, data.map((data, key) => { return React.createElement("li", { className: "accordion-list__item", key: key }, React.createElement(AccordionItem, Object.assign({}, data, { accordionHeaderClass: accordionHeaderClass, accordionBodyClass: accordionBodyClass }))); })))); }; Accordion.prototype = { accordionClass: PropTypes.string, accordionHeaderClass: PropTypes.string, accordionBodyClass: PropTypes.string, hideIcon: PropTypes.bool, tag: PropTypes.string, data: PropTypes.arrayOf(PropTypes.any) }; const Component$2 = styled.div` ${colorStyle} border-radius: 0px; align-items:center; justify-content:space-between; min-width:500px; `; const Button = styled.button` color:inherit; border:none; background-color:transparent; right: 0px; position: absolute; padding: 0px 1.2em; :focus { outline:none; } `; const Alert = props => { const { className, tag, color, children, dismiss, ...attributes } = props; const alertClasses = classNames("alert", className); const close = e => { e.target.parentNode.remove(); }; let alertComponent = React.createElement(ThemeProvider, { theme: theme }, React.createElement(Component$2, Object.assign({}, attributes, { className: alertClasses, role: "alert", as: tag, colors: color }), children, dismiss ? React.createElement(Button, { onClick: close }, "\u00D7") : null)); return alertComponent; }; Alert.defaultProps = { color: "primary", tag: "div" }; Alert.propTypes = { className: PropTypes.string, color: PropTypes.oneOf(["primary", "secondary", "success", "danger", "warning", "info", "dark", "light"]), onClose: PropTypes.func, onClosed: PropTypes.func, tag: PropTypes.string, dismiss: PropTypes.bool }; const Component$3 = styled.div``; const Container = styled.div` .animated { animation-duration: 1s; animation-fill-mode: both; } .animated.infinite { animation-iteration-count: infinite; } .animated.delay-1s { animation-delay: 1s; } .animated.delay-2s { animation-delay: 2s; } .animated.delay-3s { animation-delay: 3s; } .animated.delay-4s { animation-delay: 4s; } .animated.delay-5s { animation-delay: 5s; } .animated.fast { animation-duration: 800ms; } .animated.faster { animation-duration: 500ms; } .animated.slow { animation-duration: 2s; } .animated.slower { animation-duration: 3s; } @media (prefers-reduced-motion) { .animated { transition: none !important; animation: unset !important; } } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } } .fadeIn { animation-name: fadeIn; } @keyframes fadeInDown { from { opacity: 0; transform: translate3d(0, -100%, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInDown { animation-name: fadeInDown; } @keyframes fadeInLeft { from { opacity: 0; transform: translate3d(-100%, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInLeft { animation-name: fadeInLeft; } @keyframes fadeInRight { from { opacity: 0; transform: translate3d(100%, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInRight { animation-name: fadeInRight; } @keyframes fadeInUp { from { opacity: 0; transform: translate3d(0, 100%, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInUp { animation-name: fadeInUp; } @keyframes fadeOut { from { opacity: 1; } to { opacity: 0; } } .fadeOut { animation-name: fadeOut; } @keyframes fadeOutDown { from { opacity: 1; } to { opacity: 0; transform: translate3d(0, 100%, 0); } } .fadeOutDown { animation-name: fadeOutDown; } @keyframes fadeOutLeft { from { opacity: 1; } to { opacity: 0; transform: translate3d(-100%, 0, 0); } } .fadeOutLeft { animation-name: fadeOutLeft; } @keyframes fadeOutRight { from { opacity: 1; } to { opacity: 0; transform: translate3d(100%, 0, 0); } } .fadeOutRight { animation-name: fadeOutRight; } @keyframes fadeOutUp { from { opacity: 1; } to { opacity: 0; transform: translate3d(0, -100%, 0); } } .fadeOutUp { animation-name: fadeOutUp; } /*! * animate.css -http://daneden.me/animate * Version - 3.7.0 * Licensed under the MIT license - http://opensource.org/licenses/MIT * * Copyright (c) 2018 Daniel Eden */ @keyframes bounce { from, 20%, 53%, 80%, to { transform: translate3d(0, 0, 0); animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } 40%, 43% { transform: translate3d(0, -30px, 0); animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); } 70% { transform: translate3d(0, -15px, 0); animation-timing-function: cubic-bezier(0.755, 0.05, 0.855, 0.06); } 90% { transform: translate3d(0, -4px, 0); } } .bounce { transform-origin: center bottom; animation-name: bounce; } @keyframes flash { from, 50%, to { opacity: 1; } 25%, 75% { opacity: 0; } } .flash { animation-name: flash; } @keyframes pulse { from { transform: scale3d(1, 1, 1); } 50% { transform: scale3d(1.05, 1.05, 1.05); } to { transform: scale3d(1, 1, 1); } } .pulse { animation-name: pulse; } @keyframes rubberBand { from { transform: scale3d(1, 1, 1); } 30% { transform: scale3d(1.25, 0.75, 1); } 40% { transform: scale3d(0.75, 1.25, 1); } 50% { transform: scale3d(1.15, 0.85, 1); } 65% { transform: scale3d(0.95, 1.05, 1); } 75% { transform: scale3d(1.05, 0.95, 1); } to { transform: scale3d(1, 1, 1); } } .rubberBand { animation-name: rubberBand; } @keyframes shake { from, to { transform: translate3d(0, 0, 0); } 10%, 30%, 50%, 70%, 90% { transform: translate3d(-10px, 0, 0); } 20%, 40%, 60%, 80% { transform: translate3d(10px, 0, 0); } } .shake { animation-name: shake; } @keyframes headShake { 0% { transform: translateX(0); } 6.5% { transform: translateX(-6px) rotateY(-9deg); } 18.5% { transform: translateX(5px) rotateY(7deg); } 31.5% { transform: translateX(-3px) rotateY(-5deg); } 43.5% { transform: translateX(2px) rotateY(3deg); } 50% { transform: translateX(0); } } .headShake { animation-name: headShake; animation-timing-function: ease-in-out; } @keyframes swing { 20% { transform: rotate3d(0, 0, 1, 15deg); } 40% { transform: rotate3d(0, 0, 1, -10deg); } 60% { transform: rotate3d(0, 0, 1, 5deg); } 80% { transform: rotate3d(0, 0, 1, -5deg); } to { transform: rotate3d(0, 0, 1, 0deg); } } .swing { transform-origin: top center; animation-name: swing; } @keyframes tada { from { transform: scale3d(1, 1, 1); } 10%, 20% { transform: scale3d(0.9, 0.9, 0.9) rotate3d(0, 0, 1, -3deg); } 30%, 50%, 70%, 90% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg); } 40%, 60%, 80% { transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg); } to { transform: scale3d(1, 1, 1); } } .tada { animation-name: tada; } @keyframes wobble { from { transform: translate3d(0, 0, 0); } 15% { transform: translate3d(-25%, 0, 0) rotate3d(0, 0, 1, -5deg); } 30% { transform: translate3d(20%, 0, 0) rotate3d(0, 0, 1, 3deg); } 45% { transform: translate3d(-15%, 0, 0) rotate3d(0, 0, 1, -3deg); } 60% { transform: translate3d(10%, 0, 0) rotate3d(0, 0, 1, 2deg); } 75% { transform: translate3d(-5%, 0, 0) rotate3d(0, 0, 1, -1deg); } to { transform: translate3d(0, 0, 0); } } .wobble { animation-name: wobble; } @keyframes jello { from, 11.1%, to { transform: translate3d(0, 0, 0); } 22.2% { transform: skewX(-12.5deg) skewY(-12.5deg); } 33.3% { transform: skewX(6.25deg) skewY(6.25deg); } 44.4% { transform: skewX(-3.125deg) skewY(-3.125deg); } 55.5% { transform: skewX(1.5625deg) skewY(1.5625deg); } 66.6% { transform: skewX(-0.78125deg) skewY(-0.78125deg); } 77.7% { transform: skewX(0.39063deg) skewY(0.39063deg); } 88.8% { transform: skewX(-0.19531deg) skewY(-0.19531deg); } } .jello { transform-origin: center; animation-name: jello; } @keyframes heartBeat { 0% { transform: scale(1); } 14% { transform: scale(1.3); } 28% { transform: scale(1); } 42% { transform: scale(1.3); } 70% { transform: scale(1); } } .heartBeat { animation-name: heartBeat; animation-duration: 1.3s; animation-timing-function: ease-in-out; } @keyframes bounceIn { from, 20%, 40%, 60%, 80%, to { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } 0% { opacity: 0; transform: scale3d(0.3, 0.3, 0.3); } 20% { transform: scale3d(1.1, 1.1, 1.1); } 40% { transform: scale3d(0.9, 0.9, 0.9); } 60% { opacity: 1; transform: scale3d(1.03, 1.03, 1.03); } 80% { transform: scale3d(0.97, 0.97, 0.97); } to { opacity: 1; transform: scale3d(1, 1, 1); } } .bounceIn { animation-name: bounceIn; animation-duration: 0.75s; } @keyframes bounceInDown { from, 60%, 75%, 90%, to { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } 0% { opacity: 0; transform: translate3d(0, -3000px, 0); } 60% { opacity: 1; transform: translate3d(0, 25px, 0); } 75% { transform: translate3d(0, -10px, 0); } 90% { transform: translate3d(0, 5px, 0); } to { transform: translate3d(0, 0, 0); } } .bounceInDown { animation-name: bounceInDown; } @keyframes bounceInLeft { from, 60%, 75%, 90%, to { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } 0% { opacity: 0; transform: translate3d(-3000px, 0, 0); } 60% { opacity: 1; transform: translate3d(25px, 0, 0); } 75% { transform: translate3d(-10px, 0, 0); } 90% { transform: translate3d(5px, 0, 0); } to { transform: translate3d(0, 0, 0); } } .bounceInLeft { animation-name: bounceInLeft; } @keyframes bounceInRight { from, 60%, 75%, 90%, to { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } from { opacity: 0; transform: translate3d(3000px, 0, 0); } 60% { opacity: 1; transform: translate3d(-25px, 0, 0); } 75% { transform: translate3d(10px, 0, 0); } 90% { transform: translate3d(-5px, 0, 0); } to { transform: translate3d(0, 0, 0); } } .bounceInRight { animation-name: bounceInRight; } @keyframes bounceInUp { from, 60%, 75%, 90%, to { animation-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1); } from { opacity: 0; transform: translate3d(0, 3000px, 0); } 60% { opacity: 1; transform: translate3d(0, -20px, 0); } 75% { transform: translate3d(0, 10px, 0); } 90% { transform: translate3d(0, -5px, 0); } to { transform: translate3d(0, 0, 0); } } .bounceInUp { animation-name: bounceInUp; } @keyframes bounceOut { 20% { transform: scale3d(0.9, 0.9, 0.9); } 50%, 55% { opacity: 1; transform: scale3d(1.1, 1.1, 1.1); } to { opacity: 0; transform: scale3d(0.3, 0.3, 0.3); } } .bounceOut { animation-name: bounceOut; animation-duration: 0.75s; } @keyframes bounceOutDown { 20% { transform: translate3d(0, 10px, 0); } 40%, 45% { opacity: 1; transform: translate3d(0, -20px, 0); } to { opacity: 0; transform: translate3d(0, 2000px, 0); } } .bounceOutDown { animation-name: bounceOutDown; } @keyframes bounceOutLeft { 20% { opacity: 1; transform: translate3d(20px, 0, 0); } to { opacity: 0; transform: translate3d(-2000px, 0, 0); } } .bounceOutLeft { animation-name: bounceOutLeft; } @keyframes bounceOutRight { 20% { opacity: 1; transform: translate3d(-20px, 0, 0); } to { opacity: 0; transform: translate3d(2000px, 0, 0); } } .bounceOutRight { animation-name: bounceOutRight; } @keyframes bounceOutUp { 20% { transform: translate3d(0, -10px, 0); } 40%, 45% { opacity: 1; transform: translate3d(0, 20px, 0); } to { opacity: 0; transform: translate3d(0, -2000px, 0); } } .bounceOutUp { animation-name: bounceOutUp; } @keyframes fadeInDownBig { from { opacity: 0; transform: translate3d(0, -2000px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInDownBig { animation-name: fadeInDownBig; } @keyframes fadeInLeftBig { from { opacity: 0; transform: translate3d(-2000px, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInLeftBig { animation-name: fadeInLeftBig; } @keyframes fadeInRightBig { from { opacity: 0; transform: translate3d(2000px, 0, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInRightBig { animation-name: fadeInRightBig; } @keyframes fadeInUpBig { from { opacity: 0; transform: translate3d(0, 2000px, 0); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .fadeInUpBig { animation-name: fadeInUpBig; } @keyframes fadeOutDownBig { from { opacity: 1; } to { opacity: 0; transform: translate3d(0, 2000px, 0); } } .fadeOutDownBig { animation-name: fadeOutDownBig; } @keyframes fadeOutLeftBig { from { opacity: 1; } to { opacity: 0; transform: translate3d(-2000px, 0, 0); } } .fadeOutLeftBig { animation-name: fadeOutLeftBig; } @keyframes fadeOutRightBig { from { opacity: 1; } to { opacity: 0; transform: translate3d(2000px, 0, 0); } } .fadeOutRightBig { animation-name: fadeOutRightBig; } @keyframes fadeOutUpBig { from { opacity: 1; } to { opacity: 0; transform: translate3d(0, -2000px, 0); } } .fadeOutUpBig { animation-name: fadeOutUpBig; } @keyframes flip { from { transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 0) rotate3d(0, 1, 0, -360deg); animation-timing-function: ease-out; } 40% { transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -190deg); animation-timing-function: ease-out; } 50% { transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 150px) rotate3d(0, 1, 0, -170deg); animation-timing-function: ease-in; } 80% { transform: perspective(400px) scale3d(0.95, 0.95, 0.95) translate3d(0, 0, 0) rotate3d(0, 1, 0, 0deg); animation-timing-function: ease-in; } to { transform: perspective(400px) scale3d(1, 1, 1) translate3d(0, 0, 0) rotate3d(0, 1, 0, 0deg); animation-timing-function: ease-in; } } .flip { backface-visibility: visible; animation-name: flip; } @keyframes flipInX { from { opacity: 0; transform: perspective(400px) rotate3d(1, 0, 0, 90deg); animation-timing-function: ease-in; } 40% { transform: perspective(400px) rotate3d(1, 0, 0, -20deg); animation-timing-function: ease-in; } 60% { opacity: 1; transform: perspective(400px) rotate3d(1, 0, 0, 10deg); } 80% { transform: perspective(400px) rotate3d(1, 0, 0, -5deg); } to { transform: perspective(400px); } } .flipInX { backface-visibility: visible; animation-name: flipInX; } @keyframes flipInY { from { opacity: 0; transform: perspective(400px) rotate3d(0, 1, 0, 90deg); animation-timing-function: ease-in; } 40% { transform: perspective(400px) rotate3d(0, 1, 0, -20deg); animation-timing-function: ease-in; } 60% { opacity: 1; transform: perspective(400px) rotate3d(0, 1, 0, 10deg); } 80% { transform: perspective(400px) rotate3d(0, 1, 0, -5deg); } to { transform: perspective(400px); } } .flipInY { backface-visibility: visible; animation-name: flipInY; } @keyframes flipOutX { from { transform: perspective(400px); } 30% { opacity: 1; transform: perspective(400px) rotate3d(1, 0, 0, -20deg); } to { opacity: 0; transform: perspective(400px) rotate3d(1, 0, 0, 90deg); } } .flipOutX { animation-name: flipOutX; animation-duration: 0.75s; backface-visibility: visible; } @keyframes flipOutY { from { transform: perspective(400px); } 30% { opacity: 1; transform: perspective(400px) rotate3d(0, 1, 0, -15deg); } to { opacity: 0; transform: perspective(400px) rotate3d(0, 1, 0, 90deg); } } .flipOutY { animation-name: flipOutY; animation-duration: 0.75s; backface-visibility: visible; } @keyframes lightSpeedIn { from { opacity: 0; transform: translate3d(100%, 0, 0) skewX(-30deg); } 60% { opacity: 1; transform: skewX(20deg); } 80% { transform: skewX(-5deg); } to { transform: translate3d(0, 0, 0); } } .lightSpeedIn { animation-name: lightSpeedIn; animation-timing-function: ease-out; } @keyframes lightSpeedOut { from { opacity: 1; } to { opacity: 0; transform: translate3d(100%, 0, 0) skewX(30deg); } } .lightSpeedOut { animation-name: lightSpeedOut; animation-timing-function: ease-in; } @keyframes rotateIn { from { opacity: 0; transform: rotate3d(0, 0, 1, -200deg); transform-origin: center; } to { opacity: 1; transform: translate3d(0, 0, 0); transform-origin: center; } } .rotateIn { animation-name: rotateIn; } @keyframes rotateInDownLeft { from { opacity: 0; transform: rotate3d(0, 0, 1, -45deg); transform-origin: left bottom; } to { opacity: 1; transform: translate3d(0, 0, 0); transform-origin: left bottom; } } .rotateInDownLeft { animation-name: rotateInDownLeft; } @keyframes rotateInDownRight { from { opacity: 0; transform: rotate3d(0, 0, 1, 45deg); transform-origin: right bottom; } to { opacity: 1; transform: translate3d(0, 0, 0); transform-origin: right bottom; } } .rotateInDownRight { animation-name: rotateInDownRight; } @keyframes rotateInUpLeft { from { opacity: 0; transform: rotate3d(0, 0, 1, 45deg); transform-origin: left bottom; } to { opacity: 1; transform: translate3d(0, 0, 0); transform-origin: left bottom; } } .rotateInUpLeft { animation-name: rotateInUpLeft; } @keyframes rotateInUpRight { from { opacity: 0; transform: rotate3d(0, 0, 1, -90deg); transform-origin: right bottom; } to { opacity: 1; transform: translate3d(0, 0, 0); transform-origin: right bottom; } } .rotateInUpRight { animation-name: rotateInUpRight; } @keyframes rotateOut { from { opacity: 1; transform-origin: center; } to { opacity: 0; transform: rotate3d(0, 0, 1, 200deg); transform-origin: center; } } .rotateOut { animation-name: rotateOut; } @keyframes rotateOutDownLeft { from { opacity: 1; transform-origin: left bottom; } to { opacity: 0; transform: rotate3d(0, 0, 1, 45deg); transform-origin: left bottom; } } .rotateOutDownLeft { animation-name: rotateOutDownLeft; } @keyframes rotateOutDownRight { from { opacity: 1; transform-origin: right bottom; } to { opacity: 0; transform: rotate3d(0, 0, 1, -45deg); transform-origin: right bottom; } } .rotateOutDownRight { animation-name: rotateOutDownRight; } @keyframes rotateOutUpLeft { from { opacity: 1; transform-origin: left bottom; } to { opacity: 0; transform: rotate3d(0, 0, 1, -45deg); transform-origin: left bottom; } } .rotateOutUpLeft { animation-name: rotateOutUpLeft; } @keyframes rotateOutUpRight { from { opacity: 1; transform-origin: right bottom; } to { opacity: 0; transform: rotate3d(0, 0, 1, 90deg); transform-origin: right bottom; } } .rotateOutUpRight { animation-name: rotateOutUpRight; } @keyframes hinge { 0% { transform-origin: top left; animation-timing-function: ease-in-out; } 20%, 60% { transform: rotate3d(0, 0, 1, 80deg); transform-origin: top left; animation-timing-function: ease-in-out; } 40%, 80% { opacity: 1; transform: rotate3d(0, 0, 1, 60deg); transform-origin: top left; animation-timing-function: ease-in-out; } to { opacity: 0; transform: translate3d(0, 700px, 0); } } .hinge { animation-name: hinge; animation-duration: 2s; } @keyframes jackInTheBox { from { opacity: 0; transform: scale(0.1) rotate(30deg); transform-origin: center bottom; } 50% { transform: rotate(-10deg); } 70% { transform: rotate(3deg); } to { opacity: 1; transform: scale(1); } } .jackInTheBox { animation-name: jackInTheBox; } @keyframes rollIn { from { opacity: 0; transform: translate3d(-100%, 0, 0) rotate3d(0, 0, 1, -120deg); } to { opacity: 1; transform: translate3d(0, 0, 0); } } .rollIn { animation-name: rollIn; } @keyframes rollOut { from { opacity: 1; } to { opacity: 0; transform: translate3d(100%, 0, 0) rotate3d(0, 0, 1, 120deg); } } .rollOut { animation-name: rollOut; } @keyframes zoomIn { from { opacity: 0; transform: scale3d(0.3, 0.3, 0.3); } 50% { opacity: 1; } } .zoomIn { animation-name: zoomIn; } @keyframes zoomInDown { from { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -1000px, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } 60% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomInDown { animation-name: zoomInDown; } @keyframes zoomInLeft { from { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(-1000px, 0, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } 60% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(10px, 0, 0); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomInLeft { animation-name: zoomInLeft; } @keyframes zoomInRight { from { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(1000px, 0, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } 60% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(-10px, 0, 0); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomInRight { animation-name: zoomInRight; } @keyframes zoomInUp { from { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 1000px, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } 60% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomInUp { animation-name: zoomInUp; } @keyframes zoomOut { from { opacity: 1; } 50% { opacity: 0; transform: scale3d(0.3, 0.3, 0.3); } to { opacity: 0; } } .zoomOut { animation-name: zoomOut; } @keyframes zoomOutDown { 40% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(0, -60px, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } to { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(0, 2000px, 0); transform-origin: center bottom; animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomOutDown { animation-name: zoomOutDown; } @keyframes zoomOutLeft { 40% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(42px, 0, 0); } to { opacity: 0; transform: scale(0.1) translate3d(-2000px, 0, 0); transform-origin: left center; } } .zoomOutLeft { animation-name: zoomOutLeft; } @keyframes zoomOutRight { 40% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(-42px, 0, 0); } to { opacity: 0; transform: scale(0.1) translate3d(2000px, 0, 0); transform-origin: right center; } } .zoomOutRight { animation-name: zoomOutRight; } @keyframes zoomOutUp { 40% { opacity: 1; transform: scale3d(0.475, 0.475, 0.475) translate3d(0, 60px, 0); animation-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19); } to { opacity: 0; transform: scale3d(0.1, 0.1, 0.1) translate3d(0, -2000px, 0); transform-origin: center bottom; animation-timing-function: cubic-bezier(0.175, 0.885, 0.32, 1); } } .zoomOutUp { animation-name: zoomOutUp; } @keyframes slideInDown { from { visibility: visible; transform: translate3d(0, -100%, 0); } to { transform: translate3d(0, 0, 0); } } .slideInDown { animation-name: slideInDown; } @keyframes slideInLeft { from { visibility: visible; transform: translate3d(-100%, 0, 0); } to { transform: translate3d(0, 0, 0); } } .slideInLeft { animation-name: slideInLeft; } @keyframes slideInRight { from { visibility: visible; transform: translate3d(100%, 0, 0); } to { transform: translate3d(0, 0, 0); } } .slideInRight { animation-name: slideInRight; } @keyframes slideInUp { from { visibility: visible; transform: translate3d(0, 100%, 0); } to { transform: translate3d(0, 0, 0); } } .slideInUp { animation-name: slideInUp; } @keyframes slideOutDown { from { transform: translate3d(0, 0, 0); } to { visibility: hidden; transform: translate3d(0, 100%, 0); } } .slideOutDown { animation-name: slideOutDown; } @keyframes slideOutLeft { from { transform: translate3d(0, 0, 0); } to { visibility: hidden; transform: translate3d(-100%, 0, 0); } } .slideOutLeft { animation-name: slideOutLeft; } @keyframes slideOutRight { from { transform: translate3d(0, 0, 0); } to { visibility: hidden; transform: translate3d(100%, 0, 0); } } .slideOutRight { animation-name: slideOutRight; } @keyframes slideOutUp { from { transform: translate3d(0, 0, 0); } to { visibility: hidden; transform: translate3d(0, -100%, 0); } } .slideOutUp { animation-name: slideOutUp; } `; const Animation = props => { const { tag, children, className, count = 1, delay, duration = 1, infinite, reveal = false, style, type, onAnimationStart, onAnimationIteration, onAnimationEnd, ...attributes } = props; const [isVisible, setIsVisible] = useState(!reveal); const [isRevealed, setIsRevealed] = useState(!reveal); const [iterationCount, setIterationCount] = useState(0); const elemRef = useRef(null); const getOffset = elem => { const box = elem.getBoundingClientRect(); const { body } = document; const docEl = document.documentElement; const scrollTop = window.pageYOffset || docEl.scrollTop || body.scrollTop; const clientTop = docEl.clientTop || body.clientTop || 0; return Math.round(box.top + scrollTop - clientTop); }; const updatePredicate = useCallback(() => { const currentRef = elemRef.current; if (!currentRef) { return; } const windowHeight = window.innerHeight; const scroll = window.scrollY; const docHeight = document.documentElement.offsetHeight; const topOffset = getOffset(currentRef); const bottomOffset = topOffset + currentRef.clientHeight; const isInView = windowHeight + scroll - 100 > topOffset && scroll < topOffset || windowHeight + scroll - 100 > bottomOffset && scroll < bottomOffset || windowHeight + scroll === docHeight && topOffset + 100 > docHeight; if (isInView) { setIsVisible(true); setIsRevealed(true); } else if (!isRevealed) { setIsVisible(false); } }, [isRevealed]); useEffect(() => { setIsVisible(!reveal); setIsRevealed(!reveal); }, [reveal]); useEffect(() => { if (!reveal) { return; } window.addEventListener("scroll", updatePredicate, { passive: true }); updatePredicate(); return () => { window.removeEventListener("scroll", updatePredicate); }; }, [reveal, updatePredicate]); const handleStart = () => { setIterationCount(prevValue => prevValue + 1); if (onAnimationStart) { onAnimationStart(); } }; const handleIteration = () => { setIterationCount(prevValue => prevValue + 1); if (onAnimationIteration) { onAnimationIteration(); } }; const handleEnd = () => { const nextCount = iterationCount + 1; setIterationCount(nextCount); if (onAnimationEnd && count === nextCount) { onAnimationEnd(); } }; const styleObject = { animationDuration: duration, animationDelay: delay, animationIterationCount: infinite ? "infinite" : count, visibility: isVisible ? "visible" : "hidden", animationName: type }; const hiddenStyles = { animationName: "none", visibility: "hidden" }; const getAllStyles = Object.assign(styleObject, style); const classes = classNames(isVisible && "animated", type && type, infinite && "infinite", className); return React.createElement(ThemeProvider, { theme: theme }, React.createElement(Container, null, React.createElement(Component$3, Object.assign({ as: tag, "data-test": "animation", className: classes, onAnimationEnd: handleEnd, onAnimationIteration: handleIteration, onAnimationStart: handleStart, ref: elemRef, style: isVisible && isRevealed ? getAllStyles : hiddenStyles }, attributes), children))); }; Animation.propTypes = { children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]), className: PropTypes.string, count: PropTypes.number, delay: PropTypes.string, duration: PropTypes.oneOfType([PropTypes.string, PropTypes.number]), infinite: PropTypes.bool, onAnimationEnd: PropTypes.func, onAnimationIteration: PropTypes.func, onAnimationStart: PropTypes.func, reveal: PropTypes.bool, style: PropTypes.node, tag: PropTypes.oneOfType([PropTypes.func, PropTypes.string]), type: PropTypes.string }; Animation.defaultProps = { tag: "div", reveal: false, duration: 1, count: 1 }; const Component$4 = styled.span` display: flex; align-items: center; ${space} ${colorStyle} font-weight:200; box-shadow: ${props => props.flat ? null : "0 2px 5px 0 rgba(0, 0, 0, 0.16), 0 2px 10px 0 rgba(0, 0, 0, 0.12)"}; ${variant({ prop: "borderType", variants: { box: { borderRadius: "0px" }, pill: { borderRadius: "20px" } } })}; ${variant({ prop: "size", variants: { large: { padding: "8.75px 15px", fontSize: "1rem" }, medium: { padding: "6.25px 8.75px", fontSize: "0.85rem" }, small: { padding: "4px 6px", fontSize: "0.625rem" } } })} .icon { ${variant({ prop: "size", variants: { large: { fontSize: "1rem", marginRight: "12px" }, medium: { fontSize: "0.85rem", marginRight: "10px" }, small: { fontSize: "0.625rem !important", marginRight: "7.5px" } } })} i { ${space} ${variant({ prop: "size", variants: { large: { fontSize: "1rem" }, medium: { fontSize: "0.85rem" }, small: { fontSize: "0.625rem !important" } } })} } } `; const Badge = props => { const { className, tag, color, intensity, children, icon, borderType, size, flat, ...attributes } = props; const badgeClasses = classNames(className); const badgeComponent = React.createElement(ThemeProvider, { theme: theme }, React.createElement(Component$4, Object.assign({ className: badgeClasses, role: "badge", as: tag, colors: color, borderType: borderType, size: size, flat: flat }, attributes), icon && React.createElement("span", { className: "icon" }, React.createElement("i", { className: `fa fa-${icon}` })), children)); return badgeComponent; }; Badge.defaultProps = { tag: "span", color: "primary", borderType: "", size: "medium", intensity: "900" }; Badge.propTypes = { children: PropTypes.node, className: PropTypes.string, flat: PropTypes.bool, size: PropTypes.string, borderType: PropTypes.string, color: PropTypes.string, tag: PropTypes.string, intensity: PropTypes.oneOfType([PropTypes.oneOf([50, 100, 200, 300, 400, 500, 600, 700, 800, 900]), PropTypes.string]) }; const Component$5 = styled.div` ${space} ${color} `; const Box = props => { const { tag, className, children, display, justifyContent, flex, alignItems, alignContent, alignSelf, color, space, bgColor, m, mt, mr, mb, ml, mx, my, p, pt, pr, pb, pl, px, py, style, ...attributes } = props; const marginOrPadding = (props, suffix) => { if (props !== undefined) { return `${suffix}-${props}`; } }; const classes = classNames(display && `d-${display}`, justifyContent && `justify-content-${justifyContent}`, flex && `flex-${flex}`, alignItems && `align-items-${alignItems}`, alignContent && `align-content-${alignContent}`, alignSelf && `align-self-${alignSelf}`, color && `${color}-text`, bgColor && `bg-${bgColor}`, marginOrPadding(m, "m"), marginOrPadding(mt, "mt"), marginOrPadding(mr, "mr"), marginOrPadding(mb, "mb"), marginOrPadding(ml, "ml"), marginOrPadding(mx, "mx"), marginOrPadding(my, "my"), marginOrPadding(p, "p"), marginOrPadding(pt, "pt"), marginOrPadding(pr, "pr"), marginOrPadding(pb, "pb"), marginOrPadding(pl, "pl"), marginOrPadding(px, "px"), marginOrPadding(py, "py"), className); const isEmptyClass = classes !== "" ? classes : null; return React.createElement(ThemeProvider, { theme: theme }, React.createElement(Component$5, Object.assign({ as: tag, "data-test": "box" }, attributes, { className: isEmptyClass, color: color, space: space, style: style }), children)); }; Box.propTypes = { alignContent: PropTypes.string, alignItems: PropTypes.string, alignSelf: PropTypes.string, bgColor: PropTypes.string, children: PropTypes.node, className: PropTypes.string, color: PropTypes.string, display: PropTypes.string, flex: PropTypes.string, justifyContent: PropTypes.string, m: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), mb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), ml: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), mr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), mt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), mx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), my: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), p: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), pb: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), pl: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), pr: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), pt: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), px: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), py: PropTypes.oneOfType([PropTypes.number, PropTypes.string]), tag: PropTypes.string }; Box.defaultProps = { tag: "div" }; const Component$6 = styled.ol` ${colorStyle}; font-weight: ${props => props.bold ? 'bold' : props.light ? 'light' : null}; border-radius: ${props => props.circle ? '50%' : '0'}; text-transform: ${props => pr