@consumidor-positivo/aurora 3.0.1 → 3.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/section-app/default-score-desktop.png +0 -0
- package/assets/section-app/default-score-mobile.png +0 -0
- package/assets/section-app/re-score-desktop.png +0 -0
- package/assets/section-app/re-score-mobile.png +0 -0
- package/astro/BadgeState/index.astro +4 -0
- package/astro/DropdownItem/index.astro +121 -0
- package/astro/EmptyState/index.astro +134 -0
- package/astro/FeedbackPage/index.astro +112 -0
- package/astro/FileUpload/Preview/index.astro +102 -0
- package/astro/FileUpload/Root/index.astro +205 -0
- package/astro/ListRow/index.astro +241 -0
- package/astro/SearchBar/index.astro +432 -0
- package/astro/SectionApp/index.astro +202 -0
- package/astro/form/Checkbox/Field/index.astro +1 -1
- package/astro/form/Field/ErrorMessage/index.astro +1 -1
- package/astro/form/Field/Input/index.astro +1 -1
- package/astro/form/Field/InputHolder/index.astro +1 -1
- package/astro/form/Field/Label/index.astro +1 -1
- package/astro/form/Field/Message/index.astro +1 -1
- package/astro/form/Field/Root/index.astro +1 -1
- package/astro/form/Field/TextArea/index.astro +1 -1
- package/dist/components/DropdownItem/index.d.ts +25 -0
- package/dist/components/DropdownItem/index.es.js +89 -0
- package/dist/components/DropdownItem/index.es.js.map +1 -0
- package/dist/components/DropdownItem/styles.css +1 -0
- package/dist/components/EmptyState/index.d.ts +37 -0
- package/dist/components/EmptyState/index.es.js +67 -0
- package/dist/components/EmptyState/index.es.js.map +1 -0
- package/dist/components/EmptyState/styles.css +1 -0
- package/dist/components/FeedbackPage/index.d.ts +26 -0
- package/dist/components/FeedbackPage/index.es.js +64 -0
- package/dist/components/FeedbackPage/index.es.js.map +1 -0
- package/dist/components/FeedbackPage/styles.css +1 -0
- package/dist/components/Field/styles.css +1 -1
- package/dist/components/Field/styles2.css +1 -1
- package/dist/components/FileUpload/Preview/index.d.ts +30 -0
- package/dist/components/FileUpload/Preview/index.es.js +48 -0
- package/dist/components/FileUpload/Preview/index.es.js.map +1 -0
- package/dist/components/FileUpload/Root/index.d.ts +40 -0
- package/dist/components/FileUpload/Root/index.es.js +132 -0
- package/dist/components/FileUpload/Root/index.es.js.map +1 -0
- package/dist/components/FileUpload/index.d.ts +10 -0
- package/dist/components/FileUpload/index.es.js +15 -0
- package/dist/components/FileUpload/index.es.js.map +1 -0
- package/dist/components/Footer/index.es.js +2 -74
- package/dist/components/Footer/index.es.js.map +1 -1
- package/dist/components/ListRow/index.d.ts +65 -0
- package/dist/components/ListRow/index.es.js +137 -0
- package/dist/components/ListRow/index.es.js.map +1 -0
- package/dist/components/ListRow/styles.css +1 -0
- package/dist/components/SearchBar/hooks.d.ts +36 -0
- package/dist/components/SearchBar/index.d.ts +3 -0
- package/dist/components/SearchBar/index.es.js +319 -0
- package/dist/components/SearchBar/index.es.js.map +1 -0
- package/dist/components/SearchBar/styles.css +1 -0
- package/dist/components/SearchBar/types.d.ts +41 -0
- package/dist/components/SectionApp/index.d.ts +39 -0
- package/dist/components/SectionApp/index.es.js +95 -0
- package/dist/components/SectionApp/index.es.js.map +1 -0
- package/dist/components/SectionApp/styles.css +1 -0
- package/dist/components/form/Checkbox/Field/index.es.js +1 -1
- package/dist/components/form/Field/index.es.js +1 -1
- package/dist/components/styles/styles.css +1 -0
- package/dist/data-CpVzbjKR.js +81 -0
- package/dist/data-CpVzbjKR.js.map +1 -0
- package/dist/main.d.ts +7 -0
- package/dist/main.es.js +14 -0
- package/dist/main.es.js.map +1 -1
- package/package.json +5 -3
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -47,6 +47,10 @@ const {
|
|
|
47
47
|
text,
|
|
48
48
|
iconOnly = false,
|
|
49
49
|
class: className,
|
|
50
|
+
// Passed as `<BadgeState slot="trailing" />` (the DropdownItem trailing)
|
|
51
|
+
// the `slot` arrives as a prop; spread into `...rest` it would render as a
|
|
52
|
+
// stray `slot` attribute.
|
|
53
|
+
slot: _slot,
|
|
50
54
|
...rest
|
|
51
55
|
} = Astro.props
|
|
52
56
|
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import IconCheck from '../icons/default/IconCheck.astro'
|
|
4
|
+
import CheckboxField from '../form/Checkbox/Field/index.astro'
|
|
5
|
+
import Skeleton from '../Skeleton/index.astro'
|
|
6
|
+
import Spinner from '../Spinner/index.astro'
|
|
7
|
+
import '../../dist/components/DropdownItem/styles.css'
|
|
8
|
+
|
|
9
|
+
export type DropdownItemType = 'item' | 'category'
|
|
10
|
+
export type DropdownItemState = 'default' | 'loading' | 'skeleton' | 'empty'
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Same props and markup as the React `DropdownItem` (Figma: Dropdown
|
|
14
|
+
* Instance). Differences from React: `leading` and `trailing` are the
|
|
15
|
+
* `leading` and `trailing` named slots; `onClick` has no counterpart (forward
|
|
16
|
+
* an `id` or `data-*`, or use it inside a `SearchBar`, which emits
|
|
17
|
+
* `au:searchselect`). Every HTML attribute lands on the `<li>`.
|
|
18
|
+
*/
|
|
19
|
+
export type Props = HTMLAttributes<'li'> & {
|
|
20
|
+
/** Item (opção que a pessoa toca) ou Category (título de grupo, só texto). Figma: Dropdown Instance, Type. */
|
|
21
|
+
type?: DropdownItemType
|
|
22
|
+
label: string
|
|
23
|
+
/** Segunda linha abaixo do label (Description=True). Só no tipo item. */
|
|
24
|
+
description?: string
|
|
25
|
+
/** Troca o leading pelo `Checkbox.Field` da lib (Show Checkbox), para lista de seleção múltipla; `selected` marca o checkbox em vez de pintar o item. */
|
|
26
|
+
checkbox?: boolean
|
|
27
|
+
/** Fundo action-subtle, label em azul e check à direita (State=Selected). */
|
|
28
|
+
selected?: boolean
|
|
29
|
+
disabled?: boolean
|
|
30
|
+
/** Estados sem conteúdo (State=Loading, Skeleton e Empty): só sem description. */
|
|
31
|
+
state?: DropdownItemState
|
|
32
|
+
/** Foco virtual da navegação por teclado (State=Focus): quem tem o foco real é o campo. */
|
|
33
|
+
focused?: boolean
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const {
|
|
37
|
+
type = 'item',
|
|
38
|
+
label,
|
|
39
|
+
description,
|
|
40
|
+
checkbox = false,
|
|
41
|
+
selected = false,
|
|
42
|
+
disabled = false,
|
|
43
|
+
state = 'default',
|
|
44
|
+
focused = false,
|
|
45
|
+
class: className,
|
|
46
|
+
role,
|
|
47
|
+
// Passed as `<DropdownItem slot="x" />` the `slot` arrives as a prop; spread
|
|
48
|
+
// into `...rest` it would render as a stray `slot` attribute.
|
|
49
|
+
slot: _slot,
|
|
50
|
+
...rest
|
|
51
|
+
} = Astro.props
|
|
52
|
+
|
|
53
|
+
const isCategory = type === 'category'
|
|
54
|
+
const isItem = !isCategory && state === 'default'
|
|
55
|
+
const hasLeading = Astro.slots.has('leading')
|
|
56
|
+
const hasTrailing = Astro.slots.has('trailing')
|
|
57
|
+
const showTrailing = selected && !checkbox ? true : hasTrailing
|
|
58
|
+
|
|
59
|
+
const classes = [
|
|
60
|
+
'au-dropdown-item',
|
|
61
|
+
`au-dropdown-item--type-${type}`,
|
|
62
|
+
isItem && description && 'au-dropdown-item--with-description',
|
|
63
|
+
isItem && checkbox && 'au-dropdown-item--with-checkbox',
|
|
64
|
+
isItem && selected && 'au-dropdown-item--selected',
|
|
65
|
+
isItem && disabled && 'au-dropdown-item--disabled',
|
|
66
|
+
isItem && focused && 'au-dropdown-item--focused',
|
|
67
|
+
!isCategory && state !== 'default' && `au-dropdown-item--state-${state}`,
|
|
68
|
+
className,
|
|
69
|
+
]
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
{
|
|
73
|
+
isCategory ? (
|
|
74
|
+
<li class:list={classes} role={role ?? 'presentation'} {...rest}>
|
|
75
|
+
<span class="au-dropdown-item__label">{label}</span>
|
|
76
|
+
</li>
|
|
77
|
+
) : state === 'loading' ? (
|
|
78
|
+
<li class:list={classes} role={role ?? 'presentation'} {...rest}>
|
|
79
|
+
<Spinner size="small" />
|
|
80
|
+
</li>
|
|
81
|
+
) : state === 'skeleton' ? (
|
|
82
|
+
<li class:list={classes} role={role ?? 'presentation'} aria-hidden="true" {...rest}>
|
|
83
|
+
<Skeleton shape="circle" width={20} height={20} />
|
|
84
|
+
<Skeleton block height={20} />
|
|
85
|
+
</li>
|
|
86
|
+
) : state === 'empty' ? (
|
|
87
|
+
<li class:list={classes} role={role ?? 'option'} aria-selected="false" aria-disabled="true" {...rest}>
|
|
88
|
+
<span class="au-dropdown-item__content">
|
|
89
|
+
<span class="au-dropdown-item__label">{label}</span>
|
|
90
|
+
</span>
|
|
91
|
+
</li>
|
|
92
|
+
) : (
|
|
93
|
+
<li
|
|
94
|
+
class:list={classes}
|
|
95
|
+
role={role ?? 'option'}
|
|
96
|
+
aria-selected={selected ? 'true' : 'false'}
|
|
97
|
+
aria-disabled={disabled ? 'true' : undefined}
|
|
98
|
+
{...rest}>
|
|
99
|
+
{checkbox ? (
|
|
100
|
+
<span class="au-dropdown-item__leading" aria-hidden="true">
|
|
101
|
+
<CheckboxField checked={selected} disabled={disabled} readonly tabindex="-1" />
|
|
102
|
+
</span>
|
|
103
|
+
) : (
|
|
104
|
+
hasLeading && (
|
|
105
|
+
<span class="au-dropdown-item__leading" aria-hidden="true">
|
|
106
|
+
<slot name="leading" />
|
|
107
|
+
</span>
|
|
108
|
+
)
|
|
109
|
+
)}
|
|
110
|
+
<span class="au-dropdown-item__content">
|
|
111
|
+
<span class="au-dropdown-item__label">{label}</span>
|
|
112
|
+
{description && <span class="au-dropdown-item__description">{description}</span>}
|
|
113
|
+
</span>
|
|
114
|
+
{showTrailing && (
|
|
115
|
+
<span class="au-dropdown-item__trailing" aria-hidden="true">
|
|
116
|
+
{selected && !checkbox ? <IconCheck /> : <slot name="trailing" />}
|
|
117
|
+
</span>
|
|
118
|
+
)}
|
|
119
|
+
</li>
|
|
120
|
+
)
|
|
121
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Button from '../Button/index.astro'
|
|
4
|
+
import Text from '../Text/index.astro'
|
|
5
|
+
import IconArchive from '../icons/default/IconArchive.astro'
|
|
6
|
+
import IconSearch from '../icons/default/IconSearch.astro'
|
|
7
|
+
import '../../dist/components/EmptyState/styles.css'
|
|
8
|
+
|
|
9
|
+
export type EmptyStateType = 'card' | 'plain' | 'search-result'
|
|
10
|
+
export type EmptyStateSize = 'mobile' | 'desktop'
|
|
11
|
+
|
|
12
|
+
export type EmptyStateAction = {
|
|
13
|
+
label: string
|
|
14
|
+
/** Com `href`, o botão sai como link (`<a>`). */
|
|
15
|
+
href?: string
|
|
16
|
+
target?: string
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Same props and markup as the React `EmptyState`. `icon` is the `icon` slot
|
|
21
|
+
* and `illustration` the `illustration` slot. No `onClick` on the actions:
|
|
22
|
+
* the buttons carry `data-au-empty-state="primary"` and
|
|
23
|
+
* `data-au-empty-state="secondary"` for the page's own `<script>`, or an
|
|
24
|
+
* `href` makes them links. Every HTML attribute is forwarded to the
|
|
25
|
+
* `<section>`.
|
|
26
|
+
*/
|
|
27
|
+
export type Props = HTMLAttributes<'section'> & {
|
|
28
|
+
/**
|
|
29
|
+
* Card (borda e cantos arredondados, para áreas com limite visual próprio), Plain (solto na página ou
|
|
30
|
+
* dentro de algo que já tem borda) ou Search Result (busca ou filtro sem resultado: ícone de busca fixo
|
|
31
|
+
* e sem botões). Figma: Style.
|
|
32
|
+
*/
|
|
33
|
+
type?: EmptyStateType
|
|
34
|
+
title: string
|
|
35
|
+
description?: string
|
|
36
|
+
/** Esconde o ícone sem colocar nada no lugar. Figma: Show Icon=False. */
|
|
37
|
+
hideIcon?: boolean
|
|
38
|
+
/** Botão Outlined, a ação que resolve o vazio. Sem ele não há botões (Show Actions=False). Search Result nunca tem botões. */
|
|
39
|
+
primaryAction?: EmptyStateAction
|
|
40
|
+
/** Botão Ghost, o caminho alternativo. Só aparece junto do primeiro (Show Secondary Button=False o desliga). */
|
|
41
|
+
secondaryAction?: EmptyStateAction
|
|
42
|
+
/** Força o layout Mobile (descrição 14/22) ou Desktop (16/24). Sem ela, segue o breakpoint de 1024px. Figma: Size. */
|
|
43
|
+
size?: EmptyStateSize
|
|
44
|
+
/** Tag do título. */
|
|
45
|
+
titleAs?: 'h2' | 'h3' | 'h4'
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
type = 'card',
|
|
50
|
+
title,
|
|
51
|
+
description,
|
|
52
|
+
hideIcon = false,
|
|
53
|
+
primaryAction,
|
|
54
|
+
secondaryAction,
|
|
55
|
+
size,
|
|
56
|
+
titleAs = 'h3',
|
|
57
|
+
class: className,
|
|
58
|
+
...rest
|
|
59
|
+
} = Astro.props
|
|
60
|
+
|
|
61
|
+
// Stand in for the React `useId()`.
|
|
62
|
+
const titleId = `au-empty-state-${crypto.randomUUID().slice(0, 8)}-title`
|
|
63
|
+
const isSearch = type === 'search-result'
|
|
64
|
+
const showIllustration = Astro.slots.has('illustration')
|
|
65
|
+
const showIcon = !showIllustration && !hideIcon
|
|
66
|
+
const hasCustomIcon = Astro.slots.has('icon')
|
|
67
|
+
// Search Result has no actions: the way out is adjusting the search. Visual
|
|
68
|
+
// order of the Figma: the Ghost (secondary) on the left, the Outlined on the right.
|
|
69
|
+
const actions = (
|
|
70
|
+
!isSearch && primaryAction
|
|
71
|
+
? [
|
|
72
|
+
{ kind: 'secondary' as const, action: secondaryAction },
|
|
73
|
+
{ kind: 'primary' as const, action: primaryAction },
|
|
74
|
+
]
|
|
75
|
+
: []
|
|
76
|
+
).filter((item): item is { kind: 'primary' | 'secondary'; action: EmptyStateAction } => !!item.action)
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
<section
|
|
80
|
+
class:list={[
|
|
81
|
+
'au-empty-state',
|
|
82
|
+
`au-empty-state--type-${type}`,
|
|
83
|
+
size && `au-empty-state--size-${size}`,
|
|
84
|
+
actions.length > 0 && 'au-empty-state--with-actions',
|
|
85
|
+
showIllustration && 'au-empty-state--with-illustration',
|
|
86
|
+
className,
|
|
87
|
+
]}
|
|
88
|
+
aria-labelledby={titleId}
|
|
89
|
+
{...rest}>
|
|
90
|
+
{
|
|
91
|
+
showIllustration && (
|
|
92
|
+
<div class="au-empty-state__illustration">
|
|
93
|
+
<slot name="illustration" />
|
|
94
|
+
</div>
|
|
95
|
+
)
|
|
96
|
+
}
|
|
97
|
+
{
|
|
98
|
+
showIcon && (
|
|
99
|
+
<div class="au-empty-state__icon" aria-hidden="true">
|
|
100
|
+
{isSearch ? <IconSearch /> : hasCustomIcon ? <slot name="icon" /> : <IconArchive />}
|
|
101
|
+
</div>
|
|
102
|
+
)
|
|
103
|
+
}
|
|
104
|
+
<div class="au-empty-state__content">
|
|
105
|
+
<Text as={titleAs} id={titleId} variant="body-medium" weight="semibold" class="au-empty-state__title">
|
|
106
|
+
{title}
|
|
107
|
+
</Text>
|
|
108
|
+
{
|
|
109
|
+
description && (
|
|
110
|
+
<Text as="p" variant="body-small" color="secondary" class="au-empty-state__description">
|
|
111
|
+
{description}
|
|
112
|
+
</Text>
|
|
113
|
+
)
|
|
114
|
+
}
|
|
115
|
+
</div>
|
|
116
|
+
{
|
|
117
|
+
actions.length > 0 && (
|
|
118
|
+
<div class="au-empty-state__actions">
|
|
119
|
+
{actions.map(({ kind, action }) => (
|
|
120
|
+
<Button
|
|
121
|
+
as={action.href ? 'a' : 'button'}
|
|
122
|
+
href={action.href}
|
|
123
|
+
target={action.target}
|
|
124
|
+
type={kind === 'primary' ? 'outlined' : 'ghost'}
|
|
125
|
+
size="medium"
|
|
126
|
+
class:list={['au-empty-state__action', `au-empty-state__action--${kind}`]}
|
|
127
|
+
data-au-empty-state={kind}>
|
|
128
|
+
{action.label}
|
|
129
|
+
</Button>
|
|
130
|
+
))}
|
|
131
|
+
</div>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
</section>
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Button from '../Button/index.astro'
|
|
4
|
+
import Text from '../Text/index.astro'
|
|
5
|
+
import IconAlertOctagon from '../icons/default/IconAlertOctagon.astro'
|
|
6
|
+
import IconCheckCircle from '../icons/default/IconCheckCircle.astro'
|
|
7
|
+
import IconRefreshCw from '../icons/default/IconRefreshCw.astro'
|
|
8
|
+
import '../../dist/components/FeedbackPage/styles.css'
|
|
9
|
+
|
|
10
|
+
export type FeedbackPageType = 'error' | 'success' | 'warning'
|
|
11
|
+
export type FeedbackPageSize = 'mobile' | 'desktop'
|
|
12
|
+
|
|
13
|
+
export type FeedbackPageAction = {
|
|
14
|
+
label: string
|
|
15
|
+
/** Com `href`, o botão sai como link (`<a>`). */
|
|
16
|
+
href?: string
|
|
17
|
+
target?: string
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Same props and markup as the React `FeedbackPage`. No `onClick` on the
|
|
22
|
+
* actions: the buttons carry `data-au-feedback-page="primary"` and
|
|
23
|
+
* `data-au-feedback-page="secondary"` for the page's own `<script>`, or an
|
|
24
|
+
* `href` makes them links. Every HTML attribute is forwarded to the
|
|
25
|
+
* `<section>`.
|
|
26
|
+
*/
|
|
27
|
+
export type Props = HTMLAttributes<'section'> & {
|
|
28
|
+
/** Error (falhou), Success (deu certo) ou Warning (pede atenção ou espera). Figma: Feedback Page, Type. */
|
|
29
|
+
type?: FeedbackPageType
|
|
30
|
+
title: string
|
|
31
|
+
description?: string
|
|
32
|
+
/** Primeiro botão, Outlined: a ação que resolve. Sem ele a tela sai sem botões (Show Buttons=False). */
|
|
33
|
+
primaryAction?: FeedbackPageAction
|
|
34
|
+
/** Segundo botão, Ghost: o caminho de volta. Só aparece junto do primeiro (Only 1 Button=False o desliga). */
|
|
35
|
+
secondaryAction?: FeedbackPageAction
|
|
36
|
+
/** Força o layout Mobile (botões empilhados) ou Desktop (lado a lado). Sem ela, segue o breakpoint de 1024px. Figma: Size. */
|
|
37
|
+
size?: FeedbackPageSize
|
|
38
|
+
/** Tag do título. */
|
|
39
|
+
titleAs?: 'h1' | 'h2' | 'h3'
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const ICONS = {
|
|
43
|
+
error: IconAlertOctagon,
|
|
44
|
+
success: IconCheckCircle,
|
|
45
|
+
warning: IconRefreshCw,
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
const {
|
|
49
|
+
type = 'error',
|
|
50
|
+
title,
|
|
51
|
+
description,
|
|
52
|
+
primaryAction,
|
|
53
|
+
secondaryAction,
|
|
54
|
+
size,
|
|
55
|
+
titleAs = 'h1',
|
|
56
|
+
class: className,
|
|
57
|
+
...rest
|
|
58
|
+
} = Astro.props
|
|
59
|
+
|
|
60
|
+
// Stand in for the React `useId()`.
|
|
61
|
+
const titleId = `au-feedback-page-${crypto.randomUUID().slice(0, 8)}-title`
|
|
62
|
+
const Icon = ICONS[type]
|
|
63
|
+
const actions = primaryAction ? [primaryAction, secondaryAction].filter(Boolean) : []
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
<section
|
|
67
|
+
class:list={[
|
|
68
|
+
'au-feedback-page',
|
|
69
|
+
`au-feedback-page--type-${type}`,
|
|
70
|
+
size && `au-feedback-page--size-${size}`,
|
|
71
|
+
actions.length > 0 && 'au-feedback-page--with-actions',
|
|
72
|
+
className,
|
|
73
|
+
]}
|
|
74
|
+
aria-labelledby={titleId}
|
|
75
|
+
{...rest}>
|
|
76
|
+
<div class="au-feedback-page__icon" aria-hidden="true">
|
|
77
|
+
<span class="au-feedback-page__icon-circle">
|
|
78
|
+
<Icon size="medium" />
|
|
79
|
+
</span>
|
|
80
|
+
</div>
|
|
81
|
+
<Text as={titleAs} id={titleId} variant="heading-medium" weight="semibold" class="au-feedback-page__title">
|
|
82
|
+
{title}
|
|
83
|
+
</Text>
|
|
84
|
+
{
|
|
85
|
+
description && (
|
|
86
|
+
<Text as="p" variant="body-medium" color="secondary" class="au-feedback-page__description">
|
|
87
|
+
{description}
|
|
88
|
+
</Text>
|
|
89
|
+
)
|
|
90
|
+
}
|
|
91
|
+
{
|
|
92
|
+
actions.length > 0 && (
|
|
93
|
+
<div class="au-feedback-page__actions">
|
|
94
|
+
{actions.map((action, index) => (
|
|
95
|
+
<Button
|
|
96
|
+
as={action!.href ? 'a' : 'button'}
|
|
97
|
+
href={action!.href}
|
|
98
|
+
target={action!.target}
|
|
99
|
+
type={index === 0 ? 'outlined' : 'ghost'}
|
|
100
|
+
size="medium"
|
|
101
|
+
class:list={[
|
|
102
|
+
'au-feedback-page__action',
|
|
103
|
+
index === 0 ? 'au-feedback-page__action--primary' : 'au-feedback-page__action--secondary',
|
|
104
|
+
]}
|
|
105
|
+
data-au-feedback-page={index === 0 ? 'primary' : 'secondary'}>
|
|
106
|
+
{action!.label}
|
|
107
|
+
</Button>
|
|
108
|
+
))}
|
|
109
|
+
</div>
|
|
110
|
+
)
|
|
111
|
+
}
|
|
112
|
+
</section>
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import LinkButton from '../../LinkButton/index.astro'
|
|
4
|
+
import ProgressBar from '../../ProgressBar/index.astro'
|
|
5
|
+
import IconPaperclip from '../../icons/default/IconPaperclip.astro'
|
|
6
|
+
import IconTrash2 from '../../icons/default/IconTrash2.astro'
|
|
7
|
+
import '../../../dist/components/styles/styles.css'
|
|
8
|
+
|
|
9
|
+
export type FileUploadPreviewLink = {
|
|
10
|
+
label: string
|
|
11
|
+
href?: string
|
|
12
|
+
target?: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 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
|
|
19
|
+
* link has no `onClick` either, so give it an `href` or listen on
|
|
20
|
+
* `.au-file-upload-preview__link`. Every other HTML attribute lands on the
|
|
21
|
+
* root `div`.
|
|
22
|
+
*/
|
|
23
|
+
export type Props = HTMLAttributes<'div'> & {
|
|
24
|
+
/** Nome do arquivo. Figma: File Name. */
|
|
25
|
+
name: string
|
|
26
|
+
/** Tamanho ("1,2 MB") ou status ("Enviando... 30%"). Figma: Description. */
|
|
27
|
+
description?: string
|
|
28
|
+
/** Mensagem de erro abaixo da linha, com o motivo e o próximo passo; liga o estado Error. Figma: Error Message, State=Error. */
|
|
29
|
+
error?: string
|
|
30
|
+
/** Percentual do envio, de 0 a 100; mostra a Percentage Bar abaixo da linha. Figma: Show Progress. */
|
|
31
|
+
progress?: number
|
|
32
|
+
/** Esconde o quadro do ícone. Figma: Show Leading Icon=False. */
|
|
33
|
+
hideIcon?: boolean
|
|
34
|
+
/** Link Button small à direita ("Ver"). Figma: Show Link. */
|
|
35
|
+
link?: FileUploadPreviewLink
|
|
36
|
+
/** Mostra o botão de remover (Ghost, ícone, 40x40). Figma: Show Button. */
|
|
37
|
+
removable?: boolean
|
|
38
|
+
/** `aria-label` do botão de remover. */
|
|
39
|
+
removeLabel?: string
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const {
|
|
43
|
+
name,
|
|
44
|
+
description,
|
|
45
|
+
error,
|
|
46
|
+
progress,
|
|
47
|
+
hideIcon = false,
|
|
48
|
+
link,
|
|
49
|
+
removable = false,
|
|
50
|
+
removeLabel = 'Remover arquivo',
|
|
51
|
+
class: className,
|
|
52
|
+
...rest
|
|
53
|
+
} = Astro.props
|
|
54
|
+
|
|
55
|
+
const hasProgress = progress !== undefined
|
|
56
|
+
const hasCustomIcon = Astro.slots.has('icon')
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
<div
|
|
60
|
+
class:list={[
|
|
61
|
+
'au-file-upload-preview',
|
|
62
|
+
error && 'au-file-upload-preview--error',
|
|
63
|
+
hasProgress && 'au-file-upload-preview--with-progress',
|
|
64
|
+
className,
|
|
65
|
+
]}
|
|
66
|
+
{...rest}>
|
|
67
|
+
<div class="au-file-upload-preview__row">
|
|
68
|
+
{
|
|
69
|
+
!hideIcon && (
|
|
70
|
+
<span class="au-file-upload-preview__icon" aria-hidden="true">
|
|
71
|
+
{hasCustomIcon ? <slot name="icon" /> : <IconPaperclip />}
|
|
72
|
+
</span>
|
|
73
|
+
)
|
|
74
|
+
}
|
|
75
|
+
<span class="au-file-upload-preview__text">
|
|
76
|
+
<span class="au-file-upload-preview__name">{name}</span>
|
|
77
|
+
{description && <span class="au-file-upload-preview__description">{description}</span>}
|
|
78
|
+
</span>
|
|
79
|
+
{
|
|
80
|
+
(link || removable) && (
|
|
81
|
+
<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>
|
|
84
|
+
)}
|
|
85
|
+
{removable && (
|
|
86
|
+
<button type="button" class="au-file-upload-preview__remove" aria-label={removeLabel} data-au-file-upload="remove">
|
|
87
|
+
<IconTrash2 />
|
|
88
|
+
</button>
|
|
89
|
+
)}
|
|
90
|
+
</span>
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
</div>
|
|
94
|
+
{error && <span class="au-file-upload-preview__error">{error}</span>}
|
|
95
|
+
{
|
|
96
|
+
hasProgress && (
|
|
97
|
+
<div class="au-file-upload-preview__progress">
|
|
98
|
+
<ProgressBar percentage={progress} stepName={`Envio de ${name}`} showDescription={false} />
|
|
99
|
+
</div>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
</div>
|