@flux-ui/components 3.0.0-next.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 +45 -0
- package/package.json +77 -0
- package/src/component/FluxAction.vue +27 -0
- package/src/component/FluxActionBar.vue +94 -0
- package/src/component/FluxActionPane.vue +40 -0
- package/src/component/FluxActions.vue +27 -0
- package/src/component/FluxAlert.vue +37 -0
- package/src/component/FluxAnimatedColors.vue +141 -0
- package/src/component/FluxAspectRatio.vue +21 -0
- package/src/component/FluxAutoGrid.vue +27 -0
- package/src/component/FluxAvatar.vue +119 -0
- package/src/component/FluxBadge.vue +84 -0
- package/src/component/FluxBadgeStack.vue +18 -0
- package/src/component/FluxBorderShine.vue +36 -0
- package/src/component/FluxBoxedIcon.vue +36 -0
- package/src/component/FluxButton.vue +110 -0
- package/src/component/FluxButtonGroup.vue +15 -0
- package/src/component/FluxButtonStack.vue +28 -0
- package/src/component/FluxCalendar.vue +254 -0
- package/src/component/FluxCalendarEvent.vue +41 -0
- package/src/component/FluxCheckbox.vue +60 -0
- package/src/component/FluxChip.vue +57 -0
- package/src/component/FluxClickablePane.vue +61 -0
- package/src/component/FluxColorPicker.vue +265 -0
- package/src/component/FluxColorSelect.vue +81 -0
- package/src/component/FluxComment.vue +71 -0
- package/src/component/FluxConfirm.vue +42 -0
- package/src/component/FluxContainer.vue +23 -0
- package/src/component/FluxDataTable.vue +96 -0
- package/src/component/FluxDatePicker.vue +353 -0
- package/src/component/FluxDestructiveButton.vue +28 -0
- package/src/component/FluxDisabled.vue +22 -0
- package/src/component/FluxDivider.vue +37 -0
- package/src/component/FluxDotPattern.vue +72 -0
- package/src/component/FluxDropZone.vue +202 -0
- package/src/component/FluxDynamicView.vue +16 -0
- package/src/component/FluxExpandable.vue +119 -0
- package/src/component/FluxExpandableGroup.vue +53 -0
- package/src/component/FluxFader.vue +64 -0
- package/src/component/FluxFaderItem.vue +15 -0
- package/src/component/FluxFilter.vue +133 -0
- package/src/component/FluxFilterDate.vue +58 -0
- package/src/component/FluxFilterDateRange.vue +59 -0
- package/src/component/FluxFilterOption.vue +49 -0
- package/src/component/FluxFilterOptionAsync.vue +103 -0
- package/src/component/FluxFilterOptions.vue +62 -0
- package/src/component/FluxFilterOptionsAsync.vue +113 -0
- package/src/component/FluxFilterRange.vue +91 -0
- package/src/component/FluxFlickeringGrid.vue +141 -0
- package/src/component/FluxFlyout.vue +205 -0
- package/src/component/FluxFocalPointEditor.vue +137 -0
- package/src/component/FluxFocalPointImage.vue +29 -0
- package/src/component/FluxForm.vue +35 -0
- package/src/component/FluxFormColumn.vue +15 -0
- package/src/component/FluxFormDateInput.vue +92 -0
- package/src/component/FluxFormDateRangeInput.vue +87 -0
- package/src/component/FluxFormDateTimeInput.vue +120 -0
- package/src/component/FluxFormField.vue +98 -0
- package/src/component/FluxFormFieldAddition.vue +37 -0
- package/src/component/FluxFormInput.vue +223 -0
- package/src/component/FluxFormInputAddition.vue +31 -0
- package/src/component/FluxFormInputGroup.vue +25 -0
- package/src/component/FluxFormPinInput.vue +135 -0
- package/src/component/FluxFormRangeSlider.vue +179 -0
- package/src/component/FluxFormRow.vue +15 -0
- package/src/component/FluxFormSection.vue +23 -0
- package/src/component/FluxFormSelect.vue +59 -0
- package/src/component/FluxFormSelectAsync.vue +118 -0
- package/src/component/FluxFormSlider.vue +123 -0
- package/src/component/FluxFormTextArea.vue +53 -0
- package/src/component/FluxFormTimeZonePicker.vue +713 -0
- package/src/component/FluxGallery.vue +99 -0
- package/src/component/FluxGalleryItem.vue +49 -0
- package/src/component/FluxGrid.vue +28 -0
- package/src/component/FluxGridColumn.vue +31 -0
- package/src/component/FluxGridPattern.vue +60 -0
- package/src/component/FluxIcon.vue +79 -0
- package/src/component/FluxInfo.vue +28 -0
- package/src/component/FluxInfoStack.vue +17 -0
- package/src/component/FluxLegend.vue +27 -0
- package/src/component/FluxLink.vue +35 -0
- package/src/component/FluxMenu.vue +31 -0
- package/src/component/FluxMenuGroup.vue +21 -0
- package/src/component/FluxMenuItem.vue +84 -0
- package/src/component/FluxMenuOptions.vue +38 -0
- package/src/component/FluxMenuSubHeader.vue +33 -0
- package/src/component/FluxMenuTitle.vue +17 -0
- package/src/component/FluxNotice.vue +79 -0
- package/src/component/FluxNoticeStack.vue +17 -0
- package/src/component/FluxOverlay.vue +31 -0
- package/src/component/FluxPagination.vue +148 -0
- package/src/component/FluxPaginationBar.vue +81 -0
- package/src/component/FluxPane.vue +45 -0
- package/src/component/FluxPaneBody.vue +15 -0
- package/src/component/FluxPaneDeck.vue +24 -0
- package/src/component/FluxPaneFooter.vue +15 -0
- package/src/component/FluxPaneGroup.vue +15 -0
- package/src/component/FluxPaneHeader.vue +44 -0
- package/src/component/FluxPaneIllustration.vue +68 -0
- package/src/component/FluxPaneMedia.vue +31 -0
- package/src/component/FluxPercentageBar.vue +45 -0
- package/src/component/FluxPersona.vue +48 -0
- package/src/component/FluxPlaceholder.vue +56 -0
- package/src/component/FluxPressable.vue +77 -0
- package/src/component/FluxPrimaryButton.vue +28 -0
- package/src/component/FluxProgressBar.vue +75 -0
- package/src/component/FluxPrompt.vue +77 -0
- package/src/component/FluxPublishButton.vue +59 -0
- package/src/component/FluxQuantitySelector.vue +109 -0
- package/src/component/FluxRemove.vue +34 -0
- package/src/component/FluxRoot.vue +60 -0
- package/src/component/FluxSecondaryButton.vue +28 -0
- package/src/component/FluxSegmentedControl.vue +77 -0
- package/src/component/FluxSegmentedView.vue +15 -0
- package/src/component/FluxSeparator.vue +19 -0
- package/src/component/FluxSlideOver.vue +25 -0
- package/src/component/FluxSnackbar.vue +154 -0
- package/src/component/FluxSnackbarProvider.vue +34 -0
- package/src/component/FluxSpacer.vue +9 -0
- package/src/component/FluxSpacing.vue +32 -0
- package/src/component/FluxSpinner.vue +48 -0
- package/src/component/FluxSplitButton.vue +61 -0
- package/src/component/FluxStack.vue +40 -0
- package/src/component/FluxStatistic.vue +68 -0
- package/src/component/FluxStepper.vue +69 -0
- package/src/component/FluxStepperStep.vue +15 -0
- package/src/component/FluxStepperSteps.vue +62 -0
- package/src/component/FluxTab.vue +23 -0
- package/src/component/FluxTabBar.vue +87 -0
- package/src/component/FluxTabBarItem.vue +104 -0
- package/src/component/FluxTable.vue +68 -0
- package/src/component/FluxTableActions.vue +16 -0
- package/src/component/FluxTableCell.vue +47 -0
- package/src/component/FluxTableHeader.vue +111 -0
- package/src/component/FluxTableRow.vue +15 -0
- package/src/component/FluxTabs.vue +91 -0
- package/src/component/FluxTag.vue +85 -0
- package/src/component/FluxTagStack.vue +18 -0
- package/src/component/FluxTicks.vue +44 -0
- package/src/component/FluxTimeline.vue +17 -0
- package/src/component/FluxTimelineItem.vue +73 -0
- package/src/component/FluxToggle.vue +64 -0
- package/src/component/FluxToolbar.vue +32 -0
- package/src/component/FluxToolbarGroup.vue +18 -0
- package/src/component/FluxTooltip.vue +56 -0
- package/src/component/FluxTooltipProvider.vue +176 -0
- package/src/component/FluxWindow.vue +47 -0
- package/src/component/index.ts +142 -0
- package/src/component/primitive/Anchor.vue +17 -0
- package/src/component/primitive/AnchorPopup.vue +194 -0
- package/src/component/primitive/CoordinatePicker.vue +155 -0
- package/src/component/primitive/CoordinatePickerThumb.vue +71 -0
- package/src/component/primitive/FilterItem.vue +44 -0
- package/src/component/primitive/FilterMenuRenderer.ts +233 -0
- package/src/component/primitive/FilterOptionBase.vue +67 -0
- package/src/component/primitive/SelectBase.vue +340 -0
- package/src/component/primitive/SliderBase.vue +89 -0
- package/src/component/primitive/SliderThumb.vue +64 -0
- package/src/component/primitive/SliderTrack.vue +22 -0
- package/src/component/primitive/VNodeRenderer.ts +11 -0
- package/src/component/primitive/index.ts +10 -0
- package/src/composable/index.ts +9 -0
- package/src/composable/private/index.ts +3 -0
- package/src/composable/private/useFormSelect.ts +66 -0
- package/src/composable/private/useLoaded.ts +21 -0
- package/src/composable/private/useTranslate.ts +35 -0
- package/src/composable/useBreakpoints.ts +54 -0
- package/src/composable/useDisabled.ts +9 -0
- package/src/composable/useDisabledInjection.ts +6 -0
- package/src/composable/useExpandableGroupInjection.ts +10 -0
- package/src/composable/useFilterInjection.ts +22 -0
- package/src/composable/useFlyoutInjection.ts +10 -0
- package/src/composable/useFormFieldInjection.ts +8 -0
- package/src/composable/useTableInjection.ts +11 -0
- package/src/css/base.scss +33 -0
- package/src/css/component/Action.module.scss +107 -0
- package/src/css/component/Avatar.module.scss +177 -0
- package/src/css/component/Badge.module.scss +189 -0
- package/src/css/component/Button.module.scss +293 -0
- package/src/css/component/Calendar.module.scss +171 -0
- package/src/css/component/Chip.module.scss +58 -0
- package/src/css/component/Color.module.scss +184 -0
- package/src/css/component/Comment.module.scss +123 -0
- package/src/css/component/DatePicker.module.scss +193 -0
- package/src/css/component/Divider.module.scss +79 -0
- package/src/css/component/DropZone.module.scss +99 -0
- package/src/css/component/Expandable.module.scss +112 -0
- package/src/css/component/Fader.module.scss +38 -0
- package/src/css/component/Filter.module.scss +80 -0
- package/src/css/component/Flyout.module.scss +63 -0
- package/src/css/component/FocalPoint.module.scss +84 -0
- package/src/css/component/Form.module.scss +812 -0
- package/src/css/component/Gallery.module.scss +64 -0
- package/src/css/component/Grid.module.scss +24 -0
- package/src/css/component/Icon.module.scss +104 -0
- package/src/css/component/Info.module.scss +15 -0
- package/src/css/component/Layout.module.scss +63 -0
- package/src/css/component/Legend.module.scss +32 -0
- package/src/css/component/Menu.module.scss +314 -0
- package/src/css/component/Notice.module.scss +279 -0
- package/src/css/component/Overlay.module.scss +149 -0
- package/src/css/component/Pagination.module.scss +59 -0
- package/src/css/component/Pane.module.scss +218 -0
- package/src/css/component/PercentageBar.module.scss +31 -0
- package/src/css/component/Placeholder.module.scss +72 -0
- package/src/css/component/Progress.module.scss +84 -0
- package/src/css/component/Remove.module.scss +29 -0
- package/src/css/component/Root.module.scss +8 -0
- package/src/css/component/SegmentedControl.module.scss +82 -0
- package/src/css/component/Snackbar.module.scss +227 -0
- package/src/css/component/Spinner.module.scss +36 -0
- package/src/css/component/Statistic.module.scss +118 -0
- package/src/css/component/Stepper.module.scss +103 -0
- package/src/css/component/Tab.module.scss +162 -0
- package/src/css/component/Table.module.scss +164 -0
- package/src/css/component/Timeline.module.scss +173 -0
- package/src/css/component/Toolbar.module.scss +82 -0
- package/src/css/component/Tooltip.module.scss +62 -0
- package/src/css/component/Transition.module.scss +142 -0
- package/src/css/component/Visual.module.scss +70 -0
- package/src/css/component/base/Button.module.scss +87 -0
- package/src/css/component/base/Effect.module.scss +139 -0
- package/src/css/component/base/Grid.module.scss +8 -0
- package/src/css/component/base/Pane.module.scss +54 -0
- package/src/css/component/primitive/CoordinatePicker.module.scss +24 -0
- package/src/css/component/primitive/Slider.module.scss +116 -0
- package/src/css/index.scss +5 -0
- package/src/css/layers.scss +1 -0
- package/src/css/mixin/breakpoints.scss +112 -0
- package/src/css/mixin/focus-ring.scss +56 -0
- package/src/css/mixin/hover.scss +7 -0
- package/src/css/mixin/index.scss +3 -0
- package/src/css/reset.scss +169 -0
- package/src/css/typography.scss +87 -0
- package/src/css/variables.scss +214 -0
- package/src/data/di.ts +42 -0
- package/src/data/filter.ts +9 -0
- package/src/data/helper.ts +9 -0
- package/src/data/i18n.ts +55 -0
- package/src/data/iconRegistry.ts +21 -0
- package/src/data/index.ts +8 -0
- package/src/data/inputMask.ts +34 -0
- package/src/data/store.ts +233 -0
- package/src/image/avatar-mask.svg +3 -0
- package/src/index.ts +25 -0
- package/src/transition/FluxAutoHeightTransition.vue +59 -0
- package/src/transition/FluxAutoWidthTransition.vue +59 -0
- package/src/transition/FluxBreakthroughTransition.vue +23 -0
- package/src/transition/FluxFadeTransition.vue +24 -0
- package/src/transition/FluxOverlayTransition.vue +22 -0
- package/src/transition/FluxRouteTransition.vue +23 -0
- package/src/transition/FluxSlideOverTransition.vue +22 -0
- package/src/transition/FluxTooltipTransition.vue +22 -0
- package/src/transition/FluxVerticalWindowTransition.vue +23 -0
- package/src/transition/FluxWindowTransition.vue +23 -0
- package/src/transition/index.ts +10 -0
- package/src/util/createDialogRenderer.ts +64 -0
- package/src/util/createLabelForDateRange.ts +61 -0
- package/src/util/index.ts +2 -0
- package/src/vite.d.ts +13 -0
- package/tsconfig.json +45 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="$style.stepperSteps"
|
|
4
|
+
:style="{
|
|
5
|
+
'--progress': progress
|
|
6
|
+
}">
|
|
7
|
+
<template
|
|
8
|
+
v-for="step of amount"
|
|
9
|
+
:key="step">
|
|
10
|
+
<button
|
|
11
|
+
:class="clsx(
|
|
12
|
+
$style.stepperStepsItem,
|
|
13
|
+
current > step && $style.stepperStepsItemComplete,
|
|
14
|
+
current === step && $style.stepperStepsItemCurrent,
|
|
15
|
+
current < step && $style.stepperStepsItemIdle
|
|
16
|
+
)"
|
|
17
|
+
tabindex="-1"
|
|
18
|
+
type="button"
|
|
19
|
+
@click="activate(step - 1)">
|
|
20
|
+
<span :class="$style.stepperStepsItemParticles"/>
|
|
21
|
+
|
|
22
|
+
<FluxFadeTransition>
|
|
23
|
+
<FluxIcon
|
|
24
|
+
v-if="current > step"
|
|
25
|
+
name="check"/>
|
|
26
|
+
|
|
27
|
+
<span v-else>
|
|
28
|
+
{{ step }}
|
|
29
|
+
</span>
|
|
30
|
+
</FluxFadeTransition>
|
|
31
|
+
</button>
|
|
32
|
+
</template>
|
|
33
|
+
</div>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script
|
|
37
|
+
lang="ts"
|
|
38
|
+
setup>
|
|
39
|
+
import { clsx } from 'clsx';
|
|
40
|
+
import { computed } from 'vue';
|
|
41
|
+
import { FluxFadeTransition } from '$flux/transition';
|
|
42
|
+
import FluxIcon from './FluxIcon.vue';
|
|
43
|
+
import $style from '$flux/css/component/Stepper.module.scss';
|
|
44
|
+
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
activate: [number];
|
|
47
|
+
}>();
|
|
48
|
+
|
|
49
|
+
const {
|
|
50
|
+
amount,
|
|
51
|
+
current
|
|
52
|
+
} = defineProps<{
|
|
53
|
+
readonly amount: number;
|
|
54
|
+
readonly current: number;
|
|
55
|
+
}>();
|
|
56
|
+
|
|
57
|
+
const progress = computed(() => (current - 1) / (amount - 1));
|
|
58
|
+
|
|
59
|
+
function activate(index: number): void {
|
|
60
|
+
emit('activate', index);
|
|
61
|
+
}
|
|
62
|
+
</script>
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="$style.tab"
|
|
4
|
+
role="tabpanel">
|
|
5
|
+
<slot/>
|
|
6
|
+
</div>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<script
|
|
10
|
+
lang="ts"
|
|
11
|
+
setup>
|
|
12
|
+
import type { FluxIconName } from '@flux-ui/types';
|
|
13
|
+
import $style from '$flux/css/component/Tab.module.scss';
|
|
14
|
+
|
|
15
|
+
defineProps<{
|
|
16
|
+
readonly icon?: FluxIconName;
|
|
17
|
+
readonly label?: string;
|
|
18
|
+
}>();
|
|
19
|
+
|
|
20
|
+
defineSlots<{
|
|
21
|
+
default(): any;
|
|
22
|
+
}>();
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<nav
|
|
3
|
+
:class="$style.tabBar"
|
|
4
|
+
role="tablist"
|
|
5
|
+
aria-orientation="horizontal">
|
|
6
|
+
<button
|
|
7
|
+
v-if="isStartArrowVisible"
|
|
8
|
+
:class="$style.tabBarArrowStart"
|
|
9
|
+
tabindex="-1"
|
|
10
|
+
type="button"
|
|
11
|
+
@click="scrollToStart">
|
|
12
|
+
<FluxIcon name="angle-left"/>
|
|
13
|
+
</button>
|
|
14
|
+
|
|
15
|
+
<div
|
|
16
|
+
ref="tabBar"
|
|
17
|
+
:class="clsx(
|
|
18
|
+
$style.tabBarTabs,
|
|
19
|
+
isEndArrowVisible && $style.isEndMasked,
|
|
20
|
+
isStartArrowVisible && $style.isStartMasked
|
|
21
|
+
)">
|
|
22
|
+
<slot/>
|
|
23
|
+
</div>
|
|
24
|
+
|
|
25
|
+
<button
|
|
26
|
+
v-if="isEndArrowVisible"
|
|
27
|
+
:class="$style.tabBarArrowEnd"
|
|
28
|
+
tabindex="-1"
|
|
29
|
+
type="button"
|
|
30
|
+
@click="scrollToEnd">
|
|
31
|
+
<FluxIcon name="angle-right"/>
|
|
32
|
+
</button>
|
|
33
|
+
</nav>
|
|
34
|
+
</template>
|
|
35
|
+
|
|
36
|
+
<script
|
|
37
|
+
lang="ts"
|
|
38
|
+
setup>
|
|
39
|
+
import { unrefTemplateElement, useEventListener, useMutationObserver } from '@flux-ui/internals';
|
|
40
|
+
import { clsx } from 'clsx';
|
|
41
|
+
import { onMounted, ref, useTemplateRef } from 'vue';
|
|
42
|
+
import FluxIcon from './FluxIcon.vue';
|
|
43
|
+
import $style from '$flux/css/component/Tab.module.scss';
|
|
44
|
+
|
|
45
|
+
defineSlots<{
|
|
46
|
+
default(): any;
|
|
47
|
+
}>();
|
|
48
|
+
|
|
49
|
+
const tabBarRef = useTemplateRef('tabBar');
|
|
50
|
+
|
|
51
|
+
useEventListener(tabBarRef, 'scroll', () => checkScroll());
|
|
52
|
+
useMutationObserver(tabBarRef, () => checkScroll(), {childList: true});
|
|
53
|
+
|
|
54
|
+
const isEndArrowVisible = ref(false);
|
|
55
|
+
const isStartArrowVisible = ref(false);
|
|
56
|
+
|
|
57
|
+
onMounted(() => checkScroll());
|
|
58
|
+
|
|
59
|
+
function checkScroll(): void {
|
|
60
|
+
const tabBar = unrefTemplateElement(tabBarRef)!;
|
|
61
|
+
|
|
62
|
+
if (tabBar.scrollWidth <= tabBar.offsetWidth) {
|
|
63
|
+
isEndArrowVisible.value = false;
|
|
64
|
+
isStartArrowVisible.value = false;
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
isEndArrowVisible.value = tabBar.scrollLeft < tabBar.scrollWidth - tabBar.offsetWidth;
|
|
69
|
+
isStartArrowVisible.value = tabBar.scrollLeft > 0;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function scrollToEnd(): void {
|
|
73
|
+
const tabBar = unrefTemplateElement(tabBarRef)!;
|
|
74
|
+
tabBar.scrollBy({
|
|
75
|
+
behavior: 'smooth',
|
|
76
|
+
left: tabBar.offsetWidth / 1.5
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
function scrollToStart(): void {
|
|
81
|
+
const tabBar = unrefTemplateElement(tabBarRef)!;
|
|
82
|
+
tabBar.scrollBy({
|
|
83
|
+
behavior: 'smooth',
|
|
84
|
+
left: tabBar.offsetWidth / -1.5
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
</script>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxPressable
|
|
3
|
+
ref="tab"
|
|
4
|
+
:component-type="type"
|
|
5
|
+
:class="isActive ? $style.tabBarItemActive : $style.tabBarItem"
|
|
6
|
+
type="button"
|
|
7
|
+
role="tab"
|
|
8
|
+
:aria-disabled="disabled ? true : undefined"
|
|
9
|
+
:aria-selected="isActive"
|
|
10
|
+
:disabled="disabled ? true : undefined"
|
|
11
|
+
:tabindex="disabled ? -1 : tabindex"
|
|
12
|
+
:href="href"
|
|
13
|
+
:rel="rel"
|
|
14
|
+
:target="target"
|
|
15
|
+
:to="to"
|
|
16
|
+
@click="onClick"
|
|
17
|
+
@mouseenter="onMouseEnter"
|
|
18
|
+
@mouseleave="onMouseLeave">
|
|
19
|
+
<FluxIcon
|
|
20
|
+
v-if="icon"
|
|
21
|
+
:name="icon"
|
|
22
|
+
:size="16"/>
|
|
23
|
+
|
|
24
|
+
<span v-if="label">{{ label }}</span>
|
|
25
|
+
</FluxPressable>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script
|
|
29
|
+
lang="ts"
|
|
30
|
+
setup>
|
|
31
|
+
import type { FluxIconName, FluxPressableType, FluxTo } from '@flux-ui/types';
|
|
32
|
+
import { ComponentPublicInstance, toRef, unref, useTemplateRef, watch } from 'vue';
|
|
33
|
+
import { useDisabled } from '$flux/composable';
|
|
34
|
+
import FluxIcon from './FluxIcon.vue';
|
|
35
|
+
import FluxPressable from './FluxPressable.vue';
|
|
36
|
+
import $style from '$flux/css/component/Tab.module.scss';
|
|
37
|
+
|
|
38
|
+
const emit = defineEmits<{
|
|
39
|
+
click: [MouseEvent];
|
|
40
|
+
mouseenter: [MouseEvent];
|
|
41
|
+
mouseleave: [MouseEvent];
|
|
42
|
+
}>();
|
|
43
|
+
|
|
44
|
+
const {
|
|
45
|
+
disabled: componentDisabled,
|
|
46
|
+
isActive
|
|
47
|
+
} = defineProps<{
|
|
48
|
+
readonly type?: FluxPressableType;
|
|
49
|
+
readonly disabled?: boolean;
|
|
50
|
+
readonly icon?: FluxIconName;
|
|
51
|
+
readonly isActive?: boolean;
|
|
52
|
+
readonly label?: string;
|
|
53
|
+
readonly tabindex?: string | number;
|
|
54
|
+
readonly href?: string;
|
|
55
|
+
readonly rel?: string;
|
|
56
|
+
readonly target?: string;
|
|
57
|
+
readonly to?: FluxTo;
|
|
58
|
+
}>();
|
|
59
|
+
|
|
60
|
+
const disabled = useDisabled(toRef(() => componentDisabled));
|
|
61
|
+
const tabRef = useTemplateRef<ComponentPublicInstance>('tab');
|
|
62
|
+
|
|
63
|
+
function onClick(evt: MouseEvent): void {
|
|
64
|
+
if (unref(disabled)) {
|
|
65
|
+
evt.preventDefault();
|
|
66
|
+
evt.stopPropagation();
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
emit('click', evt);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
function onMouseEnter(evt: MouseEvent): void {
|
|
74
|
+
emit('mouseenter', evt);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function onMouseLeave(evt: MouseEvent): void {
|
|
78
|
+
emit('mouseleave', evt);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
watch(() => isActive, () => {
|
|
82
|
+
if (!isActive) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
const tab = unref(tabRef);
|
|
87
|
+
|
|
88
|
+
if (!tab) {
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
const el = tab.$el;
|
|
93
|
+
|
|
94
|
+
if (el.parentElement?.offsetWidth === el.parentElement?.scrollWidth) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
el.scrollIntoView({
|
|
99
|
+
behavior: 'smooth',
|
|
100
|
+
block: 'nearest',
|
|
101
|
+
inline: 'center'
|
|
102
|
+
});
|
|
103
|
+
}, {immediate: true});
|
|
104
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.table">
|
|
3
|
+
<table :class="$style.tableBase">
|
|
4
|
+
<thead v-if="slots.header">
|
|
5
|
+
<slot name="header"/>
|
|
6
|
+
</thead>
|
|
7
|
+
|
|
8
|
+
<tbody v-if="slots.default">
|
|
9
|
+
<slot/>
|
|
10
|
+
</tbody>
|
|
11
|
+
|
|
12
|
+
<tfoot v-if="slots.footer">
|
|
13
|
+
<slot name="footer"/>
|
|
14
|
+
</tfoot>
|
|
15
|
+
|
|
16
|
+
<caption
|
|
17
|
+
v-if="slots.caption"
|
|
18
|
+
:style="{captionSide}">
|
|
19
|
+
<slot name="caption"/>
|
|
20
|
+
</caption>
|
|
21
|
+
</table>
|
|
22
|
+
|
|
23
|
+
<div
|
|
24
|
+
v-if="isLoading"
|
|
25
|
+
:class="$style.tableLoader">
|
|
26
|
+
<FluxSpinner/>
|
|
27
|
+
</div>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script
|
|
32
|
+
lang="ts"
|
|
33
|
+
setup>
|
|
34
|
+
import { provide } from 'vue';
|
|
35
|
+
import { FluxTableInjectionKey } from '$flux/data';
|
|
36
|
+
import FluxSpinner from './FluxSpinner.vue';
|
|
37
|
+
import $style from '$flux/css/component/Table.module.scss';
|
|
38
|
+
|
|
39
|
+
const {
|
|
40
|
+
captionSide = 'bottom',
|
|
41
|
+
isBordered = true,
|
|
42
|
+
isHoverable = false,
|
|
43
|
+
isLoading = false,
|
|
44
|
+
isSeparated = true,
|
|
45
|
+
isStriped = false
|
|
46
|
+
} = defineProps<{
|
|
47
|
+
readonly captionSide?: 'top' | 'bottom';
|
|
48
|
+
readonly isBordered?: boolean;
|
|
49
|
+
readonly isHoverable?: boolean;
|
|
50
|
+
readonly isLoading?: boolean;
|
|
51
|
+
readonly isSeparated?: boolean;
|
|
52
|
+
readonly isStriped?: boolean;
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const slots = defineSlots<{
|
|
56
|
+
default?(): any;
|
|
57
|
+
caption?(): any;
|
|
58
|
+
footer?(): any;
|
|
59
|
+
header?(): any;
|
|
60
|
+
}>();
|
|
61
|
+
|
|
62
|
+
provide(FluxTableInjectionKey, {
|
|
63
|
+
isBordered,
|
|
64
|
+
isHoverable,
|
|
65
|
+
isSeparated,
|
|
66
|
+
isStriped
|
|
67
|
+
});
|
|
68
|
+
</script>
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxActions :class="$style.tableActions">
|
|
3
|
+
<slot/>
|
|
4
|
+
</FluxActions>
|
|
5
|
+
</template>
|
|
6
|
+
|
|
7
|
+
<script
|
|
8
|
+
lang="ts"
|
|
9
|
+
setup>
|
|
10
|
+
import FluxActions from './FluxActions.vue';
|
|
11
|
+
import $style from '$flux/css/component/Table.module.scss';
|
|
12
|
+
|
|
13
|
+
defineSlots<{
|
|
14
|
+
default(): any;
|
|
15
|
+
}>();
|
|
16
|
+
</script>
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<td
|
|
3
|
+
:class="clsx(
|
|
4
|
+
$style.tableCell,
|
|
5
|
+
isBordered && $style.isBordered,
|
|
6
|
+
isHoverable && $style.isHoverable,
|
|
7
|
+
isSeparated && $style.isSeparated,
|
|
8
|
+
isStriped && $style.isStriped
|
|
9
|
+
)"
|
|
10
|
+
role="cell">
|
|
11
|
+
<slot name="content">
|
|
12
|
+
<div
|
|
13
|
+
:class="$style.tableCellContent"
|
|
14
|
+
:style="{
|
|
15
|
+
flexFlow: contentDirection
|
|
16
|
+
}">
|
|
17
|
+
<slot/>
|
|
18
|
+
</div>
|
|
19
|
+
</slot>
|
|
20
|
+
</td>
|
|
21
|
+
</template>
|
|
22
|
+
|
|
23
|
+
<script
|
|
24
|
+
lang="ts"
|
|
25
|
+
setup>
|
|
26
|
+
import { clsx } from 'clsx';
|
|
27
|
+
import { useTableInjection } from '$flux/composable';
|
|
28
|
+
import $style from '$flux/css/component/Table.module.scss';
|
|
29
|
+
|
|
30
|
+
const {
|
|
31
|
+
contentDirection = 'row'
|
|
32
|
+
} = defineProps<{
|
|
33
|
+
readonly contentDirection?: 'column' | 'row';
|
|
34
|
+
}>();
|
|
35
|
+
|
|
36
|
+
defineSlots<{
|
|
37
|
+
default(): any;
|
|
38
|
+
content(): any;
|
|
39
|
+
}>();
|
|
40
|
+
|
|
41
|
+
const {
|
|
42
|
+
isBordered,
|
|
43
|
+
isHoverable,
|
|
44
|
+
isSeparated,
|
|
45
|
+
isStriped
|
|
46
|
+
} = useTableInjection();
|
|
47
|
+
</script>
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<th
|
|
3
|
+
:class="clsx(
|
|
4
|
+
$style.tableHeader,
|
|
5
|
+
isBordered && $style.isBordered,
|
|
6
|
+
isShrinking && $style.isShrinking,
|
|
7
|
+
isSticky && $style.isSticky
|
|
8
|
+
)"
|
|
9
|
+
:style="{
|
|
10
|
+
minWidth: `${minWidth}px`
|
|
11
|
+
}">
|
|
12
|
+
<div :class="$style.tableHeaderContent">
|
|
13
|
+
<slot/>
|
|
14
|
+
|
|
15
|
+
<FluxFlyout v-if="isSortable">
|
|
16
|
+
<template #opener="{open}">
|
|
17
|
+
<button
|
|
18
|
+
:class="$style.tableSort"
|
|
19
|
+
:aria-label="translate('flux.sort')"
|
|
20
|
+
tabindex="-1"
|
|
21
|
+
type="button"
|
|
22
|
+
@click="open">
|
|
23
|
+
<FluxIcon
|
|
24
|
+
:size="16"
|
|
25
|
+
:name="sortingIcon"/>
|
|
26
|
+
</button>
|
|
27
|
+
</template>
|
|
28
|
+
|
|
29
|
+
<FluxMenu>
|
|
30
|
+
<FluxMenuGroup>
|
|
31
|
+
<FluxMenuItem
|
|
32
|
+
:is-highlighted="sort === 'ascending'"
|
|
33
|
+
icon-leading="arrow-down-a-z"
|
|
34
|
+
:label="translate('flux.sortAscending')"
|
|
35
|
+
@click="$emit('sort', 'ascending')"/>
|
|
36
|
+
|
|
37
|
+
<FluxMenuItem
|
|
38
|
+
:is-highlighted="sort === 'descending'"
|
|
39
|
+
icon-leading="arrow-up-a-z"
|
|
40
|
+
:label="translate('flux.sortDescending')"
|
|
41
|
+
@click="$emit('sort', 'descending')"/>
|
|
42
|
+
</FluxMenuGroup>
|
|
43
|
+
|
|
44
|
+
<template v-if="sort">
|
|
45
|
+
<FluxSeparator/>
|
|
46
|
+
|
|
47
|
+
<FluxMenuGroup>
|
|
48
|
+
<FluxMenuItem
|
|
49
|
+
icon-leading="circle-xmark"
|
|
50
|
+
is-destructive
|
|
51
|
+
:label="translate('flux.sortRemove')"
|
|
52
|
+
@click="$emit('sort', null)"/>
|
|
53
|
+
</FluxMenuGroup>
|
|
54
|
+
</template>
|
|
55
|
+
</FluxMenu>
|
|
56
|
+
</FluxFlyout>
|
|
57
|
+
</div>
|
|
58
|
+
</th>
|
|
59
|
+
</template>
|
|
60
|
+
|
|
61
|
+
<script
|
|
62
|
+
lang="ts"
|
|
63
|
+
setup>
|
|
64
|
+
import type { FluxIconName } from '@flux-ui/types';
|
|
65
|
+
import { clsx } from 'clsx';
|
|
66
|
+
import { computed } from 'vue';
|
|
67
|
+
import { useTableInjection } from '$flux/composable';
|
|
68
|
+
import { useTranslate } from '$flux/composable/private';
|
|
69
|
+
import FluxFlyout from './FluxFlyout.vue';
|
|
70
|
+
import FluxIcon from './FluxIcon.vue';
|
|
71
|
+
import FluxMenu from './FluxMenu.vue';
|
|
72
|
+
import FluxMenuGroup from './FluxMenuGroup.vue';
|
|
73
|
+
import FluxMenuItem from './FluxMenuItem.vue';
|
|
74
|
+
import FluxSeparator from './FluxSeparator.vue';
|
|
75
|
+
import $style from '$flux/css/component/Table.module.scss';
|
|
76
|
+
|
|
77
|
+
defineEmits<{
|
|
78
|
+
sort: ['ascending' | 'descending' | null];
|
|
79
|
+
}>();
|
|
80
|
+
|
|
81
|
+
const {
|
|
82
|
+
minWidth = 0,
|
|
83
|
+
sort
|
|
84
|
+
} = defineProps<{
|
|
85
|
+
readonly isShrinking?: boolean;
|
|
86
|
+
readonly isSortable?: boolean;
|
|
87
|
+
readonly isSticky?: boolean;
|
|
88
|
+
readonly minWidth?: number;
|
|
89
|
+
readonly sort?: 'ascending' | 'descending';
|
|
90
|
+
}>();
|
|
91
|
+
|
|
92
|
+
defineSlots<{
|
|
93
|
+
default(): any;
|
|
94
|
+
}>();
|
|
95
|
+
|
|
96
|
+
const {isBordered} = useTableInjection();
|
|
97
|
+
const translate = useTranslate();
|
|
98
|
+
|
|
99
|
+
const sortingIcon = computed((): FluxIconName => {
|
|
100
|
+
switch (sort) {
|
|
101
|
+
case 'ascending':
|
|
102
|
+
return 'arrow-down-a-z';
|
|
103
|
+
|
|
104
|
+
case 'descending':
|
|
105
|
+
return 'arrow-up-a-z';
|
|
106
|
+
|
|
107
|
+
default:
|
|
108
|
+
return 'arrow-up-arrow-down';
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
</script>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.tabs">
|
|
3
|
+
<slot
|
|
4
|
+
v-bind="{children, modelValue, tabs, activate}"
|
|
5
|
+
name="tabs">
|
|
6
|
+
<FluxTabBar :class="$style.tabsBar">
|
|
7
|
+
<template
|
|
8
|
+
v-for="(tab, index) of tabs"
|
|
9
|
+
:key="index">
|
|
10
|
+
<FluxTabBarItem
|
|
11
|
+
:icon="tab.icon"
|
|
12
|
+
:is-active="modelValue === index"
|
|
13
|
+
:label="tab.label"
|
|
14
|
+
@click="activate(index)"/>
|
|
15
|
+
</template>
|
|
16
|
+
</FluxTabBar>
|
|
17
|
+
</slot>
|
|
18
|
+
|
|
19
|
+
<slot
|
|
20
|
+
v-bind="{children, modelValue, tabs, activate}"
|
|
21
|
+
name="content">
|
|
22
|
+
<FluxWindowTransition :is-back="isTransitioningBack">
|
|
23
|
+
<VNodeRenderer
|
|
24
|
+
:key="modelValue"
|
|
25
|
+
:vnode="children[modelValue]"/>
|
|
26
|
+
</FluxWindowTransition>
|
|
27
|
+
</slot>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script
|
|
32
|
+
lang="ts"
|
|
33
|
+
setup>
|
|
34
|
+
import { flattenVNodeTree, getComponentProps } from '@flux-ui/internals';
|
|
35
|
+
import type { FluxIconName } from '@flux-ui/types';
|
|
36
|
+
import { computed, ref, unref, VNode, watch } from 'vue';
|
|
37
|
+
import { FluxWindowTransition } from '$flux/transition';
|
|
38
|
+
import { VNodeRenderer } from './primitive';
|
|
39
|
+
import FluxTabBar from './FluxTabBar.vue';
|
|
40
|
+
import FluxTabBarItem from './FluxTabBarItem.vue';
|
|
41
|
+
import $style from '$flux/css/component/Tab.module.scss';
|
|
42
|
+
|
|
43
|
+
const modelValue = defineModel<number>({
|
|
44
|
+
default: 0
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
const slots = defineSlots<{
|
|
48
|
+
default(): any;
|
|
49
|
+
|
|
50
|
+
content(props: {
|
|
51
|
+
activate(index: number): void;
|
|
52
|
+
|
|
53
|
+
readonly children: VNode[];
|
|
54
|
+
readonly modelValue: number;
|
|
55
|
+
readonly tabs: {
|
|
56
|
+
readonly icon?: FluxIconName;
|
|
57
|
+
readonly label?: string;
|
|
58
|
+
}[];
|
|
59
|
+
}): any;
|
|
60
|
+
|
|
61
|
+
tabs(props: {
|
|
62
|
+
activate(index: number): void;
|
|
63
|
+
|
|
64
|
+
readonly children: VNode[];
|
|
65
|
+
readonly modelValue: number;
|
|
66
|
+
readonly tabs: {
|
|
67
|
+
readonly icon?: FluxIconName;
|
|
68
|
+
readonly label?: string;
|
|
69
|
+
}[];
|
|
70
|
+
}): any;
|
|
71
|
+
}>();
|
|
72
|
+
|
|
73
|
+
const isTransitioningBack = ref(false);
|
|
74
|
+
|
|
75
|
+
const children = computed(() => flattenVNodeTree(slots.default?.() ?? []));
|
|
76
|
+
const tabs = computed<{ icon?: FluxIconName; label?: string; }[]>(() => unref(children)
|
|
77
|
+
.filter((child: VNode) => getComponentProps<any>(child).icon || getComponentProps<any>(child).label)
|
|
78
|
+
.map((child: VNode) => ({
|
|
79
|
+
icon: getComponentProps<any>(child).icon,
|
|
80
|
+
label: getComponentProps<any>(child).label
|
|
81
|
+
}))
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
function activate(index: number): void {
|
|
85
|
+
modelValue.value = index;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
watch(modelValue, (newIndex, oldIndex) => {
|
|
89
|
+
isTransitioningBack.value = newIndex < oldIndex;
|
|
90
|
+
});
|
|
91
|
+
</script>
|