@ctlyst.id/internal-ui 2.0.6 → 2.0.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. package/dist/components/button/__stories__/button.stories.d.ts +1 -1
  2. package/dist/components/button/index.d.ts +1 -0
  3. package/dist/components/image/index.d.ts +1 -0
  4. package/dist/components/index.d.ts +1 -0
  5. package/dist/components/layouting/index.d.ts +1 -12
  6. package/dist/components/list/index.d.ts +1 -0
  7. package/dist/components/popover/index.d.ts +1 -0
  8. package/dist/components/text/index.d.ts +1 -2
  9. package/dist/components/tooltip/__stories__/tooltip.stories.d.ts +10 -0
  10. package/dist/components/tooltip/index.d.ts +1 -0
  11. package/dist/config/theme/components/checkbox.d.ts +15 -1
  12. package/dist/config/theme/components/chips.d.ts +3 -0
  13. package/dist/config/theme/components/radio.d.ts +3 -0
  14. package/dist/hooks/index.d.ts +1 -0
  15. package/dist/index.d.ts +2 -0
  16. package/dist/internal-ui.cjs.development.js +224 -40
  17. package/dist/internal-ui.cjs.development.js.map +1 -1
  18. package/dist/internal-ui.cjs.production.min.js +5 -5
  19. package/dist/internal-ui.cjs.production.min.js.map +1 -1
  20. package/dist/internal-ui.esm.js +106 -36
  21. package/dist/internal-ui.esm.js.map +1 -1
  22. package/dist/provider/index.d.ts +1 -0
  23. package/package.json +3 -3
  24. package/dist/components/layouting/components/box.d.ts +0 -4
  25. package/dist/components/layouting/components/container.d.ts +0 -4
  26. package/dist/components/layouting/components/flex.d.ts +0 -4
  27. package/dist/components/layouting/components/grid.d.ts +0 -4
  28. package/dist/components/layouting/components/stack.d.ts +0 -4
  29. package/dist/components/layouting/components/wrap.d.ts +0 -4
  30. package/dist/components/text/components/text.d.ts +0 -4
