@consumidor-positivo/aurora 1.2.0 → 1.3.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/README.md +59 -3
- package/astro/AdBox/index.astro +28 -0
- package/astro/Alert/index.astro +257 -0
- package/astro/BadgeInfo/index.astro +55 -0
- package/astro/BadgeState/index.astro +79 -0
- package/astro/Button/index.astro +11 -3
- package/astro/Card/Container/index.astro +44 -0
- package/astro/Card/Emphasis/index.astro +39 -0
- package/astro/Card/Image/index.astro +26 -0
- package/astro/Card/Root/index.astro +53 -0
- package/astro/Card/Tag/index.astro +26 -0
- package/astro/Chip/index.astro +48 -0
- package/astro/ChipBanner/index.astro +160 -0
- package/astro/Container/index.astro +16 -0
- package/astro/Divider/index.astro +27 -0
- package/astro/Image/index.astro +26 -0
- package/astro/LazyImage/index.astro +55 -0
- package/astro/LinkButton/index.astro +54 -0
- package/astro/Logo/ac/BadgeFullWhite.astro +20 -0
- package/astro/Logo/ac/BadgeWhite.astro +23 -0
- package/astro/Logo/ac/BadgeWhiteStroke.astro +27 -0
- package/astro/Logo/ac/BadgeWhiteStrokeDefault.astro +28 -0
- package/astro/Logo/ac/Badget.astro +24 -0
- package/astro/Logo/ac/Primary.astro +28 -0
- package/astro/Logo/ac/PrimaryFillWhite.astro +28 -0
- package/astro/Logo/ac/PrimaryFullWhite.astro +20 -0
- package/astro/Logo/ac/PrimaryNegative.astro +20 -0
- package/astro/Logo/ac/PrimaryWhite.astro +20 -0
- package/astro/Logo/ac/TertiaryWhite.astro +72 -0
- package/astro/Logo/cp/BadgeWhiteStroke.astro +10 -0
- package/astro/Logo/cp/Badget.astro +14 -0
- package/astro/Logo/cp/PrimaryFillWhite.astro +63 -0
- package/astro/Logo/cp/PrimaryFullWhite.astro +27 -0
- package/astro/Logo/cp/PrimaryLogoWhite.astro +67 -0
- package/astro/Logo/cp/PrimaryNegative.astro +27 -0
- package/astro/Logo/cp/PrimaryWhite.astro +27 -0
- package/astro/Modal/index.astro +213 -0
- package/astro/NotificationsBar/Link/index.astro +70 -0
- package/astro/NotificationsBar/List/index.astro +38 -0
- package/astro/NotificationsBar/index.astro +24 -0
- package/astro/PartnerBanner/index.astro +52 -0
- package/astro/ProfileNav/index.astro +34 -0
- package/astro/ProgressBar/index.astro +70 -0
- package/astro/Skeleton/index.astro +50 -0
- package/astro/SpecialButton/index.astro +331 -0
- package/astro/Spinner/index.astro +75 -0
- package/astro/SubHeader/index.astro +57 -0
- package/astro/Switch/Card/index.astro +69 -0
- package/astro/Switch/Pure/index.astro +47 -0
- package/astro/Tooltip/index.astro +38 -0
- package/astro/form/Checkbox/Field/index.astro +68 -0
- package/astro/form/Checkbox/Group/index.astro +79 -0
- package/astro/form/Datepicker/Calendar/index.astro +53 -0
- package/astro/form/Datepicker/CalendarHeader/index.astro +57 -0
- package/astro/form/Datepicker/Segment/index.astro +53 -0
- package/astro/form/Datepicker/index.astro +756 -0
- package/astro/form/EmailField/index.astro +237 -0
- package/astro/form/Field/ErrorMessage/index.astro +20 -0
- package/astro/form/Field/Input/index.astro +15 -0
- package/astro/form/Field/InputHolder/index.astro +28 -0
- package/astro/form/Field/Label/index.astro +80 -0
- package/astro/form/Field/Message/index.astro +29 -0
- package/astro/form/Field/Root/index.astro +37 -0
- package/astro/form/Field/TextArea/index.astro +69 -0
- package/astro/form/InputField/index.astro +96 -0
- package/astro/form/PasswordField/index.astro +123 -0
- package/astro/form/Radio/Field/index.astro +52 -0
- package/astro/form/Radio/Group/index.astro +78 -0
- package/astro/form/SelectField/index.astro +561 -0
- package/astro/form/TextareaField/index.astro +81 -0
- package/astro/form/TokenField/index.astro +211 -0
- package/astro/tokens/package.json +6 -0
- package/dist/{tokens-C4ypB4bY.js → astro/tokens/index.es.js} +101 -101
- package/dist/astro/tokens/index.es.js.map +1 -0
- package/dist/components/Alert/index.es.js +1 -1
- package/dist/components/BadgeInfo/index.es.js +1 -1
- package/dist/components/BadgeState/index.es.js +1 -1
- package/dist/components/Image/index.es.js +1 -1
- package/dist/components/Spinner/index.es.js +1 -1
- package/dist/components/form/Checkbox/Field/index.es.js +1 -1
- package/dist/components/form/Datepicker/Calendar/index.es.js +2 -2
- package/dist/components/form/Datepicker/CalendarHeader/index.es.js +2 -2
- package/dist/components/form/Datepicker/PortalHolder/index.es.js +1 -1
- package/dist/components/form/Datepicker/Segment/index.es.js +1 -1
- package/dist/components/form/Datepicker/index.es.js +3 -3
- package/dist/components/form/Field/Label/index.es.js +1 -1
- package/dist/components/form/SelectField/index.es.js +1 -1
- package/dist/{index-BcC9liUl.js → index-Bkl5OBIY.js} +3 -3
- package/dist/{index-BcC9liUl.js.map → index-Bkl5OBIY.js.map} +1 -1
- package/dist/{index-CFYmtkje.js → index-CZfMkAoF.js} +2 -2
- package/dist/{index-CFYmtkje.js.map → index-CZfMkAoF.js.map} +1 -1
- package/dist/{index-CeClo_WS.js → index-Cw1KtRQr.js} +2 -2
- package/dist/{index-CeClo_WS.js.map → index-Cw1KtRQr.js.map} +1 -1
- package/dist/main.es.js +101 -101
- package/package.json +7 -1
- package/dist/tokens-C4ypB4bY.js.map +0 -1
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import Text from '../../../Text/index.astro'
|
|
4
|
+
import CheckboxField from '../Field/index.astro'
|
|
5
|
+
import type { Props as CheckboxFieldProps } from '../Field/index.astro'
|
|
6
|
+
import FieldErrorMessage from '../../Field/ErrorMessage/index.astro'
|
|
7
|
+
import '../../../../dist/components/Group/styles2.css'
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* React clones its children to inject `name`, `error`, `defaultChecked`,
|
|
11
|
+
* `onChange` and `onFocus`. Astro cannot touch slotted children, so:
|
|
12
|
+
* - pass the fields as `options` and the group renders each
|
|
13
|
+
* `Checkbox/Field` with the group's `name` and `error`, checked when its
|
|
14
|
+
* `value` matches `defaultValue` (an option's own props win, like React;
|
|
15
|
+
* also like React, an option without `value` is checked when there is no
|
|
16
|
+
* `defaultValue`, since `undefined === undefined`);
|
|
17
|
+
* - or put your own `Checkbox/Field`s in the default slot, rendered after the
|
|
18
|
+
* `options`; those must carry `name` (and `error`) themselves.
|
|
19
|
+
* No `onChange`/`onFocus`: the native `change`/`focusin` events bubble to the
|
|
20
|
+
* root. React's `onChange` hands back the checked options; read them from
|
|
21
|
+
* `root.querySelectorAll('input:checked')`.
|
|
22
|
+
*/
|
|
23
|
+
export type Props = HTMLAttributes<'div'> & {
|
|
24
|
+
options?: CheckboxFieldProps[]
|
|
25
|
+
name?: string
|
|
26
|
+
defaultValue?: string | number
|
|
27
|
+
orientation?: 'horizontal' | 'vertical'
|
|
28
|
+
label?: string
|
|
29
|
+
error?: boolean
|
|
30
|
+
errorMessage?: string
|
|
31
|
+
required?: boolean
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const {
|
|
35
|
+
options = [],
|
|
36
|
+
name,
|
|
37
|
+
defaultValue,
|
|
38
|
+
orientation = 'vertical',
|
|
39
|
+
label,
|
|
40
|
+
error = false,
|
|
41
|
+
errorMessage,
|
|
42
|
+
required = false,
|
|
43
|
+
class: className,
|
|
44
|
+
...rest
|
|
45
|
+
} = Astro.props
|
|
46
|
+
|
|
47
|
+
const safeName = name || `au-checkbox-group-${crypto.randomUUID().slice(0, 8)}`
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
<div
|
|
51
|
+
class:list={[
|
|
52
|
+
'au-checkbox-group',
|
|
53
|
+
orientation === 'horizontal' && 'au-checkbox-group--horizontal',
|
|
54
|
+
className,
|
|
55
|
+
]}
|
|
56
|
+
{...rest}>
|
|
57
|
+
{
|
|
58
|
+
label && (
|
|
59
|
+
<Text variant="body-small" weight="semibold" color="secondary">
|
|
60
|
+
{label}{' '}
|
|
61
|
+
{required && <span class="au-checkbox-group__label--required">*</span>}
|
|
62
|
+
</Text>
|
|
63
|
+
)
|
|
64
|
+
}
|
|
65
|
+
<div class="au-checkbox-group__fields">
|
|
66
|
+
{
|
|
67
|
+
options.map((option) => (
|
|
68
|
+
<CheckboxField
|
|
69
|
+
name={safeName}
|
|
70
|
+
error={error}
|
|
71
|
+
checked={defaultValue === option.value}
|
|
72
|
+
{...option}
|
|
73
|
+
/>
|
|
74
|
+
))
|
|
75
|
+
}
|
|
76
|
+
<slot />
|
|
77
|
+
</div>
|
|
78
|
+
<FieldErrorMessage hasError={error} message={errorMessage} />
|
|
79
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Button from '../../../Button/index.astro'
|
|
3
|
+
import CalendarHeader from '../CalendarHeader/index.astro'
|
|
4
|
+
import '../../../../dist/components/index/styles.css'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* The calendar dialog of the Datepicker. The React version renders the grid
|
|
8
|
+
* with `react-aria-components` (`Calendar`, `CalendarGrid`, `CalendarCell`);
|
|
9
|
+
* this is the same markup, with the parts react-aria computes at render time
|
|
10
|
+
* (title, weekday names, the day cells and their `data-*` state) left for the
|
|
11
|
+
* Datepicker controller to fill, since they depend on the browser locale and
|
|
12
|
+
* on the focused month. Only rendered inside the Datepicker `<template>`.
|
|
13
|
+
*/
|
|
14
|
+
export type Props = {
|
|
15
|
+
minYear: number
|
|
16
|
+
maxYear: number
|
|
17
|
+
month: number
|
|
18
|
+
year: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { minYear, maxYear, month, year } = Astro.props
|
|
22
|
+
|
|
23
|
+
const uid = crypto.randomUUID().slice(0, 8)
|
|
24
|
+
// Stand in for the `useId()` react-aria gives the calendar and the grid.
|
|
25
|
+
const calendarId = `au-datepicker-${uid}-calendar`
|
|
26
|
+
const gridId = `au-datepicker-${uid}-grid`
|
|
27
|
+
// The inline style of react-aria's `VisuallyHidden`.
|
|
28
|
+
const visuallyHidden =
|
|
29
|
+
'border: 0; clip: rect(0 0 0 0); clip-path: inset(50%); height: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; width: 1px; white-space: nowrap'
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
<div class="au-datepicker__calendar">
|
|
33
|
+
<div class="au-datepicker__calendar-backdrop"></div>
|
|
34
|
+
<div class="au-datepicker__calendar-card">
|
|
35
|
+
<div class="au-datepicker__calendar-base" data-rac="" id={calendarId} role="application">
|
|
36
|
+
<div style={visuallyHidden}><h2></h2></div>
|
|
37
|
+
<CalendarHeader minYear={minYear} maxYear={maxYear} month={month} year={year} />
|
|
38
|
+
<table id={gridId} role="grid" cellpadding="0" class="au-datepicker__calendar-grid">
|
|
39
|
+
<thead aria-hidden="true" class="react-aria-CalendarGridHeader">
|
|
40
|
+
<tr>
|
|
41
|
+
{Array.from({ length: 7 }).map(() => <th class="au-datepicker__calendar-weekday"></th>)}
|
|
42
|
+
</tr>
|
|
43
|
+
</thead>
|
|
44
|
+
<tbody class="react-aria-CalendarGridBody"></tbody>
|
|
45
|
+
</table>
|
|
46
|
+
<div style={visuallyHidden}><button tabindex="-1"></button></div>
|
|
47
|
+
</div>
|
|
48
|
+
<div class="au-datepicker__calendar-actions-dock">
|
|
49
|
+
<Button type="outlined" class="au-datepicker__calendar-cancel" expand="x">Cancelar</Button>
|
|
50
|
+
<Button expand="x">Confirmar</Button>
|
|
51
|
+
</div>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
---
|
|
2
|
+
import IconChevronLeft from '../../../icons/default/IconChevronLeft.astro'
|
|
3
|
+
import IconChevronRight from '../../../icons/default/IconChevronRight.astro'
|
|
4
|
+
import Segment from '../Segment/index.astro'
|
|
5
|
+
import '../../../../dist/components/index/styles3.css'
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Month navigation of the Datepicker calendar: previous month, the month and
|
|
9
|
+
* year pickers, next month. Same markup as the React `CalendarHeader`; the
|
|
10
|
+
* Datepicker controller drives it.
|
|
11
|
+
*/
|
|
12
|
+
export type Props = {
|
|
13
|
+
/** Year of the first option in the year picker. */
|
|
14
|
+
minYear: number
|
|
15
|
+
/** Year of the last option in the year picker. */
|
|
16
|
+
maxYear: number
|
|
17
|
+
/** Month (1-12) and year shown when the calendar opens. */
|
|
18
|
+
month: number
|
|
19
|
+
year: number
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const { minYear, maxYear, month, year } = Astro.props
|
|
23
|
+
|
|
24
|
+
// Same lists as `useCalendarHeader`.
|
|
25
|
+
const monthsOptions = [
|
|
26
|
+
'Janeiro',
|
|
27
|
+
'Fevereiro',
|
|
28
|
+
'Março',
|
|
29
|
+
'Abril',
|
|
30
|
+
'Maio',
|
|
31
|
+
'Junho',
|
|
32
|
+
'Julho',
|
|
33
|
+
'Agosto',
|
|
34
|
+
'Setembro',
|
|
35
|
+
'Outubro',
|
|
36
|
+
'Novembro',
|
|
37
|
+
'Dezembro',
|
|
38
|
+
].map((label, index) => ({ label, value: index + 1 }))
|
|
39
|
+
|
|
40
|
+
const yearsOptions = Array.from({ length: maxYear - minYear + 1 }, (_, index) => ({
|
|
41
|
+
label: String(minYear + index),
|
|
42
|
+
value: minYear + index,
|
|
43
|
+
}))
|
|
44
|
+
---
|
|
45
|
+
|
|
46
|
+
<div class="au-datepicker__header">
|
|
47
|
+
<button class="au-datepicker__header-navigation-btn" aria-label="Mês anterior">
|
|
48
|
+
<IconChevronLeft />
|
|
49
|
+
</button>
|
|
50
|
+
<div class="au-datepicker__header-segments">
|
|
51
|
+
<Segment currentValue={month} mobileTitle="Escolha o mês" options={monthsOptions} />
|
|
52
|
+
<Segment currentValue={year} mobileTitle="Escolha o ano" options={yearsOptions} />
|
|
53
|
+
</div>
|
|
54
|
+
<button class="au-datepicker__header-navigation-btn" aria-label="Próximo">
|
|
55
|
+
<IconChevronRight />
|
|
56
|
+
</button>
|
|
57
|
+
</div>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLAttributes } from 'astro/types'
|
|
3
|
+
import IconChevronDown from '../../../icons/default/IconChevronDown.astro'
|
|
4
|
+
import IconChevronLeft from '../../../icons/default/IconChevronLeft.astro'
|
|
5
|
+
import IconX from '../../../icons/default/IconX.astro'
|
|
6
|
+
import '../../../../dist/components/index/styles2.css'
|
|
7
|
+
|
|
8
|
+
export type SegmentItem = { label: string; value: number }
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* The month/year picker of the Datepicker calendar header. Static markup only:
|
|
12
|
+
* the Datepicker controller keeps the current label, the selected option and
|
|
13
|
+
* the open state in sync (React does it in `useSegment`).
|
|
14
|
+
*/
|
|
15
|
+
export type Props = HTMLAttributes<'div'> & {
|
|
16
|
+
mobileTitle: string
|
|
17
|
+
options: SegmentItem[]
|
|
18
|
+
currentValue: number
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const { mobileTitle, options, currentValue, class: className, ...rest } = Astro.props
|
|
22
|
+
const current = options.find((option) => option.value === currentValue)
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
<div class:list={['au-datepicker__segment', className]} {...rest}>
|
|
26
|
+
<button
|
|
27
|
+
type="button"
|
|
28
|
+
class="au-datepicker__segment-input"
|
|
29
|
+
role="combobox"
|
|
30
|
+
aria-haspopup="listbox"
|
|
31
|
+
aria-expanded="false">{current?.label}<IconChevronDown /></button>
|
|
32
|
+
<div class="au-datepicker__segment-list-holder">
|
|
33
|
+
<div class="au-datepicker__segment-list-header">
|
|
34
|
+
<button type="button" aria-label="Voltar"><IconChevronLeft /></button>
|
|
35
|
+
<h4 class="au-datepicker__segment-title">{mobileTitle}</h4>
|
|
36
|
+
<button type="button" aria-label="Fechar"><IconX /></button>
|
|
37
|
+
</div>
|
|
38
|
+
<ul class="au-datepicker__segment-list" role="listbox">
|
|
39
|
+
{
|
|
40
|
+
options.map((option) => (
|
|
41
|
+
<li
|
|
42
|
+
role="option"
|
|
43
|
+
aria-selected={option.value === currentValue ? 'true' : 'false'}
|
|
44
|
+
class:list={[
|
|
45
|
+
'au-datepicker__segment-list-item',
|
|
46
|
+
option.value === currentValue && 'au-datepicker__segment-list-item--active',
|
|
47
|
+
]}
|
|
48
|
+
data-au-value={option.value}>{option.label}</li>
|
|
49
|
+
))
|
|
50
|
+
}
|
|
51
|
+
</ul>
|
|
52
|
+
</div>
|
|
53
|
+
</div>
|