@ctlyst.id/internal-ui 2.0.1 → 2.0.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
1
- import { Badge as Badge$1, 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';
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
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
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';
@@ -27,11 +27,9 @@ const Badge = props => {
27
27
  pill,
28
28
  ...rest
29
29
  } = props;
30
- return /*#__PURE__*/React__default.createElement(Badge$1, Object.assign({
30
+ return /*#__PURE__*/React__default.createElement(Badge$2, Object.assign({
31
31
  borderRadius: pill ? 10 : 4,
32
- variant: "solid",
33
- color: "white",
34
- fontSize: "10px",
32
+ variant: "primary-solid",
35
33
  padding: "0 8px",
36
34
  height: "18px",
37
35
  display: "flex",
@@ -476,6 +474,41 @@ DataTable.defaultProps = {
476
474
  sortingState: []
477
475
  };
478
476
 
477
+ const getProperties = props => {
478
+ const {
479
+ isError,
480
+ isDisabled,
481
+ isSuccess
482
+ } = props;
483
+ let outlineColor = 'neutral.400';
484
+ let focusColor = 'primary.500';
485
+ if (isError || isDisabled || isSuccess) {
486
+ if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
487
+ focusColor = outlineColor;
488
+ }
489
+ return {
490
+ outlineColor,
491
+ focusColor
492
+ };
493
+ };
494
+ const getWrapperStyle = props => {
495
+ const {
496
+ outlineColor,
497
+ focusColor
498
+ } = getProperties(props);
499
+ const style = {
500
+ border: '1px solid',
501
+ borderColor: outlineColor,
502
+ borderRadius: 'md',
503
+ transition: 'all 0.15s',
504
+ boxShadow: 'none',
505
+ _focusWithin: {
506
+ borderColor: focusColor
507
+ }
508
+ };
509
+ return defineStyle(style);
510
+ };
511
+
479
512
  const Styles = () => {
480
513
  const {
481
514
  colorMode
@@ -1347,6 +1380,7 @@ const Datepicker = ({
1347
1380
  var _props$dateFormat;
1348
1381
  const selected = value ? new Date(value) : undefined;
1349
1382
  const dateFormat = ((_props$dateFormat = props.dateFormat) !== null && _props$dateFormat !== void 0 ? _props$dateFormat : withTime) ? 'yyyy-MM-dd HH:mm' : 'yyyy-MM-dd';
1383
+ const wrapperStyle = getWrapperStyle({});
1350
1384
  const getTimeProps = () => {
1351
1385
  if (!withTime) return {};
1352
1386
  return {
@@ -1359,9 +1393,9 @@ const Datepicker = ({
1359
1393
  id: id,
1360
1394
  name: name,
1361
1395
  selected: selected,
1362
- customInput: /*#__PURE__*/React__default.createElement(Input$1, {
1396
+ customInput: /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
1363
1397
  autoComplete: "off"
1364
- }),
1398
+ }, wrapperStyle)),
1365
1399
  dateFormat: dateFormat,
1366
1400
  showPopperArrow: false,
1367
1401
  calendarClassName: classnames({
@@ -1910,45 +1944,10 @@ MultiDatePickerMonth.defaultProps = {
1910
1944
  isError: false
1911
1945
  };
1912
1946
 
1913
- const getProperties = props => {
1914
- const {
1915
- isError,
1916
- isDisabled,
1917
- isSuccess
1918
- } = props;
1919
- let outlineColor = 'neutral.400';
1920
- let focusColor = 'primary.500';
1921
- if (isError || isDisabled || isSuccess) {
1922
- if (isError) outlineColor = 'danger.500';else if (isSuccess) outlineColor = 'success.500';
1923
- focusColor = outlineColor;
1924
- }
1925
- return {
1926
- outlineColor,
1927
- focusColor
1928
- };
1929
- };
1930
- const getWrapperStyle = props => {
1931
- const {
1932
- outlineColor,
1933
- focusColor
1934
- } = getProperties(props);
1935
- const style = {
1936
- border: '1px solid',
1937
- borderColor: outlineColor,
1938
- borderRadius: 'md',
1939
- transition: 'all 0.15s',
1940
- boxShadow: 'none',
1941
- _focusWithin: {
1942
- borderColor: focusColor
1943
- }
1944
- };
1945
- return defineStyle(style);
1946
- };
1947
-
1948
1947
  const InputAddonLeft = ({
1949
1948
  children
1950
1949
  }) => {
1951
- return /*#__PURE__*/React__default.createElement(Box, {
1950
+ return /*#__PURE__*/React__default.createElement(InputLeftAddon, {
1952
1951
  borderLeftRadius: "md",
1953
1952
  backgroundColor: "neutral.200",
1954
1953
  px: 3,
@@ -1958,7 +1957,7 @@ const InputAddonLeft = ({
1958
1957
  const InputAddonRight = ({
1959
1958
  children
1960
1959
  }) => {
1961
- return /*#__PURE__*/React__default.createElement(Box, {
1960
+ return /*#__PURE__*/React__default.createElement(InputRightAddon, {
1962
1961
  borderRightRadius: "md",
1963
1962
  backgroundColor: "neutral.200",
1964
1963
  px: 3,
@@ -1972,8 +1971,6 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
1972
1971
  type,
1973
1972
  addOnLeft,
1974
1973
  addOnRight,
1975
- elementLeft,
1976
- elementRight,
1977
1974
  size,
1978
1975
  isRequired,
1979
1976
  label,
@@ -2017,7 +2014,7 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
2017
2014
  borderRadius: "md",
2018
2015
  backgroundColor: isDisabled ? 'neutral.300' : 'white.high',
2019
2016
  cursor: isDisabled ? 'not-allowed' : 'default'
2020
- }, addOnLeft && /*#__PURE__*/React__default.createElement(InputAddonLeft, null, addOnLeft), /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
2017
+ }, addOnLeft, /*#__PURE__*/React__default.createElement(Input$1, Object.assign({
2021
2018
  ref: ref,
2022
2019
  type: inputType,
2023
2020
  value: value,
@@ -2064,13 +2061,11 @@ const InputField = /*#__PURE__*/React__default.forwardRef((props, ref) => {
2064
2061
  color: iconColor
2065
2062
  })), isLoading && /*#__PURE__*/React__default.createElement(Loader, {
2066
2063
  size: "sm"
2067
- })), "(", addOnRight && /*#__PURE__*/React__default.createElement(InputAddonRight, null, addOnRight))));
2064
+ })), addOnRight)));
2068
2065
  });
2069
2066
  InputField.defaultProps = {
2070
2067
  addOnLeft: undefined,
2071
2068
  addOnRight: undefined,
2072
- elementLeft: undefined,
2073
- elementRight: undefined,
2074
2069
  withClear: undefined,
2075
2070
  isLoading: undefined,
2076
2071
  onClear: undefined
@@ -2221,7 +2216,7 @@ const Version = ({
2221
2216
  version,
2222
2217
  environment,
2223
2218
  onOpenModalRelease
2224
- }) => /*#__PURE__*/createElement(Fragment, null, version && /*#__PURE__*/createElement(Badge$1, {
2219
+ }) => /*#__PURE__*/createElement(Fragment, null, version && /*#__PURE__*/createElement(Badge$2, {
2225
2220
  "data-test-id": "dzl3esjhCphobaaIXpiUE",
2226
2221
  bg: useColorModeValue('primary.500', 'rgba(124, 124, 124, 0.12)'),
2227
2222
  color: useColorModeValue('white', 'secondary.400'),
@@ -3261,6 +3256,72 @@ const alertTheme = /*#__PURE__*/defineMultiStyleConfig({
3261
3256
  }
3262
3257
  });
3263
3258
 
3259
+ const Badge$1 = {
3260
+ baseStyle: {
3261
+ display: 'inline-block',
3262
+ fontSize: 10,
3263
+ fontWeight: 600,
3264
+ lineHeight: '1.25',
3265
+ textTransform: 'none',
3266
+ px: 2,
3267
+ py: '0.5'
3268
+ },
3269
+ variants: {
3270
+ 'primary-solid': {
3271
+ bg: 'primary.500',
3272
+ color: 'white'
3273
+ },
3274
+ 'success-solid': {
3275
+ bg: 'success.500',
3276
+ color: 'white'
3277
+ },
3278
+ 'info-solid': {
3279
+ bg: 'info.500',
3280
+ color: 'white'
3281
+ },
3282
+ 'warning-solid': {
3283
+ bg: 'warning.500',
3284
+ color: 'white'
3285
+ },
3286
+ 'danger-solid': {
3287
+ bg: 'danger.500',
3288
+ color: 'white'
3289
+ },
3290
+ 'neutral-solid': {
3291
+ bg: 'neutral.600',
3292
+ color: 'white'
3293
+ },
3294
+ 'primary-light': {
3295
+ bg: 'primary.50',
3296
+ color: 'primary.500'
3297
+ },
3298
+ 'success-light': {
3299
+ bg: 'success.50',
3300
+ color: 'success.500'
3301
+ },
3302
+ 'info-light': {
3303
+ bg: 'info.50',
3304
+ color: 'info.500'
3305
+ },
3306
+ 'warning-light': {
3307
+ bg: 'warning.50',
3308
+ color: 'warning.500'
3309
+ },
3310
+ 'danger-light': {
3311
+ bg: 'danger.50',
3312
+ color: 'danger.500'
3313
+ },
3314
+ 'neutral-light': {
3315
+ bg: 'neutral.100',
3316
+ color: 'neutral.600'
3317
+ }
3318
+ },
3319
+ // The default size and variant values
3320
+ defaultProps: {
3321
+ variant: 'primary-solid'
3322
+ }
3323
+ };
3324
+
3264
3325
  // You can also use the more specific type for
3265
3326
  // a single part component: ComponentSingleStyleConfig
3266
3327
  const Button$1 = /*#__PURE__*/defineStyleConfig({
@@ -4160,6 +4221,7 @@ const Textarea = /*#__PURE__*/defineStyleConfig$1({
4160
4221
  var components = {
4161
4222
  __proto__: null,
4162
4223
  Alert: alertTheme,
4224
+ Badge: Badge$1,
4163
4225
  Button: Button$1,
4164
4226
  Card: CardStyle,
4165
4227
  Checkbox: Checkbox,
@@ -4231,5 +4293,5 @@ const Provider = ({
4231
4293
  };
4232
4294
  Provider.displayName = 'Provider';
4233
4295
 
4234
- 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 };
4296
+ 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 };
4235
4297
  //# sourceMappingURL=internal-ui.esm.js.map