@@ -4,8 +4,8 @@ import React__default, { createElement, forwardRef as forwardRef$2, useRef, useE
4
4
  import { createContext } from '@chakra-ui/react-context';
5
5
  import { CheckCircle, Info, AlertTriangle, Close, EyeOff, Eye, Rating as Rating$1, Check } from '@ctlyst.id/internal-icon';
6
6
  import { cx as cx$1 } from '@chakra-ui/utils';
7
- import { forwardRef as forwardRef$1, useStyleConfig, Box, Button as Button$2, Badge as Badge$2, useToken, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Card, Checkbox as Checkbox$1, FormControl, FormLabel as FormLabel$1, FormHelperText, FormErrorMessage, CheckboxGroup, Stack, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, defineStyle, InputGroup, Input as Input$1, InputRightAddon, InputRightElement, theme as theme$1, InputLeftAddon, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, Container, Grid, Wrap, 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, 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
- export { AlertDialog, ModalBody as AlertDialogBody, ModalCloseButton as AlertDialogCloseButton, AlertDialogContent, ModalFooter as AlertDialogFooter, ModalHeader as AlertDialogHeader, ModalOverlay as AlertDialogOverlay, Drawer, ModalBody as DrawerBody, ModalCloseButton as DrawerCloseButton, DrawerContent, ModalFooter as DrawerFooter, ModalHeader as DrawerHeader, ModalOverlay as DrawerOverlay, InputLeftElement as InputElementLeft, InputRightElement as InputElementRight, Modal, ModalContent, ModalContextProvider, ModalFocusScope, ModalOverlay, TabIndicator, TabPanels, Tabs, TabsDescendantsProvider, TabsProvider, useDrawerContext, useModal, useModalContext, useModalStyles, useTab, useTabIndicator, useTabList, useTabPanel, useTabPanels, useTabs, useTabsContext, useTabsDescendant, useTabsDescendants, useTabsDescendantsContext, useTabsStyles } from '@chakra-ui/react';
7
+ import { forwardRef as forwardRef$1, useStyleConfig, Box, Button as Button$2, Badge as Badge$2, useToken, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Card, Checkbox as Checkbox$1, FormControl, FormLabel as FormLabel$1, FormHelperText, FormErrorMessage, CheckboxGroup, Stack, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, defineStyle, InputGroup, Input as Input$1, InputRightAddon, InputRightElement, theme as theme$1, 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
+ export { AlertDialog, ModalBody as AlertDialogBody, ModalCloseButton as AlertDialogCloseButton, AlertDialogContent, ModalFooter as AlertDialogFooter, ModalHeader as AlertDialogHeader, ModalOverlay as AlertDialogOverlay, Box, ButtonGroup, ChakraProvider, CloseButton, Container, Divider, Drawer, ModalBody as DrawerBody, ModalCloseButton as DrawerCloseButton, DrawerContent, ModalFooter as DrawerFooter, ModalHeader as DrawerHeader, ModalOverlay as DrawerOverlay, Flex, Grid, GridItem, HStack, Heading, InputLeftElement as InputElementLeft, InputRightElement as InputElementRight, Modal, ModalContent, ModalContextProvider, ModalFocusScope, ModalOverlay, Stack, TabIndicator, TabPanels, Tabs, TabsDescendantsProvider, TabsProvider, Text, Tooltip, VStack, Wrap, WrapItem, extendTheme, useColorModeValue, useDisclosure, useDrawerContext, useModal, useModalContext, useModalStyles, useTab, useTabIndicator, useTabList, useTabPanel, useTabPanels, useTabs, useTabsContext, useTabsDescendant, useTabsDescendants, useTabsDescendantsContext, useTabsStyles } from '@chakra-ui/react';
9
9
  import { FiChevronsRight, FiHome, FiCalendar, FiX, FiPower, FiMoon, FiSun, FiShoppingBag, FiShoppingCart, FiRepeat, FiBox, FiLayers, FiDollarSign, FiUsers, FiRotateCcw, FiSettings, FiLayout, FiGift, FiChevronDown } from 'react-icons/fi';
10
10
  import { ChevronUpIcon, ChevronDownIcon, UpDownIcon, ArrowLeftIcon, ChevronLeftIcon, ChevronRightIcon, ArrowRightIcon } from '@chakra-ui/icons';
11
11
  import { css, Global, keyframes } from '@emotion/react';
@@ -399,15 +399,21 @@ function CheckboxComponent({
399
399
  }, rest, {
400
400
  isDisabled: isDisabled
401
401
  }), children && /*#__PURE__*/React__default.createElement(Text, {
402
+ as: "span",
403
+ display: "block",
402
404
  textStyle: "text.sm",
403
- color: isDisabled ? 'black.low' : 'black.high'
405
+ color: isDisabled ? 'black.medium' : 'black.high'
404
406
  }, children))), /*#__PURE__*/React__default.createElement(Box, {
405
407
  mt: "5px",
406
408
  ml: "24px"
407
409
  }, isError ? /*#__PURE__*/React__default.createElement(Text, {
410
+ as: "span",
411
+ display: "block",
408
412
  textStyle: "text.xs",
409
413
  color: "danger.500"
410
414
  }, errorText) : /*#__PURE__*/React__default.createElement(Text, {
415
+ as: "span",
416
+ display: "block",
411
417
  textStyle: "text.xs",
412
418
  color: "black.medium"
413
419
  }, helpText)));
