@ctlyst.id/internal-ui 2.1.3 → 2.1.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -2,7 +2,7 @@ import { cx, dataAttr } from '@chakra-ui/shared-utils';
2
2
  import { forwardRef, omitThemingProps, useMultiStyleConfig, chakra, useColorMode } from '@chakra-ui/system';
3
3
  import React__default, { createElement, forwardRef as forwardRef$2, useMemo, useState, useEffect, useImperativeHandle, Fragment, useCallback, createContext as createContext$1, useContext, useRef } from 'react';
4
4
  import { createContext } from '@chakra-ui/react-context';
5
- import { CheckCircle, Info, AlertTriangle, Close, EyeOff, Eye, Rating as Rating$1, Check } from '@ctlyst.id/internal-icon';
5
+ import { CheckCircle, Info, AlertTriangle, Close, EyeOff, Eye, ChevronDown, Rating as Rating$1, Check } from '@ctlyst.id/internal-icon';
6
6
  import { cx as cx$1 } from '@chakra-ui/utils';
7
7
  import { forwardRef as forwardRef$1, useStyleConfig, Box, Button as Button$2, Badge as Badge$2, useToken, theme as theme$1, Text, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Card, Checkbox as Checkbox$1, FormControl, FormLabel as FormLabel$1, FormHelperText, FormErrorMessage, CheckboxGroup, Stack, Flex, Spinner, Table, Thead, Tr, useColorModeValue, Th, Tbody, Td, defineStyle, InputGroup, Input as Input$1, InputRightAddon, InputRightElement, InputLeftAddon, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, ModalBody as ModalBody$1, ModalCloseButton as ModalCloseButton$1, ModalFooter as ModalFooter$1, ModalHeader as ModalHeader$1, createIcon, Icon, Portal, Link, VisuallyHidden, Select as Select$1, Radio as Radio$1, RadioGroup, Grid, useMultiStyleConfig as useMultiStyleConfig$1, omitThemingProps as omitThemingProps$1, useCheckbox, chakra as chakra$1, useTab, TabList as TabList$1, TabPanel as TabPanel$1, Heading, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, defineStyleConfig as defineStyleConfig$1, extendTheme } from '@chakra-ui/react';
8
8
  export { AlertDialog, ModalBody as AlertDialogBody, ModalCloseButton as AlertDialogCloseButton, AlertDialogContent, ModalFooter as AlertDialogFooter, ModalHeader as AlertDialogHeader, ModalOverlay as AlertDialogOverlay, Box, ButtonGroup, Center, ChakraProvider, Table as ChakraTable, CloseButton, Code, Collapse, ColorModeScript, Container, Divider, Drawer, ModalBody as DrawerBody, ModalCloseButton as DrawerCloseButton, DrawerContent, ModalFooter as DrawerFooter, ModalHeader as DrawerHeader, ModalOverlay as DrawerOverlay, Flex, FormControl, FormErrorMessage, FormHelperText, FormLabel, Grid, GridItem, HStack, Heading, Icon, IconButton, Image, InputLeftElement as InputElementLeft, InputRightElement as InputElementRight, InputGroup, InputLeftAddon, InputLeftElement, InputRightAddon, InputRightElement, Link, List, ListIcon, ListItem, Modal, ModalContent, ModalContextProvider, ModalFocusScope, ModalOverlay, OrderedList, Popover, PopoverAnchor, PopoverArrow, PopoverBody, PopoverCloseButton, PopoverContent, PopoverFooter, PopoverHeader, PopoverTrigger, Portal, RequiredIndicator, ScaleFade, SimpleGrid, Skeleton, Spacer, Stack, TabIndicator, TabPanels, Tabs, TabsDescendantsProvider, TabsProvider, Tbody, Td, Text, Th, Thead, Tooltip, Tr, UnorderedList, VStack, Wrap, WrapItem, extendTheme, forwardRef, useBoolean, useColorMode, useColorModeValue, useDisclosure, useDrawerContext, useModal, useModalContext, useModalStyles, useTab, useTabIndicator, useTabList, useTabPanel, useTabPanels, useTabs, useTabsContext, useTabsDescendant, useTabsDescendants, useTabsDescendantsContext, useTabsStyles, useToken } from '@chakra-ui/react';
