@ctlyst.id/internal-ui 1.1.0-canary.0 → 2.0.0-canary.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
- import { useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, useStyleConfig, Card, Checkbox as Checkbox$1, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, InputGroup, Input as Input$1, InputRightAddon, FormControl, FormLabel as FormLabel$1, InputRightElement, FormHelperText, FormErrorMessage, theme as theme$1, InputLeftAddon, InputLeftElement, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, Badge, forwardRef as forwardRef$1, ModalBody as ModalBody$1, ModalCloseButton as ModalCloseButton$1, ModalFooter as ModalFooter$1, ModalHeader as ModalHeader$1, createIcon, Icon, Portal, Link, Button as Button$1, VisuallyHidden, Select as Select$1, useTab, useMultiStyleConfig, TabList as TabList$1, TabPanel as TabPanel$1, Stack, Heading, createMultiStyleConfigHelpers, extendTheme } from '@chakra-ui/react';
1
+ import { useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, Checkbox as Checkbox$1, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, InputGroup, Input as Input$1, InputRightAddon, FormControl, FormLabel as FormLabel$1, InputRightElement, FormHelperText, FormErrorMessage, theme as theme$1, InputLeftAddon, InputLeftElement, forwardRef, useStyleConfig, Textarea as Textarea$1, Image, useDisclosure, Popover as Popover$1, HStack, VStack, PopoverTrigger, Avatar, PopoverContent, PopoverArrow, PopoverBody, useColorMode as useColorMode$1, Badge, ModalBody as ModalBody$1, ModalCloseButton as ModalCloseButton$1, ModalFooter as ModalFooter$1, ModalHeader as ModalHeader$1, createIcon, Icon, Portal, Link, Button as Button$1, VisuallyHidden, Select as Select$1, useTab, useMultiStyleConfig, TabList as TabList$1, TabPanel as TabPanel$1, Stack, Heading, createMultiStyleConfigHelpers, defineStyleConfig as defineStyleConfig$1, defineStyle as defineStyle$1, extendTheme } from '@chakra-ui/react';
2
2
  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, 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';
3
- import React__default, { createElement, forwardRef, useRef, useEffect, useState, useMemo, Fragment, useCallback, createContext, useContext } from 'react';
3
+ import React__default, { createElement, useRef, useEffect, useState, useMemo, Fragment, forwardRef as forwardRef$1, useCallback, createContext, useContext } from 'react';
4
4
  import { FiChevronsRight, FiHome, FiCalendar, FiX, FiPower, FiMoon, FiSun, FiShoppingBag, FiShoppingCart, FiRepeat, FiBox, FiLayers, FiDollarSign, FiUsers, FiRotateCcw, FiSettings, FiLayout, FiGift, FiChevronDown } from 'react-icons/fi';
5
5
  import { ChevronUpIcon, ChevronDownIcon, UpDownIcon, ArrowLeftIcon, ChevronLeftIcon, ChevronRightIcon, ArrowRightIcon } from '@chakra-ui/icons';
6
6
  import { css, Global, keyframes } from '@emotion/react';
@@ -15,8 +15,8 @@ import ReactSelectAsyncCreatable from 'react-select/async-creatable';
15
15
  import ReactSelectCreatable from 'react-select/creatable';
16
16
  import { useDropzone } from 'react-dropzone';
17
17
  import { mode, getColor } from '@chakra-ui/theme-tools';
18
- import { defineStyleConfig, defineStyle, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1 } from '@chakra-ui/styled-system';
19
18
  import { checkboxAnatomy, inputAnatomy, popoverAnatomy, radioAnatomy, switchAnatomy } from '@chakra-ui/anatomy';
19
+ import { defineStyleConfig, defineStyle, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1 } from '@chakra-ui/styled-system';
20
20
  import '@fontsource/poppins';
21
21
  import axios from 'axios';
22
22
 
@@ -115,22 +115,6 @@ BreadCrumb.defaultProps = {
115
115
  spacing: 2
116
116
  };
117
117
 
