@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
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Button from '../../Button/index.astro'
|
|
4
|
+
import IconUpload from '../../icons/default/IconUpload.astro'
|
|
5
|
+
import '../../../dist/components/styles/styles.css'
|
|
6
|
+
|
|
7
|
+
export type FileUploadType = 'drag-drop' | 'button'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Same markup as the React `FileUpload.Root`. `onChange` has no counterpart:
|
|
11
|
+
* the root emits `au:fileuploadchange` (`detail: { files: File[] }`) when
|
|
12
|
+
* files are picked in the dialog or dropped on the area, and the native
|
|
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
|
|
15
|
+
* root is wiring for the controller, which removes it when it starts. Every
|
|
16
|
+
* other HTML attribute lands on the root `div`.
|
|
17
|
+
*/
|
|
18
|
+
export type Props = HTMLAttributes<'div'> & {
|
|
19
|
+
/**
|
|
20
|
+
* Drag & Drop (área tracejada que aceita arrastar ou clicar, para telas em que anexar é a ação
|
|
21
|
+
* principal) ou Only Button (título, texto de apoio e botão, para formulários e espaços curtos).
|
|
22
|
+
* Figma: Type.
|
|
23
|
+
*/
|
|
24
|
+
type?: FileUploadType
|
|
25
|
+
/** Título da área. 'Arraste o arquivo ou clique aqui' no Drag & Drop, 'Anexar arquivo' no Only Button. Figma: Title. */
|
|
26
|
+
title?: string
|
|
27
|
+
/** Esconde o título quando o card ou a seção em volta já diz o que anexar. Figma: Show Title=False. */
|
|
28
|
+
hideTitle?: boolean
|
|
29
|
+
/** Título mostrado enquanto um arquivo é arrastado sobre a área. */
|
|
30
|
+
dropTitle?: string
|
|
31
|
+
/** Formatos aceitos e tamanho máximo, antes do envio. Sem ele o texto some (Show Helper Text=False). */
|
|
32
|
+
helperText?: string
|
|
33
|
+
/**
|
|
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).
|
|
36
|
+
*/
|
|
37
|
+
buttonLabel?: string
|
|
38
|
+
/**
|
|
39
|
+
* `accept` do input de arquivo (`.png,.jpg,.pdf`). Filtra só o diálogo: um arquivo solto na área
|
|
40
|
+
* sai em `au:fileuploadchange` seja qual for o tipo, para o app recusar e explicar no Alert de erro
|
|
41
|
+
* abaixo da área ("Formato não aceito"), como a spec pede. A validação de tipo e tamanho é do consumidor.
|
|
42
|
+
*/
|
|
43
|
+
accept?: string
|
|
44
|
+
multiple?: boolean
|
|
45
|
+
disabled?: boolean
|
|
46
|
+
name?: string
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const DEFAULT_TITLE: Record<FileUploadType, string> = {
|
|
50
|
+
'drag-drop': 'Arraste o arquivo ou clique aqui',
|
|
51
|
+
button: 'Anexar arquivo',
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
const {
|
|
55
|
+
type = 'drag-drop',
|
|
56
|
+
title,
|
|
57
|
+
hideTitle = false,
|
|
58
|
+
dropTitle = 'Solte o arquivo para enviar',
|
|
59
|
+
helperText,
|
|
60
|
+
buttonLabel,
|
|
61
|
+
accept,
|
|
62
|
+
multiple = false,
|
|
63
|
+
disabled = false,
|
|
64
|
+
name,
|
|
65
|
+
id,
|
|
66
|
+
class: className,
|
|
67
|
+
...rest
|
|
68
|
+
} = Astro.props
|
|
69
|
+
|
|
70
|
+
// Stand in for the React `useId()`.
|
|
71
|
+
const inputId = id ?? `au-file-upload-${crypto.randomUUID().slice(0, 8)}`
|
|
72
|
+
const isDragDrop = type === 'drag-drop'
|
|
73
|
+
const resolvedTitle = title ?? DEFAULT_TITLE[type]
|
|
74
|
+
const resolvedButtonLabel = isDragDrop ? buttonLabel : buttonLabel ?? 'Anexar arquivo'
|
|
75
|
+
const hasText = !hideTitle || !!helperText
|
|
76
|
+
const hasFiles = Astro.slots.has('default')
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
<div
|
|
80
|
+
class:list={[
|
|
81
|
+
'au-file-upload',
|
|
82
|
+
`au-file-upload--type-${type}`,
|
|
83
|
+
disabled && 'au-file-upload--disabled',
|
|
84
|
+
className,
|
|
85
|
+
]}
|
|
86
|
+
data-element="au-file-upload"
|
|
87
|
+
data-drop-title={dropTitle}
|
|
88
|
+
{...rest}>
|
|
89
|
+
<div class="au-file-upload__area">
|
|
90
|
+
<input
|
|
91
|
+
class="au-file-upload__input"
|
|
92
|
+
type="file"
|
|
93
|
+
id={inputId}
|
|
94
|
+
name={name}
|
|
95
|
+
accept={accept}
|
|
96
|
+
multiple={multiple ? '' : undefined}
|
|
97
|
+
disabled={disabled}
|
|
98
|
+
tabindex={isDragDrop ? undefined : -1}
|
|
99
|
+
aria-label={hideTitle ? resolvedTitle : undefined}
|
|
100
|
+
aria-describedby={helperText ? `${inputId}-helper` : undefined}
|
|
101
|
+
/>
|
|
102
|
+
{
|
|
103
|
+
isDragDrop && (
|
|
104
|
+
<span class="au-file-upload__icon" aria-hidden="true">
|
|
105
|
+
<IconUpload />
|
|
106
|
+
</span>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
{
|
|
110
|
+
hasText && (
|
|
111
|
+
<span class="au-file-upload__text">
|
|
112
|
+
{/* Text on the same line as the tags: a line break here renders as whitespace inside the element. */}
|
|
113
|
+
{!hideTitle && <label for={inputId} class="au-file-upload__title">{resolvedTitle}</label>}
|
|
114
|
+
{helperText && <span id={`${inputId}-helper`} class="au-file-upload__helper">{helperText}</span>}
|
|
115
|
+
</span>
|
|
116
|
+
)
|
|
117
|
+
}
|
|
118
|
+
{
|
|
119
|
+
resolvedButtonLabel && (
|
|
120
|
+
<Button type="outlined" size="medium" disabled={disabled} class="au-file-upload__button">
|
|
121
|
+
{!isDragDrop && <IconUpload />}
|
|
122
|
+
{resolvedButtonLabel}
|
|
123
|
+
</Button>
|
|
124
|
+
)
|
|
125
|
+
}
|
|
126
|
+
</div>
|
|
127
|
+
{
|
|
128
|
+
hasFiles && (
|
|
129
|
+
<div class="au-file-upload__files">
|
|
130
|
+
<slot />
|
|
131
|
+
</div>
|
|
132
|
+
)
|
|
133
|
+
}
|
|
134
|
+
</div>
|
|
135
|
+
|
|
136
|
+
<script>
|
|
137
|
+
import { elementController } from '@consumidor-positivo/aurora/astro/runtime'
|
|
138
|
+
|
|
139
|
+
// Caps the dropped files to the input's `multiple`, as `_pickFiles` in the React Root.
|
|
140
|
+
function pickFiles(list: FileList | null, multiple: boolean): File[] {
|
|
141
|
+
const files = Array.from(list ?? [])
|
|
142
|
+
return multiple ? files : files.slice(0, 1)
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
elementController('au-file-upload', ({ root, query, on, emit }) => {
|
|
146
|
+
const input = query<HTMLInputElement>('.au-file-upload__input')
|
|
147
|
+
const area = query('.au-file-upload__area')
|
|
148
|
+
const title = query('.au-file-upload__title')
|
|
149
|
+
const button = query('.au-file-upload__button')
|
|
150
|
+
if (!input || !area) return
|
|
151
|
+
|
|
152
|
+
const dropTitle = root.dataset.dropTitle ?? 'Solte o arquivo para enviar'
|
|
153
|
+
delete root.dataset.dropTitle
|
|
154
|
+
const idleTitle = title?.textContent ?? ''
|
|
155
|
+
const isDragDrop = root.classList.contains('au-file-upload--type-drag-drop')
|
|
156
|
+
// Nested dragenter/dragleave pairs: the area is "dragging" while the count is above zero.
|
|
157
|
+
let dragDepth = 0
|
|
158
|
+
|
|
159
|
+
const setDragging = (dragging: boolean) => {
|
|
160
|
+
root.classList.toggle('au-file-upload--dragging', dragging)
|
|
161
|
+
if (title) title.textContent = dragging ? dropTitle : idleTitle
|
|
162
|
+
}
|
|
163
|
+
const inArea = (event: Event) => event.target instanceof Node && area.contains(event.target)
|
|
164
|
+
const dragBlocked = (event: Event) => input.disabled || !isDragDrop || !inArea(event)
|
|
165
|
+
|
|
166
|
+
on('change', (event) => {
|
|
167
|
+
if (event.target !== input) return
|
|
168
|
+
emit('au:fileuploadchange', { files: pickFiles(input.files, input.multiple) })
|
|
169
|
+
// Lets the same file be picked twice in a row.
|
|
170
|
+
input.value = ''
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
on('dragenter', (event) => {
|
|
174
|
+
if (dragBlocked(event)) return
|
|
175
|
+
event.preventDefault()
|
|
176
|
+
dragDepth += 1
|
|
177
|
+
setDragging(true)
|
|
178
|
+
})
|
|
179
|
+
|
|
180
|
+
on('dragover', (event) => {
|
|
181
|
+
if (dragBlocked(event)) return
|
|
182
|
+
event.preventDefault()
|
|
183
|
+
})
|
|
184
|
+
|
|
185
|
+
on('dragleave', (event) => {
|
|
186
|
+
if (dragBlocked(event)) return
|
|
187
|
+
dragDepth = Math.max(0, dragDepth - 1)
|
|
188
|
+
if (dragDepth === 0) setDragging(false)
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
on('drop', (event) => {
|
|
192
|
+
if (dragBlocked(event)) return
|
|
193
|
+
event.preventDefault()
|
|
194
|
+
dragDepth = 0
|
|
195
|
+
setDragging(false)
|
|
196
|
+
emit('au:fileuploadchange', { files: pickFiles(event.dataTransfer?.files ?? null, input.multiple) })
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
on('click', (event) => {
|
|
200
|
+
if (!button || !(event.target instanceof Node) || !button.contains(event.target)) return
|
|
201
|
+
if (input.disabled) return
|
|
202
|
+
input.click()
|
|
203
|
+
})
|
|
204
|
+
})
|
|
205
|
+
</script>
|
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import BadgeState from '../BadgeState/index.astro'
|
|
4
|
+
import Divider from '../Divider/index.astro'
|
|
5
|
+
import LinkButton from '../LinkButton/index.astro'
|
|
6
|
+
import Skeleton from '../Skeleton/index.astro'
|
|
7
|
+
import Switch from '../Switch/index.astro'
|
|
8
|
+
import RadioField from '../form/Radio/Field/index.astro'
|
|
9
|
+
import IconCheck from '../icons/default/IconCheck.astro'
|
|
10
|
+
import IconChevronRight from '../icons/default/IconChevronRight.astro'
|
|
11
|
+
import '../../dist/components/ListRow/styles.css'
|
|
12
|
+
|
|
13
|
+
export type ListRowContent = 'upward' | 'downward'
|
|
14
|
+
type BadgeStatus = 'info' | 'success' | 'error' | 'warning' | 'support' | 'neutral'
|
|
15
|
+
|
|
16
|
+
export type ListRowTrackline = {
|
|
17
|
+
/** Number (etapa numerada), Check (etapa concluída) ou Badge State (etapa com status). Figma: Track line. */
|
|
18
|
+
marker?: 'number' | 'check' | 'badge'
|
|
19
|
+
/** Número da etapa, no marcador Number. */
|
|
20
|
+
number?: number
|
|
21
|
+
/** Status do BadgeState, no marcador Badge State. */
|
|
22
|
+
status?: BadgeStatus
|
|
23
|
+
/** Última etapa: sem o traço (Dash) que liga à próxima. */
|
|
24
|
+
last?: boolean
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type ListRowLink = {
|
|
28
|
+
label: string
|
|
29
|
+
href?: string
|
|
30
|
+
target?: string
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export type ListRowBadge = {
|
|
34
|
+
status: BadgeStatus
|
|
35
|
+
text: string
|
|
36
|
+
variant?: 'regular' | 'strong'
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export type ListRowRadio = {
|
|
40
|
+
name?: string
|
|
41
|
+
value?: string
|
|
42
|
+
checked?: boolean
|
|
43
|
+
disabled?: boolean
|
|
44
|
+
id?: string
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
export type ListRowToggle = {
|
|
48
|
+
name?: string
|
|
49
|
+
value?: string
|
|
50
|
+
checked?: boolean
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
id?: string
|
|
53
|
+
'aria-label'?: string
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* Same props and markup as the React `ListRow`. Differences: `icon` and
|
|
58
|
+
* `partner` are the `icon` and `partner` named slots; `radio` and `toggle`
|
|
59
|
+
* are the initial attributes of the native inputs (listen to their `change`);
|
|
60
|
+
* the link has no `onClick` (it carries `data-au-list-row="link"`) and the
|
|
61
|
+
* row has no `onClick` (an `href` makes the root an `<a>`; otherwise hook a
|
|
62
|
+
* `data-*`). Every other HTML attribute lands on the root.
|
|
63
|
+
*/
|
|
64
|
+
export type Props = Omit<HTMLAttributes<'div'>, 'content'> & {
|
|
65
|
+
label: string
|
|
66
|
+
/** Segunda linha (Multiple line no Figma). Sem ela a linha tem 56px; com ela, 80px. */
|
|
67
|
+
description?: string
|
|
68
|
+
/** Para cima (label em destaque, padrão) ou para baixo (label pequeno em cima, valor em destaque embaixo). Figma: Downward Content. */
|
|
69
|
+
content?: ListRowContent
|
|
70
|
+
/** Leading com seleção: o `Radio.Field` da lib, sem label (a linha é o label). */
|
|
71
|
+
radio?: ListRowRadio
|
|
72
|
+
/** Leading com trackline: marcador ligado à próxima etapa por um traço. */
|
|
73
|
+
trackline?: ListRowTrackline
|
|
74
|
+
/** Trailing com conteúdo secundário: rótulo alinhado à direita. */
|
|
75
|
+
secondaryLabel?: string
|
|
76
|
+
/** Segunda linha do conteúdo secundário. */
|
|
77
|
+
secondaryDescription?: string
|
|
78
|
+
/** Trailing com link: um `LinkButton` small. */
|
|
79
|
+
link?: ListRowLink
|
|
80
|
+
/** Trailing com badge: um `BadgeState`. */
|
|
81
|
+
badge?: ListRowBadge
|
|
82
|
+
/** Trailing com ícone: o chevron que indica que a linha leva a outra tela. */
|
|
83
|
+
chevron?: boolean
|
|
84
|
+
/** Trailing com toggle: o `Switch` da lib, sem label (passe `aria-label`). */
|
|
85
|
+
toggle?: ListRowToggle
|
|
86
|
+
/** Estado de carregamento, com o mesmo leading e o mesmo número de linhas do conteúdo final. Figma: Skeleton. */
|
|
87
|
+
skeleton?: boolean
|
|
88
|
+
/** A linha inteira leva a outra tela: a raiz vira um `<a>` (`as` é ignorado). Ignorado com `skeleton`. */
|
|
89
|
+
href?: string
|
|
90
|
+
target?: string
|
|
91
|
+
/** Tag da raiz. */
|
|
92
|
+
as?: 'div' | 'li'
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const {
|
|
96
|
+
label,
|
|
97
|
+
description,
|
|
98
|
+
content = 'upward',
|
|
99
|
+
radio,
|
|
100
|
+
trackline,
|
|
101
|
+
secondaryLabel,
|
|
102
|
+
secondaryDescription,
|
|
103
|
+
link,
|
|
104
|
+
badge,
|
|
105
|
+
chevron = false,
|
|
106
|
+
toggle,
|
|
107
|
+
skeleton = false,
|
|
108
|
+
href,
|
|
109
|
+
target,
|
|
110
|
+
as = 'div',
|
|
111
|
+
class: className,
|
|
112
|
+
...rest
|
|
113
|
+
} = Astro.props
|
|
114
|
+
|
|
115
|
+
const hasIcon = Astro.slots.has('icon')
|
|
116
|
+
const hasPartner = Astro.slots.has('partner')
|
|
117
|
+
const leading = trackline ? 'trackline' : radio ? 'radio' : hasPartner ? 'partner' : hasIcon ? 'icon' : null
|
|
118
|
+
const hasSecondary = !!secondaryLabel || !!secondaryDescription
|
|
119
|
+
const hasTrailing = hasSecondary || !!link || !!badge || chevron || !!toggle
|
|
120
|
+
const twoLines = !!description
|
|
121
|
+
// The skeleton is `aria-hidden`, so it is never a link: a focusable element
|
|
122
|
+
// inside a hidden tree fails WCAG 4.1.2. Same rule as the React one.
|
|
123
|
+
const clickable = !!href && !skeleton
|
|
124
|
+
const marker = trackline?.marker ?? 'number'
|
|
125
|
+
|
|
126
|
+
const Tag = clickable ? 'a' : as
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
<Tag
|
|
130
|
+
class:list={[
|
|
131
|
+
'au-list-row',
|
|
132
|
+
`au-list-row--content-${content}`,
|
|
133
|
+
twoLines && 'au-list-row--two-lines',
|
|
134
|
+
leading && `au-list-row--leading-${leading}`,
|
|
135
|
+
hasTrailing && 'au-list-row--with-trailing',
|
|
136
|
+
skeleton && 'au-list-row--skeleton',
|
|
137
|
+
clickable && 'au-list-row--clickable',
|
|
138
|
+
trackline?.last && 'au-list-row--trackline-last',
|
|
139
|
+
className,
|
|
140
|
+
]}
|
|
141
|
+
href={clickable ? href : undefined}
|
|
142
|
+
target={clickable ? target : undefined}
|
|
143
|
+
aria-busy={skeleton ? 'true' : undefined}
|
|
144
|
+
aria-hidden={skeleton ? 'true' : undefined}
|
|
145
|
+
{...rest}>
|
|
146
|
+
<Divider width="small" />
|
|
147
|
+
<div class="au-list-row__content">
|
|
148
|
+
{
|
|
149
|
+
leading && (
|
|
150
|
+
<div class={`au-list-row__leading au-list-row__leading--${leading}`}>
|
|
151
|
+
{skeleton ? (
|
|
152
|
+
<Fragment>
|
|
153
|
+
{leading === 'icon' && <Skeleton shape="square" width={44} height={44} />}
|
|
154
|
+
{leading === 'partner' && <Skeleton shape="square" width={40} height={40} />}
|
|
155
|
+
{leading === 'radio' && <Skeleton shape="circle" width={20} height={20} />}
|
|
156
|
+
{leading === 'trackline' && <Skeleton shape="circle" width={24} height={24} />}
|
|
157
|
+
</Fragment>
|
|
158
|
+
) : (
|
|
159
|
+
<Fragment>
|
|
160
|
+
{leading === 'icon' && (
|
|
161
|
+
<span class="au-list-row__icon" aria-hidden="true">
|
|
162
|
+
<slot name="icon" />
|
|
163
|
+
</span>
|
|
164
|
+
)}
|
|
165
|
+
{leading === 'partner' && (
|
|
166
|
+
<span class="au-list-row__partner">
|
|
167
|
+
<slot name="partner" />
|
|
168
|
+
</span>
|
|
169
|
+
)}
|
|
170
|
+
{leading === 'radio' && <RadioField {...radio} />}
|
|
171
|
+
{leading === 'trackline' && (
|
|
172
|
+
<span class="au-list-row__trackline">
|
|
173
|
+
<span class={`au-list-row__marker au-list-row__marker--${marker}`}>
|
|
174
|
+
{marker === 'number' && trackline!.number}
|
|
175
|
+
{marker === 'check' && <IconCheck size="small" />}
|
|
176
|
+
{marker === 'badge' && <BadgeState status={trackline!.status ?? 'info'} iconOnly />}
|
|
177
|
+
</span>
|
|
178
|
+
{!trackline!.last && <span class="au-list-row__dash" aria-hidden="true" />}
|
|
179
|
+
</span>
|
|
180
|
+
)}
|
|
181
|
+
</Fragment>
|
|
182
|
+
)}
|
|
183
|
+
</div>
|
|
184
|
+
)
|
|
185
|
+
}
|
|
186
|
+
<div class="au-list-row__main">
|
|
187
|
+
{
|
|
188
|
+
skeleton ? (
|
|
189
|
+
<Fragment>
|
|
190
|
+
<Skeleton width={160} height={16} />
|
|
191
|
+
{twoLines && <Skeleton width={104} height={14} />}
|
|
192
|
+
</Fragment>
|
|
193
|
+
) : (
|
|
194
|
+
<Fragment>
|
|
195
|
+
<span class="au-list-row__label">{label}</span>
|
|
196
|
+
{description && <span class="au-list-row__description">{description}</span>}
|
|
197
|
+
</Fragment>
|
|
198
|
+
)
|
|
199
|
+
}
|
|
200
|
+
</div>
|
|
201
|
+
{
|
|
202
|
+
hasTrailing && (
|
|
203
|
+
<div class="au-list-row__trailing">
|
|
204
|
+
{skeleton ? (
|
|
205
|
+
<Skeleton width={56} height={16} />
|
|
206
|
+
) : (
|
|
207
|
+
<Fragment>
|
|
208
|
+
{hasSecondary && (
|
|
209
|
+
<span class="au-list-row__secondary">
|
|
210
|
+
{secondaryLabel && <span class="au-list-row__secondary-label">{secondaryLabel}</span>}
|
|
211
|
+
{secondaryDescription && (
|
|
212
|
+
<span class="au-list-row__secondary-description">{secondaryDescription}</span>
|
|
213
|
+
)}
|
|
214
|
+
</span>
|
|
215
|
+
)}
|
|
216
|
+
{link && (
|
|
217
|
+
<LinkButton
|
|
218
|
+
as={link.href ? 'a' : 'button'}
|
|
219
|
+
href={link.href}
|
|
220
|
+
target={link.target}
|
|
221
|
+
size="small"
|
|
222
|
+
class="au-list-row__link"
|
|
223
|
+
data-au-list-row="link">
|
|
224
|
+
{link.label}
|
|
225
|
+
</LinkButton>
|
|
226
|
+
)}
|
|
227
|
+
{badge && <BadgeState status={badge.status} text={badge.text} variant={badge.variant} />}
|
|
228
|
+
{toggle && <Switch {...toggle} />}
|
|
229
|
+
{chevron && (
|
|
230
|
+
<span class="au-list-row__chevron" aria-hidden="true">
|
|
231
|
+
<IconChevronRight />
|
|
232
|
+
</span>
|
|
233
|
+
)}
|
|
234
|
+
</Fragment>
|
|
235
|
+
)}
|
|
236
|
+
</div>
|
|
237
|
+
)
|
|
238
|
+
}
|
|
239
|
+
</div>
|
|
240
|
+
<Divider width="small" />
|
|
241
|
+
</Tag>
|