siam-ui-utils 3.1.4 → 3.2.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.
- package/dist/CustomBootstrap.js +9 -2
- package/dist/CustomBootstrap.js.map +1 -1
- package/dist/copy-link/index.js +3 -3
- package/dist/copy-link/index.js.map +1 -1
- package/dist/custom-input/CustomInputCheckbox.js +30 -12
- package/dist/custom-input/CustomInputCheckbox.js.map +1 -1
- package/dist/custom-input/CustomInputCurrency.js +1 -1
- package/dist/custom-input/CustomInputCurrency.js.map +1 -1
- package/dist/custom-input/CustomInputFile.js +28 -19
- package/dist/custom-input/CustomInputFile.js.map +1 -1
- package/dist/custom-input/CustomInputRadio.js +31 -47
- package/dist/custom-input/CustomInputRadio.js.map +1 -1
- package/dist/custom-input/index.css +25 -167
- package/dist/drag-and-dropzone/config.js +52 -51
- package/dist/drag-and-dropzone/config.js.map +1 -1
- package/dist/drag-and-dropzone/index.css +271 -276
- package/dist/drag-and-dropzone/index.js +30 -16
- package/dist/drag-and-dropzone/index.js.map +1 -1
- package/dist/dropzone-uploader/styled/index.css +165 -348
- package/dist/dropzone-uploader/styled/index.js +71 -60
- package/dist/dropzone-uploader/styled/index.js.map +1 -1
- package/dist/react-notifications/NotificationManager.js +14 -0
- package/dist/react-notifications/NotificationManager.js.map +1 -0
- package/dist/react-notifications/index.js +2 -1
- package/dist/react-notifications/index.js.map +1 -1
- package/dist/select/custom-select/index.js +53 -1
- package/dist/select/custom-select/index.js.map +1 -1
- package/dist/select/multi-select/index.js +6 -3
- package/dist/select/multi-select/index.js.map +1 -1
- package/dist/select/multi-select/styled-component.js +1 -1
- package/dist/select/multi-select/styled-component.js.map +1 -1
- package/dist/tomar-foto/index.js +1 -1
- package/dist/tomar-foto/index.js.map +1 -1
- package/package.json +5 -4
- package/dist/_virtual/_commonjsHelpers.js +0 -7
- package/dist/_virtual/_commonjsHelpers.js.map +0 -1
- package/dist/_virtual/index.js +0 -8
- package/dist/_virtual/index.js.map +0 -1
- package/dist/_virtual/index2.js +0 -5
- package/dist/_virtual/index2.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js +0 -77
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Badge.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js +0 -111
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Button.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js +0 -106
- package/dist/node_modules/@neolution-ch/reactstrap/esm/CloseButton.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js +0 -125
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Col.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js +0 -75
- package/dist/node_modules/@neolution-ch/reactstrap/esm/FormGroup.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js +0 -225
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Input.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js +0 -122
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Label.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js +0 -83
- package/dist/node_modules/@neolution-ch/reactstrap/esm/Row.js.map +0 -1
- package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js +0 -68
- package/dist/node_modules/@neolution-ch/reactstrap/esm/utils.js.map +0 -1
- package/dist/node_modules/classnames/index.js +0 -62
- package/dist/node_modules/classnames/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/dropzone-uploader/styled/index.jsx"],"sourcesContent":["import { getDroppedOrSelectedFiles } from 'html5-file-selector';\
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/dropzone-uploader/styled/index.jsx"],"sourcesContent":["import { getDroppedOrSelectedFiles } from 'html5-file-selector';\nimport { useRef, useState } from 'react';\nimport { useTheme } from 'styled-components';\nimport { Button } from 'siam-ui';\nimport Dropzone from '../../dropzone';\nimport { IconButtonSvg, pdfImage } from '../../iconos';\nimport './index.css';\n\nexport const DropzoneUploaderStyled = ({\n accept = 'image/*, application/pdf',\n classNames = '',\n onChangeFiles,\n totalFiles,\n label = 'Cargar Dni',\n maxFiles = 2,\n maxSize = 2,\n onMaxFileSizeError = () => {\n alert('El archivo supera el tamaño máximo');\n },\n}) => {\n const theme = useTheme();\n const primaryColor = theme?.colors?.primary?.base ?? '#016E6C';\n const borderColor = theme?.colors?.neutral?.borderLight ?? '#D6D6D6';\n const surfaceHover = theme?.colors?.primary?.surfaceHover ?? '#E6F1F1';\n\n const [files, setFiles] = useState([]);\n\n const handleChangeStatus = ({ file }, status) => {\n if (status === 'done') {\n const filesTemp = [...files, file];\n setFiles(filesTemp);\n onChangeFiles(filesTemp);\n } else if (status === 'removed') {\n const filesTemp = files.filter((f) => f !== file);\n setFiles(filesTemp);\n onChangeFiles(filesTemp);\n }\n };\n\n const getFilesFromEvent = (e) => {\n return new Promise((resolve) => {\n getDroppedOrSelectedFiles(e).then((chosenFiles) => {\n resolve(chosenFiles.map((f) => f.fileObject));\n });\n });\n };\n\n const CustomPreview = ({ fileWithMeta }) => {\n const { meta, remove } = fileWithMeta;\n if (meta.size / (1024 * 1024) > maxSize) {\n onMaxFileSizeError();\n remove();\n }\n return (\n <div\n className=\"dropzone-upload-previewContainer\"\n style={{ width: '100%', display: 'flex', alignItems: 'center' }}\n >\n {meta.type === 'application/pdf' ? (\n <>\n <IconButtonSvg\n className=\"form-control flex\"\n svg={pdfImage}\n svgOver={pdfImage}\n height=\"1.6rem\"\n width=\"1.6rem\"\n title={meta.name}\n />\n <p style={{ paddingRight: '1rem' }}>\n {meta.name.length > 17 ? meta.name.substring(0, 17) + '...' : meta.name}\n </p>\n </>\n ) : (\n <>\n <img\n className=\"dropzone-upload-previewImage mt-1\"\n src={meta.previewUrl}\n alt={meta.name}\n style={{ width: '110px', height: '110px', objectFit: 'cover', marginRight: '0.5rem' }}\n />\n <div className=\"dropzone-upload-file-name-container\">\n <p className=\"dropzone-upload-file-name\" title={meta.name}>\n {meta.name}\n </p>\n </div>\n </>\n )}\n <Button\n $variant=\"transparent\"\n $size=\"small\"\n onClick={remove}\n style={{ color: theme?.colors?.error?.base ?? '#FE4727', padding: '0 4px' }}\n >\n <TrashIcon color={theme?.colors?.error?.base ?? '#FE4727'} />\n </Button>\n </div>\n );\n };\n\n const fileInputRef = useRef(null);\n\n const InputComponent = ({ accept, onFiles, getFilesFromEvent }) => {\n const text = totalFiles > 0 ? `${maxFiles - totalFiles} archivos más` : label;\n return (\n <>\n <Button\n $variant=\"outline\"\n style={{ width: '100%' }}\n onClick={() => fileInputRef.current?.click()}\n >\n {text}\n </Button>\n <input\n ref={fileInputRef}\n style={{ display: 'none' }}\n type=\"file\"\n accept={accept}\n multiple\n onChange={(e) => {\n getFilesFromEvent(e).then((chosenFiles) => onFiles(chosenFiles));\n }}\n />\n </>\n );\n };\n\n return (\n <div\n className={classNames}\n style={{\n '--dropzone-primary': primaryColor,\n '--dropzone-border': borderColor,\n '--dropzone-active-bg': surfaceHover,\n }}\n >\n <Dropzone\n disableUpload={false}\n maxFiles={totalFiles < maxFiles ? maxFiles : 0}\n maxSize={maxSize}\n InputComponent={InputComponent}\n PreviewComponent={CustomPreview}\n classNames={{ dropzone: 'dropzone-upload-frame' }}\n onChangeStatus={handleChangeStatus}\n getFilesFromEvent={getFilesFromEvent}\n accept={accept}\n />\n </div>\n );\n};\n\nconst TrashIcon = ({ color }) => (\n <svg width=\"14\" height=\"14\" viewBox=\"0 0 24 24\" fill=\"none\" stroke={color} strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\">\n <polyline points=\"3 6 5 6 21 6\" />\n <path d=\"M19 6l-1 14a2 2 0 0 1-2 2H8a2 2 0 0 1-2-2L5 6\" />\n <path d=\"M10 11v6M14 11v6\" />\n <path d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Ae,SAC9H,UAAA;AAAA,EAAA,oBAAC,YAAA,EAAS,QAAO,eAAA,CAAe;AAAA,EAChC,oBAAC,QAAA,EAAK,GAAE,gDAAA,CAAgD;AAAA,EACxD,oBAAC,QAAA,EAAK,GAAE,mBAAA,CAAmB;AAAA,EAC3B,oBAAC,QAAA,EAAK,GAAE,yCAAA,CAAyC;AAAA,GACnD;"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { NotificationManager as NotificationManager$1 } from "siam-ui";
|
|
2
|
+
const NotificationManager = {
|
|
3
|
+
...NotificationManager$1,
|
|
4
|
+
primary(options) {
|
|
5
|
+
NotificationManager$1.info(options);
|
|
6
|
+
},
|
|
7
|
+
secondary(options) {
|
|
8
|
+
NotificationManager$1.info(options);
|
|
9
|
+
}
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
NotificationManager
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=NotificationManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NotificationManager.js","sources":["../../src/react-notifications/NotificationManager.js"],"sourcesContent":["import { NotificationManager as SiamNotificationManager } from 'siam-ui';\n\n// Extiende el NotificationManager de siam-ui agregando los tipos 'primary' y\n// 'secondary' que usa la app legacy, mapeándolos a variantes existentes.\nexport const NotificationManager = {\n ...SiamNotificationManager,\n primary(options) {\n SiamNotificationManager.info(options);\n },\n secondary(options) {\n SiamNotificationManager.info(options);\n },\n};\n\nexport default NotificationManager;\n"],"names":["SiamNotificationManager"],"mappings":";AAIY,MAAC,sBAAsB;AAAA,EACjC,GAAGA;AAAAA,EACH,QAAQ,SAAS;AACfA,0BAAwB,KAAK,OAAO;AAAA,EACtC;AAAA,EACA,UAAU,SAAS;AACjBA,0BAAwB,KAAK,OAAO;AAAA,EACtC;AACF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;"}
|
|
@@ -1,6 +1,58 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { Select } from "siam-ui";
|
|
3
|
-
|
|
3
|
+
import { useRef, useState, useCallback } from "react";
|
|
4
|
+
import { flushSync } from "react-dom";
|
|
5
|
+
const DROPDOWN_MAX_HEIGHT = 160;
|
|
6
|
+
const MARGIN = 8;
|
|
7
|
+
const CustomSelect = ({ slotProps, style, ...props }) => {
|
|
8
|
+
const wrapperRef = useRef(null);
|
|
9
|
+
const [flipStyle, setFlipStyle] = useState({});
|
|
10
|
+
const closingRef = useRef(false);
|
|
11
|
+
const handlePointerDown = useCallback((e) => {
|
|
12
|
+
if (!wrapperRef.current) return;
|
|
13
|
+
if (!wrapperRef.current.contains(e.target)) return;
|
|
14
|
+
const rect = wrapperRef.current.getBoundingClientRect();
|
|
15
|
+
flushSync(() => {
|
|
16
|
+
const spaceBelow = window.innerHeight - rect.bottom;
|
|
17
|
+
setFlipStyle(
|
|
18
|
+
spaceBelow < DROPDOWN_MAX_HEIGHT + MARGIN ? { top: "unset", bottom: `${window.innerHeight - rect.top + MARGIN}px` } : {}
|
|
19
|
+
);
|
|
20
|
+
});
|
|
21
|
+
if (wrapperRef.current.classList.contains("is-open")) {
|
|
22
|
+
closingRef.current = true;
|
|
23
|
+
document.dispatchEvent(new MouseEvent("mousedown", { bubbles: false, cancelable: false }));
|
|
24
|
+
}
|
|
25
|
+
}, []);
|
|
26
|
+
const handleClickCapture = useCallback((e) => {
|
|
27
|
+
if (closingRef.current) {
|
|
28
|
+
closingRef.current = false;
|
|
29
|
+
if (wrapperRef.current?.contains(e.target)) {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
e.nativeEvent.stopImmediatePropagation();
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}, []);
|
|
35
|
+
return /* @__PURE__ */ jsx(
|
|
36
|
+
Select,
|
|
37
|
+
{
|
|
38
|
+
ref: wrapperRef,
|
|
39
|
+
searchable: props.searchable !== false,
|
|
40
|
+
style: { fontSize: "12px", ...style },
|
|
41
|
+
onPointerDown: handlePointerDown,
|
|
42
|
+
onClickCapture: handleClickCapture,
|
|
43
|
+
slotProps: {
|
|
44
|
+
...slotProps,
|
|
45
|
+
dropdown: {
|
|
46
|
+
...slotProps?.dropdown,
|
|
47
|
+
// zIndex inline asegura precedencia sobre el CSS de styled-components en cualquier
|
|
48
|
+
// stacking context donde se use el componente (ej: modales, overlays).
|
|
49
|
+
style: { zIndex: 9999, ...flipStyle, ...slotProps?.dropdown?.style }
|
|
50
|
+
}
|
|
51
|
+
},
|
|
52
|
+
...props
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
4
56
|
export {
|
|
5
57
|
CustomSelect
|
|
6
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/select/custom-select/index.tsx"],"sourcesContent":["import { Select, type SelectProps } from 'siam-ui';\nimport React from 'react';\n\nexport const CustomSelect: React.FC<SelectProps> = (props) => (\n <
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/select/custom-select/index.tsx"],"sourcesContent":["import { Select, type SelectProps } from 'siam-ui';\nimport React, { useRef, useState, useCallback } from 'react';\nimport { flushSync } from 'react-dom';\n\n// Matches SELECT_SIZE.dropdownMaxHeight in siam-ui\nconst DROPDOWN_MAX_HEIGHT = 160;\nconst MARGIN = 8;\n\nexport const CustomSelect: React.FC<SelectProps> = ({ slotProps, style, ...props }) => {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const [flipStyle, setFlipStyle] = useState<React.CSSProperties>({});\n // Tracks when we just triggered a close, to block the subsequent click from re-opening.\n const closingRef = useRef(false);\n\n const handlePointerDown = useCallback((e: React.PointerEvent) => {\n if (!wrapperRef.current) return;\n // Los clicks en el portal del dropdown propagan por el árbol de fibras de React\n // hasta este handler. Si el target no está en el DOM del wrapper, es una opción\n // del portal y no debe tratarse como click sobre el trigger.\n if (!wrapperRef.current.contains(e.target as Node)) return;\n\n const rect = wrapperRef.current.getBoundingClientRect();\n\n // flushSync garantiza que el re-render ocurra ANTES de que el click\n // abra el dropdown, evitando race conditions en React 18.\n flushSync(() => {\n const spaceBelow = window.innerHeight - rect.bottom;\n setFlipStyle(\n spaceBelow < DROPDOWN_MAX_HEIGHT + MARGIN\n ? { top: 'unset' as React.CSSProperties['top'], bottom: `${window.innerHeight - rect.top + MARGIN}px` }\n : {}\n );\n });\n\n if (wrapperRef.current.classList.contains('is-open')) {\n closingRef.current = true;\n document.dispatchEvent(new MouseEvent('mousedown', { bubbles: false, cancelable: false }));\n }\n }, []);\n\n // Durante la fase de captura, si venimos de un cierre, bloqueamos el click\n // antes de que llegue a los handlers internos de siam-ui (onClick del trigger/input)\n // que de otro modo reabrirían el dropdown.\n // Solo bloqueamos clicks cuyo target es el propio wrapper (no opciones del portal).\n const handleClickCapture = useCallback((e: React.MouseEvent) => {\n if (closingRef.current) {\n closingRef.current = false;\n if (wrapperRef.current?.contains(e.target as Node)) {\n e.stopPropagation();\n e.nativeEvent.stopImmediatePropagation();\n }\n }\n }, []);\n\n return (\n <Select\n ref={wrapperRef}\n searchable={props.searchable !== false}\n style={{ fontSize: '12px', ...style }}\n onPointerDown={handlePointerDown}\n onClickCapture={handleClickCapture}\n slotProps={{\n ...slotProps,\n dropdown: {\n ...slotProps?.dropdown,\n // zIndex inline asegura precedencia sobre el CSS de styled-components en cualquier\n // stacking context donde se use el componente (ej: modales, overlays).\n style: { zIndex: 9999, ...flipStyle, ...slotProps?.dropdown?.style },\n },\n }}\n {...props}\n />\n );\n};\n\nexport default CustomSelect;\n"],"names":[],"mappings":";;;;AAKA,MAAM,sBAAsB;AAC5B,MAAM,SAAS;AAER,MAAM,eAAsC,CAAC,EAAE,WAAW,OAAO,GAAG,YAAY;AACrF,QAAM,aAAa,OAAuB,IAAI;AAC9C,QAAM,CAAC,WAAW,YAAY,IAAI,SA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;"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState, useRef, useEffect, useCallback } from "react";
|
|
3
3
|
import Select, { components } from "react-select";
|
|
4
|
-
import Row from "
|
|
5
|
-
import Col from "../../node_modules/@neolution-ch/reactstrap/esm/Col.js";
|
|
4
|
+
import { Row, Col } from "siam-ui";
|
|
6
5
|
import { CustomInputCheckbox } from "../../custom-input/CustomInputCheckbox.js";
|
|
7
6
|
import BadgeLabelMultiSelect from "./badge-label-multi-select.js";
|
|
8
7
|
import { BadgeWrapper, ClickableBadge } from "./styled-component.js";
|
|
@@ -153,7 +152,11 @@ const CustomMultiSelect = ({
|
|
|
153
152
|
isSearchable: false,
|
|
154
153
|
onSelectAll: handleSelectAll,
|
|
155
154
|
onOptionClick: handleOptionClick,
|
|
156
|
-
isOptionSelected
|
|
155
|
+
isOptionSelected,
|
|
156
|
+
menuPortalTarget: document.body,
|
|
157
|
+
menuPosition: "fixed",
|
|
158
|
+
menuPlacement: "auto",
|
|
159
|
+
styles: { menuPortal: (base) => ({ ...base, zIndex: 9999 }) }
|
|
157
160
|
}
|
|
158
161
|
) }),
|
|
159
162
|
/* @__PURE__ */ jsx(Col, { xs: 6, children: selected.length > 0 && /* @__PURE__ */ jsx(BadgeWrapper, { children: allSelected ? /* @__PURE__ */ jsx(ClickableBadge, { color: "info", pill: true, children: "Todos" }) : /* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/select/multi-select/index.jsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\r\nimport Select, { components } from 'react-select';\r\nimport { Col, Row } from '
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/select/multi-select/index.jsx"],"sourcesContent":["import { useCallback, useEffect, useRef, useState } from 'react';\r\nimport Select, { components } from 'react-select';\r\nimport { Col, Row } from 'siam-ui';\r\nimport { CustomInputCheckbox } from '../../custom-input/CustomInputCheckbox';\r\nimport BadgeLabelMultiSelect from './badge-label-multi-select';\r\nimport { BadgeWrapper, ClickableBadge } from './styled-component';\r\nimport './index.scss';\r\n\r\nconst SELECT_ALL_VALUE = '__select_all__';\r\nconst SELECT_ALL_OPTION = {\r\n value: SELECT_ALL_VALUE,\r\n label: 'SELECCIONAR TODOS',\r\n};\r\n\r\nfunction CheckboxOption({\r\n data,\r\n isSelected,\r\n isFocused,\r\n innerRef,\r\n selectProps,\r\n}) {\r\n const isSelectAll = data.value === SELECT_ALL_VALUE;\r\n\r\n const handleMouseDown = (e) => {\r\n e.preventDefault();\r\n e.stopPropagation();\r\n if (isSelectAll) {\r\n selectProps.onSelectAll?.();\r\n } else {\r\n selectProps.onOptionClick?.(data);\r\n }\r\n };\r\n\r\n return (\r\n <div\r\n ref={innerRef}\r\n onMouseDown={handleMouseDown}\r\n onTouchEnd={handleMouseDown}\r\n className=\"multiselect-checkbox-option\"\r\n style={{\r\n backgroundColor: isFocused ? '#f8e1e1' : 'white',\r\n borderBottom: isSelectAll ? '1px solid #ccc' : 'none',\r\n padding: '6px 12px',\r\n cursor: 'pointer',\r\n }}\r\n >\r\n <CustomInputCheckbox\r\n id={`opt_${data.value}`}\r\n checked={isSelected}\r\n onChange={() => {}}\r\n label={\r\n <span style={{ fontWeight: isSelectAll ? 'bold' : 'normal' }}>\r\n {data.label}\r\n </span>\r\n }\r\n />\r\n </div>\r\n );\r\n}\r\n\r\nfunction CustomValueContainer({ children, getValue, ...props }) {\r\n const selected = getValue();\r\n const totalOptions = props.selectProps.options.length - 1;\r\n const count = selected.length;\r\n const isAll = count > 0 && count === totalOptions;\r\n\r\n const text = isAll\r\n ? 'Todos Seleccionados'\r\n : count > 0\r\n ? selected.map((s) => s.label).join(', ')\r\n : null;\r\n\r\n return (\r\n <components.ValueContainer {...props} getValue={getValue}>\r\n {text ? (\r\n <span style={{ color: '#333' }}>{text}</span>\r\n ) : (\r\n <span\r\n style={{\r\n color: count ? 'transparent' : '#999',\r\n position: 'absolute',\r\n }}\r\n >\r\n {props.selectProps.placeholder}\r\n </span>\r\n )}\r\n {children[children.length - 1]}\r\n </components.ValueContainer>\r\n );\r\n}\r\n\r\nconst CUSTOM_COMPONENTS = {\r\n Option: CheckboxOption,\r\n ValueContainer: CustomValueContainer,\r\n};\r\n\r\nexport const CustomMultiSelect = ({\r\n lista = [],\r\n onListaUpdate = () => {},\r\n value = [],\r\n styles = {},\r\n}) => {\r\n const [selected, setSelected] = useState(value);\r\n const isInternalChange = useRef(false);\r\n\r\n useEffect(() => {\r\n if (isInternalChange.current) {\r\n isInternalChange.current = false;\r\n return;\r\n }\r\n setSelected(value);\r\n }, [JSON.stringify(value)]); // eslint-disable-line react-hooks/exhaustive-deps\r\n\r\n const update = useCallback(\r\n (newSelected) => {\r\n isInternalChange.current = true;\r\n setSelected(newSelected);\r\n onListaUpdate(newSelected);\r\n },\r\n [onListaUpdate]\r\n );\r\n\r\n const handleOptionClick = useCallback(\r\n (data) => {\r\n setSelected((prev) => {\r\n const isAlreadySelected = prev.some((s) => s.value === data.value);\r\n const next = isAlreadySelected\r\n ? prev.filter((s) => s.value !== data.value)\r\n : [...prev, data];\r\n isInternalChange.current = true;\r\n onListaUpdate(next);\r\n return next;\r\n });\r\n },\r\n [onListaUpdate]\r\n );\r\n\r\n const handleSelectAll = useCallback(() => {\r\n setSelected((prev) => {\r\n const next = prev.length === lista.length ? [] : [...lista];\r\n isInternalChange.current = true;\r\n onListaUpdate(next);\r\n return next;\r\n });\r\n }, [lista, onListaUpdate]);\r\n\r\n const handleRemoveBadge = useCallback(\r\n (valueToRemove) => {\r\n update(selected.filter((item) => item.value !== valueToRemove));\r\n },\r\n [selected, update]\r\n );\r\n\r\n const allSelected = lista.length > 0 && selected.length === lista.length;\r\n const optionsWithSelectAll = [SELECT_ALL_OPTION, ...lista];\r\n\r\n const isOptionSelected = useCallback(\r\n (option) =>\r\n option.value === SELECT_ALL_VALUE\r\n ? allSelected\r\n : selected.some((s) => s.value === option.value),\r\n [allSelected, selected]\r\n );\r\n\r\n return (\r\n <Row className=\"align-items-center\">\r\n <Col xs={6} style={styles}>\r\n <Select\r\n options={optionsWithSelectAll}\r\n value={selected}\r\n onChange={update}\r\n isMulti\r\n placeholder=\"Seleccione\"\r\n noOptionsMessage={() => 'Sin opciones'}\r\n className=\"custom-multiselect\"\r\n classNamePrefix=\"custom-multiselect\"\r\n components={CUSTOM_COMPONENTS}\r\n closeMenuOnSelect={false}\r\n hideSelectedOptions={false}\r\n isSearchable={false}\r\n onSelectAll={handleSelectAll}\r\n onOptionClick={handleOptionClick}\r\n isOptionSelected={isOptionSelected}\r\n menuPortalTarget={document.body}\r\n menuPosition=\"fixed\"\r\n menuPlacement=\"auto\"\r\n styles={{ menuPortal: (base) => ({ ...base, zIndex: 9999 }) }}\r\n />\r\n </Col>\r\n <Col xs={6}>\r\n {selected.length > 0 && (\r\n <BadgeWrapper>\r\n {allSelected ? (\r\n <ClickableBadge color=\"info\" pill>\r\n Todos\r\n </ClickableBadge>\r\n ) : (\r\n <BadgeLabelMultiSelect\r\n descripcionLabel={selected}\r\n onRemove={handleRemoveBadge}\r\n />\r\n )}\r\n </BadgeWrapper>\r\n )}\r\n </Col>\r\n </Row>\r\n );\r\n};\r\n\r\nexport default CustomMultiSelect;\r\n"],"names":[],"mappings":";;;;;;;;AAQA,MAAM,mBAAmB;AACzB,MAAM,oBAAoB;AAAA,EACxB,OAAO;AAAA,EACP,OAAO;AACT;AAEA,SAAS,eAAe;AAAA,EACtB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAG;AACD,QAAM,cAAc,KAAK,UAAU;AAEnC,QAAM,kBAAkB,CAAC,MAAM;AAC7B,MAAE,eAAA;AACF,MAAE,gBAAA;AACF,QAAI,aAAa;AACf,kBAAY,cAAA;AAAA,IACd,OAAO;AACL,kBAAY,gBAAgB,IAAI;AAAA,IAClC;AAAA,EACF;AAEA,SACE;AAAA,IAAC;A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AAU,MAAM;AAAA,EAAA;AAGnB,QAAM,cAAc,MAAM,SAAS,KAAK,SAAS,WAAW,MAAM;AAClE,QAAM,uBAAuB,CAAC,mBAAmB,GAAG,KAAK;AAEzD,QAAM,mBAAmB;AAAA,IACvB,CAAC,WACC,OAAO,UAAU,mBACb,cACA,SAAS,KAAK,CAAC,MAAM,EAAE,UAAU,OAAO,KAAK;AAAA,IACnD,CAAC,aAAa,QAAQ;AAAA,EAAA;AAGxB,SACE,qBAAC,KAAA,EAAI,WAAU,sBACb,UAAA;AAAA,IAAA,oBAAC,KAAA,EAAI,IAAI,GAAG,OAAO,QACjB,UAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,SAAS;AAAA,QACT,OAAO;AAAA,QACP,UAAU;AAAA,QACV,SAAO;AAAA,QACP,aAAY;AAAA,QACZ,kBAAkB,MAAM;AAAA,QACxB,WAAU;AAAA,QACV,iBAAgB;AAAA,QAChB,YAAY;AAAA,QACZ,mBAAmB;AAAA,QACnB,qBAAqB;AAAA,QACrB,cAAc;AAAA,QACd,aAAa;AAAA,QACb,eAAe;AAAA,QACf;AAAA,QACA,kBAAkB,SAAS;AAAA,QAC3B,cAAa;AAAA,QACb,eAAc;AAAA,QACd,QAAQ,EAAE,YAAY,CAAC,UAAU,EAAE,GAAG,MAAM,QAAQ,QAAK;AAAA,MAAG;AAAA,IAAA,GAEhE;AAAA,wBACC,KAAA,EAAI,IAAI,GACN,UAAA,SAAS,SAAS,KACjB,oBAAC,cAAA,EACE,UAAA,kCACE,gBAAA,EAAe,OAAM,QAAO,MAAI,MAAC,mBAElC,IAEA;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,kBAAkB;AAAA,QAClB,UAAU;AAAA,MAAA;AAAA,IAAA,GAGhB,EAAA,CAEJ;AAAA,EAAA,GACF;AAEJ;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styled-component.js","sources":["../../../src/select/multi-select/styled-component.js"],"sourcesContent":["import { Badge } from '
|
|
1
|
+
{"version":3,"file":"styled-component.js","sources":["../../../src/select/multi-select/styled-component.js"],"sourcesContent":["import { Badge } from 'siam-ui';\r\nimport styled from 'styled-components';\r\n\r\nexport const ClickableBadge = styled(Badge)`\r\n cursor: pointer;\r\n width: fit-content;\r\n white-space: nowrap;\r\n`;\r\n\r\nexport const BadgeWrapper = styled.div`\r\n display: inline-flex;\r\n flex-wrap: wrap;\r\n gap: 10px;\r\n padding: 0.5rem;\r\n border-radius: 0.5rem;\r\n background-color: #f1f1f1;\r\n border: 1px solid #ccc;\r\n max-width: 100%;\r\n overflow-x: auto;\r\n`;\r\n"],"names":[],"mappings":";;AAGY,MAAC,iBAAiB,OAAO,KAAK;AAAA;AAAA;AAAA;AAAA;AAM9B,MAAC,eAAe,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;"}
|
package/dist/tomar-foto/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
|
-
import Row from "
|
|
3
|
+
import { Row } from "siam-ui";
|
|
4
4
|
import { DropzoneUploader } from "../dropzone-uploader/base/index.js";
|
|
5
5
|
import { Colxx } from "../CustomBootstrap.js";
|
|
6
6
|
import imgHacerFoto from "../assets/img/take-photo.jpg.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../src/tomar-foto/index.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { Row } from '
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../src/tomar-foto/index.jsx"],"sourcesContent":["import { useState } from 'react';\r\nimport { Row } from 'siam-ui';\r\nimport { DropzoneUploader } from '../dropzone-uploader/base';\r\nimport { Colxx } from '../CustomBootstrap';\r\nimport imgHacerFoto from '../assets/img/take-photo.jpg';\r\nimport { TAKE_PHOTO } from '../constants';\r\n\r\nexport const TomarFoto = ({\r\n onFilesSelectedSelfie = () => {},\r\n isMobile = false,\r\n}) => {\r\n const [filesTotalSelectedSelfie, setTotalFilesSelectedSelfie] = useState(0);\r\n const {\r\n LOAD_SELFIE_WITH_IDENTITY_CARD_MESSAGE,\r\n MESSAGE_SELFIE_ONLY_CAN_TAKE_FROM_CELLPHONE,\r\n TAKE_PHOTO_MESSAGE,\r\n } = TAKE_PHOTO;\r\n\r\n const handleFilesSelectedSelfie = (files) => {\r\n setTotalFilesSelectedSelfie(files.length);\r\n onFilesSelectedSelfie(files);\r\n };\r\n\r\n return (\r\n <>\r\n <Row className=\"pt-2 ml-4\">\r\n <Colxx xxs=\"11\" md=\"5\">\r\n {LOAD_SELFIE_WITH_IDENTITY_CARD_MESSAGE}\r\n </Colxx>\r\n </Row>\r\n <Row className=\"pt-2 ml-2\">\r\n <Colxx xxs=\"12\" md=\"9\">\r\n {isMobile ? (\r\n <>\r\n <Colxx xxs=\"12\" className=\"text-center\">\r\n {filesTotalSelectedSelfie === 0 && (\r\n <img\r\n style={{ width: '97%' }}\r\n alt=\"hacerFotoDNI\"\r\n src={imgHacerFoto}\r\n />\r\n )}\r\n <DropzoneUploader\r\n className=\"pt-2 ml-2\"\r\n maxFiles={1}\r\n onChangeFiles={handleFilesSelectedSelfie}\r\n totalFiles={filesTotalSelectedSelfie}\r\n accept=\"image/jpg,image/jpeg\"\r\n capture=\"environment\"\r\n nameFileLabel={TAKE_PHOTO_MESSAGE}\r\n />\r\n </Colxx>\r\n </>\r\n ) : (\r\n <h2\r\n className={'view-icon iconsminds-smartphone-4 ml-2 mr-2'}\r\n style={{\r\n color: 'red',\r\n margin: '10px 10px 0px 10px',\r\n }}\r\n >\r\n {MESSAGE_SELFIE_ONLY_CAN_TAKE_FROM_CELLPHONE}\r\n </h2>\r\n )}\r\n </Colxx>\r\n </Row>\r\n </>\r\n );\r\n};\r\n"],"names":[],"mappings":";;;;;;;AAOO,MAAM,YAAY,CAAC;AAAA,EACxB,wBAAwB,MAAM;AAAA,EAA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4
4
|
"keywords": [
|
|
5
5
|
"ampf-react",
|
|
6
6
|
"ampf-utils",
|
|
@@ -92,7 +92,7 @@
|
|
|
92
92
|
"dependencies": {
|
|
93
93
|
"@neolution-ch/reactstrap": "^10.0.0",
|
|
94
94
|
"@types/react-intl": "^3.0.0",
|
|
95
|
-
"@whereby.com/browser-sdk": "^3.
|
|
95
|
+
"@whereby.com/browser-sdk": "^3.12.18",
|
|
96
96
|
"dropzone": "^6.0.0-beta.2",
|
|
97
97
|
"events": "^3.3.0",
|
|
98
98
|
"html5-file-selector": "^2.1.0",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"react-intl": "^7.1.14",
|
|
103
103
|
"react-notifications": "^1.7.4",
|
|
104
104
|
"react-select": "^5.10.2",
|
|
105
|
-
"siam-ui": "^
|
|
105
|
+
"siam-ui": "^1.2.0",
|
|
106
106
|
"siam-utils": "^1.1.4",
|
|
107
107
|
"styled-components": "^6.1.12"
|
|
108
108
|
},
|
|
@@ -132,6 +132,7 @@
|
|
|
132
132
|
"vitest": "^3.2.4"
|
|
133
133
|
},
|
|
134
134
|
"overrides": {
|
|
135
|
-
"react-popper": "2.3.0"
|
|
135
|
+
"react-popper": "2.3.0",
|
|
136
|
+
"ip-address": "^10.2.0"
|
|
136
137
|
}
|
|
137
138
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_commonjsHelpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;"}
|
package/dist/_virtual/index.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { getDefaultExportFromCjs } from "./_commonjsHelpers.js";
|
|
2
|
-
import { __require as requireClassnames } from "../node_modules/classnames/index.js";
|
|
3
|
-
var classnamesExports = requireClassnames();
|
|
4
|
-
const classNames = /* @__PURE__ */ getDefaultExportFromCjs(classnamesExports);
|
|
5
|
-
export {
|
|
6
|
-
classNames as default
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
package/dist/_virtual/index2.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index2.js","sources":[],"sourcesContent":[],"names":[],"mappings":";"}
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import classNames from "../../../../_virtual/index.js";
|
|
4
|
-
import { mapToCssModules, tagPropType } from "./utils.js";
|
|
5
|
-
var _excluded = ["className", "cssModule", "color", "innerRef", "pill", "tag"];
|
|
6
|
-
function _extends() {
|
|
7
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
8
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
9
|
-
var source = arguments[i];
|
|
10
|
-
for (var key in source) {
|
|
11
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
12
|
-
target[key] = source[key];
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return target;
|
|
17
|
-
};
|
|
18
|
-
return _extends.apply(this, arguments);
|
|
19
|
-
}
|
|
20
|
-
function _objectWithoutProperties(source, excluded) {
|
|
21
|
-
if (source == null) return {};
|
|
22
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
23
|
-
var key, i;
|
|
24
|
-
if (Object.getOwnPropertySymbols) {
|
|
25
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
26
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
27
|
-
key = sourceSymbolKeys[i];
|
|
28
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
29
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
30
|
-
target[key] = source[key];
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
return target;
|
|
34
|
-
}
|
|
35
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
36
|
-
if (source == null) return {};
|
|
37
|
-
var target = {};
|
|
38
|
-
var sourceKeys = Object.keys(source);
|
|
39
|
-
var key, i;
|
|
40
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
41
|
-
key = sourceKeys[i];
|
|
42
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
43
|
-
target[key] = source[key];
|
|
44
|
-
}
|
|
45
|
-
return target;
|
|
46
|
-
}
|
|
47
|
-
var propTypes = {
|
|
48
|
-
/** Pass children so this component can wrap the child elements */
|
|
49
|
-
children: PropTypes.node,
|
|
50
|
-
/** Add custom class */
|
|
51
|
-
className: PropTypes.string,
|
|
52
|
-
/** Change background color of Badge */
|
|
53
|
-
color: PropTypes.string,
|
|
54
|
-
/** Change existing className with a new className */
|
|
55
|
-
cssModule: PropTypes.object,
|
|
56
|
-
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
|
57
|
-
/** Add rounded corners to the Badge */
|
|
58
|
-
pill: PropTypes.bool,
|
|
59
|
-
/** Set a custom element for this component */
|
|
60
|
-
tag: tagPropType
|
|
61
|
-
};
|
|
62
|
-
function Badge(props) {
|
|
63
|
-
var className = props.className, cssModule = props.cssModule, _props$color = props.color, color = _props$color === void 0 ? "secondary" : _props$color, innerRef = props.innerRef, _props$pill = props.pill, pill = _props$pill === void 0 ? false : _props$pill, _props$tag = props.tag, Tag = _props$tag === void 0 ? "span" : _props$tag, attributes = _objectWithoutProperties(props, _excluded);
|
|
64
|
-
var classes = mapToCssModules(classNames(className, "badge", "bg-" + color, pill ? "rounded-pill" : false), cssModule);
|
|
65
|
-
if (attributes.href && Tag === "span") {
|
|
66
|
-
Tag = "a";
|
|
67
|
-
}
|
|
68
|
-
return /* @__PURE__ */ React.createElement(Tag, _extends({}, attributes, {
|
|
69
|
-
className: classes,
|
|
70
|
-
ref: innerRef
|
|
71
|
-
}));
|
|
72
|
-
}
|
|
73
|
-
Badge.propTypes = propTypes;
|
|
74
|
-
export {
|
|
75
|
-
Badge as default
|
|
76
|
-
};
|
|
77
|
-
//# sourceMappingURL=Badge.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Badge.js","sources":["../../../../../node_modules/@neolution-ch/reactstrap/esm/Badge.js"],"sourcesContent":["var _excluded = [\"className\", \"cssModule\", \"color\", \"innerRef\", \"pill\", \"tag\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nvar propTypes = {\n /** Pass children so this component can wrap the child elements */\n children: PropTypes.node,\n /** Add custom class */\n className: PropTypes.string,\n /** Change background color of Badge */\n color: PropTypes.string,\n /** Change existing className with a new className */\n cssModule: PropTypes.object,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),\n /** Add rounded corners to the Badge */\n pill: PropTypes.bool,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nfunction Badge(props) {\n var className = props.className,\n cssModule = props.cssModule,\n _props$color = props.color,\n color = _props$color === void 0 ? 'secondary' : _props$color,\n innerRef = props.innerRef,\n _props$pill = props.pill,\n pill = _props$pill === void 0 ? false : _props$pill,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'span' : _props$tag,\n attributes = _objectWithoutProperties(props, _excluded);\n var classes = mapToCssModules(classNames(className, 'badge', 'bg-' + color, pill ? 'rounded-pill' : false), cssModule);\n if (attributes.href && Tag === 'span') {\n Tag = 'a';\n }\n return /*#__PURE__*/React.createElement(Tag, _extends({}, attributes, {\n className: classes,\n ref: innerRef\n }));\n}\nBadge.propTypes = propTypes;\nexport default Badge;"],"names":[],"mappings":";;;;AAAA,IAAI,YAAY,CAAC,aAAa,aAAa,SAAS,YAAY,QAAQ,KAAK;AAC7E,SAAS,WAAW;AAAE,aAAW,OAAO,SAAS,OAAO,OAAO,SAAS,SAAU,QAAQ;AAAE,aAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AAAE,UAAI,SAAS,UAAU,CAAC;AAAG,eAAS,OAAO,QAAQ;AAAE,YAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,GAAG;AAAE,iBAAO,GAAG,IAAI,OAAO,GAAG;AAAA,QAAG;AAAA,MAAE;AAAA,IAAE;AAAE,WAAO;AAAA,EAAQ;AAAG,SAAO,SAAS,MAAM,MAAM,SAAS;AAAG;AAClV,SAAS,yBAAyB,QAAQ,UAAU;AAAE,MAAI,UAAU,KAAM,QAAO,CAAA;AAAI,MAAI,SAAS,8BAA8B,QAAQ,QAAQ;AAAG,MAAI,KAAK;AAAG,MAAI,OAAO,uBAAuB;AAAE,QAAI,mBAAmB,OAAO,sBAAsB,MAAM;AAAG,SAAK,IAAI,GAAG,IAAI,iBAAiB,QAAQ,KAAK;AAAE,YAAM,iBAAiB,CAAC;AAAG,UAAI,SAAS,QAAQ,GAAG,KAAK,EAAG;AAAU,UAAI,CAAC,OAAO,UAAU,qBAAqB,KAAK,QAAQ,GAAG,EAAG;AAAU,aAAO,GAAG,I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x_google_ignoreList":[0]}
|
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import classNames from "../../../../_virtual/index.js";
|
|
4
|
-
import { mapToCssModules, tagPropType } from "./utils.js";
|
|
5
|
-
import CloseButton from "./CloseButton.js";
|
|
6
|
-
var _excluded = ["active", "aria-label", "block", "className", "close", "cssModule", "color", "outline", "size", "tag", "innerRef"];
|
|
7
|
-
function _extends() {
|
|
8
|
-
_extends = Object.assign ? Object.assign.bind() : function(target) {
|
|
9
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
10
|
-
var source = arguments[i];
|
|
11
|
-
for (var key in source) {
|
|
12
|
-
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
13
|
-
target[key] = source[key];
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
return target;
|
|
18
|
-
};
|
|
19
|
-
return _extends.apply(this, arguments);
|
|
20
|
-
}
|
|
21
|
-
function _objectWithoutProperties(source, excluded) {
|
|
22
|
-
if (source == null) return {};
|
|
23
|
-
var target = _objectWithoutPropertiesLoose(source, excluded);
|
|
24
|
-
var key, i;
|
|
25
|
-
if (Object.getOwnPropertySymbols) {
|
|
26
|
-
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
27
|
-
for (i = 0; i < sourceSymbolKeys.length; i++) {
|
|
28
|
-
key = sourceSymbolKeys[i];
|
|
29
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
30
|
-
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
|
|
31
|
-
target[key] = source[key];
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return target;
|
|
35
|
-
}
|
|
36
|
-
function _objectWithoutPropertiesLoose(source, excluded) {
|
|
37
|
-
if (source == null) return {};
|
|
38
|
-
var target = {};
|
|
39
|
-
var sourceKeys = Object.keys(source);
|
|
40
|
-
var key, i;
|
|
41
|
-
for (i = 0; i < sourceKeys.length; i++) {
|
|
42
|
-
key = sourceKeys[i];
|
|
43
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
44
|
-
target[key] = source[key];
|
|
45
|
-
}
|
|
46
|
-
return target;
|
|
47
|
-
}
|
|
48
|
-
var propTypes = {
|
|
49
|
-
/** Manually set the visual state of the button to active */
|
|
50
|
-
active: PropTypes.bool,
|
|
51
|
-
/** Aria label */
|
|
52
|
-
"aria-label": PropTypes.string,
|
|
53
|
-
block: PropTypes.bool,
|
|
54
|
-
/** Pass children so this component can wrap them */
|
|
55
|
-
children: PropTypes.node,
|
|
56
|
-
/** Add custom class */
|
|
57
|
-
className: PropTypes.string,
|
|
58
|
-
/** Change existing className with a new className */
|
|
59
|
-
cssModule: PropTypes.object,
|
|
60
|
-
/** Use the button as a close button */
|
|
61
|
-
close: PropTypes.bool,
|
|
62
|
-
/** Change color of Button to one of the available colors */
|
|
63
|
-
color: PropTypes.string,
|
|
64
|
-
/** Disables the button */
|
|
65
|
-
disabled: PropTypes.bool,
|
|
66
|
-
innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),
|
|
67
|
-
/** Function to be triggered on click */
|
|
68
|
-
onClick: PropTypes.func,
|
|
69
|
-
/** Adds outline to the button */
|
|
70
|
-
outline: PropTypes.bool,
|
|
71
|
-
/** Make the button bigger or smaller */
|
|
72
|
-
size: PropTypes.string,
|
|
73
|
-
/** Set a custom element for this component */
|
|
74
|
-
tag: tagPropType
|
|
75
|
-
};
|
|
76
|
-
function Button(props) {
|
|
77
|
-
var onClick = useCallback(function(e) {
|
|
78
|
-
if (props.disabled) {
|
|
79
|
-
e.preventDefault();
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
if (props.onClick) {
|
|
83
|
-
return props.onClick(e);
|
|
84
|
-
}
|
|
85
|
-
}, [props.onClick, props.disabled]);
|
|
86
|
-
var active = props.active, ariaLabel = props["aria-label"], block = props.block, className = props.className, close = props.close, cssModule = props.cssModule, _props$color = props.color, color = _props$color === void 0 ? "secondary" : _props$color, outline = props.outline, size = props.size, _props$tag = props.tag, Tag = _props$tag === void 0 ? "button" : _props$tag, innerRef = props.innerRef, attributes = _objectWithoutProperties(props, _excluded);
|
|
87
|
-
if (close) {
|
|
88
|
-
return /* @__PURE__ */ React.createElement(CloseButton, attributes);
|
|
89
|
-
}
|
|
90
|
-
var btnOutlineColor = "btn".concat(outline ? "-outline" : "", "-").concat(color);
|
|
91
|
-
var classes = mapToCssModules(classNames(className, "btn", btnOutlineColor, size ? "btn-".concat(size) : false, block ? "d-block w-100" : false, {
|
|
92
|
-
active,
|
|
93
|
-
disabled: props.disabled
|
|
94
|
-
}), cssModule);
|
|
95
|
-
if (attributes.href && Tag === "button") {
|
|
96
|
-
Tag = "a";
|
|
97
|
-
}
|
|
98
|
-
return /* @__PURE__ */ React.createElement(Tag, _extends({
|
|
99
|
-
type: Tag === "button" && attributes.onClick ? "button" : void 0
|
|
100
|
-
}, attributes, {
|
|
101
|
-
className: classes,
|
|
102
|
-
ref: innerRef,
|
|
103
|
-
onClick,
|
|
104
|
-
"aria-label": ariaLabel
|
|
105
|
-
}));
|
|
106
|
-
}
|
|
107
|
-
Button.propTypes = propTypes;
|
|
108
|
-
export {
|
|
109
|
-
Button as default
|
|
110
|
-
};
|
|
111
|
-
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../../../node_modules/@neolution-ch/reactstrap/esm/Button.js"],"sourcesContent":["var _excluded = [\"active\", \"aria-label\", \"block\", \"className\", \"close\", \"cssModule\", \"color\", \"outline\", \"size\", \"tag\", \"innerRef\"];\nfunction _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }\nfunction _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }\nfunction _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }\nimport React, { useCallback } from 'react';\nimport PropTypes from 'prop-types';\nimport classNames from 'classnames';\nimport { mapToCssModules, tagPropType } from './utils';\nimport CloseButton from './CloseButton';\nvar propTypes = {\n /** Manually set the visual state of the button to active */\n active: PropTypes.bool,\n /** Aria label */\n 'aria-label': PropTypes.string,\n block: PropTypes.bool,\n /** Pass children so this component can wrap them */\n children: PropTypes.node,\n /** Add custom class */\n className: PropTypes.string,\n /** Change existing className with a new className */\n cssModule: PropTypes.object,\n /** Use the button as a close button */\n close: PropTypes.bool,\n /** Change color of Button to one of the available colors */\n color: PropTypes.string,\n /** Disables the button */\n disabled: PropTypes.bool,\n innerRef: PropTypes.oneOfType([PropTypes.object, PropTypes.func, PropTypes.string]),\n /** Function to be triggered on click */\n onClick: PropTypes.func,\n /** Adds outline to the button */\n outline: PropTypes.bool,\n /** Make the button bigger or smaller */\n size: PropTypes.string,\n /** Set a custom element for this component */\n tag: tagPropType\n};\nfunction Button(props) {\n var onClick = useCallback(function (e) {\n if (props.disabled) {\n e.preventDefault();\n return;\n }\n if (props.onClick) {\n return props.onClick(e);\n }\n }, [props.onClick, props.disabled]);\n var active = props.active,\n ariaLabel = props['aria-label'],\n block = props.block,\n className = props.className,\n close = props.close,\n cssModule = props.cssModule,\n _props$color = props.color,\n color = _props$color === void 0 ? 'secondary' : _props$color,\n outline = props.outline,\n size = props.size,\n _props$tag = props.tag,\n Tag = _props$tag === void 0 ? 'button' : _props$tag,\n innerRef = props.innerRef,\n attributes = _objectWithoutProperties(props, _excluded);\n if (close) {\n return /*#__PURE__*/React.createElement(CloseButton, attributes);\n }\n var btnOutlineColor = \"btn\".concat(outline ? '-outline' : '', \"-\").concat(color);\n var classes = mapToCssModules(classNames(className, 'btn', btnOutlineColor, size ? \"btn-\".concat(size) : false, block ? 'd-block w-100' : false, {\n active: active,\n disabled: props.disabled\n }), cssModule);\n if (attributes.href && Tag === 'button') {\n Tag = 'a';\n }\n return /*#__PURE__*/React.createElement(Tag, _extends({\n type: Tag === 'button' && attributes.onClick ? 'button' : undefined\n }, attributes, {\n className: classes,\n ref: innerRef,\n onClick: onClick,\n \"aria-label\": ariaLabel\n }));\n}\nButton.propTypes = propTypes;\nexport default Button;"],"names":[],"mappings":";;;;;AAAA,IAAI,YAAY,CAAC,UAAU,cAAc,SAAS,aAAa,SAAS,aAAa,SAAS,WAAW,QAAQ,OAAO,UAAU;AAClI,SAAS,WAAW;AAAE,aAAW,OAAO,SAAS,OAAO,OAAO,SAAS,SAAU,QAAQ;AAAE,aAAS,IAAI,GAAG,IAAI,UAAU,QAAQ,KAAK;AAAE,UAAI,SAAS,UAAU,CAAC;AAAG,eAAS,OAAO,QAAQ;AAAE,YAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,GAAG,GAAG;AAAE,iBAAO,GAAG,IAAI,OAAO,GAAG;AAAA,QAAG;AAAA,MAAE;AAAA,IAAE;AAAE,WAAO;AAAA,EAAQ;AAAG,SAAO,SAAS,MAAM,MAAM,SAAS;AAAG;AAClV,SAAS,yBAAyB,QAAQ,UAAU;AAAE,MAAI,UAAU,KAAM,QAAO,CAAA;AAAI,MAAI,SAAS,8BAA8B,QAAQ,QAAQ;AAAG,MAAI,KAAK;AAAG,MAAI,OAAO,uBAAuB;AAAE,QAAI,mBAAmB,OAAO,sBAAsB,MAAM;AAAG,SAAK,IAAI,GAAG,I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