siam-ui-utils 3.0.32 → 3.1.0

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.
Files changed (124) hide show
  1. package/dist/CustomBootstrap.js +9 -9
  2. package/dist/CustomBootstrap.js.map +1 -1
  3. package/dist/_virtual/_commonjsHelpers.js +7 -7
  4. package/dist/_virtual/events.js +6 -6
  5. package/dist/_virtual/events2.js +5 -5
  6. package/dist/_virtual/index.js +8 -8
  7. package/dist/_virtual/index2.js +5 -5
  8. package/dist/assets/img/copiar.png.js +5 -5
  9. package/dist/assets/img/take-photo.jpg.js +5 -5
  10. package/dist/constants.js +9 -9
  11. package/dist/copy-link/index.js +60 -60
  12. package/dist/copy-link/index.js.map +1 -1
  13. package/dist/copy-link/styles.css +37 -37
  14. package/dist/custom-input/CustomInputCheckbox.js +37 -35
  15. package/dist/custom-input/CustomInputCheckbox.js.map +1 -1
  16. package/dist/custom-input/CustomInputCurrency.js +84 -84
  17. package/dist/custom-input/CustomInputCurrency.js.map +1 -1
  18. package/dist/custom-input/CustomInputFile.js +47 -45
  19. package/dist/custom-input/CustomInputFile.js.map +1 -1
  20. package/dist/custom-input/CustomInputRadio.js +68 -66
  21. package/dist/custom-input/CustomInputRadio.js.map +1 -1
  22. package/dist/custom-input/constant.js +5 -5
  23. package/dist/custom-input/index.js +12 -12
  24. package/dist/drag-and-dropzone/DropzoneComponent.js +83 -0
  25. package/dist/drag-and-dropzone/DropzoneComponent.js.map +1 -0
  26. package/dist/drag-and-dropzone/config.js +59 -59
  27. package/dist/drag-and-dropzone/index.js +39 -39
  28. package/dist/drag-and-dropzone/index.js.map +1 -1
  29. package/dist/dropzone/Input.js +77 -77
  30. package/dist/dropzone/Layout.js +50 -50
  31. package/dist/dropzone/Preview.js +117 -117
  32. package/dist/dropzone/SubmitButton.js +34 -34
  33. package/dist/dropzone/assets/cancel.svg.js +5 -5
  34. package/dist/dropzone/assets/remove.svg.js +5 -5
  35. package/dist/dropzone/assets/restart.svg.js +5 -5
  36. package/dist/dropzone/index.js +514 -514
  37. package/dist/dropzone/utils.js +93 -93
  38. package/dist/dropzone-uploader/base/index.js +135 -135
  39. package/dist/dropzone-uploader/index.js +7 -7
  40. package/dist/dropzone-uploader/styled/index.js +148 -148
  41. package/dist/dropzone-uploader/styled/index.js.map +1 -1
  42. package/dist/iconos/constants-svg.js +666 -666
  43. package/dist/iconos/icon-button-svg.js +50 -50
  44. package/dist/iconos/index.js +24 -24
  45. package/dist/iconos/styled-icon.js +26 -26
  46. package/dist/index.js +4 -4
  47. package/dist/intl-messages/index.js +11 -11
  48. package/dist/node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js +8 -8
  49. package/dist/node_modules/@babel/runtime/helpers/esm/extends.js +13 -13
  50. package/dist/node_modules/@babel/runtime/helpers/esm/inheritsLoose.js +8 -8
  51. package/dist/node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js +13 -13
  52. package/dist/node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js +9 -9
  53. package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +111 -0
  54. package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js.map +1 -0
  55. package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +106 -0
  56. package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js.map +1 -0
  57. package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +125 -0
  58. package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js.map +1 -0
  59. package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +75 -0
  60. package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js.map +1 -0
  61. package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +225 -0
  62. package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js.map +1 -0
  63. package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +122 -0
  64. package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js.map +1 -0
  65. package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +83 -0
  66. package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js.map +1 -0
  67. package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +68 -0
  68. package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js.map +1 -0
  69. package/dist/node_modules/classnames/index.js +62 -62
  70. package/dist/node_modules/dom-helpers/esm/addClass.js +10 -10
  71. package/dist/node_modules/dom-helpers/esm/hasClass.js +8 -8
  72. package/dist/node_modules/dom-helpers/esm/removeClass.js +16 -16
  73. package/dist/node_modules/dropzone/dist/dropzone.js +1968 -0
  74. package/dist/node_modules/dropzone/dist/dropzone.js.map +1 -0
  75. package/dist/node_modules/events/events.js +372 -372
  76. package/dist/node_modules/just-extend/index.esm.js +43 -0
  77. package/dist/node_modules/just-extend/index.esm.js.map +1 -0
  78. package/dist/node_modules/react-transition-group/esm/CSSTransition.js +275 -275
  79. package/dist/node_modules/react-transition-group/esm/Transition.js +441 -441
  80. package/dist/node_modules/react-transition-group/esm/TransitionGroup.js +146 -146
  81. package/dist/node_modules/react-transition-group/esm/TransitionGroupContext.js +6 -6
  82. package/dist/node_modules/react-transition-group/esm/config.js +7 -7
  83. package/dist/node_modules/react-transition-group/esm/utils/ChildMapping.js +100 -100
  84. package/dist/node_modules/react-transition-group/esm/utils/PropTypes.js +24 -24
  85. package/dist/node_modules/react-transition-group/esm/utils/reflow.js +7 -7
  86. package/dist/react-notifications/Notification.js +73 -73
  87. package/dist/react-notifications/NotificationContainer.js +59 -59
  88. package/dist/react-notifications/NotificationManager.js +174 -174
  89. package/dist/react-notifications/Notifications.js +72 -72
  90. package/dist/react-notifications/constants.js +26 -26
  91. package/dist/react-notifications/index.js +11 -11
  92. package/dist/select/custom-select/constants.js +8 -8
  93. package/dist/select/custom-select/index.js +89 -90
  94. package/dist/select/custom-select/index.js.map +1 -1
  95. package/dist/select/custom-select-input/index.js +12 -12
  96. package/dist/select/index.js +9 -9
  97. package/dist/select/multi-select/badge-label-multi-select.js +29 -29
  98. package/dist/select/multi-select/index.css +36 -23
  99. package/dist/select/multi-select/index.js +171 -62
  100. package/dist/select/multi-select/index.js.map +1 -1
  101. package/dist/select/multi-select/styled-component.js +23 -24
  102. package/dist/select/multi-select/styled-component.js.map +1 -1
  103. package/dist/timer/index.js +60 -60
  104. package/dist/timer/styles.css +58 -58
  105. package/dist/tomar-foto/index.js +62 -62
  106. package/dist/tomar-foto/index.js.map +1 -1
  107. package/dist/view-layout/button-editor.js +14 -14
  108. package/dist/view-layout/constants.js +11 -11
  109. package/dist/view-layout/editor-layer.js +28 -28
  110. package/dist/view-layout/index.js +53 -53
  111. package/dist/view-layout/slot-wrapper.js +39 -39
  112. package/dist/view-layout/styles.css +126 -126
  113. package/dist/where-by-room/index.js +20 -20
  114. package/dist/where-by-room/room.js +78 -78
  115. package/index.d.ts +1 -1
  116. package/package.json +12 -10
  117. package/dist/_virtual/react-dropzone.js +0 -8
  118. package/dist/_virtual/react-dropzone.js.map +0 -1
  119. package/dist/_virtual/react-dropzone2.js +0 -5
  120. package/dist/_virtual/react-dropzone2.js.map +0 -1
  121. package/dist/node_modules/react-dropzone-component/dist/react-dropzone.js +0 -1023
  122. package/dist/node_modules/react-dropzone-component/dist/react-dropzone.js.map +0 -1
  123. package/dist/node_modules/react-multi-select-component/dist/esm/index.js +0 -178
  124. package/dist/node_modules/react-multi-select-component/dist/esm/index.js.map +0 -1
