@ctlyst.id/internal-ui 2.0.2 → 2.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
- import { Badge as Badge$2, useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, forwardRef, useStyleConfig, Button as Button$2, Card, Checkbox as Checkbox$1, FormControl, FormLabel as FormLabel$1, FormHelperText, FormErrorMessage, CheckboxGroup, Stack, Flex, Spinner, Table, Thead, Tr, Th, Tbody, Td, InputGroup, Input as Input$1, InputRightAddon, InputRightElement, theme as theme$1, defineStyle, 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, omitThemingProps, useCheckbox, chakra, useTab, TabList as TabList$1, TabPanel as TabPanel$1, Heading, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, defineStyleConfig as defineStyleConfig$1, extendTheme } from '@chakra-ui/react';
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';
1
+ import { Badge as Badge$2, useToken, Box, Text, useColorModeValue, Breadcrumb, BreadcrumbItem, BreadcrumbLink, forwardRef, useStyleConfig, Button as Button$2, 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, omitThemingProps, useCheckbox, chakra, useTab, TabList as TabList$1, TabPanel as TabPanel$1, Heading, createMultiStyleConfigHelpers as createMultiStyleConfigHelpers$1, defineStyleConfig as defineStyleConfig$1, extendTheme } from '@chakra-ui/react';
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, 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';
3
3
  import React__default, { createElement, forwardRef as forwardRef$1, useRef, useEffect, useState, useMemo, Fragment, 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';
@@ -223,7 +223,6 @@ CheckboxComponent.defaultProps = {
223
223
  errorText: ''
224
224
  };
225
225
 
226
- /* eslint-disable no-nested-ternary */
227
226
  const Field = props => {
228
227
  const {
229
228
  label,
@@ -233,7 +232,8 @@ const Field = props => {
233
232
  rightHelperText,
234
233
  isRequired,
235
234
  children,
236
- isSuccess
235
+ isSuccess,
236
+ boxProps = {}
237
237
  } = props;
238
238
  const getHelperColor = () => {
239
239
  if (isError) return 'danger.500';
@@ -246,9 +246,9 @@ const Field = props => {
246
246
  };
247
247
  const helperColor = getHelperColor();
248
248
  const justifyHelper = getJustifyContentHelper();
249
- return /*#__PURE__*/React__default.createElement(FormControl, {
249
+ return /*#__PURE__*/React__default.createElement(FormControl, Object.assign({
250
250
  isInvalid: isError
251
- }, label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(FormLabel$1, {
251
+ }, boxProps), label && (typeof label === 'string' ? /*#__PURE__*/React__default.createElement(FormLabel$1, {
252
252
  mb: 1,
253
253
  fontSize: "text.sm",
254
254
  requiredIndicator: undefined
@@ -261,19 +261,19 @@ const Field = props => {
261
261
  display: "flex",
262
262
  width: "full",
263
263
  justifyContent: justifyHelper
264
- }, !isError ? leftHelperText && /*#__PURE__*/React__default.createElement(FormHelperText, {
264
+ }, !isError ? leftHelperText && (typeof leftHelperText === 'string' ? /*#__PURE__*/React__default.createElement(FormHelperText, {
265
265
  fontSize: "text.xs",
266
266
  color: helperColor,
267
267
  mt: 1
268
- }, leftHelperText) : typeof errorMessage === 'string' ? /*#__PURE__*/React__default.createElement(FormErrorMessage, {
268
+ }, leftHelperText) : leftHelperText) : typeof errorMessage === 'string' ? /*#__PURE__*/React__default.createElement(FormErrorMessage, {
269
269
  fontSize: "text.xs",
270
270
  color: "danger.500",
271
271
  mt: 1
272
- }, errorMessage) : errorMessage, rightHelperText && /*#__PURE__*/React__default.createElement(FormHelperText, {
272
+ }, errorMessage) : errorMessage, rightHelperText && (typeof rightHelperText === 'string' ? /*#__PURE__*/React__default.createElement(FormHelperText, {
273
273
  fontSize: "text.xs",
274
274
  color: helperColor,
275
275
  mt: 1
276
- }, rightHelperText)));
276
+ }, rightHelperText) : rightHelperText)));
277
277
  };
278
278
  Field.defaultProps = {
279
279
  label: '',
@@ -282,7 +282,8 @@ Field.defaultProps = {
282
282
  errorMessage: undefined,
283
283
  leftHelperText: undefined,
284
284
  rightHelperText: undefined,
285
- isRequired: false
285
+ isRequired: false,
286
+ boxProps: {}
286
287
  };
287
288
 
288
289
  function CheckboxGroupComponent(props) {
@@ -474,6 +475,41 @@ DataTable.defaultProps = {
474
475
  sortingState: []
475
476
  };
476
477
 
478
+ const getProperties = props => {
479
+ const {
480
+ isError,
481
+ isDisabled,
482
+ isSuccess
483
+ } = props;
484
+ let outlineColor = 'neutral.400';
485
+ let focusColor = 'primary.500';
486
+ if (isError || isDisabled || isSuccess) {
487
+ if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
488
+ focusColor = outlineColor;
489
+ }
490
+ return {
491
+ outlineColor,
492
+ focusColor
493
+ };
494
+ };
495
+ const getWrapperStyle = props => {
496
+ const {
497
+ outlineColor,
498
+ focusColor
499
+ } = getProperties(props);
500
+ const style = {
501
+ border: '1px solid',
502
+ borderColor: outlineColor,
503
+ borderRadius: 'md',
504
+ transition: 'all 0.15s',
505
+ boxShadow: 'none',
506
+ _focusWithin: {
507
+ borderColor: focusColor
508
+ }
509
+ };
510
+ return defineStyle(style);
511
+ };
512
+
477
513
  const Styles = () => {
478
514
  const {
479
515
  colorMode
@@ -1345,6 +1381,7 @@ const Datepicker = ({
1345
1381
  var _props$dateFormat;
1346
1382
  const selected = value ? new Date(value) : undefined;
1347
1383
  const dateFormat = ((_props$dateFormat = props.dateFormat) !== null && _props$dateFormat !== void 0 ? _props$dateFormat : withTime) ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
1384
+ const wrapperStyle = getWrapperStyle({});
1348
1385
  const getTimeProps = () => {
1349
1386
  if (!withTime) return {};
1350
1387
  return {
@@ -1357,9 +1394,9 @@ const Datepicker = ({
1357
1394
  id: id,
1358
1395
  name: name,
1359
1396
  selected: selected,
1360
- customInput: /*#__PURE__*/React__default.createElement(Input$1, {
1397
+ customInput: /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
1361
1398
  autoComplete: "off"
1362
- }),
1399
+ }, wrapperStyle)),
1363
1400
  dateFormat: dateFormat,
1364
1401
  showPopperArrow: false,
1365
1402
  calendarClassName: classnames({
@@ -1908,45 +1945,10 @@ MultiDatePickerMonth.defaultProps = {
1908
1945
  isError: false
1909
1946
  };
1910
1947
 
1911
- const getProperties = props => {
1912
- const {
1913
- isError,
1914
- isDisabled,
1915
- isSuccess
1916
- } = props;
1917
- let outlineColor = 'neutral.400';
1918
- let focusColor = 'primary.500';
1919
- if (isError || isDisabled || isSuccess) {
1920
- if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
1921
- focusColor = outlineColor;
1922
- }
1923
- return {
1924
- outlineColor,
1925
- focusColor
1926
- };
1927
- };
1928
- const getWrapperStyle = props => {
1929
- const {
1930
- outlineColor,
1931
- focusColor
1932
- } = getProperties(props);
1933
- const style = {
1934
- border: '1px solid',
1935
- borderColor: outlineColor,
1936
- borderRadius: 'md',
1937
- transition: 'all 0.15s',
1938
- boxShadow: 'none',
1939
- _focusWithin: {
1940
- borderColor: focusColor
1941
- }
1942
- };
1943
- return defineStyle(style);
1944
- };
1945
-
1946
1948
  const InputAddonLeft = ({
1947
1949
  children
1948
1950
  }) => {
1949
- return /*#__PURE__*/React__default.createElement(Box, {
1951
+ return /*#__PURE__*/React__default.createElement(InputLeftAddon, {
1950
1952
  borderLeftRadius: "md",
1951
1953
  backgroundColor: "neutral.200",
1952
1954
  px: 3,
@@ -1956,7 +1958,7 @@ const InputAddonLeft = ({
1956
1958
  const InputAddonRight = ({
1957
1959
  children
1958
1960
  }) => {
1959
- return /*#__PURE__*/React__default.createElement(Box, {
1961
+ return /*#__PURE__*/React__default.createElement(InputRightAddon, {
1960
1962
  borderRightRadius: "md",
1961
1963
  backgroundColor: "neutral.200",
1962
1964
  px: 3,
@@ -1970,8 +1972,6 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1970
1972
  type,
1971
1973
  addOnLeft,
1972
1974
  addOnRight,
1973
- elementLeft,
1974
- elementRight,
1975
1975
  size,
1976
1976
  isRequired,
1977
1977
  label,
@@ -2015,7 +2015,7 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
2015
2015
  borderRadius: "md",
2016
2016
  backgroundColor: isDisabled ? 'neutral.300' : 'white.high',
2017
2017
  cursor: isDisabled ? 'not-allowed' : 'default'
2018
- }, addOnLeft && /*#__PURE__*/React__default.createElement(InputAddonLeft, null, addOnLeft), /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
2018
+ }, addOnLeft, /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
2019
2019
  ref: ref,
2020
2020
  type: inputType,
2021
2021
  value: value,
@@ -2062,13 +2062,11 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
2062
2062
  color: iconColor
2063
2063
  })), isLoading && /*#__PURE__*/React__default.createElement(Loader, {
2064
2064
  size: "sm"
2065
- })), "(", addOnRight && /*#__PURE__*/React__default.createElement(InputAddonRight, null, addOnRight))));
2065
+ })), addOnRight)));
2066
2066
  });
2067
2067
  InputField.defaultProps = {
2068
2068
  addOnLeft: undefined,
2069
2069
  addOnRight: undefined,
2070
- elementLeft: undefined,
2071
- elementRight: undefined,
2072
2070
  withClear: undefined,
2073
2071
  isLoading: undefined,
2074
2072
  onClear: undefined
@@ -4296,5 +4294,5 @@ const Provider = ({
4296
4294
  };
4297
4295
  Provider.displayName = 'Provider';
4298
4296
 
4299
- export { Badge, Box, BreadCrumb, Button, CardCustom as Card, CheckboxComponent as Checkbox, CheckboxGroupComponent as CheckboxGroup, Container, DataTable, DatePickerMonth, Datepicker, Field, Flex, Grid, Header, InputField, Loader, Navigation as MainMenu, ModalBody, ModalCloseButton, ModalFooter, ModalHeader, MultiDatePickerMonth, Pagination, PaginationDetail, PaginationFilter, Provider, ProviderContext, RadioComponent as Radio, RadioGroupComponent as RadioGroup, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Stack, Switch, Tab, TabList, TabPanel, Text, TextareaField, Uploader, Wrap, foundations, theme, useInternalUI };
4297
+ export { 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, Select, SelectAsync, SelectAsyncCreatable, SelectCreatable, Stack, Switch, Tab, TabList, TabPanel, Text, TextareaField, Uploader, Wrap, foundations, theme, useInternalUI };
4300
4298
  //# sourceMappingURL=internal-ui.esm.js.map