@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,84 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxPressable
|
|
3
|
+
:class="clsx(
|
|
4
|
+
color === 'gray' && $style.badgeGray,
|
|
5
|
+
color === 'primary' && $style.badgePrimary,
|
|
6
|
+
color === 'danger' && $style.badgeDanger,
|
|
7
|
+
color === 'info' && $style.badgeInfo,
|
|
8
|
+
color === 'success' && $style.badgeSuccess,
|
|
9
|
+
color === 'warning' && $style.badgeWarning
|
|
10
|
+
)"
|
|
11
|
+
:component-type="type"
|
|
12
|
+
:tabindex="tabindex"
|
|
13
|
+
:href="href"
|
|
14
|
+
:rel="rel"
|
|
15
|
+
:target="target"
|
|
16
|
+
:to="to"
|
|
17
|
+
@click="$emit('click', $event)"
|
|
18
|
+
@mouseenter="$emit('mouseenter', $event)"
|
|
19
|
+
@mouseleave="$emit('mouseleave', $event)">
|
|
20
|
+
<FluxSpinner
|
|
21
|
+
v-if="isLoading"
|
|
22
|
+
:class="$style.badgeIcon"
|
|
23
|
+
:size="16"/>
|
|
24
|
+
|
|
25
|
+
<span
|
|
26
|
+
v-else-if="dot"
|
|
27
|
+
:class="$style.badgeDot"/>
|
|
28
|
+
|
|
29
|
+
<FluxIcon
|
|
30
|
+
v-else-if="icon"
|
|
31
|
+
:class="$style.badgeIcon"
|
|
32
|
+
:size="16"
|
|
33
|
+
:name="icon"/>
|
|
34
|
+
|
|
35
|
+
<span :class="$style.badgeLabel">
|
|
36
|
+
{{ label }}
|
|
37
|
+
</span>
|
|
38
|
+
|
|
39
|
+
<button
|
|
40
|
+
v-if="type === 'none' && isDeletable"
|
|
41
|
+
:class="$style.badgeClose"
|
|
42
|
+
type="button"
|
|
43
|
+
@click="onDeleteClick()">
|
|
44
|
+
<FluxIcon name="xmark"/>
|
|
45
|
+
</button>
|
|
46
|
+
</FluxPressable>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script
|
|
50
|
+
lang="ts"
|
|
51
|
+
setup>
|
|
52
|
+
import type { FluxButtonEmits, FluxColor, FluxIconName, FluxPressableType, FluxTo } from '@flux-ui/types';
|
|
53
|
+
import { clsx } from 'clsx';
|
|
54
|
+
import FluxIcon from './FluxIcon.vue';
|
|
55
|
+
import FluxPressable from './FluxPressable.vue';
|
|
56
|
+
import FluxSpinner from './FluxSpinner.vue';
|
|
57
|
+
import $style from '$flux/css/component/Badge.module.scss';
|
|
58
|
+
|
|
59
|
+
const emit = defineEmits<FluxButtonEmits & {
|
|
60
|
+
delete: [];
|
|
61
|
+
}>();
|
|
62
|
+
|
|
63
|
+
const {
|
|
64
|
+
color = 'gray',
|
|
65
|
+
type = 'none'
|
|
66
|
+
} = defineProps<{
|
|
67
|
+
readonly color?: FluxColor;
|
|
68
|
+
readonly dot?: boolean;
|
|
69
|
+
readonly icon?: FluxIconName;
|
|
70
|
+
readonly isDeletable?: boolean;
|
|
71
|
+
readonly isLoading?: boolean;
|
|
72
|
+
readonly label: string;
|
|
73
|
+
readonly type?: FluxPressableType;
|
|
74
|
+
readonly tabindex?: string | number;
|
|
75
|
+
readonly href?: string;
|
|
76
|
+
readonly rel?: string;
|
|
77
|
+
readonly target?: string;
|
|
78
|
+
readonly to?: FluxTo;
|
|
79
|
+
}>();
|
|
80
|
+
|
|
81
|
+
function onDeleteClick(): void {
|
|
82
|
+
emit('delete');
|
|
83
|
+
}
|
|
84
|
+
</script>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxStack
|
|
3
|
+
direction="horizontal"
|
|
4
|
+
:gap="6"
|
|
5
|
+
is-wrapping>
|
|
6
|
+
<slot/>
|
|
7
|
+
</FluxStack>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script
|
|
11
|
+
lang="ts"
|
|
12
|
+
setup>
|
|
13
|
+
import FluxStack from './FluxStack.vue';
|
|
14
|
+
|
|
15
|
+
defineSlots<{
|
|
16
|
+
default(): any;
|
|
17
|
+
}>();
|
|
18
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import { flattenVNodeTree, orange600, pink600, purple600 } from '@flux-ui/internals';
|
|
3
|
+
import { clsx } from 'clsx';
|
|
4
|
+
import { cloneVNode, defineComponent, Fragment, h, PropType } from 'vue';
|
|
5
|
+
import $style from '$flux/css/component/Visual.module.scss';
|
|
6
|
+
|
|
7
|
+
export default defineComponent({
|
|
8
|
+
inheritAttrs: false,
|
|
9
|
+
props: {
|
|
10
|
+
colors: {default: [purple600, 'transparent', orange600, 'transparent', pink600, 'transparent', purple600], type: Array as PropType<string[]>},
|
|
11
|
+
duration: {default: 9, type: Number},
|
|
12
|
+
offset: {default: 1, type: Number},
|
|
13
|
+
radius: {default: undefined, type: [String, Number] as PropType<string | number>},
|
|
14
|
+
width: {default: 2, type: Number}
|
|
15
|
+
},
|
|
16
|
+
setup(props, {attrs, slots}) {
|
|
17
|
+
return () => h(
|
|
18
|
+
Fragment,
|
|
19
|
+
flattenVNodeTree(slots.default?.() ?? []).map(vnode => cloneVNode(vnode, {
|
|
20
|
+
...attrs,
|
|
21
|
+
class: clsx(
|
|
22
|
+
attrs.class as string,
|
|
23
|
+
$style.borderShine
|
|
24
|
+
),
|
|
25
|
+
style: {
|
|
26
|
+
'--shine-colors': props.colors.join(', '),
|
|
27
|
+
'--shine-duration': props.duration,
|
|
28
|
+
'--shine-offset': props.offset,
|
|
29
|
+
'--shine-radius': props.radius,
|
|
30
|
+
'--shine-width': props.width
|
|
31
|
+
}
|
|
32
|
+
}))
|
|
33
|
+
);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div
|
|
3
|
+
:class="clsx(
|
|
4
|
+
!color && $style.iconBoxedDefault,
|
|
5
|
+
color === 'gray' && $style.iconBoxedGray,
|
|
6
|
+
color === 'primary' && $style.iconBoxedPrimary,
|
|
7
|
+
color === 'danger' && $style.iconBoxedDanger,
|
|
8
|
+
color === 'info' && $style.iconBoxedInfo,
|
|
9
|
+
color === 'success' && $style.iconBoxedSuccess,
|
|
10
|
+
color === 'warning' && $style.iconBoxedWarning,
|
|
11
|
+
)"
|
|
12
|
+
:style="{
|
|
13
|
+
fontSize: size && `${size}px`
|
|
14
|
+
}">
|
|
15
|
+
<FluxIcon :name="name"/>
|
|
16
|
+
</div>
|
|
17
|
+
</template>
|
|
18
|
+
|
|
19
|
+
<script
|
|
20
|
+
lang="ts"
|
|
21
|
+
setup>
|
|
22
|
+
import type { FluxColor, FluxIconName } from '@flux-ui/types';
|
|
23
|
+
import { clsx } from 'clsx';
|
|
24
|
+
import FluxIcon from './FluxIcon.vue';
|
|
25
|
+
import $style from '$flux/css/component/Icon.module.scss';
|
|
26
|
+
|
|
27
|
+
defineEmits<{
|
|
28
|
+
click: [MouseEvent];
|
|
29
|
+
}>();
|
|
30
|
+
|
|
31
|
+
defineProps<{
|
|
32
|
+
readonly color?: FluxColor;
|
|
33
|
+
readonly name: FluxIconName;
|
|
34
|
+
readonly size?: number;
|
|
35
|
+
}>();
|
|
36
|
+
</script>
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxPressable
|
|
3
|
+
:component-type="type"
|
|
4
|
+
:class="clsx(
|
|
5
|
+
cssClass,
|
|
6
|
+
isFilled && $style.isFilled,
|
|
7
|
+
size === 'small' && $style.isSmall,
|
|
8
|
+
size === 'medium' && $style.isMedium,
|
|
9
|
+
size === 'large' && $style.isLarge,
|
|
10
|
+
size === 'xl' && $style.isXl
|
|
11
|
+
)"
|
|
12
|
+
:type="isSubmit ? 'submit' : 'button'"
|
|
13
|
+
:aria-disabled="disabled ? true : undefined"
|
|
14
|
+
:disabled="disabled ? true : undefined"
|
|
15
|
+
:tabindex="disabled ? -1 : tabindex"
|
|
16
|
+
:href="href"
|
|
17
|
+
:rel="rel"
|
|
18
|
+
:target="target"
|
|
19
|
+
:to="to"
|
|
20
|
+
@click="onClick"
|
|
21
|
+
@mouseenter="onMouseEnter"
|
|
22
|
+
@mouseleave="onMouseLeave">
|
|
23
|
+
<slot name="before"/>
|
|
24
|
+
|
|
25
|
+
<slot name="iconLeading">
|
|
26
|
+
<FluxSpinner
|
|
27
|
+
v-if="isLoading && (iconLeading || !iconTrailing)"
|
|
28
|
+
:size="20"/>
|
|
29
|
+
|
|
30
|
+
<FluxIcon
|
|
31
|
+
v-else-if="iconLeading"
|
|
32
|
+
:class="cssClassIcon"
|
|
33
|
+
:name="iconLeading"/>
|
|
34
|
+
</slot>
|
|
35
|
+
|
|
36
|
+
<slot name="label">
|
|
37
|
+
<span
|
|
38
|
+
v-if="label"
|
|
39
|
+
:class="cssClassLabel">
|
|
40
|
+
{{ label }}
|
|
41
|
+
</span>
|
|
42
|
+
</slot>
|
|
43
|
+
|
|
44
|
+
<slot name="iconTrailing">
|
|
45
|
+
<FluxSpinner
|
|
46
|
+
v-if="isLoading && (!iconLeading && iconTrailing)"
|
|
47
|
+
:size="20"/>
|
|
48
|
+
|
|
49
|
+
<FluxIcon
|
|
50
|
+
v-else-if="iconTrailing"
|
|
51
|
+
:class="cssClassIcon"
|
|
52
|
+
:name="iconTrailing"/>
|
|
53
|
+
</slot>
|
|
54
|
+
|
|
55
|
+
<slot name="after"/>
|
|
56
|
+
</FluxPressable>
|
|
57
|
+
</template>
|
|
58
|
+
|
|
59
|
+
<script lang="ts">
|
|
60
|
+
export const SLOTS = ['default', 'after', 'before', 'iconLeading', 'iconTrailing', 'label'] as const;
|
|
61
|
+
</script>
|
|
62
|
+
|
|
63
|
+
<script
|
|
64
|
+
lang="ts"
|
|
65
|
+
setup>
|
|
66
|
+
import type { FluxButtonEmits, FluxButtonProps, FluxButtonSlots } from '@flux-ui/types';
|
|
67
|
+
import { clsx } from 'clsx';
|
|
68
|
+
import { toRef, unref } from 'vue';
|
|
69
|
+
import { useDisabled } from '$flux/composable';
|
|
70
|
+
import FluxIcon from './FluxIcon.vue';
|
|
71
|
+
import FluxPressable from './FluxPressable.vue';
|
|
72
|
+
import FluxSpinner from './FluxSpinner.vue';
|
|
73
|
+
import $style from '$flux/css/component/base/Button.module.scss';
|
|
74
|
+
|
|
75
|
+
const emit = defineEmits<FluxButtonEmits>();
|
|
76
|
+
|
|
77
|
+
const {
|
|
78
|
+
disabled: componentDisabled,
|
|
79
|
+
isLoading,
|
|
80
|
+
size = 'medium',
|
|
81
|
+
tabindex = 0,
|
|
82
|
+
type = 'button'
|
|
83
|
+
} = defineProps<FluxButtonProps & {
|
|
84
|
+
readonly cssClass: string;
|
|
85
|
+
readonly cssClassIcon: string;
|
|
86
|
+
readonly cssClassLabel: string;
|
|
87
|
+
}>();
|
|
88
|
+
|
|
89
|
+
defineSlots<FluxButtonSlots>();
|
|
90
|
+
|
|
91
|
+
const disabled = useDisabled(toRef(() => componentDisabled));
|
|
92
|
+
|
|
93
|
+
function onClick(evt: MouseEvent): void {
|
|
94
|
+
if (unref(disabled) || isLoading) {
|
|
95
|
+
evt.preventDefault();
|
|
96
|
+
evt.stopPropagation();
|
|
97
|
+
return;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
emit('click', evt);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function onMouseEnter(evt: MouseEvent): void {
|
|
104
|
+
emit('mouseenter', evt);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function onMouseLeave(evt: MouseEvent): void {
|
|
108
|
+
emit('mouseleave', evt);
|
|
109
|
+
}
|
|
110
|
+
</script>
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxStack
|
|
3
|
+
:direction="direction"
|
|
4
|
+
:gap="gap"
|
|
5
|
+
:is-fill="isFill">
|
|
6
|
+
<slot/>
|
|
7
|
+
</FluxStack>
|
|
8
|
+
</template>
|
|
9
|
+
|
|
10
|
+
<script
|
|
11
|
+
lang="ts"
|
|
12
|
+
setup>
|
|
13
|
+
import type { FluxDirection } from '@flux-ui/types';
|
|
14
|
+
import FluxStack from './FluxStack.vue';
|
|
15
|
+
|
|
16
|
+
const {
|
|
17
|
+
direction = 'horizontal',
|
|
18
|
+
gap = 9
|
|
19
|
+
} = defineProps<{
|
|
20
|
+
readonly direction?: FluxDirection;
|
|
21
|
+
readonly gap?: number;
|
|
22
|
+
readonly isFill?: boolean;
|
|
23
|
+
}>();
|
|
24
|
+
|
|
25
|
+
defineSlots<{
|
|
26
|
+
default(): any;
|
|
27
|
+
}>();
|
|
28
|
+
</script>
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div :class="$style.calendar">
|
|
3
|
+
<FluxActionBar :class="$style.calendarActions">
|
|
4
|
+
<template #primary>
|
|
5
|
+
<div
|
|
6
|
+
:class="$style.calendarCurrent"
|
|
7
|
+
role="presentation">
|
|
8
|
+
<FluxFlyout :width="300">
|
|
9
|
+
<template #opener="{open}">
|
|
10
|
+
<button
|
|
11
|
+
:class="$style.calendarCurrentMonth"
|
|
12
|
+
type="button"
|
|
13
|
+
@click="open">
|
|
14
|
+
{{ viewMonth }}
|
|
15
|
+
</button>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<template #default="{close}">
|
|
19
|
+
<div :class="$styleDatePicker.datePickerMonths">
|
|
20
|
+
<template
|
|
21
|
+
v-for="month of months"
|
|
22
|
+
:key="month">
|
|
23
|
+
<FluxSecondaryButton
|
|
24
|
+
:label="month.label"
|
|
25
|
+
tabindex="-1"
|
|
26
|
+
@click="setViewMonth(month.date, close)"/>
|
|
27
|
+
</template>
|
|
28
|
+
</div>
|
|
29
|
+
</template>
|
|
30
|
+
</FluxFlyout>
|
|
31
|
+
|
|
32
|
+
<FluxFlyout :width="300">
|
|
33
|
+
<template #opener="{open}">
|
|
34
|
+
<button
|
|
35
|
+
:class="$style.calendarCurrentYear"
|
|
36
|
+
type="button"
|
|
37
|
+
@click="open">
|
|
38
|
+
{{ viewYear }}
|
|
39
|
+
</button>
|
|
40
|
+
</template>
|
|
41
|
+
|
|
42
|
+
<template #default="{close}">
|
|
43
|
+
<div :class="$styleDatePicker.datePickerYears">
|
|
44
|
+
<FluxSecondaryButton
|
|
45
|
+
icon-leading="angle-left"
|
|
46
|
+
tabindex="-1"
|
|
47
|
+
@click="previousYears"/>
|
|
48
|
+
|
|
49
|
+
<template
|
|
50
|
+
v-for="year of years"
|
|
51
|
+
:key="year">
|
|
52
|
+
<FluxSecondaryButton
|
|
53
|
+
:label="year.toString()"
|
|
54
|
+
tabindex="-1"
|
|
55
|
+
@click="setViewYear(year, close)"/>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
<FluxSecondaryButton
|
|
59
|
+
icon-leading="angle-right"
|
|
60
|
+
tabindex="-1"
|
|
61
|
+
@click="nextYears"/>
|
|
62
|
+
</div>
|
|
63
|
+
</template>
|
|
64
|
+
</FluxFlyout>
|
|
65
|
+
</div>
|
|
66
|
+
</template>
|
|
67
|
+
|
|
68
|
+
<template #actionsEnd>
|
|
69
|
+
<FluxSecondaryButton
|
|
70
|
+
:label="translate('flux.today')"
|
|
71
|
+
@click="setToday"/>
|
|
72
|
+
|
|
73
|
+
<FluxButtonGroup>
|
|
74
|
+
<FluxSecondaryButton
|
|
75
|
+
icon-leading="angle-left"
|
|
76
|
+
@click="previousMonth"/>
|
|
77
|
+
|
|
78
|
+
<FluxSecondaryButton
|
|
79
|
+
icon-leading="angle-right"
|
|
80
|
+
@click="nextMonth"/>
|
|
81
|
+
</FluxButtonGroup>
|
|
82
|
+
</template>
|
|
83
|
+
</FluxActionBar>
|
|
84
|
+
|
|
85
|
+
<FluxWindowTransition :is-back="isTransitioningToPast">
|
|
86
|
+
<div
|
|
87
|
+
:key="viewDate.month"
|
|
88
|
+
:class="$style.calendarCells"
|
|
89
|
+
role="grid">
|
|
90
|
+
<template v-for="day of days">
|
|
91
|
+
<div :class="$style.calendarDay">
|
|
92
|
+
{{ day }}
|
|
93
|
+
</div>
|
|
94
|
+
</template>
|
|
95
|
+
|
|
96
|
+
<template v-for="date of dates">
|
|
97
|
+
<div
|
|
98
|
+
:class="clsx(
|
|
99
|
+
$style.calendarEntry,
|
|
100
|
+
viewDate.month !== date.month && $style.isDisabled
|
|
101
|
+
)"
|
|
102
|
+
role="gridcell">
|
|
103
|
+
<div :class="$style.calendarEvents">
|
|
104
|
+
<VNodeRenderer
|
|
105
|
+
v-for="event of getEventsForDate(date)"
|
|
106
|
+
:class="clsx(
|
|
107
|
+
event.type === 'single' && $style.isSingle,
|
|
108
|
+
event.type === 'start' && $style.isStart,
|
|
109
|
+
event.type === 'end' && $style.isEnd,
|
|
110
|
+
event.type === 'middle' && $style.isMiddle
|
|
111
|
+
)"
|
|
112
|
+
:style="{
|
|
113
|
+
gridRow: event.index
|
|
114
|
+
}"
|
|
115
|
+
:vnode="event.vnode"/>
|
|
116
|
+
</div>
|
|
117
|
+
|
|
118
|
+
<span :class="$style.calendarEntryDate">
|
|
119
|
+
{{ date.toLocaleString({day: 'numeric'}) }}
|
|
120
|
+
</span>
|
|
121
|
+
</div>
|
|
122
|
+
</template>
|
|
123
|
+
</div>
|
|
124
|
+
</FluxWindowTransition>
|
|
125
|
+
|
|
126
|
+
<div
|
|
127
|
+
v-if="isLoading"
|
|
128
|
+
:class="$style.calendarLoader">
|
|
129
|
+
<FluxSpinner/>
|
|
130
|
+
</div>
|
|
131
|
+
</div>
|
|
132
|
+
</template>
|
|
133
|
+
|
|
134
|
+
<script
|
|
135
|
+
lang="ts"
|
|
136
|
+
setup>
|
|
137
|
+
import { flattenVNodeTree, getComponentName, getComponentProps, useCalendar, useCalendarMonthSwitcher, useCalendarYearSwitcher } from '@flux-ui/internals';
|
|
138
|
+
import { clsx } from 'clsx';
|
|
139
|
+
import { DateTime } from 'luxon';
|
|
140
|
+
import { computed, unref, VNode, watch } from 'vue';
|
|
141
|
+
import { useTranslate } from '$flux/composable/private';
|
|
142
|
+
import { FluxWindowTransition } from '$flux/transition';
|
|
143
|
+
import { VNodeRenderer } from './primitive';
|
|
144
|
+
import FluxActionBar from './FluxActionBar.vue';
|
|
145
|
+
import FluxButtonGroup from './FluxButtonGroup.vue';
|
|
146
|
+
import FluxFlyout from './FluxFlyout.vue';
|
|
147
|
+
import FluxSecondaryButton from './FluxSecondaryButton.vue';
|
|
148
|
+
import FluxSpinner from '$flux/component/FluxSpinner.vue';
|
|
149
|
+
import $style from '$flux/css/component/Calendar.module.scss';
|
|
150
|
+
import $styleDatePicker from '$flux/css/component/DatePicker.module.scss';
|
|
151
|
+
|
|
152
|
+
type Event = {
|
|
153
|
+
readonly index: number;
|
|
154
|
+
readonly type: 'start' | 'end' | 'middle' | 'single';
|
|
155
|
+
readonly vnode: VNode;
|
|
156
|
+
};
|
|
157
|
+
|
|
158
|
+
const emit = defineEmits<{
|
|
159
|
+
navigate: [DateTime, DateTime, DateTime];
|
|
160
|
+
}>();
|
|
161
|
+
|
|
162
|
+
const {
|
|
163
|
+
initialDate = DateTime.now()
|
|
164
|
+
} = defineProps<{
|
|
165
|
+
readonly initialDate?: DateTime;
|
|
166
|
+
readonly isLoading?: boolean;
|
|
167
|
+
}>();
|
|
168
|
+
|
|
169
|
+
const slots = defineSlots<{
|
|
170
|
+
default?(): any;
|
|
171
|
+
}>();
|
|
172
|
+
|
|
173
|
+
const {
|
|
174
|
+
isTransitioningToPast,
|
|
175
|
+
viewDate,
|
|
176
|
+
viewMonth,
|
|
177
|
+
viewYear,
|
|
178
|
+
dates,
|
|
179
|
+
days,
|
|
180
|
+
nextMonth,
|
|
181
|
+
previousMonth,
|
|
182
|
+
setViewDate
|
|
183
|
+
} = useCalendar(initialDate, {
|
|
184
|
+
weekDayLength: 'long'
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
const {
|
|
188
|
+
months
|
|
189
|
+
} = useCalendarMonthSwitcher(viewDate, 'short');
|
|
190
|
+
|
|
191
|
+
const {
|
|
192
|
+
years,
|
|
193
|
+
next: nextYears,
|
|
194
|
+
previous: previousYears
|
|
195
|
+
} = useCalendarYearSwitcher(viewDate);
|
|
196
|
+
|
|
197
|
+
const translate = useTranslate();
|
|
198
|
+
|
|
199
|
+
const eventNodes = computed(() => flattenVNodeTree(slots.default?.() ?? []));
|
|
200
|
+
const events = computed(() => unref(eventNodes)
|
|
201
|
+
.filter(en => getComponentName(en) === 'FluxCalendarEvent'));
|
|
202
|
+
|
|
203
|
+
function getEventsForDate(forDate: DateTime): Event[] {
|
|
204
|
+
const forDateStr = forDate.toSQLDate();
|
|
205
|
+
|
|
206
|
+
return unref(events)
|
|
207
|
+
.map<Event | null>((vnode, index) => {
|
|
208
|
+
const {date} = getComponentProps<{ date: DateTime | [DateTime, DateTime]; }>(vnode);
|
|
209
|
+
|
|
210
|
+
if (Array.isArray(date)) {
|
|
211
|
+
if (forDate < date[0] || forDate > date[1]) {
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
return {
|
|
216
|
+
type: forDateStr === date[0].toSQLDate() ? 'start' : (forDateStr === date[1].toSQLDate() ? 'end' : 'middle'),
|
|
217
|
+
index,
|
|
218
|
+
vnode
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
if (forDateStr !== date.toSQLDate()) {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
return {
|
|
227
|
+
type: 'single',
|
|
228
|
+
index,
|
|
229
|
+
vnode
|
|
230
|
+
};
|
|
231
|
+
})
|
|
232
|
+
.filter(e => e !== null);
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
function setToday(): void {
|
|
236
|
+
setViewDate(DateTime.now());
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
function setViewMonth(month: DateTime, close: () => void): void {
|
|
240
|
+
close();
|
|
241
|
+
setViewDate(month);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
function setViewYear(year: number, close: () => void): void {
|
|
245
|
+
close();
|
|
246
|
+
setViewDate(unref(viewDate).set({year}));
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
watch([viewDate, dates], ([viewDate, dates]) => {
|
|
250
|
+
emit('navigate', viewDate, dates[0], dates[dates.length - 1]);
|
|
251
|
+
}, {immediate: true});
|
|
252
|
+
|
|
253
|
+
watch(() => initialDate, setViewDate);
|
|
254
|
+
</script>
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FluxTooltip>
|
|
3
|
+
<template #content>
|
|
4
|
+
<slot name="tooltip">
|
|
5
|
+
{{ label }}
|
|
6
|
+
</slot>
|
|
7
|
+
</template>
|
|
8
|
+
|
|
9
|
+
<button
|
|
10
|
+
:class="$style.calendarEvent"
|
|
11
|
+
type="button"
|
|
12
|
+
@click="onClick">
|
|
13
|
+
<span>{{ label }}</span>
|
|
14
|
+
</button>
|
|
15
|
+
</FluxTooltip>
|
|
16
|
+
</template>
|
|
17
|
+
|
|
18
|
+
<script
|
|
19
|
+
lang="ts"
|
|
20
|
+
setup>
|
|
21
|
+
import type { DateTime } from 'luxon';
|
|
22
|
+
import FluxTooltip from './FluxTooltip.vue';
|
|
23
|
+
import $style from '$flux/css/component/Calendar.module.scss';
|
|
24
|
+
|
|
25
|
+
const emit = defineEmits<{
|
|
26
|
+
click: [MouseEvent];
|
|
27
|
+
}>();
|
|
28
|
+
|
|
29
|
+
defineProps<{
|
|
30
|
+
readonly date: DateTime | [DateTime, DateTime];
|
|
31
|
+
readonly label: string;
|
|
32
|
+
}>();
|
|
33
|
+
|
|
34
|
+
defineSlots<{
|
|
35
|
+
tooltip(): any;
|
|
36
|
+
}>();
|
|
37
|
+
|
|
38
|
+
function onClick(evt: MouseEvent): void {
|
|
39
|
+
emit('click', evt);
|
|
40
|
+
}
|
|
41
|
+
</script>
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<label
|
|
3
|
+
:class="$style.checkbox"
|
|
4
|
+
:for="id">
|
|
5
|
+
<input
|
|
6
|
+
v-model="modelValue"
|
|
7
|
+
ref="input"
|
|
8
|
+
type="checkbox"
|
|
9
|
+
:class="$style.checkboxNative"
|
|
10
|
+
:id="id"/>
|
|
11
|
+
|
|
12
|
+
<button
|
|
13
|
+
:class="$style.checkboxElement"
|
|
14
|
+
role="checkbox"
|
|
15
|
+
:aria-checked="modelValue ?? false">
|
|
16
|
+
<FluxIcon
|
|
17
|
+
v-if="isIndeterminate"
|
|
18
|
+
name="minus"
|
|
19
|
+
:size="16"/>
|
|
20
|
+
|
|
21
|
+
<FluxIcon
|
|
22
|
+
v-else
|
|
23
|
+
name="check"
|
|
24
|
+
:size="16"/>
|
|
25
|
+
</button>
|
|
26
|
+
|
|
27
|
+
<span
|
|
28
|
+
v-if="label"
|
|
29
|
+
:class="$style.checkboxLabel">
|
|
30
|
+
{{ label }}
|
|
31
|
+
</span>
|
|
32
|
+
</label>
|
|
33
|
+
</template>
|
|
34
|
+
|
|
35
|
+
<script
|
|
36
|
+
lang="ts"
|
|
37
|
+
setup>
|
|
38
|
+
import { computed, unref, useTemplateRef, watchEffect } from 'vue';
|
|
39
|
+
import { useFormFieldInjection } from '$flux/composable';
|
|
40
|
+
import FluxIcon from './FluxIcon.vue';
|
|
41
|
+
import $style from '$flux/css/component/Form.module.scss';
|
|
42
|
+
|
|
43
|
+
const modelValue = defineModel<boolean | null>({
|
|
44
|
+
default: false
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
defineProps<{
|
|
48
|
+
readonly label?: string;
|
|
49
|
+
}>();
|
|
50
|
+
|
|
51
|
+
const inputRef = useTemplateRef('input');
|
|
52
|
+
const {id} = useFormFieldInjection();
|
|
53
|
+
|
|
54
|
+
const isIndeterminate = computed(() => unref(modelValue) === null);
|
|
55
|
+
|
|
56
|
+
watchEffect(() => {
|
|
57
|
+
const input = unref(inputRef);
|
|
58
|
+
input && (input.indeterminate = unref(isIndeterminate));
|
|
59
|
+
});
|
|
60
|
+
</script>
|