@@ -2349,7 +2355,8 @@ const Profile = ({
2349
2355
  }, (data === null || data === void 0 ? void 0 : data.office) && /*#__PURE__*/createElement(Text, {
2350
2356
  color: "neutral.700",
2351
2357
  display: "inline-block",
2352
- mr: 0.5
2358
+ mr: 0.5,
2359
+ as: "span"
2353
2360
  }, data.office, " |", ' '), data === null || data === void 0 ? void 0 : data.userRole)), /*#__PURE__*/createElement(PopoverTrigger, null, /*#__PURE__*/createElement(Avatar, {
2354
2361
  size: 'sm',
2355
2362
  bg: "primary.500",
@@ -2899,15 +2906,21 @@ function RadioComponent({
2899
2906
  }, rest, {
2900
2907
  isDisabled: isDisabled
2901
2908
  }), children && /*#__PURE__*/React__default.createElement(Text, {
2909
+ as: "span",
2910
+ display: "block",
2902
2911
  textStyle: "text.sm",
2903
- color: isDisabled ? 'black.low' : 'black.high'
2912
+ color: isDisabled ? 'black.medium' : 'black.high'
2904
2913
  }, children))), /*#__PURE__*/React__default.createElement(Box, {
2905
2914
  mt: "5px",
2906
2915
  ml: "24px"
2907
2916
  }, isError ? /*#__PURE__*/React__default.createElement(Text, {
2917
+ as: "span",
2918
+ display: "block",
2908
2919
  textStyle: "text.xs",
2909
2920
  color: "danger.500"
2910
2921
  }, errorText) : /*#__PURE__*/React__default.createElement(Text, {
2922
+ as: "span",
2923
+ display: "block",
2911
2924
  textStyle: "text.xs",
2912
2925
  color: "black.medium"
2913
2926
  }, helpText)));