118
- const CardCustom = /*#__PURE__*/forwardRef(({
119
- children,
120
- ...rest
121
- }, ref) => {
122
- const styles = useStyleConfig('Card', rest);
123
- return /*#__PURE__*/React__default.createElement(Card, Object.assign({
124
- __css: styles,
125
- backgroundColor: "white.high",
126
- ref: ref
127
- }, rest), children);
128
- });
129
- CardCustom.defaultProps = {
130
- withShadow: true,
131
- isRounded: true
132
- };
133
-
134
118
  function CheckboxComponent({
135
119
  isError = false,
136
120
  helpText = '',
@@ -1792,6 +1776,7 @@ const Field = props => {
1792
1776
  return /*#__PURE__*/React__default.createElement(FormControl, {
1793
1777
  isInvalid: isError
1794
1778
  }, label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(FormLabel$1, {
1779
+ mb: 1,
1795
1780
  fontSize: "text.sm",
1796
1781
  requiredIndicator: undefined
1797
1782
  }, isRequired && /*#__PURE__*/React__default.createElement(Box, {
@@ -1871,21 +1856,36 @@ InputField.defaultProps = {
1871
1856
  elementRight: undefined
1872
1857
  };
1873
1858
 
1859
+ const Loader = /*#__PURE__*/forwardRef((props, ref) => {
1860
+ const styles = useStyleConfig('LoaderStyle', props);
1861
+ return /*#__PURE__*/React__default.createElement(Box, {
1862
+ ref: ref,
1863
+ __css: styles
1864
+ });
1865
+ });
1866
+
1874
1867
  const TextareaField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1875
1868
  const {
1876
1869
  value,
1870
+ isLoading,
1877
1871
  ...inputProps
1878
1872
  } = props;
1879
- return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, inputProps), /*#__PURE__*/React__default.createElement(Textarea$1, Object.assign({
1873
+ return /*#__PURE__*/React__default.createElement(Field, Object.assign({}, inputProps), /*#__PURE__*/React__default.createElement(Box, {
1874
+ position: "relative"
1875
+ }, /*#__PURE__*/React__default.createElement(Textarea$1, Object.assign({
1880
1876
  ref: ref,
1881
1877
  value: value
1882
- }, inputProps)));
1878
+ }, inputProps)), isLoading && /*#__PURE__*/React__default.createElement(Box, {
1879
+ zIndex: 999,
1880
+ top: 2,
1881
+ right: 2,
1882
+ position: "absolute"
1883
+ }, /*#__PURE__*/React__default.createElement(Loader, {
1884
+ size: "sm"
1885
+ }))));
1883
1886
  });
1884
1887
  TextareaField.defaultProps = {
1885
- addOnLeft: undefined,
1886
- addOnRight: undefined,
1887
- elementLeft: undefined,
1888
- elementRight: undefined
1888
+ isLoading: undefined
1889
1889
  };
1890
1890
 
1891
1891
  const XMSLogo = () => /*#__PURE__*/React__default.createElement(Image, {
@@ -2072,14 +2072,6 @@ Header.defaultProps = {
2072
2072
  hideSwitchMode: false
2073
2073
  };
2074
2074
 
2075
- const Loader = /*#__PURE__*/forwardRef$1((props, ref) => {
2076
- const styles = useStyleConfig('LoaderStyle', props);
2077
- return /*#__PURE__*/React__default.createElement(Box, {
2078
- ref: ref,
2079
- __css: styles
2080
- });
2081
- });
2082
-
2083
2075
  const ModalBody = /*#__PURE__*/React__default.forwardRef(({
2084
2076
  children,
2085
2077
  ...rest
@@ -2090,7 +2082,7 @@ const ModalBody = /*#__PURE__*/React__default.forwardRef(({
2090
2082
  }, rest), children);
2091
2083
  });
2092
2084
 
2093
- const ModalCloseButton = /*#__PURE__*/forwardRef((props, ref) => {
2085
+ const ModalCloseButton = /*#__PURE__*/forwardRef$1((props, ref) => {
2094
2086
  return /*#__PURE__*/React__default.createElement(ModalCloseButton$1, Object.assign({
2095
2087
  ref: ref,
2096
2088
  top: 4,
@@ -2100,7 +2092,7 @@ const ModalCloseButton = /*#__PURE__*/forwardRef((props, ref) => {
2100
2092
  }, props));
2101
2093
  });
2102
2094
 
2103
- const ModalFooter = /*#__PURE__*/forwardRef(({
2095
+ const ModalFooter = /*#__PURE__*/forwardRef$1(({
2104
2096
  children,
2105
2097
  ...rest
2106
2098
  }, ref) => {
@@ -2111,7 +2103,7 @@ const ModalFooter = /*#__PURE__*/forwardRef(({
2111
2103
  }, rest), children);
2112
2104
  });
2113
2105
 
2114
- const ModalHeader = /*#__PURE__*/forwardRef(({
2106
+ const ModalHeader = /*#__PURE__*/forwardRef$1(({
2115
2107
  children,
2116
2108
  ...rest
2117
2109
  }, ref) => {
@@ -2262,7 +2254,7 @@ Navigation.defaultProps = {
2262
2254
  host: undefined
2263
2255
  };
2264
2256
 
2265
- const PaginationButton = /*#__PURE__*/forwardRef$1(({
2257
+ const PaginationButton = /*#__PURE__*/forwardRef(({
2266
2258
  className,
2267
2259
  style,
2268
2260
  isActive,
@@ -2674,7 +2666,7 @@ function SelectCreatable({
2674
2666
  })));
2675
2667
  }
2676
2668
 
2677
- const Tab = /*#__PURE__*/forwardRef$1((props, ref) => {
2669
+ const Tab = /*#__PURE__*/forwardRef((props, ref) => {
2678
2670
  var _props$leftAddon, _props$rightAddon;
2679
2671
  const tabProps = useTab({
2680
2672
  ...props,
@@ -2702,13 +2694,13 @@ const Tab = /*#__PURE__*/forwardRef$1((props, ref) => {
2702
2694
  })));
2703
2695
  });
2704
2696
 
2705
- const TabList = /*#__PURE__*/forwardRef$1((props, ref) => /*#__PURE__*/React__default.createElement(TabList$1, {
2697
+ const TabList = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React__default.createElement(TabList$1, {
2706
2698
  borderBottom: "1px solid",
2707
2699
  borderColor: useColorModeValue('gray.200', 'bright-gray.800'),
2708
2700
  ref: ref
2709
2701
  }, props.children));
2710
2702
 
2711
- const TabPanel = /*#__PURE__*/forwardRef$1((props, ref) => /*#__PURE__*/React__default.createElement(TabPanel$1, {
2703
+ const TabPanel = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/React__default.createElement(TabPanel$1, {
2712
2704
  px: 0,
2713
2705
  ref: ref
2714
2706
  }, props.children));
@@ -2907,15 +2899,6 @@ const Button = {
2907
2899
  }
2908
2900
  };
2909
2901
 
2910
- const CardStyle = /*#__PURE__*/defineStyleConfig({
2911
- baseStyle: props => {
2912
- return {
2913
- shadow: props.withShadow ? 'raised' : 'none',
2914
- borderRadius: props.isRounded ? 'lg' : 'none'
2915
- };
2916
- }
2917
- });
2918
-
2919
2902
  const {
2920
2903
  definePartsStyle,
2921
2904
  defineMultiStyleConfig
@@ -3339,37 +3322,90 @@ const Switch = /*#__PURE__*/defineMultiStyleConfig$2({
3339
3322
  baseStyle: baseStyle$3
3340
3323
  });
3341
3324
 
3342
- const Textarea = {
3343
- baseStyle: {
3325
+ const getProps = props => {
3326
+ const {
3327
+ isError,
3328
+ isSuccess,
3329
+ isDisabled
3330
+ } = props;
3331
+ let borderColor = 'neutral.400';
3332
+ let focusBorderColor = 'primary.500';
3333
+ if (isError) {
3334
+ borderColor = 'danger.500';
3335
+ focusBorderColor = 'danger.500';
3336
+ } else if (isSuccess) {
3337
+ borderColor = 'success.500';
3338
+ focusBorderColor = 'success.500';
3339
+ } else if (isDisabled && !isError && !isSuccess) {
3340
+ borderColor = 'neutral.400';
3341
+ focusBorderColor = 'danger.500';
3342
+ }
3343
+ return {
3344
+ focusBorderColor,
3345
+ borderColor
3346
+ };
3347
+ };
3348
+ const outline$1 = /*#__PURE__*/defineStyle$1(props => {
3349
+ const {
3350
+ focusBorderColor,
3351
+ borderColor
3352
+ } = getProps(props);
3353
+ return {
3354
+ background: 'white.high',
3355
+ color: 'black.high',
3356
+ borderColor,
3357
+ fontSize: 'text.sm',
3358
+ padding: 2,
3359
+ borderRadius: 'md',
3360
+ borderWidth: '1px',
3361
+ outline: 'none',
3362
+ _disabled: {
3363
+ opacity: 1,
3364
+ color: 'black.low',
3365
+ background: 'neutral.300'
3366
+ },
3367
+ _placeholder: {
3368
+ color: 'black.low'
3369
+ },
3344
3370
  _hover: {
3345
- borderColor: 'primary.500',
3346
- boxShadow: 'none',
3347
- outline: 'none'
3371
+ borderColor
3348
3372
  },
3349
3373
  _focus: {
3350
- borderColor: 'primary.500',
3351
- boxShadow: 'none',
3352
- outline: 'none'
3374
+ outline: 'none',
3375
+ borderColor: focusBorderColor,
3376
+ boxShadow: 'none'
3353
3377
  },
3354
3378
  _focusVisible: {
3355
- borderColor: 'primary.500',
3356
- boxShadow: 'none',
3357
- outline: 'none'
3379
+ outline: 'none',
3380
+ borderColor: focusBorderColor,
3381
+ boxShadow: 'none'
3358
3382
  },
3359
3383
  _focusWithin: {
3360
- borderColor: 'primary.500',
3361
- boxShadow: 'none',
3362
- outline: 'none'
3384
+ outline: 'none',
3385
+ borderColor: focusBorderColor,
3386
+ boxShadow: 'none'
3387
+ },
3388
+ _invalid: {
3389
+ outline: 'none',
3390
+ borderColor: 'danger.500',
3391
+ boxShadow: 'none'
3363
3392
  }
3393
+ };
3394
+ });
3395
+ const Textarea = /*#__PURE__*/defineStyleConfig$1({
3396
+ variants: {
3397
+ outline: outline$1
3398
+ },
3399
+ defaultProps: {
3400
+ variant: 'outline'
3364
3401
  }
3365
- };
3402
+ });
3366
3403
 
3367
3404
 
3368
3405
 
3369
3406
  var components = {
3370
3407
  __proto__: null,
3371
3408
  Button: Button,
3372
- Card: CardStyle,
3373
3409
  Checkbox: Checkbox,
3374
3410
  FormLabel: FormLabel,
3375
3411
  Input: Input,
@@ -3438,5 +3474,5 @@ const Provider = ({
3438
3474
  };
3439
3475
  Provider.displayName = 'Provider';
3440
3476
 
3441
- export { BreadCrumb, CardCustom as Card, CheckboxComponent as Checkbox, DataTable, DatePickerMonth, Datepicker, Field, Header, InputField, Loader, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Tab, TabList, TabPanel, TextareaField, Uploader, theme, useInternalUI };
3477
+ export { BreadCrumb, CheckboxComponent as Checkbox, DataTable, DatePickerMonth, Datepicker, Field, Header, InputField, Loader, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Tab, TabList, TabPanel, TextareaField, Uploader, theme, useInternalUI };
3442
3478
  //# sourceMappingURL=internal-ui.esm.js.map