@cnamts/synapse 1.0.6 → 1.0.8
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/{DateFilter-BlOpwEVq.js → DateFilter-DkqG0pmr.js} +1 -1
- package/dist/{NumberFilter-BPUXE4wY.js → NumberFilter-Ck7AwD39.js} +1 -1
- package/dist/{PeriodFilter-B2yx329_.js → PeriodFilter-LRI6YpgU.js} +1 -1
- package/dist/{SelectFilter-CedKn1oV.js → SelectFilter-DPc70Jk7.js} +1 -1
- package/dist/{TextFilter-DkhJjRtR.js → TextFilter-DRQL7uD8.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.d.ts +116 -0
- package/dist/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +220 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +68 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.d.ts +204 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +26 -26
- package/dist/components/Amelipro/AmeliproBadge/AmeliproBadge.d.ts +59 -0
- package/dist/components/Amelipro/AmeliproBtn/AmeliproBtn.d.ts +3 -3
- package/dist/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +214 -0
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproCarousel/types.d.ts +7 -0
- package/dist/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.d.ts +125 -0
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproResultList/AmeliproResultList.d.ts +164 -0
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +27 -27
- package/dist/components/Amelipro/AmeliproStateTile/AmeliproStateTile.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +32 -32
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +7 -7
- package/dist/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTooltips/AmeliproTooltips.d.ts +2 -2
- package/dist/components/ChipList/ChipList.d.ts +4 -0
- package/dist/components/ChipList/locales.d.ts +4 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +8 -8
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +329 -1296
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +0 -1
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +2 -0
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +71 -0
- package/dist/components/Customs/SyTabs/config.d.ts +17 -0
- package/dist/components/Customs/SyTabs/types.d.ts +11 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +9 -9
- package/dist/components/DataList/DataList.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +4811 -240
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +52 -33
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +23 -10
- package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +1 -0
- package/dist/components/DatePicker/composables/useTodayButton.d.ts +1 -0
- package/dist/components/DialogBox/DialogBox.d.ts +219 -0
- package/dist/components/HeaderLoading/HeaderLoading.d.ts +27 -0
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +110 -3
- package/dist/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.d.ts +19 -1
- package/dist/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/components/NirField/NirField.d.ts +18 -18
- package/dist/components/PeriodField/PeriodField.d.ts +10766 -1620
- package/dist/components/PhoneField/PhoneField.d.ts +1866 -2
- package/dist/components/PhoneField/indicatifs.d.ts +1 -0
- package/dist/components/PhoneField/locales.d.ts +1 -0
- package/dist/components/RangeField/RangeField.d.ts +1 -1
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/SubHeader/SubHeader.d.ts +8 -0
- package/dist/components/SubHeader/locales.d.ts +1 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +6 -6
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -4
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -4
- package/dist/components/Tables/common/SyTablePagination.d.ts +333 -1296
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +2 -2
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/design-system-v3.js +173 -164
- package/dist/design-system-v3.umd.cjs +286 -263
- package/dist/{main-BXPFSAB4.js → main-DXMoMtj5.js} +13176 -11457
- package/dist/services/NotificationService.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/amelipro/icons.ts +38 -11
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.stories.ts +135 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.vue +107 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/__snapshots__/AmeliproAccordionGroup.spec.ts.snap +513 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.mdx +16 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +300 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +288 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/AmeliproAccordionList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +1712 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.mdx +19 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +68 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +66 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.vue +145 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/AmeliproAccordionResultTemplate.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/__snapshots__/AmeliproAccordionResultTemplate.spec.ts.snap +127 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/AmeliproAccordionResult.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/__snapshots__/AmeliproAccordionResult.spec.ts.snap +123 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +273 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +275 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/AmeliproAccordionResultList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +1593 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.mdx +15 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.stories.ts +54 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.vue +76 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/AmeliproBadge.spec.ts +20 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/__snapshots__/AmeliproBadge.spec.ts.snap +19 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.mdx +15 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.stories.ts +191 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +263 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.vue +93 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/AmeliproCarouselItem.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/__snapshots__/AmeliproCarouselItem.spec.ts.snap +43 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/AmeliproCarousel.spec.ts +40 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/__snapshots__/AmeliproCarousel.spec.ts.snap +342 -0
- package/src/components/Amelipro/AmeliproCarousel/types.d.ts +8 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.mdx +18 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.stories.ts +67 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.vue +233 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/AmeliproClickableTile.spec.ts +21 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/__snapshots__/AmeliproClickableTile.spec.ts.snap +140 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +7 -1
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproIcon/iconList.ts +6 -0
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.mdx +15 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +264 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +231 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/AmeliproResultList.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +434 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +6 -5
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +23 -26
- package/src/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.stories.ts +2 -2
- package/src/components/ChipList/Accessibilite.stories.ts +4 -0
- package/src/components/ChipList/ChipList.vue +185 -42
- package/src/components/ChipList/locales.ts +4 -2
- package/src/components/ChipList/tests/chipList.spec.ts +7 -4
- package/src/components/Customs/Selects/SelectOverview.mdx +34 -66
- package/src/components/Customs/Selects/SyBtnSelect/SyBtnSelect.stories.ts +10 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.mdx +3 -0
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +14 -0
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +14 -6
- package/src/components/Customs/Selects/SySelect/SySelect.vue +268 -205
- package/src/components/Customs/Selects/SySelect/composables/tests/useSySelectKeyboard.spec.ts +0 -10
- package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +0 -5
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +184 -25
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +3 -1
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +165 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +28 -9
- package/src/components/Customs/SyTabs/Accessibilite.mdx +309 -0
- package/src/components/Customs/SyTabs/SyTabs.mdx +117 -0
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +354 -0
- package/src/components/Customs/SyTabs/SyTabs.vue +413 -0
- package/src/components/Customs/SyTabs/config.ts +17 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +425 -0
- package/src/components/Customs/SyTabs/types.ts +12 -0
- package/src/components/Customs/SyTextField/SyTextField.mdx +3 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +142 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -16
- package/src/components/DataList/DataList.vue +47 -49
- package/src/components/DataListGroup/DataListGroup.vue +1 -1
- package/src/components/DataListItem/DataListItem.vue +67 -63
- package/src/components/DataListItem/tests/DataListItem.spec.ts +2 -2
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +3 -3
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +49 -13
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +412 -649
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +215 -0
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.mdx +2 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +281 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +17 -4
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +111 -18
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +238 -6
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +716 -757
- package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +4 -4
- package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +17 -10
- package/src/components/DatePicker/composables/useDateInputEditing.ts +52 -22
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +18 -4
- package/src/components/DatePicker/composables/useTodayButton.ts +13 -1
- package/src/components/DatePicker/utils/dateFormattingUtils.ts +79 -14
- package/src/components/DialogBox/DialogBox.stories.ts +12 -0
- package/src/components/DialogBox/DialogBox.vue +16 -11
- package/src/components/DialogBox/tests/DialogBox.spec.ts +22 -0
- package/src/components/HeaderLoading/Accessibilite.mdx +429 -8
- package/src/components/HeaderLoading/Accessibilite.stories.ts +4 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +59 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +17 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +91 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +37 -1
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +284 -21
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +2 -2
- package/src/components/NirField/NirField.mdx +3 -0
- package/src/components/NirField/NirField.vue +10 -1
- package/src/components/NirField/tests/NirField.spec.ts +81 -0
- package/src/components/NotificationBar/NotificationBar.stories.ts +128 -2
- package/src/components/NotificationBar/NotificationBar.vue +16 -1
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +65 -0
- package/src/components/PasswordField/PasswordField.mdx +3 -0
- package/src/components/PeriodField/PeriodField.mdx +2 -0
- package/src/components/PeriodField/PeriodField.stories.ts +195 -0
- package/src/components/PhoneField/Accessibilite.stories.ts +4 -0
- package/src/components/PhoneField/PhoneField.mdx +3 -1
- package/src/components/PhoneField/PhoneField.stories.ts +285 -1
- package/src/components/PhoneField/PhoneField.vue +228 -95
- package/src/components/PhoneField/indicatifs.ts +102 -102
- package/src/components/PhoneField/locales.ts +1 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +419 -2
- package/src/components/SkipLink/SkipLink.vue +3 -31
- package/src/components/SkipLink/tests/skipLink.spec.ts +0 -21
- package/src/components/SubHeader/Accessibilite.stories.ts +8 -0
- package/src/components/SubHeader/SubHeader.mdx +1 -0
- package/src/components/SubHeader/SubHeader.stories.ts +179 -60
- package/src/components/SubHeader/SubHeader.vue +45 -15
- package/src/components/SubHeader/locales.ts +1 -0
- package/src/components/SyAlert/SyAlert.vue +6 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +3 -10
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +242 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +29 -10
- package/src/components/Tables/SyTable/SyTable.mdx +3 -10
- package/src/components/Tables/SyTable/SyTable.stories.ts +242 -0
- package/src/components/Tables/SyTable/SyTable.vue +2 -0
- package/src/components/Tables/common/SyTablePagination.vue +13 -6
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +6 -1
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +157 -0
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/index.ts +9 -0
- package/src/composables/useFilterable/useFilterable.ts +10 -0
- package/src/designTokens/tokens/amelipro/apColors.ts +1 -1
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +3 -3
- package/src/services/NotificationService.ts +9 -0
- package/src/stories/Components/Components.stories.ts +1 -1
- package/src/stories/GuideDuDev/FormValidationGuide.mdx +342 -0
- package/src/stories/Templates/Templates.stories.ts +1 -1
- package/src/utils/functions/ameliproColors/ameliproColors.ts +1 -1
- package/dist/components/DataList/locales.d.ts +0 -3
- package/src/components/DataList/locales.ts +0 -3
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +0 -266
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import type { TabItem } from './types'
|
|
3
|
+
import useCustomizableOptions from '@/composables/useCustomizableOptions'
|
|
4
|
+
import { config } from './config'
|
|
5
|
+
import { ref, watch, onMounted, onUnmounted, getCurrentInstance } from 'vue'
|
|
6
|
+
import type { Router } from 'vue-router'
|
|
7
|
+
|
|
8
|
+
const props = withDefaults(defineProps<{
|
|
9
|
+
items: TabItem[]
|
|
10
|
+
modelValue?: number | string
|
|
11
|
+
/** Si activé, une confirmation sera demandée avant de changer d'onglet */
|
|
12
|
+
confirmTabChange?: boolean
|
|
13
|
+
/** Message affiché dans la boîte de dialogue de confirmation */
|
|
14
|
+
confirmationMessage?: boolean
|
|
15
|
+
/** Options personnalisées pour les composants Vuetify */
|
|
16
|
+
vuetifyOptions?: {
|
|
17
|
+
sheet?: {
|
|
18
|
+
theme?: string
|
|
19
|
+
dense?: boolean
|
|
20
|
+
color?: string
|
|
21
|
+
}
|
|
22
|
+
tabs?: {
|
|
23
|
+
height?: string
|
|
24
|
+
showArrows?: boolean
|
|
25
|
+
}
|
|
26
|
+
tab?: {
|
|
27
|
+
'base-color'?: string
|
|
28
|
+
'active-color'?: string
|
|
29
|
+
'slider-color'?: string
|
|
30
|
+
'ripple'?: boolean
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}>(), {
|
|
34
|
+
modelValue: undefined,
|
|
35
|
+
confirmTabChange: false,
|
|
36
|
+
confirmationMessage: false,
|
|
37
|
+
vuetifyOptions: () => ({}),
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
// Disable automatic attribute inheritance since we handle it manually
|
|
41
|
+
defineOptions({
|
|
42
|
+
inheritAttrs: false,
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits(['update:modelValue', 'cancel-navigation', 'confirm-tab-change'])
|
|
46
|
+
|
|
47
|
+
defineSlots<{
|
|
48
|
+
'tabs-prepend': () => unknown
|
|
49
|
+
'tabs-append': () => unknown
|
|
50
|
+
'default': () => unknown
|
|
51
|
+
}>()
|
|
52
|
+
|
|
53
|
+
const options = useCustomizableOptions(config, { vuetifyOptions: props.vuetifyOptions })
|
|
54
|
+
|
|
55
|
+
// Safely get router through getCurrentInstance - it might not be available in all contexts
|
|
56
|
+
const instance = getCurrentInstance()
|
|
57
|
+
const router = instance?.appContext.config.globalProperties.$router as Router | null || null
|
|
58
|
+
|
|
59
|
+
// État pour suivre l'élément activement sélectionné
|
|
60
|
+
const activeItemIndex = ref<number>(0)
|
|
61
|
+
// Élément actuellement focusé (pour la navigation clavier)
|
|
62
|
+
const focusedItemIndex = ref<number>(-1)
|
|
63
|
+
|
|
64
|
+
// Émet un événement pour gérer la confirmation de changement d'onglet
|
|
65
|
+
async function handleTabChangeConfirmation(message: string): Promise<boolean> {
|
|
66
|
+
// Émettre l'événement avec le message et retourner une promesse
|
|
67
|
+
let resolver: (value: boolean) => void
|
|
68
|
+
const promise = new Promise<boolean>((resolve) => {
|
|
69
|
+
resolver = resolve
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
// Émettre l'événement avec le message et un callback pour résoudre la promesse
|
|
73
|
+
emit('confirm-tab-change', message, (confirmed: boolean) => {
|
|
74
|
+
resolver(confirmed)
|
|
75
|
+
})
|
|
76
|
+
|
|
77
|
+
return promise
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Fonction pour activer un élément au clic avec confirmation si nécessaire
|
|
81
|
+
async function setActiveItem(index: number) {
|
|
82
|
+
// Si l'index est déjà actif, ne rien faire
|
|
83
|
+
if (index === activeItemIndex.value) return
|
|
84
|
+
|
|
85
|
+
// Récupérer l'item pour la navigation potentielle
|
|
86
|
+
const item = props.items[index]
|
|
87
|
+
const hasHref = item && (item.href || item.to)
|
|
88
|
+
|
|
89
|
+
// Si la confirmation est activée, demander confirmation
|
|
90
|
+
if (props.confirmTabChange && hasHref) {
|
|
91
|
+
const confirmMessage = props.confirmationMessage
|
|
92
|
+
const confirmed = await handleTabChangeConfirmation(confirmMessage.toString())
|
|
93
|
+
|
|
94
|
+
if (!confirmed) {
|
|
95
|
+
// L'utilisateur a annulé, émettre un événement d'annulation
|
|
96
|
+
emit('cancel-navigation')
|
|
97
|
+
return
|
|
98
|
+
}
|
|
99
|
+
// Si confirmé, laisser la navigation se faire naturellement (RouterLink ou href)
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Mettre à jour l'onglet actif
|
|
103
|
+
activeItemIndex.value = index
|
|
104
|
+
emit('update:modelValue', typeof props.modelValue === 'string' ? props.items[index].value : index)
|
|
105
|
+
|
|
106
|
+
// Pour les éléments sans navigation (ni href ni to), on ne fait que mettre à jour l'état
|
|
107
|
+
// La navigation pour RouterLink et href se fait automatiquement via les éléments HTML
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
// Fonction pour gérer les touches Enter et Space
|
|
111
|
+
function handleKeyPress(event: KeyboardEvent, index: number) {
|
|
112
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
113
|
+
const item = props.items[index]
|
|
114
|
+
// Don't prevent default for external links - let them navigate naturally
|
|
115
|
+
if (!item.href) {
|
|
116
|
+
event.preventDefault()
|
|
117
|
+
}
|
|
118
|
+
void setActiveItem(index) // void pour ignorer la promesse
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// Configuration des attributs ARIA et gestion du focus global
|
|
123
|
+
function setupAccessibilityFeatures() {
|
|
124
|
+
// Ajouter un écouteur global pour gérer l'escape key
|
|
125
|
+
const handleEscape = (event: KeyboardEvent) => {
|
|
126
|
+
if (event.key === 'Escape' && focusedItemIndex.value >= 0) {
|
|
127
|
+
// Retirer le focus des éléments du menu
|
|
128
|
+
focusedItemIndex.value = -1
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
window.addEventListener('keydown', handleEscape)
|
|
133
|
+
|
|
134
|
+
// Cleanup
|
|
135
|
+
onUnmounted(() => {
|
|
136
|
+
window.removeEventListener('keydown', handleEscape)
|
|
137
|
+
})
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
// Navigation clavier entre les tabs (touches de direction)
|
|
141
|
+
function handleArrowNavigation(event: KeyboardEvent, currentIndex: number) {
|
|
142
|
+
if (!['ArrowLeft', 'ArrowRight', 'Home', 'End'].includes(event.key)) return
|
|
143
|
+
event.preventDefault()
|
|
144
|
+
const itemCount = props.items?.length || 0
|
|
145
|
+
if (itemCount === 0) return
|
|
146
|
+
|
|
147
|
+
let newIndex = currentIndex
|
|
148
|
+
switch (event.key) {
|
|
149
|
+
case 'ArrowLeft':
|
|
150
|
+
newIndex = currentIndex <= 0 ? itemCount - 1 : currentIndex - 1
|
|
151
|
+
break
|
|
152
|
+
case 'ArrowRight':
|
|
153
|
+
newIndex = currentIndex >= itemCount - 1 ? 0 : currentIndex + 1
|
|
154
|
+
break
|
|
155
|
+
case 'Home':
|
|
156
|
+
newIndex = 0
|
|
157
|
+
break
|
|
158
|
+
case 'End':
|
|
159
|
+
newIndex = itemCount - 1
|
|
160
|
+
break
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
// Mettre à jour l'index de l'élément focusé et actif
|
|
164
|
+
focusedItemIndex.value = newIndex
|
|
165
|
+
|
|
166
|
+
// Focus sur le nouvel élément et l'activer
|
|
167
|
+
// Vérifier si l'élément existe et se focaliser sur le bouton
|
|
168
|
+
const tabButton = document.getElementById(`tab-${newIndex}`)
|
|
169
|
+
if (tabButton) {
|
|
170
|
+
tabButton.focus()
|
|
171
|
+
setActiveItem(newIndex)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
// Initialiser l'élément actif au montage
|
|
176
|
+
onMounted(() => {
|
|
177
|
+
// Configurer l'accessibilité
|
|
178
|
+
setupAccessibilityFeatures()
|
|
179
|
+
|
|
180
|
+
// Si les items ne sont pas un tableau ou vides, ne rien faire
|
|
181
|
+
if (!Array.isArray(props.items) || props.items.length === 0) return
|
|
182
|
+
|
|
183
|
+
// Si modelValue est défini, utiliser cette valeur pour déterminer l'index actif
|
|
184
|
+
if (props.modelValue !== undefined) {
|
|
185
|
+
if (typeof props.modelValue === 'number') {
|
|
186
|
+
try {
|
|
187
|
+
const currentPath = window.location?.pathname
|
|
188
|
+
const index = currentPath ? props.items.findIndex(item => item.to === currentPath) : -1
|
|
189
|
+
|
|
190
|
+
// Si un index valide est trouvé, l'utiliser
|
|
191
|
+
if (index >= 0) {
|
|
192
|
+
activeItemIndex.value = index
|
|
193
|
+
}
|
|
194
|
+
// Sinon utiliser props.modelValue comme index direct si c'est valide
|
|
195
|
+
else if (props.modelValue >= 0 && props.modelValue < props.items.length) {
|
|
196
|
+
activeItemIndex.value = props.modelValue
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
catch {
|
|
200
|
+
// Utiliser props.modelValue comme fallback si c'est dans la plage valide
|
|
201
|
+
if (props.modelValue >= 0 && props.modelValue < props.items.length) {
|
|
202
|
+
activeItemIndex.value = props.modelValue
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
else {
|
|
207
|
+
// Chercher l'index de l'item avec la valeur correspondante
|
|
208
|
+
const index = props.items.findIndex(item => item.value === props.modelValue)
|
|
209
|
+
if (index !== -1) {
|
|
210
|
+
activeItemIndex.value = index
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
else {
|
|
215
|
+
// Par défaut, sélectionner le premier élément
|
|
216
|
+
activeItemIndex.value = 0
|
|
217
|
+
}
|
|
218
|
+
})
|
|
219
|
+
|
|
220
|
+
// Observer les changements du modelValue pour mettre à jour l'élément actif
|
|
221
|
+
watch(() => props.modelValue, (newValue) => {
|
|
222
|
+
if (newValue !== undefined) {
|
|
223
|
+
if (typeof newValue === 'number') {
|
|
224
|
+
activeItemIndex.value = newValue
|
|
225
|
+
}
|
|
226
|
+
else {
|
|
227
|
+
const index = props.items.findIndex(item => item.value === newValue)
|
|
228
|
+
if (index !== -1) {
|
|
229
|
+
activeItemIndex.value = index
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
})
|
|
234
|
+
</script>
|
|
235
|
+
|
|
236
|
+
<template>
|
|
237
|
+
<VSheet
|
|
238
|
+
:theme="options.sheet.theme"
|
|
239
|
+
:color="options.sheet.color"
|
|
240
|
+
:class="[{ 'v-sheet--dense': options.sheet.dense }, $attrs.class]"
|
|
241
|
+
v-bind="$attrs"
|
|
242
|
+
>
|
|
243
|
+
<div class="sy-tabs px-xl-0 px-4">
|
|
244
|
+
<slot name="tabs-prepend" />
|
|
245
|
+
<slot>
|
|
246
|
+
<nav
|
|
247
|
+
role="tablist"
|
|
248
|
+
aria-label="Onglets de navigation"
|
|
249
|
+
class="sy-tabs__nav"
|
|
250
|
+
>
|
|
251
|
+
<ul
|
|
252
|
+
class="sy-tabs__list"
|
|
253
|
+
>
|
|
254
|
+
<li
|
|
255
|
+
v-for="(item, index) in Array.isArray(items) ? items : []"
|
|
256
|
+
:key="index"
|
|
257
|
+
class="sy-tabs__item"
|
|
258
|
+
role="presentation"
|
|
259
|
+
>
|
|
260
|
+
<!-- Use RouterLink for internal navigation -->
|
|
261
|
+
<RouterLink
|
|
262
|
+
v-if="item.to && router"
|
|
263
|
+
:id="`tab-${index}`"
|
|
264
|
+
:to="item.to"
|
|
265
|
+
class="sy-tabs__button"
|
|
266
|
+
:class="{ 'sy-tabs__button--active': activeItemIndex === index }"
|
|
267
|
+
role="tab"
|
|
268
|
+
:aria-selected="activeItemIndex === index"
|
|
269
|
+
:aria-controls="`panel-${index}`"
|
|
270
|
+
tabindex="0"
|
|
271
|
+
@click="setActiveItem(index)"
|
|
272
|
+
@keydown="(event) => {
|
|
273
|
+
handleKeyPress(event, index);
|
|
274
|
+
handleArrowNavigation(event, index);
|
|
275
|
+
}"
|
|
276
|
+
>
|
|
277
|
+
{{ item.label.toUpperCase() }}
|
|
278
|
+
</RouterLink>
|
|
279
|
+
<!-- Use regular anchor for external links -->
|
|
280
|
+
<a
|
|
281
|
+
v-else-if="item.href"
|
|
282
|
+
:id="`tab-${index}`"
|
|
283
|
+
:href="item.href"
|
|
284
|
+
class="sy-tabs__button"
|
|
285
|
+
:class="{ 'sy-tabs__button--active': activeItemIndex === index }"
|
|
286
|
+
role="tab"
|
|
287
|
+
:aria-selected="activeItemIndex === index"
|
|
288
|
+
:aria-controls="`panel-${index}`"
|
|
289
|
+
tabindex="0"
|
|
290
|
+
@click="(event) => {
|
|
291
|
+
// Don't prevent default for external links - let them navigate naturally
|
|
292
|
+
setActiveItem(index);
|
|
293
|
+
}"
|
|
294
|
+
@keydown="(event) => {
|
|
295
|
+
handleKeyPress(event, index);
|
|
296
|
+
handleArrowNavigation(event, index);
|
|
297
|
+
}"
|
|
298
|
+
>
|
|
299
|
+
{{ item.label.toUpperCase() }}
|
|
300
|
+
</a>
|
|
301
|
+
<!-- Fallback button for items without navigation -->
|
|
302
|
+
<button
|
|
303
|
+
v-else
|
|
304
|
+
:id="`tab-${index}`"
|
|
305
|
+
class="sy-tabs__button"
|
|
306
|
+
:class="{ 'sy-tabs__button--active': activeItemIndex === index }"
|
|
307
|
+
role="tab"
|
|
308
|
+
:aria-selected="activeItemIndex === index"
|
|
309
|
+
:aria-controls="`panel-${index}`"
|
|
310
|
+
tabindex="0"
|
|
311
|
+
@click="setActiveItem(index)"
|
|
312
|
+
@keydown="(event) => {
|
|
313
|
+
handleKeyPress(event, index);
|
|
314
|
+
handleArrowNavigation(event, index);
|
|
315
|
+
}"
|
|
316
|
+
>
|
|
317
|
+
{{ item.label.toUpperCase() }}
|
|
318
|
+
</button>
|
|
319
|
+
</li>
|
|
320
|
+
</ul>
|
|
321
|
+
</nav>
|
|
322
|
+
</slot>
|
|
323
|
+
<slot name="tabs-append" />
|
|
324
|
+
</div>
|
|
325
|
+
</VSheet>
|
|
326
|
+
|
|
327
|
+
<!-- Panneau de contenu des onglets -->
|
|
328
|
+
<div class="sy-tabs-panels">
|
|
329
|
+
<div
|
|
330
|
+
v-for="(item, index) in Array.isArray(items) ? items : []"
|
|
331
|
+
:id="`panel-${index}`"
|
|
332
|
+
:key="`panel-${index}`"
|
|
333
|
+
class="sy-tabs-panel"
|
|
334
|
+
role="tabpanel"
|
|
335
|
+
:aria-labelledby="`tab-${index}`"
|
|
336
|
+
:hidden="activeItemIndex !== index"
|
|
337
|
+
>
|
|
338
|
+
<slot
|
|
339
|
+
:name="`panel-${index}`"
|
|
340
|
+
:active="activeItemIndex === index"
|
|
341
|
+
>
|
|
342
|
+
{{ item.content || '' }}
|
|
343
|
+
</slot>
|
|
344
|
+
</div>
|
|
345
|
+
</div>
|
|
346
|
+
</template>
|
|
347
|
+
|
|
348
|
+
<style lang="scss" scoped>
|
|
349
|
+
@use '@/assets/tokens.scss' as *;
|
|
350
|
+
|
|
351
|
+
.sy-tabs {
|
|
352
|
+
display: flex;
|
|
353
|
+
align-items: center;
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
.sy-tabs__nav {
|
|
357
|
+
flex: 1 1 0;
|
|
358
|
+
width: 100%;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
.sy-tabs__list {
|
|
362
|
+
display: flex;
|
|
363
|
+
list-style-type: none;
|
|
364
|
+
padding: 0;
|
|
365
|
+
margin: 0;
|
|
366
|
+
width: 100%;
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.sy-tabs__item {
|
|
370
|
+
cursor: pointer;
|
|
371
|
+
display: flex;
|
|
372
|
+
align-items: stretch;
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
.sy-tabs__button {
|
|
376
|
+
display: flex;
|
|
377
|
+
align-items: center;
|
|
378
|
+
justify-content: center;
|
|
379
|
+
padding: 0 16px;
|
|
380
|
+
min-height: v-bind("options.tabs.height + 'px'");
|
|
381
|
+
font-size: 0.875rem;
|
|
382
|
+
font-weight: 700;
|
|
383
|
+
background: none;
|
|
384
|
+
border: none;
|
|
385
|
+
color: v-bind("options.tab['base-color']");
|
|
386
|
+
transition: color 0.2s ease;
|
|
387
|
+
text-decoration: none; /* For RouterLink elements */
|
|
388
|
+
|
|
389
|
+
&:hover {
|
|
390
|
+
color: v-bind("options.tab['active-color']");
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
&:focus-visible {
|
|
394
|
+
outline: 3px solid v-bind("options.tab['active-color']");
|
|
395
|
+
outline-offset: -3px;
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
&--active {
|
|
399
|
+
color: v-bind("options.tab['active-color']");
|
|
400
|
+
border-bottom: 3px solid v-bind("options.tab['slider-color']");
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
.sy-tabs-panels {
|
|
405
|
+
padding: 16px;
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
.sy-tabs-panel {
|
|
409
|
+
&[hidden] {
|
|
410
|
+
display: none;
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
</style>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export const config = {
|
|
2
|
+
sheet: {
|
|
3
|
+
theme: 'default',
|
|
4
|
+
dense: false,
|
|
5
|
+
color: '#fff',
|
|
6
|
+
},
|
|
7
|
+
tabs: {
|
|
8
|
+
'height': '48',
|
|
9
|
+
'show-arrows': true,
|
|
10
|
+
},
|
|
11
|
+
tab: {
|
|
12
|
+
'base-color': '#0C419A',
|
|
13
|
+
'active-color': '#0C419A',
|
|
14
|
+
'slider-color': '#0C419A',
|
|
15
|
+
'ripple': false,
|
|
16
|
+
},
|
|
17
|
+
}
|