@@ -765,7 +765,7 @@ const getWrapperStyle = props => {
765
765
  const style = {
766
766
  border: '1px solid',
767
767
  borderColor: outlineColor,
768
- borderRadius: 'md',
768
+ borderRadius: 'sm',
769
769
  transition: 'all 0.15s',
770
770
  boxShadow: 'none',
771
771
  _focusWithin: {
@@ -1863,7 +1863,7 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1863
1863
  __css: wrapperStyle
1864
1864
  }, /*#__PURE__*/React__default.createElement(InputGroup, {
1865
1865
  size: size,
1866
- borderRadius: "md",
1866
+ borderRadius: "sm",
1867
1867
  backgroundColor: isDisabled ? 'neutral.300' : 'white.high',
1868
1868
  cursor: isDisabled ? 'not-allowed' : 'default'
1869
1869
  }, addOnLeft, /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
@@ -2218,7 +2218,7 @@ const ModalFooter = /*#__PURE__*/forwardRef$2(({
2218
2218
  return /*#__PURE__*/React__default.createElement(ModalFooter$1, Object.assign({
2219
2219
  ref: ref,
2220
2220
  background: useColorModeValue('neutral.200', 'mirage.900'),
2221
- borderBottomRadius: "md"
2221
+ borderBottomRadius: "sm"
2222
2222
  }, rest), children);
2223
2223
  });
2224
2224
 
@@ -2229,7 +2229,7 @@ const ModalHeader = /*#__PURE__*/forwardRef$2(({
2229
2229
  return /*#__PURE__*/React__default.createElement(ModalHeader$1, Object.assign({
2230
2230
  ref: ref,
2231
2231
  background: useColorModeValue('neutral.200', 'mirage.900'),
2232
- borderTopRadius: "md",
2232
+ borderTopRadius: "sm",
2233
2233
  textStyle: "text-lg"
2234
2234
  }, rest), children);
2235
2235
  });
@@ -2373,6 +2373,101 @@ Navigation.defaultProps = {
2373
2373
  host: undefined
2374
2374
  };
2375
2375
 
2376
+ const NavigationBar = ({
2377
+ navigations,
2378
+ isFetched,
2379
+ pathname,
2380
+ asPath,
2381
+ mappingIcon,
2382
+ ...props
2383
+ }) => {
2384
+ const urlMenu = subMenu => {
2385
+ if (window.location.hostname === 'localhost') {
2386
+ return subMenu.navLink;
2387
+ }
2388
+ return subMenu.navHost + subMenu.navLink;
2389
+ };
2390
+ return /*#__PURE__*/React__default.createElement(Box, Object.assign({
2391
+ hidden: isFetched && navigations === undefined,
2392
+ backgroundRepeat: "repeat-x",
2393
+ "data-test-id": "CT_component_navigation_cms"
2394
+ }, props), /*#__PURE__*/React__default.createElement(Flex, {
2395
+ bg: "white",
2396
+ w: "full",
2397
+ rounded: 'md',
2398
+ flexWrap: "wrap",
2399
+ alignItems: "center",
2400
+ shadow: "raised",
2401
+ gap: 1,
2402
+ px: 4,
2403
+ py: 2
2404
+ }, navigations === null || navigations === void 0 ? void 0 : navigations.map(item => {
2405
+ var _childMenu$;
2406
+ const childMenu = item.children.filter(subMenu => asPath === null || asPath === void 0 ? void 0 : asPath.includes(subMenu.navLink));
2407
+ const isActive = pathname === null || pathname === void 0 ? void 0 : pathname.startsWith((_childMenu$ = childMenu[0]) === null || _childMenu$ === void 0 ? void 0 : _childMenu$.navLink);
2408
+ const activeBg = isActive ? 'primary.500' : undefined;
2409
+ return /*#__PURE__*/React__default.createElement(Popover$1, {
2410
+ isLazy: true,
2411
+ key: item.id,
2412
+ trigger: "hover",
2413
+ placement: "bottom-start",
2414
+ openDelay: 100,
2415
+ closeDelay: 100
2416
+ }, ({
2417
+ isOpen,
2418
+ onClose
2419
+ }) => /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(PopoverTrigger, null, /*#__PURE__*/React__default.createElement(Button$2, {
2420
+ h: 7.5,
2421
+ p: 2,
2422
+ size: "sm",
2423
+ variant: "ghost",
2424
+ "data-test-id": `CT_component_navigation_button-${item.title}${isActive ? '-active' : ''}`,
2425
+ _hover: {
2426
+ backgroundColor: !isActive ? 'neutral.400' : activeBg
2427
+ },
2428
+ backgroundColor: isOpen && !isActive ? 'neutral.400' : activeBg,
2429
+ color: isActive ? 'primary.50' : 'black.high',
2430
+ leftIcon: mappingIcon.get(item.title),
2431
+ rightIcon: /*#__PURE__*/React__default.createElement(ChevronDown, {
2432
+ size: 4,
2433
+ color: "inherit"
2434
+ })
2435
+ }, item.title)), item.children && /*#__PURE__*/React__default.createElement(PopoverContent, {
2436
+ border: "none",
2437
+ shadow: "raised",
2438
+ py: 1,
2439
+ width: 240
2440
+ }, item.children.map(subMenu => /*#__PURE__*/React__default.createElement(Link, {
2441
+ key: subMenu.id,
2442
+ href: urlMenu(subMenu),
2443
+ display: "flex",
2444
+ alignItems: "center",
2445
+ transition: "padding 0.35s ease 0s",
2446
+ _hover: {
2447
+ pl: 6
2448
+ },
2449
+ _first: {
2450
+ borderTopRadius: 'md'
2451
+ },
2452
+ _last: {
2453
+ borderBottomRadius: 'md'
2454
+ },
2455
+ py: 3,
2456
+ px: 4,
2457
+ color: pathname !== null && pathname !== void 0 && pathname.startsWith(subMenu.navLink) ? 'primary.800' : 'black.high',
2458
+ onClick: onClose,
2459
+ background: pathname !== null && pathname !== void 0 && pathname.startsWith(subMenu.navLink) ? 'primary.50' : 'transparent',
2460
+ "data-test-id": `CT_component_navigation_link-${item.id}`
2461
+ }, mappingIcon.get(item.title), /*#__PURE__*/React__default.createElement(Text, {
2462
+ textStyle: "text-sm",
2463
+ ml: 3
2464
+ }, subMenu.title))))));
2465
+ })));
2466
+ };
2467
+ NavigationBar.defaultProps = {
2468
+ navigations: undefined
2469
+ };
2470
+
2376
2471
  const PaginationButton = /*#__PURE__*/forwardRef$1(({
2377
2472
  className,
2378
2473
  style,
@@ -3311,7 +3406,7 @@ const baseStyle = /*#__PURE__*/definePartsStyle({
3311
3406
  bg: $bg.reference,
3312
3407
  px: '4',
3313
3408
  py: '2',
3314
- borderRadius: 'md'
3409
+ borderRadius: 'sm'
3315
3410
  },
3316
3411
  title: {
3317
3412
  fontWeight: 'regular',
@@ -3475,7 +3570,7 @@ const Button$1 = /*#__PURE__*/defineStyleConfig({
3475
3570
  fontWeight: 'normal',
3476
3571
  px: 4,
3477
3572
  py: 2.5,
3478
- borderRadius: 'md',
3573
+ borderRadius: 'sm',
3479
3574
  _disabled: {
3480
3575
  opacity: 1,
3481
3576
  bg: 'neutral.300',
@@ -3738,7 +3833,7 @@ const CardStyle = /*#__PURE__*/defineStyleConfig({
3738
3833
  baseStyle: props => {
3739
3834
  return {
3740
3835
  shadow: props.withShadow ? 'raised' : 'none',
3741
- borderRadius: props.isRounded ? 'lg' : 'none'
3836
+ borderRadius: props.isRounded ? 'sm' : 'none'
3742
3837
  };
3743
3838
  }
3744
3839
  });
@@ -3953,17 +4048,17 @@ const size = {
3953
4048
  lg: /*#__PURE__*/defineStyle$1({
3954
4049
  fontSize: 'text.lg',
3955
4050
  h: 12,
3956
- borderRadius: 'md'
4051
+ borderRadius: 'sm'
3957
4052
  }),
3958
4053
  md: /*#__PURE__*/defineStyle$1({
3959
4054
  fontSize: 'text.md',
3960
4055
  h: 10,
3961
- borderRadius: 'md'
4056
+ borderRadius: 'sm'
3962
4057
  }),
3963
4058
  sm: /*#__PURE__*/defineStyle$1({
3964
4059
  fontSize: 'text.sm',
3965
4060
  h: 9,
3966
- borderRadius: 'md'
4061
+ borderRadius: 'sm'
3967
4062
  })
3968
4063
  };
3969
4064
  const sizes = {
@@ -4024,6 +4119,7 @@ const Input = /*#__PURE__*/defineMultiStyleConfig$2({
4024
4119
  }
4025
4120
  });
4026
4121
 
4122
+ /* eslint-disable prefer-destructuring */
4027
4123
  const rotate = /*#__PURE__*/keyframes({
4028
4124
  '0%': {
4029
4125
  transform: 'rotate(0deg)'
@@ -4033,10 +4129,23 @@ const rotate = /*#__PURE__*/keyframes({
4033
4129
  }
4034
4130
  });
4035
4131
  const getLoaderColor = color => {
4036
- if (color === 'primary') return '--chakra-colors-primary-600';
4037
- if (color === 'danger') return '--chakra-colors-danger-500';
4038
- if (color === 'warning') return '--chakra-colors-warning-700';
4039
- return '--chakra-colors-white-high';
4132
+ const colorValue = color.split('.');
4133
+ let backgroundColor;
4134
+ switch (colorValue.length) {
4135
+ case 1:
4136
+ backgroundColor = colorValue[0];
4137
+ break;
4138
+ case 2:
4139
+ backgroundColor = `var(--chakra-colors-${colorValue[0]}-${colorValue[1]})`;
4140
+ break;
4141
+ default:
4142
+ backgroundColor = 'var(--chakra-colors-white-high)';
4143
+ break;
4144
+ }
4145
+ if (color === 'primary') return 'var(--chakra-colors-primary-600)';
4146
+ if (color === 'danger') return 'var(--chakra-colors-danger-500)';
4147
+ if (color === 'warning') return 'var(--chakra-colors-warning-700)';
4148
+ return backgroundColor;
4040
4149
  };
4041
4150
  const LoaderStyle = /*#__PURE__*/defineStyleConfig({
4042
4151
  baseStyle: props => {
@@ -4047,7 +4156,7 @@ const LoaderStyle = /*#__PURE__*/defineStyleConfig({
4047
4156
  justifyContent: 'center',
4048
4157
  alignItems: 'center',
4049
4158
  animation: `${rotate} 1s linear infinite`,
4050
- background: `conic-gradient(from 180deg at 50% 50%, var(${colors}) 0deg, rgba(217, 217, 217, 0) 360deg);`,
4159
+ background: `conic-gradient(from 180deg at 50% 50%, ${colors} 0deg, rgba(217, 217, 217, 0) 360deg);`,
4051
4160
  ':before': {
4052
4161
  content: `''`,
4053
4162
  display: 'block',
@@ -4535,7 +4644,7 @@ const outline$1 = /*#__PURE__*/defineStyle(props => {
4535
4644
  borderColor,
4536
4645
  fontSize: 'text.sm',
4537
4646
  padding: 2,
4538
- borderRadius: 'md',
4647
+ borderRadius: 'sm',
4539
4648
  borderWidth: '1px',
4540
4649
  outline: 'none',
4541
4650
  _disabled: {
@@ -4706,5 +4815,5 @@ function useFetcher() {
4706
4815
  };
4707
4816
  }
4708
4817
 
4709
- export { Alert, AlertAction, AlertClose, AlertDescription, AlertIcon, AlertTitle, Badge, BreadCrumb, Button, CardCustom as Card, CheckboxComponent as Checkbox, CheckboxGroupComponent as CheckboxGroup, Chips, DataTable, DatePickerMonth, Datepicker, Field, Header, InputAddonLeft, InputAddonRight, InputField, Loader, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, RadioComponent as Radio, RadioGroupComponent as RadioGroup, Rating, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Switch, Tab, TabList, TabPanel, TextareaField, Uploader, getTheme, theme, useAlertStyles, useFetcher, useInternalUI };
4818
+ export { Alert, AlertAction, AlertClose, AlertDescription, AlertIcon, AlertTitle, Badge, BreadCrumb, Button, CardCustom as Card, CheckboxComponent as Checkbox, CheckboxGroupComponent as CheckboxGroup, Chips, DataTable, DatePickerMonth, Datepicker, Field, Header, InputAddonLeft, InputAddonRight, InputField, Loader, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, NavigationBar, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, RadioComponent as Radio, RadioGroupComponent as RadioGroup, Rating, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Switch, Tab, TabList, TabPanel, TextareaField, Uploader, getTheme, theme, useAlertStyles, useFetcher, useInternalUI };
4710
4819
  //# sourceMappingURL=internal-ui.esm.js.map