softable-pixels-web 1.2.28 → 1.2.29

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.
@@ -1,6 +1,8 @@
1
1
  import { n as styled, t as useThemedStyles } from "./useThemedStyles-Dco_54KA.js";
2
2
  import { t as Typography } from "./Typography-D1dxTP-6.js";
3
3
  import { t as Icon } from "./Icon-lVgQoCFP.js";
4
+ import { t as Label } from "./Label-lzG8Cp8P.js";
5
+ import { t as ErrorMessage } from "./ErrorMessage-kAHOafpg.js";
4
6
  import { useRef, useState } from "react";
5
7
  import { jsx, jsxs } from "react/jsx-runtime";
6
8
 
@@ -162,14 +164,25 @@ function useFileInput({ files, multiple, maxFileSizeInMB = MAX_FILE_SIZE_IN_MB,
162
164
  function createFileInputStyles(props) {
163
165
  return styled({
164
166
  container: {
167
+ width: "100%",
165
168
  display: "flex",
166
169
  flexDirection: "column",
167
170
  rowGap: 12
168
171
  },
172
+ wrapper: {
173
+ width: "100%",
174
+ height: "100%",
175
+ display: "flex",
176
+ flexDirection: "column",
177
+ rowGap: 8
178
+ },
169
179
  input: {
180
+ width: "100%",
181
+ height: "100%",
170
182
  display: "flex",
171
183
  flexDirection: "column",
172
184
  alignItems: "center",
185
+ justifyContent: "center",
173
186
  rowGap: 8,
174
187
  paddingTop: 24,
175
188
  paddingBottom: 24,
@@ -241,59 +254,71 @@ const FileInput = (props) => {
241
254
  }
242
255
  return /* @__PURE__ */ jsxs("div", {
243
256
  style: styles.container,
244
- children: [/* @__PURE__ */ jsxs("button", {
245
- type: "button",
246
- style: styles.input,
247
- onClick: handleInputClick,
248
- onDrop: handleFileDrop,
249
- onDragOver: handleDragOver,
250
- onDragEnter: handleDragEnter,
251
- onDragLeave: handleDragLeave,
252
- children: [
253
- /* @__PURE__ */ jsx("div", {
254
- style: styles.icon,
255
- children: /* @__PURE__ */ jsx(Icon, { name: "general-upload" })
256
- }),
257
- /* @__PURE__ */ jsxs("div", {
258
- style: styles.title,
259
- children: [/* @__PURE__ */ jsx(Typography, {
260
- variant: "b1",
261
- color: "var(--px-color-primary)",
262
- fontWeight: "bold",
263
- children: "Clique para carregar"
264
- }), /* @__PURE__ */ jsx(Typography, {
265
- variant: "b1",
266
- children: "ou arraste um arquivo"
267
- })]
268
- }),
269
- /* @__PURE__ */ jsx("div", {
270
- style: styles.description,
271
- children: /* @__PURE__ */ jsxs(Typography, {
272
- variant: "b2",
273
- color: "var(--px-text-primary)",
274
- children: [
275
- renderExtensions(),
276
- renderSeparator(),
277
- renderMaxAllowedSize()
278
- ]
279
- })
280
- }),
281
- /* @__PURE__ */ jsx("input", {
282
- ref: inputRef,
283
- type: "file",
284
- hidden: true,
285
- accept,
286
- multiple,
287
- onChange: handleFileChange
288
- })
289
- ]
290
- }), /* @__PURE__ */ jsx("div", {
291
- style: styles.files,
292
- children: renderFiles()
293
- })]
257
+ children: [
258
+ props.label ? /* @__PURE__ */ jsx(Label, {
259
+ label: props.label,
260
+ required: props.required,
261
+ htmlFor: "fileInput"
262
+ }) : null,
263
+ /* @__PURE__ */ jsxs("div", {
264
+ style: styles.wrapper,
265
+ children: [/* @__PURE__ */ jsxs("button", {
266
+ type: "button",
267
+ style: styles.input,
268
+ onClick: handleInputClick,
269
+ onDrop: handleFileDrop,
270
+ onDragOver: handleDragOver,
271
+ onDragEnter: handleDragEnter,
272
+ onDragLeave: handleDragLeave,
273
+ children: [
274
+ /* @__PURE__ */ jsx("div", {
275
+ style: styles.icon,
276
+ children: /* @__PURE__ */ jsx(Icon, { name: "general-upload" })
277
+ }),
278
+ /* @__PURE__ */ jsxs("div", {
279
+ style: styles.title,
280
+ children: [/* @__PURE__ */ jsx(Typography, {
281
+ variant: "b1",
282
+ color: "var(--px-color-primary)",
283
+ fontWeight: "bold",
284
+ children: "Clique para carregar"
285
+ }), /* @__PURE__ */ jsx(Typography, {
286
+ variant: "b1",
287
+ children: "ou arraste um arquivo"
288
+ })]
289
+ }),
290
+ /* @__PURE__ */ jsx("div", {
291
+ style: styles.description,
292
+ children: /* @__PURE__ */ jsxs(Typography, {
293
+ variant: "b2",
294
+ color: "var(--px-text-primary)",
295
+ children: [
296
+ renderExtensions(),
297
+ renderSeparator(),
298
+ renderMaxAllowedSize()
299
+ ]
300
+ })
301
+ }),
302
+ /* @__PURE__ */ jsx("input", {
303
+ hidden: true,
304
+ type: "file",
305
+ id: "fileInput",
306
+ ref: inputRef,
307
+ accept,
308
+ multiple,
309
+ onChange: handleFileChange
310
+ })
311
+ ]
312
+ }), props.errorMessage ? /* @__PURE__ */ jsx(ErrorMessage, { message: props.errorMessage }) : null]
313
+ }),
314
+ /* @__PURE__ */ jsx("div", {
315
+ style: styles.files,
316
+ children: renderFiles()
317
+ })
318
+ ]
294
319
  });
295
320
  };
296
321
 
297
322
  //#endregion
298
323
  export { types_exports as n, FileInput as t };
299
- //# sourceMappingURL=FileInput-CgtLe4M7.js.map
324
+ //# sourceMappingURL=FileInput-C6N2PiPi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FileInput-C6N2PiPi.js","names":["RemoveButton: React.FC<RemoveButtonProps>","FileCard: React.FC<FileCardProps>","FileInput: React.FC<FileInputProps>"],"sources":["../src/components/commons/inputs/FileInput/components/FileCard/components/RemoveButton/styles.ts","../src/components/commons/inputs/FileInput/components/FileCard/components/RemoveButton/index.tsx","../src/components/commons/inputs/FileInput/components/FileCard/styles.ts","../src/components/commons/inputs/FileInput/components/FileCard/index.tsx","../src/components/commons/inputs/FileInput/constants.ts","../src/components/commons/inputs/FileInput/hooks/useFileInput/index.tsx","../src/components/commons/inputs/FileInput/styles.ts","../src/components/commons/inputs/FileInput/types.ts","../src/components/commons/inputs/FileInput/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createRemoveButtonStyles() {\n return styled({\n container: {\n position: 'absolute',\n top: 0,\n right: 0,\n cursor: 'pointer',\n\n padding: 2,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n\n borderColor: 'var(--px-border-primary)',\n borderWidth: 1,\n borderRadius: 40,\n backgroundColor: 'var(--px-bg)',\n\n transform: 'translateY(-50%) translateX(50%)'\n }\n })\n}\n","// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { RemoveButtonProps } from './types'\n\n// Styles\nimport { createRemoveButtonStyles } from './styles'\n\nexport const RemoveButton: React.FC<RemoveButtonProps> = ({ onClick }) => {\n // Hooks\n const { styles } = useThemedStyles({}, createRemoveButtonStyles)\n\n return (\n <button type=\"button\" style={styles.container} onClick={onClick}>\n <Icon name=\"general-close\" size=\"xs\" color=\"var(--color-error)\" />\n </button>\n )\n}\n","import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createFileCardStyles() {\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n rowGap: 4\n },\n content: {\n position: 'relative',\n width: 80,\n height: 60,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n\n borderColor: 'var(--px-border-primary)',\n borderWidth: 1,\n borderRadius: 8\n }\n })\n}\n","// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Typography } from '@components/commons/toolkit/Typography'\nimport { RemoveButton } from './components/RemoveButton'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { FileCardProps } from './types'\n\n// Styles\nimport { createFileCardStyles } from './styles'\n\nexport const FileCard: React.FC<FileCardProps> = ({ file, onRemoveClick }) => {\n // Hooks\n const { styles } = useThemedStyles({}, createFileCardStyles)\n\n // Functions\n function renderName() {\n if (file.name.length <= 10) return file.name\n return `${file.name.substring(0, 10)}...`\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.content}>\n <RemoveButton onClick={onRemoveClick} />\n\n <Icon name=\"general-file\" />\n </div>\n\n <Typography variant=\"b3\" color=\"var(--px-text-primary)\">\n {renderName()}\n </Typography>\n </div>\n )\n}\n","export const MAX_FILE_SIZE_IN_MB = 5\nexport const BYTES_IN_MB = 1024 * 1024\n","// External Libraries\nimport { useRef, useState } from 'react'\n\n// Constants\nimport { BYTES_IN_MB, MAX_FILE_SIZE_IN_MB } from '../../constants'\n\n// Types\nimport type { FileInputProps } from '../../types'\n\nexport function useFileInput({\n files,\n multiple,\n maxFileSizeInMB = MAX_FILE_SIZE_IN_MB,\n acceptedExtensions,\n onFileChange\n}: FileInputProps) {\n // Refs\n const inputRef = useRef<HTMLInputElement>(null)\n\n // Constants\n const accept = acceptedExtensions?.map(extension => `.${extension}`).join(',')\n const maxFileSizeInBytes = maxFileSizeInMB * BYTES_IN_MB\n\n // States\n const [isDragging, setIsDragging] = useState(false)\n\n // Functions\n function handleInputClick(e: React.MouseEvent) {\n e.stopPropagation()\n\n if (inputRef.current) inputRef.current.value = ''\n inputRef.current?.click()\n }\n\n function handleFileChange(e: React.ChangeEvent<HTMLInputElement>) {\n const selectedFiles = Array.from(e.target.files ?? [])\n\n if (!selectedFiles.length) return\n\n const validFiles = selectedFiles.filter(isSizeAllowed)\n\n if (!validFiles.length) return\n\n if (multiple) {\n onFileChange([...(files ?? []), ...validFiles])\n } else {\n onFileChange([validFiles[0]])\n }\n }\n\n function handleFileDrop(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(false)\n\n const droppedFiles = Array.from(e.dataTransfer.files)\n\n if (!droppedFiles.length) return\n\n const allowedFiles = droppedFiles.filter(file => isSizeAllowed(file))\n\n if (multiple) {\n onFileChange([...files, ...allowedFiles])\n } else {\n onFileChange([allowedFiles[0]])\n }\n }\n\n function handleDragEnter(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(true)\n }\n\n function handleDragOver(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n }\n\n function handleDragLeave(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(false)\n }\n\n function handleRemoveClick(file: File) {\n const filesSet = new Set(files)\n filesSet.delete(file)\n const nextFiles = Array.from(filesSet)\n onFileChange(nextFiles)\n }\n\n function isSizeAllowed(file: File) {\n return file.size <= maxFileSizeInBytes\n }\n\n return {\n accept,\n inputRef,\n isDragging,\n maxFileSizeInMB,\n handleFileDrop,\n handleDragOver,\n handleDragEnter,\n handleDragLeave,\n handleFileChange,\n handleInputClick,\n handleRemoveClick\n }\n}\n","// Types\nimport type { FileInputProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface Props extends FileInputProps {\n isDragging: boolean\n}\n\nexport function createFileInputStyles(props: Props) {\n return styled({\n container: {\n width: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n rowGap: 12\n },\n wrapper: {\n width: '100%',\n height: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n rowGap: 8\n },\n input: {\n width: '100%',\n height: '100%',\n\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n justifyContent: 'center',\n rowGap: 8,\n\n paddingTop: 24,\n paddingBottom: 24,\n paddingLeft: 40,\n paddingRight: 40,\n\n borderColor: props.isDragging\n ? 'var(--px-color-primary)'\n : 'var(--px-border-primary)',\n borderWidth: 1,\n borderStyle: props.isDragging\n ? 'dashed'\n : (props.borderVariant ?? 'solid'),\n borderRadius: 16,\n\n cursor: props.isDragging ? 'grabbing' : 'pointer',\n\n __rules: {\n '&:hover': {\n borderColor: 'var(--px-color-primary) !important'\n }\n }\n },\n icon: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 12,\n border: '1px solid var(--px-border-primary)',\n borderRadius: 'var(--px-radius-lg)',\n boxShadow: 'var(--px-shadow-xs)',\n pointerEvents: 'none'\n },\n title: {\n display: 'flex',\n alignItems: 'center',\n columnGap: 4,\n pointerEvents: 'none'\n },\n description: {\n pointerEvents: 'none'\n },\n files: {\n display: 'flex',\n alignItems: 'center',\n columnGap: 16\n }\n })\n}\n","import type {\n LayoutProps,\n MarginProps,\n PaddingProps\n} from '@hooks/useThemedStyles/types'\n\nexport interface FileInputProps extends MarginProps, PaddingProps, LayoutProps {\n files: File[]\n label?: string\n multiple?: boolean\n required?: boolean\n errorMessage?: string\n borderVariant?: 'solid' | 'dashed'\n maxFileSizeInMB?: number\n acceptedExtensions?: string[]\n onFileChange: (files: File[]) => void\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { FileCard } from './components/FileCard'\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Label } from '@components/commons/toolkit/Label'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useFileInput } from './hooks/useFileInput'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { FileInputProps } from './types'\n\n// Styles\nimport { createFileInputStyles } from './styles'\nimport { ErrorMessage } from '@components/commons/toolkit/ErrorMessage'\n\nexport * as FileInputTypes from './types'\n\nexport const FileInput: React.FC<FileInputProps> = props => {\n // Constants\n const { files, multiple, acceptedExtensions } = props\n\n // Hooks\n const {\n accept,\n inputRef,\n isDragging,\n maxFileSizeInMB,\n handleFileDrop,\n handleDragOver,\n handleDragEnter,\n handleDragLeave,\n handleFileChange,\n handleInputClick,\n handleRemoveClick\n } = useFileInput(props)\n const { styles } = useThemedStyles(\n { ...props, isDragging },\n createFileInputStyles,\n {\n applyCommonProps: true,\n pick: p => [p.files, p.isDragging]\n }\n )\n\n // Functions\n function renderExtensions() {\n if (!acceptedExtensions) return ''\n\n const extensions = acceptedExtensions\n .map(extension => `.${extension}`)\n .join(', ')\n return `Formatos aceitos: ${extensions}`\n }\n\n function renderSeparator() {\n return acceptedExtensions && maxFileSizeInMB ? ' - ' : ''\n }\n\n function renderMaxAllowedSize() {\n return `Tamanho máximo ${maxFileSizeInMB} MB`\n }\n\n function renderFiles() {\n return files.map(file => (\n <FileCard\n key={file.name}\n file={file}\n onRemoveClick={() => handleRemoveClick(file)}\n />\n ))\n }\n\n return (\n <div style={styles.container}>\n {props.label ? (\n <Label\n label={props.label}\n required={props.required}\n htmlFor=\"fileInput\"\n />\n ) : null}\n\n <div style={styles.wrapper}>\n <button\n type=\"button\"\n style={styles.input}\n onClick={handleInputClick}\n onDrop={handleFileDrop}\n onDragOver={handleDragOver}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n >\n <div style={styles.icon}>\n <Icon name=\"general-upload\" />\n </div>\n\n <div style={styles.title}>\n <Typography\n variant=\"b1\"\n color=\"var(--px-color-primary)\"\n fontWeight=\"bold\"\n >\n Clique para carregar\n </Typography>\n\n <Typography variant=\"b1\">ou arraste um arquivo</Typography>\n </div>\n\n <div style={styles.description}>\n <Typography variant=\"b2\" color=\"var(--px-text-primary)\">\n {renderExtensions()}\n\n {renderSeparator()}\n\n {renderMaxAllowedSize()}\n </Typography>\n </div>\n\n <input\n hidden\n type=\"file\"\n id=\"fileInput\"\n ref={inputRef}\n accept={accept}\n multiple={multiple}\n onChange={handleFileChange}\n />\n </button>\n\n {props.errorMessage ? (\n <ErrorMessage message={props.errorMessage} />\n ) : null}\n </div>\n\n <div style={styles.files}>{renderFiles()}</div>\n </div>\n )\n}\n"],"mappings":";;;;;;;;;AAEA,SAAgB,2BAA2B;AACzC,QAAO,OAAO,EACZ,WAAW;EACT,UAAU;EACV,KAAK;EACL,OAAO;EACP,QAAQ;EAER,SAAS;EACT,SAAS;EACT,gBAAgB;EAChB,YAAY;EAEZ,aAAa;EACb,aAAa;EACb,cAAc;EACd,iBAAiB;EAEjB,WAAW;EACZ,EACF,CAAC;;;;;ACVJ,MAAaA,gBAA6C,EAAE,cAAc;CAExE,MAAM,EAAE,WAAW,gBAAgB,EAAE,EAAE,yBAAyB;AAEhE,QACE,oBAAC;EAAO,MAAK;EAAS,OAAO,OAAO;EAAoB;YACtD,oBAAC;GAAK,MAAK;GAAgB,MAAK;GAAK,OAAM;IAAuB;GAC3D;;;;;ACjBb,SAAgB,uBAAuB;AACrC,QAAO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IACb,UAAU,MAAM;IAChB,SAAQ;KACR,GACA;GAEJ,qBAAC;IAAI,OAAO,OAAO;eACjB,qBAAC;KACC,MAAK;KACL,OAAO,OAAO;KACd,SAAS;KACT,QAAQ;KACR,YAAY;KACZ,aAAa;KACb,aAAa;;MAEb,oBAAC;OAAI,OAAO,OAAO;iBACjB,oBAAC,QAAK,MAAK,mBAAmB;QAC1B;MAEN,qBAAC;OAAI,OAAO,OAAO;kBACjB,oBAAC;QACC,SAAQ;QACR,OAAM;QACN,YAAW;kBACZ;SAEY,EAEb,oBAAC;QAAW,SAAQ;kBAAK;SAAkC;QACvD;MAEN,oBAAC;OAAI,OAAO,OAAO;iBACjB,qBAAC;QAAW,SAAQ;QAAK,OAAM;;SAC5B,kBAAkB;SAElB,iBAAiB;SAEjB,sBAAsB;;SACZ;QACT;MAEN,oBAAC;OACC;OACA,MAAK;OACL,IAAG;OACH,KAAK;OACG;OACE;OACV,UAAU;QACV;;MACK,EAER,MAAM,eACL,oBAAC,gBAAa,SAAS,MAAM,eAAgB,GAC3C;KACA;GAEN,oBAAC;IAAI,OAAO,OAAO;cAAQ,aAAa;KAAO;;GAC3C"}
@@ -1,2 +1,2 @@
1
- import { n as types_d_exports, t as FileInput } from "./index-BEipaO2C.js";
1
+ import { n as types_d_exports, t as FileInput } from "./index-CHsvpknw.js";
2
2
  export { FileInput, types_d_exports as FileInputTypes };
@@ -1,6 +1,8 @@
1
1
  import "./useThemedStyles-Dco_54KA.js";
2
2
  import "./Typography-D1dxTP-6.js";
3
3
  import "./Icon-lVgQoCFP.js";
4
- import { n as types_exports, t as FileInput } from "./FileInput-CgtLe4M7.js";
4
+ import "./Label-lzG8Cp8P.js";
5
+ import "./ErrorMessage-kAHOafpg.js";
6
+ import { n as types_exports, t as FileInput } from "./FileInput-C6N2PiPi.js";
5
7
 
6
8
  export { FileInput, types_exports as FileInputTypes };
@@ -1,7 +1,7 @@
1
1
  import { t as CommonStyleProps } from "./styleProps-Bq2PkDym.js";
2
2
  import { r as TypeStyles } from "./useThemedStyles-DoHwc6h5.js";
3
3
  import { ReactNode } from "react";
4
- import * as react_jsx_runtime0 from "react/jsx-runtime";
4
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
5
5
 
6
6
  //#region src/components/commons/toolkit/TabSwitch/styles.d.ts
7
7
  declare function createTabSwitchStyles<T>(props: TabSwitchProps<T>): {
@@ -47,7 +47,7 @@ interface TabSwitchProps<T> extends CommonStyleProps {
47
47
  }
48
48
  //#endregion
49
49
  //#region src/components/commons/toolkit/TabSwitch/index.d.ts
50
- declare const TabSwitch: <T>(props: TabSwitchProps<T>) => react_jsx_runtime0.JSX.Element;
50
+ declare const TabSwitch: <T>(props: TabSwitchProps<T>) => react_jsx_runtime1.JSX.Element;
51
51
  //#endregion
52
52
  export { types_d_exports as n, TabSwitch as t };
53
- //# sourceMappingURL=index-BQRzf4rc.d.ts.map
53
+ //# sourceMappingURL=index-BBmC9Lfb.d.ts.map
@@ -22,7 +22,7 @@ declare function createInputStyles(props: InputProps): {
22
22
  padding: string;
23
23
  opacity: number;
24
24
  boxShadow: "var(--px-shadow-default)";
25
- borderColor: "var(--px-border-primary)" | "var(--px-color-error)";
25
+ borderColor: "var(--px-color-error)" | "var(--px-border-primary)";
26
26
  __rules: {
27
27
  '&:focus-within': {
28
28
  outlineOffset: string;
@@ -103,4 +103,4 @@ interface InputMethods {
103
103
  declare const Input: react0.ForwardRefExoticComponent<InputProps & react0.RefAttributes<InputMethods>>;
104
104
  //#endregion
105
105
  export { Input as t };
106
- //# sourceMappingURL=index-DFfPk9_X.d.ts.map
106
+ //# sourceMappingURL=index-C31Z2a2S.d.ts.map
@@ -7,7 +7,10 @@ declare namespace types_d_exports {
7
7
  }
8
8
  interface FileInputProps extends MarginProps, PaddingProps, LayoutProps {
9
9
  files: File[];
10
+ label?: string;
10
11
  multiple?: boolean;
12
+ required?: boolean;
13
+ errorMessage?: string;
11
14
  borderVariant?: 'solid' | 'dashed';
12
15
  maxFileSizeInMB?: number;
13
16
  acceptedExtensions?: string[];
@@ -18,4 +21,4 @@ interface FileInputProps extends MarginProps, PaddingProps, LayoutProps {
18
21
  declare const FileInput: React.FC<FileInputProps>;
19
22
  //#endregion
20
23
  export { types_d_exports as n, FileInput as t };
21
- //# sourceMappingURL=index-BEipaO2C.d.ts.map
24
+ //# sourceMappingURL=index-CHsvpknw.d.ts.map
@@ -27,7 +27,7 @@ declare function createSelectStyles(props: SelectProps): {
27
27
  opacity: number;
28
28
  cursor: "not-allowed" | "pointer" | "progress";
29
29
  boxShadow: "var(--px-shadow-default)";
30
- borderColor: "var(--px-border-primary)" | "var(--px-color-error)";
30
+ borderColor: "var(--px-color-error)" | "var(--px-border-primary)";
31
31
  __rules: {
32
32
  '&:focus-within': {
33
33
  outlineOffset: string;
@@ -102,4 +102,4 @@ interface SelectOption {
102
102
  declare const Select: React$1.FC<SelectProps>;
103
103
  //#endregion
104
104
  export { types_d_exports as n, Select as t };
105
- //# sourceMappingURL=index-DAAEXO7G.d.ts.map
105
+ //# sourceMappingURL=index-DlVdtSCT.d.ts.map
@@ -1,6 +1,6 @@
1
1
  import { a as TextProps } from "./styleProps-Bq2PkDym.js";
2
2
  import { r as TypeStyles } from "./useThemedStyles-DoHwc6h5.js";
3
- import * as react_jsx_runtime1 from "react/jsx-runtime";
3
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
4
4
 
5
5
  //#region src/components/commons/inputs/TextArea/styles.d.ts
6
6
  declare function createTextAreaStyles(props: TextAreaProps): {
@@ -27,7 +27,7 @@ declare function createTextAreaStyles(props: TextAreaProps): {
27
27
  fontWeight: "400";
28
28
  fontSize: string;
29
29
  color: "var(--px-text-primary)";
30
- borderColor: "var(--px-border-primary)" | "var(--px-color-error)";
30
+ borderColor: "var(--px-color-error)" | "var(--px-border-primary)";
31
31
  outlineOffset: string;
32
32
  cursor: "default" | undefined;
33
33
  __rules: {
@@ -67,7 +67,7 @@ interface TextAreaProps {
67
67
  }
68
68
  //#endregion
69
69
  //#region src/components/commons/inputs/TextArea/index.d.ts
70
- declare const TextArea: (props: TextAreaProps) => react_jsx_runtime1.JSX.Element;
70
+ declare const TextArea: (props: TextAreaProps) => react_jsx_runtime0.JSX.Element;
71
71
  //#endregion
72
72
  export { TextArea as t };
73
- //# sourceMappingURL=index-BxDK_Go8.d.ts.map
73
+ //# sourceMappingURL=index-Q90gI7Q2.d.ts.map
package/dist/index.d.ts CHANGED
@@ -4,13 +4,13 @@ import { t as IconButton } from "./index-2zCiMZnT.js";
4
4
  import { n as types_d_exports$1, t as ColorPicker } from "./index-CLDq1eQr.js";
5
5
  import { n as types_d_exports$5 } from "./types-vfa_y8KH.js";
6
6
  import { n as types_d_exports$3, t as DatePicker } from "./index-UoeT_1nR.js";
7
- import { n as types_d_exports$4, t as FileInput } from "./index-BEipaO2C.js";
7
+ import { n as types_d_exports$4, t as FileInput } from "./index-CHsvpknw.js";
8
8
  import { n as Locale, r as MaskType, t as MaskModule } from "./index-CSRzYxDc.js";
9
- import { t as Input } from "./index-DFfPk9_X.js";
9
+ import { t as Input } from "./index-C31Z2a2S.js";
10
10
  import { t as SearchInput } from "./index-MyZ_XVsH.js";
11
- import { n as types_d_exports$6, t as Select } from "./index-DAAEXO7G.js";
11
+ import { n as types_d_exports$6, t as Select } from "./index-DlVdtSCT.js";
12
12
  import { t as index_d_exports } from "./index-CriBmhqv.js";
13
- import { t as TextArea } from "./index-BxDK_Go8.js";
13
+ import { t as TextArea } from "./index-Q90gI7Q2.js";
14
14
  import { t as Popover } from "./index-tivXt3ba.js";
15
15
  import { t as BasePopover } from "./index-BKsKKh1p.js";
16
16
  import { t as Breadcrumb } from "./index-CBHEtmuG.js";
@@ -25,7 +25,7 @@ import { InfoSummary, InfoSummaryItem, InfoSummaryProps } from "./info-summary.j
25
25
  import { t as Pagination } from "./index-D5kC89SC.js";
26
26
  import { ScrollPaginationContainer } from "./scroll-pagination-container.js";
27
27
  import { t as Switch } from "./index-B0g1F3X4.js";
28
- import { n as types_d_exports$7, t as TabSwitch } from "./index-BQRzf4rc.js";
28
+ import { n as types_d_exports$7, t as TabSwitch } from "./index-BBmC9Lfb.js";
29
29
  import { Typography } from "./typography.js";
30
30
  import { a as ThemeName, c as ThemeRegistry, i as ThemeMode, l as ThemeTokens, n as useTheme, o as ThemePersistence, r as ThemeContextData, s as ThemeProviderProps, t as ThemeProvider } from "./index-DPmfBsga.js";
31
31
  import { useDismiss } from "./use-dismiss.js";
package/dist/index.js CHANGED
@@ -29,7 +29,7 @@ import { t as TextArea } from "./TextArea-NeN7ynND.js";
29
29
  import { t as SearchInput } from "./SearchInput-WHXwVu4s.js";
30
30
  import { n as types_exports$1, t as ColorPicker } from "./ColorPicker-v5ULLhFP.js";
31
31
  import { t as Skeleton } from "./Skeleton-pvWAx_gn.js";
32
- import { n as types_exports$4, t as FileInput } from "./FileInput-CgtLe4M7.js";
32
+ import { n as types_exports$4, t as FileInput } from "./FileInput-C6N2PiPi.js";
33
33
  import { useVirtualAnchor } from "./use-virtual-anchor.js";
34
34
  import { t as Breadcrumb } from "./Breadcrumb-CBCBNcIC.js";
35
35
 
package/dist/input.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- import { t as Input } from "./index-DFfPk9_X.js";
1
+ import { t as Input } from "./index-C31Z2a2S.js";
2
2
  export { Input };
package/dist/select.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  import "./types-vfa_y8KH.js";
2
- import { n as types_d_exports, t as Select } from "./index-DAAEXO7G.js";
2
+ import { n as types_d_exports, t as Select } from "./index-DlVdtSCT.js";
3
3
  import "./index-CriBmhqv.js";
4
4
  export { Select, types_d_exports as SelectTypes };
@@ -1,2 +1,2 @@
1
- import { n as types_d_exports, t as TabSwitch } from "./index-BQRzf4rc.js";
1
+ import { n as types_d_exports, t as TabSwitch } from "./index-BBmC9Lfb.js";
2
2
  export { TabSwitch, types_d_exports as TabSwitchTypes };
@@ -1,2 +1,2 @@
1
- import { t as TextArea } from "./index-BxDK_Go8.js";
1
+ import { t as TextArea } from "./index-Q90gI7Q2.js";
2
2
  export { TextArea };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "softable-pixels-web",
3
- "version": "1.2.28",
3
+ "version": "1.2.29",
4
4
  "description": "",
5
5
  "keywords": [],
6
6
  "author": "softable",
@@ -1 +0,0 @@
1
- {"version":3,"file":"FileInput-CgtLe4M7.js","names":["RemoveButton: React.FC<RemoveButtonProps>","FileCard: React.FC<FileCardProps>","FileInput: React.FC<FileInputProps>"],"sources":["../src/components/commons/inputs/FileInput/components/FileCard/components/RemoveButton/styles.ts","../src/components/commons/inputs/FileInput/components/FileCard/components/RemoveButton/index.tsx","../src/components/commons/inputs/FileInput/components/FileCard/styles.ts","../src/components/commons/inputs/FileInput/components/FileCard/index.tsx","../src/components/commons/inputs/FileInput/constants.ts","../src/components/commons/inputs/FileInput/hooks/useFileInput/index.tsx","../src/components/commons/inputs/FileInput/styles.ts","../src/components/commons/inputs/FileInput/types.ts","../src/components/commons/inputs/FileInput/index.tsx"],"sourcesContent":["import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createRemoveButtonStyles() {\n return styled({\n container: {\n position: 'absolute',\n top: 0,\n right: 0,\n cursor: 'pointer',\n\n padding: 2,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n\n borderColor: 'var(--px-border-primary)',\n borderWidth: 1,\n borderRadius: 40,\n backgroundColor: 'var(--px-bg)',\n\n transform: 'translateY(-50%) translateX(50%)'\n }\n })\n}\n","// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { RemoveButtonProps } from './types'\n\n// Styles\nimport { createRemoveButtonStyles } from './styles'\n\nexport const RemoveButton: React.FC<RemoveButtonProps> = ({ onClick }) => {\n // Hooks\n const { styles } = useThemedStyles({}, createRemoveButtonStyles)\n\n return (\n <button type=\"button\" style={styles.container} onClick={onClick}>\n <Icon name=\"general-close\" size=\"xs\" color=\"var(--color-error)\" />\n </button>\n )\n}\n","import { styled } from '@hooks/useThemedStyles/types'\n\nexport function createFileCardStyles() {\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'column',\n justifyContent: 'center',\n alignItems: 'center',\n rowGap: 4\n },\n content: {\n position: 'relative',\n width: 80,\n height: 60,\n display: 'flex',\n justifyContent: 'center',\n alignItems: 'center',\n\n borderColor: 'var(--px-border-primary)',\n borderWidth: 1,\n borderRadius: 8\n }\n })\n}\n","// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { Typography } from '@components/commons/toolkit/Typography'\nimport { RemoveButton } from './components/RemoveButton'\n\n// Hooks\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { FileCardProps } from './types'\n\n// Styles\nimport { createFileCardStyles } from './styles'\n\nexport const FileCard: React.FC<FileCardProps> = ({ file, onRemoveClick }) => {\n // Hooks\n const { styles } = useThemedStyles({}, createFileCardStyles)\n\n // Functions\n function renderName() {\n if (file.name.length <= 10) return file.name\n return `${file.name.substring(0, 10)}...`\n }\n\n return (\n <div style={styles.container}>\n <div style={styles.content}>\n <RemoveButton onClick={onRemoveClick} />\n\n <Icon name=\"general-file\" />\n </div>\n\n <Typography variant=\"b3\" color=\"var(--px-text-primary)\">\n {renderName()}\n </Typography>\n </div>\n )\n}\n","export const MAX_FILE_SIZE_IN_MB = 5\nexport const BYTES_IN_MB = 1024 * 1024\n","// External Libraries\nimport { useRef, useState } from 'react'\n\n// Constants\nimport { BYTES_IN_MB, MAX_FILE_SIZE_IN_MB } from '../../constants'\n\n// Types\nimport type { FileInputProps } from '../../types'\n\nexport function useFileInput({\n files,\n multiple,\n maxFileSizeInMB = MAX_FILE_SIZE_IN_MB,\n acceptedExtensions,\n onFileChange\n}: FileInputProps) {\n // Refs\n const inputRef = useRef<HTMLInputElement>(null)\n\n // Constants\n const accept = acceptedExtensions?.map(extension => `.${extension}`).join(',')\n const maxFileSizeInBytes = maxFileSizeInMB * BYTES_IN_MB\n\n // States\n const [isDragging, setIsDragging] = useState(false)\n\n // Functions\n function handleInputClick(e: React.MouseEvent) {\n e.stopPropagation()\n\n if (inputRef.current) inputRef.current.value = ''\n inputRef.current?.click()\n }\n\n function handleFileChange(e: React.ChangeEvent<HTMLInputElement>) {\n const selectedFiles = Array.from(e.target.files ?? [])\n\n if (!selectedFiles.length) return\n\n const validFiles = selectedFiles.filter(isSizeAllowed)\n\n if (!validFiles.length) return\n\n if (multiple) {\n onFileChange([...(files ?? []), ...validFiles])\n } else {\n onFileChange([validFiles[0]])\n }\n }\n\n function handleFileDrop(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(false)\n\n const droppedFiles = Array.from(e.dataTransfer.files)\n\n if (!droppedFiles.length) return\n\n const allowedFiles = droppedFiles.filter(file => isSizeAllowed(file))\n\n if (multiple) {\n onFileChange([...files, ...allowedFiles])\n } else {\n onFileChange([allowedFiles[0]])\n }\n }\n\n function handleDragEnter(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(true)\n }\n\n function handleDragOver(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n }\n\n function handleDragLeave(e: React.DragEvent<HTMLButtonElement>) {\n e.preventDefault()\n e.stopPropagation()\n\n setIsDragging(false)\n }\n\n function handleRemoveClick(file: File) {\n const filesSet = new Set(files)\n filesSet.delete(file)\n const nextFiles = Array.from(filesSet)\n onFileChange(nextFiles)\n }\n\n function isSizeAllowed(file: File) {\n return file.size <= maxFileSizeInBytes\n }\n\n return {\n accept,\n inputRef,\n isDragging,\n maxFileSizeInMB,\n handleFileDrop,\n handleDragOver,\n handleDragEnter,\n handleDragLeave,\n handleFileChange,\n handleInputClick,\n handleRemoveClick\n }\n}\n","// Types\nimport type { FileInputProps } from './types'\nimport { styled } from '@hooks/useThemedStyles/types'\n\ninterface Props extends FileInputProps {\n isDragging: boolean\n}\n\nexport function createFileInputStyles(props: Props) {\n return styled({\n container: {\n display: 'flex',\n flexDirection: 'column',\n rowGap: 12\n },\n input: {\n display: 'flex',\n flexDirection: 'column',\n alignItems: 'center',\n rowGap: 8,\n\n paddingTop: 24,\n paddingBottom: 24,\n paddingLeft: 40,\n paddingRight: 40,\n\n borderColor: props.isDragging\n ? 'var(--px-color-primary)'\n : 'var(--px-border-primary)',\n borderWidth: 1,\n borderStyle: props.isDragging\n ? 'dashed'\n : (props.borderVariant ?? 'solid'),\n borderRadius: 16,\n\n cursor: props.isDragging ? 'grabbing' : 'pointer',\n\n __rules: {\n '&:hover': {\n borderColor: 'var(--px-color-primary) !important'\n }\n }\n },\n icon: {\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n padding: 12,\n border: '1px solid var(--px-border-primary)',\n borderRadius: 'var(--px-radius-lg)',\n boxShadow: 'var(--px-shadow-xs)',\n pointerEvents: 'none'\n },\n title: {\n display: 'flex',\n alignItems: 'center',\n columnGap: 4,\n pointerEvents: 'none'\n },\n description: {\n pointerEvents: 'none'\n },\n files: {\n display: 'flex',\n alignItems: 'center',\n columnGap: 16\n }\n })\n}\n","import type {\n LayoutProps,\n MarginProps,\n PaddingProps\n} from '@hooks/useThemedStyles/types'\n\nexport interface FileInputProps extends MarginProps, PaddingProps, LayoutProps {\n files: File[]\n multiple?: boolean\n borderVariant?: 'solid' | 'dashed'\n maxFileSizeInMB?: number\n acceptedExtensions?: string[]\n onFileChange: (files: File[]) => void\n}\n","// External Libraries\nimport type React from 'react'\n\n// Components\nimport { Icon } from '@components/commons/toolkit/Icon'\nimport { FileCard } from './components/FileCard'\nimport { Typography } from '@components/commons/toolkit/Typography'\n\n// Hooks\nimport { useFileInput } from './hooks/useFileInput'\nimport { useThemedStyles } from '@hooks/useThemedStyles'\n\n// Types\nimport type { FileInputProps } from './types'\n\n// Styles\nimport { createFileInputStyles } from './styles'\n\nexport * as FileInputTypes from './types'\n\nexport const FileInput: React.FC<FileInputProps> = props => {\n // Constants\n const { files, multiple, acceptedExtensions } = props\n\n // Hooks\n const {\n accept,\n inputRef,\n isDragging,\n maxFileSizeInMB,\n handleFileDrop,\n handleDragOver,\n handleDragEnter,\n handleDragLeave,\n handleFileChange,\n handleInputClick,\n handleRemoveClick\n } = useFileInput(props)\n const { styles } = useThemedStyles(\n { ...props, isDragging },\n createFileInputStyles,\n {\n applyCommonProps: true,\n pick: p => [p.files, p.isDragging]\n }\n )\n\n // Functions\n function renderExtensions() {\n if (!acceptedExtensions) return ''\n\n const extensions = acceptedExtensions\n .map(extension => `.${extension}`)\n .join(', ')\n return `Formatos aceitos: ${extensions}`\n }\n\n function renderSeparator() {\n return acceptedExtensions && maxFileSizeInMB ? ' - ' : ''\n }\n\n function renderMaxAllowedSize() {\n return `Tamanho máximo ${maxFileSizeInMB} MB`\n }\n\n function renderFiles() {\n return files.map(file => (\n <FileCard\n key={file.name}\n file={file}\n onRemoveClick={() => handleRemoveClick(file)}\n />\n ))\n }\n\n return (\n <div style={styles.container}>\n <button\n type=\"button\"\n style={styles.input}\n onClick={handleInputClick}\n onDrop={handleFileDrop}\n onDragOver={handleDragOver}\n onDragEnter={handleDragEnter}\n onDragLeave={handleDragLeave}\n >\n <div style={styles.icon}>\n <Icon name=\"general-upload\" />\n </div>\n\n <div style={styles.title}>\n <Typography\n variant=\"b1\"\n color=\"var(--px-color-primary)\"\n fontWeight=\"bold\"\n >\n Clique para carregar\n </Typography>\n\n <Typography variant=\"b1\">ou arraste um arquivo</Typography>\n </div>\n\n <div style={styles.description}>\n <Typography variant=\"b2\" color=\"var(--px-text-primary)\">\n {renderExtensions()}\n\n {renderSeparator()}\n\n {renderMaxAllowedSize()}\n </Typography>\n </div>\n\n <input\n ref={inputRef}\n type=\"file\"\n hidden\n accept={accept}\n multiple={multiple}\n onChange={handleFileChange}\n />\n </button>\n\n <div style={styles.files}>{renderFiles()}</div>\n </div>\n )\n}\n"],"mappings":";;;;;;;AAEA,SAAgB,2BAA2B;AACzC,QAAO,OAAO,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