@ctlyst.id/internal-ui 2.0.9 → 2.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  export { default as Button } from './components/button';
2
2
  export * from './components/button';
3
- export { ButtonGroup, ButtonGroupProps, CloseButton, CloseButtonProps } from '@chakra-ui/react';
3
+ export { ButtonGroup, ButtonGroupProps, CloseButton, CloseButtonProps, IconButton, IconButtonProps, } from '@chakra-ui/react';
@@ -1,5 +1,5 @@
1
1
  import type { BoxProps, TableBodyProps, TableCellProps, TableColumnHeaderProps, TableHeadProps, TableProps, TableRowProps } from '@chakra-ui/react';
2
- import type { ColumnDef, ColumnSort, RowSelectionInstance, SortingState } from '@tanstack/react-table';
2
+ import type { ColumnDef, RowSelectionInstance, SortingState } from '@tanstack/react-table';
3
3
  import * as React from 'react';
4
4
  export interface TableStyleProps {
5
5
  table?: TableProps;
@@ -16,7 +16,7 @@ export interface DataTableProps<T = unknown> extends BoxProps {
16
16
  isLoading?: boolean;
17
17
  withSelectedRow?: boolean | undefined;
18
18
  onSelectedRow?: (data: T[]) => void;
19
- onSort?: (data: ColumnSort[] | SortingState | ((prevState: SortingState) => SortingState)) => void;
19
+ onSort?: (data: SortingState) => void;
20
20
  manualSorting?: boolean;
21
21
  sortingState?: SortingState;
22
22
  sortDescFirst?: boolean;
@@ -4,3 +4,4 @@ export { default as InputField } from './components/input-field';
4
4
  export * from './components/input-field';
5
5
  export { default as TextareaField } from './components/textarea';
6
6
  export * from './components/textarea';
7
+ export { FormControl, FormControlProps, FormLabel, FormLabelProps, InputGroup, InputGroupProps, RequiredIndicator, RequiredIndicatorProps, } from '@chakra-ui/react';
@@ -22,6 +22,7 @@ export * from './radio';
22
22
  export * from './rating';
23
23
  export * from './select';
24
24
  export * from './switch';
25
+ export * from './table';
25
26
  export * from './tabs';
26
27
  export * from './text';
27
28
  export * from './tooltip';
@@ -1 +1 @@
1
- export { Box, BoxProps, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridItem, GridItemProps, GridProps, HStack, Stack, StackProps, VStack, Wrap, WrapItem, WrapItemProps, WrapProps, } from '@chakra-ui/react';
1
+ export { Box, BoxProps, Center, Collapse, Container, ContainerProps, Divider, DividerProps, Flex, FlexProps, Grid, GridItem, GridItemProps, GridProps, HStack, Spacer, Stack, StackProps, VStack, Wrap, WrapItem, WrapItemProps, WrapProps, } from '@chakra-ui/react';
@@ -1,2 +1,3 @@
1
1
  export { default as Loader } from './components/loader';
2
2
  export * from './components/loader';
3
+ export { ScaleFade, ScaleFadeProps, Skeleton } from '@chakra-ui/react';
@@ -0,0 +1 @@
1
+ export { Table as ChakraTable, TableBodyProps, TableCellProps, TableColumnHeaderProps, TableHeadProps, TableProps, TableRowProps, Tbody, Td, Th, Thead, Tr, } from '@chakra-ui/react';
@@ -1 +1 @@
1
- export { Heading, HeadingProps, Text, TextProps } from '@chakra-ui/react';
1
+ export { Code, CodeProps, Heading, HeadingProps, Link, LinkProps, Text, TextProps } from '@chakra-ui/react';
@@ -1,2 +1,2 @@
1
1
  export { default as useFetcher } from './useFetcher';
2
- export { useColorModeValue, useDisclosure, UseDisclosureProps } from '@chakra-ui/react';
2
+ export { useBoolean, useColorModeValue, useDisclosure, UseDisclosureProps, useToken } from '@chakra-ui/react';
@@ -560,48 +560,6 @@ Chips.defaultProps = {
560
560
  size: 'sm'
561
561
  };
562
562
 
563
- const useCombinedRefs = (...refs) => {
564
- const targetRef = React.useRef();
565
- React.useEffect(() => {
566
- refs.forEach(ref => {
567
- /* eslint-disable no-param-reassign */
568
- if (!ref) return;
569
- if (typeof ref === 'function') {
570
- ref(targetRef.current);
571
- } else {
572
- ref.current = targetRef.current;
573
- }
574
- });
575
- }, [refs]);
576
- return targetRef;
577
- };
578
- const IndeterminateCheckbox = /*#__PURE__*/React.forwardRef(({
579
- isIndeterminate,
580
- isChecked,
581
- ...rest
582
- }, ref) => {
583
- const defaultRef = React.useRef(null);
584
- const combinedRef = useCombinedRefs(ref, defaultRef);
585
- React.useEffect(() => {
586
- if (combinedRef !== null && combinedRef !== void 0 && combinedRef.current) {
587
- combinedRef.current.indeterminate = isIndeterminate !== null && isIndeterminate !== void 0 ? isIndeterminate : false;
588
- }
589
- }, [combinedRef, isIndeterminate]);
590
- return /*#__PURE__*/React__default.createElement(react.Checkbox, Object.assign({
591
- ref: combinedRef,
592
- focusBorderColor: "0",
593
- isIndeterminate: isIndeterminate,
594
- isChecked: isChecked,
595
- inputProps: {
596
- 'data-test-id': `CT_component_indeterminate-checkbox_${rest.id || rest.name}`
597
- }
598
- }, rest));
599
- });
600
- IndeterminateCheckbox.displayName = 'IndeterminateCheckbox';
601
- IndeterminateCheckbox.defaultProps = {
602
- isIndeterminate: false
603
- };
604
-
605
563
  /* eslint-disable react-hooks/rules-of-hooks */
606
564
  const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
607
565
  const {
@@ -618,6 +576,7 @@ const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
618
576
  manualSorting,
619
577
  onRowClick
620
578
  } = props;
579
+ const [isFirstLoad, setIsFirstLoad] = React.useState(true);
621
580
  const [sorting, setSorting] = React.useState(sortingState !== null && sortingState !== void 0 ? sortingState : []);
622
581
  const [rowSelection, onRowSelectionChange] = React.useState({});
623
582
  const dataColumns = React.useMemo(() => columns, [columns]);
@@ -625,20 +584,20 @@ const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
625
584
  id: 'select',
626
585
  header: ({
627
586
  table
628
- }) => /*#__PURE__*/React.createElement(IndeterminateCheckbox, Object.assign({
629
- name: "select-header"
587
+ }) => /*#__PURE__*/React.createElement(react.Checkbox, Object.assign({
588
+ "data-test-id": "select-header-data-table"
630
589
  }, {
631
- checked: table.getIsAllRowsSelected(),
632
- indeterminate: table.getIsSomeRowsSelected(),
590
+ isChecked: table.getIsAllRowsSelected(),
591
+ isIndeterminate: table.getIsSomeRowsSelected(),
633
592
  onChange: table.getToggleAllRowsSelectedHandler()
634
593
  })),
635
594
  cell: ({
636
595
  row
637
- }) => /*#__PURE__*/React.createElement(IndeterminateCheckbox, Object.assign({
638
- name: `select-${row.index}`
596
+ }) => /*#__PURE__*/React.createElement(react.Checkbox, Object.assign({
597
+ "data-test-id": `select-data-table-${row.index}`
639
598
  }, {
640
- checked: row.getIsSelected(),
641
- indeterminate: row.getIsSomeSelected(),
599
+ isChecked: row.getIsSelected(),
600
+ isIndeterminate: row.getIsSomeSelected(),
642
601
  onChange: row.getToggleSelectedHandler()
643
602
  }))
644
603
  }], []);
@@ -650,9 +609,6 @@ const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
650
609
  };
