@samuelgomez/astro 0.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/README.md +54 -0
- package/package.json +42 -0
- package/src/components/Accordion/index.astro +31 -0
- package/src/components/Alert/AlertDanger.astro +12 -0
- package/src/components/Alert/AlertInfo.astro +12 -0
- package/src/components/Alert/AlertSuccess.astro +12 -0
- package/src/components/Alert/AlertWarning.astro +12 -0
- package/src/components/Alert/index.astro +10 -0
- package/src/components/Badge/BadgeDanger.astro +15 -0
- package/src/components/Badge/BadgeInfo.astro +15 -0
- package/src/components/Badge/BadgeSuccess.astro +15 -0
- package/src/components/Badge/BadgeWarning.astro +15 -0
- package/src/components/Badge/index.astro +9 -0
- package/src/components/Box/index.astro +45 -0
- package/src/components/BoxPost/index.astro +66 -0
- package/src/components/Button/index.astro +35 -0
- package/src/components/Caniuse/index.astro +24 -0
- package/src/components/Codepen/index.astro +25 -0
- package/src/components/DebugGrid/index.astro +100 -0
- package/src/components/Demo/Demoui.astro +13 -0
- package/src/components/Demo/index.astro +105 -0
- package/src/components/Dialog/index.astro +74 -0
- package/src/components/FormattedDate/index.astro +17 -0
- package/src/components/GithubContributions/index.astro +88 -0
- package/src/components/Home/CardsBlog.astro +41 -0
- package/src/components/Home/CardsCodepen.astro +53 -0
- package/src/components/Home/CardsGithub.astro +44 -0
- package/src/components/Img/index.astro +28 -0
- package/src/components/Link/index.astro +33 -0
- package/src/components/Nav/NavToggle.astro +40 -0
- package/src/components/Nav/index.astro +71 -0
- package/src/components/Pagination/PaginationItem.astro +51 -0
- package/src/components/Pagination/index.astro +39 -0
- package/src/components/ScrollWatcher/index.astro +11 -0
- package/src/components/Social/index.astro +22 -0
- package/src/components/Support/index.astro +24 -0
- package/src/components/Svg/index.astro +30 -0
- package/src/components/SwitchTheme.astro +45 -0
- package/src/components/Table/Table.astro +15 -0
- package/src/components/Table/TableBody.astro +21 -0
- package/src/components/Table/TableHeader.astro +19 -0
- package/src/components/Table/index.astro +21 -0
- package/src/components/TableOfContent/index.astro +117 -0
- package/src/components/Tabs/TabList.astro +23 -0
- package/src/components/Tabs/TabListItem.astro +22 -0
- package/src/components/Tabs/TabPanel.astro +19 -0
- package/src/components/Tabs/TabsContainer.astro +174 -0
- package/src/components/Tabs/index.astro +46 -0
- package/src/components/Title/h1.astro +12 -0
- package/src/components/Title/h2.astro +12 -0
- package/src/components/Title/h3.astro +12 -0
- package/src/components/Title/h4.astro +12 -0
- package/src/components/Title/h5.astro +12 -0
- package/src/components/Title/h6.astro +12 -0
- package/src/components/Title/heading.astro +8 -0
- package/src/components/Title/index.astro +39 -0
- package/src/components/WrapperToHtml/index.astro +8 -0
- package/src/components/form/Field/index.astro +43 -0
- package/src/components/form/Fieldset/index.astro +14 -0
- package/src/components/form/Form/FieldDate.astro +32 -0
- package/src/components/form/Form/FieldEmail.astro +32 -0
- package/src/components/form/Form/FieldNumber.astro +35 -0
- package/src/components/form/Form/FieldPassword.astro +32 -0
- package/src/components/form/Form/FieldRadio.astro +32 -0
- package/src/components/form/Form/FieldSelect.astro +26 -0
- package/src/components/form/Form/FieldText.astro +35 -0
- package/src/components/form/Form/FieldTextarea.astro +25 -0
- package/src/components/form/Form/index.astro +5 -0
- package/src/components/form/Input/index.astro +27 -0
- package/src/components/form/InputRadio/index.astro +30 -0
- package/src/components/form/MoreInfo/index.astro +14 -0
- package/src/components/form/Select/index.astro +25 -0
- package/src/components/form/Status/index.astro +34 -0
- package/src/components/form/Textarea/index.astro +26 -0
- package/src/components/helpers/WrapperOrNot/index.astro +23 -0
- package/src/components/layout/Footer.astro +3 -0
- package/src/components/layout/Head.astro +154 -0
- package/src/components/layout/Header.astro +28 -0
- package/src/components/old/Grid.astro +18 -0
- package/src/components/old/Section.astro +19 -0
- package/src/components/old/SwitchTheme.astro +66 -0
- package/src/components/old/index-webco.astro +55 -0
- package/src/components/old/send.astro +28 -0
- package/src/helpers/dom.ts +19 -0
- package/src/helpers/isEmptyOrNull.test.ts +58 -0
- package/src/helpers/isEmptyOrNull.ts +6 -0
- package/src/helpers/setSlug.test.ts +20 -0
- package/src/helpers/setSlug.ts +7 -0
- package/src/helpers/setTocTitle.ts +2 -0
- package/src/helpers/setVariants.test.ts +26 -0
- package/src/helpers/setVariants.ts +18 -0
- package/src/icons/Add.astro +18 -0
- package/src/icons/Anchor.astro +22 -0
- package/src/icons/Arrow.astro +11 -0
- package/src/icons/AstroLogo.astro +35 -0
- package/src/icons/Check.astro +11 -0
- package/src/icons/ChevronDown.astro +11 -0
- package/src/icons/ChevronLeft.astro +11 -0
- package/src/icons/ChevronRight.astro +11 -0
- package/src/icons/Codepen.astro +36 -0
- package/src/icons/Cross.astro +11 -0
- package/src/icons/ExternalLink.astro +19 -0
- package/src/icons/Github.astro +36 -0
- package/src/icons/Github2.astro +11 -0
- package/src/icons/Grid.astro +19 -0
- package/src/icons/Info.astro +11 -0
- package/src/icons/Instagram.astro +11 -0
- package/src/icons/Linkedin.astro +11 -0
- package/src/icons/LogoSG.astro +66 -0
- package/src/icons/MoonSun.astro +17 -0
- package/src/icons/Send.astro +11 -0
- package/src/icons/Slash.astro +14 -0
- package/src/icons/Trash.astro +19 -0
- package/src/icons/Twitter.astro +14 -0
- package/src/types/Permutations.d.ts +3 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
---
|
|
2
|
+
export { default as h1 } from './h1.astro';
|
|
3
|
+
export { default as h2 } from './h2.astro';
|
|
4
|
+
export { default as h3 } from './h3.astro';
|
|
5
|
+
export { default as h4 } from './h4.astro';
|
|
6
|
+
export { default as h5 } from './h5.astro';
|
|
7
|
+
export { default as h6 } from './h6.astro';
|
|
8
|
+
---
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLTag } from 'astro/types';
|
|
3
|
+
import Link from '@samuelgomez/astro/components/Link/index.astro';
|
|
4
|
+
import Anchor from '@samuelgomez/astro/icons/Anchor.astro';
|
|
5
|
+
import { setSlug } from '@samuelgomez/astro/helpers/setSlug';
|
|
6
|
+
|
|
7
|
+
export type titleLevel = 1 | 2 | 3 | 4 | 5 | 6;
|
|
8
|
+
|
|
9
|
+
type Props = {
|
|
10
|
+
label?: string;
|
|
11
|
+
level?: titleLevel;
|
|
12
|
+
noLink?: boolean;
|
|
13
|
+
id?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const { label, level = 1, noLink, id, ...props } = Astro.props;
|
|
17
|
+
|
|
18
|
+
const htmlLabel = await Astro.slots.render('default');
|
|
19
|
+
|
|
20
|
+
const idHeading = label ? setSlug(label) : id?.replace('--', '-');
|
|
21
|
+
|
|
22
|
+
const title = label || htmlLabel.toString();
|
|
23
|
+
|
|
24
|
+
const Heading = `h${level}` as HTMLTag;
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
<Heading {...props} id={idHeading}>
|
|
28
|
+
{
|
|
29
|
+
!noLink && idHeading && (
|
|
30
|
+
<Link href={`#${idHeading}`}>
|
|
31
|
+
<Anchor slot="after-link" title={title} />
|
|
32
|
+
</Link>
|
|
33
|
+
)
|
|
34
|
+
}
|
|
35
|
+
<slot name="before-title" />
|
|
36
|
+
{label}
|
|
37
|
+
<slot />
|
|
38
|
+
<slot name="after-title" />
|
|
39
|
+
</Heading>
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
import MoreInfo from '@samuelgomez/astro/components/form/MoreInfo/index.astro';
|
|
3
|
+
import Status from '@samuelgomez/astro/components/form/Status/index.astro';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
id?: string;
|
|
7
|
+
name: string;
|
|
8
|
+
label: string;
|
|
9
|
+
moreInfo: string;
|
|
10
|
+
help: string;
|
|
11
|
+
errorMessage?: string;
|
|
12
|
+
title?: string;
|
|
13
|
+
required?: boolean;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
name,
|
|
18
|
+
id = name,
|
|
19
|
+
label,
|
|
20
|
+
moreInfo,
|
|
21
|
+
help,
|
|
22
|
+
errorMessage,
|
|
23
|
+
title,
|
|
24
|
+
required = true,
|
|
25
|
+
} = Astro.props;
|
|
26
|
+
|
|
27
|
+
const html = await Astro.slots.render('default', [name]);
|
|
28
|
+
---
|
|
29
|
+
|
|
30
|
+
<div class="field">
|
|
31
|
+
<label id={`label-${name}`} for={id}>{label}</label>
|
|
32
|
+
{moreInfo && <MoreInfo moreInfo={moreInfo} />}
|
|
33
|
+
<div class="input-container">
|
|
34
|
+
<Fragment set:html={html} />
|
|
35
|
+
</div>
|
|
36
|
+
<Status
|
|
37
|
+
required={required}
|
|
38
|
+
id={id || name}
|
|
39
|
+
help={help}
|
|
40
|
+
errorMessage={errorMessage}
|
|
41
|
+
title={title}
|
|
42
|
+
/>
|
|
43
|
+
</div>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Input from '@samuelgomez/astro/components/form/Input/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'date',
|
|
7
|
+
label = 'Votre date',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
autocomplete = null,
|
|
11
|
+
required = true,
|
|
12
|
+
errorMessage = undefined,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Field
|
|
18
|
+
name={name}
|
|
19
|
+
label={label}
|
|
20
|
+
moreInfo={moreInfo}
|
|
21
|
+
help={help}
|
|
22
|
+
required={required}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
>
|
|
25
|
+
<Input
|
|
26
|
+
name={name}
|
|
27
|
+
autocomplete={autocomplete}
|
|
28
|
+
type="date"
|
|
29
|
+
required={required}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Input from '@samuelgomez/astro/components/form/Input/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'email',
|
|
7
|
+
label = 'Votre email',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
autocomplete = 'email',
|
|
11
|
+
required = true,
|
|
12
|
+
errorMessage = undefined,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Field
|
|
18
|
+
name={name}
|
|
19
|
+
label={label}
|
|
20
|
+
moreInfo={moreInfo}
|
|
21
|
+
help={help}
|
|
22
|
+
required={required}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
>
|
|
25
|
+
<Input
|
|
26
|
+
name={name}
|
|
27
|
+
autocomplete={autocomplete}
|
|
28
|
+
type="email"
|
|
29
|
+
required={required}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Input from '@samuelgomez/astro/components/form/Input/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'text',
|
|
7
|
+
label = 'Votre text',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
autocomplete = null,
|
|
11
|
+
errorMessage = undefined,
|
|
12
|
+
required = true,
|
|
13
|
+
title = undefined,
|
|
14
|
+
...rest
|
|
15
|
+
} = Astro.props;
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<Field
|
|
19
|
+
name={name}
|
|
20
|
+
label={label}
|
|
21
|
+
moreInfo={moreInfo}
|
|
22
|
+
help={help}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
required={required}
|
|
25
|
+
title={title}
|
|
26
|
+
>
|
|
27
|
+
<Input
|
|
28
|
+
name={name}
|
|
29
|
+
autocomplete={autocomplete}
|
|
30
|
+
type="number"
|
|
31
|
+
required={required}
|
|
32
|
+
title={title}
|
|
33
|
+
{...rest}
|
|
34
|
+
/>
|
|
35
|
+
</Field>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Input from '@samuelgomez/astro/components/form/Input/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'password',
|
|
7
|
+
label = 'Votre mot de passe',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
autocomplete = 'off',
|
|
11
|
+
required = true,
|
|
12
|
+
errorMessage = undefined,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Field
|
|
18
|
+
name={name}
|
|
19
|
+
label={label}
|
|
20
|
+
moreInfo={moreInfo}
|
|
21
|
+
help={help}
|
|
22
|
+
required={required}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
>
|
|
25
|
+
<Input
|
|
26
|
+
name={name}
|
|
27
|
+
autocomplete={autocomplete}
|
|
28
|
+
type="password"
|
|
29
|
+
required={required}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Radio from '@samuelgomez/astro/components/form/InputRadio/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'selection',
|
|
7
|
+
label = 'Votre sélection',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
options = [],
|
|
11
|
+
errorMessage = undefined,
|
|
12
|
+
required = true,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Field
|
|
18
|
+
name={name}
|
|
19
|
+
label={label}
|
|
20
|
+
moreInfo={moreInfo}
|
|
21
|
+
help={help}
|
|
22
|
+
errorMessage={errorMessage}
|
|
23
|
+
required={required}
|
|
24
|
+
>
|
|
25
|
+
<Radio
|
|
26
|
+
legend={label}
|
|
27
|
+
name={name}
|
|
28
|
+
options={options}
|
|
29
|
+
required={required}
|
|
30
|
+
{...rest}
|
|
31
|
+
/>
|
|
32
|
+
</Field>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Select from '@samuelgomez/astro/components/form/Select/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'selection',
|
|
7
|
+
label = 'Votre sélection',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
options = [],
|
|
11
|
+
errorMessage = undefined,
|
|
12
|
+
required = true,
|
|
13
|
+
...rest
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<Field
|
|
18
|
+
name={name}
|
|
19
|
+
label={label}
|
|
20
|
+
moreInfo={moreInfo}
|
|
21
|
+
help={help}
|
|
22
|
+
required={required}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
>
|
|
25
|
+
<Select name={name} options={options} required={required} {...rest} />
|
|
26
|
+
</Field>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Input from '@samuelgomez/astro/components/form/Input/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'text',
|
|
7
|
+
label = 'Votre text',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
autocomplete = null,
|
|
11
|
+
errorMessage = undefined,
|
|
12
|
+
required = true,
|
|
13
|
+
title = undefined,
|
|
14
|
+
...rest
|
|
15
|
+
} = Astro.props;
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<Field
|
|
19
|
+
name={name}
|
|
20
|
+
label={label}
|
|
21
|
+
moreInfo={moreInfo}
|
|
22
|
+
help={help}
|
|
23
|
+
errorMessage={errorMessage}
|
|
24
|
+
required={required}
|
|
25
|
+
title={title}
|
|
26
|
+
>
|
|
27
|
+
<Input
|
|
28
|
+
name={name}
|
|
29
|
+
autocomplete={autocomplete}
|
|
30
|
+
type="text"
|
|
31
|
+
required={required}
|
|
32
|
+
title={title}
|
|
33
|
+
{...rest}
|
|
34
|
+
/>
|
|
35
|
+
</Field>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Field from '@samuelgomez/astro/components/form/Field/index.astro';
|
|
3
|
+
import Textarea from '@samuelgomez/astro/components/form/Textarea/index.astro';
|
|
4
|
+
|
|
5
|
+
const {
|
|
6
|
+
name = 'text',
|
|
7
|
+
label = 'Votre text',
|
|
8
|
+
moreInfo = "Plus d'infos",
|
|
9
|
+
help = 'Aide',
|
|
10
|
+
errorMessage = undefined,
|
|
11
|
+
required = true,
|
|
12
|
+
...rest
|
|
13
|
+
} = Astro.props;
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
<Field
|
|
17
|
+
name={name}
|
|
18
|
+
label={label}
|
|
19
|
+
moreInfo={moreInfo}
|
|
20
|
+
help={help}
|
|
21
|
+
required={required}
|
|
22
|
+
errorMessage={errorMessage}
|
|
23
|
+
>
|
|
24
|
+
<Textarea name={name} required={required} {...rest} />
|
|
25
|
+
</Field>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = astroHTML.JSX.InputHTMLAttributes & {
|
|
3
|
+
ariaDescribedby?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
autocomplete,
|
|
9
|
+
type = 'text',
|
|
10
|
+
required = true,
|
|
11
|
+
id = name,
|
|
12
|
+
value,
|
|
13
|
+
ariaDescribedby = `help-${id}`,
|
|
14
|
+
...inputProps
|
|
15
|
+
} = Astro.props;
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
<input
|
|
19
|
+
type={type}
|
|
20
|
+
name={name}
|
|
21
|
+
required={required}
|
|
22
|
+
id={id}
|
|
23
|
+
value={value}
|
|
24
|
+
autocomplete={autocomplete}
|
|
25
|
+
aria-describedby={ariaDescribedby}
|
|
26
|
+
{...inputProps}
|
|
27
|
+
/>
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = Partial<HTMLInputElement> & {
|
|
3
|
+
ariaDescribedby?: string;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
legend: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const { name, required = true, options, legend } = Astro.props;
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
<fieldset>
|
|
15
|
+
<legend class="sr-only">{legend}</legend>
|
|
16
|
+
{
|
|
17
|
+
options?.map((option, index) => (
|
|
18
|
+
<>
|
|
19
|
+
<input
|
|
20
|
+
type="radio"
|
|
21
|
+
name={name}
|
|
22
|
+
required={required}
|
|
23
|
+
id={`${name}-${index}`}
|
|
24
|
+
value={option.value}
|
|
25
|
+
/>
|
|
26
|
+
<label for={`${name}-${index}`}>{option.label}</label>
|
|
27
|
+
</>
|
|
28
|
+
))
|
|
29
|
+
}
|
|
30
|
+
</fieldset>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Button from '@samuelgomez/astro/components/Button/index.astro';
|
|
3
|
+
import Info from '@samuelgomez/astro/icons/Info.astro';
|
|
4
|
+
|
|
5
|
+
type Props = {
|
|
6
|
+
moreInfo: string;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
const { moreInfo } = Astro.props;
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
<Button class="tooltip" variant="small" aria-label={moreInfo}>
|
|
13
|
+
<Info />
|
|
14
|
+
</Button>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = Partial<Omit<HTMLSelectElement, 'options'>> & {
|
|
3
|
+
ariaDescribedby?: string;
|
|
4
|
+
options: {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}[];
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
placeholderValue?: string;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
name,
|
|
14
|
+
required = true,
|
|
15
|
+
id = name,
|
|
16
|
+
options,
|
|
17
|
+
placeholder = 'Sélectionner',
|
|
18
|
+
placeholderValue = '',
|
|
19
|
+
} = Astro.props;
|
|
20
|
+
---
|
|
21
|
+
|
|
22
|
+
<select name={name} required={required} id={id}>
|
|
23
|
+
<option value={placeholderValue}>{placeholder}</option>
|
|
24
|
+
{options?.map(option => <option value={option.value}>{option.label}</option>)}
|
|
25
|
+
</select>
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
---
|
|
2
|
+
import Cross from '@samuelgomez/astro/icons/Cross.astro';
|
|
3
|
+
import Check from '@samuelgomez/astro/icons/Check.astro';
|
|
4
|
+
type Props = {
|
|
5
|
+
id?: string;
|
|
6
|
+
help: string;
|
|
7
|
+
errorMessage?: string;
|
|
8
|
+
title?: string;
|
|
9
|
+
required?: boolean;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const {
|
|
13
|
+
help,
|
|
14
|
+
id,
|
|
15
|
+
errorMessage = 'Le champ est en erreur',
|
|
16
|
+
required = true,
|
|
17
|
+
title = undefined,
|
|
18
|
+
} = Astro.props;
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
<span class="error-icon" aria-hidden="true"
|
|
22
|
+
><Cross fill="var(--bc-error)" /></span
|
|
23
|
+
>
|
|
24
|
+
<span class="valid-icon" aria-hidden="true"
|
|
25
|
+
><Check fill="var(--bc-success)" /></span
|
|
26
|
+
>
|
|
27
|
+
<span class="help-message" id={`help-${id}`}>
|
|
28
|
+
{help}
|
|
29
|
+
{required ? ' (champ obligatoire)' : ' (champ optionnel)'}
|
|
30
|
+
</span>
|
|
31
|
+
<span role="alert" class="error-message">
|
|
32
|
+
{errorMessage}
|
|
33
|
+
{Boolean(title) && ` : ${title}`}
|
|
34
|
+
</span>
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
---
|
|
2
|
+
type Props = Partial<HTMLTextAreaElement> & {
|
|
3
|
+
ariaDescribedby?: string;
|
|
4
|
+
};
|
|
5
|
+
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
required = true,
|
|
9
|
+
id = name,
|
|
10
|
+
value,
|
|
11
|
+
rows = '5',
|
|
12
|
+
cols = '5',
|
|
13
|
+
ariaDescribedby = `help-${id}`,
|
|
14
|
+
} = Astro.props;
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
<textarea
|
|
18
|
+
value={value}
|
|
19
|
+
name={name}
|
|
20
|
+
required={required}
|
|
21
|
+
id={id}
|
|
22
|
+
rows={rows}
|
|
23
|
+
cols={cols}
|
|
24
|
+
aria-describedby={ariaDescribedby}
|
|
25
|
+
spellcheck="true"
|
|
26
|
+
lang="fr"></textarea>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
import type { HTMLTag } from 'astro/types';
|
|
3
|
+
|
|
4
|
+
type Props = {
|
|
5
|
+
condition?: boolean;
|
|
6
|
+
wrapper?: HTMLTag;
|
|
7
|
+
class?: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const { condition, wrapper: Wrapper = 'div', ...rest } = Astro.props;
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
{
|
|
14
|
+
condition ? (
|
|
15
|
+
<Wrapper {...rest}>
|
|
16
|
+
<slot />
|
|
17
|
+
</Wrapper>
|
|
18
|
+
) : (
|
|
19
|
+
<>
|
|
20
|
+
<slot />
|
|
21
|
+
</>
|
|
22
|
+
)
|
|
23
|
+
}
|