@fibery/ui-kit 1.0.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/index.ts +2 -0
- package/package.json +100 -0
- package/src/Button.d.ts +24 -0
- package/src/Button.js +361 -0
- package/src/FormFieldLoader.js +30 -0
- package/src/Item.tsx +127 -0
- package/src/Loaders.d.ts +16 -0
- package/src/Loaders.js +144 -0
- package/src/Select/components.js +64 -0
- package/src/Select/index.d.ts +11 -0
- package/src/Select/index.js +140 -0
- package/src/Select/lazy.js +35 -0
- package/src/Select/select-loader.tsx +8 -0
- package/src/Select/styles.js +133 -0
- package/src/ThemeProvider.tsx +14 -0
- package/src/create-inline-theme.ts +55 -0
- package/src/designSystem.ts +877 -0
- package/src/icons/Icon.tsx +56 -0
- package/src/icons/IconAsBackground.tsx +15 -0
- package/src/icons/IconAsPaths.ts +50 -0
- package/src/icons/ast/Activity.ts +8 -0
- package/src/icons/ast/ActivityLog.ts +8 -0
- package/src/icons/ast/Add.ts +8 -0
- package/src/icons/ast/AddCompact.ts +8 -0
- package/src/icons/ast/AddReactions.ts +8 -0
- package/src/icons/ast/AntdFilledCheckCircle.ts +8 -0
- package/src/icons/ast/AntdFilledCloseCircle.ts +8 -0
- package/src/icons/ast/AntdFilledExclamationCircle.ts +8 -0
- package/src/icons/ast/AntdFilledInfoCircle.ts +8 -0
- package/src/icons/ast/App.ts +8 -0
- package/src/icons/ast/AppDetails.ts +8 -0
- package/src/icons/ast/AppStore.ts +8 -0
- package/src/icons/ast/AppStoreOneColor.ts +8 -0
- package/src/icons/ast/AppTemplates.ts +8 -0
- package/src/icons/ast/AppTemplatesOneColor.ts +8 -0
- package/src/icons/ast/AppWebhooks.ts +8 -0
- package/src/icons/ast/AppWiki.ts +8 -0
- package/src/icons/ast/ArrowBottom.ts +8 -0
- package/src/icons/ast/ArrowCollapse.ts +8 -0
- package/src/icons/ast/ArrowCollapseVertical.ts +8 -0
- package/src/icons/ast/ArrowLeft.ts +8 -0
- package/src/icons/ast/ArrowRight.ts +8 -0
- package/src/icons/ast/ArrowTop.ts +8 -0
- package/src/icons/ast/AskForInput.ts +8 -0
- package/src/icons/ast/Back.ts +8 -0
- package/src/icons/ast/BacklogIcon.ts +8 -0
- package/src/icons/ast/BatchActionsIcon.ts +8 -0
- package/src/icons/ast/Cards.ts +8 -0
- package/src/icons/ast/Checked.ts +8 -0
- package/src/icons/ast/ClearValue.ts +8 -0
- package/src/icons/ast/Close.ts +8 -0
- package/src/icons/ast/ColorCoding.ts +8 -0
- package/src/icons/ast/Columns.ts +8 -0
- package/src/icons/ast/CopyUrl.ts +8 -0
- package/src/icons/ast/Database.ts +8 -0
- package/src/icons/ast/Delete.ts +8 -0
- package/src/icons/ast/Demo.ts +8 -0
- package/src/icons/ast/DoubleArrowLeft.ts +8 -0
- package/src/icons/ast/DoubleArrowRight.ts +8 -0
- package/src/icons/ast/DragBlockHandle.ts +8 -0
- package/src/icons/ast/DragHandle.ts +8 -0
- package/src/icons/ast/ExtensionAssignments.ts +8 -0
- package/src/icons/ast/ExtensionAvatar.ts +8 -0
- package/src/icons/ast/ExtensionComments.ts +8 -0
- package/src/icons/ast/ExtensionFiles.ts +8 -0
- package/src/icons/ast/ExtensionReferences.ts +8 -0
- package/src/icons/ast/ExtensionWorkflow.ts +8 -0
- package/src/icons/ast/Favorites.ts +8 -0
- package/src/icons/ast/FavoritesChecked.ts +8 -0
- package/src/icons/ast/FavoritesMenu.ts +8 -0
- package/src/icons/ast/Fields.ts +8 -0
- package/src/icons/ast/Filter.ts +8 -0
- package/src/icons/ast/FocusMode.ts +8 -0
- package/src/icons/ast/FocusModeOff.ts +8 -0
- package/src/icons/ast/Globe.ts +8 -0
- package/src/icons/ast/Hide.ts +8 -0
- package/src/icons/ast/Hint.ts +8 -0
- package/src/icons/ast/Home.ts +8 -0
- package/src/icons/ast/Integration.ts +8 -0
- package/src/icons/ast/InvitePeople.ts +8 -0
- package/src/icons/ast/Items.ts +8 -0
- package/src/icons/ast/LeftPanel.ts +8 -0
- package/src/icons/ast/Levels.ts +8 -0
- package/src/icons/ast/Lock.ts +8 -0
- package/src/icons/ast/MenuCollapser.ts +8 -0
- package/src/icons/ast/Milestones.ts +8 -0
- package/src/icons/ast/More.ts +8 -0
- package/src/icons/ast/MoreCompact.ts +8 -0
- package/src/icons/ast/MySpace.ts +8 -0
- package/src/icons/ast/Notifications.ts +8 -0
- package/src/icons/ast/ObjChild.ts +8 -0
- package/src/icons/ast/ObjM2M.ts +8 -0
- package/src/icons/ast/ObjO2O.ts +8 -0
- package/src/icons/ast/ObjParent.ts +8 -0
- package/src/icons/ast/ObjSelf.ts +8 -0
- package/src/icons/ast/OnSchedule.ts +8 -0
- package/src/icons/ast/OpenAsPage.ts +8 -0
- package/src/icons/ast/PageRegularMode.ts +8 -0
- package/src/icons/ast/PageWideMode.ts +8 -0
- package/src/icons/ast/Photo.ts +8 -0
- package/src/icons/ast/Popup.ts +8 -0
- package/src/icons/ast/Posts.ts +8 -0
- package/src/icons/ast/Remove.ts +8 -0
- package/src/icons/ast/Reply.ts +8 -0
- package/src/icons/ast/Restore.ts +8 -0
- package/src/icons/ast/RicheditorActionsMore.ts +8 -0
- package/src/icons/ast/RicheditorBlockCode.ts +8 -0
- package/src/icons/ast/RicheditorBlockEntity.ts +8 -0
- package/src/icons/ast/RicheditorBlockH1.ts +8 -0
- package/src/icons/ast/RicheditorBlockH2.ts +8 -0
- package/src/icons/ast/RicheditorBlockH3.ts +8 -0
- package/src/icons/ast/RicheditorBlockH4.ts +8 -0
- package/src/icons/ast/RicheditorBlockMention.ts +8 -0
- package/src/icons/ast/RicheditorBlockParagraph.ts +8 -0
- package/src/icons/ast/RicheditorBlockQuote.ts +8 -0
- package/src/icons/ast/RicheditorChecklistCreate.ts +8 -0
- package/src/icons/ast/RicheditorCommentCreate.ts +8 -0
- package/src/icons/ast/RicheditorEntityLinkCreate.ts +8 -0
- package/src/icons/ast/RicheditorHistoryRedo.ts +8 -0
- package/src/icons/ast/RicheditorHistoryUndo.ts +8 -0
- package/src/icons/ast/RicheditorImageAlignCenter.ts +8 -0
- package/src/icons/ast/RicheditorImageAlignLeft.ts +8 -0
- package/src/icons/ast/RicheditorImageAlignRight.ts +8 -0
- package/src/icons/ast/RicheditorImageUpload.ts +8 -0
- package/src/icons/ast/RicheditorImageWrapCenter.ts +8 -0
- package/src/icons/ast/RicheditorImageWrapLeft.ts +8 -0
- package/src/icons/ast/RicheditorImageWrapRight.ts +8 -0
- package/src/icons/ast/RicheditorImageZoom.ts +8 -0
- package/src/icons/ast/RicheditorLinkCreate.ts +8 -0
- package/src/icons/ast/RicheditorLinkedhighlightCreate.ts +8 -0
- package/src/icons/ast/RicheditorListBullet.ts +8 -0
- package/src/icons/ast/RicheditorListIndent.ts +8 -0
- package/src/icons/ast/RicheditorListOrdered.ts +8 -0
- package/src/icons/ast/RicheditorListUnindent.ts +8 -0
- package/src/icons/ast/RicheditorMarkCode.ts +8 -0
- package/src/icons/ast/RicheditorMarkEm.ts +8 -0
- package/src/icons/ast/RicheditorMarkHighlight.ts +8 -0
- package/src/icons/ast/RicheditorMarkStrike.ts +8 -0
- package/src/icons/ast/RicheditorMarkStrong.ts +8 -0
- package/src/icons/ast/RicheditorMarkUnderline.ts +8 -0
- package/src/icons/ast/RicheditorOpenLink.ts +8 -0
- package/src/icons/ast/RicheditorTableCreate.ts +8 -0
- package/src/icons/ast/RicheditorUnlink.ts +8 -0
- package/src/icons/ast/RicheditorVideoUpload.ts +8 -0
- package/src/icons/ast/RightPanel.ts +8 -0
- package/src/icons/ast/Rows.ts +8 -0
- package/src/icons/ast/Search.ts +8 -0
- package/src/icons/ast/SelfReferenceOff.ts +8 -0
- package/src/icons/ast/SelfReferenceOn.ts +8 -0
- package/src/icons/ast/Settings.ts +8 -0
- package/src/icons/ast/Share.ts +8 -0
- package/src/icons/ast/Shared.ts +8 -0
- package/src/icons/ast/Sidebar.ts +8 -0
- package/src/icons/ast/Slack.ts +8 -0
- package/src/icons/ast/SmartFolder.ts +8 -0
- package/src/icons/ast/Sort.ts +8 -0
- package/src/icons/ast/SortOnBottom.ts +8 -0
- package/src/icons/ast/SortOnTop.ts +8 -0
- package/src/icons/ast/Spinner.ts +8 -0
- package/src/icons/ast/TypeBoolean.ts +8 -0
- package/src/icons/ast/TypeButton.ts +8 -0
- package/src/icons/ast/TypeCheckbox.ts +8 -0
- package/src/icons/ast/TypeDate.ts +8 -0
- package/src/icons/ast/TypeEmail.ts +8 -0
- package/src/icons/ast/TypeEmoji.ts +8 -0
- package/src/icons/ast/TypeFormula.ts +8 -0
- package/src/icons/ast/TypeFunction.ts +8 -0
- package/src/icons/ast/TypeLookup.ts +8 -0
- package/src/icons/ast/TypeMoney.ts +8 -0
- package/src/icons/ast/TypeMultiSelect.ts +8 -0
- package/src/icons/ast/TypeNumber.ts +8 -0
- package/src/icons/ast/TypePercent.ts +8 -0
- package/src/icons/ast/TypePhone.ts +8 -0
- package/src/icons/ast/TypeRelation.ts +8 -0
- package/src/icons/ast/TypeRichText.ts +8 -0
- package/src/icons/ast/TypeRule.ts +8 -0
- package/src/icons/ast/TypeSingleSelect.ts +8 -0
- package/src/icons/ast/TypeText.ts +8 -0
- package/src/icons/ast/TypeUrl.ts +8 -0
- package/src/icons/ast/Upgrade.ts +8 -0
- package/src/icons/ast/ViewBoard.ts +8 -0
- package/src/icons/ast/ViewCalendar.ts +8 -0
- package/src/icons/ast/ViewCanvas.ts +8 -0
- package/src/icons/ast/ViewChart.ts +8 -0
- package/src/icons/ast/ViewDetails.ts +8 -0
- package/src/icons/ast/ViewDocument.ts +8 -0
- package/src/icons/ast/ViewFeed.ts +8 -0
- package/src/icons/ast/ViewList.ts +8 -0
- package/src/icons/ast/ViewPage.ts +8 -0
- package/src/icons/ast/ViewTable.ts +8 -0
- package/src/icons/ast/ViewTimeline.ts +8 -0
- package/src/icons/ast/Views.ts +8 -0
- package/src/icons/ast/Warning.ts +8 -0
- package/src/icons/ast/index.tsx +174 -0
- package/src/icons/generateIconFromAst.ts +29 -0
- package/src/icons/getIconContainerStyle.tsx +13 -0
- package/src/icons/getShiftStyle.ts +21 -0
- package/src/icons/react/Activity.tsx +12 -0
- package/src/icons/react/ActivityLog.tsx +12 -0
- package/src/icons/react/Add.tsx +12 -0
- package/src/icons/react/AddCompact.tsx +12 -0
- package/src/icons/react/AddReactions.tsx +12 -0
- package/src/icons/react/AntdFilledCheckCircle.tsx +12 -0
- package/src/icons/react/AntdFilledCloseCircle.tsx +12 -0
- package/src/icons/react/AntdFilledExclamationCircle.tsx +12 -0
- package/src/icons/react/AntdFilledInfoCircle.tsx +12 -0
- package/src/icons/react/App.tsx +12 -0
- package/src/icons/react/AppDetails.tsx +12 -0
- package/src/icons/react/AppStore.tsx +12 -0
- package/src/icons/react/AppStoreOneColor.tsx +12 -0
- package/src/icons/react/AppTemplates.tsx +12 -0
- package/src/icons/react/AppTemplatesOneColor.tsx +12 -0
- package/src/icons/react/AppWebhooks.tsx +12 -0
- package/src/icons/react/AppWiki.tsx +12 -0
- package/src/icons/react/ArrowBottom.tsx +12 -0
- package/src/icons/react/ArrowCollapse.tsx +12 -0
- package/src/icons/react/ArrowCollapseVertical.tsx +12 -0
- package/src/icons/react/ArrowLeft.tsx +12 -0
- package/src/icons/react/ArrowRight.tsx +12 -0
- package/src/icons/react/ArrowTop.tsx +12 -0
- package/src/icons/react/AskForInput.tsx +12 -0
- package/src/icons/react/Back.tsx +12 -0
- package/src/icons/react/BacklogIcon.tsx +12 -0
- package/src/icons/react/BatchActionsIcon.tsx +12 -0
- package/src/icons/react/Cards.tsx +12 -0
- package/src/icons/react/Checked.tsx +12 -0
- package/src/icons/react/ClearValue.tsx +12 -0
- package/src/icons/react/Close.tsx +12 -0
- package/src/icons/react/ColorCoding.tsx +12 -0
- package/src/icons/react/Columns.tsx +12 -0
- package/src/icons/react/CopyUrl.tsx +12 -0
- package/src/icons/react/Database.tsx +12 -0
- package/src/icons/react/Delete.tsx +12 -0
- package/src/icons/react/Demo.tsx +12 -0
- package/src/icons/react/DoubleArrowLeft.tsx +12 -0
- package/src/icons/react/DoubleArrowRight.tsx +12 -0
- package/src/icons/react/DragBlockHandle.tsx +12 -0
- package/src/icons/react/DragHandle.tsx +12 -0
- package/src/icons/react/ExtensionAssignments.tsx +12 -0
- package/src/icons/react/ExtensionAvatar.tsx +12 -0
- package/src/icons/react/ExtensionComments.tsx +12 -0
- package/src/icons/react/ExtensionFiles.tsx +12 -0
- package/src/icons/react/ExtensionReferences.tsx +12 -0
- package/src/icons/react/ExtensionWorkflow.tsx +12 -0
- package/src/icons/react/Favorites.tsx +12 -0
- package/src/icons/react/FavoritesChecked.tsx +12 -0
- package/src/icons/react/FavoritesMenu.tsx +12 -0
- package/src/icons/react/Fields.tsx +12 -0
- package/src/icons/react/Filter.tsx +12 -0
- package/src/icons/react/FocusMode.tsx +12 -0
- package/src/icons/react/FocusModeOff.tsx +12 -0
- package/src/icons/react/Globe.tsx +12 -0
- package/src/icons/react/Hide.tsx +12 -0
- package/src/icons/react/Hint.tsx +12 -0
- package/src/icons/react/Home.tsx +12 -0
- package/src/icons/react/Integration.tsx +12 -0
- package/src/icons/react/InvitePeople.tsx +12 -0
- package/src/icons/react/Items.tsx +12 -0
- package/src/icons/react/LeftPanel.tsx +12 -0
- package/src/icons/react/Levels.tsx +12 -0
- package/src/icons/react/Lock.tsx +12 -0
- package/src/icons/react/MenuCollapser.tsx +12 -0
- package/src/icons/react/Milestones.tsx +12 -0
- package/src/icons/react/More.tsx +12 -0
- package/src/icons/react/MoreCompact.tsx +12 -0
- package/src/icons/react/MySpace.tsx +12 -0
- package/src/icons/react/Notifications.tsx +12 -0
- package/src/icons/react/ObjChild.tsx +12 -0
- package/src/icons/react/ObjM2M.tsx +12 -0
- package/src/icons/react/ObjO2O.tsx +12 -0
- package/src/icons/react/ObjParent.tsx +12 -0
- package/src/icons/react/ObjSelf.tsx +12 -0
- package/src/icons/react/OnSchedule.tsx +12 -0
- package/src/icons/react/OpenAsPage.tsx +12 -0
- package/src/icons/react/PageRegularMode.tsx +12 -0
- package/src/icons/react/PageWideMode.tsx +12 -0
- package/src/icons/react/Photo.tsx +12 -0
- package/src/icons/react/Popup.tsx +12 -0
- package/src/icons/react/Posts.tsx +12 -0
- package/src/icons/react/Remove.tsx +12 -0
- package/src/icons/react/Reply.tsx +12 -0
- package/src/icons/react/Restore.tsx +12 -0
- package/src/icons/react/RicheditorActionsMore.tsx +12 -0
- package/src/icons/react/RicheditorBlockCode.tsx +12 -0
- package/src/icons/react/RicheditorBlockEntity.tsx +12 -0
- package/src/icons/react/RicheditorBlockH1.tsx +12 -0
- package/src/icons/react/RicheditorBlockH2.tsx +12 -0
- package/src/icons/react/RicheditorBlockH3.tsx +12 -0
- package/src/icons/react/RicheditorBlockH4.tsx +12 -0
- package/src/icons/react/RicheditorBlockMention.tsx +12 -0
- package/src/icons/react/RicheditorBlockParagraph.tsx +12 -0
- package/src/icons/react/RicheditorBlockQuote.tsx +12 -0
- package/src/icons/react/RicheditorChecklistCreate.tsx +12 -0
- package/src/icons/react/RicheditorCommentCreate.tsx +12 -0
- package/src/icons/react/RicheditorEntityLinkCreate.tsx +12 -0
- package/src/icons/react/RicheditorHistoryRedo.tsx +12 -0
- package/src/icons/react/RicheditorHistoryUndo.tsx +12 -0
- package/src/icons/react/RicheditorImageAlignCenter.tsx +12 -0
- package/src/icons/react/RicheditorImageAlignLeft.tsx +12 -0
- package/src/icons/react/RicheditorImageAlignRight.tsx +12 -0
- package/src/icons/react/RicheditorImageUpload.tsx +12 -0
- package/src/icons/react/RicheditorImageWrapCenter.tsx +12 -0
- package/src/icons/react/RicheditorImageWrapLeft.tsx +12 -0
- package/src/icons/react/RicheditorImageWrapRight.tsx +12 -0
- package/src/icons/react/RicheditorImageZoom.tsx +12 -0
- package/src/icons/react/RicheditorLinkCreate.tsx +12 -0
- package/src/icons/react/RicheditorLinkedhighlightCreate.tsx +12 -0
- package/src/icons/react/RicheditorListBullet.tsx +12 -0
- package/src/icons/react/RicheditorListIndent.tsx +12 -0
- package/src/icons/react/RicheditorListOrdered.tsx +12 -0
- package/src/icons/react/RicheditorListUnindent.tsx +12 -0
- package/src/icons/react/RicheditorMarkCode.tsx +12 -0
- package/src/icons/react/RicheditorMarkEm.tsx +12 -0
- package/src/icons/react/RicheditorMarkHighlight.tsx +12 -0
- package/src/icons/react/RicheditorMarkStrike.tsx +12 -0
- package/src/icons/react/RicheditorMarkStrong.tsx +12 -0
- package/src/icons/react/RicheditorMarkUnderline.tsx +12 -0
- package/src/icons/react/RicheditorOpenLink.tsx +12 -0
- package/src/icons/react/RicheditorTableCreate.tsx +12 -0
- package/src/icons/react/RicheditorUnlink.tsx +12 -0
- package/src/icons/react/RicheditorVideoUpload.tsx +12 -0
- package/src/icons/react/RightPanel.tsx +12 -0
- package/src/icons/react/Rows.tsx +12 -0
- package/src/icons/react/Search.tsx +12 -0
- package/src/icons/react/SelfReferenceOff.tsx +12 -0
- package/src/icons/react/SelfReferenceOn.tsx +12 -0
- package/src/icons/react/Settings.tsx +12 -0
- package/src/icons/react/Share.tsx +12 -0
- package/src/icons/react/Shared.tsx +12 -0
- package/src/icons/react/Sidebar.tsx +12 -0
- package/src/icons/react/Slack.tsx +12 -0
- package/src/icons/react/SmartFolder.tsx +12 -0
- package/src/icons/react/Sort.tsx +12 -0
- package/src/icons/react/SortOnBottom.tsx +12 -0
- package/src/icons/react/SortOnTop.tsx +12 -0
- package/src/icons/react/Spinner.tsx +12 -0
- package/src/icons/react/TypeBoolean.tsx +12 -0
- package/src/icons/react/TypeButton.tsx +12 -0
- package/src/icons/react/TypeCheckbox.tsx +12 -0
- package/src/icons/react/TypeDate.tsx +12 -0
- package/src/icons/react/TypeEmail.tsx +12 -0
- package/src/icons/react/TypeEmoji.tsx +12 -0
- package/src/icons/react/TypeFormula.tsx +12 -0
- package/src/icons/react/TypeFunction.tsx +12 -0
- package/src/icons/react/TypeLookup.tsx +12 -0
- package/src/icons/react/TypeMoney.tsx +12 -0
- package/src/icons/react/TypeMultiSelect.tsx +12 -0
- package/src/icons/react/TypeNumber.tsx +12 -0
- package/src/icons/react/TypePercent.tsx +12 -0
- package/src/icons/react/TypePhone.tsx +12 -0
- package/src/icons/react/TypeRelation.tsx +12 -0
- package/src/icons/react/TypeRichText.tsx +12 -0
- package/src/icons/react/TypeRule.tsx +12 -0
- package/src/icons/react/TypeSingleSelect.tsx +12 -0
- package/src/icons/react/TypeText.tsx +12 -0
- package/src/icons/react/TypeUrl.tsx +12 -0
- package/src/icons/react/Upgrade.tsx +12 -0
- package/src/icons/react/ViewBoard.tsx +12 -0
- package/src/icons/react/ViewCalendar.tsx +12 -0
- package/src/icons/react/ViewCanvas.tsx +12 -0
- package/src/icons/react/ViewChart.tsx +12 -0
- package/src/icons/react/ViewDetails.tsx +12 -0
- package/src/icons/react/ViewDocument.tsx +12 -0
- package/src/icons/react/ViewFeed.tsx +12 -0
- package/src/icons/react/ViewList.tsx +12 -0
- package/src/icons/react/ViewPage.tsx +12 -0
- package/src/icons/react/ViewTable.tsx +12 -0
- package/src/icons/react/ViewTimeline.tsx +12 -0
- package/src/icons/react/Views.tsx +12 -0
- package/src/icons/react/Warning.tsx +12 -0
- package/src/icons/react/index.tsx +174 -0
- package/src/icons/types.ts +29 -0
- package/src/loading-sausage.tsx +171 -0
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
import {css} from "@linaria/core";
|
|
2
|
+
import {styled} from "@linaria/react";
|
|
3
|
+
import cn from "classnames";
|
|
4
|
+
import _ from "lodash";
|
|
5
|
+
import {useRef, memo} from "react";
|
|
6
|
+
import {space, themeVars} from "./designSystem";
|
|
7
|
+
|
|
8
|
+
const getRandomWithSeed = _.memoize((seed: number) => {
|
|
9
|
+
const x = Math.sin(seed + 1) * 10000;
|
|
10
|
+
return x - Math.floor(x);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
export const getRandomInt = (min: number, max: number, seed?: number): number => {
|
|
14
|
+
const random = seed ? getRandomWithSeed(seed) : process.env.NODE_ENV === "test" ? 0.5 : Math.random();
|
|
15
|
+
return Math.floor(random * (max - min + 1)) + min;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
const blackGradient1 = `linear-gradient(90deg, ${themeVars.shades.opacity5} 0%, ${themeVars.shades.opacity10} 100%)`;
|
|
19
|
+
const blackGradient2 = `linear-gradient(90deg, ${themeVars.shades.opacity10} 0%, ${themeVars.shades.opacity5} 100%)`;
|
|
20
|
+
|
|
21
|
+
const whiteGradient1 = `linear-gradient(90deg, ${themeVars.lights.opacity5} 0%, ${themeVars.lights.opacity10} 100%)`;
|
|
22
|
+
const whiteGradient2 = `linear-gradient(90deg, ${themeVars.lights.opacity10} 0%, ${themeVars.lights.opacity5} 100%)`;
|
|
23
|
+
|
|
24
|
+
const loadingSausageStyle = css`
|
|
25
|
+
vertical-align: middle;
|
|
26
|
+
position: relative;
|
|
27
|
+
background: none;
|
|
28
|
+
|
|
29
|
+
&::before,
|
|
30
|
+
&::after {
|
|
31
|
+
content: "";
|
|
32
|
+
display: block;
|
|
33
|
+
position: absolute;
|
|
34
|
+
top: 0;
|
|
35
|
+
bottom: 0;
|
|
36
|
+
left: 0;
|
|
37
|
+
right: 0;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes OpacityAnim {
|
|
41
|
+
0% {
|
|
42
|
+
opacity: 1;
|
|
43
|
+
}
|
|
44
|
+
100% {
|
|
45
|
+
opacity: 0;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
&::before {
|
|
50
|
+
animation: OpacityAnim 2s ease-in-out 0s infinite alternate;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
&::after {
|
|
54
|
+
animation: OpacityAnim 2s ease-in-out -2s infinite alternate;
|
|
55
|
+
}
|
|
56
|
+
`;
|
|
57
|
+
|
|
58
|
+
const light = css`
|
|
59
|
+
&::before {
|
|
60
|
+
background-image: ${blackGradient1};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
&::after {
|
|
64
|
+
background-image: ${blackGradient2};
|
|
65
|
+
}
|
|
66
|
+
`;
|
|
67
|
+
|
|
68
|
+
const dark = css`
|
|
69
|
+
&::before {
|
|
70
|
+
background-image: ${whiteGradient1};
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
&::after {
|
|
74
|
+
background-image: ${whiteGradient2};
|
|
75
|
+
}
|
|
76
|
+
`;
|
|
77
|
+
|
|
78
|
+
const marginStyle = css`
|
|
79
|
+
${{
|
|
80
|
+
marginTop: space.xs,
|
|
81
|
+
marginBottom: space.xs,
|
|
82
|
+
}}
|
|
83
|
+
`;
|
|
84
|
+
|
|
85
|
+
const loadingSausageWithAnimatedAppearanceStyle = css`
|
|
86
|
+
@keyframes OpacityAnim {
|
|
87
|
+
0% {
|
|
88
|
+
opacity: 0;
|
|
89
|
+
}
|
|
90
|
+
100% {
|
|
91
|
+
opacity: 1;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
animation: OpacityAnim 1s cubic-bezier(0.95, 0.05, 0.795, 0.035) 1;
|
|
95
|
+
`;
|
|
96
|
+
|
|
97
|
+
const Container = styled.div<{height: number}>`
|
|
98
|
+
&::before,
|
|
99
|
+
&::after {
|
|
100
|
+
border-radius: ${(props) => `${props.height / 2}px`};
|
|
101
|
+
}
|
|
102
|
+
`;
|
|
103
|
+
|
|
104
|
+
type Props = {
|
|
105
|
+
minWidth?: number;
|
|
106
|
+
maxWidth?: number;
|
|
107
|
+
height?: number;
|
|
108
|
+
inverted?: boolean;
|
|
109
|
+
animateAppearance?: boolean;
|
|
110
|
+
margins?: boolean;
|
|
111
|
+
index?: number;
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
export const LoadingSausage = memo(function LoadingSausage({
|
|
115
|
+
minWidth = 80,
|
|
116
|
+
maxWidth = 120,
|
|
117
|
+
index,
|
|
118
|
+
height = 12,
|
|
119
|
+
inverted = false,
|
|
120
|
+
margins = true,
|
|
121
|
+
animateAppearance = false,
|
|
122
|
+
}: Props): JSX.Element {
|
|
123
|
+
const widthRef = useRef(getRandomInt(minWidth, maxWidth, index));
|
|
124
|
+
return (
|
|
125
|
+
<Container
|
|
126
|
+
height={height}
|
|
127
|
+
style={{width: widthRef.current, height}}
|
|
128
|
+
className={cn(
|
|
129
|
+
loadingSausageStyle,
|
|
130
|
+
inverted ? light : dark,
|
|
131
|
+
margins && marginStyle,
|
|
132
|
+
animateAppearance && loadingSausageWithAnimatedAppearanceStyle
|
|
133
|
+
)}
|
|
134
|
+
/>
|
|
135
|
+
);
|
|
136
|
+
});
|
|
137
|
+
|
|
138
|
+
type SausageListProps = {
|
|
139
|
+
amount?: number;
|
|
140
|
+
minAmount?: number;
|
|
141
|
+
maxAmount?: number;
|
|
142
|
+
WrapperComponent?: ({children}: {children: JSX.Element}) => JSX.Element;
|
|
143
|
+
} & Omit<Props, "index">;
|
|
144
|
+
export const LoadingSausageList = memo<SausageListProps>(function LoadingSausageList({
|
|
145
|
+
amount,
|
|
146
|
+
minAmount = 1,
|
|
147
|
+
maxAmount = 1,
|
|
148
|
+
WrapperComponent,
|
|
149
|
+
...restProps
|
|
150
|
+
}: SausageListProps) {
|
|
151
|
+
const calculatedAmount = amount || getRandomInt(minAmount, maxAmount);
|
|
152
|
+
const list = new Array(calculatedAmount).fill(null);
|
|
153
|
+
return (
|
|
154
|
+
<>
|
|
155
|
+
{list.map((_, index) => {
|
|
156
|
+
const style = {opacity: (calculatedAmount - index) / calculatedAmount};
|
|
157
|
+
return (
|
|
158
|
+
<div style={style} key={index}>
|
|
159
|
+
{WrapperComponent ? (
|
|
160
|
+
<WrapperComponent>
|
|
161
|
+
<LoadingSausage index={index + 1} {...restProps} />
|
|
162
|
+
</WrapperComponent>
|
|
163
|
+
) : (
|
|
164
|
+
<LoadingSausage index={index + 1} {...restProps} />
|
|
165
|
+
)}
|
|
166
|
+
</div>
|
|
167
|
+
);
|
|
168
|
+
})}
|
|
169
|
+
</>
|
|
170
|
+
);
|
|
171
|
+
});
|