651
610
  const onSortingChange = data => {
652
611
  setSorting(data);
653
- if (onSort) {
654
- onSort(data);
655
- }
656
612
  };
657
613
  const table = reactTable.useReactTable({
658
614
  data: dataSource,
@@ -685,6 +641,14 @@ const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
685
641
  React.useImperativeHandle(ref, () => ({
686
642
  toggleAllRowsSelected
687
643
  }));
644
+ React.useEffect(() => {
645
+ if (onSort && !isFirstLoad) {
646
+ onSort(sorting);
647
+ }
648
+ }, [sorting]);
649
+ React.useEffect(() => {
650
+ setIsFirstLoad(false);
651
+ }, []);
688
652
  return /*#__PURE__*/React.createElement(react.Box, Object.assign({}, props), isLoading && /*#__PURE__*/React.createElement(react.Flex, {
689
653
  w: "100%",
690
654
  h: "100%",
@@ -738,12 +702,12 @@ const DataTable = /*#__PURE__*/React.forwardRef((props, ref) => {
738
702
  key: row.id
739
703
  }, styles === null || styles === void 0 ? void 0 : styles.tableRow, {
740
704
  css: react$1.css`
741
- &:last-child {
742
- td {
743
- border-bottom: none;
744
- }
705
+ &:last-child {
706
+ td {
707
+ border-bottom: none;
745
708
  }
746
- `,
709
+ }
710
+ `,
747
711
  onClick: () => {
748
712
  if (onRowClick) {
749
713
  onRowClick(row.original);
@@ -4731,18 +4695,48 @@ Object.defineProperty(exports, 'ButtonGroup', {
4731
4695
  return react.ButtonGroup;
4732
4696
  }
4733
4697
  });
4698
+ Object.defineProperty(exports, 'Center', {
4699
+ enumerable: true,
4700
+ get: function () {
4701
+ return react.Center;
4702
+ }
4703
+ });
4734
4704
  Object.defineProperty(exports, 'ChakraProvider', {
4735
4705
  enumerable: true,
4736
4706
  get: function () {
4737
4707
  return react.ChakraProvider;
4738
4708
  }
4739
4709
  });
4710
+ Object.defineProperty(exports, 'ChakraTable', {
4711
+ enumerable: true,
4712
+ get: function () {
4713
+ return react.Table;
4714
+ }
4715
+ });
4740
4716
  Object.defineProperty(exports, 'CloseButton', {
4741
4717
  enumerable: true,
4742
4718
  get: function () {
4743
4719
  return react.CloseButton;
4744
4720
  }
4745
4721
  });
4722
+ Object.defineProperty(exports, 'Code', {
4723
+ enumerable: true,
4724
+ get: function () {
4725
+ return react.Code;
4726
+ }
4727
+ });
4728
+ Object.defineProperty(exports, 'Collapse', {
4729
+ enumerable: true,
4730
+ get: function () {
4731
+ return react.Collapse;
4732
+ }
4733
+ });
4734
+ Object.defineProperty(exports, 'ColorModeScript', {
4735
+ enumerable: true,
4736
+ get: function () {
4737
+ return react.ColorModeScript;
4738
+ }
4739
+ });
4746
4740
  Object.defineProperty(exports, 'Container', {
4747
4741
  enumerable: true,
4748
4742
  get: function () {
@@ -4803,6 +4797,18 @@ Object.defineProperty(exports, 'Flex', {
4803
4797
  return react.Flex;
4804
4798
  }
4805
4799
  });
4800
+ Object.defineProperty(exports, 'FormControl', {
4801
+ enumerable: true,
4802
+ get: function () {
4803
+ return react.FormControl;
4804
+ }
4805
+ });
4806
+ Object.defineProperty(exports, 'FormLabel', {
4807
+ enumerable: true,
4808
+ get: function () {
4809
+ return react.FormLabel;
4810
+ }
4811
+ });
4806
4812
  Object.defineProperty(exports, 'Grid', {
4807
4813
  enumerable: true,
4808
4814
  get: function () {
@@ -4833,6 +4839,12 @@ Object.defineProperty(exports, 'Icon', {
4833
4839
  return react.Icon;
4834
4840
  }
4835
4841
  });
4842
+ Object.defineProperty(exports, 'IconButton', {
4843
+ enumerable: true,
4844
+ get: function () {
4845
+ return react.IconButton;
4846
+ }
4847
+ });
4836
4848
  Object.defineProperty(exports, 'Image', {
4837
4849
  enumerable: true,
4838
4850
  get: function () {
@@ -4851,6 +4863,18 @@ Object.defineProperty(exports, 'InputElementRight', {
4851
4863
  return react.InputRightElement;
4852
4864
  }
4853
4865
  });
4866
+ Object.defineProperty(exports, 'InputGroup', {
4867
+ enumerable: true,
4868
+ get: function () {
4869
+ return react.InputGroup;
4870
+ }
4871
+ });
4872
+ Object.defineProperty(exports, 'Link', {
4873
+ enumerable: true,
4874
+ get: function () {
4875
+ return react.Link;
4876
+ }
4877
+ });
4854
4878
  Object.defineProperty(exports, 'List', {
4855
4879
  enumerable: true,
4856
4880
  get: function () {
@@ -4965,6 +4989,30 @@ Object.defineProperty(exports, 'Portal', {
4965
4989
  return react.Portal;
4966
4990
  }
4967
4991
  });
4992
+ Object.defineProperty(exports, 'RequiredIndicator', {
4993
+ enumerable: true,
4994
+ get: function () {
4995
+ return react.RequiredIndicator;
4996
+ }
4997
+ });
4998
+ Object.defineProperty(exports, 'ScaleFade', {
4999
+ enumerable: true,
5000
+ get: function () {
5001
+ return react.ScaleFade;
5002
+ }
5003
+ });
5004
+ Object.defineProperty(exports, 'Skeleton', {
5005
+ enumerable: true,
5006
+ get: function () {
5007
+ return react.Skeleton;
5008
+ }
5009
+ });
5010
+ Object.defineProperty(exports, 'Spacer', {
5011
+ enumerable: true,
5012
+ get: function () {
5013
+ return react.Spacer;
5014
+ }
5015
+ });
4968
5016
  Object.defineProperty(exports, 'Stack', {
4969
5017
  enumerable: true,
4970
5018
  get: function () {
@@ -5001,18 +5049,48 @@ Object.defineProperty(exports, 'TabsProvider', {
5001
5049
  return react.TabsProvider;
5002
5050
  }
5003
5051
  });
5052
+ Object.defineProperty(exports, 'Tbody', {
5053
+ enumerable: true,
5054
+ get: function () {
5055
+ return react.Tbody;
5056
+ }
5057
+ });
5058
+ Object.defineProperty(exports, 'Td', {
5059
+ enumerable: true,
5060
+ get: function () {
5061
+ return react.Td;
5062
+ }
5063
+ });
5004
5064
  Object.defineProperty(exports, 'Text', {
5005
5065
  enumerable: true,
5006
5066
  get: function () {
5007
5067
  return react.Text;
5008
5068
  }
5009
5069
  });
5070
+ Object.defineProperty(exports, 'Th', {
5071
+ enumerable: true,
5072
+ get: function () {
5073
+ return react.Th;
5074
+ }
5075
+ });
5076
+ Object.defineProperty(exports, 'Thead', {
5077
+ enumerable: true,
5078
+ get: function () {
5079
+ return react.Thead;
5080
+ }
5081
+ });
5010
5082
  Object.defineProperty(exports, 'Tooltip', {
5011
5083
  enumerable: true,
5012
5084
  get: function () {
5013
5085
  return react.Tooltip;
5014
5086
  }
5015
5087
  });
5088
+ Object.defineProperty(exports, 'Tr', {
5089
+ enumerable: true,
5090
+ get: function () {
5091
+ return react.Tr;
5092
+ }
5093
+ });
5016
5094
  Object.defineProperty(exports, 'UnorderedList', {
5017
5095
  enumerable: true,
5018
5096
  get: function () {
@@ -5043,6 +5121,12 @@ Object.defineProperty(exports, 'extendTheme', {
5043
5121
  return react.extendTheme;
5044
5122
  }
5045
5123
  });
5124
+ Object.defineProperty(exports, 'useBoolean', {
5125
+ enumerable: true,
5126
+ get: function () {
5127
+ return react.useBoolean;
5128
+ }
5129
+ });
5046
5130
  Object.defineProperty(exports, 'useColorModeValue', {
5047
5131
  enumerable: true,
5048
5132
  get: function () {
@@ -5145,6 +5229,12 @@ Object.defineProperty(exports, 'useTabsStyles', {
5145
5229
  return react.useTabsStyles;
5146
5230
  }
5147
5231
  });
5232
+ Object.defineProperty(exports, 'useToken', {
5233
+ enumerable: true,
5234
+ get: function () {
5235
+ return react.useToken;
5236
+ }
5237
+ });
5148
5238
  exports.Alert = Alert;
5149
5239
  exports.AlertAction = AlertAction;
5150
5240
  exports.AlertClose = AlertClose;