@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,89 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
ref="root"
|
|
4
|
+
:class="clsx(
|
|
5
|
+
$style.slider,
|
|
6
|
+
disabled && $style.isDisabled,
|
|
7
|
+
isDragging && $style.isDragging
|
|
8
|
+
)"
|
|
9
|
+
role="slider"
|
|
10
|
+
:aria-disabled="disabled ? true : undefined"
|
|
11
|
+
@pointerdown="onPointerDown">
|
|
12
|
+
<FluxTicks
|
|
13
|
+
v-if="isTicksVisible"
|
|
14
|
+
:lower="min"
|
|
15
|
+
:upper="max"/>
|
|
16
|
+
<slot/>
|
|
17
|
+
</div>
|
|
18
|
+
</template>
|
|
19
|
+
|
|
20
|
+
<script
|
|
21
|
+
lang="ts"
|
|
22
|
+
setup>
|
|
23
|
+
import { unrefTemplateElement } from '@flux-ui/internals';
|
|
24
|
+
import { clsx } from 'clsx';
|
|
25
|
+
import { onMounted, onUnmounted, toRef, unref, useTemplateRef, watch } from 'vue';
|
|
26
|
+
import { useDisabled } from '$flux/composable';
|
|
27
|
+
import FluxTicks from '$flux/component/FluxTicks.vue';
|
|
28
|
+
import $style from '$flux/css/component/primitive/Slider.module.scss';
|
|
29
|
+
|
|
30
|
+
const emit = defineEmits<{
|
|
31
|
+
dragging: [boolean];
|
|
32
|
+
update: [number];
|
|
33
|
+
}>();
|
|
34
|
+
|
|
35
|
+
const {
|
|
36
|
+
disabled: componentDisabled,
|
|
37
|
+
isDragging
|
|
38
|
+
} = defineProps<{
|
|
39
|
+
readonly disabled?: boolean;
|
|
40
|
+
readonly isDragging?: boolean;
|
|
41
|
+
readonly isTicksVisible?: boolean;
|
|
42
|
+
readonly max: number;
|
|
43
|
+
readonly min: number;
|
|
44
|
+
readonly step: number;
|
|
45
|
+
}>();
|
|
46
|
+
|
|
47
|
+
const disabled = useDisabled(toRef(() => componentDisabled));
|
|
48
|
+
const rootRef = useTemplateRef('root');
|
|
49
|
+
|
|
50
|
+
onMounted(() => {
|
|
51
|
+
document.addEventListener('pointermove', onPointerMove);
|
|
52
|
+
document.addEventListener('pointerup', onPointerUp, {passive: true});
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
onUnmounted(() => {
|
|
56
|
+
document.removeEventListener('pointermove', onPointerMove);
|
|
57
|
+
document.removeEventListener('pointerup', onPointerUp);
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
function onPointerDown(evt: PointerEvent): void {
|
|
61
|
+
if (unref(disabled)) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
emit('dragging', true);
|
|
66
|
+
requestAnimationFrame(() => onPointerMove(evt));
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function onPointerMove(evt: PointerEvent): void {
|
|
70
|
+
const root = unrefTemplateElement(rootRef);
|
|
71
|
+
|
|
72
|
+
if (!isDragging || !root) {
|
|
73
|
+
return;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let {left, width} = root.getBoundingClientRect();
|
|
77
|
+
left += 6; // margin.
|
|
78
|
+
width -= 12; // margin times two.
|
|
79
|
+
|
|
80
|
+
emit('update', Math.max(0, Math.min(1, (evt.pageX - left) / width)));
|
|
81
|
+
evt.preventDefault();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
function onPointerUp(): void {
|
|
85
|
+
emit('dragging', false);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
watch(() => isDragging, () => emit('dragging', isDragging));
|
|
89
|
+
</script>
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<button
|
|
3
|
+
:class="clsx(
|
|
4
|
+
$style.sliderThumb,
|
|
5
|
+
disabled && $style.isDisabled,
|
|
6
|
+
isDragging && $style.isDragging
|
|
7
|
+
)"
|
|
8
|
+
:style="{
|
|
9
|
+
left: `${position * 100}%`
|
|
10
|
+
}"
|
|
11
|
+
:aria-disabled="disabled ? true : undefined"
|
|
12
|
+
:tabindex="disabled ? -1 : 0"
|
|
13
|
+
type="button"
|
|
14
|
+
@keydown="onKeyDown"
|
|
15
|
+
@pointerdown="$emit('grab', $event)"/>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script
|
|
19
|
+
lang="ts"
|
|
20
|
+
setup>
|
|
21
|
+
import { clsx } from 'clsx';
|
|
22
|
+
import { toRef, unref } from 'vue';
|
|
23
|
+
import { useDisabled } from '$flux/composable';
|
|
24
|
+
import $style from '$flux/css/component/primitive/Slider.module.scss';
|
|
25
|
+
|
|
26
|
+
const emit = defineEmits<{
|
|
27
|
+
decrement: [];
|
|
28
|
+
grab: [PointerEvent];
|
|
29
|
+
increment: [];
|
|
30
|
+
}>();
|
|
31
|
+
|
|
32
|
+
const {
|
|
33
|
+
disabled: componentDisabled
|
|
34
|
+
} = defineProps<{
|
|
35
|
+
readonly disabled?: boolean;
|
|
36
|
+
readonly isDragging?: boolean;
|
|
37
|
+
readonly position: number;
|
|
38
|
+
}>();
|
|
39
|
+
|
|
40
|
+
const disabled = useDisabled(toRef(() => componentDisabled));
|
|
41
|
+
|
|
42
|
+
function onKeyDown(evt: KeyboardEvent): void {
|
|
43
|
+
if (unref(disabled)) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
switch (evt.key) {
|
|
48
|
+
case 'ArrowDown':
|
|
49
|
+
case 'ArrowLeft':
|
|
50
|
+
emit('decrement');
|
|
51
|
+
break;
|
|
52
|
+
|
|
53
|
+
case 'ArrowUp':
|
|
54
|
+
case 'ArrowRight':
|
|
55
|
+
emit('increment');
|
|
56
|
+
break;
|
|
57
|
+
|
|
58
|
+
default:
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
evt.preventDefault();
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.sliderTrack">
|
|
3
|
+
<div
|
|
4
|
+
:class="$style.sliderTrackValue"
|
|
5
|
+
:style="{
|
|
6
|
+
left: `${percentageLower * 100}%`,
|
|
7
|
+
width: `${(percentageUpper - percentageLower) * 100}%`
|
|
8
|
+
}"/>
|
|
9
|
+
<slot/>
|
|
10
|
+
</div>
|
|
11
|
+
</template>
|
|
12
|
+
|
|
13
|
+
<script
|
|
14
|
+
lang="ts"
|
|
15
|
+
setup>
|
|
16
|
+
import $style from '$flux/css/component/primitive/Slider.module.scss';
|
|
17
|
+
|
|
18
|
+
defineProps<{
|
|
19
|
+
readonly percentageLower: number;
|
|
20
|
+
readonly percentageUpper: number;
|
|
21
|
+
}>();
|
|
22
|
+
</script>
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { default as Anchor } from './Anchor.vue';
|
|
2
|
+
export { default as AnchorPopup } from './AnchorPopup.vue';
|
|
3
|
+
export { default as FilterOptionBase } from './FilterOptionBase.vue';
|
|
4
|
+
export { default as SelectBase } from './SelectBase.vue';
|
|
5
|
+
export { default as SliderBase } from './SliderBase.vue';
|
|
6
|
+
export { default as SliderThumb } from './SliderThumb.vue';
|
|
7
|
+
export { default as SliderTrack } from './SliderTrack.vue';
|
|
8
|
+
|
|
9
|
+
export { FilterMenuRenderer } from './FilterMenuRenderer';
|
|
10
|
+
export { VNodeRenderer } from './VNodeRenderer';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { default as useBreakpoints } from './useBreakpoints';
|
|
2
|
+
export { default as useDisabled } from './useDisabled';
|
|
3
|
+
|
|
4
|
+
export { default as useDisabledInjection } from './useDisabledInjection';
|
|
5
|
+
export { default as useExpandableGroupInjection } from './useExpandableGroupInjection';
|
|
6
|
+
export { default as useFilterInjection } from './useFilterInjection';
|
|
7
|
+
export { default as useFlyoutInjection } from './useFlyoutInjection';
|
|
8
|
+
export { default as useFormFieldInjection } from './useFormFieldInjection';
|
|
9
|
+
export { default as useTableInjection } from './useTableInjection';
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import type { FluxFormSelectEntry, FluxFormSelectOption, FluxFormSelectOptions, FluxFormSelectValue } from '@flux-ui/types';
|
|
2
|
+
import type { MaybeRef, Ref } from 'vue';
|
|
3
|
+
import { computed, unref } from 'vue';
|
|
4
|
+
import { isFluxFormSelectGroup, isFluxFormSelectOption } from '$flux/data';
|
|
5
|
+
|
|
6
|
+
export default function (modelValue: Ref<FluxFormSelectValue>, isMultiple: boolean, options: MaybeRef<FluxFormSelectEntry[]>, searchQuery?: Ref<string>) {
|
|
7
|
+
const values = computed(() => {
|
|
8
|
+
const model = unref(modelValue);
|
|
9
|
+
return Array.isArray(model) ? model : [model];
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
const groups = computed(() => {
|
|
13
|
+
const groups: FluxFormSelectOptions[] = [];
|
|
14
|
+
const search = unref(searchQuery)?.trim().toLowerCase();
|
|
15
|
+
|
|
16
|
+
const available = unref(options)
|
|
17
|
+
.filter(o => !('value' in o) || (!search || o.label.toLowerCase().includes(search)))
|
|
18
|
+
.filter(o => !('value' in o) || !isMultiple || !unref(selected).find(s => s.value === o.value));
|
|
19
|
+
|
|
20
|
+
if (available.length === 0) {
|
|
21
|
+
return [];
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (!available.find(isFluxFormSelectGroup)) {
|
|
25
|
+
return [[null, available]] as FluxFormSelectOptions[];
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
for (let i = 0; i < available.length;) {
|
|
29
|
+
const item = available[i];
|
|
30
|
+
|
|
31
|
+
if (isFluxFormSelectOption(item)) {
|
|
32
|
+
++i;
|
|
33
|
+
groups.push([null, [item]]);
|
|
34
|
+
continue;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const subItems: FluxFormSelectOption[] = [];
|
|
38
|
+
|
|
39
|
+
for (++i; i <= available.length; ++i) {
|
|
40
|
+
const subItem = available[i];
|
|
41
|
+
|
|
42
|
+
if (isFluxFormSelectGroup(subItem) || i === available.length) {
|
|
43
|
+
if (subItems.length > 0) {
|
|
44
|
+
groups.push([item, subItems]);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
subItems.push(subItem);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
return groups;
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
const selected = computed(() => unref(values)
|
|
58
|
+
.map(v => unref(options).find(o => isFluxFormSelectOption(o) && o.value === v))
|
|
59
|
+
.filter(isFluxFormSelectOption));
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
groups,
|
|
63
|
+
selected,
|
|
64
|
+
values
|
|
65
|
+
};
|
|
66
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { computed, shallowRef, unref } from 'vue';
|
|
2
|
+
|
|
3
|
+
export default function () {
|
|
4
|
+
const tasks = shallowRef(0);
|
|
5
|
+
|
|
6
|
+
const isLoading = computed(() => unref(tasks) > 0);
|
|
7
|
+
|
|
8
|
+
function loaded<T extends Function>(fn: T): T {
|
|
9
|
+
return (async (...args: any[]) => {
|
|
10
|
+
tasks.value++;
|
|
11
|
+
|
|
12
|
+
return await fn(...args)
|
|
13
|
+
.finally(() => tasks.value--);
|
|
14
|
+
}) as unknown as T;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
return {
|
|
18
|
+
isLoading,
|
|
19
|
+
loaded
|
|
20
|
+
};
|
|
21
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { getCurrentInstance } from 'vue';
|
|
2
|
+
import type { FluxTranslate, FluxTranslation } from '$flux/data';
|
|
3
|
+
import { english } from '$flux/data';
|
|
4
|
+
|
|
5
|
+
const fallback: FluxTranslate = (key, params) => {
|
|
6
|
+
if (!(key in english)) {
|
|
7
|
+
return key;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
let translation: string = english[key as FluxTranslation];
|
|
11
|
+
|
|
12
|
+
for (let paramName in params) {
|
|
13
|
+
translation = translation.replaceAll(`{${paramName}}`, params[paramName].toString());
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return translation;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default () => {
|
|
20
|
+
const instance = getCurrentInstance()?.proxy;
|
|
21
|
+
|
|
22
|
+
if (!instance || !isVueI18n(instance)) {
|
|
23
|
+
return fallback;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
return instance.$t;
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type VueI18n = {
|
|
30
|
+
$t: FluxTranslate;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
function isVueI18n(obj: object | null): obj is VueI18n {
|
|
34
|
+
return !!obj && '$t' in obj;
|
|
35
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { onMounted, onUnmounted, ref } from 'vue';
|
|
3
|
+
|
|
4
|
+
const BREAKPOINTS = {
|
|
5
|
+
xs: 0,
|
|
6
|
+
sm: 640,
|
|
7
|
+
md: 768,
|
|
8
|
+
lg: 1024,
|
|
9
|
+
xl: 1280
|
|
10
|
+
} as const;
|
|
11
|
+
|
|
12
|
+
type Breakpoint = keyof typeof BREAKPOINTS;
|
|
13
|
+
|
|
14
|
+
export default function () {
|
|
15
|
+
const currentBreakpoint = ref<Breakpoint | null>(null);
|
|
16
|
+
const breakpointRefs = Object.fromEntries(
|
|
17
|
+
Object.keys(BREAKPOINTS).map((key) => [key, ref(false)])
|
|
18
|
+
) as Record<Breakpoint, Ref<boolean>>;
|
|
19
|
+
|
|
20
|
+
const updateBreakpoints = () => {
|
|
21
|
+
const width = window.innerWidth;
|
|
22
|
+
let activeBreakpoint: Breakpoint | null = null;
|
|
23
|
+
|
|
24
|
+
for (const [key, value] of Object.entries(BREAKPOINTS).reverse() as [
|
|
25
|
+
Breakpoint,
|
|
26
|
+
number
|
|
27
|
+
][]) {
|
|
28
|
+
if (width >= value) {
|
|
29
|
+
activeBreakpoint = key;
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
currentBreakpoint.value = activeBreakpoint;
|
|
35
|
+
|
|
36
|
+
for (const key of Object.keys(BREAKPOINTS) as Breakpoint[]) {
|
|
37
|
+
breakpointRefs[key].value = key === activeBreakpoint;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
onMounted(() => {
|
|
42
|
+
updateBreakpoints();
|
|
43
|
+
window.addEventListener('resize', updateBreakpoints, {passive: true});
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
onUnmounted(() => {
|
|
47
|
+
window.removeEventListener('resize', updateBreakpoints);
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
return {
|
|
51
|
+
currentBreakpoint,
|
|
52
|
+
...breakpointRefs
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Ref } from 'vue';
|
|
2
|
+
import { computed, unref } from 'vue';
|
|
3
|
+
import useDisabledInjection from './useDisabledInjection';
|
|
4
|
+
|
|
5
|
+
export default function (componentDisabled: Ref<boolean>) {
|
|
6
|
+
const treeDisabled = useDisabledInjection();
|
|
7
|
+
|
|
8
|
+
return computed(() => unref(componentDisabled) || unref(treeDisabled));
|
|
9
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { inject } from 'vue';
|
|
2
|
+
import { FluxExpandableGroupInjectionKey } from '$flux/data';
|
|
3
|
+
|
|
4
|
+
export default function () {
|
|
5
|
+
return inject(FluxExpandableGroupInjectionKey, {
|
|
6
|
+
closeAll: () => void 0,
|
|
7
|
+
register: () => void 0,
|
|
8
|
+
unregister: () => void 0
|
|
9
|
+
});
|
|
10
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { inject, ref } from 'vue';
|
|
2
|
+
import { FluxFilterInjectionKey } from '$flux/data';
|
|
3
|
+
|
|
4
|
+
export default function () {
|
|
5
|
+
return inject(FluxFilterInjectionKey, {
|
|
6
|
+
// note(Bas): The default value is never used, but required by
|
|
7
|
+
// Vue, so that explains the empty getter and function below.
|
|
8
|
+
state: ref({
|
|
9
|
+
get resettable() {
|
|
10
|
+
return [];
|
|
11
|
+
},
|
|
12
|
+
|
|
13
|
+
reset(): void {
|
|
14
|
+
}
|
|
15
|
+
}),
|
|
16
|
+
back: () => void 0,
|
|
17
|
+
reset: () => void 0,
|
|
18
|
+
getValue: () => void 0,
|
|
19
|
+
hasValue: () => false,
|
|
20
|
+
setValue: () => void 0
|
|
21
|
+
});
|
|
22
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
@use 'variables';
|
|
2
|
+
|
|
3
|
+
@layer flux-base {
|
|
4
|
+
:root, [light] {
|
|
5
|
+
@include variables.animation;
|
|
6
|
+
@include variables.color-light;
|
|
7
|
+
@include variables.default-light;
|
|
8
|
+
@include variables.shadow-light;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
[dark] {
|
|
12
|
+
@include variables.color-dark;
|
|
13
|
+
@include variables.default-dark;
|
|
14
|
+
@include variables.shadow-dark;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
html {
|
|
18
|
+
font-size: var(--font-size);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
body {
|
|
22
|
+
background: var(--background);
|
|
23
|
+
font-family: var(--font-sans), system-ui;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
body, dialog {
|
|
27
|
+
color: var(--foreground);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
[inert] *::-webkit-scrollbar {
|
|
31
|
+
display: none;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
@use '$flux/css/mixin';
|
|
2
|
+
|
|
3
|
+
@value button, buttonIcon, buttonLabel from './base/Button.module.scss';
|
|
4
|
+
@value basePaneStructure from './base/Pane.module.scss';
|
|
5
|
+
|
|
6
|
+
.action {
|
|
7
|
+
composes: button;
|
|
8
|
+
|
|
9
|
+
height: 30px;
|
|
10
|
+
width: 30px;
|
|
11
|
+
padding-left: 6px;
|
|
12
|
+
padding-right: 6px;
|
|
13
|
+
border: 0;
|
|
14
|
+
border-radius: calc(var(--radius) / 2);
|
|
15
|
+
box-shadow: none;
|
|
16
|
+
|
|
17
|
+
@include mixin.hover {
|
|
18
|
+
background: rgb(var(--gray-3));
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
&:active {
|
|
22
|
+
background: rgb(var(--gray-2));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.spinner {
|
|
26
|
+
font-size: 24px;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.actionIcon {
|
|
31
|
+
composes: buttonIcon;
|
|
32
|
+
|
|
33
|
+
color: var(--foreground);
|
|
34
|
+
font-size: 18px;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
.action.isDestructive .actionIcon {
|
|
38
|
+
color: rgb(var(--danger-7));
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
.actionLabel {
|
|
42
|
+
composes: buttonLabel;
|
|
43
|
+
|
|
44
|
+
color: var(--foreground);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.actionBar {
|
|
48
|
+
flex-wrap: wrap;
|
|
49
|
+
|
|
50
|
+
.separator {
|
|
51
|
+
margin-top: 9px;
|
|
52
|
+
margin-bottom: 9px;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@include mixin.breakpoint-up(sm) {
|
|
56
|
+
> .formInput {
|
|
57
|
+
max-width: 240px;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
:local(.basePaneStructure) > .actionBar {
|
|
63
|
+
padding: 15px 21px;
|
|
64
|
+
background: rgb(var(--gray-1));
|
|
65
|
+
border: 1px solid rgb(var(--gray-2));
|
|
66
|
+
border-left: 0;
|
|
67
|
+
border-right: 0;
|
|
68
|
+
|
|
69
|
+
&:first-child {
|
|
70
|
+
border-top: 0;
|
|
71
|
+
border-top-left-radius: var(--radius);
|
|
72
|
+
border-top-right-radius: var(--radius);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
&:last-child {
|
|
76
|
+
border-bottom: 0;
|
|
77
|
+
border-bottom-left-radius: var(--radius);
|
|
78
|
+
border-bottom-right-radius: var(--radius);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.paneHeader + .actionBar {
|
|
83
|
+
margin-top: 21px;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.actionPane {
|
|
87
|
+
container: actionPane / inline-size;
|
|
88
|
+
|
|
89
|
+
width: 100%;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
.actionPaneGrid {
|
|
93
|
+
display: grid;
|
|
94
|
+
padding: 36px;
|
|
95
|
+
gap: 36px;
|
|
96
|
+
grid-template-columns: 1fr auto;
|
|
97
|
+
|
|
98
|
+
@container actionPane (max-width: 540px) {
|
|
99
|
+
grid-template-columns: 1fr;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.actionPaneBody {
|
|
104
|
+
position: relative;
|
|
105
|
+
padding: 0;
|
|
106
|
+
text-wrap: pretty;
|
|
107
|
+
}
|