@ctlyst.id/internal-ui 2.1.2 → 2.1.4
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/components/header/components/header.d.ts +1 -0
- package/dist/components/header/components/logo.d.ts +1 -0
- package/dist/components/navigation/__stories__/navigation.stories.d.ts +1 -0
- package/dist/components/navigation/components/navigation-bar.d.ts +12 -0
- package/dist/components/navigation/index.d.ts +2 -0
- package/dist/components/navigation/types.d.ts +16 -0
- package/dist/config/__stories__/foundations.stories.d.ts +1 -0
- package/dist/internal-ui.cjs.development.js +156 -34
- package/dist/internal-ui.cjs.development.js.map +1 -1
- package/dist/internal-ui.cjs.production.min.js +4 -4
- package/dist/internal-ui.cjs.production.min.js.map +1 -1
- package/dist/internal-ui.esm.js +145 -24
- package/dist/internal-ui.esm.js.map +1 -1
- package/package.json +2 -2
package/dist/internal-ui.esm.js
CHANGED
@@ -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: '
|
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: "
|
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({
|
@@ -1948,16 +1948,32 @@ TextareaField.defaultProps = {
|
|
1948
1948
|
};
|
1949
1949
|
|
1950
1950
|
const Logo = ({
|
1951
|
+
url,
|
1951
1952
|
imageUrl,
|
1952
1953
|
height
|
1953
|
-
}) =>
|
1954
|
-
|
1955
|
-
|
1956
|
-
|
1957
|
-
|
1958
|
-
|
1959
|
-
}
|
1954
|
+
}) => {
|
1955
|
+
if (url) return /*#__PURE__*/React__default.createElement(Box, {
|
1956
|
+
as: "a",
|
1957
|
+
href: url,
|
1958
|
+
cursor: "pointer",
|
1959
|
+
target: "_self"
|
1960
|
+
}, /*#__PURE__*/React__default.createElement(Image, {
|
1961
|
+
w: "100%",
|
1962
|
+
h: height !== null && height !== void 0 ? height : 9,
|
1963
|
+
maxH: height !== null && height !== void 0 ? height : 9,
|
1964
|
+
src: imageUrl,
|
1965
|
+
alt: imageUrl
|
1966
|
+
}));
|
1967
|
+
return /*#__PURE__*/React__default.createElement(Image, {
|
1968
|
+
w: "100%",
|
1969
|
+
h: height !== null && height !== void 0 ? height : 9,
|
1970
|
+
maxH: height !== null && height !== void 0 ? height : 9,
|
1971
|
+
src: imageUrl,
|
1972
|
+
alt: imageUrl
|
1973
|
+
});
|
1974
|
+
};
|
1960
1975
|
Logo.defaultProps = {
|
1976
|
+
url: undefined,
|
1961
1977
|
height: undefined
|
1962
1978
|
};
|
1963
1979
|
|
@@ -2118,6 +2134,7 @@ const Header = ({
|
|
2118
2134
|
mainLogoSize,
|
2119
2135
|
centerLogoSize = 4,
|
2120
2136
|
hideEnv = false,
|
2137
|
+
urlLogo,
|
2121
2138
|
children,
|
2122
2139
|
...props
|
2123
2140
|
}) => /*#__PURE__*/createElement(Box, Object.assign({
|
@@ -2134,6 +2151,7 @@ const Header = ({
|
|
2134
2151
|
}, /*#__PURE__*/createElement(Flex, {
|
2135
2152
|
alignItems: "center"
|
2136
2153
|
}, /*#__PURE__*/createElement(Logo, {
|
2154
|
+
url: urlLogo,
|
2137
2155
|
imageUrl: mainLogo,
|
2138
2156
|
height: mainLogoSize
|
2139
2157
|
}), children && children), /*#__PURE__*/createElement(HStack, {
|
@@ -2144,6 +2162,7 @@ const Header = ({
|
|
2144
2162
|
left: "50%",
|
2145
2163
|
transform: "translate(-50%,0)"
|
2146
2164
|
}, /*#__PURE__*/createElement(Logo, {
|
2165
|
+
url: urlLogo,
|
2147
2166
|
imageUrl: centerLogo,
|
2148
2167
|
height: centerLogoSize
|
2149
2168
|
}), /*#__PURE__*/createElement(Version, {
|
@@ -2168,7 +2187,8 @@ Header.defaultProps = {
|
|
2168
2187
|
mainLogoSize: undefined,
|
2169
2188
|
centerLogo: undefined,
|
2170
2189
|
centerLogoSize: undefined,
|
2171
|
-
hideEnv: false
|
2190
|
+
hideEnv: false,
|
2191
|
+
urlLogo: undefined
|
2172
2192
|
};
|
2173
2193
|
|
2174
2194
|
const ModalBody = /*#__PURE__*/React__default.forwardRef(({
|
@@ -2198,7 +2218,7 @@ const ModalFooter = /*#__PURE__*/forwardRef$2(({
|
|
2198
2218
|
return /*#__PURE__*/React__default.createElement(ModalFooter$1, Object.assign({
|
2199
2219
|
ref: ref,
|
2200
2220
|
background: useColorModeValue('neutral.200', 'mirage.900'),
|
2201
|
-
borderBottomRadius: "
|
2221
|
+
borderBottomRadius: "sm"
|
2202
2222
|
}, rest), children);
|
2203
2223
|
});
|
2204
2224
|
|
@@ -2209,7 +2229,7 @@ const ModalHeader = /*#__PURE__*/forwardRef$2(({
|
|
2209
2229
|
return /*#__PURE__*/React__default.createElement(ModalHeader$1, Object.assign({
|
2210
2230
|
ref: ref,
|
2211
2231
|
background: useColorModeValue('neutral.200', 'mirage.900'),
|
2212
|
-
borderTopRadius: "
|
2232
|
+
borderTopRadius: "sm",
|
2213
2233
|
textStyle: "text-lg"
|
2214
2234
|
}, rest), children);
|
2215
2235
|
});
|
@@ -2353,6 +2373,101 @@ Navigation.defaultProps = {
|
|
2353
2373
|
host: undefined
|
2354
2374
|
};
|
2355
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
|
+
|
2356
2471
|
const PaginationButton = /*#__PURE__*/forwardRef$1(({
|
2357
2472
|
className,
|
2358
2473
|
style,
|
@@ -3148,7 +3263,13 @@ const Tab = /*#__PURE__*/forwardRef$1((props, ref) => {
|
|
3148
3263
|
_selected: {
|
3149
3264
|
borderColor: 'primary.400',
|
3150
3265
|
color: 'primary.500',
|
3151
|
-
transform: 'translateY(-2px)'
|
3266
|
+
transform: 'translateY(-2px)',
|
3267
|
+
_hover: {
|
3268
|
+
'& .chakra-badge': {
|
3269
|
+
bg: 'primary.500'
|
3270
|
+
},
|
3271
|
+
color: 'primary.500'
|
3272
|
+
}
|
3152
3273
|
},
|
3153
3274
|
color: "black.medium",
|
3154
3275
|
_focus: {
|
@@ -3285,7 +3406,7 @@ const baseStyle = /*#__PURE__*/definePartsStyle({
|
|
3285
3406
|
bg: $bg.reference,
|
3286
3407
|
px: '4',
|
3287
3408
|
py: '2',
|
3288
|
-
borderRadius: '
|
3409
|
+
borderRadius: 'sm'
|
3289
3410
|
},
|
3290
3411
|
title: {
|
3291
3412
|
fontWeight: 'regular',
|
@@ -3449,7 +3570,7 @@ const Button$1 = /*#__PURE__*/defineStyleConfig({
|
|
3449
3570
|
fontWeight: 'normal',
|
3450
3571
|
px: 4,
|
3451
3572
|
py: 2.5,
|
3452
|
-
borderRadius: '
|
3573
|
+
borderRadius: 'sm',
|
3453
3574
|
_disabled: {
|
3454
3575
|
opacity: 1,
|
3455
3576
|
bg: 'neutral.300',
|
@@ -3712,7 +3833,7 @@ const CardStyle = /*#__PURE__*/defineStyleConfig({
|
|
3712
3833
|
baseStyle: props => {
|
3713
3834
|
return {
|
3714
3835
|
shadow: props.withShadow ? 'raised' : 'none',
|
3715
|
-
borderRadius: props.isRounded ? '
|
3836
|
+
borderRadius: props.isRounded ? 'sm' : 'none'
|
3716
3837
|
};
|
3717
3838
|
}
|
3718
3839
|
});
|
@@ -3723,7 +3844,7 @@ const {
|
|
3723
3844
|
} = /*#__PURE__*/createMultiStyleConfigHelpers$1(checkboxAnatomy.keys);
|
3724
3845
|
const baseStyle$1 = /*#__PURE__*/definePartsStyle$1({
|
3725
3846
|
control: {
|
3726
|
-
borderRadius: '
|
3847
|
+
borderRadius: 'sm',
|
3727
3848
|
w: 4,
|
3728
3849
|
h: 4,
|
3729
3850
|
border: '1px solid'
|
@@ -3827,7 +3948,7 @@ const Chips$1 = /*#__PURE__*/defineStyleConfig({
|
|
3827
3948
|
const defaultProps = {
|
3828
3949
|
color: 'primary.500',
|
3829
3950
|
textStyle: 'text.sm',
|
3830
|
-
borderRadius: '
|
3951
|
+
borderRadius: '2xl',
|
3831
3952
|
borderWidth: '1px',
|
3832
3953
|
borderColor: 'primary.500',
|
3833
3954
|
bg: 'white.high',
|
@@ -3927,17 +4048,17 @@ const size = {
|
|
3927
4048
|
lg: /*#__PURE__*/defineStyle$1({
|
3928
4049
|
fontSize: 'text.lg',
|
3929
4050
|
h: 12,
|
3930
|
-
borderRadius: '
|
4051
|
+
borderRadius: 'sm'
|
3931
4052
|
}),
|
3932
4053
|
md: /*#__PURE__*/defineStyle$1({
|
3933
4054
|
fontSize: 'text.md',
|
3934
4055
|
h: 10,
|
3935
|
-
borderRadius: '
|
4056
|
+
borderRadius: 'sm'
|
3936
4057
|
}),
|
3937
4058
|
sm: /*#__PURE__*/defineStyle$1({
|
3938
4059
|
fontSize: 'text.sm',
|
3939
4060
|
h: 9,
|
3940
|
-
borderRadius: '
|
4061
|
+
borderRadius: 'sm'
|
3941
4062
|
})
|
3942
4063
|
};
|
3943
4064
|
const sizes = {
|
@@ -4509,7 +4630,7 @@ const outline$1 = /*#__PURE__*/defineStyle(props => {
|
|
4509
4630
|
borderColor,
|
4510
4631
|
fontSize: 'text.sm',
|
4511
4632
|
padding: 2,
|
4512
|
-
borderRadius: '
|
4633
|
+
borderRadius: 'sm',
|
4513
4634
|
borderWidth: '1px',
|
4514
4635
|
outline: 'none',
|
4515
4636
|
_disabled: {
|
@@ -4680,5 +4801,5 @@ function useFetcher() {
|
|
4680
4801
|
};
|
4681
4802
|
}
|
4682
4803
|
|
4683
|
-
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 };
|
4804
|
+
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 };
|
4684
4805
|
//# sourceMappingURL=internal-ui.esm.js.map
|