Chip.vue : l'actif (échelle, fonction) passe de --primary, translucide dans le thème AEP (3,96:1 composé, sous AA), à --nav-primary-solid / --nav-text-on-primary (14,62:1 ; ≈12:1 en sombre), comme le formulaire libre depuis AF4. Le survol d'un actif ne change plus de fond ; tous les :hover passent sous @media (hover: hover) (plus de chip collé au tap). Mesuré sur /, /agences, /proposer, mobile et desktop. FormLibre.vue : surcharges locales de AF4 devenues inutiles retirées (principal plein, bloc hover: none) ; le survol du secondaire passe sous (hover: hover). Secondaire en contour vérifié au toucher. Décision MOE du 29/09, veto Jules possible. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_0174RrDEQFQTtySXkTcsUKuv
178 lines
4.4 KiB
Vue
178 lines
4.4 KiB
Vue
<template>
|
|
<component
|
|
:is="as"
|
|
:type="as === 'button' ? 'button' : undefined"
|
|
class="chip"
|
|
:class="[`chip--${variant}`, { 'chip--active': active }]"
|
|
:aria-pressed="as === 'button' ? active : undefined"
|
|
@click="as === 'button' && emit('toggle')"
|
|
>
|
|
<span class="chip__label">{{ label }}</span>
|
|
<span v-if="count !== undefined" class="chip__count">{{ count }}</span>
|
|
<button
|
|
v-if="removable"
|
|
type="button"
|
|
class="chip__remove"
|
|
:aria-label="`Retirer ${label}`"
|
|
@click.stop="emit('remove')"
|
|
>
|
|
<svg width="10" height="10" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
<line x1="18" y1="6" x2="6" y2="18" />
|
|
<line x1="6" y1="6" x2="18" y2="18" />
|
|
</svg>
|
|
</button>
|
|
</component>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
withDefaults(
|
|
defineProps<{
|
|
label: string
|
|
variant?: 'echelle' | 'fonction' | 'posture'
|
|
active?: boolean
|
|
count?: number
|
|
as?: 'button' | 'span'
|
|
removable?: boolean
|
|
}>(),
|
|
{
|
|
variant: 'fonction',
|
|
active: false,
|
|
count: undefined,
|
|
as: 'button',
|
|
removable: false,
|
|
}
|
|
)
|
|
|
|
const emit = defineEmits<{
|
|
toggle: []
|
|
remove: []
|
|
}>()
|
|
</script>
|
|
|
|
<style scoped>
|
|
.chip {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: var(--space-2xs);
|
|
padding: var(--space-2xs) var(--space-sm);
|
|
border-radius: var(--radius-full);
|
|
font-size: var(--fs-xs);
|
|
line-height: var(--lh-tight);
|
|
font-weight: var(--fw-medium);
|
|
border: 1.5px solid transparent;
|
|
cursor: pointer;
|
|
user-select: none;
|
|
min-height: 32px;
|
|
box-sizing: border-box;
|
|
background: none;
|
|
transition: background-color var(--dur-fast) var(--ease-out),
|
|
color var(--dur-fast) var(--ease-out),
|
|
border-color var(--dur-fast) var(--ease-out),
|
|
transform var(--dur-fast) var(--ease-out);
|
|
}
|
|
|
|
@media (prefers-reduced-motion: reduce) {
|
|
.chip {
|
|
transition: none;
|
|
}
|
|
}
|
|
|
|
/* Survol : uniquement sur pointeur capable de survol. Sur tactile, :hover
|
|
reste collé après un tap (chip « allumé » sans être actif). */
|
|
@media (hover: hover) {
|
|
.chip:hover {
|
|
transform: translateY(-1px);
|
|
}
|
|
}
|
|
|
|
.chip:focus-visible {
|
|
outline: 2px solid var(--focus-ring);
|
|
outline-offset: 2px;
|
|
}
|
|
|
|
/* ── Échelle : outline bleu, fond transparent, actif = plein ────────────── */
|
|
.chip--echelle {
|
|
border-color: var(--primary);
|
|
color: var(--text);
|
|
background: transparent;
|
|
}
|
|
@media (hover: hover) {
|
|
.chip--echelle:hover {
|
|
background: var(--primary-hover);
|
|
border-color: var(--primary-hover);
|
|
color: var(--on-primary);
|
|
}
|
|
}
|
|
/* Actif = fond PLEIN. --primary est translucide dans le thème AEP
|
|
(rgba(26,34,56,.6) : 4,16:1 sur le fond de page, sous AA) ; le couple
|
|
--nav-primary-solid / --nav-text-on-primary (≈14,6:1) reste lisible aussi
|
|
en sombre. Le survol d'un chip actif ne change pas de fond. */
|
|
.chip--echelle.chip--active {
|
|
background: var(--nav-primary-solid);
|
|
border-color: var(--nav-primary-solid);
|
|
color: var(--nav-text-on-primary);
|
|
}
|
|
|
|
/* ── Fonction/hashtag : pleine bleu, inactif = bg-alt ────────────────────── */
|
|
.chip--fonction {
|
|
border-color: transparent;
|
|
background: var(--bg-alt);
|
|
color: var(--text);
|
|
}
|
|
@media (hover: hover) {
|
|
.chip--fonction:hover {
|
|
background: var(--primary-hover);
|
|
color: var(--on-primary);
|
|
}
|
|
}
|
|
.chip--fonction.chip--active {
|
|
background: var(--nav-primary-solid);
|
|
color: var(--nav-text-on-primary);
|
|
}
|
|
|
|
/* ── Posture (préparée pour plus tard) : outline safran ──────────────────── */
|
|
.chip--posture {
|
|
border-color: var(--accent);
|
|
color: var(--text);
|
|
background: transparent;
|
|
}
|
|
@media (hover: hover) {
|
|
.chip--posture:hover {
|
|
background: var(--accent);
|
|
color: var(--on-accent);
|
|
}
|
|
}
|
|
.chip--posture.chip--active {
|
|
background: var(--accent);
|
|
border-color: var(--accent);
|
|
color: var(--on-accent);
|
|
}
|
|
|
|
.chip__count {
|
|
font-size: 0.85em;
|
|
opacity: 0.75;
|
|
}
|
|
|
|
.chip__remove {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
width: 14px;
|
|
height: 14px;
|
|
padding: 0;
|
|
border: none;
|
|
background: transparent;
|
|
color: inherit;
|
|
opacity: 0.7;
|
|
cursor: pointer;
|
|
border-radius: var(--radius-full);
|
|
}
|
|
.chip__remove:hover {
|
|
opacity: 1;
|
|
}
|
|
.chip__remove:focus-visible {
|
|
outline: 2px solid var(--focus-ring);
|
|
outline-offset: 1px;
|
|
}
|
|
</style>
|