@@ -1,84 +1,84 @@
1
- import { jsx } from "react/jsx-runtime";
2
- import { useState, useEffect } from "react";
3
- import { Input } from "reactstrap";
4
- import { fieldToCurrency } from "siam-utils";
5
- const CustomInputCurrency = (props) => {
6
- const {
7
- onChange = () => {
8
- },
9
- onFocus = () => {
10
- },
11
- value = {},
12
- maxLength = "20",
13
- style = {}
14
- } = props;
15
- const styleCurrency = { ...style, textAlign: "right" };
16
- const [valueInputCur, setValueInputCur] = useState("");
17
- const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18
- const handleInputOnBlur = (event) => {
19
- const { target } = event;
20
- if (valueInputCur !== "") {
21
- const valor = valueInputCur.replace(".", "");
22
- const valorPersistence = valor.replace(",", ".");
23
- setValueInputCur(fieldToCurrency(valorPersistence));
24
- onChange({
25
- ...event,
26
- target: {
27
- ...target,
28
- value: valorPersistence,
29
- valueCurrency: fieldToCurrency(valorPersistence),
30
- valueFloat: parseFloat(valorPersistence)
31
- }
32
- });
33
- }
34
- };
35
- const handleInputOnFocus = (e) => {
36
- if (valueInputCur !== "") {
37
- const valor = valueInputCur.replace("$ ", "");
38
- const valor2 = valor.replace(/\./g, "");
39
- setValueInputCur(valor2);
40
- }
41
- onFocus(e);
42
- };
43
- const handleInputChange = (event) => {
44
- const { target } = event;
45
- const valor = target.value.replace("$ ", "");
46
- const valid = /^-?[0-9.]*(?:[,]\d?\d?)?$/;
47
- if (valid.test(valor)) {
48
- const sepDec = valor.slice(-1) === "." ? `${valor.slice(0, -1)},` : valor;
49
- const punto = new RegExp(escapeRegExp("."), "g");
50
- const sinSepMil = sepDec.replace(punto, "");
51
- const posPuntoDec = sinSepMil.indexOf(",");
52
- const parteDecimal = posPuntoDec >= 0 ? sinSepMil.slice(posPuntoDec) : "";
53
- const parteEntera = posPuntoDec >= 0 ? sinSepMil.slice(0, posPuntoDec) : sinSepMil;
54
- setValueInputCur(parteEntera + parteDecimal);
55
- }
56
- };
57
- useEffect(() => {
58
- if (value && value !== "") {
59
- if (typeof value != "number" && value && value.includes("$")) {
60
- setValueInputCur(value.toString());
61
- } else {
62
- setValueInputCur(fieldToCurrency(value.toString()));
63
- }
64
- } else {
65
- setValueInputCur("");
66
- }
67
- }, [value]);
68
- return /* @__PURE__ */ jsx(
69
- Input,
70
- {
71
- ...props,
72
- style: styleCurrency,
73
- maxLength,
74
- value: valueInputCur,
75
- onFocus: handleInputOnFocus,
76
- onChange: handleInputChange,
77
- onBlur: handleInputOnBlur
78
- }
79
- );
80
- };
81
- export {
82
- CustomInputCurrency
83
- };
84
- //# sourceMappingURL=CustomInputCurrency.js.map
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useState, useEffect } from "react";
3
+ import Input from "../node_modules/@neolution-ch/reactstrap/esm/Input.js";
4
+ import { fieldToCurrency } from "siam-utils";
5
+ const CustomInputCurrency = (props) => {
6
+ const {
7
+ onChange = () => {
8
+ },
9
+ onFocus = () => {
10
+ },
11
+ value = {},
12
+ maxLength = "20",
13
+ style = {}
14
+ } = props;
15
+ const styleCurrency = { ...style, textAlign: "right" };
16
+ const [valueInputCur, setValueInputCur] = useState("");
17
+ const escapeRegExp = (string) => string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
18
+ const handleInputOnBlur = (event) => {
19
+ const { target } = event;
20
+ if (valueInputCur !== "") {
21
+ const valor = valueInputCur.replace(".", "");
22
+ const valorPersistence = valor.replace(",", ".");
23
+ setValueInputCur(fieldToCurrency(valorPersistence));
24
+ onChange({
25
+ ...event,
26
+ target: {
27
+ ...target,
28
+ value: valorPersistence,
29
+ valueCurrency: fieldToCurrency(valorPersistence),
30
+ valueFloat: parseFloat(valorPersistence)
31
+ }
32
+ });
33
+ }
34
+ };
35
+ const handleInputOnFocus = (e) => {
36
+ if (valueInputCur !== "") {
37
+ const valor = valueInputCur.replace("$ ", "");
38
+ const valor2 = valor.replace(/\./g, "");
39
+ setValueInputCur(valor2);
40
+ }
41
+ onFocus(e);
42
+ };
43
+ const handleInputChange = (event) => {
44
+ const { target } = event;
45
+ const valor = target.value.replace("$ ", "");
46
+ const valid = /^-?[0-9.]*(?:[,]\d?\d?)?$/;
47
+ if (valid.test(valor)) {
48
+ const sepDec = valor.slice(-1) === "." ? `${valor.slice(0, -1)},` : valor;
49
+ const punto = new RegExp(escapeRegExp("."), "g");
50
+ const sinSepMil = sepDec.replace(punto, "");
51
+ const posPuntoDec = sinSepMil.indexOf(",");
52
+ const parteDecimal = posPuntoDec >= 0 ? sinSepMil.slice(posPuntoDec) : "";
53
+ const parteEntera = posPuntoDec >= 0 ? sinSepMil.slice(0, posPuntoDec) : sinSepMil;
54
+ setValueInputCur(parteEntera + parteDecimal);
55
+ }
56
+ };
57
+ useEffect(() => {
58
+ if (value && value !== "") {
59
+ if (typeof value != "number" && value && value.includes("$")) {
60
+ setValueInputCur(value.toString());
61
+ } else {
62
+ setValueInputCur(fieldToCurrency(value.toString()));
63
+ }
64
+ } else {
65
+ setValueInputCur("");
66
+ }
67
+ }, [value]);
68
+ return /* @__PURE__ */ jsx(
69
+ Input,
70
+ {
71
+ ...props,
72
+ style: styleCurrency,
73
+ maxLength,
74
+ value: valueInputCur,
75
+ onFocus: handleInputOnFocus,
76
+ onChange: handleInputChange,
77
+ onBlur: handleInputOnBlur
78
+ }
79
+ );
80
+ };
81
+ export {
82
+ CustomInputCurrency
83
+ };
84
+ //# sourceMappingURL=CustomInputCurrency.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomInputCurrency.js","sources":["../../src/custom-input/CustomInputCurrency.jsx"],"sourcesContent":["import { useEffect, useState } from 'react';\r\nimport { Input } from 'reactstrap';\r\nimport { fieldToCurrency } from 'siam-utils';\r\n/**\r\n * value, //admite formato como devuelve la BD (varchar), flotante o currency\r\n * al setear un valor en el componente se visualiza como Currency:\r\n * Formato $ 3.000,60\r\n * Al intentar editar el VALOR automaticamente se conviertea un numero cuyo formato es:\r\n * sin separador de miles, sin simbolo pesos ($), y la coma como separador de decimales\r\n * Formato: 3000,60\r\n * Al perder el foco el VALOR cambia a formato currency\r\n * Para el componente PADRE que lo esta usando, va a recibir desde el evento onblur un valor cuyo formato es el PERSISTENCE:\r\n * Formato: 3000.60\r\n */\r\nexport const CustomInputCurrency = (props) => {\r\n const {\r\n onChange = () => {\r\n undefined;\r\n },\r\n onFocus = () => {\r\n undefined;\r\n },\r\n value = {},\r\n maxLength = '20',\r\n style = {},\r\n } = props;\r\n const styleCurrency = { ...style, textAlign: 'right' };\r\n const [valueInputCur, setValueInputCur] = useState('');\r\n const escapeRegExp = (string) =>\r\n string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n\r\n const handleInputOnBlur = (event) => {\r\n const { target } = event;\r\n if (valueInputCur !== '') {\r\n const valor = valueInputCur.replace('.', '');\r\n const valorPersistence = valor.replace(',', '.');\r\n setValueInputCur(fieldToCurrency(valorPersistence));\r\n onChange({\r\n ...event,\r\n target: {\r\n ...target,\r\n value: valorPersistence,\r\n valueCurrency: fieldToCurrency(valorPersistence),\r\n valueFloat: parseFloat(valorPersistence),\r\n },\r\n });\r\n }\r\n };\r\n\r\n const handleInputOnFocus = (e) => {\r\n if (valueInputCur !== '') {\r\n const valor = valueInputCur.replace('$ ', '');\r\n const valor2 = valor.replace(/\\./g, '');\r\n setValueInputCur(valor2);\r\n }\r\n onFocus(e);\r\n };\r\n\r\n const handleInputChange = (event) => {\r\n const { target } = event;\r\n const valor = target.value.replace('$ ', '');\r\n const valid = /^-?[0-9.]*(?:[,]\\d?\\d?)?$/;\r\n if (valid.test(valor)) {\r\n const sepDec = valor.slice(-1) === '.' ? `${valor.slice(0, -1)},` : valor;\r\n const punto = new RegExp(escapeRegExp('.'), 'g');\r\n const sinSepMil = sepDec.replace(punto, '');\r\n const posPuntoDec = sinSepMil.indexOf(',');\r\n const parteDecimal = posPuntoDec >= 0 ? sinSepMil.slice(posPuntoDec) : '';\r\n const parteEntera =\r\n posPuntoDec >= 0 ? sinSepMil.slice(0, posPuntoDec) : sinSepMil;\r\n setValueInputCur(parteEntera + parteDecimal);\r\n }\r\n };\r\n useEffect(() => {\r\n if (value && value !== '') {\r\n if (typeof value != 'number' && value && value.includes('$')) {\r\n setValueInputCur(value.toString());\r\n } else {\r\n setValueInputCur(fieldToCurrency(value.toString()));\r\n }\r\n } else {\r\n setValueInputCur('');\r\n }\r\n }, [value]);\r\n\r\n return (\r\n <Input\r\n {...props}\r\n style={styleCurrency}\r\n maxLength={maxLength}\r\n value={valueInputCur}\r\n onFocus={handleInputOnFocus}\r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M,KAAK,KAAK,GAAG;AACrB,YAAM,SAAS,MAAM,MAAM,EAAE,MAAM,MAAM,GAAG,MAAM,MAAM,GAAG,EAAE,CAAC,MAAM;AACpE,YAAM,QAAQ,IAAI,OAAO,aAAa,GAAG,GAAG,GAAG;AAC/C,YAAM,YAAY,OAAO,QAAQ,OAAO,EAAE;AAC1C,YAAM,cAAc,UAAU,QAAQ,GAAG;AACzC,YAAM,eAAe,eAAe,IAAI,UAAU,MAAM,WAAW,IAAI;AACvE,YAAM,cACJ,eAAe,IAAI,UAAU,MAAM,GAAG,WAAW,IAAI;AACvD,uBAAiB,cAAc,YAAY;AAAA,IAC7C;AAAA,EACF;AACA,YAAU,MAAM;AACd,QAAI,SAAS,UAAU,IAAI;AACzB,UAAI,OAAO,SAAS,YAAY,SAAS,MAAM,SAAS,GAAG,GAAG;AAC5D,yBAAiB,MAAM,UAAU;AAAA,MACnC,OAAO;AACL,yBAAiB,gBAAgB,MAAM,SAAA,CAAU,CAAC;AAAA,MACpD;AAAA,IACF,OAAO;AACL,uBAAiB,EAAE;AAAA,IACrB;AAAA,EACF,GAAG,CAAC,KAAK,CAAC;AAEV,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACE,GAAG;AAAA,MACJ,OAAO;AAAA,MACP;AAAA,MACA,OAAO;AAAA,MACP,SAAS;AAAA,MACT,UAAU;AAAA,MACV,QAAQ;AAAA,IAAA;AAAA,EAAA;AAGd;"}
1
+ {"version":3,"file":"CustomInputCurrency.js","sources":["../../src/custom-input/CustomInputCurrency.jsx"],"sourcesContent":["import { useEffect, useState } from 'react';\r\nimport { Input } from '@neolution-ch/reactstrap';\r\nimport { fieldToCurrency } from 'siam-utils';\r\n/**\r\n * value, //admite formato como devuelve la BD (varchar), flotante o currency\r\n * al setear un valor en el componente se visualiza como Currency:\r\n * Formato $ 3.000,60\r\n * Al intentar editar el VALOR automaticamente se conviertea un numero cuyo formato es:\r\n * sin separador de miles, sin simbolo pesos ($), y la coma como separador de decimales\r\n * Formato: 3000,60\r\n * Al perder el foco el VALOR cambia a formato currency\r\n * Para el componente PADRE que lo esta usando, va a recibir desde el evento onblur un valor cuyo formato es el PERSISTENCE:\r\n * Formato: 3000.60\r\n */\r\nexport const CustomInputCurrency = (props) => {\r\n const {\r\n onChange = () => {\r\n undefined;\r\n },\r\n onFocus = () => {\r\n undefined;\r\n },\r\n value = {},\r\n maxLength = '20',\r\n style = {},\r\n } = props;\r\n const styleCurrency = { ...style, textAlign: 'right' };\r\n const [valueInputCur, setValueInputCur] = useState('');\r\n const escapeRegExp = (string) =>\r\n string.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&');\r\n\r\n const handleInputOnBlur = (event) => {\r\n const { target } = event;\r\n if (valueInputCur !== '') {\r\n const valor = valueInputCur.replace('.', '');\r\n const valorPersistence = valor.replace(',', '.');\r\n setValueInputCur(fieldToCurrency(valorPersistence));\r\n onChange({\r\n ...event,\r\n target: {\r\n ...target,\r\n value: valorPersistence,\r\n valueCurrency: fieldToCurrency(valorPersistence),\r\n valueFloat: parseFloat(valorPersistence),\r\n },\r\n });\r\n }\r\n };\r\n\r\n const handleInputOnFocus = (e) => {\r\n if (valueInputCur !== '') {\r\n const valor = valueInputCur.replace('$ ', '');\r\n const valor2 = valor.replace(/\\./g, '');\r\n setValueInputCur(valor2);\r\n }\r\n onFocus(e);\r\n };\r\n\r\n const handleInputChange = (event) => {\r\n const { target } = event;\r\n const valor = target.value.replace('$ ', '');\r\n const valid = /^-?[0-9.]*(?:[,]\\d?\\d?)?$/;\r\n if (valid.test(valor)) {\r\n const sepDec = valor.slice(-1) === '.' ? `${valor.slice(0, -1)},` : valor;\r\n const punto = new RegExp(escapeRegExp('.'), 'g');\r\n const sinSepMil = sepDec.replace(punto, '');\r\n const posPuntoDec = sinSepMil.indexOf(',');\r\n const parteDecimal = posPuntoDec >= 0 ? sinSepMil.slice(posPuntoDec) : '';\r\n const parteEntera =\r\n posPuntoDec >= 0 ? sinSepMil.slice(0, posPuntoDec) : sinSepMil;\r\n setValueInputCur(parteEntera + parteDecimal);\r\n }\r\n };\r\n useEffect(() => {\r\n if (value && value !== '') {\r\n if (typeof value != 'number' && value && value.includes('$')) {\r\n setValueInputCur(value.toString());\r\n } else {\r\n setValueInputCur(fieldToCurrency(value.toString()));\r\n }\r\n } else {\r\n setValueInputCur('');\r\n }\r\n }, [value]);\r\n\r\n return (\r\n <Input\r\n {...props}\r\n style={styleCurrency}\r\n maxLength={maxLength}\r\n value={valueInputCur}\r\n onFocus={handleInputOnFocus}\r\n onChange={handleInputChange}\r\n onBlur={handleInputOnBlur}\r\n />\r\n );\r\n};\r\n\r\nexport default CustomInputCurrency;\r\n"],"names":[],"mappings":";;;;AAcO,MAAM,sBAAsB,CAAC,UAAU;AAC5C,QAAM;AAAA,IACJ,WAAW,MAAM;AAAA,IAEjB;AAAA,IACA,UAAU,MAAM;AAAA,IAEhB;AAAA,IACA,QAAQ,CAAA;AAAA,IACR,YAAY;AAAA,IACZ,QAAQ,CAAA;AAAA,EAAC,IACP;AACJ,QAAM,gBAAgB,EAAE,GAAG,OAAO,WAAW,QAAA;AAC7C,QAAM,CAAC,eAAe,gBAAgB,IAAI,SAAS,EAAE;AACrD,QAAM,eAAe,CAAC,WACpB,OAAO,QAAQ,uBAAuB,MAAM;AAE9C,QAAM,oBAAoB,CAAC,UAAU;AACnC,UAAM,EAAE,WAAW;AACnB,QAAI,kBAAkB,IAAI;AACxB,YAAM,QAAQ,cAAc,QAAQ,KAAK,EAAE;AAC3C,YAAM,mBAAmB,MAAM,QAAQ,KAAK,GAAG;AAC/C,uBAAiB,gBAAgB,gBAAgB,CAAC;AAClD,eAAS;AAAA,QACP,GAAG;AAAA,QACH,QAAQ;AAAA,UACN,GAAG;AAAA,UACH,OAAO;AAAA,UACP,eAAe,gBAAgB,gBAAgB;AAAA,UAC/C,YAAY,WAAW,gBAAgB;AAAA,QAAA;AAAA,MACzC,CACD;AAAA,IACH;AAAA,EACF;AAEA,QAAM,qBAAqB,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,47 @@
1
- import { jsxs, jsx } from "react/jsx-runtime";
2
- import { useState } from "react";
3
- import { FormGroup, Label, Input } from "reactstrap";
4
- import { MENSAJE } from "./constant.js";
5
- import "./index.css";
6
- const CustomInputFile = ({
7
- accept,
8
- className = "",
9
- id,
10
- label,
11
- name,
12
- onChange
13
- }) => {
14
- const [fileName, setFileName] = useState(label || LABEL_FILE);
15
- const { LABEL_FILE } = MENSAJE;
16
- const handleFileChange = (event) => {
17
- const files = event.target.files;
18
- if (files.length > 0) {
19
- setFileName(files[0].name);
20
- } else {
21
- setFileName(label || LABEL_FILE);
22
- }
23
- if (onChange) {
24
- onChange(event);
25
- }
26
- };
27
- return /* @__PURE__ */ jsxs(FormGroup, { className: `custom-file ${className}`, children: [
28
- /* @__PURE__ */ jsx(Label, { for: id, className: "custom-file-label", children: fileName }),
29
- /* @__PURE__ */ jsx(
30
- Input,
31
- {
32
- id,
33
- name,
34
- accept,
35
- type: "file",
36
- onChange: handleFileChange,
37
- className: "custom-file-input"
38
- }
39
- )
40
- ] });
41
- };
42
- export {
43
- CustomInputFile
44
- };
45
- //# sourceMappingURL=CustomInputFile.js.map
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useState } from "react";
3
+ import FormGroup from "../node_modules/@neolution-ch/reactstrap/esm/FormGroup.js";
4
+ import Input from "../node_modules/@neolution-ch/reactstrap/esm/Input.js";
5
+ import Label from "../node_modules/@neolution-ch/reactstrap/esm/Label.js";
6
+ import { MENSAJE } from "./constant.js";
7
+ import "./index.css";
8
+ const CustomInputFile = ({
9
+ accept,
10
+ className = "",
11
+ id,
12
+ label,
13
+ name,
14
+ onChange
15
+ }) => {
16
+ const [fileName, setFileName] = useState(label || LABEL_FILE);
17
+ const { LABEL_FILE } = MENSAJE;
18
+ const handleFileChange = (event) => {
19
+ const files = event.target.files;
20
+ if (files.length > 0) {
21
+ setFileName(files[0].name);
22
+ } else {
23
+ setFileName(label || LABEL_FILE);
24
+ }
25
+ if (onChange) {
26
+ onChange(event);
27
+ }
28
+ };
29
+ return /* @__PURE__ */ jsxs(FormGroup, { className: `custom-file ${className}`, children: [
30
+ /* @__PURE__ */ jsx(Label, { for: id, className: "custom-file-label", children: fileName }),
31
+ /* @__PURE__ */ jsx(
32
+ Input,
33
+ {
34
+ id,
35
+ name,
36
+ accept,
37
+ type: "file",
38
+ onChange: handleFileChange,
39
+ className: "custom-file-input"
40
+ }
41
+ )
42
+ ] });
43
+ };
44
+ export {
45
+ CustomInputFile
46
+ };
47
+ //# sourceMappingURL=CustomInputFile.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomInputFile.js","sources":["../../src/custom-input/CustomInputFile.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { FormGroup, Input, Label } from 'reactstrap';\r\nimport { MENSAJE } from './constant';\r\nimport './index.css';\r\n\r\nexport const CustomInputFile = ({\r\n accept,\r\n className = '',\r\n id,\r\n label,\r\n name,\r\n onChange,\r\n}) => {\r\n const [fileName, setFileName] = useState(label || LABEL_FILE);\r\n const { LABEL_FILE } = MENSAJE;\r\n const handleFileChange = (event) => {\r\n const files = event.target.files;\r\n if (files.length > 0) {\r\n setFileName(files[0].name);\r\n } else {\r\n setFileName(label || LABEL_FILE);\r\n }\r\n\r\n if (onChange) {\r\n onChange(event);\r\n }\r\n };\r\n\r\n return (\r\n <FormGroup className={`custom-file ${className}`}>\r\n <Label for={id} className=\"custom-file-label\">\r\n {fileName}\r\n </Label>\r\n <Input\r\n id={id}\r\n name={name}\r\n accept={accept}\r\n type=\"file\"\r\n onChange={handleFileChange}\r\n className=\"custom-file-input\"\r\n />\r\n </FormGroup>\r\n );\r\n};\r\n\r\nexport default CustomInputFile;\r\n"],"names":[],"mappings":";;;;;AAKO,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,SAAS,UAAU;AAC5D,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,CAAC,UAAU;AAClC,UAAM,QAAQ,MAAM,OAAO;AAC3B,QAAI,MAAM,SAAS,GAAG;AACpB,kBAAY,MAAM,CAAC,EAAE,IAAI;AAAA,IAC3B,OAAO;AACL,kBAAY,SAAS,UAAU;AAAA,IACjC;AAEA,QAAI,UAAU;AACZ,eAAS,KAAK;AAAA,IAChB;AAAA,EACF;AAEA,SACE,qBAAC,WAAA,EAAU,WAAW,eAAe,SAAS,IAC5C,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAM,KAAK,IAAI,WAAU,qBACvB,UAAA,UACH;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL,UAAU;AAAA,QACV,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
1
+ {"version":3,"file":"CustomInputFile.js","sources":["../../src/custom-input/CustomInputFile.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { FormGroup, Input, Label } from '@neolution-ch/reactstrap';\r\nimport { MENSAJE } from './constant';\r\nimport './index.css';\r\n\r\nexport const CustomInputFile = ({\r\n accept,\r\n className = '',\r\n id,\r\n label,\r\n name,\r\n onChange,\r\n}) => {\r\n const [fileName, setFileName] = useState(label || LABEL_FILE);\r\n const { LABEL_FILE } = MENSAJE;\r\n const handleFileChange = (event) => {\r\n const files = event.target.files;\r\n if (files.length > 0) {\r\n setFileName(files[0].name);\r\n } else {\r\n setFileName(label || LABEL_FILE);\r\n }\r\n\r\n if (onChange) {\r\n onChange(event);\r\n }\r\n };\r\n\r\n return (\r\n <FormGroup className={`custom-file ${className}`}>\r\n <Label for={id} className=\"custom-file-label\">\r\n {fileName}\r\n </Label>\r\n <Input\r\n id={id}\r\n name={name}\r\n accept={accept}\r\n type=\"file\"\r\n onChange={handleFileChange}\r\n className=\"custom-file-input\"\r\n />\r\n </FormGroup>\r\n );\r\n};\r\n\r\nexport default CustomInputFile;\r\n"],"names":[],"mappings":";;;;;;;AAKO,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,SAAS,UAAU;AAC5D,QAAM,EAAE,eAAe;AACvB,QAAM,mBAAmB,CAAC,UAAU;AAClC,UAAM,QAAQ,MAAM,OAAO;AAC3B,QAAI,MAAM,SAAS,GAAG;AACpB,kBAAY,MAAM,CAAC,EAAE,IAAI;AAAA,IAC3B,OAAO;AACL,kBAAY,SAAS,UAAU;AAAA,IACjC;AAEA,QAAI,UAAU;AACZ,eAAS,KAAK;AAAA,IAChB;AAAA,EACF;AAEA,SACE,qBAAC,WAAA,EAAU,WAAW,eAAe,SAAS,IAC5C,UAAA;AAAA,IAAA,oBAAC,OAAA,EAAM,KAAK,IAAI,WAAU,qBACvB,UAAA,UACH;AAAA,IACA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC;AAAA,QACA;AAAA,QACA;AAAA,QACA,MAAK;AAAA,QACL,UAAU;AAAA,QACV,WAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
@@ -1,66 +1,68 @@
1
- import { jsx, jsxs } from "react/jsx-runtime";
2
- import { FormGroup, Input, Label } from "reactstrap";
3
- import "./index.css";
4
- const CustomInputRadio = ({
5
- className,
6
- customClassName,
7
- checked,
8
- disabled,
9
- id,
10
- inline,
11
- label,
12
- name,
13
- onChange,
14
- direction = "row"
15
- }) => {
16
- return /* @__PURE__ */ jsx(
17
- FormGroup,
18
- {
19
- inline,
20
- className: `custom-radio ${customClassName || ""}`,
21
- children: /* @__PURE__ */ jsxs(
22
- "div",
23
- {
24
- style: {
25
- display: "flex",
26
- flexDirection: direction,
27
- alignItems: "center",
28
- justifyContent: "center"
29
- },
30
- children: [
31
- /* @__PURE__ */ jsx(
32
- Input,
33
- {
34
- id,
35
- type: "radio",
36
- name,
37
- checked,
38
- onChange,
39
- disabled,
40
- className
41
- }
42
- ),
43
- /* @__PURE__ */ jsx(
44
- Label,
45
- {
46
- check: true,
47
- htmlFor: id,
48
- style: {
49
- alignItems: "center",
50
- justifyContent: "center",
51
- height: "25px",
52
- width: "25px"
53
- }
54
- }
55
- ),
56
- /* @__PURE__ */ jsx("div", { children: label })
57
- ]
58
- }
59
- )
60
- }
61
- );
62
- };
63
- export {
64
- CustomInputRadio
65
- };
66
- //# sourceMappingURL=CustomInputRadio.js.map
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import FormGroup from "../node_modules/@neolution-ch/reactstrap/esm/FormGroup.js";
3
+ import Input from "../node_modules/@neolution-ch/reactstrap/esm/Input.js";
4
+ import Label from "../node_modules/@neolution-ch/reactstrap/esm/Label.js";
5
+ import "./index.css";
6
+ const CustomInputRadio = ({
7
+ className,
8
+ customClassName,
9
+ checked,
10
+ disabled,
11
+ id,
12
+ inline,
13
+ label,
14
+ name,
15
+ onChange,
16
+ direction = "row"
17
+ }) => {
18
+ return /* @__PURE__ */ jsx(
19
+ FormGroup,
20
+ {
21
+ inline,
22
+ className: `custom-radio ${customClassName || ""}`,
23
+ children: /* @__PURE__ */ jsxs(
24
+ "div",
25
+ {
26
+ style: {
27
+ display: "flex",
28
+ flexDirection: direction,
29
+ alignItems: "center",
30
+ justifyContent: "center"
31
+ },
32
+ children: [
33
+ /* @__PURE__ */ jsx(
34
+ Input,
35
+ {
36
+ id,
37
+ type: "radio",
38
+ name,
39
+ checked,
40
+ onChange,
41
+ disabled,
42
+ className
43
+ }
44
+ ),
45
+ /* @__PURE__ */ jsx(
46
+ Label,
47
+ {
48
+ check: true,
49
+ htmlFor: id,
50
+ style: {
51
+ alignItems: "center",
52
+ justifyContent: "center",
53
+ height: "25px",
54
+ width: "25px"
55
+ }
56
+ }
57
+ ),
58
+ /* @__PURE__ */ jsx("div", { children: label })
59
+ ]
60
+ }
61
+ )
62
+ }
63
+ );
64
+ };
65
+ export {
66
+ CustomInputRadio
67
+ };
68
+ //# sourceMappingURL=CustomInputRadio.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CustomInputRadio.js","sources":["../../src/custom-input/CustomInputRadio.jsx"],"sourcesContent":["import { FormGroup, Label, Input } from 'reactstrap';\r\nimport './index.css';\r\n\r\nexport const CustomInputRadio = ({\r\n className,\r\n customClassName,\r\n checked,\r\n disabled,\r\n id,\r\n inline,\r\n label,\r\n name,\r\n onChange,\r\n direction = 'row',\r\n}) => {\r\n return (\r\n <FormGroup\r\n inline={inline}\r\n className={`custom-radio ${customClassName || ''}`}\r\n >\r\n <div\r\n style={{\r\n display: 'flex',\r\n flexDirection: direction,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n <Input\r\n id={id}\r\n type=\"radio\"\r\n name={name}\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={disabled}\r\n className={className}\r\n />\r\n\r\n <Label\r\n check\r\n htmlFor={id}\r\n style={{\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n height: '25px',\r\n width: '25px',\r\n }}\r\n ></Label>\r\n <div>{label}</div>\r\n </div>\r\n </FormGroup>\r\n );\r\n};\r\n\r\nexport default CustomInputRadio;\r\n"],"names":[],"mappings":";;;AAGO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACd,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,gBAAgB,mBAAmB,EAAE;AAAA,MAEhD,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAO;AAAA,YACL,SAAS;AAAA,YACT,eAAe;AAAA,YACf,YAAY;AAAA,YACZ,gBAAgB;AAAA,UAAA;AAAA,UAGlB,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC;AAAA,gBACA,MAAK;AAAA,gBACL;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGF;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAO;AAAA,kBACL,YAAY;AAAA,kBACZ,gBAAgB;AAAA,kBAChB,QAAQ;AAAA,kBACR,OAAO;AAAA,gBAAA;AAAA,cACT;AAAA,YAAA;AAAA,YAEF,oBAAC,SAAK,UAAA,MAAA,CAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGN;"}
1
+ {"version":3,"file":"CustomInputRadio.js","sources":["../../src/custom-input/CustomInputRadio.jsx"],"sourcesContent":["import { FormGroup, Label, Input } from '@neolution-ch/reactstrap';\r\nimport './index.css';\r\n\r\nexport const CustomInputRadio = ({\r\n className,\r\n customClassName,\r\n checked,\r\n disabled,\r\n id,\r\n inline,\r\n label,\r\n name,\r\n onChange,\r\n direction = 'row',\r\n}) => {\r\n return (\r\n <FormGroup\r\n inline={inline}\r\n className={`custom-radio ${customClassName || ''}`}\r\n >\r\n <div\r\n style={{\r\n display: 'flex',\r\n flexDirection: direction,\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n }}\r\n >\r\n <Input\r\n id={id}\r\n type=\"radio\"\r\n name={name}\r\n checked={checked}\r\n onChange={onChange}\r\n disabled={disabled}\r\n className={className}\r\n />\r\n\r\n <Label\r\n check\r\n htmlFor={id}\r\n style={{\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n height: '25px',\r\n width: '25px',\r\n }}\r\n ></Label>\r\n <div>{label}</div>\r\n </div>\r\n </FormGroup>\r\n );\r\n};\r\n\r\nexport default CustomInputRadio;\r\n"],"names":[],"mappings":";;;;;AAGO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AACd,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA,WAAW,gBAAgB,mBAAmB,EAAE;AAAA,MAEhD,UAAA;AAAA,QAAC;AAAA,QAAA;AAAA,UACC,OAAO;AAAA,YACL,SAAS;AAAA,YACT,eAAe;AAAA,YACf,YAAY;AAAA,YACZ,gBAAgB;AAAA,UAAA;AAAA,UAGlB,UAAA;AAAA,YAAA;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC;AAAA,gBACA,MAAK;AAAA,gBACL;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,gBACA;AAAA,cAAA;AAAA,YAAA;AAAA,YAGF;AAAA,cAAC;AAAA,cAAA;AAAA,gBACC,OAAK;AAAA,gBACL,SAAS;AAAA,gBACT,OAAO;AAAA,kBACL,YAAY;AAAA,kBACZ,gBAAgB;AAAA,kBAChB,QAAQ;AAAA,kBACR,OAAO;AAAA,gBAAA;AAAA,cACT;AAAA,YAAA;AAAA,YAEF,oBAAC,SAAK,UAAA,MAAA,CAAM;AAAA,UAAA;AAAA,QAAA;AAAA,MAAA;AAAA,IACd;AAAA,EAAA;AAGN;"}
@@ -1,5 +1,5 @@
1
- const MENSAJE = { LABEL_FILE: "Elija el archivo..." };
2
- export {
3
- MENSAJE
4
- };
5
- //# sourceMappingURL=constant.js.map
1
+ const MENSAJE = { LABEL_FILE: "Elija el archivo..." };
2
+ export {
3
+ MENSAJE
4
+ };
5
+ //# sourceMappingURL=constant.js.map
@@ -1,12 +1,12 @@
1
- import "./index.css";
2
- import { CustomInputCheckbox } from "./CustomInputCheckbox.js";
3
- import { CustomInputRadio } from "./CustomInputRadio.js";
4
- import { CustomInputFile } from "./CustomInputFile.js";
5
- import { CustomInputCurrency } from "./CustomInputCurrency.js";
6
- export {
7
- CustomInputCheckbox,
8
- CustomInputCurrency,
9
- CustomInputFile,
10
- CustomInputRadio
11
- };
12
- //# sourceMappingURL=index.js.map
1
+ import "./index.css";
2
+ import { CustomInputCheckbox } from "./CustomInputCheckbox.js";
3
+ import { CustomInputRadio } from "./CustomInputRadio.js";
4
+ import { CustomInputFile } from "./CustomInputFile.js";
5
+ import { CustomInputCurrency } from "./CustomInputCurrency.js";
6
+ export {
7
+ CustomInputCheckbox,
8
+ CustomInputCurrency,
9
+ CustomInputFile,
10
+ CustomInputRadio
11
+ };
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,83 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useRef, useState, useMemo, useEffect } from "react";
3
+ function DropzoneComponent({
4
+ config = {},
5
+ djsConfig = {},
6
+ eventHandlers = {},
7
+ className = "",
8
+ action,
9
+ children
10
+ }) {
11
+ const dropzoneRef = useRef(null);
12
+ const dropzoneInstance = useRef(null);
13
+ const [files, setFiles] = useState([]);
14
+ const options = useMemo(() => {
15
+ return {
16
+ ...config.postUrl ? { url: config.postUrl } : {},
17
+ ...djsConfig
18
+ };
19
+ }, [config.postUrl, djsConfig]);
20
+ const setupEvents = (dz) => {
21
+ if (!eventHandlers) return;
22
+ Object.entries(eventHandlers).forEach(([event, handler]) => {
23
+ if (!handler) return;
24
+ const handlers = Array.isArray(handler) ? handler : [handler];
25
+ handlers.forEach((fn) => {
26
+ if (event === "init") {
27
+ fn(dz);
28
+ } else {
29
+ dz.on(event, fn);
30
+ }
31
+ });
32
+ });
33
+ dz.on("addedfile", (file) => {
34
+ if (!file) return;
35
+ setFiles((prev) => [...prev, file]);
36
+ });
37
+ dz.on("removedfile", (file) => {
38
+ if (!file) return;
39
+ setFiles(
40
+ (prev) => prev.filter((f) => !(f.name === file.name && f.size === file.size))
41
+ );
42
+ });
43
+ };
44
+ useEffect(() => {
45
+ let mounted = true;
46
+ const initDropzone = async () => {
47
+ const { default: Dropzone } = await import("../node_modules/dropzone/dist/dropzone.js");
48
+ if (!mounted) return;
49
+ Dropzone.autoDiscover = false;
50
+ const node = config.dropzoneSelector || dropzoneRef.current;
51
+ if (!node) return;
52
+ const dz = new Dropzone(node, options);
53
+ dropzoneInstance.current = dz;
54
+ setupEvents(dz);
55
+ };
56
+ initDropzone();
57
+ return () => {
58
+ mounted = false;
59
+ const dz = dropzoneInstance.current;
60
+ if (!dz) return;
61
+ dz.off();
62
+ dz.destroy();
63
+ };
64
+ }, []);
65
+ useEffect(() => {
66
+ const dz = dropzoneInstance.current;
67
+ if (!dz) return;
68
+ dz.options = {
69
+ ...dz.options,
70
+ ...djsConfig,
71
+ ...config.postUrl ? { url: config.postUrl } : {}
72
+ };
73
+ }, [config.postUrl, djsConfig]);
74
+ const dropzoneClass = className ? `filepicker dropzone ${className}` : "filepicker dropzone";
75
+ if (!config.postUrl && action) {
76
+ return /* @__PURE__ */ jsx("form", { ref: dropzoneRef, action, className: dropzoneClass, children });
77
+ }
78
+ return /* @__PURE__ */ jsx("div", { ref: dropzoneRef, className: dropzoneClass, children });
79
+ }
80
+ export {
81
+ DropzoneComponent as default
82
+ };
83
+ //# sourceMappingURL=DropzoneComponent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"DropzoneComponent.js","sources":["../../src/drag-and-dropzone/DropzoneComponent.jsx"],"sourcesContent":["import { useEffect, useRef, useState, useMemo } from 'react';\r\n\r\nexport default function DropzoneComponent({\r\n config = {},\r\n djsConfig = {},\r\n eventHandlers = {},\r\n className = '',\r\n action,\r\n children,\r\n}) {\r\n const dropzoneRef = useRef(null);\r\n const dropzoneInstance = useRef(null);\r\n\r\n const [files, setFiles] = useState([]);\r\n\r\n const options = useMemo(() => {\r\n return {\r\n ...(config.postUrl ? { url: config.postUrl } : {}),\r\n ...djsConfig,\r\n };\r\n }, [config.postUrl, djsConfig]);\r\n\r\n const setupEvents = (dz) => {\r\n if (!eventHandlers) return;\r\n\r\n Object.entries(eventHandlers).forEach(([event, handler]) => {\r\n if (!handler) return;\r\n\r\n const handlers = Array.isArray(handler) ? handler : [handler];\r\n\r\n handlers.forEach((fn) => {\r\n if (event === 'init') {\r\n fn(dz);\r\n } else {\r\n dz.on(event, fn);\r\n }\r\n });\r\n });\r\n\r\n dz.on('addedfile', (file) => {\r\n if (!file) return;\r\n setFiles((prev) => [...prev, file]);\r\n });\r\n\r\n dz.on('removedfile', (file) => {\r\n if (!file) return;\r\n\r\n setFiles((prev) =>\r\n prev.filter((f) => !(f.name === file.name && f.size === file.size))\r\n );\r\n });\r\n };\r\n\r\n useEffect(() => {\r\n let mounted = true;\r\n\r\n const initDropzone = async () => {\r\n const { default: Dropzone } = await import('dropzone');\r\n\r\n if (!mounted) return;\r\n\r\n Dropzone.autoDiscover = false;\r\n\r\n const node = config.dropzoneSelector || dropzoneRef.current;\r\n if (!node) return;\r\n\r\n const dz = new Dropzone(node, options);\r\n\r\n dropzoneInstance.current = dz;\r\n\r\n setupEvents(dz);\r\n };\r\n\r\n initDropzone();\r\n\r\n return () => {\r\n mounted = false;\r\n\r\n const dz = dropzoneInstance.current;\r\n\r\n if (!dz) return;\r\n\r\n dz.off();\r\n dz.destroy();\r\n };\r\n }, []);\r\n\r\n useEffect(() => {\r\n const dz = dropzoneInstance.current;\r\n\r\n if (!dz) return;\r\n\r\n dz.options = {\r\n ...dz.options,\r\n ...djsConfig,\r\n ...(config.postUrl ? { url: config.postUrl } : {}),\r\n };\r\n }, [config.postUrl, djsConfig]);\r\n\r\n const dropzoneClass = className\r\n ? `filepicker dropzone ${className}`\r\n : 'filepicker dropzone';\r\n\r\n if (!config.postUrl && action) {\r\n return (\r\n <form ref={dropzoneRef} action={action} className={dropzoneClass}>\r\n {children}\r\n </form>\r\n );\r\n }\r\n\r\n return (\r\n <div ref={dropzoneRef} className={dropzoneClass}>\r\n {children}\r\n </div>\r\n );\r\n}\r\n"],"names":[],"mappings":";;AAEA,SAAwB,kBAAkB;AAAA,EACxC,SAAS,CAAA;AAAA,EACT,YAAY,CAAA;AAAA,EACZ,gBAAgB,CAAA;AAAA,E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