@ctlyst.id/internal-ui 3.3.8 → 3.3.10

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.
package/dist/index.mjs CHANGED
@@ -1065,167 +1065,174 @@ var useDataTable = ({
1065
1065
  };
1066
1066
  };
1067
1067
  var DataTable = React5.forwardRef((props, ref) => {
1068
- const { isLoading, styles, headerSticky, onRowClick, container } = props;
1068
+ var _a, _b;
1069
+ const { isLoading, styles, headerSticky, onRowClick, container, columnPinning } = props;
1069
1070
  const { table, toggleAllRowsSelected, generateColumn } = useDataTable(props);
1070
1071
  React5.useImperativeHandle(ref, () => ({
1071
1072
  toggleAllRowsSelected
1072
1073
  }));
1073
- return /* @__PURE__ */ jsx24(Box11, { overflowX: "auto", position: "relative", px: 4, maxW: "100%", w: "full", ...container, children: isLoading ? /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, "data-loading": "true", children: [
1074
- /* @__PURE__ */ jsx24(Thead, { ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { mx: "2", ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => /* @__PURE__ */ jsx24(
1075
- Th,
1076
- {
1077
- colSpan: header.colSpan,
1078
- width: `${header.getSize() + (index === 0 || index === headerGroup.headers.length - 1 ? 16 : 0)}px`,
1079
- ...styles == null ? void 0 : styles.tableColumnHeader,
1080
- children: /* @__PURE__ */ jsx24(
1081
- Flex2,
1074
+ return /* @__PURE__ */ jsx24(
1075
+ Box11,
1076
+ {
1077
+ overflowX: "auto",
1078
+ overflowY: "hidden",
1079
+ position: "relative",
1080
+ pl: ((_a = columnPinning == null ? void 0 : columnPinning.left) == null ? void 0 : _a.length) ? 0 : 4,
1081
+ pr: ((_b = columnPinning == null ? void 0 : columnPinning.right) == null ? void 0 : _b.length) ? 0 : 4,
1082
+ maxW: "100%",
1083
+ w: "full",
1084
+ ...container,
1085
+ children: isLoading ? /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, "data-loading": "true", children: [
1086
+ /* @__PURE__ */ jsx24(Thead, { ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}), children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { mx: "2", ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => /* @__PURE__ */ jsx24(
1087
+ Th,
1082
1088
  {
1083
- "data-test-id": "CT_component_data-table_loader",
1084
- textTransform: "capitalize",
1085
- align: "center",
1086
- gap: 2,
1087
- children: flexRender(header.column.columnDef.header, header.getContext())
1089
+ colSpan: header.colSpan,
1090
+ width: `${header.getSize() + (index === 0 || index === headerGroup.headers.length - 1 ? 16 : 0)}px`,
1091
+ ...styles == null ? void 0 : styles.tableColumnHeader,
1092
+ children: /* @__PURE__ */ jsx24(
1093
+ Flex2,
1094
+ {
1095
+ "data-test-id": "CT_component_data-table_loader",
1096
+ textTransform: "capitalize",
1097
+ align: "center",
1098
+ gap: 2,
1099
+ children: flexRender(header.column.columnDef.header, header.getContext())
1100
+ }
1101
+ )
1102
+ },
1103
+ header.id
1104
+ )) }, headerGroup.id)) }),
1105
+ /* @__PURE__ */ jsx24(Tbody, { children: [...Array(5)].map((num) => /* @__PURE__ */ jsx24(Tr, { mx: "2", children: [...Array(generateColumn().length)].map((i) => /* @__PURE__ */ jsx24(Td, { width: 210, children: /* @__PURE__ */ jsx24(Skeleton2, { startColor: "neutral.100", endColor: "neutral.200", h: "20px", w: "70%" }, i) }, i)) }, num)) })
1106
+ ] }) : /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, children: [
1107
+ /* @__PURE__ */ jsx24(
1108
+ Thead,
1109
+ {
1110
+ maxH: "50px",
1111
+ ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}),
1112
+ children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { bg: useColorModeValue("initial", "ebony-clay.700"), ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => {
1113
+ var _a2;
1114
+ return /* @__PURE__ */ jsx24(
1115
+ Th,
1116
+ {
1117
+ colSpan: header.colSpan,
1118
+ sx: getCommonPinningStyles(header.column),
1119
+ width: `${header.getSize() + (index === 0 || index === headerGroup.headers.length - 1 ? 16 : 0)}px`,
1120
+ ...styles == null ? void 0 : styles.tableColumnHeader,
1121
+ children: /* @__PURE__ */ jsxs8(
1122
+ Flex2,
1123
+ {
1124
+ backgroundColor: "white",
1125
+ height: "100%",
1126
+ "data-test-id": `CT_Container_TableHeader_${header.id}`,
1127
+ textTransform: "capitalize",
1128
+ userSelect: "none",
1129
+ align: "center",
1130
+ gap: 2,
1131
+ children: [
1132
+ flexRender(header.column.columnDef.header, header.getContext()),
1133
+ /* @__PURE__ */ jsx24(
1134
+ Box11,
1135
+ {
1136
+ as: "span",
1137
+ cursor: header.column.getCanSort() ? "pointer" : "default",
1138
+ "data-test-id": `CT_Container_SortingIcon_${header.id}`,
1139
+ onClick: header.column.getToggleSortingHandler(),
1140
+ children: (_a2 = header.column.getCanSort() && {
1141
+ asc: /* @__PURE__ */ jsx24(ChevronUpIcon, { h: 4, w: 4, color: "neutral.500" }),
1142
+ desc: /* @__PURE__ */ jsx24(ChevronDownIcon, { h: 4, w: 4, color: "neutral.500" })
1143
+ }[header.column.getIsSorted()]) != null ? _a2 : /* @__PURE__ */ jsx24(Box11, { display: "flex", justifyContent: "center", alignItems: "center", boxSize: 4, children: /* @__PURE__ */ jsx24(UpDownIcon, { color: "neutral.500" }) })
1144
+ }
1145
+ )
1146
+ ]
1147
+ }
1148
+ )
1149
+ },
1150
+ header.id
1151
+ );
1152
+ }) }, headerGroup.id))
1088
1153
  }
1089
- )
1090
- },
1091
- header.id
1092
- )) }, headerGroup.id)) }),
1093
- /* @__PURE__ */ jsx24(Tbody, { children: [...Array(5)].map((num) => /* @__PURE__ */ jsx24(Tr, { mx: "2", children: [...Array(generateColumn().length)].map((i) => /* @__PURE__ */ jsx24(Td, { width: 210, children: /* @__PURE__ */ jsx24(Skeleton2, { startColor: "neutral.100", endColor: "neutral.200", h: "20px", w: "70%" }, i) }, i)) }, num)) })
1094
- ] }) : /* @__PURE__ */ jsxs8(Table, { ...styles == null ? void 0 : styles.table, children: [
1095
- /* @__PURE__ */ jsx24(
1096
- Thead,
1097
- {
1098
- maxH: "50px",
1099
- ...(styles == null ? void 0 : styles.tableHead, headerSticky ? { position: "sticky", top: 0, bg: "white", zIndex: 1 } : {}),
1100
- children: table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx24(Tr, { bg: useColorModeValue("initial", "ebony-clay.700"), ...styles == null ? void 0 : styles.tableRow, children: headerGroup.headers.map((header, index) => {
1101
- var _a;
1154
+ ),
1155
+ /* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
1102
1156
  return /* @__PURE__ */ jsx24(
1103
- Th,
1157
+ Tr,
1104
1158
  {
1105
- colSpan: header.colSpan,
1106
- sx: getCommonPinningStyles(header.column),
1107
- width: `${header.getSize() + (index === 0 || index === headerGroup.headers.length - 1 ? 16 : 0)}px`,
1108
- ...styles == null ? void 0 : styles.tableColumnHeader,
1109
- children: /* @__PURE__ */ jsxs8(
1110
- Flex2,
1111
- {
1112
- backgroundColor: "white",
1113
- height: "100%",
1114
- "data-test-id": `CT_Container_TableHeader_${header.id}`,
1115
- textTransform: "capitalize",
1116
- userSelect: "none",
1117
- align: "center",
1118
- gap: 2,
1119
- children: [
1120
- flexRender(header.column.columnDef.header, header.getContext()),
1121
- /* @__PURE__ */ jsx24(
1122
- Box11,
1123
- {
1124
- as: "span",
1125
- cursor: header.column.getCanSort() ? "pointer" : "default",
1126
- "data-test-id": `CT_Container_SortingIcon_${header.id}`,
1127
- onClick: header.column.getToggleSortingHandler(),
1128
- children: (_a = header.column.getCanSort() && {
1129
- asc: /* @__PURE__ */ jsx24(ChevronUpIcon, { h: 4, w: 4, color: "neutral.500" }),
1130
- desc: /* @__PURE__ */ jsx24(ChevronDownIcon, { h: 4, w: 4, color: "neutral.500" })
1131
- }[header.column.getIsSorted()]) != null ? _a : /* @__PURE__ */ jsx24(Box11, { display: "flex", justifyContent: "center", alignItems: "center", boxSize: 4, children: /* @__PURE__ */ jsx24(UpDownIcon, { color: "neutral.500" }) })
1132
- }
1133
- )
1134
- ]
1135
- }
1136
- )
1137
- },
1138
- header.id
1139
- );
1140
- }) }, headerGroup.id))
1141
- }
1142
- ),
1143
- /* @__PURE__ */ jsx24(Tbody, { ...styles == null ? void 0 : styles.tableBody, children: table.getRowModel().rows.map((row) => {
1144
- return /* @__PURE__ */ jsx24(
1145
- Tr,
1146
- {
1147
- "data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
1148
- tabindex: "0",
1149
- ...styles == null ? void 0 : styles.tableRow,
1150
- css: css`
1159
+ "data-test-id": "-RU0hNYGRzeVM3HQ4cXHl",
1160
+ tabindex: "0",
1161
+ ...styles == null ? void 0 : styles.tableRow,
1162
+ css: css`
1151
1163
  &:last-child {
1152
1164
  td {
1153
1165
  border-bottom: none;
1154
1166
  }
1155
1167
  }
1156
1168
  `,
1157
- onMouseDown: (e) => {
1158
- var _a;
1159
- (_a = e.currentTarget) == null ? void 0 : _a.setAttribute("data-active", "true");
1160
- },
1161
- onMouseUp: (e) => {
1162
- var _a;
1163
- (_a = e.currentTarget) == null ? void 0 : _a.removeAttribute("data-active");
1164
- },
1165
- onClick: () => {
1166
- if (onRowClick) {
1167
- onRowClick(row.original);
1168
- }
1169
- },
1170
- children: row.getVisibleCells().map((cell) => {
1171
- const meta = cell.column.columnDef.meta;
1172
- const isDisabled = isCellDisabled(row.original, cell.column.id);
1173
- return /* @__PURE__ */ jsx24(
1174
- Td,
1175
- {
1176
- "data-test-id": `CT_Component_TableCell_${cell.id}`,
1177
- fontSize: "text.sm",
1178
- sx: getCommonPinningStyles(cell.column),
1179
- ...styles == null ? void 0 : styles.tableCell,
1180
- children: /* @__PURE__ */ jsx24(
1181
- Flex2,
1169
+ onMouseDown: (e) => {
1170
+ var _a2;
1171
+ (_a2 = e.currentTarget) == null ? void 0 : _a2.setAttribute("data-active", "true");
1172
+ },
1173
+ onMouseUp: (e) => {
1174
+ var _a2;
1175
+ (_a2 = e.currentTarget) == null ? void 0 : _a2.removeAttribute("data-active");
1176
+ },
1177
+ onClick: () => {
1178
+ if (onRowClick) {
1179
+ onRowClick(row.original);
1180
+ }
1181
+ },
1182
+ children: row.getVisibleCells().map((cell) => {
1183
+ const meta = cell.column.columnDef.meta;
1184
+ const isDisabled = isCellDisabled(row.original, cell.column.id);
1185
+ return /* @__PURE__ */ jsx24(
1186
+ Td,
1182
1187
  {
1183
- height: "100%",
1184
- width: "100%",
1185
- align: "center",
1186
- opacity: isDisabled ? 0.5 : 1,
1187
- sx: { ...meta && meta.columnStyles ? meta.columnStyles : {} },
1188
+ "data-test-id": `CT_Component_TableCell_${cell.id}`,
1189
+ fontSize: "text.sm",
1190
+ sx: getCommonPinningStyles(cell.column),
1191
+ ...styles == null ? void 0 : styles.tableCell,
1188
1192
  children: /* @__PURE__ */ jsx24(
1189
1193
  Flex2,
1190
1194
  {
1191
- tabIndex: 0,
1192
- cursor: "auto",
1193
- "data-test-id": `CT_Component_TableCell_Content-${cell.id}`,
1194
- onMouseUp: (e) => e.stopPropagation(),
1195
- onMouseDown: (e) => e.stopPropagation(),
1196
- onClick: (e) => {
1197
- e.stopPropagation();
1198
- },
1199
- noOfLines: 2,
1200
- sx: {
1201
- display: "-webkit-inline-box"
1202
- },
1203
- children: flexRender(cell.column.columnDef.cell, cell.getContext())
1195
+ height: "100%",
1196
+ width: "100%",
1197
+ align: "center",
1198
+ opacity: isDisabled ? 0.5 : 1,
1199
+ sx: { ...meta && meta.columnStyles ? meta.columnStyles : {} },
1200
+ children: /* @__PURE__ */ jsx24(
1201
+ Flex2,
1202
+ {
1203
+ tabIndex: 0,
1204
+ cursor: "auto",
1205
+ "data-test-id": `CT_Component_TableCell_Content-${cell.id}`,
1206
+ onMouseUp: (e) => e.stopPropagation(),
1207
+ onMouseDown: (e) => e.stopPropagation(),
1208
+ onClick: (e) => {
1209
+ e.stopPropagation();
1210
+ },
1211
+ noOfLines: 2,
1212
+ sx: {
1213
+ display: "-webkit-inline-box"
1214
+ },
1215
+ children: flexRender(cell.column.columnDef.cell, cell.getContext())
1216
+ }
1217
+ )
1204
1218
  }
1205
1219
  )
1206
- }
1207
- )
1208
- },
1209
- cell.id
1210
- );
1211
- })
1212
- },
1213
- row.id
1214
- );
1215
- }) })
1216
- ] }) });
1220
+ },
1221
+ cell.id
1222
+ );
1223
+ })
1224
+ },
1225
+ row.id
1226
+ );
1227
+ }) })
1228
+ ] })
1229
+ }
1230
+ );
1217
1231
  });
1218
1232
  var data_table_default = DataTable;
1219
1233
 
1220
1234
  // src/components/datepicker/components/datepicker.tsx
1221
- import {
1222
- FormControl as FormControl3,
1223
- FormErrorMessage as FormErrorMessage3,
1224
- FormHelperText as FormHelperText3,
1225
- IconButton as IconButton4,
1226
- InputGroup as InputGroup4,
1227
- InputRightElement as InputRightElement3
1228
- } from "@chakra-ui/react";
1235
+ import { FormControl as FormControl3, FormErrorMessage as FormErrorMessage3, FormHelperText as FormHelperText3, IconButton as IconButton4 } from "@chakra-ui/react";
1229
1236
  import { cx as cx8 } from "@chakra-ui/shared-utils";
1230
1237
  import { Calendar, Close as Close3 } from "@ctlyst.id/internal-icon";
1231
1238
  import ReactDatePicker from "react-datepicker";
@@ -2162,7 +2169,33 @@ var Datepicker = ({
2162
2169
  id,
2163
2170
  name,
2164
2171
  selected,
2165
- customInput: /* @__PURE__ */ jsx27(input_field_default, { label, isRequired, autoComplete: "off", isError }),
2172
+ customInput: /* @__PURE__ */ jsx27(
2173
+ input_field_default,
2174
+ {
2175
+ label,
2176
+ isRequired,
2177
+ autoComplete: "off",
2178
+ isError,
2179
+ addOnRight: /* @__PURE__ */ jsxs10(InputRightElement, { alignSelf: "center", bottom: 0, flexDir: "row-reverse", width: "auto", mr: 2, gap: 2, children: [
2180
+ /* @__PURE__ */ jsx27(Calendar, { size: 4, color: "neutral.400" }),
2181
+ value && /* @__PURE__ */ jsx27(
2182
+ IconButton4,
2183
+ {
2184
+ "data-test-id": "H0rseVCzGIaqoLho-EPbu",
2185
+ display: "flex",
2186
+ alignItems: "center",
2187
+ variant: "unstyled",
2188
+ "aria-label": "Remove",
2189
+ onClick: onClear,
2190
+ cursor: "pointer",
2191
+ size: "sm",
2192
+ minW: "unset",
2193
+ icon: /* @__PURE__ */ jsx27(Close3, { size: 4, color: "neutral.600" })
2194
+ }
2195
+ )
2196
+ ] })
2197
+ }
2198
+ ),
2166
2199
  showPopperArrow: false,
2167
2200
  calendarClassName: cx8({ inline: props.inline }),
2168
2201
  dropdownMode: "select",
@@ -2180,27 +2213,7 @@ var Datepicker = ({
2180
2213
  return component;
2181
2214
  }
2182
2215
  return /* @__PURE__ */ jsxs10(FormControl3, { "data-test-id": "CT_Component_datepicker_wrapper", isInvalid: isError, children: [
2183
- /* @__PURE__ */ jsxs10(InputGroup4, { children: [
2184
- component,
2185
- /* @__PURE__ */ jsxs10(InputRightElement3, { alignSelf: "center", bottom: 0, flexDir: "row-reverse", width: "auto", mr: 2, gap: 2, children: [
2186
- /* @__PURE__ */ jsx27(Calendar, { size: 4, color: "neutral.400" }),
2187
- value && /* @__PURE__ */ jsx27(
2188
- IconButton4,
2189
- {
2190
- "data-test-id": "H0rseVCzGIaqoLho-EPbu",
2191
- display: "flex",
2192
- alignItems: "center",
2193
- variant: "unstyled",
2194
- "aria-label": "Remove",
2195
- onClick: onClear,
2196
- cursor: "pointer",
2197
- size: "sm",
2198
- minW: "unset",
2199
- icon: /* @__PURE__ */ jsx27(Close3, { size: 4, color: "neutral.600" })
2200
- }
2201
- )
2202
- ] })
2203
- ] }),
2216
+ component,
2204
2217
  !isError ? /* @__PURE__ */ jsx27(FormHelperText3, { fontSize: "text.xs", mt: 1, children: helperText }) : /* @__PURE__ */ jsx27(FormErrorMessage3, { fontSize: "text.xs", mt: 1, children: error })
2205
2218
  ] });
2206
2219
  };
@@ -4642,7 +4655,7 @@ import {
4642
4655
  import { Code, CodeProps, Heading, HeadingProps, Link as Link5, LinkProps, Text as Text17, TextProps } from "@chakra-ui/react";
4643
4656
 
4644
4657
  // src/components/time-input/components/index.tsx
4645
- import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup5 } from "@chakra-ui/react";
4658
+ import { Box as Box29, Flex as Flex17, forwardRef as forwardRef12, Input as Input3, InputGroup as InputGroup4 } from "@chakra-ui/react";
4646
4659
  import { Clock } from "@ctlyst.id/internal-icon";
4647
4660
  import { useEffect as useEffect3, useImperativeHandle as useImperativeHandle2 } from "react";
4648
4661
 
@@ -4747,7 +4760,8 @@ var InputTimeArea = forwardRef12((props, ref) => {
4747
4760
  boxSizing: "content-box",
4748
4761
  height: "22px",
4749
4762
  ref,
4750
- p: "2px",
4763
+ px: "2px",
4764
+ py: 0,
4751
4765
  sx: {
4752
4766
  fontVariantNumeric: "tabular-nums"
4753
4767
  },
@@ -4830,7 +4844,7 @@ var TimeInput2 = forwardRef12(
4830
4844
  borderColor: focusColor
4831
4845
  },
4832
4846
  children: /* @__PURE__ */ jsxs29(
4833
- InputGroup5,
4847
+ InputGroup4,
4834
4848
  {
4835
4849
  borderRadius: "sm",
4836
4850
  backgroundColor: isDisabled ? "neutral.300" : "white.high",