siam-ui-utils 3.1.5 → 3.2.1

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 (60) hide show
  1. package/dist/CustomBootstrap.js +2 -2
  2. package/dist/CustomBootstrap.js.map +1 -1
  3. package/dist/copy-link/index.js +3 -3
  4. package/dist/copy-link/index.js.map +1 -1
  5. package/dist/custom-input/CustomInputCheckbox.js +30 -12
  6. package/dist/custom-input/CustomInputCheckbox.js.map +1 -1
  7. package/dist/custom-input/CustomInputCurrency.js +1 -1
  8. package/dist/custom-input/CustomInputCurrency.js.map +1 -1
  9. package/dist/custom-input/CustomInputFile.js +28 -19
  10. package/dist/custom-input/CustomInputFile.js.map +1 -1
  11. package/dist/custom-input/CustomInputRadio.js +31 -47
  12. package/dist/custom-input/CustomInputRadio.js.map +1 -1
  13. package/dist/custom-input/index.css +25 -167
  14. package/dist/drag-and-dropzone/config.js +52 -51
  15. package/dist/drag-and-dropzone/config.js.map +1 -1
  16. package/dist/drag-and-dropzone/index.css +271 -276
  17. package/dist/drag-and-dropzone/index.js +30 -16
  18. package/dist/drag-and-dropzone/index.js.map +1 -1
  19. package/dist/dropzone-uploader/styled/index.css +165 -348
  20. package/dist/dropzone-uploader/styled/index.js +71 -60
  21. package/dist/dropzone-uploader/styled/index.js.map +1 -1
  22. package/dist/react-notifications/NotificationManager.js +14 -0
  23. package/dist/react-notifications/NotificationManager.js.map +1 -0
  24. package/dist/react-notifications/index.js +2 -1
  25. package/dist/react-notifications/index.js.map +1 -1
  26. package/dist/select/custom-select/index.js +59 -10
  27. package/dist/select/custom-select/index.js.map +1 -1
  28. package/dist/select/multi-select/index.js +6 -3
  29. package/dist/select/multi-select/index.js.map +1 -1
  30. package/dist/select/multi-select/styled-component.js +1 -1
  31. package/dist/select/multi-select/styled-component.js.map +1 -1
  32. package/dist/tomar-foto/index.js +1 -1
  33. package/dist/tomar-foto/index.js.map +1 -1
  34. package/package.json +3 -3
  35. package/dist/_virtual/_commonjsHelpers.js +0 -7
  36. package/dist/_virtual/_commonjsHelpers.js.map +0 -1
  37. package/dist/_virtual/index.js +0 -8
  38. package/dist/_virtual/index.js.map +0 -1
  39. package/dist/_virtual/index2.js +0 -5
  40. package/dist/_virtual/index2.js.map +0 -1
  41. package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js +0 -77
  42. package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js.map +0 -1
  43. package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +0 -111
  44. package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js.map +0 -1
  45. package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +0 -106
  46. package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js.map +0 -1
  47. package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +0 -125
  48. package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js.map +0 -1
  49. package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +0 -75
  50. package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js.map +0 -1
  51. package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +0 -225
  52. package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js.map +0 -1
  53. package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +0 -122
  54. package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js.map +0 -1
  55. package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +0 -83
  56. package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js.map +0 -1
  57. package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +0 -68
  58. package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js.map +0 -1
  59. package/dist/node_modules/classnames/index.js +0 -62
  60. package/dist/node_modules/classnames/index.js.map +0 -1
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
- import Col from "./node_modules/@neolution-ch/reactstrap/esm/Col.js";
3
- const Colxx = (props) => /* @__PURE__ */ jsx(Col, { ...props, widths: ["xxs", "xs", "sm", "md", "lg", "xl", "xxl"] });
2
+ import { Col } from "siam-ui";
3
+ const Colxx = (props) => /* @__PURE__ */ jsx(Col, { ...props });
4
4
  const Separator = ({ className }) => /* @__PURE__ */ jsx("div", { className: `separator ${className}` });