@@ -3157,9 +3170,6 @@ function SelectCreatable({
3157
3170
  */
3158
3171
  const Switch = /*#__PURE__*/forwardRef$1(function Switch(props, ref) {
3159
3172
  const styles = useMultiStyleConfig$1('Switch', props);
3160
- const {
3161
- size = 'md'
3162
- } = props;
3163
3173
  const {
3164
3174
  spacing = '0.5rem',
3165
3175
  children,
@@ -3221,10 +3231,10 @@ const Switch = /*#__PURE__*/forwardRef$1(function Switch(props, ref) {
3221
3231
  transform: "translate(-50%, -50%)"
3222
3232
  }, /*#__PURE__*/React__default.createElement(Check, {
3223
3233
  color: "white",
3224
- size: getIconSize(size)
3234
+ size: getIconSize(props.size)
3225
3235
  }), /*#__PURE__*/React__default.createElement(Close, {
3226
3236
  color: state.isDisabled ? 'neutral.600' : 'neutral.900',
3227
- size: getIconSize(size)
3237
+ size: getIconSize(props.size)
3228
3238
  })), /*#__PURE__*/React__default.createElement(chakra$1.span, {
3229
3239
  __css: styles.thumb,
3230
3240
  className: "chakra-switch__thumb",
@@ -3237,6 +3247,9 @@ const Switch = /*#__PURE__*/forwardRef$1(function Switch(props, ref) {
3237
3247
  __css: labelStyles
3238
3248
  }), children));
3239
3249
  });
3250
+ Switch.defaultProps = {
3251
+ size: 'sm'
3252
+ };
3240
3253
 
3241
3254
  const Tab = /*#__PURE__*/forwardRef$1((props, ref) => {
3242
3255
  var _props$leftAddon, _props$rightAddon;
@@ -3502,6 +3515,10 @@ const Badge$1 = {
3502
3515
  color: 'white'
3503
3516
  },
3504
3517
  'neutral-solid': {
3518
+ bg: 'neutral.900',
3519
+ color: 'white'
3520
+ },
3521
+ 'disabled-solid': {
3505
3522
  bg: 'neutral.600',
3506
3523
  color: 'white'
3507
3524
  },
@@ -3526,7 +3543,11 @@ const Badge$1 = {
3526
3543
  color: 'danger.500'
3527
3544
  },
3528
3545
  'neutral-light': {
3529
- bg: 'neutral.100',
3546
+ bg: 'neutral.200',
3547
+ color: 'neutral.900'
3548
+ },
3549
+ 'disabled-light': {
3550
+ bg: 'neutral.200',
3530
3551
  color: 'neutral.600'
3531
3552
  }
3532
3553
  },
@@ -3825,8 +3846,7 @@ const baseStyle$1 = /*#__PURE__*/definePartsStyle$1({
3825
3846
  border: '1px solid'
3826
3847
  },
3827
3848
  icon: {
3828
- color: 'neutral.50',
3829
- width: '9px'
3849
+ color: 'neutral.50'
3830
3850
  },
3831
3851
  label: {
3832
3852
  fontWeight: '400',
@@ -3835,8 +3855,8 @@ const baseStyle$1 = /*#__PURE__*/definePartsStyle$1({
3835
3855
  ml: '8px'
3836
3856
  },
3837
3857
  _disabled: {
3838
- background: 'neutral.500',
3839
- border: '1px solid',
3858
+ background: 'neutral.200',
3859
+ border: '0',
3840
3860
  borderColor: 'neutral.500',
3841
3861
  cursor: 'not-allowed'
3842
3862
  }
@@ -3859,11 +3879,14 @@ const errors = /*#__PURE__*/definePartsStyle$1({
3859
3879
  },
3860
3880
  label: {
3861
3881
  fontSize: '12px'
3882
+ },
3883
+ icon: {
3884
+ fontSize: '7px'
3862
3885
  }
3863
3886
  });
3864
3887
  const unstyled = /*#__PURE__*/definePartsStyle$1({
3865
3888
  control: {
3866
- borderColor: 'neutral.500',
3889
+ borderColor: 'neutral.600',
3867
3890
  _checked: {
3868
3891
  borderColor: 'primary.500',
3869
3892
  backgroundColor: 'primary.500',
@@ -3872,21 +3895,33 @@ const unstyled = /*#__PURE__*/definePartsStyle$1({
3872
3895
  backgroundColor: 'primary.600'
3873
3896
  },
3874
3897
  _disabled: {
3875
- backgroundColor: 'neutral.500',
3876
- borderColor: 'neutral.500'
3898
+ backgroundColor: 'primary.500',
3899
+ borderColor: 'primary.500',
3900
+ opacity: 0.3
3877
3901
  }
3878
3902
  },
3879
3903
  _disabled: {
3880
- backgroundColor: 'neutral.500',
3881
- borderColor: 'neutral.500'
3904
+ backgroundColor: 'neutral.200',
3905
+ borderColor: 'neutral.200'
3882
3906
  },
3883
3907
  _indeterminate: {
3884
3908
  borderColor: 'primary.500',
3885
- backgroundColor: 'primary.500'
3909
+ backgroundColor: 'primary.500',
3910
+ _disabled: {
3911
+ backgroundColor: 'primary.500',
3912
+ borderColor: 'primary.500',
3913
+ opacity: 0.3
3914
+ }
3886
3915
  }
3887
3916
  },
3888
3917
  label: {
3889
- fontSize: '12px'
3918
+ fontSize: '12px',
3919
+ _disabled: {
3920
+ opacity: 1
3921
+ }
3922
+ },
3923
+ icon: {
3924
+ fontSize: '7px'
3890
3925
  }
3891
3926
  });
3892
3927
  const variants$1 = {
@@ -3949,10 +3984,13 @@ const Chips = /*#__PURE__*/defineStyleConfig({
3949
3984
  },
3950
3985
  sizes: {
3951
3986
  sm: {
3952
- fontSize: '12px'
3987
+ fontSize: '12px',
3988
+ lineHeight: 4
3953
3989
  },
3954
3990
  md: {
3955
- fontSize: '14px'
3991
+ fontSize: '14px',
3992
+ paddingY: 2,
3993
+ lineHeight: 5
3956
3994
  }
3957
3995
  },
3958
3996
  defaultProps: {
@@ -4012,7 +4050,7 @@ const size = {
4012
4050
  }),
4013
4051
  sm: /*#__PURE__*/defineStyle$1({
4014
4052
  fontSize: 'text.sm',
4015
- h: 9.5,
4053
+ h: 9,
4016
4054
  borderRadius: 'md'
4017
4055
  })
4018
4056
  };
@@ -4196,7 +4234,8 @@ const baseStyle$4 = /*#__PURE__*/definePartsStyle$4({
4196
4234
  textStyle: 'text.sm',
4197
4235
  color: 'black.high',
4198
4236
  _disabled: {
4199
- color: 'black.low'
4237
+ opacity: 1,
4238
+ color: 'black.medium'
4200
4239
  }
4201
4240
  }
4202
4241
  });
@@ -4213,21 +4252,22 @@ const errors$1 = /*#__PURE__*/definePartsStyle$4({
4213
4252
  },
4214
4253
  _hover: {
4215
4254
  borderColor: 'danger.500',
4216
- bg: 'gray.200'
4255
+ bg: 'neutral.200'
4217
4256
  },
4218
4257
  _disabled: {
4219
4258
  borderColor: 'danger.500',
4220
- bg: 'white',
4259
+ bg: 'white.high',
4221
4260
  _before: {
4222
4261
  h: '10px',
4223
4262
  w: '10px',
4224
- bg: 'neutral.500'
4263
+ bg: 'primary.500',
4264
+ opacity: 0.3
4225
4265
  }
4226
4266
  }
4227
4267
  },
4228
4268
  _disabled: {
4229
4269
  borderColor: 'danger.500',
4230
- bg: 'neutral.500'
4270
+ bg: 'neutral.200'
4231
4271
  }
4232
4272
  },
4233
4273
  label: {
@@ -4250,18 +4290,19 @@ const unstyled$2 = /*#__PURE__*/definePartsStyle$4({
4250
4290
  bg: 'gray.200'
4251
4291
  },
4252
4292
  _disabled: {
4253
- borderColor: 'neutral.500',
4254
- bg: 'white',
4293
+ borderColor: 'primary.500',
4294
+ bg: 'white.high',
4295
+ opacity: 0.3,
4255
4296
  _before: {
4256
4297
  h: '10px',
4257
4298
  w: '10px',
4258
- bg: 'neutral.500'
4299
+ bg: 'primary.500'
4259
4300
  }
4260
4301
  }
4261
4302
  },
4262
4303
  _disabled: {
4263
- borderColor: 'neutral.500',
4264
- bg: 'neutral.500'
4304
+ borderColor: 'neutral.200',
4305
+ bg: 'neutral.200'
4265
4306
  }
4266
4307
  },
4267
4308
  label: {
@@ -4508,5 +4549,34 @@ const Provider = ({
4508
4549
  };
4509
4550
  Provider.displayName = 'Provider';
4510
4551
 
4511
- export { Alert, AlertAction, AlertClose, AlertDescription, AlertIcon, AlertTitle, Badge, Box, BreadCrumb, Button, CardCustom as Card, CheckboxComponent as Checkbox, CheckboxGroupComponent as CheckboxGroup, Container, DataTable, DatePickerMonth, Datepicker, Field, Flex, Grid, 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, Stack, Switch, Tab, TabList, TabPanel, Text, TextareaField, Uploader, Wrap, foundations, theme, useAlertStyles, useInternalUI };
4552
+ function useFetcher() {
4553
+ const {
4554
+ instance
4555
+ } = useInternalUI();
4556
+ const axiosInstance = useMemo(() => instance || axios, [instance]);
4557
+ const fetcher = async ({
4558
+ url,
4559
+ data,
4560
+ method,
4561
+ headers,
4562
+ ...config
4563
+ }) => {
4564
+ const response = await axiosInstance.request({
4565
+ data,
4566
+ url,
4567
+ method,
4568
+ headers: {
4569
+ 'Content-Type': 'application/json; charset=utf-8',
4570
+ ...headers
4571
+ },
4572
+ ...config
4573
+ });
4574
+ return response;
4575
+ };
4576
+ return {
4577
+ fetcher
4578
+ };
4579
+ }
4580
+
4581
+ export { Alert, AlertAction, AlertClose, AlertDescription, AlertIcon, AlertTitle, Badge, BreadCrumb, Button, CardCustom as Card, CheckboxComponent as Checkbox, CheckboxGroupComponent as CheckboxGroup, 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, foundations, theme, useAlertStyles, useFetcher, useInternalUI };
4512
4582
  //# sourceMappingURL=internal-ui.esm.js.map