@ctlyst.id/internal-ui 5.4.6 → 5.4.8

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
@@ -5764,7 +5764,7 @@ var styles_default2 = Styles2;
5764
5764
  import { Fragment as Fragment11, jsx as jsx65, jsxs as jsxs30 } from "react/jsx-runtime";
5765
5765
  var CustomCloseButton = (props) => {
5766
5766
  const { closeToast } = props;
5767
- return /* @__PURE__ */ jsx65(Box30, { p: 2, mb: 1, alignItems: "center", display: "flex", "data-test-id": "", cursor: "pointer", onClick: closeToast, children: /* @__PURE__ */ jsx65(Close6, { size: 4, color: "white" }) });
5767
+ return /* @__PURE__ */ jsx65(Box30, { p: 2, mb: 1, alignItems: "center", display: "flex", "data-test-id": "", cursor: "pointer", onClick: () => closeToast(), children: /* @__PURE__ */ jsx65(Close6, { size: 4, color: "white" }) });
5768
5768
  };
5769
5769
  var DEFAULT_OPTIONS = {
5770
5770
  position: "top-right",
@@ -5798,7 +5798,7 @@ var useToast = () => {
5798
5798
  const content = (icon, message, link) => {
5799
5799
  return /* @__PURE__ */ jsxs30(Fragment11, { children: [
5800
5800
  /* @__PURE__ */ jsx65(styles_default2, {}),
5801
- /* @__PURE__ */ jsxs30(Flex18, { justifyContent: "space-between", alignItems: "center", gap: 4, mb: 1, children: [
5801
+ /* @__PURE__ */ jsxs30(Flex18, { justifyContent: "space-between", alignItems: "center", gap: 4, mb: 1, flex: 1, children: [
5802
5802
  /* @__PURE__ */ jsxs30(Flex18, { alignItems: "center", children: [
5803
5803
  icon && /* @__PURE__ */ jsx65(chakra7.span, { mr: 2, w: 4, h: 4, children: renderIcon(icon, "default") }),
5804
5804
  /* @__PURE__ */ jsx65(chakra7.span, { noOfLines: 2, children: message })
@@ -5902,6 +5902,7 @@ import { useCallback as useCallback4, useEffect as useEffect4, useState as useSt
5902
5902
  import { useDropzone } from "react-dropzone";
5903
5903
 
5904
5904
  // src/components/uploader/constants.ts
5905
+ var ONE_MEGA_BYTE = 1e6;
5905
5906
  var messages = {
5906
5907
  dragActive: "Drop file disini...",
5907
5908
  dragInActive: `(Klik atau drag untuk input file)`,
@@ -5915,7 +5916,17 @@ var IMG_EXT = {
5915
5916
  png: "png",
5916
5917
  gif: "gif"
5917
5918
  };
5919
+ var EXCEL_EXT = {
5920
+ xls: "xls",
5921
+ xlsx: "xlsx",
5922
+ csv: "csv"
5923
+ };
5918
5924
  var DEFAULT_IMAGE_MIME_TYPE = [IMG_EXT.jpg, IMG_EXT.jpeg, IMG_EXT.png, IMG_EXT.gif];
5925
+ var DEFAULT_EXCEL_MIME_TYPE = [
5926
+ "application/vnd.ms-excel",
5927
+ "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",
5928
+ "text/csv"
5929
+ ];
5919
5930
  var concatList = (list) => {
5920
5931
  let _concatedList = "";
5921
5932
  if (list.length > 1) {
@@ -5985,6 +5996,7 @@ var Uploader = ({
5985
5996
  acceptFormat = {
5986
5997
  validate: DEFAULT_IMAGE_MIME_TYPE
5987
5998
  },
5999
+ acceptFileType,
5988
6000
  maxFileSize,
5989
6001
  customValidation,
5990
6002
  value,
@@ -6012,6 +6024,11 @@ var Uploader = ({
6012
6024
  const onDropAccepted = useCallback4(
6013
6025
  (files) => {
6014
6026
  const file = files[0];
6027
+ if (acceptFileType && acceptFileType.includes(file.type)) {
6028
+ setFilePreview(file.name);
6029
+ onHandleUploadFile == null ? void 0 : onHandleUploadFile(file, null);
6030
+ return null;
6031
+ }
6015
6032
  const imageUrl = URL.createObjectURL(file);
6016
6033
  const img = new Image();
6017
6034
  if (file.type === "image/heic") {
@@ -6035,7 +6052,7 @@ var Uploader = ({
6035
6052
  };
6036
6053
  return null;
6037
6054
  },
6038
- [customValidation, dimension, handleRejection, onHandleUploadFile]
6055
+ [customValidation, dimension, handleRejection, onHandleUploadFile, acceptFileType]
6039
6056
  );
6040
6057
  const onDropRejected = useCallback4((fileRejections) => {
6041
6058
  defaultOnHandleRejections(fileRejections, { acceptFormat, maxFileSize }, handleRejection);
@@ -6060,7 +6077,10 @@ var Uploader = ({
6060
6077
  const { getRootProps, getInputProps, isDragActive, acceptedFiles, open } = useDropzone({
6061
6078
  onDropAccepted,
6062
6079
  onDropRejected,
6063
- accept: Object.fromEntries(acceptFile),
6080
+ accept: {
6081
+ ...acceptFormat ? Object.fromEntries(acceptFile) : {},
6082
+ ...acceptFileType ? Object.fromEntries(acceptFileType.map((type) => [type, []])) : {}
6083
+ },
6064
6084
  maxFiles: 1,
6065
6085
  maxSize: maxFileSize == null ? void 0 : maxFileSize.validate,
6066
6086
  noClick: isDisabled || !!filePreview,
@@ -8082,6 +8102,8 @@ export {
8082
8102
  Container,
8083
8103
  ContainerProps,
8084
8104
  counter_default as Counter,
8105
+ DEFAULT_EXCEL_MIME_TYPE,
8106
+ DEFAULT_IMAGE_MIME_TYPE,
8085
8107
  data_table_default as DataTable,
8086
8108
  datepicker_month_default as DatePickerMonth,
8087
8109
  datepicker_default as Datepicker,
@@ -8098,6 +8120,7 @@ export {
8098
8120
  ModalOverlay3 as DrawerOverlay,
8099
8121
  DrawerProps,
8100
8122
  DropdownIndicator,
8123
+ EXCEL_EXT,
8101
8124
  empty_state_default as EmptyState,
8102
8125
  error_code_default as ErrorCode,
8103
8126
  Fade2 as Fade,
@@ -8121,6 +8144,7 @@ export {
8121
8144
  HeadingProps,
8122
8145
  Hide,
8123
8146
  HideProps,
8147
+ IMG_EXT,
8124
8148
  Icon3 as Icon,
8125
8149
  IconButton2 as IconButton,
8126
8150
  IconButtonProps,
@@ -8178,6 +8202,7 @@ export {
8178
8202
  Navbar,
8179
8203
  navigation_bar_default as NavigationBar,
8180
8204
  NoOptionsMessage,
8205
+ ONE_MEGA_BYTE,
8181
8206
  OrderedList,
8182
8207
  pagination_default as Pagination,
8183
8208
  pagination_detail_default as PaginationDetail,
@@ -8322,16 +8347,19 @@ export {
8322
8347
  WrapItemProps,
8323
8348
  WrapProps,
8324
8349
  XMSLogo,
8350
+ concatList,
8325
8351
  createExtendTheme,
8326
8352
  defaultOnHandleRejections,
8327
8353
  dimensionValidator,
8328
8354
  extendTheme,
8355
+ formatValidationMessage,
8329
8356
  forwardRef13 as forwardRef,
8330
8357
  getSelectAllCheckboxState,
8331
8358
  getTheme,
8332
8359
  id,
8333
8360
  isCellDisabled,
8334
8361
  isRatioEqual,
8362
+ messages,
8335
8363
  selectStyles,
8336
8364
  theme4 as theme,
8337
8365
  themeSelect,