5
5
  export {
6
6
  Colxx,
@@ -1 +1 @@
1
- {"version":3,"file":"CustomBootstrap.js","sources":["../src/CustomBootstrap.jsx"],"sourcesContent":["import { Col } from '@neolution-ch/reactstrap';\r\n\r\nconst Colxx = (props) => (\r\n <Col {...props} widths={['xxs', 'xs', 'sm', 'md', 'lg', 'xl', 'xxl']} />\r\n);\r\n\r\nconst Separator = ({ className }) => (\r\n <div className={`separator ${className}`} />\r\n);\r\nexport { Colxx, Separator };\r\n"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,CAAC,UACb,oBAAC,KAAA,EAAK,GAAG,OAAO,QAAQ,CAAC,OAAO,MAAM,MAAM,MAAM,MAAM,MAAM,KAAK,EAAA,CAAG;AAGxE,MAAM,YAAY,CAAC,EAAE,UAAA,0BAClB,OAAA,EAAI,WAAW,aAAa,SAAS,GAAA,CAAI;"}
1
+ {"version":3,"file":"CustomBootstrap.js","sources":["../src/CustomBootstrap.jsx"],"sourcesContent":["import { Col } from 'siam-ui';\r\n\r\nconst Colxx = (props) => <Col {...props} />;\r\n\r\nconst Separator = ({ className }) => (\r\n <div className={`separator ${className}`} />\r\n);\r\nexport { Colxx, Separator };\r\n"],"names":[],"mappings":";;AAEA,MAAM,QAAQ,CAAC,UAAU,oBAAC,KAAA,EAAK,GAAG,MAAA,CAAO;AAEzC,MAAM,YAAY,CAAC,EAAE,UAAA,0BAClB,OAAA,EAAI,WAAW,aAAa,SAAS,GAAA,CAAI;"}
@@ -1,6 +1,6 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { useState } from "react";
3
- import Button from "../node_modules/@neolution-ch/reactstrap/esm/Button.js";
3
+ import { Button } from "siam-ui";
4
4
  import copiarIcon from "../assets/img/copiar.png.js";
5
5
  import "./styles.css";
6
6
  const copyToClipboard = async (text) => {
@@ -43,8 +43,8 @@ const CopyLink = ({ link }) => {
43
43
  /* @__PURE__ */ jsx(
44
44
  Button,
45
45
  {
46
- color: "link",
47
- size: "sm",
46
+ $variant: "transparent",
47
+ $size: "small",
48
48
  onClick: handleCopy,
49
49
  title: "Copiar link",
50
50
  className: "copy-link-btn",
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../src/copy-link/index.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { Button } from '@neolution-ch/reactstrap';\r\nimport copiarIcon from '../assets/img/copiar.png';\r\nimport './styles.scss';\r\n\r\nconst copyToClipboard = async (text) => {\r\n try {\r\n if (!text) return false;\r\n if (navigator.clipboard?.writeText) {\r\n await navigator.clipboard.writeText(text);\r\n return true;\r\n }\r\n const ta = document.createElement('textarea');\r\n ta.value = text;\r\n ta.style.position = 'fixed';\r\n ta.style.left = '-9999px';\r\n document.body.appendChild(ta);\r\n ta.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(ta);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n};\r\n\r\nconst CopyLink = ({ link }) => {\r\n const [copied, setCopied] = useState(false);\r\n\r\n const handleCopy = async () => {\r\n await copyToClipboard(link);\r\n setCopied(true);\r\n setTimeout(() => setCopied(false), 2000);\r\n };\r\n return (\r\n <span className=\"copy-link-container\">\r\n <span\r\n title={link}\r\n className={`copy-link-text${copied ? ' copied' : ''}`}\r\n onClick={handleCopy}\r\n >\r\n {link}\r\n </span>\r\n <Button\r\n color=\"link\"\r\n size=\"sm\"\r\n onClick={handleCopy}\r\n title=\"Copiar link\"\r\n className=\"copy-link-btn\"\r\n >\r\n <img src={copiarIcon} alt=\"Copiar\" />\r\n </Button>\r\n {copied && <span className=\"copy-link-copied\">¡Copiado!</span>}\r\n </span>\r\n );\r\n};\r\n\r\nexport { CopyLink };\r\n"],"names":[],"mappings":";;;;;AAKA,MAAM,kBAAkB,OAAO,SAAS;AACtC,MAAI;AACF,QAAI,CAAC,KAAM,QAAO;AAClB,QAAI,UAAU,WAAW,WAAW;AAClC,YAAM,UAAU,UAAU,UAAU,IAAI;AACxC,aAAO;AAAA,IACT;AACA,UAAM,KAAK,SAAS,cAAc,UAAU;AAC5C,OAAG,QAAQ;AACX,OAAG,MAAM,WAAW;AACpB,OAAG,MAAM,OAAO;AAChB,aAAS,KAAK,YAAY,EAAE;AAC5B,OAAG,OAAA;AACH,aAAS,YAAY,MAAM;AAC3B,aAAS,KAAK,YAAY,EAAE;AAC5B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,MAAM,WAAW,CAAC,EAAE,WAAW;AAC7B,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,QAAM,aAAa,YAAY;AAC7B,UAAM,gBAAgB,IAAI;AAC1B,cAAU,IAAI;AACd,eAAW,MAAM,UAAU,KAAK,GAAG,GAAI;AAAA,EACzC;AACA,SACE,qBAAC,QAAA,EAAK,WAAU,uBACd,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,QACP,WAAW,iBAAiB,SAAS,YAAY,EAAE;AAAA,QACnD,SAAS;AAAA,QAER,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAM;AAAA,QACN,MAAK;AAAA,QACL,SAAS;AAAA,QACT,OAAM;AAAA,QACN,WAAU;AAAA,QAEV,UAAA,oBAAC,OAAA,EAAI,KAAK,YAAY,KAAI,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,IAEpC,UAAU,oBAAC,QAAA,EAAK,WAAU,oBAAmB,UAAA,YAAA,CAAS;AAAA,EAAA,GACzD;AAEJ;"}
1
+ {"version":3,"file":"index.js","sources":["../../src/copy-link/index.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { Button } from 'siam-ui';\r\nimport copiarIcon from '../assets/img/copiar.png';\r\nimport './styles.scss';\r\n\r\nconst copyToClipboard = async (text) => {\r\n try {\r\n if (!text) return false;\r\n if (navigator.clipboard?.writeText) {\r\n await navigator.clipboard.writeText(text);\r\n return true;\r\n }\r\n const ta = document.createElement('textarea');\r\n ta.value = text;\r\n ta.style.position = 'fixed';\r\n ta.style.left = '-9999px';\r\n document.body.appendChild(ta);\r\n ta.select();\r\n document.execCommand('copy');\r\n document.body.removeChild(ta);\r\n return true;\r\n } catch {\r\n return false;\r\n }\r\n};\r\n\r\nconst CopyLink = ({ link }) => {\r\n const [copied, setCopied] = useState(false);\r\n\r\n const handleCopy = async () => {\r\n await copyToClipboard(link);\r\n setCopied(true);\r\n setTimeout(() => setCopied(false), 2000);\r\n };\r\n return (\r\n <span className=\"copy-link-container\">\r\n <span\r\n title={link}\r\n className={`copy-link-text${copied ? ' copied' : ''}`}\r\n onClick={handleCopy}\r\n >\r\n {link}\r\n </span>\r\n <Button\r\n $variant=\"transparent\"\r\n $size=\"small\"\r\n onClick={handleCopy}\r\n title=\"Copiar link\"\r\n className=\"copy-link-btn\"\r\n >\r\n <img src={copiarIcon} alt=\"Copiar\" />\r\n </Button>\r\n {copied && <span className=\"copy-link-copied\">¡Copiado!</span>}\r\n </span>\r\n );\r\n};\r\n\r\nexport { CopyLink };\r\n"],"names":[],"mappings":";;;;;AAKA,MAAM,kBAAkB,OAAO,SAAS;AACtC,MAAI;AACF,QAAI,CAAC,KAAM,QAAO;AAClB,QAAI,UAAU,WAAW,WAAW;AAClC,YAAM,UAAU,UAAU,UAAU,IAAI;AACxC,aAAO;AAAA,IACT;AACA,UAAM,KAAK,SAAS,cAAc,UAAU;AAC5C,OAAG,QAAQ;AACX,OAAG,MAAM,WAAW;AACpB,OAAG,MAAM,OAAO;AAChB,aAAS,KAAK,YAAY,EAAE;AAC5B,OAAG,OAAA;AACH,aAAS,YAAY,MAAM;AAC3B,aAAS,KAAK,YAAY,EAAE;AAC5B,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,MAAM,WAAW,CAAC,EAAE,WAAW;AAC7B,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAS,KAAK;AAE1C,QAAM,aAAa,YAAY;AAC7B,UAAM,gBAAgB,IAAI;AAC1B,cAAU,IAAI;AACd,eAAW,MAAM,UAAU,KAAK,GAAG,GAAI;AAAA,EACzC;AACA,SACE,qBAAC,QAAA,EAAK,WAAU,uBACd,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,OAAO;AAAA,QACP,WAAW,iBAAiB,SAAS,YAAY,EAAE;AAAA,QACnD,SAAS;AAAA,QAER,UAAA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEH;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,UAAS;AAAA,QACT,OAAM;AAAA,QACN,SAAS;AAAA,QACT,OAAM;AAAA,QACN,WAAU;AAAA,QAEV,UAAA,oBAAC,OAAA,EAAI,KAAK,YAAY,KAAI,SAAA,CAAS;AAAA,MAAA;AAAA,IAAA;AAAA,IAEpC,UAAU,oBAAC,QAAA,EAAK,WAAU,oBAAmB,UAAA,YAAA,CAAS;AAAA,EAAA,GACzD;AAEJ;"}
@@ -1,8 +1,5 @@
1
- import { jsxs, jsx } 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";
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { Checkbox } from "siam-ui";
6
3
  const CustomInputCheckbox = ({
7
4
  className,
8
5
  id,
@@ -11,24 +8,45 @@ const CustomInputCheckbox = ({
11
8
  defaultChecked,
12
9
  disabled,
13
10
  label,
14
- onChange
11
+ onChange,
12
+ direction = "row",
13
+ style,
14
+ slotProps
15
15
  }) => {
16
- return /* @__PURE__ */ jsxs(FormGroup, { check: true, className: "custom-checkbox", children: [
16
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
17
17
  /* @__PURE__ */ jsx(
18
- Input,
18
+ Checkbox,
19
19
  {
20
- type: "checkbox",
21
20
  id: `check_${id}`,
22
21
  className,
23
22
  checked,
24
23
  onChange,
25
24
  defaultChecked,
26
- disabled
25
+ disabled,
26
+ label,
27
+ direction,
28
+ style: {
29
+ "--siam-checkbox-size": "19px",
30
+ ...style
31
+ },
32
+ slotProps: {
33
+ ...slotProps,
34
+ root: {
35
+ ...slotProps?.root,
36
+ style: {
37
+ flexDirection: direction,
38
+ ...slotProps?.root?.style
39
+ }
40
+ },
41
+ label: {
42
+ ...slotProps?.label,
43
+ style: { fontSize: "12px", ...slotProps?.label?.style }
44
+ }
45
+ }
27
46
  }
28
47
  ),
29
- /* @__PURE__ */ jsx(Label, { check: true, htmlFor: `check_${id}`, children: label }),
30
48
  children
31
- ] }, id);
49
+ ] });
32
50
  };
33
51
  export {
34
52
  CustomInputCheckbox
@@ -1 +1 @@
1
- {"version":3,"file":"CustomInputCheckbox.js","sources":["../../src/custom-input/CustomInputCheckbox.jsx"],"sourcesContent":["import { FormGroup, Label, Input } from '@neolution-ch/reactstrap';\r\nimport './index.css';\r\n\r\nexport const CustomInputCheckbox = ({\r\n className,\r\n id,\r\n checked,\r\n children,\r\n defaultChecked,\r\n disabled,\r\n label,\r\n onChange,\r\n}) => {\r\n return (\r\n <FormGroup check key={id} className=\"custom-checkbox\">\r\n <Input\r\n type=\"checkbox\"\r\n id={`check_${id}`}\r\n className={className}\r\n checked={checked}\r\n onChange={onChange}\r\n defaultChecked={defaultChecked}\r\n disabled={disabled}\r\n />\r\n <Label check htmlFor={`check_${id}`}>\r\n {label}\r\n </Label>\r\n {children}\r\n </FormGroup>\r\n );\r\n};\r\nexport default CustomInputCheckbox;\r\n"],"names":[],"mappings":";;;;;AAGO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,SACE,qBAAC,WAAA,EAAU,OAAK,MAAU,WAAU,mBAClC,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,IAAI,SAAS,EAAE;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,MAAA;AAAA,IAAA;AAAA,IAEF,oBAAC,SAAM,OAAK,MAAC,SAAS,SAAS,EAAE,IAC9B,UAAA,MAAA,CACH;AAAA,IACC;AAAA,EAAA,EAAA,GAbmB,EActB;AAEJ;"}
1
+ {"version":3,"file":"CustomInputCheckbox.js","sources":["../../src/custom-input/CustomInputCheckbox.jsx"],"sourcesContent":["import { Checkbox } from 'siam-ui';\n\nexport const CustomInputCheckbox = ({\n className,\n id,\n checked,\n children,\n defaultChecked,\n disabled,\n label,\n onChange,\n direction = 'row',\n style,\n slotProps,\n}) => {\n return (\n <>\n <Checkbox\n id={`check_${id}`}\n className={className}\n checked={checked}\n onChange={onChange}\n defaultChecked={defaultChecked}\n disabled={disabled}\n label={label}\n direction={direction}\n style={{\n '--siam-checkbox-size': '19px',\n ...style,\n }}\n slotProps={{\n ...slotProps,\n root: {\n ...slotProps?.root,\n style: {\n flexDirection: direction,\n ...slotProps?.root?.style,\n },\n },\n label: {\n ...slotProps?.label,\n style: { fontSize: '12px', ...slotProps?.label?.style },\n },\n }}\n />\n {children}\n </>\n );\n};\n\nexport default CustomInputCheckbox;\n"],"names":[],"mappings":";;AAEO,MAAM,sBAAsB,CAAC;AAAA,EAClC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AACF,MAAM;AACJ,SACE,qBAAA,UAAA,EACE,UAAA;AAAA,IAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,IAAI,SAAS,EAAE;AAAA,QACf;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO;AAAA,UACL,wBAAwB;AAAA,UACxB,GAAG;AAAA,QAAA;AAAA,QAEL,WAAW;AAAA,UACT,GAAG;AAAA,UACH,MAAM;AAAA,YACJ,GAAG,WAAW;AAAA,YACd,OAAO;AAAA,cACL,eAAe;AAAA,cACf,GAAG,WAAW,MAAM;AAAA,YAAA;AAAA,UACtB;AAAA,UAEF,OAAO;AAAA,YACL,GAAG,WAAW;AAAA,YACd,OAAO,EAAE,UAAU,QAAQ,GAAG,WAAW,OAAO,MAAA;AAAA,UAAM;AAAA,QACxD;AAAA,MACF;AAAA,IAAA;AAAA,IAED;AAAA,EAAA,GACH;AAEJ;"}
@@ -1,6 +1,6 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { useState, useEffect } from "react";
3
- import Input from "../node_modules/@neolution-ch/reactstrap/esm/Input.js";
3
+ import { Input } from "siam-ui";
4
4
  import { fieldToCurrency } from "siam-utils";
5
5
  const CustomInputCurrency = (props) => {
6
6
  const {
@@ -1 +1 @@
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,CAAC,MAAM;AAChC,QAAI,kBAAkB,IAAI;AACxB,YAAM,QAAQ,cAAc,QAAQ,MAAM,EAAE;AAC5C,YAAM,SAAS,MAAM,QAAQ,OAAO,EAAE;AACtC,uBAAiB,MAAM;AAAA,IACzB;AACA,YAAQ,CAAC;AAAA,EACX;AAEA,QAAM,oBAAoB,CAAC,UAAU;AACnC,UAAM,EAAE,WAAW;AACnB,UAAM,QAAQ,OAAO,MAAM,QAAQ,MAAM,EAAE;AAC3C,UAAM,QAAQ;AACd,QAAI,MAAM,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 'siam-ui';\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,CAAC,MAAM;AAChC,QAAI,kBAAkB,IAAI;AACxB,YAAM,QAAQ,cAAc,QAAQ,MAAM,EAAE;AAC5C,YAAM,SAAS,MAAM,QAAQ,OAAO,EAAE;AACtC,uBAAiB,MAAM;AAAA,IACzB;AACA,YAAQ,CAAC;AAAA,EACX;AAEA,QAAM,oBAAoB,CAAC,UAAU;AACnC,UAAM,EAAE,WAAW;AACnB,UAAM,QAAQ,OAAO,MAAM,QAAQ,MAAM,EAAE;AAC3C,UAAM,QAAQ;AACd,QAAI,MAAM,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,10 +1,9 @@
1
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";
2
+ import { useState, useRef } from "react";
3
+ import { useTheme } from "styled-components";
4
+ import { Label, Input } from "siam-ui";
6
5
  import { MENSAJE } from "./constant.js";
7
- import "./index.css";
6
+ const ClipIcon = ({ color }) => /* @__PURE__ */ jsx("svg", { width: "15", height: "15", viewBox: "0 0 24 24", fill: "none", stroke: color, strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48" }) });
8
7
  const CustomInputFile = ({
9
8
  accept,
10
9
  className = "",
@@ -13,30 +12,40 @@ const CustomInputFile = ({
13
12
  name,
14
13
  onChange
15
14
  }) => {
16
- const [fileName, setFileName] = useState(label || LABEL_FILE);
15
+ const theme = useTheme();
16
+ const iconColor = theme?.colors?.primary?.base ?? "#016E6C";
17
17
  const { LABEL_FILE } = MENSAJE;
18
+ const [fileName, setFileName] = useState("");
19
+ const inputRef = useRef(null);
20
+ const openPicker = () => inputRef.current?.click();
18
21
  const handleFileChange = (event) => {
19
22
  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
- }
23
+ setFileName(files.length > 0 ? files[0].name : "");
24
+ if (onChange) onChange(event);
28
25
  };
29
- return /* @__PURE__ */ jsxs(FormGroup, { className: `custom-file ${className}`, children: [
30
- /* @__PURE__ */ jsx(Label, { for: id, className: "custom-file-label", children: fileName }),
26
+ return /* @__PURE__ */ jsxs("div", { className, children: [
27
+ label && /* @__PURE__ */ jsx(Label, { htmlFor: id, style: { display: "block", marginBottom: 4 }, children: label }),
31
28
  /* @__PURE__ */ jsx(
32
29
  Input,
33
30
  {
31
+ readOnly: true,
32
+ value: fileName,
33
+ placeholder: LABEL_FILE,
34
+ onClick: openPicker,
35
+ style: { cursor: "pointer" },
36
+ iconRight: /* @__PURE__ */ jsx("span", { onClick: openPicker, style: { display: "flex", alignItems: "center", cursor: "pointer" }, children: /* @__PURE__ */ jsx(ClipIcon, { color: iconColor }) })
37
+ }
38
+ ),
39
+ /* @__PURE__ */ jsx(
40
+ "input",
41
+ {
42
+ ref: inputRef,
43
+ type: "file",
34
44
  id,
35
45
  name,
36
46
  accept,
37
- type: "file",
38
- onChange: handleFileChange,
39
- className: "custom-file-input"
47
+ style: { display: "none" },
48
+ onChange: handleFileChange
40
49
  }
41
50
  )
42
51
  ] });
@@ -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 '@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
+ {"version":3,"file":"CustomInputFile.js","sources":["../../src/custom-input/CustomInputFile.jsx"],"sourcesContent":["import { useRef, useState } from 'react';\nimport { useTheme } from 'styled-components';\nimport { Input, Label } from 'siam-ui';\nimport { MENSAJE } from './constant';\n\nconst ClipIcon = ({ color }) => (\n <svg width=\"15\" height=\"15\" viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <path d=\"m21.44 11.05-9.19 9.19a6 6 0 0 1-8.49-8.49l8.57-8.57A4 4 0 1 1 18 8.84l-8.59 8.57a2 2 0 0 1-2.83-2.83l8.49-8.48\"/>\n </svg>\n);\n\nexport const CustomInputFile = ({\n accept,\n className = '',\n id,\n label,\n name,\n onChange,\n}) => {\n const theme = useTheme();\n const iconColor = theme?.colors?.primary?.base ?? '#016E6C';\n const { LABEL_FILE } = MENSAJE;\n const [fileName, setFileName] = useState('');\n const inputRef = useRef(null);\n\n const openPicker = () => inputRef.current?.click();\n\n const handleFileChange = (event) => {\n const files = event.target.files;\n setFileName(files.length > 0 ? files[0].name : '');\n if (onChange) onChange(event);\n };\n\n return (\n <div className={className}>\n {label && <Label htmlFor={id} style={{ display: 'block', marginBottom: 4 }}>{label}</Label>}\n <Input\n readOnly\n value={fileName}\n placeholder={LABEL_FILE}\n onClick={openPicker}\n style={{ cursor: 'pointer' }}\n iconRight={\n <span onClick={openPicker} style={{ display: 'flex', alignItems: 'center', cursor: 'pointer' }}>\n <ClipIcon color={iconColor} />\n </span>\n }\n />\n <input\n ref={inputRef}\n type=\"file\"\n id={id}\n name={name}\n accept={accept}\n style={{ display: 'none' }}\n onChange={handleFileChange}\n />\n </div>\n );\n};\n\nexport default CustomInputFile;\n"],"names":[],"mappings":";;;;;AAKA,MAAM,WAAW,CAAC,EAAE,MAAA,MAClB,oBAAC,OAAA,EAAI,OAAM,MAAK,QAAO,MAAK,SAAQ,aAAY,MAAK,QAAO,QAAQ,OAAO,aAAY,KAAI,eAAc,SAAQ,gBAAe,SAC9H,UAAA,oBAAC,QAAA,EAAK,GAAE,kHAAA,CAAiH,EAAA,CAC3H;AAGK,MAAM,kBAAkB,CAAC;AAAA,EAC9B;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,MAAM;AACJ,QAAM,QAAQ,SAAA;AACd,QAAM,YAAY,OAAO,QAAQ,SAAS,QAAQ;AAClD,QAAM,EAAE,eAAe;AACvB,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,EAAE;AAC3C,QAAM,WAAW,OAAO,IAAI;AAE5B,QAAM,aAAa,MAAM,SAAS,SAAS,MAAA;AAE3C,QAAM,mBAAmB,CAAC,UAAU;AAClC,UAAM,QAAQ,MAAM,OAAO;AAC3B,gBAAY,MAAM,SAAS,IAAI,MAAM,CAAC,EAAE,OAAO,EAAE;AACjD,QAAI,mBAAmB,KAAK;AAAA,EAC9B;AAEA,SACE,qBAAC,SAAI,WACF,UAAA;AAAA,IAAA,SAAS,oBAAC,OAAA,EAAM,SAAS,IAAI,OAAO,EAAE,SAAS,SAAS,cAAc,EAAA,GAAM,UAAA,MAAA,CAAM;AAAA,IACnF;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,UAAQ;AAAA,QACR,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,QACT,OAAO,EAAE,QAAQ,UAAA;AAAA,QACjB,WACE,oBAAC,QAAA,EAAK,SAAS,YAAY,OAAO,EAAE,SAAS,QAAQ,YAAY,UAAU,QAAQ,UAAA,GACjF,8BAAC,UAAA,EAAS,OAAO,WAAW,EAAA,CAC9B;AAAA,MAAA;AAAA,IAAA;AAAA,IAGJ;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,KAAK;AAAA,QACL,MAAK;AAAA,QACL;AAAA,QACA;AAAA,QACA;AAAA,QACA,OAAO,EAAE,SAAS,OAAA;AAAA,QAClB,UAAU;AAAA,MAAA;AAAA,IAAA;AAAA,EACZ,GACF;AAEJ;"}
@@ -1,64 +1,48 @@
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";
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { Radio } from "siam-ui";
6
3
  const CustomInputRadio = ({
7
4
  className,
8
5
  customClassName,
9
6
  checked,
10
7
  disabled,
11
8
  id,
12
- inline,
13
9
  label,
14
10
  name,
15
11
  onChange,
16
- direction = "row"
12
+ direction = "row",
13
+ style,
14
+ slotProps
17
15
  }) => {
18
16
  return /* @__PURE__ */ jsx(
19
- FormGroup,
17
+ Radio,
20
18
  {
21
- inline,
22
- className: `custom-radio ${customClassName || ""}`,
23
- children: /* @__PURE__ */ jsxs(
24
- "div",
25
- {
19
+ id,
20
+ name,
21
+ checked: checked ?? false,
22
+ onChange,
23
+ disabled,
24
+ className: className ?? customClassName,
25
+ label,
26
+ direction: direction === "column" ? "col" : "row",
27
+ style: {
28
+ "--siam-radio-size": "19px",
29
+ "--siam-radio-inner-size": "11px",
30
+ ...style
31
+ },
32
+ slotProps: {
33
+ ...slotProps,
34
+ root: {
35
+ ...slotProps?.root,
26
36
  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
- ]
37
+ flexDirection: direction === "column" ? "column" : "row",
38
+ ...slotProps?.root?.style
39
+ }
40
+ },
41
+ label: {
42
+ ...slotProps?.label,
43
+ style: { fontSize: "12px", ...slotProps?.label?.style }
60
44
  }
61
- )
45
+ }
62
46
  }
63
47
  );
64
48
  };
@@ -1 +1 @@
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
+ {"version":3,"file":"CustomInputRadio.js","sources":["../../src/custom-input/CustomInputRadio.jsx"],"sourcesContent":["import { Radio } from 'siam-ui';\n\nexport const CustomInputRadio = ({\n className,\n customClassName,\n checked,\n disabled,\n id,\n label,\n name,\n onChange,\n direction = 'row',\n style,\n slotProps,\n}) => {\n return (\n <Radio\n id={id}\n name={name}\n checked={checked ?? false}\n onChange={onChange}\n disabled={disabled}\n className={className ?? customClassName}\n label={label}\n direction={direction === 'column' ? 'col' : 'row'}\n style={{\n '--siam-radio-size': '19px',\n '--siam-radio-inner-size': '11px',\n ...style,\n }}\n slotProps={{\n ...slotProps,\n root: {\n ...slotProps?.root,\n style: {\n flexDirection: direction === 'column' ? 'column' : 'row',\n ...slotProps?.root?.style,\n },\n },\n label: {\n ...slotProps?.label,\n style: { fontSize: '12px', ...slotProps?.label?.style },\n },\n }}\n />\n );\n};\n\nexport default CustomInputRadio;\n"],"names":[],"mappings":";;AAEO,MAAM,mBAAmB,CAAC;AAAA,EAC/B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA;AACF,MAAM;AACJ,SACE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC;AAAA,MACA;AAAA,MACA,SAAS,WAAW;AAAA,MACpB;AAAA,MACA;AAAA,MACA,WAAW,aAAa;AAAA,MACxB;AAAA,MACA,WAAW,cAAc,WAAW,QAAQ;AAAA,MAC5C,OAAO;AAAA,QACL,qBAAqB;AAAA,QACrB,2BAA2B;AAAA,QAC3B,GAAG;AAAA,MAAA;AAAA,MAEL,WAAW;AAAA,QACT,GAAG;AAAA,QACH,MAAM;AAAA,UACJ,GAAG,WAAW;AAAA,UACd,OAAO;AAAA,YACL,eAAe,cAAc,WAAW,WAAW;AAAA,YACnD,GAAG,WAAW,MAAM;AAAA,UAAA;AAAA,QACtB;AAAA,QAEF,OAAO;AAAA,UACL,GAAG,WAAW;AAAA,UACd,OAAO,EAAE,UAAU,QAAQ,GAAG,WAAW,OAAO,MAAA;AAAA,QAAM;AAAA,MACxD;AAAA,IACF;AAAA,EAAA;AAGN;"}
@@ -1,167 +1,25 @@
1
- /* Estilos para los checkbox personalizados */
2
- .custom-checkbox input[type='checkbox'] {
3
- position: absolute;
4
- opacity: 0;
5
- z-index: -1;
6
- }
7
-
8
- .custom-checkbox input[type='checkbox'] + label {
9
- position: relative;
10
- padding-left: 2rem;
11
- cursor: pointer;
12
- line-height: 0px !important;
13
- }
14
-
15
- .custom-checkbox input[type='checkbox'] + label::before {
16
- content: '';
17
- display: inline-block;
18
- width: 1rem;
19
- height: 1rem;
20
- border: 1px solid #ccc;
21
- border-radius: 0.25rem;
22
- background-color: white;
23
- position: absolute;
24
- left: 0;
25
- top: -11px;
26
- transition: background-color 0.2s, border-color 0.2s;
27
- }
28
-
29
- .custom-checkbox input[type='checkbox']:checked + label::before {
30
- background-color: #900604;
31
- border-color: #900604;
32
- }
33
-
34
- .custom-checkbox input[type='checkbox']:checked + label::after {
35
- content: '';
36
- position: absolute;
37
- top: -10px;
38
- left: 0.3rem;
39
- width: 0.5rem;
40
- height: 0.6rem;
41
- border: solid white;
42
- border-width: 0 0.2rem 0.2rem 0;
43
- transform: rotate(45deg);
44
- }
45
-
46
- /* Estilos específicos para CheckMultiSelect */
47
- .check-multi-select
48
- .custom-checkbox
49
- input[type='checkbox']:not(:checked)
50
- + label::before {
51
- background-color: #900604; /* Fondo rojo en CheckMultiSelect para desmarcados */
52
- border-color: #900604;
53
- }
54
-
55
- .check-multi-select
56
- .custom-checkbox
57
- input[type='checkbox']:not(:checked)
58
- + label::after {
59
- content: '';
60
- position: absolute;
61
- top: -0.29rem; /* Ajusta la posición del tilde */
62
- left: 0.25rem;
63
- width: 0.5rem;
64
- height: 0.1rem;
65
- background-color: white;
66
- }
67
-
68
- /* Estilos para checkboxes deshabilitados */
69
- .custom-checkbox input[type='checkbox']:disabled + label {
70
- cursor: not-allowed; /* Cambia el cursor */
71
- color: #6c757d;
72
- line-height: 0px !important;
73
- }
74
-
75
- .custom-checkbox input[type='checkbox']:disabled + label::before {
76
- background-color: #e9ecef;
77
- border-color: #ced4da;
78
- }
79
-
80
- .custom-checkbox input[type='checkbox']:disabled:checked + label::before {
81
- background-color: #adb5bd;
82
- border-color: #adb5bd;
83
- }
84
-
85
- /* Estilos para los radio buttons personalizados */
86
- .custom-radio input[type='radio'] {
87
- position: absolute;
88
- opacity: 0;
89
- }
90
-
91
- .custom-radio label {
92
- display: inline-flex;
93
- align-items: center;
94
- justify-items: center;
95
- cursor: pointer;
96
- }
97
-
98
- .custom-radio label::before {
99
- position: absolute;
100
- content: '';
101
- display: inline-block;
102
- width: 20px;
103
- height: 20px;
104
- border-radius: 50%;
105
- border: 2px solid #ced4da;
106
- background-color: white;
107
- transition: background-color 0.2s, border-color 0.2s;
108
- }
109
-
110
- .custom-radio input[type='radio']:checked + label::before {
111
- position: absolute;
112
- background-color: #900604;
113
- border-color: #900604;
114
- }
115
-
116
- .custom-radio input[type='radio']:checked + label::after {
117
- content: '';
118
- position: absolute;
119
- width: 0.5rem;
120
- height: 0.45rem;
121
- background-color: white !important;
122
- transition: translateY(-50%);
123
- border-radius: 50%;
124
- display: inline-block;
125
- }
126
-
127
- /* Estilos específicos para radio buttons deshabilitados */
128
- .custom-radio input[type='radio']:disabled + label {
129
- cursor: not-allowed; /* Cambia el cursor */
130
- color: #6c757d; /* Color gris */
131
- }
132
-
133
- .custom-radio input[type='radio']:disabled + label::before {
134
- background-color: #e9ecef; /* Fondo gris claro */
135
- border-color: #ced4da; /* Borde gris claro */
136
- }
137
-
138
- .custom-radio input[type='radio']:disabled:checked + label::before {
139
- background-color: #adb5bd; /* Fondo gris más oscuro para el estado checked */
140
- border-color: #adb5bd; /* Borde gris más oscuro */
141
- }
142
-
143
- /* Estilos para el custom file */
144
- .custom-file {
145
- height: calc(2.5rem + 2px);
146
- }
147
-
148
- .custom-file-label:focus,
149
- .custom-file-input:focus {
150
- border-color: #900604;
151
- }
152
-
153
- .custom-file-label::after {
154
- height: calc(2.5rem + 2px - 2px);
155
- padding: 0.75rem 0.75rem 0.5rem 0.75rem;
156
- background: #900604;
157
- color: white; /* Ajustado para contraste */
158
- border-color: #900604;
159
- }
160
-
161
- .custom-file-input:focus ~ .custom-file-label {
162
- border-color: rgba(144, 6, 4, 0.6);
163
- }
164
-
165
- .custom-file-input {
166
- box-shadow: initial !important;
167
- }
1
+ /* Estilos para el custom file */
2
+ .custom-file {
3
+ height: calc(2.5rem + 2px);
4
+ }
5
+
6
+ .custom-file-label:focus,
7
+ .custom-file-input:focus {
8
+ border-color: #900604;
9
+ }
10
+
11
+ .custom-file-label::after {
12
+ height: calc(2.5rem + 2px - 2px);
13
+ padding: 0.75rem 0.75rem 0.5rem 0.75rem;
14
+ background: #900604;
15
+ color: white;
16
+ border-color: #900604;
17
+ }
18
+
19
+ .custom-file-input:focus ~ .custom-file-label {
20
+ border-color: rgba(144, 6, 4, 0.6);
21
+ }
22
+
23
+ .custom-file-input {
24
+ box-shadow: initial !important;
25
+ }