@onepercentio/one-ui 0.28.8 → 0.29.0
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/utils/e2e.d.ts +13 -0
- package/dist/utils/e2e.js +42 -0
- package/package.json +4 -1
- package/src/assets/img/svg/checkbox.svg +3 -0
- package/src/assets/styles/index.scss +2 -0
- package/src/assets/styles/mixins.scss +12 -0
- package/src/assets/styles/variables.scss +49 -0
- package/src/components/AdaptiveButton/AdaptiveButton.module.scss +7 -0
- package/src/components/AdaptiveButton/AdaptiveButton.tsx +26 -0
- package/src/components/AdaptiveButton/index.tsx +1 -0
- package/src/components/AdaptiveContainer/AdaptiveContainer.module.scss +53 -0
- package/src/components/AdaptiveContainer/AdaptiveContainer.tsx +200 -0
- package/src/components/AdaptiveContainer/index.tsx +1 -0
- package/src/components/AdaptiveDialog/AdaptiveDialog.module.scss +147 -0
- package/src/components/AdaptiveDialog/AdaptiveDialog.tsx +97 -0
- package/src/components/AdaptiveDialog/index.tsx +1 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.module.scss +49 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.sample.tsx +10 -0
- package/src/components/AdaptiveSidebar/AdaptiveSidebar.tsx +123 -0
- package/src/components/AdaptiveSidebar/index.tsx +1 -0
- package/src/components/AnchoredTooltip/AnchoredTooltip.module.scss +64 -0
- package/src/components/AnchoredTooltip/AnchoredTooltip.tsx +250 -0
- package/src/components/AnchoredTooltip/index.tsx +1 -0
- package/src/components/AnimatedEntrance/AnimatedEntrance.module.scss +108 -0
- package/src/components/AnimatedEntrance/AnimatedEntrance.tsx +227 -0
- package/src/components/AnimatedEntrance/index.tsx +5 -0
- package/src/components/AsyncWrapper/AsyncWrapper.tsx +38 -0
- package/src/components/AsyncWrapper/index.tsx +1 -0
- package/src/components/Avatar/Avatar.module.scss +22 -0
- package/src/components/Avatar/Avatar.tsx +31 -0
- package/src/components/Avatar/index.tsx +1 -0
- package/src/components/BucketFill/BucketFill.module.scss +36 -0
- package/src/components/BucketFill/BucketFill.tsx +65 -0
- package/src/components/BucketFill/index.tsx +1 -0
- package/src/components/Button/Button.module.scss +45 -0
- package/src/components/Button/Button.tsx +40 -0
- package/src/components/Button/index.tsx +1 -0
- package/src/components/Card/Card.module.scss +12 -0
- package/src/components/Card/Card.tsx +9 -0
- package/src/components/Card/index.tsx +1 -0
- package/src/components/Chart/Chart.e2e.ts +4 -0
- package/src/components/Chart/Chart.logic.tsx +8 -0
- package/src/components/Chart/Chart.module.scss +58 -0
- package/src/components/Chart/Chart.types.ts +35 -0
- package/src/components/Chart/Chart.view.tsx +240 -0
- package/src/components/Chart/index.tsx +1 -0
- package/src/components/CheckBox/CheckBox.module.scss +36 -0
- package/src/components/CheckBox/CheckBox.tsx +63 -0
- package/src/components/CheckBox/index.tsx +1 -0
- package/src/components/CodeInput/CodeInput.module.scss +5 -0
- package/src/components/CodeInput/CodeInput.tsx +84 -0
- package/src/components/CodeInput/index.tsx +1 -0
- package/src/components/Collapsable/Collapsable.module.scss +42 -0
- package/src/components/Collapsable/Collapsable.tsx +253 -0
- package/src/components/Collapsable/index.tsx +1 -0
- package/src/components/Countdown/Countdown.tsx +130 -0
- package/src/components/Countdown/index.tsx +1 -0
- package/src/components/CurrencyInput/CurrencyInput.hook.ts +37 -0
- package/src/components/CurrencyInput/CurrencyInput.tsx +25 -0
- package/src/components/CurrencyInput/index.tsx +1 -0
- package/src/components/Divider/Divider.module.scss +7 -0
- package/src/components/Divider/Divider.tsx +13 -0
- package/src/components/Divider/index.tsx +1 -0
- package/src/components/EmailInput/EmailInput.module.scss +0 -0
- package/src/components/EmailInput/EmailInput.tsx +51 -0
- package/src/components/EmailInput/index.tsx +1 -0
- package/src/components/FadeIn/FadeIn.module.scss +9 -0
- package/src/components/FadeIn/FadeIn.tsx +77 -0
- package/src/components/FadeIn/index.tsx +1 -0
- package/src/components/FileInput/FileInput.module.scss +6 -0
- package/src/components/FileInput/FileInput.tsx +75 -0
- package/src/components/FileInput/View/BigFactory/BigFactory.module.scss +20 -0
- package/src/components/FileInput/View/BigFactory/BigFactory.tsx +48 -0
- package/src/components/FileInput/View/BigFactory/index.tsx +1 -0
- package/src/components/FileInput/View/Compact/Compact.module.scss +68 -0
- package/src/components/FileInput/View/Compact/Compact.tsx +151 -0
- package/src/components/FileInput/View/Compact/index.tsx +1 -0
- package/src/components/FileInput/View/View.types.ts +12 -0
- package/src/components/FileInput/index.tsx +1 -0
- package/src/components/FlowController/FlowController.module.scss +47 -0
- package/src/components/FlowController/FlowController.tsx +93 -0
- package/src/components/FlowController/index.tsx +1 -0
- package/src/components/Form/Form.tsx +243 -0
- package/src/components/Form/index.ts +1 -0
- package/src/components/Form/v2/Form.hook.ts +341 -0
- package/src/components/Form/v2/Form.module.scss +0 -0
- package/src/components/Form/v2/Form.tsx +78 -0
- package/src/components/Form/v2/Form.types.ts +118 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/DateField.tsx +73 -0
- package/src/components/Form/v2/FormField/Extensions/DateField/index.tsx +1 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.module.scss +0 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/PhoneField.tsx +91 -0
- package/src/components/Form/v2/FormField/Extensions/PhoneField/index.tsx +1 -0
- package/src/components/Form/v2/FormField/FormField.module.scss +0 -0
- package/src/components/Form/v2/FormField/FormField.tsx +378 -0
- package/src/components/Form/v2/FormField/FormField.types.ts +129 -0
- package/src/components/Form/v2/FormField/index.tsx +1 -0
- package/src/components/Form/v2/index.tsx +1 -0
- package/src/components/Freeze/Freeze.tsx +9 -0
- package/src/components/Freeze/index.tsx +1 -0
- package/src/components/HSForms/HSForms.tsx +57 -0
- package/src/components/HSForms/index.tsx +1 -0
- package/src/components/Header/Header.module.scss +119 -0
- package/src/components/Header/Header.tsx +138 -0
- package/src/components/Header/index.tsx +1 -0
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.module.scss +44 -0
- package/src/components/HeaderCloseBtn/HeaderCloseBtn.tsx +28 -0
- package/src/components/HeaderCloseBtn/index.tsx +1 -0
- package/src/components/InfinityScroll/InfinityScroll.module.scss +30 -0
- package/src/components/InfinityScroll/InfinityScroll.tsx +187 -0
- package/src/components/InfinityScroll/index.tsx +1 -0
- package/src/components/Input/Input.module.scss +71 -0
- package/src/components/Input/Input.tsx +134 -0
- package/src/components/Input/index.tsx +1 -0
- package/src/components/InstantCounter/InstantCounter.tsx +77 -0
- package/src/components/InstantCounter/index.tsx +1 -0
- package/src/components/LavaLamp/LavaLamp.data.tsx +114 -0
- package/src/components/LavaLamp/LavaLamp.module.scss +26 -0
- package/src/components/LavaLamp/LavaLamp.tsx +131 -0
- package/src/components/LavaLamp/index.tsx +1 -0
- package/src/components/LavaLamp/v2/LavaLamp.module.scss +23 -0
- package/src/components/LavaLamp/v2/LavaLamp.tsx +197 -0
- package/src/components/LinkToId/LinkToId.module.scss +4 -0
- package/src/components/LinkToId/LinkToId.tsx +51 -0
- package/src/components/LinkToId/index.tsx +1 -0
- package/src/components/Loader/Loader.module.scss +40 -0
- package/src/components/Loader/Loader.tsx +18 -0
- package/src/components/Loader/index.tsx +1 -0
- package/src/components/LoaderDotsIndicator/LoaderDotsIndicator.tsx +34 -0
- package/src/components/LoaderDotsIndicator/index.tsx +1 -0
- package/src/components/LoopableVideo/LoopableVideo.tsx +37 -0
- package/src/components/LoopableVideo/index.tsx +1 -0
- package/src/components/MainGrid/MainGrid.module.scss +28 -0
- package/src/components/MainGrid/MainGrid.tsx +68 -0
- package/src/components/MainGrid/index.tsx +1 -0
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.module.scss +220 -0
- package/src/components/MutableHamburgerButton/MutableHamburgerButton.tsx +38 -0
- package/src/components/MutableHamburgerButton/index.tsx +1 -0
- package/src/components/Notification/Notification.module.scss +25 -0
- package/src/components/Notification/Notification.tsx +13 -0
- package/src/components/Notification/index.tsx +1 -0
- package/src/components/OrderableList/OrderableList.module.scss +98 -0
- package/src/components/OrderableList/OrderableList.tsx +564 -0
- package/src/components/OrderableList/index.tsx +1 -0
- package/src/components/PaginationIndicator/PaginationIndicator.tsx +365 -0
- package/src/components/PaginationIndicator/index.tsx +1 -0
- package/src/components/Parallax/Parallax.module.scss +28 -0
- package/src/components/Parallax/Parallax.tsx +248 -0
- package/src/components/Parallax/index.tsx +1 -0
- package/src/components/Parallax/math/helpers.ts +289 -0
- package/src/components/PasswordInput/PasswordInput.module.scss +17 -0
- package/src/components/PasswordInput/PasswordInput.tsx +154 -0
- package/src/components/PasswordInput/index.tsx +1 -0
- package/src/components/PingPongText/PingPongText.module.scss +4 -0
- package/src/components/PingPongText/PingPongText.tsx +83 -0
- package/src/components/PingPongText/index.tsx +1 -0
- package/src/components/PixelatedScan/PixelatedScan.module.scss +86 -0
- package/src/components/PixelatedScan/PixelatedScan.tsx +175 -0
- package/src/components/PixelatedScan/index.tsx +1 -0
- package/src/components/Portal/Portal.module.scss +3 -0
- package/src/components/Portal/Portal.tsx +68 -0
- package/src/components/Portal/index.tsx +1 -0
- package/src/components/ProgressBar/ProgressBar.module.scss +44 -0
- package/src/components/ProgressBar/ProgressBar.tsx +124 -0
- package/src/components/ProgressBar/index.tsx +1 -0
- package/src/components/ProgressTexts/ProgressTexts.module.scss +37 -0
- package/src/components/ProgressTexts/ProgressTexts.tsx +85 -0
- package/src/components/ProgressTexts/index.tsx +1 -0
- package/src/components/Radio/Radio.module.scss +36 -0
- package/src/components/Radio/Radio.tsx +53 -0
- package/src/components/Radio/index.tsx +1 -0
- package/src/components/SectionContainer/SectionContainer.module.scss +30 -0
- package/src/components/SectionContainer/SectionContainer.tsx +49 -0
- package/src/components/SectionContainer/index.tsx +1 -0
- package/src/components/Select/Select.module.scss +58 -0
- package/src/components/Select/Select.tsx +192 -0
- package/src/components/Select/index.tsx +1 -0
- package/src/components/Skeleton/Skeleton.module.scss +21 -0
- package/src/components/Skeleton/Skeleton.tsx +29 -0
- package/src/components/Skeleton/index.tsx +1 -0
- package/src/components/Spacing/Spacing.module.scss +13 -0
- package/src/components/Spacing/Spacing.tsx +24 -0
- package/src/components/Spacing/index.tsx +1 -0
- package/src/components/StaticScroller/StaticScroller.module.scss +14 -0
- package/src/components/StaticScroller/StaticScroller.tsx +83 -0
- package/src/components/StaticScroller/index.tsx +1 -0
- package/src/components/Switch/Switch.module.scss +43 -0
- package/src/components/Switch/Switch.tsx +41 -0
- package/src/components/Switch/index.tsx +1 -0
- package/src/components/Table/Table.module.scss +76 -0
- package/src/components/Table/Table.tsx +152 -0
- package/src/components/Table/index.tsx +1 -0
- package/src/components/Tabs/Tabs.module.scss +40 -0
- package/src/components/Tabs/Tabs.tsx +104 -0
- package/src/components/Tabs/index.tsx +1 -0
- package/src/components/Text/Text.module.scss +81 -0
- package/src/components/Text/Text.tsx +42 -0
- package/src/components/Text/index.tsx +1 -0
- package/src/components/Transition/MasksFactory/DiagonalReveal.tsx +47 -0
- package/src/components/Transition/MasksFactory/DiagonalSquareToBalls.tsx +78 -0
- package/src/components/Transition/MasksFactory/PhysicsSquares.tsx +106 -0
- package/src/components/Transition/MasksFactory/SquareToBalls.tsx +66 -0
- package/src/components/Transition/MasksFactory/utils.ts +35 -0
- package/src/components/Transition/Transition.module.scss +211 -0
- package/src/components/Transition/Transition.tsx +495 -0
- package/src/components/Transition/index.tsx +1 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.ai.md +9 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.sample.tsx +34 -0
- package/src/components/UncontrolledTransition/UncontrolledTransition.tsx +143 -0
- package/src/components/UncontrolledTransition/index.tsx +2 -0
- package/src/components/WalletConnectionWrapper/WalletConnectionWrapper.tsx +212 -0
- package/src/components/WalletConnectionWrapper/index.tsx +1 -0
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.module.scss +5 -0
- package/src/components/utilitary/ScrollAndFocusLock/ScrollAndFocusLock.tsx +52 -0
- package/src/components/utilitary/ScrollAndFocusLock/index.tsx +1 -0
- package/src/context/AsyncProcess.tsx +107 -0
- package/src/context/ContextAsyncControl.tsx +89 -0
- package/src/context/CustomBrowserRouter.tsx +55 -0
- package/src/context/OneUIProvider.tsx +308 -0
- package/src/hooks/logs/useDependencyChangeDetection.ts +25 -0
- package/src/hooks/logs/useIsMounting.ts +7 -0
- package/src/hooks/persistence/useLocalStorage.ts +45 -0
- package/src/hooks/shims/ObjectWatchShim.ts +56 -0
- package/src/hooks/ui/useAdaptiveImage.tsx +36 -0
- package/src/hooks/ui/useAlternating.tsx +22 -0
- package/src/hooks/ui/useBreakpoint.tsx +21 -0
- package/src/hooks/ui/useCustomScrollbar.module.scss +20 -0
- package/src/hooks/ui/useCustomScrollbar.tsx +22 -0
- package/src/hooks/ui/useEffectIf.ts +11 -0
- package/src/hooks/ui/useMouseHover.tsx +26 -0
- package/src/hooks/ui/usePaginationControls.module.scss +16 -0
- package/src/hooks/ui/usePaginationControls.tsx +176 -0
- package/src/hooks/ui/useSnapToViewport.module.scss +6 -0
- package/src/hooks/ui/useSnapToViewport.ts +28 -0
- package/src/hooks/ui/useTilt.tsx +219 -0
- package/src/hooks/ui/useZoomable.module.scss +34 -0
- package/src/hooks/ui/useZoomable.tsx +144 -0
- package/src/hooks/useAsyncControl.ai.md +25 -0
- package/src/hooks/useAsyncControl.ts +101 -0
- package/src/hooks/useContainedRepositioning.ts +110 -0
- package/src/hooks/useCustomHistory.ts +14 -0
- package/src/hooks/useElementFit.ts +82 -0
- package/src/hooks/useFirestoreWatch.ts +54 -0
- package/src/hooks/useForm.ts +49 -0
- package/src/hooks/useFreeze.ts +12 -0
- package/src/hooks/useHero.module.scss +41 -0
- package/src/hooks/useHero.ts +512 -0
- package/src/hooks/useIntersection.ts +32 -0
- package/src/hooks/useMergeRefs.ts +29 -0
- package/src/hooks/useObserve.ts +24 -0
- package/src/hooks/usePagination.ts +228 -0
- package/src/hooks/usePooledOperation.ts +54 -0
- package/src/hooks/usePooling.ts +46 -0
- package/src/hooks/useRebound.ts +23 -0
- package/src/hooks/useShortIntl.ai.md +5 -0
- package/src/hooks/useShortIntl.ts +97 -0
- package/src/hooks/utility/useAsyncMemo.ts +43 -0
- package/src/hooks/utility/useDepChange.ts +11 -0
- package/src/hooks/utility/useEvents.ts +33 -0
- package/src/hooks/utility/useImmediate.ts +8 -0
- package/src/hooks/utility/useManualInit.ts +24 -0
- package/src/hooks/utility/useModule.ts +15 -0
- package/src/hooks/utility/useQuery.ts +15 -0
- package/src/hooks/utility/useUniqueEffect.ts +22 -0
- package/src/index.ts +3 -0
- package/src/models/DebugLogger.ts +7 -0
- package/src/models/GenericContract.ts +169 -0
- package/src/models/Orbs.ts +97 -0
- package/src/reac-app-env.d.ts +6 -0
- package/src/storybook/assets/video/txt-reversed.mp4 +0 -0
- package/src/storybookUtils/index.tsx +53 -0
- package/src/type-utils.ts +49 -0
- package/src/utility.d.ts +70 -0
- package/src/utils/blockchain.ts +43 -0
- package/src/utils/e2e.ts +52 -0
- package/src/utils/flatten.ts +17 -0
- package/src/utils/formatters.ts +36 -0
- package/src/utils/html.utils.ts +3 -0
- package/src/utils/ownEvent.ts +8 -0
- package/src/utils/test.ts +19 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Module from "module";
|
|
3
|
+
type PossibleT = (string | readonly [id: string, func: (n: number) => `${string}-${number}`])[];
|
|
4
|
+
type T<IDS extends PossibleT> = {
|
|
5
|
+
[I in IDS[number] extends string ? IDS[number] : IDS[number][0]]: I extends IDS[number] ? string : (id: any) => string;
|
|
6
|
+
};
|
|
7
|
+
export declare function combineTestIds(...t: ReturnType<typeof testIDFactory>[]): {};
|
|
8
|
+
/**
|
|
9
|
+
* Creates an data-testid map generator instance based on the module name or arbitrary id
|
|
10
|
+
* @returns A function to set the IDs that this created instance will provide
|
|
11
|
+
*/
|
|
12
|
+
export declare function testIDFactory(moduleOrId: Pick<Module, "id"> | string): <const IDS extends PossibleT>(...idsArr: IDS[]) => T<IDS>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.combineTestIds = combineTestIds;
|
|
7
|
+
exports.testIDFactory = testIDFactory;
|
|
8
|
+
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
9
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
10
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
11
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
|
12
|
+
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
13
|
+
function toSrcPath(str) {
|
|
14
|
+
const indexOfSrc = str.indexOf("src");
|
|
15
|
+
const modName = indexOfSrc === -1 ? str : str.slice(indexOfSrc);
|
|
16
|
+
return modName.replace("appclientecmascript", "");
|
|
17
|
+
}
|
|
18
|
+
function combineTestIds() {
|
|
19
|
+
for (var _len = arguments.length, t = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
20
|
+
t[_key] = arguments[_key];
|
|
21
|
+
}
|
|
22
|
+
return t.reduce((acc, i) => _objectSpread(_objectSpread({}, acc), {}, {
|
|
23
|
+
i
|
|
24
|
+
}), {});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates an data-testid map generator instance based on the module name or arbitrary id
|
|
29
|
+
* @returns A function to set the IDs that this created instance will provide
|
|
30
|
+
*/
|
|
31
|
+
function testIDFactory(moduleOrId) {
|
|
32
|
+
const moduleId = typeof module === "string" ? module : module.id;
|
|
33
|
+
return function () {
|
|
34
|
+
for (var _len2 = arguments.length, idsArr = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
35
|
+
idsArr[_key2] = arguments[_key2];
|
|
36
|
+
}
|
|
37
|
+
return idsArr.reduce((acc, ids) => _objectSpread(_objectSpread({}, acc), ids.reduce((map, id) => _objectSpread(_objectSpread({}, map), {}, {
|
|
38
|
+
[typeof id === "string" ? id : id[0]]: typeof id === "string" ? "".concat(toSrcPath(moduleId.toLowerCase().replace(/[^a-z]/g, "")), "-").concat(id) : i => "".concat(toSrcPath(moduleId.toLowerCase().replace(/[^a-z]/g, "")), "-").concat(id[1](i))
|
|
39
|
+
}), {})), {});
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJuYW1lcyI6WyJ0b1NyY1BhdGgiLCJzdHIiLCJpbmRleE9mU3JjIiwiaW5kZXhPZiIsIm1vZE5hbWUiLCJzbGljZSIsInJlcGxhY2UiLCJjb21iaW5lVGVzdElkcyIsIl9sZW4iLCJhcmd1bWVudHMiLCJsZW5ndGgiLCJ0IiwiQXJyYXkiLCJfa2V5IiwicmVkdWNlIiwiYWNjIiwiaSIsIl9vYmplY3RTcHJlYWQiLCJ0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BQUN2QixPQUFPLENBQUMsU0FBUyxFQUFFLEVBQUUsQ0FDOUMsQ0FBQyxPQUFBc0IsTUFBQSxDQUFJTixFQUFFLENBQUMsQ0FBQyxDQUFDLENBQUNOLENBQUMsQ0FBQztJQUFFLEVBQ3ZCLEVBQ0YsQ0FBQyxDQUNILENBQUMsQ0FDRCxFQUNGLENBQUMsQ0FDSCxDQUFDO0VBQUE7QUFDTCIsImlnbm9yZUxpc3QiOltdfQ==
|
package/package.json
CHANGED
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@onepercentio/one-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.29.0",
|
|
4
4
|
"description": "A set of reusable components created through the development of Onepercent projects",
|
|
5
5
|
"repository": "git@github.com:onepercentio/one-ui.git",
|
|
6
6
|
"author": "Murilo Oliveira de Araujo <murilo.araujo@onepercent.io>",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"types": "./dist/index.d.ts",
|
|
9
9
|
"main": "./dist/index.ts",
|
|
10
|
+
"exports": {
|
|
11
|
+
"./*": "./src/*.ts"
|
|
12
|
+
},
|
|
10
13
|
"devDependencies": {
|
|
11
14
|
"@babel/cli": "^7.22.9",
|
|
12
15
|
"@babel/core": "^7.22.9",
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
$digitalBlue: var(--digital-blue, #558eff);
|
|
2
|
+
$mediumGray: var(--medium-gray, #bababa);
|
|
3
|
+
$lightGray: var(--light-gray, #d6d6d6);
|
|
4
|
+
$spaceBlue: var(--space-blue, #0f113a);
|
|
5
|
+
$warningRed: var(--warning-red, #e84b4b);
|
|
6
|
+
$sunsetPink: var(--sunset-pink, #ff3e7d);
|
|
7
|
+
$darkestGray: var(--darkest-gray, #727272);
|
|
8
|
+
$gray: var(--gray, #0f113a);
|
|
9
|
+
$success: var(--success, lightgreen);
|
|
10
|
+
$successDark: var(--success-dark, green);
|
|
11
|
+
$mainBackgroundColor: var(--bg-color, white);
|
|
12
|
+
$primaryColor: var(--primary-color, var(--digital-blue));
|
|
13
|
+
$elevation: var(--card-elevation, 0px 4px 10px rgba(0, 0, 0, 0.1));
|
|
14
|
+
|
|
15
|
+
$mainFontFamily: var(--main-font, Roboto);
|
|
16
|
+
$secondaryFontFamily: var(--second-font, Manrope);
|
|
17
|
+
|
|
18
|
+
$headerFillBackgroundColor: var(--header-background-color, $digitalBlue);
|
|
19
|
+
$headerBackgroundColor: var(--header-divider-bg-color, #467eea);
|
|
20
|
+
$headerTextColor: var(--header-text-color, #94b8ff);
|
|
21
|
+
$headerBrightColor: var(--header-bright-color, white);
|
|
22
|
+
|
|
23
|
+
$tableRowBgColor: var(--table-row-bg-color, white);
|
|
24
|
+
$tableRowBorderColor: var(--table-row-border-color, #bec1ca);
|
|
25
|
+
|
|
26
|
+
$buttonBorderRadius: var(--button-border-radius, 8px);
|
|
27
|
+
$buttonTextColor: var(--button-text-color, white);
|
|
28
|
+
|
|
29
|
+
$tooltipBackgroudColor: var(--tooltip-background-color, $digitalBlue);
|
|
30
|
+
|
|
31
|
+
$checkboxBaseColor: var(--checkbox-base-color, $digitalBlue);
|
|
32
|
+
|
|
33
|
+
$textDefaultColor: var(--text-default-color, $digitalBlue);
|
|
34
|
+
|
|
35
|
+
$buttonPrimaryBackgroundColor: var(--button-primary-bg-color, #1e22aa);
|
|
36
|
+
|
|
37
|
+
$fileInputBackgroundColor: var(--file-input-bg-color, #f2f6f7);
|
|
38
|
+
$fileInputBorderColor: var(--file-input-border-color, #dce1e8);
|
|
39
|
+
|
|
40
|
+
$avatarBackgroundColor: var(--avatar-bg-color, $lightGray);
|
|
41
|
+
|
|
42
|
+
$pixelatedGuideBackground: var(--pixelated-scan-bg, var(--digital-blue));
|
|
43
|
+
|
|
44
|
+
$almostInstant: var(--animation--speed-almostInstant, 50ms);
|
|
45
|
+
$veryFast: var(--animation--speed-veryfast, 125ms);
|
|
46
|
+
$fast: var(--animation--speed-fast, 250ms);
|
|
47
|
+
$normal: var(--animation--speed-normal, 500ms);
|
|
48
|
+
$slow: var(--animation--speed-slow, 1s);
|
|
49
|
+
$verySlow: var(--animation--speed-veryslow, 2s);
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { ComponentProps, ReactElement } from "react";
|
|
2
|
+
import AdaptiveContainer from "../AdaptiveContainer";
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
import Styles from "./AdaptiveButton.module.scss";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* A button that adapts it's width according to the content size
|
|
8
|
+
**/
|
|
9
|
+
export default function AdaptiveButton({
|
|
10
|
+
children,
|
|
11
|
+
className = "",
|
|
12
|
+
...buttonProps
|
|
13
|
+
}: {
|
|
14
|
+
children: ReactElement;
|
|
15
|
+
} & ComponentProps<typeof Button>) {
|
|
16
|
+
return (
|
|
17
|
+
<AdaptiveContainer
|
|
18
|
+
containerElement={Button}
|
|
19
|
+
className={`${Styles.resetButton} ${className}`}
|
|
20
|
+
direction="both"
|
|
21
|
+
{...buttonProps}
|
|
22
|
+
>
|
|
23
|
+
{children}
|
|
24
|
+
</AdaptiveContainer>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AdaptiveButton';
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
.resetSection {
|
|
2
|
+
min-height: 0px;
|
|
3
|
+
transition: width var(--adaptive-container-transition-time, 400ms) linear,
|
|
4
|
+
height var(--adaptive-container-transition-time, 400ms) linear,
|
|
5
|
+
min-height var(--adaptive-container-transition-time, 400ms) linear;
|
|
6
|
+
transition-timing-function: linear;
|
|
7
|
+
overflow: hidden;
|
|
8
|
+
align-items: flex-start;
|
|
9
|
+
&.h,&.both {
|
|
10
|
+
> * {
|
|
11
|
+
min-width: auto !important;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
&.v,&.both {
|
|
15
|
+
> * {
|
|
16
|
+
min-height: initial;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
@keyframes fadeInDelayed {
|
|
22
|
+
0% {
|
|
23
|
+
opacity: 0;
|
|
24
|
+
}
|
|
25
|
+
50% {
|
|
26
|
+
opacity: 0.1;
|
|
27
|
+
}
|
|
28
|
+
100% {
|
|
29
|
+
opacity: 1;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
@keyframes fadeOutDelayed {
|
|
33
|
+
0% {
|
|
34
|
+
opacity: 1;
|
|
35
|
+
}
|
|
36
|
+
50% {
|
|
37
|
+
opacity: 0.1;
|
|
38
|
+
}
|
|
39
|
+
100% {
|
|
40
|
+
opacity: 0;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.fadeInDelayed {
|
|
45
|
+
animation-name: fadeInDelayed;
|
|
46
|
+
animation-duration: 500ms !important;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.fadeOutAbsolute {
|
|
50
|
+
position: absolute;
|
|
51
|
+
animation-name: fadeOutDelayed;
|
|
52
|
+
animation-duration: 500ms !important;
|
|
53
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
ComponentProps,
|
|
3
|
+
ElementRef,
|
|
4
|
+
FunctionComponent,
|
|
5
|
+
HTMLAttributes,
|
|
6
|
+
HTMLProps,
|
|
7
|
+
JSX,
|
|
8
|
+
ReactElement,
|
|
9
|
+
useEffect,
|
|
10
|
+
useMemo,
|
|
11
|
+
useRef,
|
|
12
|
+
} from "react";
|
|
13
|
+
import { TransitionAnimationTypes } from "../Transition";
|
|
14
|
+
import UncontrolledTransition from "../UncontrolledTransition";
|
|
15
|
+
import Styles from "./AdaptiveContainer.module.scss";
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* A container that animates width changes across content updates
|
|
19
|
+
**/
|
|
20
|
+
export default function AdaptiveContainer<
|
|
21
|
+
E extends keyof JSX.IntrinsicElements | FunctionComponent
|
|
22
|
+
>({
|
|
23
|
+
children,
|
|
24
|
+
className = "",
|
|
25
|
+
containerElement: _Wrapper = "div" as any,
|
|
26
|
+
direction = "h",
|
|
27
|
+
strict = true,
|
|
28
|
+
...otherProps
|
|
29
|
+
}: {
|
|
30
|
+
containerElement?: E;
|
|
31
|
+
children: ReactElement;
|
|
32
|
+
/**
|
|
33
|
+
* The direction in which the content will be resized
|
|
34
|
+
*
|
|
35
|
+
* "h" // When the content will change in width
|
|
36
|
+
* "v" // When the content will change in height
|
|
37
|
+
*/
|
|
38
|
+
direction?: "h" | "v" | "both";
|
|
39
|
+
className?: string;
|
|
40
|
+
contentClassName?: string;
|
|
41
|
+
/**
|
|
42
|
+
* true: It will animate restricting to the height when it was rendered
|
|
43
|
+
* false: It will animate trying to reach the height when it was rendered, growing in size if the content inside it changes */
|
|
44
|
+
strict?: boolean;
|
|
45
|
+
} & ComponentProps<E>) {
|
|
46
|
+
const animatedProperty = useMemo(() => {
|
|
47
|
+
if (!strict && direction !== "v")
|
|
48
|
+
throw new Error(
|
|
49
|
+
`Strict false only works with direction "v" at the moment`
|
|
50
|
+
);
|
|
51
|
+
switch (direction) {
|
|
52
|
+
case "both":
|
|
53
|
+
return ["width", "height"] as const
|
|
54
|
+
case "h":
|
|
55
|
+
return ("width" as const);
|
|
56
|
+
case "v":
|
|
57
|
+
return strict ? ("height" as const) : ("minHeight" as const);
|
|
58
|
+
}
|
|
59
|
+
}, [direction, strict]);
|
|
60
|
+
const uncontrolledRef =
|
|
61
|
+
useRef<ElementRef<typeof UncontrolledTransition>>(null);
|
|
62
|
+
const buttonRef = useRef<HTMLElement>(null);
|
|
63
|
+
|
|
64
|
+
useEffect(() => {
|
|
65
|
+
const transitionContainer = uncontrolledRef.current!.sectionRef.current;
|
|
66
|
+
if (transitionContainer)
|
|
67
|
+
if (direction === "both") {
|
|
68
|
+
transitionContainer.style.width = `${transitionContainer.clientWidth}px`;
|
|
69
|
+
transitionContainer.style.height = `${transitionContainer.clientHeight}px`;
|
|
70
|
+
} else if (direction === "h") {
|
|
71
|
+
transitionContainer.style.width = `${transitionContainer.clientWidth}px`;
|
|
72
|
+
transitionContainer.style[animatedProperty as "width"] = ``;
|
|
73
|
+
} else {
|
|
74
|
+
transitionContainer.style[
|
|
75
|
+
animatedProperty as "height"
|
|
76
|
+
] = `${transitionContainer.clientHeight}px`;
|
|
77
|
+
transitionContainer.style.width = ``;
|
|
78
|
+
}
|
|
79
|
+
const t = setTimeout(() => {
|
|
80
|
+
if (uncontrolledRef.current) {
|
|
81
|
+
const transitionContainer = uncontrolledRef.current.sectionRef.current;
|
|
82
|
+
if (transitionContainer) {
|
|
83
|
+
const screenThatWillEnter =
|
|
84
|
+
transitionContainer.lastChild as HTMLDivElement;
|
|
85
|
+
|
|
86
|
+
if (screenThatWillEnter) {
|
|
87
|
+
function resetFactory(
|
|
88
|
+
param: "minHeight" | "height" | "width",
|
|
89
|
+
target: number
|
|
90
|
+
) {
|
|
91
|
+
const resetPropertyInstance = (e: Pick<TransitionEvent, "propertyName">) => {
|
|
92
|
+
if (e.propertyName !== param) return;
|
|
93
|
+
setTimeout(() => {
|
|
94
|
+
if (transitionContainer?.style[param] === `${target}px`) {
|
|
95
|
+
transitionContainer!.style[param] = "";
|
|
96
|
+
}
|
|
97
|
+
}, 100);
|
|
98
|
+
|
|
99
|
+
if (transitionContainer)
|
|
100
|
+
transitionContainer.removeEventListener(
|
|
101
|
+
"transitionend",
|
|
102
|
+
resetPropertyInstance
|
|
103
|
+
);
|
|
104
|
+
};
|
|
105
|
+
return resetPropertyInstance;
|
|
106
|
+
}
|
|
107
|
+
if (direction === "both") {
|
|
108
|
+
const contentSize = {
|
|
109
|
+
width: screenThatWillEnter.clientWidth,
|
|
110
|
+
height: screenThatWillEnter.scrollHeight
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
const targetSize = {
|
|
114
|
+
width: `${contentSize.width}px`,
|
|
115
|
+
height: `${contentSize.height}px`
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
const prevSize = {
|
|
119
|
+
width: transitionContainer.style.width,
|
|
120
|
+
height: transitionContainer.style.height
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
transitionContainer.style.width = targetSize.width;
|
|
124
|
+
transitionContainer.style.height = targetSize.height;
|
|
125
|
+
|
|
126
|
+
if (Array.isArray(animatedProperty))
|
|
127
|
+
for (let prop of animatedProperty as ('width' | 'height')[]) {
|
|
128
|
+
const resetProperty = resetFactory(
|
|
129
|
+
prop,
|
|
130
|
+
contentSize[prop]
|
|
131
|
+
);
|
|
132
|
+
if (targetSize[prop] === prevSize[prop])
|
|
133
|
+
resetProperty({ propertyName: prop });
|
|
134
|
+
else
|
|
135
|
+
transitionContainer.addEventListener(
|
|
136
|
+
"transitionend",
|
|
137
|
+
resetProperty
|
|
138
|
+
);
|
|
139
|
+
}
|
|
140
|
+
} else if (direction === "h") {
|
|
141
|
+
const contentWidth = screenThatWillEnter.clientWidth;
|
|
142
|
+
const targetWidth = `${contentWidth}px`;
|
|
143
|
+
const prevWidth = transitionContainer.style.width;
|
|
144
|
+
transitionContainer.style.width = targetWidth;
|
|
145
|
+
const func = resetFactory("width", contentWidth);
|
|
146
|
+
if (targetWidth === prevWidth) func({ propertyName: "width" });
|
|
147
|
+
else transitionContainer.addEventListener("transitionend", func);
|
|
148
|
+
} else {
|
|
149
|
+
const _animatedProperty = animatedProperty as "width"
|
|
150
|
+
const contentHeight = screenThatWillEnter.scrollHeight;
|
|
151
|
+
const targetHeight = `${contentHeight}px`;
|
|
152
|
+
const prevHeight = transitionContainer.style[_animatedProperty];
|
|
153
|
+
transitionContainer.style[_animatedProperty] = targetHeight;
|
|
154
|
+
const resetProperty = resetFactory(
|
|
155
|
+
_animatedProperty,
|
|
156
|
+
contentHeight
|
|
157
|
+
);
|
|
158
|
+
if (targetHeight === prevHeight)
|
|
159
|
+
resetProperty({ propertyName: _animatedProperty });
|
|
160
|
+
else
|
|
161
|
+
transitionContainer.addEventListener(
|
|
162
|
+
"transitionend",
|
|
163
|
+
resetProperty
|
|
164
|
+
);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}, 100);
|
|
170
|
+
return () => clearTimeout(t);
|
|
171
|
+
}, [children.key, direction]);
|
|
172
|
+
const Wrapper = _Wrapper as any;
|
|
173
|
+
const directionClass = direction in Styles ? Styles[direction] : "";
|
|
174
|
+
|
|
175
|
+
return (
|
|
176
|
+
<>
|
|
177
|
+
<Wrapper className={`${className}`} ref={buttonRef} {...otherProps}>
|
|
178
|
+
<UncontrolledTransition
|
|
179
|
+
ref={uncontrolledRef}
|
|
180
|
+
transitionType={TransitionAnimationTypes.CUSTOM}
|
|
181
|
+
lockTransitionWidth={false}
|
|
182
|
+
config={{
|
|
183
|
+
backward: {
|
|
184
|
+
elementExiting: Styles.fadeOutAbsolute,
|
|
185
|
+
elementEntering: Styles.fadeInDelayed,
|
|
186
|
+
},
|
|
187
|
+
forward: {
|
|
188
|
+
elementExiting: Styles.fadeOutAbsolute,
|
|
189
|
+
elementEntering: Styles.fadeInDelayed,
|
|
190
|
+
},
|
|
191
|
+
}}
|
|
192
|
+
className={`${Styles.resetSection} ${directionClass}`}
|
|
193
|
+
contentClassName={otherProps.contentClassName}
|
|
194
|
+
>
|
|
195
|
+
{children}
|
|
196
|
+
</UncontrolledTransition>
|
|
197
|
+
</Wrapper>
|
|
198
|
+
</>
|
|
199
|
+
);
|
|
200
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './AdaptiveContainer';
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
@import "../../assets/styles/index.scss";
|
|
2
|
+
|
|
3
|
+
.backdrop {
|
|
4
|
+
position: fixed;
|
|
5
|
+
top: 0px;
|
|
6
|
+
left: 0px;
|
|
7
|
+
right: 0px;
|
|
8
|
+
bottom: 0px;
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
justify-content: center;
|
|
12
|
+
z-index: 1000;
|
|
13
|
+
transition: backdrop-filter $veryFast linear;
|
|
14
|
+
backdrop-filter: var(--adaptive-dialog-backdrop-backdrop, initial);
|
|
15
|
+
pointer-events: none;
|
|
16
|
+
|
|
17
|
+
@media screen and (orientation: "portrait") {
|
|
18
|
+
align-items: flex-end;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
.backdrop,
|
|
22
|
+
.container {
|
|
23
|
+
animation-duration: $fast;
|
|
24
|
+
animation-fill-mode: forwards;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.open {
|
|
28
|
+
&.backdrop {
|
|
29
|
+
animation-name: backdropAppear;
|
|
30
|
+
}
|
|
31
|
+
.container {
|
|
32
|
+
animation-name: reveal;
|
|
33
|
+
}
|
|
34
|
+
@media screen and (orientation: "portrait") {
|
|
35
|
+
.container {
|
|
36
|
+
animation-timing-function: ease-in-out;
|
|
37
|
+
animation-name: slideUp;
|
|
38
|
+
transform: translateY(100%);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.close {
|
|
44
|
+
&.backdrop {
|
|
45
|
+
animation-name: backdropDismiss;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.container {
|
|
49
|
+
animation-name: dismiss;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
@media screen and (orientation: "portrait") {
|
|
53
|
+
.container {
|
|
54
|
+
animation-name: slideDown;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.container {
|
|
60
|
+
> .closeBtn {
|
|
61
|
+
position: absolute;
|
|
62
|
+
right: 16px;
|
|
63
|
+
top: 16px;
|
|
64
|
+
background: none;
|
|
65
|
+
border: none;
|
|
66
|
+
width: auto;
|
|
67
|
+
height: auto;
|
|
68
|
+
padding: 0px !important;
|
|
69
|
+
}
|
|
70
|
+
padding: 16px 32px;
|
|
71
|
+
position: relative;
|
|
72
|
+
width: 100%;
|
|
73
|
+
max-width: 640px;
|
|
74
|
+
background: $mainBackgroundColor;
|
|
75
|
+
backdrop-filter: var(--adaptive-dialog-backdrop, initial);
|
|
76
|
+
display: flex;
|
|
77
|
+
align-items: center;
|
|
78
|
+
justify-content: center;
|
|
79
|
+
flex-direction: column;
|
|
80
|
+
max-height: 90% !important;
|
|
81
|
+
overscroll-behavior: contain;
|
|
82
|
+
@media screen and (orientation: "portrait") {
|
|
83
|
+
min-height: initial;
|
|
84
|
+
align-items: flex-start;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
@keyframes backdropAppear {
|
|
89
|
+
0% {
|
|
90
|
+
background-color: #0000;
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
100% {
|
|
94
|
+
background-color: #0005;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@keyframes backdropDismiss {
|
|
99
|
+
0% {
|
|
100
|
+
background-color: #0005;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
100% {
|
|
104
|
+
background-color: #0000;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
@keyframes reveal {
|
|
109
|
+
0% {
|
|
110
|
+
opacity: 0;
|
|
111
|
+
}
|
|
112
|
+
100% {
|
|
113
|
+
opacity: 1;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
@keyframes dismiss {
|
|
118
|
+
0% {
|
|
119
|
+
opacity: 1;
|
|
120
|
+
}
|
|
121
|
+
100% {
|
|
122
|
+
opacity: 0;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@keyframes slideUp {
|
|
127
|
+
0% {
|
|
128
|
+
min-height: 0px;
|
|
129
|
+
transform: translateY(100%);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
100% {
|
|
133
|
+
min-height: 0px;
|
|
134
|
+
transform: translateY(0%);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
@keyframes slideDown {
|
|
139
|
+
0% {
|
|
140
|
+
transform: translateY(0%);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
100% {
|
|
144
|
+
min-height: 0px;
|
|
145
|
+
transform: translateY(100%);
|
|
146
|
+
}
|
|
147
|
+
}
|