@tekkare/romulus 0.1.349 → 0.1.350
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/dist/module.json
CHANGED
|
@@ -25,10 +25,11 @@
|
|
|
25
25
|
defaut (sous la rangee du titre, avant les onglets).
|
|
26
26
|
-->
|
|
27
27
|
<script setup lang="ts">
|
|
28
|
+
import { nextTick, onBeforeUnmount, onMounted, ref, watch } from 'vue'
|
|
28
29
|
import { useRouter } from 'vue-router'
|
|
29
30
|
import type { RmHeaderTab } from './AppHeader.vue'
|
|
30
31
|
|
|
31
|
-
withDefaults(
|
|
32
|
+
const props = withDefaults(
|
|
32
33
|
defineProps<{
|
|
33
34
|
title?: string | null
|
|
34
35
|
/**
|
|
@@ -52,6 +53,66 @@ withDefaults(
|
|
|
52
53
|
const emit = defineEmits<{ tab: [key: string] }>()
|
|
53
54
|
|
|
54
55
|
const router = useRouter()
|
|
56
|
+
|
|
57
|
+
/* Onglets qui debordent : une barre de defilement fine passait inapercue, des
|
|
58
|
+
clients ne voyaient pas les derniers onglets. Une fleche (et un fondu) de
|
|
59
|
+
chaque cote ou il reste des onglets caches le dit clairement. */
|
|
60
|
+
const tabsEl = ref<HTMLElement | null>(null)
|
|
61
|
+
const canScrollLeft = ref(false)
|
|
62
|
+
const canScrollRight = ref(false)
|
|
63
|
+
|
|
64
|
+
function updateArrows() {
|
|
65
|
+
const el = tabsEl.value
|
|
66
|
+
if (!el) return
|
|
67
|
+
canScrollLeft.value = el.scrollLeft > 1
|
|
68
|
+
canScrollRight.value = el.scrollLeft + el.clientWidth < el.scrollWidth - 1
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function scrollTabs(direction: -1 | 1) {
|
|
72
|
+
const el = tabsEl.value
|
|
73
|
+
if (!el) return
|
|
74
|
+
el.scrollBy({ left: direction * el.clientWidth * 0.7, behavior: 'smooth' })
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* L'onglet actif reste visible, meme ouvert par un lien sur un onglet du bout.
|
|
78
|
+
Calcul a la main : `scrollIntoView` ferait aussi defiler la page. */
|
|
79
|
+
function revealActiveTab() {
|
|
80
|
+
const el = tabsEl.value
|
|
81
|
+
const active = el?.querySelector<HTMLElement>('.rm-page-header__tab--active')
|
|
82
|
+
if (!el || !active) return
|
|
83
|
+
const margin = 40
|
|
84
|
+
const left = active.offsetLeft - el.offsetLeft
|
|
85
|
+
const right = left + active.offsetWidth
|
|
86
|
+
if (left < el.scrollLeft + margin) el.scrollLeft = Math.max(0, left - margin)
|
|
87
|
+
else if (right > el.scrollLeft + el.clientWidth - margin) el.scrollLeft = right - el.clientWidth + margin
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
let resizeObserver: ResizeObserver | null = null
|
|
91
|
+
|
|
92
|
+
onMounted(() => {
|
|
93
|
+
nextTick(() => {
|
|
94
|
+
revealActiveTab()
|
|
95
|
+
updateArrows()
|
|
96
|
+
})
|
|
97
|
+
if (typeof ResizeObserver !== 'undefined' && tabsEl.value) {
|
|
98
|
+
resizeObserver = new ResizeObserver(updateArrows)
|
|
99
|
+
resizeObserver.observe(tabsEl.value)
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
|
|
103
|
+
watch(
|
|
104
|
+
() => props.tabs.map((tab) => `${tab.key}:${tab.active ? 1 : 0}`).join('|'),
|
|
105
|
+
() => nextTick(() => {
|
|
106
|
+
if (resizeObserver && tabsEl.value) {
|
|
107
|
+
resizeObserver.disconnect()
|
|
108
|
+
resizeObserver.observe(tabsEl.value)
|
|
109
|
+
}
|
|
110
|
+
revealActiveTab()
|
|
111
|
+
updateArrows()
|
|
112
|
+
}),
|
|
113
|
+
)
|
|
114
|
+
|
|
115
|
+
onBeforeUnmount(() => resizeObserver?.disconnect())
|
|
55
116
|
</script>
|
|
56
117
|
|
|
57
118
|
<template>
|
|
@@ -76,7 +137,26 @@ const router = useRouter()
|
|
|
76
137
|
</div>
|
|
77
138
|
<slot />
|
|
78
139
|
|
|
79
|
-
<div
|
|
140
|
+
<div
|
|
141
|
+
v-if="tabs.length"
|
|
142
|
+
class="rm-page-header__tabs-wrap"
|
|
143
|
+
:class="{
|
|
144
|
+
'rm-page-header__tabs-wrap--left': canScrollLeft,
|
|
145
|
+
'rm-page-header__tabs-wrap--right': canScrollRight,
|
|
146
|
+
}"
|
|
147
|
+
>
|
|
148
|
+
<button
|
|
149
|
+
v-if="canScrollLeft"
|
|
150
|
+
type="button"
|
|
151
|
+
class="rm-page-header__tabs-arrow rm-page-header__tabs-arrow--left"
|
|
152
|
+
aria-label="Onglets précédents"
|
|
153
|
+
title="Onglets précédents"
|
|
154
|
+
tabindex="-1"
|
|
155
|
+
@click="scrollTabs(-1)"
|
|
156
|
+
>
|
|
157
|
+
<RmIcon name="CaretLeft" :size="16" />
|
|
158
|
+
</button>
|
|
159
|
+
<div ref="tabsEl" class="rm-page-header__tabs" role="tablist" :aria-label="tabsLabel" @scroll.passive="updateArrows">
|
|
80
160
|
<button
|
|
81
161
|
v-for="tab in tabs"
|
|
82
162
|
:key="tab.key"
|
|
@@ -96,9 +176,21 @@ const router = useRouter()
|
|
|
96
176
|
<span v-if="tab.tag" class="rm-page-header__tab-tag">{{ tab.tag }}</span>
|
|
97
177
|
</button>
|
|
98
178
|
</div>
|
|
179
|
+
<button
|
|
180
|
+
v-if="canScrollRight"
|
|
181
|
+
type="button"
|
|
182
|
+
class="rm-page-header__tabs-arrow rm-page-header__tabs-arrow--right"
|
|
183
|
+
aria-label="Onglets suivants"
|
|
184
|
+
title="Onglets suivants"
|
|
185
|
+
tabindex="-1"
|
|
186
|
+
@click="scrollTabs(1)"
|
|
187
|
+
>
|
|
188
|
+
<RmIcon name="CaretRight" :size="16" />
|
|
189
|
+
</button>
|
|
190
|
+
</div>
|
|
99
191
|
</header>
|
|
100
192
|
</template>
|
|
101
193
|
|
|
102
194
|
<style scoped>
|
|
103
|
-
.rm-page-header{backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);box-sizing:border-box;color:var(--text-primary);display:flex;flex-direction:column;font-family:var(--font-sans);gap:var(--space-12);padding:var(--space-16) var(--space-32) var(--space-12);position:sticky;top:0;width:100%;z-index:95}.rm-page-header__row{align-items:center;align-self:stretch;display:flex;gap:var(--space-16)}.rm-page-header__back{background:transparent;border:none;color:inherit;cursor:pointer;display:inline-flex;padding:0}.rm-page-header__heading{flex-grow:2;min-width:0}.rm-page-header__eyebrow{color:var(--text-muted);font-size:var(--font-12);font-weight:var(--weight-medium);margin:0 0 2px}.rm-page-header__title{flex-grow:2;font-family:var(--font-serif);font-size:var(--font-32);font-weight:700;letter-spacing:-.02em;line-height:1.1;margin:0;min-width:0}.rm-page-header__title :deep(h1),.rm-page-header__title :deep(h2),.rm-page-header__title :deep(p){font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-page-header__actions{align-items:center;display:flex;flex:0 0 auto;gap:var(--space-16)}.rm-page-header__tabs{display:flex;gap:var(--space-8);
|
|
195
|
+
.rm-page-header{backdrop-filter:blur(12px);background:color-mix(in srgb,var(--bg-surface-3) 80%,transparent);border-bottom:1px solid var(--border-default);box-sizing:border-box;color:var(--text-primary);display:flex;flex-direction:column;font-family:var(--font-sans);gap:var(--space-12);padding:var(--space-16) var(--space-32) var(--space-12);position:sticky;top:0;width:100%;z-index:95}.rm-page-header__row{align-items:center;align-self:stretch;display:flex;gap:var(--space-16)}.rm-page-header__back{background:transparent;border:none;color:inherit;cursor:pointer;display:inline-flex;padding:0}.rm-page-header__heading{flex-grow:2;min-width:0}.rm-page-header__eyebrow{color:var(--text-muted);font-size:var(--font-12);font-weight:var(--weight-medium);margin:0 0 2px}.rm-page-header__title{flex-grow:2;font-family:var(--font-serif);font-size:var(--font-32);font-weight:700;letter-spacing:-.02em;line-height:1.1;margin:0;min-width:0}.rm-page-header__title :deep(h1),.rm-page-header__title :deep(h2),.rm-page-header__title :deep(p){font-family:inherit;font-size:inherit;font-weight:inherit;line-height:inherit;margin:0}.rm-page-header__actions{align-items:center;display:flex;flex:0 0 auto;gap:var(--space-16)}.rm-page-header__tabs-wrap{margin-bottom:-13px;min-width:0;position:relative}.rm-page-header__tabs{display:flex;gap:var(--space-8);overflow-x:auto;scrollbar-width:none}.rm-page-header__tabs::-webkit-scrollbar{display:none}.rm-page-header__tabs-wrap--left .rm-page-header__tabs{-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 64px);mask-image:linear-gradient(90deg,transparent 0,#000 64px)}.rm-page-header__tabs-wrap--right .rm-page-header__tabs{-webkit-mask-image:linear-gradient(270deg,transparent 0,#000 64px);mask-image:linear-gradient(270deg,transparent 0,#000 64px)}.rm-page-header__tabs-wrap--left.rm-page-header__tabs-wrap--right .rm-page-header__tabs{-webkit-mask-image:linear-gradient(90deg,transparent 0,#000 64px,#000 calc(100% - 64px),transparent);mask-image:linear-gradient(90deg,transparent 0,#000 64px,#000 calc(100% - 64px),transparent)}.rm-page-header__tabs-arrow{align-items:center;background:var(--bg-surface);border:1px solid var(--border-default);border-radius:var(--radius-pill);box-shadow:0 1px 4px rgba(0,0,0,.12);color:var(--color-primary);cursor:pointer;display:inline-flex;height:28px;justify-content:center;padding:0;position:absolute;top:50%;transform:translateY(-50%);transition:background-color .15s,color .15s;width:28px;z-index:1}.rm-page-header__tabs-arrow:hover{background:color-mix(in srgb,var(--color-primary) 12%,var(--bg-surface))}.rm-page-header__tabs-arrow--left{left:0}.rm-page-header__tabs-arrow--right{right:0}.rm-page-header__tab{background:none;border:none;border-bottom:3px solid transparent;border-radius:8px 8px 0 0;color:var(--text-muted);cursor:pointer;font-family:inherit;font-size:var(--font-14);font-weight:500;line-height:1.6;padding:var(--space-8) var(--space-16) var(--space-10);transition:background-color .3s,color .15s;white-space:nowrap}.rm-page-header__tab:hover{color:var(--color-primary)}.rm-page-header__tab-count{background:color-mix(in srgb,currentColor 12%,transparent);border-radius:var(--radius-pill);font-size:var(--font-12)}.rm-page-header__tab-count,.rm-page-header__tab-tag{display:inline-block;font-weight:600;line-height:1.5;margin-left:var(--space-6);padding:0 var(--space-6)}.rm-page-header__tab-tag{border:1px solid;border-radius:var(--radius-pill);font-size:var(--font-11,11px);letter-spacing:.02em;vertical-align:1px}.rm-page-header__tab--disabled{cursor:not-allowed;opacity:.6}.rm-page-header__tab--disabled,.rm-page-header__tab--disabled:hover{color:var(--text-disabled,var(--text-muted))}.rm-page-header__tab--active{background:color-mix(in srgb,var(--color-primary) 6%,transparent);border-bottom-color:var(--color-primary);color:var(--color-primary);font-weight:600}
|
|
104
196
|
</style>
|
|
@@ -7,12 +7,15 @@
|
|
|
7
7
|
/* Le bandeau de page traverse tout le cadre, quel que soit le wrapper de la
|
|
8
8
|
page (`oip_grid`, `arg_page_layout`...) : meme calcul que la barre de
|
|
9
9
|
filtres (largeur publiee par OipShell, marges negatives). Son contenu reste
|
|
10
|
-
cale sur la colonne de contenu.
|
|
10
|
+
cale sur la colonne de contenu. La marge part de la largeur reelle du
|
|
11
|
+
parent (`100%`), pas du plafond de la colonne : un bandeau pose
|
|
12
|
+
directement dans la colonne pleine largeur (sans wrapper plafonne)
|
|
13
|
+
etait sinon decale a gauche et coupe a droite. */
|
|
11
14
|
.rm-shell .main_container .rm-page-header {
|
|
12
15
|
box-sizing: border-box;
|
|
13
16
|
width: var(--oip-main-w, 100%);
|
|
14
17
|
max-width: none;
|
|
15
|
-
margin-inline: calc((
|
|
18
|
+
margin-inline: calc((100% - var(--oip-main-w, 100%)) / 2);
|
|
16
19
|
padding-inline: max(32px, (var(--oip-main-w, 100%) - var(--oip-content-max, 100%)) / 2 + 32px);
|
|
17
20
|
}
|
|
18
21
|
|