@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.
Files changed (261) hide show
  1. package/README.md +45 -0
  2. package/package.json +77 -0
  3. package/src/component/FluxAction.vue +27 -0
  4. package/src/component/FluxActionBar.vue +94 -0
  5. package/src/component/FluxActionPane.vue +40 -0
  6. package/src/component/FluxActions.vue +27 -0
  7. package/src/component/FluxAlert.vue +37 -0
  8. package/src/component/FluxAnimatedColors.vue +141 -0
  9. package/src/component/FluxAspectRatio.vue +21 -0
  10. package/src/component/FluxAutoGrid.vue +27 -0
  11. package/src/component/FluxAvatar.vue +119 -0
  12. package/src/component/FluxBadge.vue +84 -0
  13. package/src/component/FluxBadgeStack.vue +18 -0
  14. package/src/component/FluxBorderShine.vue +36 -0
  15. package/src/component/FluxBoxedIcon.vue +36 -0
  16. package/src/component/FluxButton.vue +110 -0
  17. package/src/component/FluxButtonGroup.vue +15 -0
  18. package/src/component/FluxButtonStack.vue +28 -0
  19. package/src/component/FluxCalendar.vue +254 -0
  20. package/src/component/FluxCalendarEvent.vue +41 -0
  21. package/src/component/FluxCheckbox.vue +60 -0
  22. package/src/component/FluxChip.vue +57 -0
  23. package/src/component/FluxClickablePane.vue +61 -0
  24. package/src/component/FluxColorPicker.vue +265 -0
  25. package/src/component/FluxColorSelect.vue +81 -0
  26. package/src/component/FluxComment.vue +71 -0
  27. package/src/component/FluxConfirm.vue +42 -0
  28. package/src/component/FluxContainer.vue +23 -0
  29. package/src/component/FluxDataTable.vue +96 -0
  30. package/src/component/FluxDatePicker.vue +353 -0
  31. package/src/component/FluxDestructiveButton.vue +28 -0
  32. package/src/component/FluxDisabled.vue +22 -0
  33. package/src/component/FluxDivider.vue +37 -0
  34. package/src/component/FluxDotPattern.vue +72 -0
  35. package/src/component/FluxDropZone.vue +202 -0
  36. package/src/component/FluxDynamicView.vue +16 -0
  37. package/src/component/FluxExpandable.vue +119 -0
  38. package/src/component/FluxExpandableGroup.vue +53 -0
  39. package/src/component/FluxFader.vue +64 -0
  40. package/src/component/FluxFaderItem.vue +15 -0
  41. package/src/component/FluxFilter.vue +133 -0
  42. package/src/component/FluxFilterDate.vue +58 -0
  43. package/src/component/FluxFilterDateRange.vue +59 -0
  44. package/src/component/FluxFilterOption.vue +49 -0
  45. package/src/component/FluxFilterOptionAsync.vue +103 -0
  46. package/src/component/FluxFilterOptions.vue +62 -0
  47. package/src/component/FluxFilterOptionsAsync.vue +113 -0
  48. package/src/component/FluxFilterRange.vue +91 -0
  49. package/src/component/FluxFlickeringGrid.vue +141 -0
  50. package/src/component/FluxFlyout.vue +205 -0
  51. package/src/component/FluxFocalPointEditor.vue +137 -0
  52. package/src/component/FluxFocalPointImage.vue +29 -0
  53. package/src/component/FluxForm.vue +35 -0
  54. package/src/component/FluxFormColumn.vue +15 -0
  55. package/src/component/FluxFormDateInput.vue +92 -0
  56. package/src/component/FluxFormDateRangeInput.vue +87 -0
  57. package/src/component/FluxFormDateTimeInput.vue +120 -0
  58. package/src/component/FluxFormField.vue +98 -0
  59. package/src/component/FluxFormFieldAddition.vue +37 -0
  60. package/src/component/FluxFormInput.vue +223 -0
  61. package/src/component/FluxFormInputAddition.vue +31 -0
  62. package/src/component/FluxFormInputGroup.vue +25 -0
  63. package/src/component/FluxFormPinInput.vue +135 -0
  64. package/src/component/FluxFormRangeSlider.vue +179 -0
  65. package/src/component/FluxFormRow.vue +15 -0
  66. package/src/component/FluxFormSection.vue +23 -0
  67. package/src/component/FluxFormSelect.vue +59 -0
  68. package/src/component/FluxFormSelectAsync.vue +118 -0
  69. package/src/component/FluxFormSlider.vue +123 -0
  70. package/src/component/FluxFormTextArea.vue +53 -0
  71. package/src/component/FluxFormTimeZonePicker.vue +713 -0
  72. package/src/component/FluxGallery.vue +99 -0
  73. package/src/component/FluxGalleryItem.vue +49 -0
  74. package/src/component/FluxGrid.vue +28 -0
  75. package/src/component/FluxGridColumn.vue +31 -0
  76. package/src/component/FluxGridPattern.vue +60 -0
  77. package/src/component/FluxIcon.vue +79 -0
  78. package/src/component/FluxInfo.vue +28 -0
  79. package/src/component/FluxInfoStack.vue +17 -0
  80. package/src/component/FluxLegend.vue +27 -0
  81. package/src/component/FluxLink.vue +35 -0
  82. package/src/component/FluxMenu.vue +31 -0
  83. package/src/component/FluxMenuGroup.vue +21 -0
  84. package/src/component/FluxMenuItem.vue +84 -0
  85. package/src/component/FluxMenuOptions.vue +38 -0
  86. package/src/component/FluxMenuSubHeader.vue +33 -0
  87. package/src/component/FluxMenuTitle.vue +17 -0
  88. package/src/component/FluxNotice.vue +79 -0
  89. package/src/component/FluxNoticeStack.vue +17 -0
  90. package/src/component/FluxOverlay.vue +31 -0
  91. package/src/component/FluxPagination.vue +148 -0
  92. package/src/component/FluxPaginationBar.vue +81 -0
  93. package/src/component/FluxPane.vue +45 -0
  94. package/src/component/FluxPaneBody.vue +15 -0
  95. package/src/component/FluxPaneDeck.vue +24 -0
  96. package/src/component/FluxPaneFooter.vue +15 -0
  97. package/src/component/FluxPaneGroup.vue +15 -0
  98. package/src/component/FluxPaneHeader.vue +44 -0
  99. package/src/component/FluxPaneIllustration.vue +68 -0
  100. package/src/component/FluxPaneMedia.vue +31 -0
  101. package/src/component/FluxPercentageBar.vue +45 -0
  102. package/src/component/FluxPersona.vue +48 -0
  103. package/src/component/FluxPlaceholder.vue +56 -0
  104. package/src/component/FluxPressable.vue +77 -0
  105. package/src/component/FluxPrimaryButton.vue +28 -0
  106. package/src/component/FluxProgressBar.vue +75 -0
  107. package/src/component/FluxPrompt.vue +77 -0
  108. package/src/component/FluxPublishButton.vue +59 -0
  109. package/src/component/FluxQuantitySelector.vue +109 -0
  110. package/src/component/FluxRemove.vue +34 -0
  111. package/src/component/FluxRoot.vue +60 -0
  112. package/src/component/FluxSecondaryButton.vue +28 -0
  113. package/src/component/FluxSegmentedControl.vue +77 -0
  114. package/src/component/FluxSegmentedView.vue +15 -0
  115. package/src/component/FluxSeparator.vue +19 -0
  116. package/src/component/FluxSlideOver.vue +25 -0
  117. package/src/component/FluxSnackbar.vue +154 -0
  118. package/src/component/FluxSnackbarProvider.vue +34 -0
  119. package/src/component/FluxSpacer.vue +9 -0
  120. package/src/component/FluxSpacing.vue +32 -0
  121. package/src/component/FluxSpinner.vue +48 -0
  122. package/src/component/FluxSplitButton.vue +61 -0
  123. package/src/component/FluxStack.vue +40 -0
  124. package/src/component/FluxStatistic.vue +68 -0
  125. package/src/component/FluxStepper.vue +69 -0
  126. package/src/component/FluxStepperStep.vue +15 -0
  127. package/src/component/FluxStepperSteps.vue +62 -0
  128. package/src/component/FluxTab.vue +23 -0
  129. package/src/component/FluxTabBar.vue +87 -0
  130. package/src/component/FluxTabBarItem.vue +104 -0
  131. package/src/component/FluxTable.vue +68 -0
  132. package/src/component/FluxTableActions.vue +16 -0
  133. package/src/component/FluxTableCell.vue +47 -0
  134. package/src/component/FluxTableHeader.vue +111 -0
  135. package/src/component/FluxTableRow.vue +15 -0
  136. package/src/component/FluxTabs.vue +91 -0
  137. package/src/component/FluxTag.vue +85 -0
  138. package/src/component/FluxTagStack.vue +18 -0
  139. package/src/component/FluxTicks.vue +44 -0
  140. package/src/component/FluxTimeline.vue +17 -0
  141. package/src/component/FluxTimelineItem.vue +73 -0
  142. package/src/component/FluxToggle.vue +64 -0
  143. package/src/component/FluxToolbar.vue +32 -0
  144. package/src/component/FluxToolbarGroup.vue +18 -0
  145. package/src/component/FluxTooltip.vue +56 -0
  146. package/src/component/FluxTooltipProvider.vue +176 -0
  147. package/src/component/FluxWindow.vue +47 -0
  148. package/src/component/index.ts +142 -0
  149. package/src/component/primitive/Anchor.vue +17 -0
  150. package/src/component/primitive/AnchorPopup.vue +194 -0
  151. package/src/component/primitive/CoordinatePicker.vue +155 -0
  152. package/src/component/primitive/CoordinatePickerThumb.vue +71 -0
  153. package/src/component/primitive/FilterItem.vue +44 -0
  154. package/src/component/primitive/FilterMenuRenderer.ts +233 -0
  155. package/src/component/primitive/FilterOptionBase.vue +67 -0
  156. package/src/component/primitive/SelectBase.vue +340 -0
  157. package/src/component/primitive/SliderBase.vue +89 -0
  158. package/src/component/primitive/SliderThumb.vue +64 -0
  159. package/src/component/primitive/SliderTrack.vue +22 -0
  160. package/src/component/primitive/VNodeRenderer.ts +11 -0
  161. package/src/component/primitive/index.ts +10 -0
  162. package/src/composable/index.ts +9 -0
  163. package/src/composable/private/index.ts +3 -0
  164. package/src/composable/private/useFormSelect.ts +66 -0
  165. package/src/composable/private/useLoaded.ts +21 -0
  166. package/src/composable/private/useTranslate.ts +35 -0
  167. package/src/composable/useBreakpoints.ts +54 -0
  168. package/src/composable/useDisabled.ts +9 -0
  169. package/src/composable/useDisabledInjection.ts +6 -0
  170. package/src/composable/useExpandableGroupInjection.ts +10 -0
  171. package/src/composable/useFilterInjection.ts +22 -0
  172. package/src/composable/useFlyoutInjection.ts +10 -0
  173. package/src/composable/useFormFieldInjection.ts +8 -0
  174. package/src/composable/useTableInjection.ts +11 -0
  175. package/src/css/base.scss +33 -0
  176. package/src/css/component/Action.module.scss +107 -0
  177. package/src/css/component/Avatar.module.scss +177 -0
  178. package/src/css/component/Badge.module.scss +189 -0
  179. package/src/css/component/Button.module.scss +293 -0
  180. package/src/css/component/Calendar.module.scss +171 -0
  181. package/src/css/component/Chip.module.scss +58 -0
  182. package/src/css/component/Color.module.scss +184 -0
  183. package/src/css/component/Comment.module.scss +123 -0
  184. package/src/css/component/DatePicker.module.scss +193 -0
  185. package/src/css/component/Divider.module.scss +79 -0
  186. package/src/css/component/DropZone.module.scss +99 -0
  187. package/src/css/component/Expandable.module.scss +112 -0
  188. package/src/css/component/Fader.module.scss +38 -0
  189. package/src/css/component/Filter.module.scss +80 -0
  190. package/src/css/component/Flyout.module.scss +63 -0
  191. package/src/css/component/FocalPoint.module.scss +84 -0
  192. package/src/css/component/Form.module.scss +812 -0
  193. package/src/css/component/Gallery.module.scss +64 -0
  194. package/src/css/component/Grid.module.scss +24 -0
  195. package/src/css/component/Icon.module.scss +104 -0
  196. package/src/css/component/Info.module.scss +15 -0
  197. package/src/css/component/Layout.module.scss +63 -0
  198. package/src/css/component/Legend.module.scss +32 -0
  199. package/src/css/component/Menu.module.scss +314 -0
  200. package/src/css/component/Notice.module.scss +279 -0
  201. package/src/css/component/Overlay.module.scss +149 -0
  202. package/src/css/component/Pagination.module.scss +59 -0
  203. package/src/css/component/Pane.module.scss +218 -0
  204. package/src/css/component/PercentageBar.module.scss +31 -0
  205. package/src/css/component/Placeholder.module.scss +72 -0
  206. package/src/css/component/Progress.module.scss +84 -0
  207. package/src/css/component/Remove.module.scss +29 -0
  208. package/src/css/component/Root.module.scss +8 -0
  209. package/src/css/component/SegmentedControl.module.scss +82 -0
  210. package/src/css/component/Snackbar.module.scss +227 -0
  211. package/src/css/component/Spinner.module.scss +36 -0
  212. package/src/css/component/Statistic.module.scss +118 -0
  213. package/src/css/component/Stepper.module.scss +103 -0
  214. package/src/css/component/Tab.module.scss +162 -0
  215. package/src/css/component/Table.module.scss +164 -0
  216. package/src/css/component/Timeline.module.scss +173 -0
  217. package/src/css/component/Toolbar.module.scss +82 -0
  218. package/src/css/component/Tooltip.module.scss +62 -0
  219. package/src/css/component/Transition.module.scss +142 -0
  220. package/src/css/component/Visual.module.scss +70 -0
  221. package/src/css/component/base/Button.module.scss +87 -0
  222. package/src/css/component/base/Effect.module.scss +139 -0
  223. package/src/css/component/base/Grid.module.scss +8 -0
  224. package/src/css/component/base/Pane.module.scss +54 -0
  225. package/src/css/component/primitive/CoordinatePicker.module.scss +24 -0
  226. package/src/css/component/primitive/Slider.module.scss +116 -0
  227. package/src/css/index.scss +5 -0
  228. package/src/css/layers.scss +1 -0
  229. package/src/css/mixin/breakpoints.scss +112 -0
  230. package/src/css/mixin/focus-ring.scss +56 -0
  231. package/src/css/mixin/hover.scss +7 -0
  232. package/src/css/mixin/index.scss +3 -0
  233. package/src/css/reset.scss +169 -0
  234. package/src/css/typography.scss +87 -0
  235. package/src/css/variables.scss +214 -0
  236. package/src/data/di.ts +42 -0
  237. package/src/data/filter.ts +9 -0
  238. package/src/data/helper.ts +9 -0
  239. package/src/data/i18n.ts +55 -0
  240. package/src/data/iconRegistry.ts +21 -0
  241. package/src/data/index.ts +8 -0
  242. package/src/data/inputMask.ts +34 -0
  243. package/src/data/store.ts +233 -0
  244. package/src/image/avatar-mask.svg +3 -0
  245. package/src/index.ts +25 -0
  246. package/src/transition/FluxAutoHeightTransition.vue +59 -0
  247. package/src/transition/FluxAutoWidthTransition.vue +59 -0
  248. package/src/transition/FluxBreakthroughTransition.vue +23 -0
  249. package/src/transition/FluxFadeTransition.vue +24 -0
  250. package/src/transition/FluxOverlayTransition.vue +22 -0
  251. package/src/transition/FluxRouteTransition.vue +23 -0
  252. package/src/transition/FluxSlideOverTransition.vue +22 -0
  253. package/src/transition/FluxTooltipTransition.vue +22 -0
  254. package/src/transition/FluxVerticalWindowTransition.vue +23 -0
  255. package/src/transition/FluxWindowTransition.vue +23 -0
  256. package/src/transition/index.ts +10 -0
  257. package/src/util/createDialogRenderer.ts +64 -0
  258. package/src/util/createLabelForDateRange.ts +61 -0
  259. package/src/util/index.ts +2 -0
  260. package/src/vite.d.ts +13 -0
  261. 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,15 @@
1
+ <template>
2
+ <tr :class="$style.tableRow">
3
+ <slot/>
4
+ </tr>
5
+ </template>
6
+
7
+ <script
8
+ lang="ts"
9
+ setup>
10
+ import $style from '$flux/css/component/Table.module.scss';
11
+
12
+ defineSlots<{
13
+ default(): any;
14
+ }>();
15
+ </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>