@takaro/lib-components 0.0.0-next.0da151e
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/.babelrc +7 -0
- package/@types/files.d.ts +23 -0
- package/@types/react-table-config.d.ts +121 -0
- package/Dockerfile.dev +21 -0
- package/package.json +15 -0
- package/public/images/7-days-to-die/logo.png +0 -0
- package/public/images/csmm-icon.png +0 -0
- package/public/images/milk.png +0 -0
- package/public/images/placeholder-01.jpeg +0 -0
- package/public/images/placeholder-02.jpeg +0 -0
- package/public/images/placeholder-03.jpeg +0 -0
- package/public/images/rust/logo.png +0 -0
- package/readme.md +10 -0
- package/src/components/actions/Button/Button.stories.tsx +149 -0
- package/src/components/actions/Button/Button.test.tsx +8 -0
- package/src/components/actions/Button/Button.test.tsx.snap +89 -0
- package/src/components/actions/Button/__snapshots__/Button.test.tsx.snap +18 -0
- package/src/components/actions/Button/index.tsx +89 -0
- package/src/components/actions/Button/style.ts +142 -0
- package/src/components/actions/ContextMenu/ContextMenu.stories.tsx +41 -0
- package/src/components/actions/ContextMenu/Group.tsx +34 -0
- package/src/components/actions/ContextMenu/MenuItem.tsx +69 -0
- package/src/components/actions/ContextMenu/index.tsx +216 -0
- package/src/components/actions/Dropdown/Dropdown.stories.tsx +88 -0
- package/src/components/actions/Dropdown/DropdownContext.tsx +21 -0
- package/src/components/actions/Dropdown/DropdownMenu.tsx +70 -0
- package/src/components/actions/Dropdown/DropdownMenuGroup.tsx +37 -0
- package/src/components/actions/Dropdown/DropdownMenuItem.tsx +128 -0
- package/src/components/actions/Dropdown/DropdownTrigger.tsx +87 -0
- package/src/components/actions/Dropdown/index.tsx +22 -0
- package/src/components/actions/Dropdown/useDropdown.tsx +89 -0
- package/src/components/actions/DropdownButton/DropdownButton.stories.tsx +88 -0
- package/src/components/actions/DropdownButton/index.tsx +128 -0
- package/src/components/actions/IconButton/IconButton.stories.tsx +54 -0
- package/src/components/actions/IconButton/IconButton.test.tsx +8 -0
- package/src/components/actions/IconButton/IconButton.test.tsx.snap +46 -0
- package/src/components/actions/IconButton/__snapshots__/IconButton.test.tsx.snap +18 -0
- package/src/components/actions/IconButton/getIconSize.ts +16 -0
- package/src/components/actions/IconButton/index.tsx +28 -0
- package/src/components/actions/IconButton/style.ts +51 -0
- package/src/components/actions/ToggleButton/ToggleButton.stories.tsx +85 -0
- package/src/components/actions/ToggleButton/ToggleButton.tsx +48 -0
- package/src/components/actions/ToggleButton/ToggleButtonGroup.tsx +107 -0
- package/src/components/actions/ToggleButton/index.tsx +2 -0
- package/src/components/actions/ToggleButton/style.ts +75 -0
- package/src/components/actions/index.ts +16 -0
- package/src/components/charts/AreaChart/AreaChart.stories.tsx +103 -0
- package/src/components/charts/AreaChart/index.tsx +428 -0
- package/src/components/charts/BarChart/BarChart.stories.tsx +55 -0
- package/src/components/charts/BarChart/index.tsx +420 -0
- package/src/components/charts/BrushHandle.tsx +21 -0
- package/src/components/charts/EmptyChart.tsx +45 -0
- package/src/components/charts/GeoMercator/GeoMercator.stories.tsx +77 -0
- package/src/components/charts/GeoMercator/index.tsx +228 -0
- package/src/components/charts/GeoMercator/iso3166-alpha2-to-alpha3.ts +250 -0
- package/src/components/charts/GeoMercator/world.d.ts +1 -0
- package/src/components/charts/GeoMercator/world.json +99818 -0
- package/src/components/charts/Heatmap/Heatmap.stories.tsx +189 -0
- package/src/components/charts/Heatmap/index.tsx +461 -0
- package/src/components/charts/LineChart/LineChart.stories.tsx +111 -0
- package/src/components/charts/LineChart/index.tsx +353 -0
- package/src/components/charts/PieChart/PieChart.stories.tsx +151 -0
- package/src/components/charts/PieChart/index.tsx +457 -0
- package/src/components/charts/PointHighlight.tsx +49 -0
- package/src/components/charts/RadarChart/RadarChart.stories.tsx +47 -0
- package/src/components/charts/RadarChart/generators.ts +30 -0
- package/src/components/charts/RadarChart/index.tsx +224 -0
- package/src/components/charts/RadialBarChart/RadialBarChart.stories.tsx +59 -0
- package/src/components/charts/RadialBarChart/index.tsx +231 -0
- package/src/components/charts/RadialLineChart/RadialLineChart.stories.tsx +43 -0
- package/src/components/charts/RadialLineChart/index.tsx +231 -0
- package/src/components/charts/ZoomControls.tsx +49 -0
- package/src/components/charts/index.tsx +26 -0
- package/src/components/charts/useGradients.tsx +37 -0
- package/src/components/charts/util.ts +78 -0
- package/src/components/data/Avatar/Avatar.stories.tsx +93 -0
- package/src/components/data/Avatar/context.tsx +20 -0
- package/src/components/data/Avatar/index.tsx +136 -0
- package/src/components/data/Avatar/style.ts +124 -0
- package/src/components/data/Avatar/useImageLoadingStatus.tsx +32 -0
- package/src/components/data/Chip/Chip.stories.tsx +67 -0
- package/src/components/data/Chip/Chip.test.tsx +8 -0
- package/src/components/data/Chip/Chip.test.tsx.snap +50 -0
- package/src/components/data/Chip/__snapshots__/Chip.test.tsx.snap +38 -0
- package/src/components/data/Chip/index.tsx +67 -0
- package/src/components/data/Chip/style.ts +49 -0
- package/src/components/data/Console/Console.stories.tsx +51 -0
- package/src/components/data/Console/Console.tsx +125 -0
- package/src/components/data/Console/ConsoleInput/index.tsx +87 -0
- package/src/components/data/Console/ConsoleInput/style.ts +41 -0
- package/src/components/data/Console/ConsoleLine/index.tsx +127 -0
- package/src/components/data/Console/ConsoleLine/style.ts +76 -0
- package/src/components/data/Console/MessageModel.ts +9 -0
- package/src/components/data/Console/constants.ts +6 -0
- package/src/components/data/Console/index.tsx +4 -0
- package/src/components/data/Console/style.ts +31 -0
- package/src/components/data/Console/useConsoleLiveMode.ts +42 -0
- package/src/components/data/CopyId/CopyId.stories.tsx +36 -0
- package/src/components/data/CopyId/index.tsx +107 -0
- package/src/components/data/CountryList/index.tsx +146 -0
- package/src/components/data/DateFormatter/DateFormatter.stories.tsx +26 -0
- package/src/components/data/DateFormatter/index.tsx +15 -0
- package/src/components/data/Drawer/Drawer.stories.tsx +155 -0
- package/src/components/data/Drawer/DrawerBody.tsx +22 -0
- package/src/components/data/Drawer/DrawerContent.tsx +169 -0
- package/src/components/data/Drawer/DrawerContext.tsx +21 -0
- package/src/components/data/Drawer/DrawerFooter.tsx +19 -0
- package/src/components/data/Drawer/DrawerHeading.tsx +50 -0
- package/src/components/data/Drawer/DrawerSkeleton.tsx +29 -0
- package/src/components/data/Drawer/index.tsx +25 -0
- package/src/components/data/Drawer/useDrawer.tsx +66 -0
- package/src/components/data/InfiniteScroll/InfiniteScroll.stories.tsx +33 -0
- package/src/components/data/InfiniteScroll/index.tsx +54 -0
- package/src/components/data/Stats/Sparkline.tsx +48 -0
- package/src/components/data/Stats/Stat.tsx +192 -0
- package/src/components/data/Stats/Stats.stories.tsx +196 -0
- package/src/components/data/Stats/context.tsx +18 -0
- package/src/components/data/Stats/index.tsx +62 -0
- package/src/components/data/Table/Table.stories.tsx +146 -0
- package/src/components/data/Table/index.tsx +492 -0
- package/src/components/data/Table/react-table.d.ts +14 -0
- package/src/components/data/Table/style.ts +97 -0
- package/src/components/data/Table/subcomponents/ColumnHeader/ColumnSettings.tsx +164 -0
- package/src/components/data/Table/subcomponents/ColumnHeader/index.tsx +207 -0
- package/src/components/data/Table/subcomponents/ColumnHeader/style.ts +90 -0
- package/src/components/data/Table/subcomponents/ColumnVisibility/index.tsx +70 -0
- package/src/components/data/Table/subcomponents/Filter/field.tsx +127 -0
- package/src/components/data/Table/subcomponents/Filter/index.tsx +228 -0
- package/src/components/data/Table/subcomponents/Filter/style.ts +26 -0
- package/src/components/data/Table/subcomponents/Filter/types.ts +10 -0
- package/src/components/data/Table/subcomponents/Pagination/PagePicker.tsx +109 -0
- package/src/components/data/Table/subcomponents/Pagination/PageSizeSelect.tsx +37 -0
- package/src/components/data/Table/subcomponents/Pagination/style.ts +49 -0
- package/src/components/data/index.ts +28 -0
- package/src/components/dialogs/Dialog/Dialog.stories.tsx +77 -0
- package/src/components/dialogs/Dialog/DialogBody.tsx +64 -0
- package/src/components/dialogs/Dialog/DialogContent.tsx +44 -0
- package/src/components/dialogs/Dialog/DialogContext.tsx +21 -0
- package/src/components/dialogs/Dialog/DialogHeading.tsx +56 -0
- package/src/components/dialogs/Dialog/index.tsx +20 -0
- package/src/components/dialogs/Dialog/useDialog.tsx +50 -0
- package/src/components/feedback/Alert/Alert.stories.tsx +75 -0
- package/src/components/feedback/Alert/Alert.test.tsx +8 -0
- package/src/components/feedback/Alert/Alert.test.tsx.snap +146 -0
- package/src/components/feedback/Alert/__snapshots__/Alert.test.tsx.snap +44 -0
- package/src/components/feedback/Alert/index.tsx +120 -0
- package/src/components/feedback/Alert/style.ts +97 -0
- package/src/components/feedback/Badge/Badge.stories.tsx +23 -0
- package/src/components/feedback/Badge/index.tsx +47 -0
- package/src/components/feedback/ErrorFallback/ErrorFallback.stories.tsx +10 -0
- package/src/components/feedback/ErrorFallback/index.tsx +49 -0
- package/src/components/feedback/ErrorPage/ErrorPage.stories.tsx +31 -0
- package/src/components/feedback/ErrorPage/index.tsx +193 -0
- package/src/components/feedback/FormError/FormError.stories.tsx +25 -0
- package/src/components/feedback/FormError/index.tsx +54 -0
- package/src/components/feedback/IconTooltip/IconTooltip.stories.tsx +22 -0
- package/src/components/feedback/IconTooltip/index.tsx +51 -0
- package/src/components/feedback/Loaders/Loaders.stories.tsx +28 -0
- package/src/components/feedback/Loaders/Loading.test.tsx +8 -0
- package/src/components/feedback/Loaders/Loading.test.tsx.snap +141 -0
- package/src/components/feedback/Loaders/Loading.tsx +107 -0
- package/src/components/feedback/Loaders/Spinner.test.tsx +8 -0
- package/src/components/feedback/Loaders/Spinner.test.tsx.snap +18 -0
- package/src/components/feedback/Loaders/Spinner.tsx +74 -0
- package/src/components/feedback/Loaders/__snapshots__/Loading.test.tsx.snap +141 -0
- package/src/components/feedback/Loaders/__snapshots__/Spinner.test.tsx.snap +10 -0
- package/src/components/feedback/Loaders/index.ts +2 -0
- package/src/components/feedback/NetworkDetector/NetworkDetector.stories.tsx +21 -0
- package/src/components/feedback/NetworkDetector/NetworkDetector.test.tsx +8 -0
- package/src/components/feedback/NetworkDetector/NetworkDetector.test.tsx.snap +3 -0
- package/src/components/feedback/NetworkDetector/__snapshots__/NetworkDetector.test.tsx.snap +3 -0
- package/src/components/feedback/NetworkDetector/index.tsx +41 -0
- package/src/components/feedback/NotificationBanner/NotificationBanner.stories.tsx +13 -0
- package/src/components/feedback/NotificationBanner/NotificationBanner.test.tsx +15 -0
- package/src/components/feedback/NotificationBanner/NotificationBanner.test.tsx.snap +3 -0
- package/src/components/feedback/NotificationBanner/__snapshots__/NotificationBanner.test.tsx.snap +3 -0
- package/src/components/feedback/NotificationBanner/index.tsx +78 -0
- package/src/components/feedback/Popover/Popover.stories.tsx +33 -0
- package/src/components/feedback/Popover/PopoverContent.tsx +46 -0
- package/src/components/feedback/Popover/PopoverContext.tsx +21 -0
- package/src/components/feedback/Popover/PopoverTrigger.tsx +45 -0
- package/src/components/feedback/Popover/index.tsx +22 -0
- package/src/components/feedback/Popover/usePopover.tsx +87 -0
- package/src/components/feedback/ProgressBar/ProgressBar.stories.tsx +38 -0
- package/src/components/feedback/ProgressBar/index.tsx +137 -0
- package/src/components/feedback/Skeleton/Skeleton.stories.tsx +33 -0
- package/src/components/feedback/Skeleton/Skeleton.test.tsx +8 -0
- package/src/components/feedback/Skeleton/Skeleton.test.tsx.snap +35 -0
- package/src/components/feedback/Skeleton/__snapshots__/Skeleton.test.tsx.snap +9 -0
- package/src/components/feedback/Skeleton/index.tsx +62 -0
- package/src/components/feedback/Tooltip/Tooltip.stories.tsx +69 -0
- package/src/components/feedback/Tooltip/TooltipContent.tsx +51 -0
- package/src/components/feedback/Tooltip/TooltipContext.tsx +13 -0
- package/src/components/feedback/Tooltip/TooltipTrigger.tsx +39 -0
- package/src/components/feedback/Tooltip/index.tsx +26 -0
- package/src/components/feedback/Tooltip/useTooltip.tsx +82 -0
- package/src/components/feedback/index.ts +37 -0
- package/src/components/feedback/snacks/CookieConsent/index.tsx +125 -0
- package/src/components/feedback/snacks/CookieConsent/style.ts +99 -0
- package/src/components/feedback/snacks/Default/default.stories.tsx +73 -0
- package/src/components/feedback/snacks/Default/index.tsx +78 -0
- package/src/components/feedback/snacks/Default/style.ts +58 -0
- package/src/components/feedback/snacks/Drawer/Drawer.stories.tsx +46 -0
- package/src/components/feedback/snacks/Drawer/index.tsx +85 -0
- package/src/components/feedback/snacks/NetworkDetector/index.tsx +73 -0
- package/src/components/feedback/snacks/index.d.ts +15 -0
- package/src/components/feedback/snacks/index.ts +8 -0
- package/src/components/index.ts +9 -0
- package/src/components/inputs/CheckBox/CheckBox.stories.tsx +64 -0
- package/src/components/inputs/CheckBox/Controlled.tsx +123 -0
- package/src/components/inputs/CheckBox/Generic.tsx +42 -0
- package/src/components/inputs/CheckBox/index.tsx +4 -0
- package/src/components/inputs/CheckBox/style.ts +56 -0
- package/src/components/inputs/CodeField/CodeField.stories.tsx +86 -0
- package/src/components/inputs/CodeField/index.tsx +174 -0
- package/src/components/inputs/CodeField/style.ts +50 -0
- package/src/components/inputs/Date/DatePicker/Controlled.tsx +103 -0
- package/src/components/inputs/Date/DatePicker/DatePicker.stories.tsx +267 -0
- package/src/components/inputs/Date/DatePicker/Generic.tsx +283 -0
- package/src/components/inputs/Date/DatePicker/formats.tsx +32 -0
- package/src/components/inputs/Date/DatePicker/style.ts +41 -0
- package/src/components/inputs/Date/DateRangePicker/Context.tsx +123 -0
- package/src/components/inputs/Date/DateRangePicker/Controlled.tsx +74 -0
- package/src/components/inputs/Date/DateRangePicker/DateRangePicker.stories.tsx +37 -0
- package/src/components/inputs/Date/DateRangePicker/DateSelector/Absolute.tsx +98 -0
- package/src/components/inputs/Date/DateRangePicker/DateSelector/Relative.tsx +54 -0
- package/src/components/inputs/Date/DateRangePicker/DateSelector/index.tsx +49 -0
- package/src/components/inputs/Date/DateRangePicker/Generic.tsx +167 -0
- package/src/components/inputs/Date/DateRangePicker/QuickSelect/index.tsx +254 -0
- package/src/components/inputs/Date/DateRangePicker/QuickSelect/style.ts +40 -0
- package/src/components/inputs/Date/DateRangePicker/style.ts +65 -0
- package/src/components/inputs/Date/subcomponents/Calendar/index.tsx +150 -0
- package/src/components/inputs/Date/subcomponents/Calendar/style.ts +61 -0
- package/src/components/inputs/Date/subcomponents/RelativePicker/index.tsx +170 -0
- package/src/components/inputs/Date/subcomponents/RelativePicker/style.ts +50 -0
- package/src/components/inputs/Date/subcomponents/TimePicker/TimePicker.stories.tsx +25 -0
- package/src/components/inputs/Date/subcomponents/TimePicker/index.tsx +40 -0
- package/src/components/inputs/Date/subcomponents/TimePicker/style.ts +34 -0
- package/src/components/inputs/Date/types.ts +14 -0
- package/src/components/inputs/DurationField/Controlled.tsx +69 -0
- package/src/components/inputs/DurationField/Duration.stories.tsx +57 -0
- package/src/components/inputs/DurationField/Generic.tsx +197 -0
- package/src/components/inputs/DurationField/__tests__/Generic.test.tsx +12 -0
- package/src/components/inputs/DurationField/index.tsx +5 -0
- package/src/components/inputs/DurationField/style.ts +42 -0
- package/src/components/inputs/EditableField/EditableField.stories.tsx +65 -0
- package/src/components/inputs/EditableField/index.tsx +135 -0
- package/src/components/inputs/EditableField/style.ts +11 -0
- package/src/components/inputs/FileField/Controlled.tsx +104 -0
- package/src/components/inputs/FileField/FileField.stories.tsx +210 -0
- package/src/components/inputs/FileField/Generic.tsx +133 -0
- package/src/components/inputs/FileField/index.tsx +5 -0
- package/src/components/inputs/FileField/style.ts +34 -0
- package/src/components/inputs/InputProps.ts +59 -0
- package/src/components/inputs/RadioGroup/Controlled.tsx +45 -0
- package/src/components/inputs/RadioGroup/Generic.tsx +34 -0
- package/src/components/inputs/RadioGroup/RadioGroup.stories.tsx +118 -0
- package/src/components/inputs/RadioGroup/RadioItem.tsx +130 -0
- package/src/components/inputs/RadioGroup/context.tsx +20 -0
- package/src/components/inputs/RadioGroup/index.ts +5 -0
- package/src/components/inputs/RadioGroup/style.ts +3 -0
- package/src/components/inputs/Switch/Controlled.tsx +57 -0
- package/src/components/inputs/Switch/Generic.tsx +40 -0
- package/src/components/inputs/Switch/Switch.stories.tsx +89 -0
- package/src/components/inputs/Switch/index.ts +5 -0
- package/src/components/inputs/Switch/style.ts +62 -0
- package/src/components/inputs/TagField/Controlled.tsx +103 -0
- package/src/components/inputs/TagField/Generic.tsx +138 -0
- package/src/components/inputs/TagField/TagField.stories.tsx +68 -0
- package/src/components/inputs/TagField/index.ts +5 -0
- package/src/components/inputs/TagField/style.ts +25 -0
- package/src/components/inputs/TagField/util.ts +34 -0
- package/src/components/inputs/TextAreaField/Controlled.tsx +101 -0
- package/src/components/inputs/TextAreaField/Generic.tsx +58 -0
- package/src/components/inputs/TextAreaField/TextAreaField.stories.tsx +99 -0
- package/src/components/inputs/TextAreaField/index.ts +5 -0
- package/src/components/inputs/TextAreaField/style.ts +28 -0
- package/src/components/inputs/TextField/Controlled.tsx +120 -0
- package/src/components/inputs/TextField/Generic.tsx +138 -0
- package/src/components/inputs/TextField/TextField.stories.tsx +217 -0
- package/src/components/inputs/TextField/index.ts +5 -0
- package/src/components/inputs/TextField/style.ts +103 -0
- package/src/components/inputs/TextField/util.ts +24 -0
- package/src/components/inputs/ValueConfirmationField/ValueConfirmationField.stories.tsx +33 -0
- package/src/components/inputs/ValueConfirmationField/index.tsx +54 -0
- package/src/components/inputs/index.ts +72 -0
- package/src/components/inputs/layout/Description.tsx +33 -0
- package/src/components/inputs/layout/ErrorMessage/ErrorMessage.stories.tsx +28 -0
- package/src/components/inputs/layout/ErrorMessage/index.tsx +63 -0
- package/src/components/inputs/layout/InputWrapper.ts +6 -0
- package/src/components/inputs/layout/Label/index.tsx +71 -0
- package/src/components/inputs/layout/Label/style.ts +50 -0
- package/src/components/inputs/layout/index.ts +8 -0
- package/src/components/inputs/layout/setAriaDescribedBy.ts +3 -0
- package/src/components/inputs/selects/SelectField/Controlled.tsx +127 -0
- package/src/components/inputs/selects/SelectField/Generic/FilterInput.tsx +48 -0
- package/src/components/inputs/selects/SelectField/Generic/index.tsx +299 -0
- package/src/components/inputs/selects/SelectField/SelectField.stories.tsx +252 -0
- package/src/components/inputs/selects/SelectField/index.ts +5 -0
- package/src/components/inputs/selects/SelectField/style.ts +29 -0
- package/src/components/inputs/selects/SelectQueryField/Controlled.tsx +110 -0
- package/src/components/inputs/selects/SelectQueryField/Generic/index.tsx +401 -0
- package/src/components/inputs/selects/SelectQueryField/SelectQueryField.stories.tsx +280 -0
- package/src/components/inputs/selects/SelectQueryField/index.tsx +5 -0
- package/src/components/inputs/selects/SelectQueryField/style.ts +13 -0
- package/src/components/inputs/selects/SubComponents/Option.tsx +114 -0
- package/src/components/inputs/selects/SubComponents/OptionGroup.tsx +18 -0
- package/src/components/inputs/selects/SubComponents/index.ts +10 -0
- package/src/components/inputs/selects/SubComponents/style.ts +51 -0
- package/src/components/inputs/selects/data.ts +123 -0
- package/src/components/inputs/selects/index.tsx +49 -0
- package/src/components/inputs/selects/sharedStyle.ts +76 -0
- package/src/components/layout/Container/index.ts +21 -0
- package/src/components/layout/index.ts +1 -0
- package/src/components/navigation/HorizontalNav/HorizontalNav.stories.tsx +29 -0
- package/src/components/navigation/HorizontalNav/index.tsx +13 -0
- package/src/components/navigation/HorizontalNav/style.ts +93 -0
- package/src/components/navigation/IconNav/IconNav.stories.tsx +46 -0
- package/src/components/navigation/IconNav/index.tsx +50 -0
- package/src/components/navigation/Steppers/SlimStepper/Stepper.stories.tsx +90 -0
- package/src/components/navigation/Steppers/SlimStepper/index.tsx +104 -0
- package/src/components/navigation/Steppers/SlimStepper/style.ts +85 -0
- package/src/components/navigation/Steppers/Stepper/Stepper.stories.tsx +88 -0
- package/src/components/navigation/Steppers/Stepper/index.tsx +114 -0
- package/src/components/navigation/Steppers/Stepper/style.ts +106 -0
- package/src/components/navigation/Steppers/context.tsx +2 -0
- package/src/components/navigation/Steppers/provider.tsx +18 -0
- package/src/components/navigation/Steppers/reducer.ts +51 -0
- package/src/components/navigation/Steppers/stepStates.ts +5 -0
- package/src/components/navigation/Steppers/useStepper.ts +34 -0
- package/src/components/navigation/Tabs/Content.tsx +39 -0
- package/src/components/navigation/Tabs/Context.tsx +21 -0
- package/src/components/navigation/Tabs/List.tsx +17 -0
- package/src/components/navigation/Tabs/Tabs.stories.tsx +119 -0
- package/src/components/navigation/Tabs/Trigger.tsx +66 -0
- package/src/components/navigation/Tabs/index.tsx +35 -0
- package/src/components/navigation/Tabs/useTabs.tsx +28 -0
- package/src/components/navigation/index.ts +17 -0
- package/src/components/other/ActionMenu/ActionMenu.stories.tsx +81 -0
- package/src/components/other/ActionMenu/index.tsx +62 -0
- package/src/components/other/ActionMenu/style.ts +47 -0
- package/src/components/other/ClipBoard/ClipBoard.stories.tsx +14 -0
- package/src/components/other/ClipBoard/ClipBoard.test.tsx +8 -0
- package/src/components/other/ClipBoard/ClipBoard.test.tsx.snap +70 -0
- package/src/components/other/ClipBoard/__snapshots__/ClipBoard.test.tsx.snap +36 -0
- package/src/components/other/ClipBoard/index.tsx +70 -0
- package/src/components/other/CollapseList/CollapseList.stories.tsx +21 -0
- package/src/components/other/CollapseList/index.tsx +110 -0
- package/src/components/other/Collapsible/Collapsible.stories.tsx +19 -0
- package/src/components/other/Collapsible/CollapsibleContent.tsx +29 -0
- package/src/components/other/Collapsible/CollapsibleContext.tsx +17 -0
- package/src/components/other/Collapsible/CollapsibleTrigger.tsx +83 -0
- package/src/components/other/Collapsible/index.tsx +21 -0
- package/src/components/other/Company/index.tsx +44 -0
- package/src/components/other/Company/style.ts +58 -0
- package/src/components/other/Empty/Empty.stories.tsx +28 -0
- package/src/components/other/Empty/Empty.test.tsx +10 -0
- package/src/components/other/Empty/Empty.test.tsx.snap +85 -0
- package/src/components/other/Empty/__snapshots__/Empty.test.tsx.snap +21 -0
- package/src/components/other/Empty/index.tsx +85 -0
- package/src/components/other/PermissionsGuard/PermissionsGuard.stories.tsx +55 -0
- package/src/components/other/PermissionsGuard/hasPermissionsHelper.ts +18 -0
- package/src/components/other/PermissionsGuard/index.tsx +27 -0
- package/src/components/other/Plan/Plan.stories.tsx +21 -0
- package/src/components/other/Plan/index.tsx +92 -0
- package/src/components/other/Plan/style.ts +61 -0
- package/src/components/other/Usage/Usage.stories.tsx +21 -0
- package/src/components/other/Usage/Usage.tsx +35 -0
- package/src/components/other/Usage/UsageCard.stories.tsx +31 -0
- package/src/components/other/Usage/UsageCard.tsx +88 -0
- package/src/components/other/index.ts +27 -0
- package/src/components/visual/Card/Card.stories.tsx +22 -0
- package/src/components/visual/Card/CardBody.tsx +11 -0
- package/src/components/visual/Card/CardTitle.tsx +29 -0
- package/src/components/visual/Card/index.tsx +58 -0
- package/src/components/visual/Divider/Divider.stories.tsx +19 -0
- package/src/components/visual/Divider/Divider.test.tsx +8 -0
- package/src/components/visual/Divider/Divider.test.tsx.snap +35 -0
- package/src/components/visual/Divider/__snapshots__/Divider.test.tsx.snap +13 -0
- package/src/components/visual/Divider/index.tsx +88 -0
- package/src/components/visual/Flag/index.tsx +61 -0
- package/src/components/visual/index.ts +8 -0
- package/src/errors/base.ts +14 -0
- package/src/errors/errors.ts +126 -0
- package/src/errors/index.ts +14 -0
- package/src/helpers/camelCaseToSpaces.ts +5 -0
- package/src/helpers/formatNumber.ts +6 -0
- package/src/helpers/getInitials.ts +16 -0
- package/src/helpers/getSnackbarProvider.tsx +57 -0
- package/src/helpers/getTransition.ts +9 -0
- package/src/helpers/index.ts +6 -0
- package/src/helpers/makeData.ts +34 -0
- package/src/helpers/regexprs.ts +9 -0
- package/src/hooks/index.ts +9 -0
- package/src/hooks/useCallbackRef.tsx +17 -0
- package/src/hooks/useDebounce.tsx +22 -0
- package/src/hooks/useFocus.tsx +12 -0
- package/src/hooks/useLocalStorage.tsx +35 -0
- package/src/hooks/useLockScroll.ts +26 -0
- package/src/hooks/useOnScreen.ts +24 -0
- package/src/hooks/useOutsideAlerter.tsx +15 -0
- package/src/hooks/useTableActions.ts +61 -0
- package/src/hooks/useTheme.tsx +7 -0
- package/src/images/company-icon-primary.svg +3 -0
- package/src/images/company-icon-secondary.svg +3 -0
- package/src/images/index.ts +4 -0
- package/src/index.ts +9 -0
- package/src/stories/Colors.mdx +35 -0
- package/src/stories/Introduction.mdx +17 -0
- package/src/stories/Spacing.mdx +25 -0
- package/src/styled/GlobalStyle.ts +209 -0
- package/src/styled/Snackbar.tsx +41 -0
- package/src/styled/animations.ts +36 -0
- package/src/styled/breakpoint.ts +7 -0
- package/src/styled/device.ts +10 -0
- package/src/styled/index.ts +10 -0
- package/src/styled/spacing.ts +38 -0
- package/src/styled/theme.tsx +110 -0
- package/src/styled/types.ts +5 -0
- package/src/styled/zIndex.ts +31 -0
- package/src/test/__mocks__/fileMock.ts +2 -0
- package/src/test/setupTests.ts +3 -0
- package/src/test/snapshotResolver.js +21 -0
- package/src/test/testUtils.tsx +34 -0
- package/src/types/index.ts +1 -0
- package/src/types/json.ts +5 -0
- package/src/views/LoadingPage.tsx +36 -0
- package/src/views/index.ts +1 -0
- package/tsconfig.json +14 -0
- package/vite.config.mts +17 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { useEffect, useMemo, useRef } from 'react';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Source: RadixUI
|
|
5
|
+
* A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a
|
|
6
|
+
* prop or avoid re-executing effects when passed as a dependency
|
|
7
|
+
*/
|
|
8
|
+
export function useCallbackRef<T extends (...args: any[]) => any>(callback: T | undefined): T {
|
|
9
|
+
const callbackRef = useRef(callback);
|
|
10
|
+
|
|
11
|
+
useEffect(() => {
|
|
12
|
+
callbackRef.current = callback;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
// https://github.com/facebook/react/issues/19240
|
|
16
|
+
return useMemo(() => ((...args) => callbackRef.current?.(...args)) as T, []);
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useDebounce<T>(value: T, delay: number): T {
|
|
4
|
+
const [debouncedValue, setDebouncedValue] = useState(value);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const handler = setTimeout(() => {
|
|
8
|
+
setDebouncedValue(value);
|
|
9
|
+
}, delay);
|
|
10
|
+
|
|
11
|
+
/*
|
|
12
|
+
Cancel the timeout if value changes (also on delay change or unmount)
|
|
13
|
+
This is how we prevent debounced value from updating if value is changed
|
|
14
|
+
within the delay period. Timeout gets cleared and restarted.
|
|
15
|
+
*/
|
|
16
|
+
return (): void => {
|
|
17
|
+
clearTimeout(handler);
|
|
18
|
+
};
|
|
19
|
+
}, [value, delay]); // only recall if value or delay changes.
|
|
20
|
+
|
|
21
|
+
return debouncedValue;
|
|
22
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useLocalStorage<T>(key: string, initialValue: T) {
|
|
4
|
+
const [error, setError] = useState<DOMException | null>(null);
|
|
5
|
+
|
|
6
|
+
const [storedValue, setStoredValue] = useState<T>(() => {
|
|
7
|
+
try {
|
|
8
|
+
const item = window.localStorage.getItem(key);
|
|
9
|
+
return item ? JSON.parse(item) : initialValue;
|
|
10
|
+
} catch (e) {
|
|
11
|
+
console.error('Error reading the local storage value', e);
|
|
12
|
+
return initialValue;
|
|
13
|
+
}
|
|
14
|
+
});
|
|
15
|
+
|
|
16
|
+
const setValue = (value: T | ((prevValue: T) => T)): void => {
|
|
17
|
+
try {
|
|
18
|
+
setStoredValue((prevValue) => {
|
|
19
|
+
const valueToStore = value instanceof Function ? value(prevValue) : value;
|
|
20
|
+
window.localStorage.setItem(key, JSON.stringify(valueToStore));
|
|
21
|
+
return valueToStore;
|
|
22
|
+
});
|
|
23
|
+
} catch (e) {
|
|
24
|
+
// DOMException code 22 for QuotaExceededError
|
|
25
|
+
if (e instanceof DOMException && e.name === 'QuotaExceededError') {
|
|
26
|
+
console.error('LocalStorage quota exceeded', e);
|
|
27
|
+
setError(e);
|
|
28
|
+
} else {
|
|
29
|
+
console.error('Error setting the local storage value', e);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
return { storedValue, setValue, error };
|
|
35
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useLayoutEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useLockBodyScroll(lock = true): void {
|
|
4
|
+
useLayoutEffect(() => {
|
|
5
|
+
if (lock) {
|
|
6
|
+
const originalStyle = window.getComputedStyle(document.body).overflowY;
|
|
7
|
+
document.body.style.overflowY = 'hidden';
|
|
8
|
+
// Re-enable scrolling when component unmounts.
|
|
9
|
+
return (): void => {
|
|
10
|
+
document.body.style.overflowY = originalStyle;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
}, []); // Empty array ensures effect is only run on mount and unmount.
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function useLockRefScroll(ref: React.MutableRefObject<HTMLElement>): void {
|
|
17
|
+
useLayoutEffect(() => {
|
|
18
|
+
if (ref) {
|
|
19
|
+
const originalStyle = ref.current.style.overflow;
|
|
20
|
+
ref.current.style.overflow = 'hidden';
|
|
21
|
+
return (): any => {
|
|
22
|
+
ref.current.style.overflow = originalStyle;
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
}, [ref]);
|
|
26
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useOnScreen(ref: React.RefObject<any>, rootMargin = '0px'): boolean {
|
|
4
|
+
const [isIntersecting, setIntersecting] = useState(false);
|
|
5
|
+
|
|
6
|
+
useEffect(() => {
|
|
7
|
+
const observer = new IntersectionObserver(
|
|
8
|
+
([entry]) => {
|
|
9
|
+
setIntersecting(entry.isIntersecting);
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
rootMargin,
|
|
13
|
+
},
|
|
14
|
+
);
|
|
15
|
+
if (ref.current) {
|
|
16
|
+
observer.observe(ref.current);
|
|
17
|
+
}
|
|
18
|
+
return (): void => {
|
|
19
|
+
observer.unobserve(ref.current);
|
|
20
|
+
};
|
|
21
|
+
}, []);
|
|
22
|
+
|
|
23
|
+
return isIntersecting;
|
|
24
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { useEffect, RefObject, MutableRefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export function useOutsideAlerter(ref: RefObject<HTMLElement> | MutableRefObject<HTMLElement>, f: () => void): void {
|
|
4
|
+
useEffect(() => {
|
|
5
|
+
function handleClickOutside(event: any): void {
|
|
6
|
+
if (ref.current && !ref.current.contains(event.target)) {
|
|
7
|
+
f();
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
document.addEventListener('mousedown', handleClickOutside);
|
|
11
|
+
return (): void => {
|
|
12
|
+
document.removeEventListener('mousedown', handleClickOutside);
|
|
13
|
+
};
|
|
14
|
+
}, [ref]);
|
|
15
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { PaginationState, SortingState, RowSelectionState } from '@tanstack/react-table';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { APIOutput } from '@takaro/apiclient';
|
|
4
|
+
|
|
5
|
+
interface ExtendedAPIOutput<T> extends APIOutput {
|
|
6
|
+
data: T[];
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export interface PageOptions {
|
|
10
|
+
// amount of pages items are spread across
|
|
11
|
+
pageCount: number;
|
|
12
|
+
// total amount of items
|
|
13
|
+
total: number;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
interface TableActionOptions {
|
|
17
|
+
pageIndex?: number;
|
|
18
|
+
pageSize?: number;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export interface ColumnFilter {
|
|
22
|
+
id: string;
|
|
23
|
+
value: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
const DEFAULT_PAGE_SIZE = 10;
|
|
27
|
+
const DEFAULT_PAGE_INDEX = 0;
|
|
28
|
+
|
|
29
|
+
export function useTableActions<T>(
|
|
30
|
+
{ pageIndex, pageSize }: TableActionOptions = { pageIndex: DEFAULT_PAGE_INDEX, pageSize: DEFAULT_PAGE_SIZE },
|
|
31
|
+
) {
|
|
32
|
+
const [paginationState, setPaginationState] = useState<PaginationState>({
|
|
33
|
+
pageIndex: pageIndex ?? DEFAULT_PAGE_INDEX,
|
|
34
|
+
pageSize: pageSize ?? DEFAULT_PAGE_SIZE,
|
|
35
|
+
});
|
|
36
|
+
const [columnFiltersState, setColumnFiltersState] = useState<ColumnFilter[]>([]);
|
|
37
|
+
const [columnSearchState, setColumnSearchState] = useState<ColumnFilter[]>([]);
|
|
38
|
+
const [sortingState, setSortingState] = useState<SortingState>([]);
|
|
39
|
+
const [rowSelectionState, setRowSelectionState] = useState<RowSelectionState>({});
|
|
40
|
+
|
|
41
|
+
function getPageOptions(data: ExtendedAPIOutput<T>): PageOptions {
|
|
42
|
+
// we can use page 0 here because that data is the same for all pages
|
|
43
|
+
const limit = data.meta.limit!;
|
|
44
|
+
const total = data.meta.total!;
|
|
45
|
+
|
|
46
|
+
const pageCount = data.meta.total ? Math.ceil(total / limit) : Math.ceil(data.data.length / limit);
|
|
47
|
+
|
|
48
|
+
return {
|
|
49
|
+
pageCount,
|
|
50
|
+
total,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return {
|
|
55
|
+
pagination: { paginationState, setPaginationState, getPageOptions },
|
|
56
|
+
columnFilters: { columnFiltersState, setColumnFiltersState },
|
|
57
|
+
columnSearch: { columnSearchState, setColumnSearchState },
|
|
58
|
+
sorting: { sortingState, setSortingState },
|
|
59
|
+
rowSelection: { rowSelectionState, setRowSelectionState },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<path fill="#664DE5" d="M512 165.4c0 127.9-70.05 235.3-175.3 270.1c-20.04 7.938-41.83 12.46-64.69 12.46c-64.9 0-125.2-36.51-155.7-94.47c-54.13 49.93-68.71 107-68.96 108.1C44.72 472.6 34.87 480 24.02 480c-1.844 0-3.727-.2187-5.602-.6562c-12.89-3.098-20.84-16.08-17.75-28.96c9.598-39.5 90.47-226.4 335.3-226.4C344.8 224 352 216.8 352 208S344.8 192 336 192C228.6 192 151 226.6 96.29 267.6c.1934-10.82 1.242-21.84 3.535-33.05c13.47-65.81 66.04-119 131.4-134.2c28.33-6.562 55.68-6.013 80.93-.0054c56 13.32 118.2-7.412 149.3-61.24c5.664-9.828 20.02-9.516 24.66 .8282C502.7 76.76 512 121.9 512 165.4z"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
|
|
2
|
+
<path fill="#030917" d="M512 165.4c0 127.9-70.05 235.3-175.3 270.1c-20.04 7.938-41.83 12.46-64.69 12.46c-64.9 0-125.2-36.51-155.7-94.47c-54.13 49.93-68.71 107-68.96 108.1C44.72 472.6 34.87 480 24.02 480c-1.844 0-3.727-.2187-5.602-.6562c-12.89-3.098-20.84-16.08-17.75-28.96c9.598-39.5 90.47-226.4 335.3-226.4C344.8 224 352 216.8 352 208S344.8 192 336 192C228.6 192 151 226.6 96.29 267.6c.1934-10.82 1.242-21.84 3.535-33.05c13.47-65.81 66.04-119 131.4-134.2c28.33-6.562 55.68-6.013 80.93-.0054c56 13.32 118.2-7.412 149.3-61.24c5.664-9.828 20.02-9.516 24.66 .8282C502.7 76.76 512 121.9 512 165.4z"/>
|
|
3
|
+
</svg>
|
package/src/index.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export * from './components';
|
|
2
|
+
export * from './styled';
|
|
3
|
+
export * from './hooks';
|
|
4
|
+
export * from './helpers';
|
|
5
|
+
export * from './views';
|
|
6
|
+
export * as errors from './errors';
|
|
7
|
+
export * from './types';
|
|
8
|
+
export * from './images';
|
|
9
|
+
export * as testing from './test/testUtils';
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { Meta, ColorPalette, ColorItem } from '@storybook/blocks';
|
|
2
|
+
import { styled } from '../styled';
|
|
3
|
+
import { darkTheme as theme } from '../styled/theme';
|
|
4
|
+
|
|
5
|
+
<Meta title="Colors" />
|
|
6
|
+
|
|
7
|
+
# Colors
|
|
8
|
+
|
|
9
|
+
<ColorPalette>
|
|
10
|
+
<ColorItem title="theme.colors.primary" colors={[theme.colors.primary]} />
|
|
11
|
+
<ColorItem title="theme.colors.secondary" colors={[theme.colors.secondary]} />
|
|
12
|
+
|
|
13
|
+
## Alert colors
|
|
14
|
+
|
|
15
|
+
<ColorItem title="theme.colors.info" colors={[theme.colors.info]} />
|
|
16
|
+
<ColorItem title="theme.colors.success" colors={[theme.colors.success]} />
|
|
17
|
+
<ColorItem title="theme.colors.warning" colors={[theme.colors.warning]} />
|
|
18
|
+
<ColorItem title="theme.colors.error" colors={[theme.colors.error]} />
|
|
19
|
+
|
|
20
|
+
## backgrounds
|
|
21
|
+
|
|
22
|
+
<ColorItem title="theme.colors.background" colors={[theme.colors.background]} />
|
|
23
|
+
<ColorItem title="theme.colors.backgroundAlt" colors={[theme.colors.backgroundAlt]} />
|
|
24
|
+
<ColorItem title="theme.colors.backgroundAccent" colors={[theme.colors.backgroundAccent]} />
|
|
25
|
+
<ColorItem title="theme.colors.placeholder" colors={[theme.colors.placeholder]} />
|
|
26
|
+
<ColorItem title="theme.colors.placeholderHighlight" colors={[theme.colors.placeholderHighlight]} />
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
## Text
|
|
30
|
+
|
|
31
|
+
<ColorItem title="theme.colors.text" colors={[theme.colors.text]} />
|
|
32
|
+
<ColorItem title="theme.colors.textAlt" colors={[theme.colors.textAlt]} />
|
|
33
|
+
<ColorItem title="theme.colors.disabled" colors={[theme.colors.disabled]} />
|
|
34
|
+
|
|
35
|
+
</ColorPalette>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
|
|
3
|
+
<Meta title="Introduction" />
|
|
4
|
+
|
|
5
|
+
<style>{``}</style>
|
|
6
|
+
|
|
7
|
+
# Takaro UI library
|
|
8
|
+
|
|
9
|
+
Takaro UI is a component library custom made to used within the Takaro ecosystem.
|
|
10
|
+
|
|
11
|
+
## Roadmap
|
|
12
|
+
|
|
13
|
+
You can see what we have in mind at our projects page.
|
|
14
|
+
|
|
15
|
+
## Development
|
|
16
|
+
|
|
17
|
+
If you'd like to help us out with the project, we welcome contributions of all types! Check out our Contributing.md for more details on how you can help make Takaro UI even better!
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs';
|
|
2
|
+
import { spacing } from '../styled/spacing';
|
|
3
|
+
|
|
4
|
+
<Meta title="Spacing" />
|
|
5
|
+
|
|
6
|
+
# Spacing
|
|
7
|
+
Cosistent spacing of width, height, margins and padding maintain visual balance in the design system.
|
|
8
|
+
|
|
9
|
+
## Spacing tokens
|
|
10
|
+
The design system provides spacers that can be used vertically and horizontally. The smaller spacers should be used on more detailed spacing of elements within reusable components.
|
|
11
|
+
The larger spacers should be used on layout spacing. **These spacing tokens should be used for all possible spacings!**
|
|
12
|
+
|
|
13
|
+
<div style={{ display: 'flex', flexWrap: 'wrap', alignItems: 'flex-end', marginTop: '20px' }}>
|
|
14
|
+
{Object.entries(spacing)
|
|
15
|
+
.sort((a, b) => parseFloat(a[0].replace('_', '.')) - parseFloat(b[0].replace('_', '.')))
|
|
16
|
+
.map(([key, value]) => (
|
|
17
|
+
<div key={key} style={{ margin: '10px', textAlign: 'center' }}>
|
|
18
|
+
<div style={{ backgroundColor: '#333', width: '50px', height: value, marginBottom: '5px' }}></div>
|
|
19
|
+
{key.replace('_', '.')}
|
|
20
|
+
</div>
|
|
21
|
+
))}
|
|
22
|
+
</div>
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
import { createGlobalStyle, keyframes } from 'styled-components';
|
|
2
|
+
import { ThemeType } from './theme';
|
|
3
|
+
import { SnackBarStyles } from './Snackbar';
|
|
4
|
+
|
|
5
|
+
const skeletonLoading = keyframes`
|
|
6
|
+
0% { transform: translateX(-100%); }
|
|
7
|
+
40%, 100% { transform: translateX(100%); }
|
|
8
|
+
`;
|
|
9
|
+
|
|
10
|
+
export const GlobalStyle = createGlobalStyle<{ theme: ThemeType }>`
|
|
11
|
+
|
|
12
|
+
*::selection {
|
|
13
|
+
background-color: ${({ theme }) => theme.colors.primary};
|
|
14
|
+
color: white;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
:root {
|
|
18
|
+
font-size: 62.5%; /* (62.5/100) * 16px = 10px */
|
|
19
|
+
box-sizing: border-box;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
#takaro-root {
|
|
23
|
+
margin: 0 auto;
|
|
24
|
+
overflow-x: hidden;
|
|
25
|
+
background-color: ${({ theme }) => theme.colors.background};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
html, body {
|
|
30
|
+
width: 100%;
|
|
31
|
+
height: 100%;
|
|
32
|
+
margin: 0;
|
|
33
|
+
padding: 0;
|
|
34
|
+
scroll-behavior: smooth;
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
font-family: 'Inter', sans-serif;
|
|
37
|
+
font-weight: 400;
|
|
38
|
+
font-size: ${({ theme }) => theme.fontSize.medium};
|
|
39
|
+
-webkit-font-smoothing: antialiased;
|
|
40
|
+
-moz-osx-font-smoothing: grayscale;
|
|
41
|
+
background-color: ${({ theme }) => theme.colors.background};
|
|
42
|
+
|
|
43
|
+
@supports (scrollbar-gutter: stable) {
|
|
44
|
+
scrollbar-gutter: stable;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
body{
|
|
49
|
+
transition: background-color 0.2s linear;
|
|
50
|
+
overflow: hidden;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
a, p, div, ul, li, h1, h2, h3, h4, h5, h6, header, footer, fieldset, legend, dl, dt, dd{
|
|
54
|
+
transition: background-color 0.2s linear;
|
|
55
|
+
transition: box-shadow 0.125s linear;
|
|
56
|
+
margin: 0;
|
|
57
|
+
padding: 0;
|
|
58
|
+
box-sizing: border-box;
|
|
59
|
+
color: ${({ theme }) => theme.colors.text};
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
span {
|
|
63
|
+
letter-spacing: normal;
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
h1 {
|
|
67
|
+
font-size: ${({ theme }) => theme.fontSize.large};
|
|
68
|
+
font-weight: 600;
|
|
69
|
+
}
|
|
70
|
+
h2 {
|
|
71
|
+
font-size: ${({ theme }) => theme.fontSize.mediumLarge};
|
|
72
|
+
font-weight: 600;
|
|
73
|
+
}
|
|
74
|
+
h3 {
|
|
75
|
+
font-size: ${({ theme }) => theme.fontSize.medium};
|
|
76
|
+
font-weight: 500;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
strong {
|
|
81
|
+
padding: ${({ theme }) => `0 ${theme.spacing['0_25']}`};
|
|
82
|
+
border-radius: ${({ theme }) => theme.borderRadius.small};
|
|
83
|
+
border: 1px solid ${({ theme }) => theme.colors.backgroundAccent};
|
|
84
|
+
background-color: ${({ theme }) => theme.colors.backgroundAlt};
|
|
85
|
+
font-weight: 400;
|
|
86
|
+
white-space: no-wrap;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
form {
|
|
90
|
+
display: block;
|
|
91
|
+
width: 100%;
|
|
92
|
+
fieldset {
|
|
93
|
+
border: none;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
input, textarea {
|
|
98
|
+
appearance: none;
|
|
99
|
+
box-sizing: border-box;
|
|
100
|
+
margin: 0;
|
|
101
|
+
outline: 0;
|
|
102
|
+
padding: ${({ theme }) => `${theme.spacing['0_75']} ${theme.spacing[1]}`};
|
|
103
|
+
border-width: 0.1rem;
|
|
104
|
+
border-radius: ${({ theme }) => theme.borderRadius.medium};
|
|
105
|
+
font-size: ${({ theme }) => theme.fontSize.small};
|
|
106
|
+
border-color: transparent;
|
|
107
|
+
background-color: ${({ theme }) => theme.colors.backgroundAlt};
|
|
108
|
+
color: ${({ theme }) => theme.colors.text};
|
|
109
|
+
font-family: inherit;
|
|
110
|
+
&[readOnly]{
|
|
111
|
+
cursor: default;
|
|
112
|
+
&:focus {
|
|
113
|
+
border-color: none!important;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&:disabled {
|
|
118
|
+
cursor: not-allowed;
|
|
119
|
+
&:focus {
|
|
120
|
+
border-color: none!important;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
&:focus {
|
|
126
|
+
outline: 0;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
textarea {
|
|
131
|
+
resize: vertical;
|
|
132
|
+
width: calc(100% - ${({ theme }) => theme.spacing[1]} * 2);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
input[type='search']::-webkit-search-decoration,
|
|
136
|
+
input[type='search']::-webkit-search-cancel-button,
|
|
137
|
+
input[type='search']::-webkit-search-results-button,
|
|
138
|
+
input[type='search']::-webkit-search-results-decoration {
|
|
139
|
+
display: none;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
li {
|
|
143
|
+
list-style: none;
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
button {
|
|
147
|
+
display: block;
|
|
148
|
+
padding: ${({ theme }) => `${theme.spacing['0_75']} ${theme.spacing['2_5']}`};
|
|
149
|
+
border-radius: ${({ theme }) => theme.borderRadius.medium};
|
|
150
|
+
border: none;
|
|
151
|
+
|
|
152
|
+
&:disabled {
|
|
153
|
+
cursor: default;
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
a.underline {
|
|
158
|
+
text-decoration: underline;
|
|
159
|
+
text-decoration-color: inherit;
|
|
160
|
+
text-decoration-thickness: 1px;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
a, button {
|
|
164
|
+
cursor: pointer;
|
|
165
|
+
text-decoration: none;
|
|
166
|
+
background-position: -100px;
|
|
167
|
+
&:active, &:focus{
|
|
168
|
+
outline: 0;
|
|
169
|
+
outline-style: none;
|
|
170
|
+
-moz-outline-style: none;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
.placeholder {
|
|
175
|
+
overflow: hidden;
|
|
176
|
+
position: relative;
|
|
177
|
+
border-radius: ${({ theme }): string => theme.borderRadius.large};
|
|
178
|
+
background-color: ${({ theme }): string => theme.colors.placeholder};
|
|
179
|
+
border: 1px solid ${({ theme }): string => theme.colors.backgroundAccent};
|
|
180
|
+
&::before {
|
|
181
|
+
content: '';
|
|
182
|
+
width: 100%;
|
|
183
|
+
position: absolute;
|
|
184
|
+
top: 0;
|
|
185
|
+
right: 0;
|
|
186
|
+
bottom: 0;
|
|
187
|
+
left: 0;
|
|
188
|
+
transform: translateX(-100%);
|
|
189
|
+
background-image: linear-gradient(
|
|
190
|
+
90deg,
|
|
191
|
+
${({ theme }): string => theme.colors.placeholderHighlight}d3 0,
|
|
192
|
+
${({ theme }): string => theme.colors.placeholderHighlight}4d 20%,
|
|
193
|
+
${({ theme }): string => theme.colors.placeholderHighlight}66 60%,
|
|
194
|
+
${({ theme }): string => theme.colors.placeholderHighlight}d3
|
|
195
|
+
);
|
|
196
|
+
animation: ${skeletonLoading} 2.5s infinite ease-in-out;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
.simplebar-mask {
|
|
201
|
+
&:focus-visible {
|
|
202
|
+
border: none;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/* notistack snackbar styling */
|
|
207
|
+
${SnackBarStyles}
|
|
208
|
+
|
|
209
|
+
`;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { css } from 'styled-components';
|
|
2
|
+
import { ThemeType } from './theme';
|
|
3
|
+
|
|
4
|
+
export const SnackBarStyles = css<{ theme: ThemeType }>`
|
|
5
|
+
/* Snackbar snack colors for every type */
|
|
6
|
+
.mui-snackbar {
|
|
7
|
+
color: white;
|
|
8
|
+
}
|
|
9
|
+
.MuiSnackbarContent-root {
|
|
10
|
+
background-color: ${({ theme }): string => theme.colors.primary};
|
|
11
|
+
color: white;
|
|
12
|
+
}
|
|
13
|
+
#notistack-snackbar {
|
|
14
|
+
font-weight: 600;
|
|
15
|
+
font-family: 'Lato', sans-serif;
|
|
16
|
+
color: ${({ theme }) => theme.colors.text};
|
|
17
|
+
font-size: 1.5rem;
|
|
18
|
+
padding: 2rem;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
div.SnackbarContent-root {
|
|
22
|
+
border: 1px solid ${({ theme }) => theme.colors.background};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/* info */
|
|
26
|
+
div.SnackbarItem-variantInfo {
|
|
27
|
+
background-color: ${({ theme }): string => theme.colors.white}!important;
|
|
28
|
+
}
|
|
29
|
+
/* success */
|
|
30
|
+
div.SnackbarItem-variantSuccess {
|
|
31
|
+
background-color: ${({ theme }): string => theme.colors.white}!important;
|
|
32
|
+
}
|
|
33
|
+
/* warning */
|
|
34
|
+
div.SnackbarItem-variantWarning {
|
|
35
|
+
background-color: ${({ theme }): string => theme.colors.white}!important;
|
|
36
|
+
}
|
|
37
|
+
/* error */
|
|
38
|
+
div.SnackbarItem-variantError {
|
|
39
|
+
background-color: ${({ theme }): string => theme.colors.background}!important;
|
|
40
|
+
}
|
|
41
|
+
`;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { keyframes } from 'styled-components';
|
|
2
|
+
|
|
3
|
+
export const pulseAnimation = (color: string) => keyframes`
|
|
4
|
+
0% {
|
|
5
|
+
transform: scale(0.95);
|
|
6
|
+
box-shadow: 0 0 0 0 ${color}B3;
|
|
7
|
+
}
|
|
8
|
+
30% {
|
|
9
|
+
transform: scale(1);
|
|
10
|
+
box-shadow: 0 0 0 10px rgba(0,0,0,0.0);
|
|
11
|
+
}
|
|
12
|
+
45% {
|
|
13
|
+
transform: scale(0.95);
|
|
14
|
+
box-shadow: 0 0 0 0 rgba(0,0,0,0);
|
|
15
|
+
}
|
|
16
|
+
100% {
|
|
17
|
+
transform: scale(0.95);
|
|
18
|
+
box-shadow: 0 0 0 0 rgba(0,0,0,0);
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
|
|
22
|
+
export const shakeAnimation = keyframes`
|
|
23
|
+
2.5%, 22.5% {
|
|
24
|
+
transform: translate3d(-1px, 0, 0);
|
|
25
|
+
}
|
|
26
|
+
5%, 20% {
|
|
27
|
+
transform: translate3d(2px, 0, 0);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
7.5%, 12.5%, 17.5% {
|
|
31
|
+
transform: translate3d(-4px, 0, 0);
|
|
32
|
+
}
|
|
33
|
+
10%, 15% {
|
|
34
|
+
transform: translate3d(4px, 0, 0);
|
|
35
|
+
}
|
|
36
|
+
`;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export const device = {
|
|
2
|
+
// We see everything bigger as the default.
|
|
3
|
+
xxl: '(max-width: 1921px)',
|
|
4
|
+
xl: '(max-width: 1500px)',
|
|
5
|
+
lg: '(max-width: 1200px)',
|
|
6
|
+
md: '(max-width: 992px)',
|
|
7
|
+
sm: '(max-width: 768px)',
|
|
8
|
+
xs: '(max-width: 576px)',
|
|
9
|
+
xxs: '(max-width: 450px)',
|
|
10
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/* Re-export of styled-components styled default export which at typings for the custom theme */
|
|
2
|
+
export { styled, lightTheme, darkTheme, ThemeProvider, useThemeSwitcher } from './theme';
|
|
3
|
+
export type { ThemeType, ThemeName } from './theme';
|
|
4
|
+
|
|
5
|
+
export { GlobalStyle } from './GlobalStyle';
|
|
6
|
+
export * from './types';
|
|
7
|
+
export { device } from './device';
|
|
8
|
+
export * from './animations';
|
|
9
|
+
|
|
10
|
+
export type { Spacing } from './spacing';
|