@consumidor-positivo/aurora 3.2.0 → 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.
@@ -4,6 +4,7 @@ import LinkButton from '../../LinkButton/index.astro'
4
4
  import ProgressBar from '../../ProgressBar/index.astro'
5
5
  import IconPaperclip from '../../icons/default/IconPaperclip.astro'
6
6
  import IconTrash2 from '../../icons/default/IconTrash2.astro'
7
+ import IconX from '../../icons/default/IconX.astro'
7
8
  import '../../../dist/components/styles/styles.css'
8
9
 
9
10
  export type FileUploadPreviewLink = {
@@ -14,8 +15,9 @@ export type FileUploadPreviewLink = {
14
15
 
15
16
  /**
16
17
  * Same markup as the React `FileUpload.Preview`. `icon` is the `icon` slot.
17
- * `onRemove` has no counterpart: `removable` renders the remove button, which
18
- * carries `data-au-file-upload="remove"` for the page's own `<script>`; the
18
+ * `onRemove` has no counterpart: `removable` renders the remove button (the
19
+ * cancel X while there is `progress`), which carries
20
+ * `data-au-file-upload="remove"` for the page's own `<script>`; the
19
21
  * link has no `onClick` either, so give it an `href` or listen on
20
22
  * `.au-file-upload-preview__link`. Every other HTML attribute lands on the
21
23
  * root `div`.
@@ -27,16 +29,27 @@ export type Props = HTMLAttributes<'div'> & {
27
29
  description?: string
28
30
  /** Mensagem de erro abaixo da linha, com o motivo e o próximo passo; liga o estado Error. Figma: Error Message, State=Error. */
29
31
  error?: string
30
- /** Percentual do envio, de 0 a 100; mostra a Percentage Bar abaixo da linha. Figma: Show Progress. */
32
+ /**
33
+ * Percentual do envio, de 0 a 100: a linha entra no estado Enviando, com a Percentage Bar abaixo
34
+ * (rótulo e percentual) e só o X de cancelar à direita; o link e a lixeira aparecem quando o envio
35
+ * termina. Figma: Show Progress.
36
+ */
31
37
  progress?: number
38
+ /** Rótulo à esquerda da barra durante o envio. */
39
+ progressLabel?: string
32
40
  /** Esconde o quadro do ícone. Figma: Show Leading Icon=False. */
33
41
  hideIcon?: boolean
34
- /** Link Button small à direita ("Ver"). Figma: Show Link. */
42
+ /** Link Button small à direita ("Ver"), só com o arquivo já enviado. Figma: Show Link. */
35
43
  link?: FileUploadPreviewLink
36
- /** Mostra o botão de remover (Ghost, ícone, 40x40). Figma: Show Button. */
44
+ /**
45
+ * Mostra o botão de remover o arquivo enviado (lixeira) ou de cancelar o envio em andamento (X,
46
+ * enquanto há `progress`). Figma: Show Button.
47
+ */
37
48
  removable?: boolean
38
49
  /** `aria-label` do botão de remover. */
39
50
  removeLabel?: string
51
+ /** `aria-label` do botão de cancelar, durante o envio. */
52
+ cancelLabel?: string
40
53
  }
41
54
 
42
55
  const {
@@ -44,15 +57,19 @@ const {
44
57
  description,
45
58
  error,
46
59
  progress,
60
+ progressLabel = 'Enviando...',
47
61
  hideIcon = false,
48
62
  link,
49
63
  removable = false,
50
64
  removeLabel = 'Remover arquivo',
65
+ cancelLabel = 'Cancelar envio',
51
66
  class: className,
52
67
  ...rest
53
68
  } = Astro.props
54
69
 
55
70
  const hasProgress = progress !== undefined
71
+ // While sending, the only action is to cancel: the link waits for the file.
72
+ const showLink = !!link && !hasProgress
56
73
  const hasCustomIcon = Astro.slots.has('icon')
57
74
  ---
58
75
 
@@ -77,14 +94,19 @@ const hasCustomIcon = Astro.slots.has('icon')
77
94
  {description && <span class="au-file-upload-preview__description">{description}</span>}
78
95
  </span>
79
96
  {
80
- (link || removable) && (
97
+ (showLink || removable) && (
81
98
  <span class="au-file-upload-preview__actions">
82
- {link && (
83
- <LinkButton as={link.href ? 'a' : 'button'} href={link.href} target={link.target} size="small" class="au-file-upload-preview__link">{link.label}</LinkButton>
99
+ {showLink && (
100
+ <LinkButton as={link!.href ? 'a' : 'button'} href={link!.href} target={link!.target} size="small" class="au-file-upload-preview__link">{link!.label}</LinkButton>
84
101
  )}
102
+ {showLink && removable && <span class="au-file-upload-preview__actions-divider" aria-hidden="true" />}
85
103
  {removable && (
86
- <button type="button" class="au-file-upload-preview__remove" aria-label={removeLabel} data-au-file-upload="remove">
87
- <IconTrash2 />
104
+ <button
105
+ type="button"
106
+ class:list={['au-file-upload-preview__remove', hasProgress && 'au-file-upload-preview__remove--cancel']}
107
+ aria-label={hasProgress ? cancelLabel : removeLabel}
108
+ data-au-file-upload="remove">
109
+ {hasProgress ? <IconX /> : <IconTrash2 />}
88
110
  </button>
89
111
  )}
90
112
  </span>
@@ -95,7 +117,7 @@ const hasCustomIcon = Astro.slots.has('icon')
95
117
  {
96
118
  hasProgress && (
97
119
  <div class="au-file-upload-preview__progress">
98
- <ProgressBar percentage={progress} stepName={`Envio de ${name}`} showDescription={false} />
120
+ <ProgressBar percentage={progress} stepName={progressLabel} />
99
121
  </div>
100
122
  )
101
123
  }
@@ -11,7 +11,8 @@ export type FileUploadType = 'drag-drop' | 'button'
11
11
  * the root emits `au:fileuploadchange` (`detail: { files: File[] }`) when
12
12
  * files are picked in the dialog or dropped on the area, and the native
13
13
  * `change` of the input still fires for the dialog. `children` is the
14
- * default slot (the `FileUpload.Preview` rows). The `data-drop-title` on the
14
+ * default slot (the `FileUpload.Preview` rows). The Only Button's button
15
+ * opens the dialog through the controller; the Drag & Drop has no button. The `data-drop-title` on the
15
16
  * root is wiring for the controller, which removes it when it starts. Every
16
17
  * other HTML attribute lands on the root `div`.
17
18
  */
@@ -31,8 +32,8 @@ export type Props = HTMLAttributes<'div'> & {
31
32
  /** Formatos aceitos e tamanho máximo, antes do envio. Sem ele o texto some (Show Helper Text=False). */
32
33
  helperText?: string
33
34
  /**
34
- * Rótulo do botão Outlined. No Drag & Drop o botão só aparece com ele (Show Button); no Only Button
35
- * é o botão principal ('Anexar arquivo' por padrão).
35
+ * Rótulo do botão Outlined do Only Button ('Anexar arquivo' por padrão). Ignorado no Drag & Drop:
36
+ * ali a área inteira é o controle e não há botão dentro dela.
36
37
  */
37
38
  buttonLabel?: string
38
39
  /**
@@ -71,7 +72,7 @@ const {
71
72
  const inputId = id ?? `au-file-upload-${crypto.randomUUID().slice(0, 8)}`
72
73
  const isDragDrop = type === 'drag-drop'
73
74
  const resolvedTitle = title ?? DEFAULT_TITLE[type]
74
- const resolvedButtonLabel = isDragDrop ? buttonLabel : buttonLabel ?? 'Anexar arquivo'
75
+ const resolvedButtonLabel = isDragDrop ? undefined : buttonLabel ?? 'Anexar arquivo'
75
76
  const hasText = !hideTitle || !!helperText
76
77
  const hasFiles = Astro.slots.has('default')
77
78
  ---
@@ -118,7 +119,7 @@ const hasFiles = Astro.slots.has('default')
118
119
  {
119
120
  resolvedButtonLabel && (
120
121
  <Button type="outlined" size="medium" disabled={disabled} class="au-file-upload__button">
121
- {!isDragDrop && <IconUpload />}
122
+ <IconUpload />
122
123
  {resolvedButtonLabel}
123
124
  </Button>
124
125
  )
@@ -12,19 +12,30 @@ export type FileUploadPreviewProps = {
12
12
  description?: string;
13
13
  /** Mensagem de erro abaixo da linha, com o motivo e o próximo passo; liga o estado Error. Figma: Error Message, State=Error. */
14
14
  error?: string;
15
- /** Percentual do envio, de 0 a 100; mostra a Percentage Bar abaixo da linha. Figma: Show Progress. */
15
+ /**
16
+ * Percentual do envio, de 0 a 100: a linha entra no estado Enviando, com a Percentage Bar abaixo
17
+ * (rótulo e percentual) e só o X de cancelar à direita; o link e a lixeira aparecem quando o envio
18
+ * termina. Figma: Show Progress.
19
+ */
16
20
  progress?: number;
21
+ /** Rótulo à esquerda da barra durante o envio. @default 'Enviando...' */
22
+ progressLabel?: string;
17
23
  /** Troca o ícone padrão (paperclip, 20px). Figma: Switch Icon. */
18
24
  icon?: ReactNode;
19
25
  /** Esconde o quadro do ícone. Figma: Show Leading Icon=False. */
20
26
  hideIcon?: boolean;
21
- /** Link Button small à direita ("Ver"). Figma: Show Link. */
27
+ /** Link Button small à direita ("Ver"), só com o arquivo já enviado. Figma: Show Link. */
22
28
  link?: FileUploadPreviewLink;
23
- /** Botão de remover (Ghost, ícone, 40x40). Sem ele o botão some (Show Button=False). */
29
+ /**
30
+ * Remove o arquivo enviado (lixeira) ou cancela o envio em andamento (X, enquanto há `progress`).
31
+ * Sem ele o botão some (Show Button=False).
32
+ */
24
33
  onRemove?: () => void;
25
34
  /** `aria-label` do botão de remover. @default 'Remover arquivo' */
26
35
  removeLabel?: string;
36
+ /** `aria-label` do botão de cancelar, durante o envio. @default 'Cancelar envio' */
37
+ cancelLabel?: string;
27
38
  className?: string;
28
39
  'data-testid'?: string;
29
40
  };
30
- export declare const FileUploadPreview: ({ name, description, error, progress, icon, hideIcon, link, onRemove, removeLabel, className, "data-testid": dataTestId, }: FileUploadPreviewProps) => import("react/jsx-runtime").JSX.Element;
41
+ export declare const FileUploadPreview: ({ name, description, error, progress, progressLabel, icon, hideIcon, link, onRemove, removeLabel, cancelLabel, className, "data-testid": dataTestId, }: FileUploadPreviewProps) => import("react/jsx-runtime").JSX.Element;
@@ -6,21 +6,25 @@ import "react";
6
6
  import "../../Icon/index.es.js";
7
7
  import { IconPaperclip } from "../../icons/IconPaperclip/index.es.js";
8
8
  import { IconTrash2 } from "../../icons/IconTrash2/index.es.js";
9
+ import { IconX } from "../../icons/IconX/index.es.js";
9
10
  import '../../styles/styles.css';/* empty css */
10
11
  const FileUploadPreview = ({
11
12
  name,
12
13
  description,
13
14
  error,
14
15
  progress,
16
+ progressLabel = "Enviando...",
15
17
  icon,
16
18
  hideIcon = false,
17
19
  link,
18
20
  onRemove,
19
21
  removeLabel = "Remover arquivo",
22
+ cancelLabel = "Cancelar envio",
20
23
  className,
21
24
  "data-testid": dataTestId
22
25
  }) => {
23
26
  const hasProgress = progress !== void 0;
27
+ const showLink = !!link && !hasProgress;
24
28
  const classes = classNames("au-file-upload-preview", {
25
29
  "au-file-upload-preview--error": !!error,
26
30
  "au-file-upload-preview--with-progress": hasProgress,
@@ -33,13 +37,23 @@ const FileUploadPreview = ({
33
37
  /* @__PURE__ */ jsx("span", { className: "au-file-upload-preview__name", children: name }),
34
38
  description && /* @__PURE__ */ jsx("span", { className: "au-file-upload-preview__description", children: description })
35
39
  ] }),
36
- (link || onRemove) && /* @__PURE__ */ jsxs("span", { className: "au-file-upload-preview__actions", children: [
37
- link && (link.href ? /* @__PURE__ */ jsx(LinkButton, { as: "a", href: link.href, target: link.target, size: "small", className: "au-file-upload-preview__link", onClick: link.onClick, children: link.label }) : /* @__PURE__ */ jsx(LinkButton, { size: "small", className: "au-file-upload-preview__link", onClick: link.onClick, children: link.label })),
38
- onRemove && /* @__PURE__ */ jsx("button", { type: "button", className: "au-file-upload-preview__remove", "aria-label": removeLabel, onClick: onRemove, children: /* @__PURE__ */ jsx(IconTrash2, {}) })
40
+ (showLink || onRemove) && /* @__PURE__ */ jsxs("span", { className: "au-file-upload-preview__actions", children: [
41
+ showLink && (link.href ? /* @__PURE__ */ jsx(LinkButton, { as: "a", href: link.href, target: link.target, size: "small", className: "au-file-upload-preview__link", onClick: link.onClick, children: link.label }) : /* @__PURE__ */ jsx(LinkButton, { size: "small", className: "au-file-upload-preview__link", onClick: link.onClick, children: link.label })),
42
+ showLink && onRemove && /* @__PURE__ */ jsx("span", { className: "au-file-upload-preview__actions-divider", "aria-hidden": "true" }),
43
+ onRemove && /* @__PURE__ */ jsx(
44
+ "button",
45
+ {
46
+ type: "button",
47
+ className: classNames("au-file-upload-preview__remove", { "au-file-upload-preview__remove--cancel": hasProgress }),
48
+ "aria-label": hasProgress ? cancelLabel : removeLabel,
49
+ onClick: onRemove,
50
+ children: hasProgress ? /* @__PURE__ */ jsx(IconX, {}) : /* @__PURE__ */ jsx(IconTrash2, {})
51
+ }
52
+ )
39
53
  ] })
40
54
  ] }),
41
55
  error && /* @__PURE__ */ jsx("span", { className: "au-file-upload-preview__error", children: error }),
42
- hasProgress && /* @__PURE__ */ jsx("div", { className: "au-file-upload-preview__progress", children: /* @__PURE__ */ jsx(ProgressBar, { percentage: progress, stepName: `Envio de ${name}`, showDescription: false }) })
56
+ hasProgress && /* @__PURE__ */ jsx("div", { className: "au-file-upload-preview__progress", children: /* @__PURE__ */ jsx(ProgressBar, { percentage: progress, stepName: progressLabel }) })
43
57
  ] });
44
58
  };
45
59
  export {
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../lib/components/FileUpload/Preview/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { LinkButton } from '@components/LinkButton'\nimport { ProgressBar } from '@components/ProgressBar'\nimport { IconPaperclip, IconTrash2 } from '@components/icons'\nimport '../styles.scss'\n\nexport type FileUploadPreviewLink = {\n label: string\n href?: string\n target?: string\n onClick?: () => void\n}\n\nexport type FileUploadPreviewProps = {\n /** Nome do arquivo. Figma: File Name. */\n name: string\n /** Tamanho (\"1,2 MB\") ou status (\"Enviando... 30%\"). Figma: Description. */\n description?: string\n /** Mensagem de erro abaixo da linha, com o motivo e o próximo passo; liga o estado Error. Figma: Error Message, State=Error. */\n error?: string\n /** Percentual do envio, de 0 a 100; mostra a Percentage Bar abaixo da linha. Figma: Show Progress. */\n progress?: number\n /** Troca o ícone padrão (paperclip, 20px). Figma: Switch Icon. */\n icon?: ReactNode\n /** Esconde o quadro do ícone. Figma: Show Leading Icon=False. */\n hideIcon?: boolean\n /** Link Button small à direita (\"Ver\"). Figma: Show Link. */\n link?: FileUploadPreviewLink\n /** Botão de remover (Ghost, ícone, 40x40). Sem ele o botão some (Show Button=False). */\n onRemove?: () => void\n /** `aria-label` do botão de remover. @default 'Remover arquivo' */\n removeLabel?: string\n className?: string\n 'data-testid'?: string\n}\n\nexport const FileUploadPreview = ({\n name,\n description,\n error,\n progress,\n icon,\n hideIcon = false,\n link,\n onRemove,\n removeLabel = 'Remover arquivo',\n className,\n 'data-testid': dataTestId,\n}: FileUploadPreviewProps) => {\n const hasProgress = progress !== undefined\n const classes = classNames('au-file-upload-preview', {\n 'au-file-upload-preview--error': !!error,\n 'au-file-upload-preview--with-progress': hasProgress,\n [className!]: !!className,\n })\n\n return (\n <div className={classes} data-testid={dataTestId}>\n <div className=\"au-file-upload-preview__row\">\n {!hideIcon && (\n <span className=\"au-file-upload-preview__icon\" aria-hidden=\"true\">\n {icon ?? <IconPaperclip />}\n </span>\n )}\n <span className=\"au-file-upload-preview__text\">\n <span className=\"au-file-upload-preview__name\">{name}</span>\n {description && <span className=\"au-file-upload-preview__description\">{description}</span>}\n </span>\n {(link || onRemove) && (\n <span className=\"au-file-upload-preview__actions\">\n {link &&\n (link.href ? (\n <LinkButton as=\"a\" href={link.href} target={link.target} size=\"small\" className=\"au-file-upload-preview__link\" onClick={link.onClick}>\n {link.label}\n </LinkButton>\n ) : (\n <LinkButton size=\"small\" className=\"au-file-upload-preview__link\" onClick={link.onClick}>\n {link.label}\n </LinkButton>\n ))}\n {onRemove && (\n <button type=\"button\" className=\"au-file-upload-preview__remove\" aria-label={removeLabel} onClick={onRemove}>\n <IconTrash2 />\n </button>\n )}\n </span>\n )}\n </div>\n {error && <span className=\"au-file-upload-preview__error\">{error}</span>}\n {hasProgress && (\n <div className=\"au-file-upload-preview__progress\">\n <ProgressBar percentage={progress} stepName={`Envio de ${name}`} showDescription={false} />\n </div>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;AAqCO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA,eAAe;AACjB,MAA8B;AAC5B,QAAM,cAAc,aAAa;AACjC,QAAM,UAAU,WAAW,0BAA0B;AAAA,IACnD,iCAAiC,CAAC,CAAC;AAAA,IACnC,yCAAyC;AAAA,IACzC,CAAC,SAAU,GAAG,CAAC,CAAC;AAAA,EAAA,CACjB;AAED,SACE,qBAAC,OAAA,EAAI,WAAW,SAAS,eAAa,YACpC,UAAA;AAAA,IAAA,qBAAC,OAAA,EAAI,WAAU,+BACZ,UAAA;AAAA,MAAA,CAAC,YACA,oBAAC,QAAA,EAAK,WAAU,gCAA+B,eAAY,QACxD,UAAA,QAAQ,oBAAC,eAAA,CAAA,CAAc,EAAA,CAC1B;AAAA,MAEF,qBAAC,QAAA,EAAK,WAAU,gCACd,UAAA;AAAA,QAAA,oBAAC,QAAA,EAAK,WAAU,gCAAgC,UAAA,MAAK;AAAA,QACpD,eAAe,oBAAC,QAAA,EAAK,WAAU,uCAAuC,UAAA,YAAA,CAAY;AAAA,MAAA,GACrF;AAAA,OACE,QAAQ,aACR,qBAAC,QAAA,EAAK,WAAU,mCACb,UAAA;AAAA,QAAA,SACE,KAAK,OACJ,oBAAC,YAAA,EAAW,IAAG,KAAI,MAAM,KAAK,MAAM,QAAQ,KAAK,QAAQ,MAAK,SAAQ,WAAU,gCAA+B,SAAS,KAAK,SAC1H,UAAA,KAAK,MAAA,CACR,wBAEC,YAAA,EAAW,MAAK,SAAQ,WAAU,gCAA+B,SAAS,KAAK,SAC7E,eAAK,MAAA,CACR;AAAA,QAEH,YACC,oBAAC,UAAA,EAAO,MAAK,UAAS,WAAU,kCAAiC,cAAY,aAAa,SAAS,UACjG,UAAA,oBAAC,cAAW,EAAA,CACd;AAAA,MAAA,EAAA,CAEJ;AAAA,IAAA,GAEJ;AAAA,IACC,SAAS,oBAAC,QAAA,EAAK,WAAU,iCAAiC,UAAA,OAAM;AAAA,IAChE,eACC,oBAAC,OAAA,EAAI,WAAU,oCACb,UAAA,oBAAC,aAAA,EAAY,YAAY,UAAU,UAAU,YAAY,IAAI,IAAI,iBAAiB,OAAO,EAAA,CAC3F;AAAA,EAAA,GAEJ;AAEJ;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../../lib/components/FileUpload/Preview/index.tsx"],"sourcesContent":["import { ReactNode } from 'react'\nimport classNames from 'classnames'\nimport { LinkButton } from '@components/LinkButton'\nimport { ProgressBar } from '@components/ProgressBar'\nimport { IconPaperclip, IconTrash2, IconX } from '@components/icons'\nimport '../styles.scss'\n\nexport type FileUploadPreviewLink = {\n label: string\n href?: string\n target?: string\n onClick?: () => void\n}\n\nexport type FileUploadPreviewProps = {\n /** Nome do arquivo. Figma: File Name. */\n name: string\n /** Tamanho (\"1,2 MB\") ou status (\"Enviando... 30%\"). Figma: Description. */\n description?: string\n /** Mensagem de erro abaixo da linha, com o motivo e o próximo passo; liga o estado Error. Figma: Error Message, State=Error. */\n error?: string\n /**\n * Percentual do envio, de 0 a 100: a linha entra no estado Enviando, com a Percentage Bar abaixo\n * (rótulo e percentual) e só o X de cancelar à direita; o link e a lixeira aparecem quando o envio\n * termina. Figma: Show Progress.\n */\n progress?: number\n /** Rótulo à esquerda da barra durante o envio. @default 'Enviando...' */\n progressLabel?: string\n /** Troca o ícone padrão (paperclip, 20px). Figma: Switch Icon. */\n icon?: ReactNode\n /** Esconde o quadro do ícone. Figma: Show Leading Icon=False. */\n hideIcon?: boolean\n /** Link Button small à direita (\"Ver\"), só com o arquivo já enviado. Figma: Show Link. */\n link?: FileUploadPreviewLink\n /**\n * Remove o arquivo enviado (lixeira) ou cancela o envio em andamento (X, enquanto há `progress`).\n * Sem ele o botão some (Show Button=False).\n */\n onRemove?: () => void\n /** `aria-label` do botão de remover. @default 'Remover arquivo' */\n removeLabel?: string\n /** `aria-label` do botão de cancelar, durante o envio. @default 'Cancelar envio' */\n cancelLabel?: string\n className?: string\n 'data-testid'?: string\n}\n\nexport const FileUploadPreview = ({\n name,\n description,\n error,\n progress,\n progressLabel = 'Enviando...',\n icon,\n hideIcon = false,\n link,\n onRemove,\n removeLabel = 'Remover arquivo',\n cancelLabel = 'Cancelar envio',\n className,\n 'data-testid': dataTestId,\n}: FileUploadPreviewProps) => {\n const hasProgress = progress !== undefined\n // While sending, the only action is to cancel: the link waits for the file.\n const showLink = !!link && !hasProgress\n const classes = classNames('au-file-upload-preview', {\n 'au-file-upload-preview--error': !!error,\n 'au-file-upload-preview--with-progress': hasProgress,\n [className!]: !!className,\n })\n\n return (\n <div className={classes} data-testid={dataTestId}>\n <div className=\"au-file-upload-preview__row\">\n {!hideIcon && (\n <span className=\"au-file-upload-preview__icon\" aria-hidden=\"true\">\n {icon ?? <IconPaperclip />}\n </span>\n )}\n <span className=\"au-file-upload-preview__text\">\n <span className=\"au-file-upload-preview__name\">{name}</span>\n {description && <span className=\"au-file-upload-preview__description\">{description}</span>}\n </span>\n {(showLink || onRemove) && (\n <span className=\"au-file-upload-preview__actions\">\n {showLink &&\n (link.href ? (\n <LinkButton as=\"a\" href={link.href} target={link.target} size=\"small\" className=\"au-file-upload-preview__link\" onClick={link.onClick}>\n {link.label}\n </LinkButton>\n ) : (\n <LinkButton size=\"small\" className=\"au-file-upload-preview__link\" onClick={link.onClick}>\n {link.label}\n </LinkButton>\n ))}\n {showLink && onRemove && <span className=\"au-file-upload-preview__actions-divider\" aria-hidden=\"true\" />}\n {onRemove && (\n <button\n type=\"button\"\n className={classNames('au-file-upload-preview__remove', { 'au-file-upload-preview__remove--cancel': hasProgress })}\n aria-label={hasProgress ? cancelLabel : removeLabel}\n onClick={onRemove}>\n {hasProgress ? <IconX /> : <IconTrash2 />}\n </button>\n )}\n </span>\n )}\n </div>\n {error && <span className=\"au-file-upload-preview__error\">{error}</span>}\n {hasProgress && (\n <div className=\"au-file-upload-preview__progress\">\n <ProgressBar percentage={progress} stepName={progressLabel} />\n </div>\n )}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;;;;AAgDO,MAAM,oBAAoB,CAAC;AAAA,EAChC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,cAAc;AAAA,EACd;AAAA,EACA,eAAe;AACjB,MAA8B;AAC5B,QAAM,cAAc,aAAa;AAEjC,QAAM,WAAW,CAAC,CAAC,QAAQ,CAAC;AAC5B,QAAM,UAAU,WAAW,0BAA0B;AAAA,IACnD,iCAAiC,CAAC,CAAC;AAAA,IACnC,yCAAyC;AAAA,IACzC,CAAC,SAAU,GAAG,CAAC,CAAC;AAAA,EAAA,CACjB;AAED,SACE,qBAAC,OAAA,EAAI,WAAW,SAAS,eAAa,YAC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AA,EAAA,GAEJ;AAEJ;"}
@@ -16,8 +16,8 @@ export type FileUploadRootProps = {
16
16
  /** Formatos aceitos e tamanho máximo, antes do envio. Sem ele o texto some (Show Helper Text=False). */
17
17
  helperText?: string;
18
18
  /**
19
- * Rótulo do botão Outlined. No Drag & Drop o botão só aparece com ele (Show Button); no Only Button
20
- * é o botão principal, com @default 'Anexar arquivo'.
19
+ * Rótulo do botão Outlined do Only Button, com @default 'Anexar arquivo'. Ignorado no Drag & Drop:
20
+ * ali a área inteira é o controle e não há botão dentro dela.
21
21
  */
22
22
  buttonLabel?: string;
23
23
  /**
@@ -37,7 +37,7 @@ const FileUploadRoot = ({
37
37
  const [dragging, setDragging] = useState(false);
38
38
  const isDragDrop = type === "drag-drop";
39
39
  const resolvedTitle = title ?? DEFAULT_TITLE[type];
40
- const resolvedButtonLabel = isDragDrop ? buttonLabel : buttonLabel ?? "Anexar arquivo";
40
+ const resolvedButtonLabel = isDragDrop ? void 0 : buttonLabel ?? "Anexar arquivo";
41
41
  const hasText = !hideTitle || !!helperText;
42
42
  const classes = classNames("au-file-upload", `au-file-upload--type-${type}`, {
43
43
  "au-file-upload--disabled": disabled,
@@ -115,7 +115,7 @@ const FileUploadRoot = ({
115
115
  className: "au-file-upload__button",
116
116
  onClick: openDialog,
117
117
  children: [
118
- !isDragDrop && /* @__PURE__ */ jsx(IconUpload, {}),
118
+ /* @__PURE__ */ jsx(IconUpload, {}),
119
119
  resolvedButtonLabel
120
120
  ]
121
121
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.es.js","sources":["../../../../lib/components/FileUpload/Root/index.tsx"],"sourcesContent":["import { ChangeEvent, DragEvent, ReactNode, useId, useRef, useState } from 'react'\nimport classNames from 'classnames'\nimport { Button } from '@components/Button'\nimport { IconUpload } from '@components/icons'\nimport '../styles.scss'\n\nexport type FileUploadType = 'drag-drop' | 'button'\n\nexport type FileUploadRootProps = {\n /**\n * Drag & Drop (área tracejada que aceita arrastar ou clicar, para telas em que anexar é a ação\n * principal) ou Only Button (título, texto de apoio e botão, para formulários e espaços curtos).\n * Figma: Type.\n */\n type?: FileUploadType\n /** Título da área. @default 'Arraste o arquivo ou clique aqui' no Drag & Drop, 'Anexar arquivo' no Only Button. Figma: Title. */\n title?: string\n /** Esconde o título quando o card ou a seção em volta já diz o que anexar. Figma: Show Title=False. */\n hideTitle?: boolean\n /** Título mostrado enquanto um arquivo é arrastado sobre a área. @default 'Solte o arquivo para enviar' */\n dropTitle?: string\n /** Formatos aceitos e tamanho máximo, antes do envio. Sem ele o texto some (Show Helper Text=False). */\n helperText?: string\n /**\n * Rótulo do botão Outlined. No Drag & Drop o botão só aparece com ele (Show Button); no Only Button\n * é o botão principal, com @default 'Anexar arquivo'.\n */\n buttonLabel?: string\n /**\n * `accept` do input de arquivo (`.png,.jpg,.pdf`). Filtra só o diálogo: um arquivo solto na área\n * chega ao `onChange` seja qual for o tipo, para o app recusar e explicar no Alert de erro abaixo\n * da área (\"Formato não aceito\"), como a spec pede. A validação de tipo e tamanho é do consumidor.\n */\n accept?: string\n multiple?: boolean\n disabled?: boolean\n name?: string\n id?: string\n /** Arquivos escolhidos no diálogo ou soltos na área; com `multiple` desligado, só o primeiro. */\n onChange?: (files: File[]) => void\n /** As linhas `FileUpload.Preview`, empilhadas logo abaixo da área com 8px entre elas. */\n children?: ReactNode\n className?: string\n 'data-testid'?: string\n}\n\nconst DEFAULT_TITLE: Record<FileUploadType, string> = {\n 'drag-drop': 'Arraste o arquivo ou clique aqui',\n button: 'Anexar arquivo',\n}\n\n/** Caps the picked or dropped files to the input's `multiple`. The Astro controller has a copy. */\nfunction _pickFiles(list: FileList | null, multiple: boolean): File[] {\n const files = Array.from(list ?? [])\n return multiple ? files : files.slice(0, 1)\n}\n\nexport const FileUploadRoot = ({\n type = 'drag-drop',\n title,\n hideTitle = false,\n dropTitle = 'Solte o arquivo para enviar',\n helperText,\n buttonLabel,\n accept,\n multiple = false,\n disabled = false,\n name,\n id,\n onChange,\n children,\n className,\n 'data-testid': dataTestId,\n}: FileUploadRootProps) => {\n const generatedId = `au-file-upload-${useId().replace(/[^a-zA-Z0-9]/g, '')}`\n const inputId = id ?? generatedId\n const inputRef = useRef<HTMLInputElement>(null)\n // Nested dragenter/dragleave pairs: the area is \"dragging\" while the count is above zero.\n const dragDepth = useRef(0)\n const [dragging, setDragging] = useState(false)\n\n const isDragDrop = type === 'drag-drop'\n const resolvedTitle = title ?? DEFAULT_TITLE[type]\n const resolvedButtonLabel = isDragDrop ? buttonLabel : buttonLabel ?? 'Anexar arquivo'\n const hasText = !hideTitle || !!helperText\n\n const classes = classNames('au-file-upload', `au-file-upload--type-${type}`, {\n 'au-file-upload--disabled': disabled,\n 'au-file-upload--dragging': dragging,\n [className!]: !!className,\n })\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(_pickFiles(event.target.files, multiple))\n // Lets the same file be picked twice in a row.\n event.target.value = ''\n }\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n dragDepth.current += 1\n setDragging(true)\n }\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n }\n\n const handleDragLeave = () => {\n if (disabled || !isDragDrop) return\n dragDepth.current = Math.max(0, dragDepth.current - 1)\n if (dragDepth.current === 0) setDragging(false)\n }\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n dragDepth.current = 0\n setDragging(false)\n onChange?.(_pickFiles(event.dataTransfer.files, multiple))\n }\n\n const openDialog = () => inputRef.current?.click()\n\n return (\n <div className={classes} data-testid={dataTestId}>\n <div\n className=\"au-file-upload__area\"\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}>\n <input\n ref={inputRef}\n className=\"au-file-upload__input\"\n type=\"file\"\n id={inputId}\n name={name}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n // In the Only Button the button is the focusable control; the input stays out of the tab order.\n tabIndex={isDragDrop ? undefined : -1}\n aria-label={hideTitle ? resolvedTitle : undefined}\n aria-describedby={helperText ? `${inputId}-helper` : undefined}\n onChange={handleChange}\n />\n {isDragDrop && (\n <span className=\"au-file-upload__icon\" aria-hidden=\"true\">\n <IconUpload />\n </span>\n )}\n {hasText && (\n <span className=\"au-file-upload__text\">\n {!hideTitle && (\n <label htmlFor={inputId} className=\"au-file-upload__title\">\n {dragging ? dropTitle : resolvedTitle}\n </label>\n )}\n {helperText && (\n <span id={`${inputId}-helper`} className=\"au-file-upload__helper\">\n {helperText}\n </span>\n )}\n </span>\n )}\n {resolvedButtonLabel && (\n <Button\n type=\"outlined\"\n size=\"medium\"\n disabled={disabled}\n className=\"au-file-upload__button\"\n onClick={openDialog}>\n {!isDragDrop && <IconUpload />}\n {resolvedButtonLabel}\n </Button>\n )}\n </div>\n {children && <div className=\"au-file-upload__files\">{children}</div>}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;AA8CA,MAAM,gBAAgD;AAAA,EACpD,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,SAAS,WAAW,MAAuB,UAA2B;AACpE,QAAM,QAAQ,MAAM,KAAK,QAAQ,CAAA,CAAE;AACnC,SAAO,WAAW,QAAQ,MAAM,MAAM,GAAG,CAAC;AAC5C;AAEO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,OAAO;AAAA,EACP;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAA2B;AACzB,QAAM,cAAc,kBAAkB,MAAA,EAAQ,QAAQ,iBAAiB,EAAE,CAAC;AAC1E,QAAM,UAAU,MAAM;AACtB,QAAM,WAAW,OAAyB,IAAI;AAE9C,Q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AAAA,QACV,aAAa;AAAA,QACb,YAAY;AAAA,QACZ,aAAa;AAAA,QACb,QAAQ;AAAA,QACR,UAAA;AAAA,UAAA;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,KAAK;AAAA,cACL,WAAU;AAAA,cACV,MAAK;AAAA,cACL,IAAI;AAAA,cACJ;AAAA,cACA;AAAA,cACA;AAAA,cACA;AAAA,cAEA,UAAU,aAAa,SAAY;AAAA,cACnC,cAAY,YAAY,gBAAgB;AAAA,cACxC,oBAAkB,aAAa,GAAG,OAAO,YAAY;AAAA,cACrD,UAAU;AAAA,YAAA;AAAA,UAAA;AAAA,UAEX,kCACE,QAAA,EAAK,WAAU,wBAAuB,eAAY,QACjD,UAAA,oBAAC,YAAA,CAAA,CAAW,EAAA,CACd;AAAA,UAED,WACC,qBAAC,QAAA,EAAK,WAAU,wBACb,UAAA;AAAA,YAAA,CAAC,iCACC,SAAA,EAAM,SAAS,SAAS,WAAU,yBAChC,UAAA,WAAW,YAAY,cAAA,CAC1B;AAAA,YAED,kCACE,QAAA,EAAK,IAAI,GAAG,OAAO,WAAW,WAAU,0BACtC,UAAA,WAAA,CACH;AAAA,UAAA,GAEJ;AAAA,UAED,uBACC;AAAA,YAAC;AAAA,YAAA;AAAA,cACC,MAAK;AAAA,cACL,MAAK;AAAA,cACL;AAAA,cACA,WAAU;AAAA,cACV,SAAS;AAAA,cACR,UAAA;AAAA,gBAAA,CAAC,kCAAe,YAAA,EAAW;AAAA,gBAC3B;AAAA,cAAA;AAAA,YAAA;AAAA,UAAA;AAAA,QACH;AAAA,MAAA;AAAA,IAAA;AAAA,IAGH,YAAY,oBAAC,OAAA,EAAI,WAAU,yBAAyB,SAAA,CAAS;AAAA,EAAA,GAChE;AAEJ;"}
1
+ {"version":3,"file":"index.es.js","sources":["../../../../lib/components/FileUpload/Root/index.tsx"],"sourcesContent":["import { ChangeEvent, DragEvent, ReactNode, useId, useRef, useState } from 'react'\nimport classNames from 'classnames'\nimport { Button } from '@components/Button'\nimport { IconUpload } from '@components/icons'\nimport '../styles.scss'\n\nexport type FileUploadType = 'drag-drop' | 'button'\n\nexport type FileUploadRootProps = {\n /**\n * Drag & Drop (área tracejada que aceita arrastar ou clicar, para telas em que anexar é a ação\n * principal) ou Only Button (título, texto de apoio e botão, para formulários e espaços curtos).\n * Figma: Type.\n */\n type?: FileUploadType\n /** Título da área. @default 'Arraste o arquivo ou clique aqui' no Drag & Drop, 'Anexar arquivo' no Only Button. Figma: Title. */\n title?: string\n /** Esconde o título quando o card ou a seção em volta já diz o que anexar. Figma: Show Title=False. */\n hideTitle?: boolean\n /** Título mostrado enquanto um arquivo é arrastado sobre a área. @default 'Solte o arquivo para enviar' */\n dropTitle?: string\n /** Formatos aceitos e tamanho máximo, antes do envio. Sem ele o texto some (Show Helper Text=False). */\n helperText?: string\n /**\n * Rótulo do botão Outlined do Only Button, com @default 'Anexar arquivo'. Ignorado no Drag & Drop:\n * ali a área inteira é o controle e não há botão dentro dela.\n */\n buttonLabel?: string\n /**\n * `accept` do input de arquivo (`.png,.jpg,.pdf`). Filtra só o diálogo: um arquivo solto na área\n * chega ao `onChange` seja qual for o tipo, para o app recusar e explicar no Alert de erro abaixo\n * da área (\"Formato não aceito\"), como a spec pede. A validação de tipo e tamanho é do consumidor.\n */\n accept?: string\n multiple?: boolean\n disabled?: boolean\n name?: string\n id?: string\n /** Arquivos escolhidos no diálogo ou soltos na área; com `multiple` desligado, só o primeiro. */\n onChange?: (files: File[]) => void\n /** As linhas `FileUpload.Preview`, empilhadas logo abaixo da área com 8px entre elas. */\n children?: ReactNode\n className?: string\n 'data-testid'?: string\n}\n\nconst DEFAULT_TITLE: Record<FileUploadType, string> = {\n 'drag-drop': 'Arraste o arquivo ou clique aqui',\n button: 'Anexar arquivo',\n}\n\n/** Caps the picked or dropped files to the input's `multiple`. The Astro controller has a copy. */\nfunction _pickFiles(list: FileList | null, multiple: boolean): File[] {\n const files = Array.from(list ?? [])\n return multiple ? files : files.slice(0, 1)\n}\n\nexport const FileUploadRoot = ({\n type = 'drag-drop',\n title,\n hideTitle = false,\n dropTitle = 'Solte o arquivo para enviar',\n helperText,\n buttonLabel,\n accept,\n multiple = false,\n disabled = false,\n name,\n id,\n onChange,\n children,\n className,\n 'data-testid': dataTestId,\n}: FileUploadRootProps) => {\n const generatedId = `au-file-upload-${useId().replace(/[^a-zA-Z0-9]/g, '')}`\n const inputId = id ?? generatedId\n const inputRef = useRef<HTMLInputElement>(null)\n // Nested dragenter/dragleave pairs: the area is \"dragging\" while the count is above zero.\n const dragDepth = useRef(0)\n const [dragging, setDragging] = useState(false)\n\n const isDragDrop = type === 'drag-drop'\n const resolvedTitle = title ?? DEFAULT_TITLE[type]\n const resolvedButtonLabel = isDragDrop ? undefined : buttonLabel ?? 'Anexar arquivo'\n const hasText = !hideTitle || !!helperText\n\n const classes = classNames('au-file-upload', `au-file-upload--type-${type}`, {\n 'au-file-upload--disabled': disabled,\n 'au-file-upload--dragging': dragging,\n [className!]: !!className,\n })\n\n const handleChange = (event: ChangeEvent<HTMLInputElement>) => {\n onChange?.(_pickFiles(event.target.files, multiple))\n // Lets the same file be picked twice in a row.\n event.target.value = ''\n }\n\n const handleDragEnter = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n dragDepth.current += 1\n setDragging(true)\n }\n\n const handleDragOver = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n }\n\n const handleDragLeave = () => {\n if (disabled || !isDragDrop) return\n dragDepth.current = Math.max(0, dragDepth.current - 1)\n if (dragDepth.current === 0) setDragging(false)\n }\n\n const handleDrop = (event: DragEvent<HTMLDivElement>) => {\n if (disabled || !isDragDrop) return\n event.preventDefault()\n dragDepth.current = 0\n setDragging(false)\n onChange?.(_pickFiles(event.dataTransfer.files, multiple))\n }\n\n const openDialog = () => inputRef.current?.click()\n\n return (\n <div className={classes} data-testid={dataTestId}>\n <div\n className=\"au-file-upload__area\"\n onDragEnter={handleDragEnter}\n onDragOver={handleDragOver}\n onDragLeave={handleDragLeave}\n onDrop={handleDrop}>\n <input\n ref={inputRef}\n className=\"au-file-upload__input\"\n type=\"file\"\n id={inputId}\n name={name}\n accept={accept}\n multiple={multiple}\n disabled={disabled}\n // In the Only Button the button is the focusable control; the input stays out of the tab order.\n tabIndex={isDragDrop ? undefined : -1}\n aria-label={hideTitle ? resolvedTitle : undefined}\n aria-describedby={helperText ? `${inputId}-helper` : undefined}\n onChange={handleChange}\n />\n {isDragDrop && (\n <span className=\"au-file-upload__icon\" aria-hidden=\"true\">\n <IconUpload />\n </span>\n )}\n {hasText && (\n <span className=\"au-file-upload__text\">\n {!hideTitle && (\n <label htmlFor={inputId} className=\"au-file-upload__title\">\n {dragging ? dropTitle : resolvedTitle}\n </label>\n )}\n {helperText && (\n <span id={`${inputId}-helper`} className=\"au-file-upload__helper\">\n {helperText}\n </span>\n )}\n </span>\n )}\n {resolvedButtonLabel && (\n <Button\n type=\"outlined\"\n size=\"medium\"\n disabled={disabled}\n className=\"au-file-upload__button\"\n onClick={openDialog}>\n <IconUpload />\n {resolvedButtonLabel}\n </Button>\n )}\n </div>\n {children && <div className=\"au-file-upload__files\">{children}</div>}\n </div>\n )\n}\n"],"names":[],"mappings":";;;;;;;AA8CA,MAAM,gBAAgD;AAAA,EACpD,aAAa;AAAA,EACb,QAAQ;AACV;AAGA,SAAS,WAAW,MAAuB,UAA2B;AACpE,QAAM,QAAQ,MAAM,KAAK,QAAQ,CAAA,CAAE;AACnC,SAAO,WAAW,QAAQ,MAAM,MAAM,GAAG,CAAC;AAC5C;AAEO,MAAM,iBAAiB,CAAC;AAAA,EAC7B,OAAO;AAAA,EACP;AAAA,EACA,YAAY;AAAA,EACZ,YAAY;AAAA,EACZ;AAAA,EACA;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX,WAAW;AAAA,EACX;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,eAAe;AACjB,MAA2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-upload{display:flex;flex-direction:column;width:100%}.au-file-upload__area{position:relative;display:flex;flex-direction:column;gap:12px;box-sizing:border-box;width:100%;font-family:"Source Sans 3",sans-serif}.au-file-upload--type-drag-drop .au-file-upload__area{align-items:center;padding:24px;text-align:center;background-color:#fff;border:1px dashed #c4c9d4;border-radius:16px;transition:background-color .3s ease,border-color .3s ease}.au-file-upload--type-drag-drop .au-file-upload__input{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.au-file-upload--type-drag-drop .au-file-upload__button{position:relative;z-index:1;margin-top:4px}.au-file-upload--type-drag-drop:not(.au-file-upload--disabled) .au-file-upload__area:hover,.au-file-upload--type-drag-drop.au-file-upload--dragging .au-file-upload__area{background-color:#f2f5fc;border-color:#0048db}.au-file-upload--type-drag-drop .au-file-upload__area:has(>.au-file-upload__input:focus-visible){border-style:solid;border-color:#0048db;outline:1px solid #0048db}.au-file-upload--type-drag-drop.au-file-upload--disabled .au-file-upload__area{background-color:#f6f7fa;border-color:#e2e4e9}.au-file-upload--type-drag-drop.au-file-upload--disabled .au-file-upload__input{cursor:default}.au-file-upload--type-button .au-file-upload__area{align-items:flex-start;gap:16px;text-align:start}.au-file-upload--type-button .au-file-upload__input{position:absolute;width:1px;height:1px;margin:0;overflow:hidden;opacity:0;pointer-events:none}.au-file-upload__icon{display:flex;align-items:center;justify-content:center}.au-file-upload__text{display:flex;flex-direction:column;gap:4px}.au-file-upload__title{font-size:14px;line-height:22px;font-weight:600;color:#454a54}.au-file-upload__helper{font-size:14px;line-height:22px;color:#5e6573}.au-file-upload--disabled .au-file-upload__title,.au-file-upload--disabled .au-file-upload__helper{color:#c4c9d4}.au-file-upload--disabled .au-file-upload__icon .au-icon,.au-file-upload--disabled .au-file-upload__icon .au-icon>svg{color:#c4c9d4}.au-file-upload__files{display:flex;flex-direction:column;gap:8px;margin-top:8px}.au-file-upload-preview{display:flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%;padding:12px 16px;font-family:"Source Sans 3",sans-serif;background-color:#fff;border:1px solid #e2e4e9;border-radius:8px}.au-file-upload-preview__row{display:flex;align-items:center;gap:12px}.au-file-upload-preview__icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:40px;height:40px;background-color:#f6f7fa;border-radius:8px}.au-file-upload-preview__icon .au-icon,.au-file-upload-preview__icon .au-icon>svg{color:#313131}.au-file-upload-preview--error .au-file-upload-preview__icon{background-color:#ffe5e5}.au-file-upload-preview--error .au-file-upload-preview__icon .au-icon,.au-file-upload-preview--error .au-file-upload-preview__icon .au-icon>svg{color:#991717}.au-file-upload-preview__text{display:flex;flex:1;flex-direction:column;min-width:0}.au-file-upload-preview__name{overflow:hidden;font-size:14px;line-height:22px;font-weight:600;color:#454a54;text-overflow:ellipsis;white-space:nowrap}.au-file-upload-preview__description{font-size:12px;line-height:19px;color:#5e6573}.au-file-upload-preview__actions{display:flex;flex-shrink:0;align-items:center;gap:10px}.au-file-upload-preview__remove{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:8px;background-color:transparent;border:none;border-radius:999px;cursor:pointer;transition:background-color .3s ease}.au-file-upload-preview__remove:hover,.au-file-upload-preview__remove:focus-visible{background-color:#f2f5fc}.au-file-upload-preview__remove:active{background-color:#dce8ff}.au-file-upload-preview__error{font-size:12px;line-height:19px;color:#991717}.au-file-upload-preview__progress{width:100%}
1
+ .au-file-upload{display:flex;flex-direction:column;width:100%}.au-file-upload__area{position:relative;display:flex;flex-direction:column;gap:12px;box-sizing:border-box;width:100%;font-family:"Source Sans 3",sans-serif}.au-file-upload--type-drag-drop .au-file-upload__area{align-items:center;padding:24px;text-align:center;background-color:#fff;border:1px dashed #c4c9d4;border-radius:16px;transition:background-color .3s ease,border-color .3s ease}.au-file-upload--type-drag-drop .au-file-upload__input{position:absolute;top:0;right:0;bottom:0;left:0;width:100%;height:100%;margin:0;opacity:0;cursor:pointer}.au-file-upload--type-drag-drop:not(.au-file-upload--disabled) .au-file-upload__area:hover,.au-file-upload--type-drag-drop.au-file-upload--dragging .au-file-upload__area{background-color:#f2f5fc;border-color:#0048db}.au-file-upload--type-drag-drop .au-file-upload__area:has(>.au-file-upload__input:focus-visible){border-style:solid;border-color:#0048db;outline:1px solid #0048db}.au-file-upload--type-drag-drop.au-file-upload--disabled .au-file-upload__area{background-color:#f6f7fa;border-color:#e2e4e9}.au-file-upload--type-drag-drop.au-file-upload--disabled .au-file-upload__input{cursor:default}.au-file-upload--type-button .au-file-upload__area{align-items:flex-start;gap:16px;text-align:start}.au-file-upload--type-button .au-file-upload__input{position:absolute;width:1px;height:1px;margin:0;overflow:hidden;opacity:0;pointer-events:none}.au-file-upload__icon{display:flex;align-items:center;justify-content:center}.au-file-upload__text{display:flex;flex-direction:column}.au-file-upload--type-button .au-file-upload__text{gap:8px}.au-file-upload__title{font-size:14px;line-height:22px;font-weight:600;color:#454a54}.au-file-upload__helper{font-size:14px;line-height:22px;color:#5e6573}.au-file-upload--disabled .au-file-upload__title,.au-file-upload--disabled .au-file-upload__helper{color:#c4c9d4}.au-file-upload--disabled .au-file-upload__icon .au-icon,.au-file-upload--disabled .au-file-upload__icon .au-icon>svg{color:#c4c9d4}.au-file-upload__files{display:flex;flex-direction:column;gap:8px;margin-top:8px}.au-file-upload-preview{display:flex;flex-direction:column;gap:8px;box-sizing:border-box;width:100%;padding:14px 12px;font-family:"Source Sans 3",sans-serif;background-color:#fff;border:1px solid #e2e4e9;border-radius:8px}.au-file-upload-preview__row{display:flex;align-items:center;gap:12px}.au-file-upload-preview__icon{display:flex;flex-shrink:0;align-items:center;justify-content:center;width:40px;height:40px;background-color:#f6f7fa;border-radius:8px}.au-file-upload-preview__icon .au-icon,.au-file-upload-preview__icon .au-icon>svg{color:#313131}.au-file-upload-preview--error .au-file-upload-preview__icon{background-color:#ffe5e5}.au-file-upload-preview--error .au-file-upload-preview__icon .au-icon,.au-file-upload-preview--error .au-file-upload-preview__icon .au-icon>svg{color:#991717}.au-file-upload-preview__text{display:flex;flex:1;flex-direction:column;min-width:0}.au-file-upload-preview__name{overflow:hidden;font-size:14px;line-height:22px;font-weight:600;color:#454a54;text-overflow:ellipsis;white-space:nowrap}.au-file-upload-preview__description{font-size:12px;line-height:19px;color:#5e6573}.au-file-upload-preview__actions{display:flex;flex-shrink:0;align-items:center;gap:10px}.au-file-upload-preview .au-file-upload-preview__link{min-height:40px;padding:0 16px;margin:0 -16px}.au-file-upload-preview__actions-divider{width:0;height:40px;border-left:1px solid #F2F5FC}.au-file-upload-preview__remove{display:flex;align-items:center;justify-content:center;width:40px;height:40px;padding:8px;background-color:transparent;border:none;border-radius:999px;cursor:pointer;transition:background-color .3s ease}.au-file-upload-preview__remove:hover,.au-file-upload-preview__remove:focus-visible{background-color:#f2f5fc}.au-file-upload-preview__remove:active{background-color:#dce8ff}.au-file-upload-preview__error{margin-top:12px;font-size:12px;line-height:19px;color:#991717}.au-file-upload-preview__progress{width:100%}.au-file-upload-preview__progress .au-progress-bar{gap:12px}.au-file-upload-preview__progress .au-progress-bar__text .au-text{font-size:12px;line-height:19px}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@consumidor-positivo/aurora",
3
3
  "private": false,
4
- "version": "3.2.0",
4
+ "version": "3.2.1",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "https://github.com/AcordoCertoBR/aurora"