@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,77 @@
1
+ <template>
2
+ <nav
3
+ ref="control"
4
+ :class="isFill ? $style.segmentedControlFill : $style.segmentedControlInline">
5
+ <div
6
+ v-if="activeItemWidth > 0"
7
+ :class="$style.segmentedControlHighlight"
8
+ :style="{
9
+ left: `${activeItemX}px`,
10
+ width: `${activeItemWidth}px`
11
+ }"/>
12
+
13
+ <template v-for="(item, index) of items">
14
+ <div
15
+ v-if="index > 0"
16
+ :class="clsx(
17
+ $style.segmentedControlSeparator,
18
+ (index === modelValue || index === modelValue + 1) && $style.isActive
19
+ )"
20
+ role="separator"/>
21
+
22
+ <button
23
+ ref="items"
24
+ :class="clsx(
25
+ $style.segmentedControlItem,
26
+ index === modelValue && $style.isActive
27
+ )"
28
+ type="button"
29
+ @click="activate(index)">
30
+ <FluxIcon
31
+ v-if="item.icon"
32
+ :name="item.icon"
33
+ :size="15"/>
34
+
35
+ <span>{{ item.label }}</span>
36
+ </button>
37
+ </template>
38
+ </nav>
39
+ </template>
40
+
41
+ <script
42
+ lang="ts"
43
+ setup>
44
+ import type { FluxSegmentedControlItemObject } from '@flux-ui/types';
45
+ import { clsx } from 'clsx';
46
+ import { onMounted, onUpdated, ref, unref, useTemplateRef } from 'vue';
47
+ import FluxIcon from './FluxIcon.vue';
48
+ import $style from '$flux/css/component/SegmentedControl.module.scss';
49
+
50
+ const modelValue = defineModel<number>({
51
+ default: 0
52
+ });
53
+
54
+ defineProps<{
55
+ readonly isFill?: boolean;
56
+ readonly items: FluxSegmentedControlItemObject[];
57
+ }>();
58
+
59
+ const controlRef = useTemplateRef<HTMLElement>('control');
60
+ const itemRefs = useTemplateRef<HTMLButtonElement[]>('items');
61
+
62
+ const activeItemX = ref(0);
63
+ const activeItemWidth = ref(0);
64
+
65
+ onMounted(() => activate(unref(modelValue)));
66
+ onUpdated(() => activate(unref(modelValue)));
67
+
68
+ function activate(index: number): void {
69
+ const itemRef = itemRefs.value![index];
70
+ const {left: controlX} = controlRef.value!.getBoundingClientRect();
71
+ const {width, left: x} = itemRef.getBoundingClientRect();
72
+
73
+ activeItemX.value = x - controlX - 1;
74
+ activeItemWidth.value = width;
75
+ modelValue.value = index;
76
+ }
77
+ </script>
@@ -0,0 +1,15 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue';
3
+
4
+ export default defineComponent({
5
+ props: {
6
+ index: Number
7
+ },
8
+ setup(props, {slots}) {
9
+ return () => {
10
+ const items = slots.default!();
11
+ return items[props.index!];
12
+ };
13
+ }
14
+ });
15
+ </script>
@@ -0,0 +1,19 @@
1
+ <template>
2
+ <div
3
+ :class="direction === 'horizontal' ? $style.separatorHorizontal : $style.separatorVertical"
4
+ role="separator"
5
+ :aria-orientation="direction"/>
6
+ </template>
7
+
8
+ <script
9
+ lang="ts"
10
+ setup>
11
+ import type { FluxDirection } from '@flux-ui/types';
12
+ import $style from '$flux/css/component/Divider.module.scss';
13
+
14
+ const {
15
+ direction = 'horizontal'
16
+ } = defineProps<{
17
+ readonly direction?: FluxDirection;
18
+ }>();
19
+ </script>
@@ -0,0 +1,25 @@
1
+ <script lang="ts">
2
+ import { defineComponent } from 'vue';
3
+ import { FluxSlideOverTransition } from '$flux/transition';
4
+ import { createDialogRenderer } from '$flux/util';
5
+ import $style from '$flux/css/component/Overlay.module.scss';
6
+
7
+ export default defineComponent({
8
+ emits: ['close'],
9
+ inheritAttrs: false,
10
+ props: {
11
+ isCloseable: {default: false, type: Boolean},
12
+ viewKey: {default: null, type: String}
13
+ },
14
+ setup(props, {attrs, emit, slots}) {
15
+ return createDialogRenderer(
16
+ attrs,
17
+ props,
18
+ emit,
19
+ slots,
20
+ $style.slideOver,
21
+ FluxSlideOverTransition
22
+ );
23
+ }
24
+ });
25
+ </script>
@@ -0,0 +1,154 @@
1
+ <template>
2
+ <div
3
+ v-if="isRendered"
4
+ :class="clsx(
5
+ color === 'gray' && $style.snackbarGray,
6
+ color === 'primary' && $style.snackbarPrimary,
7
+ color === 'danger' && $style.snackbarDanger,
8
+ color === 'info' && $style.snackbarInfo,
9
+ color === 'success' && $style.snackbarSuccess,
10
+ color === 'warning' && $style.snackbarWarning
11
+ )">
12
+ <div :class="$style.snackbarContent">
13
+ <FluxSpinner
14
+ v-if="isLoading"
15
+ :size="18"/>
16
+
17
+ <FluxIcon
18
+ v-else-if="icon"
19
+ :size="18"
20
+ :name="icon"/>
21
+
22
+ <div :class="$style.snackbarBody">
23
+ <div
24
+ v-if="title"
25
+ :class="$style.snackbarTitle">
26
+ {{ title }}
27
+ </div>
28
+
29
+ <div
30
+ v-if="message"
31
+ :class="$style.snackbarMessage">
32
+ {{ message }}
33
+ </div>
34
+
35
+ <FluxProgressBar
36
+ v-if="progressIndeterminate || progressValue"
37
+ :is-indeterminate="progressIndeterminate"
38
+ :max="progressMax"
39
+ :min="progressMin"
40
+ :status="progressStatus"
41
+ :value="progressValue"/>
42
+
43
+ <div
44
+ v-if="subMessage"
45
+ :class="$style.snackbarSubMessage">
46
+ {{ subMessage }}
47
+ </div>
48
+ </div>
49
+ </div>
50
+
51
+ <div
52
+ v-if="hasActions"
53
+ :class="$style.snackbarActions">
54
+ <button
55
+ v-for="(actionLabel, actionKey) of actions"
56
+ :key="actionKey"
57
+ :class="$style.snackbarAction"
58
+ tabindex="-1"
59
+ type="button"
60
+ @click="onAction(actionKey)">
61
+ <span>{{ actionLabel }}</span>
62
+ </button>
63
+ </div>
64
+
65
+ <FluxAction
66
+ v-if="isCloseable"
67
+ icon="xmark"
68
+ @click="onClose()"/>
69
+ </div>
70
+ </template>
71
+
72
+ <script
73
+ lang="ts"
74
+ setup>
75
+ import type { FluxColor, FluxIconName, FluxSnackbarObject } from '@flux-ui/types';
76
+ import { clsx } from 'clsx';
77
+ import { computed, getCurrentInstance, onBeforeUnmount, ref, watch, watchEffect } from 'vue';
78
+ import { addSnackbar, removeSnackbar, updateSnackbar } from '$flux/data';
79
+ import FluxAction from './FluxAction.vue';
80
+ import FluxIcon from './FluxIcon.vue';
81
+ import FluxProgressBar from './FluxProgressBar.vue';
82
+ import FluxSpinner from './FluxSpinner.vue';
83
+ import $style from '$flux/css/component/Snackbar.module.scss';
84
+
85
+ const emit = defineEmits<{
86
+ action: [string];
87
+ close: [];
88
+ }>();
89
+
90
+ const {
91
+ actions,
92
+ color = 'gray',
93
+ isRendered
94
+ } = defineProps<{
95
+ readonly actions?: Record<string, string>;
96
+ readonly color?: FluxColor;
97
+ readonly icon?: FluxIconName;
98
+ readonly isCloseable?: boolean;
99
+ readonly isLoading?: boolean;
100
+ readonly isRendered?: boolean;
101
+ readonly message?: string;
102
+ readonly progressIndeterminate?: boolean;
103
+ readonly progressMax?: number;
104
+ readonly progressMin?: number;
105
+ readonly progressStatus?: string;
106
+ readonly progressValue?: number;
107
+ readonly subMessage?: string;
108
+ readonly title?: string;
109
+ }>();
110
+
111
+ const instance = getCurrentInstance()!;
112
+
113
+ const id = ref<number | null>(null);
114
+
115
+ const hasActions = computed(() => actions && Object.entries(actions).length > 0);
116
+
117
+ onBeforeUnmount(() => {
118
+ if (id.value) {
119
+ removeSnackbar(id.value);
120
+ }
121
+ });
122
+
123
+ function onAction(actionKey: string): void {
124
+ emit('action', actionKey);
125
+ }
126
+
127
+ function onClose(): void {
128
+ emit('close');
129
+ }
130
+
131
+ watchEffect(() => {
132
+ if (!id.value) {
133
+ return;
134
+ }
135
+
136
+ updateSnackbar(id.value, instance.props);
137
+ });
138
+
139
+ watch(() => isRendered, () => {
140
+ if (isRendered) {
141
+ if (id.value) {
142
+ removeSnackbar(id.value);
143
+ }
144
+
145
+ return;
146
+ }
147
+
148
+ let spec: Omit<FluxSnackbarObject, 'id'> = instance.props;
149
+ spec.onAction = onAction;
150
+ spec.onClose = onClose;
151
+
152
+ id.value = addSnackbar(spec);
153
+ }, {immediate: true});
154
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <TransitionGroup
3
+ name="flux-snackbars"
4
+ tag="div"
5
+ :class="$style.snackbars"
6
+ :enter-active-class="$style.snackbarsEnterActive"
7
+ :enter-from-class="$style.snackbarsEnterFrom"
8
+ :leave-active-class="$style.snackbarsLeaveActive"
9
+ :leave-to-class="$style.snackbarsLeaveTo"
10
+ :move-class="$style.snackbarsMove">
11
+ <FluxSnackbar
12
+ v-for="snackbar of snackbars.toReversed()"
13
+ :key="snackbar.id"
14
+ :="snackbar"
15
+ is-rendered
16
+ @action="onAction(snackbar)"
17
+ @close="() => snackbar.onClose?.()"/>
18
+ </TransitionGroup>
19
+ </template>
20
+
21
+ <script
22
+ lang="ts"
23
+ setup>
24
+ import type { FluxSnackbarObject } from '@flux-ui/types';
25
+ import { useFluxStore } from '$flux/data';
26
+ import FluxSnackbar from './FluxSnackbar.vue';
27
+ import $style from '$flux/css/component/Snackbar.module.scss';
28
+
29
+ const {snackbars} = useFluxStore();
30
+
31
+ function onAction(snackbar: FluxSnackbarObject): (actionKey: string) => void {
32
+ return actionKey => snackbar.onAction?.(actionKey);
33
+ }
34
+ </script>
@@ -0,0 +1,9 @@
1
+ <template>
2
+ <div :class="$style.spacer"/>
3
+ </template>
4
+
5
+ <script
6
+ lang="ts"
7
+ setup>
8
+ import $style from '$flux/css/component/Layout.module.scss';
9
+ </script>
@@ -0,0 +1,32 @@
1
+ <template>
2
+ <div :style="{flex: `0 0 ${spacings[size]}px`}"/>
3
+ </template>
4
+
5
+ <script
6
+ lang="ts"
7
+ setup>
8
+ const spacings = [
9
+ 0,
10
+ 3,
11
+ 6,
12
+ 9,
13
+ 12,
14
+ 15,
15
+ 18,
16
+ 24,
17
+ 30,
18
+ 36,
19
+ 42,
20
+ 48,
21
+ 54,
22
+ 60,
23
+ 72,
24
+ 84,
25
+ 90,
26
+ 120
27
+ ] as const;
28
+
29
+ defineProps<{
30
+ readonly size: keyof typeof spacings;
31
+ }>();
32
+ </script>
@@ -0,0 +1,48 @@
1
+ <template>
2
+ <svg
3
+ :class="$style.spinner"
4
+ viewBox="0 0 24 24"
5
+ :style="{
6
+ fontSize: size && `${size}px`
7
+ }">
8
+ <circle
9
+ :class="$style.spinnerTrack"
10
+ cx="12"
11
+ cy="12"
12
+ r="10"
13
+ fill="transparent"
14
+ stroke-width="4"/>
15
+
16
+ <circle
17
+ :class="$style.spinnerEffect"
18
+ cx="12"
19
+ cy="12"
20
+ r="10"
21
+ fill="transparent"
22
+ stroke-width="4"
23
+ stroke-dasharray="21 45"
24
+ stroke-dashoffset="30"
25
+ stroke-linecap="round"/>
26
+
27
+ <circle
28
+ :class="$style.spinnerValue"
29
+ cx="12"
30
+ cy="12"
31
+ r="10"
32
+ fill="transparent"
33
+ stroke-width="4"
34
+ stroke-dasharray="21 45"
35
+ stroke-dashoffset="30"
36
+ stroke-linecap="round"/>
37
+ </svg>
38
+ </template>
39
+
40
+ <script
41
+ lang="ts"
42
+ setup>
43
+ import $style from '$flux/css/component/Spinner.module.scss';
44
+
45
+ defineProps<{
46
+ readonly size?: number;
47
+ }>();
48
+ </script>
@@ -0,0 +1,61 @@
1
+ <template>
2
+ <FluxFlyout
3
+ :direction="flyoutDirection"
4
+ :is-auto-width="flyoutIsAutoWidth"
5
+ :margin="flyoutMargin"
6
+ :width="flyoutWidth">
7
+ <template #opener="{close, open, toggle}">
8
+ <div :class="$style.buttonGroup">
9
+ <slot
10
+ v-bind="{close, open, toggle}"
11
+ name="button"/>
12
+
13
+ <FluxSecondaryButton
14
+ :icon-leading="buttonIcon"
15
+ @click="open"/>
16
+ </div>
17
+ </template>
18
+
19
+ <template #default="bindings">
20
+ <slot
21
+ v-bind="bindings"
22
+ name="flyout"/>
23
+ </template>
24
+ </FluxFlyout>
25
+ </template>
26
+
27
+ <script
28
+ setup
29
+ lang="ts">
30
+ import type { FluxDirection, FluxIconName } from '@flux-ui/types';
31
+ import FluxFlyout from './FluxFlyout.vue';
32
+ import FluxSecondaryButton from './FluxSecondaryButton.vue';
33
+ import $style from '$flux/css/component/Button.module.scss';
34
+
35
+ const {
36
+ buttonIcon = 'ellipsis-h'
37
+ } = defineProps<{
38
+ readonly buttonIcon?: FluxIconName;
39
+ readonly flyoutDirection?: FluxDirection;
40
+ readonly flyoutIsAutoWidth?: boolean;
41
+ readonly flyoutMargin?: number;
42
+ readonly flyoutWidth?: number | string;
43
+ }>();
44
+
45
+ defineSlots<{
46
+ button(props: {
47
+ close(): void;
48
+ open(): void;
49
+ toggle(): void;
50
+ }): any;
51
+
52
+ flyout(props: {
53
+ close(): void;
54
+
55
+ readonly paneX: number;
56
+ readonly paneY: number;
57
+ readonly openerWidth: number;
58
+ readonly openerHeight: number;
59
+ }): any;
60
+ }>();
61
+ </script>
@@ -0,0 +1,40 @@
1
+ <template>
2
+ <Component
3
+ :is="tag ?? 'div'"
4
+ :class="clsx(
5
+ direction === 'horizontal' && $style.stackHorizontal,
6
+ direction === 'vertical' && $style.stackVertical,
7
+ isCentered && $style.isCentered,
8
+ isFill && $style.isFill,
9
+ isWrapping && $style.isWrapping
10
+ )"
11
+ :style="{
12
+ '--gap': gap && `${gap}px`
13
+ }">
14
+ <slot/>
15
+ </Component>
16
+ </template>
17
+
18
+ <script
19
+ lang="ts"
20
+ setup>
21
+ import type { FluxDirection } from '@flux-ui/types';
22
+ import { clsx } from 'clsx';
23
+ import $style from '$flux/css/component/Layout.module.scss';
24
+
25
+ const {
26
+ direction = 'vertical',
27
+ gap = 30
28
+ } = defineProps<{
29
+ readonly direction?: FluxDirection;
30
+ readonly gap?: number;
31
+ readonly isCentered?: boolean;
32
+ readonly isFill?: boolean;
33
+ readonly isWrapping?: boolean;
34
+ readonly tag?: keyof HTMLElementTagNameMap;
35
+ }>();
36
+
37
+ defineSlots<{
38
+ default(): any;
39
+ }>();
40
+ </script>
@@ -0,0 +1,68 @@
1
+ <template>
2
+ <FluxPane
3
+ :class="clsx(
4
+ direction === 'horizontal' && $style.statisticHorizontal,
5
+ direction === 'vertical' && $style.statisticVertical,
6
+ color === 'gray' && $style.isGray,
7
+ color === 'primary' && $style.isPrimary,
8
+ color === 'danger' && $style.isDanger,
9
+ color === 'info' && $style.isInfo,
10
+ color === 'success' && $style.isSuccess,
11
+ color === 'warning' && $style.isWarning
12
+ )">
13
+ <div :class="$style.statisticIcon">
14
+ <FluxIcon
15
+ :name="icon"
16
+ :size="24"/>
17
+ </div>
18
+
19
+ <div :class="$style.statisticData">
20
+ <span>{{ label }}</span>
21
+ <strong>{{ value }}</strong>
22
+ </div>
23
+
24
+ <div
25
+ v-if="changeIcon || changeValue"
26
+ :class="clsx(
27
+ $style.statisticChange,
28
+ changeColor === 'gray' && $style.isGray,
29
+ changeColor === 'primary' && $style.isPrimary,
30
+ changeColor === 'danger' && $style.isDanger,
31
+ changeColor === 'info' && $style.isInfo,
32
+ changeColor === 'success' && $style.isSuccess,
33
+ changeColor === 'warning' && $style.isWarning
34
+ )">
35
+ <span v-if="changeValue">{{ changeValue }}</span>
36
+
37
+ <FluxIcon
38
+ v-if="changeIcon"
39
+ :name="changeIcon"
40
+ :size="14"/>
41
+ </div>
42
+ </FluxPane>
43
+ </template>
44
+
45
+ <script
46
+ lang="ts"
47
+ setup>
48
+ import type { FluxColor, FluxDirection, FluxIconName } from '@flux-ui/types';
49
+ import { clsx } from 'clsx';
50
+ import FluxIcon from './FluxIcon.vue';
51
+ import FluxPane from './FluxPane.vue';
52
+ import $style from '$flux/css/component/Statistic.module.scss';
53
+
54
+ const {
55
+ changeColor = 'gray',
56
+ color = 'gray',
57
+ direction = 'horizontal'
58
+ } = defineProps<{
59
+ readonly changeColor?: FluxColor;
60
+ readonly changeIcon?: FluxIconName;
61
+ readonly changeValue?: string;
62
+ readonly color?: FluxColor;
63
+ readonly direction?: FluxDirection;
64
+ readonly icon: FluxIconName;
65
+ readonly label: string;
66
+ readonly value: string;
67
+ }>();
68
+ </script>
@@ -0,0 +1,69 @@
1
+ <template>
2
+ <slot
3
+ v-bind="{activate, modelValue, steps}"
4
+ name="steps">
5
+ <FluxStepperSteps
6
+ :amount="steps"
7
+ :current="modelValue + 1"
8
+ @activate="activate"/>
9
+ </slot>
10
+
11
+ <slot
12
+ v-bind="{activate, modelValue, children, isTransitioningBack, steps, view}"
13
+ name="content">
14
+ <FluxWindowTransition :is-back="isTransitioningBack">
15
+ <FluxDynamicView
16
+ :key="modelValue"
17
+ :vnode="view"/>
18
+ </FluxWindowTransition>
19
+ </slot>
20
+ </template>
21
+
22
+ <script
23
+ lang="ts"
24
+ setup>
25
+ import { flattenVNodeTree } from '@flux-ui/internals';
26
+ import { computed, ref, unref, VNode, watch } from 'vue';
27
+ import { FluxWindowTransition } from '$flux/transition';
28
+ import FluxDynamicView from './FluxDynamicView.vue';
29
+ import FluxStepperSteps from './FluxStepperSteps.vue';
30
+
31
+ const modelValue = defineModel<number>({
32
+ default: 0
33
+ });
34
+
35
+ const slots = defineSlots<{
36
+ default(): any;
37
+
38
+ content(props: {
39
+ activate(index: number): void;
40
+
41
+ readonly children: VNode[];
42
+ readonly isTransitioningBack: boolean;
43
+ readonly modelValue: number;
44
+ readonly steps: number;
45
+ readonly view: VNode;
46
+ }): any;
47
+
48
+ steps(props: {
49
+ activate(index: number): void;
50
+
51
+ readonly modelValue: number;
52
+ readonly steps: number;
53
+ }): any;
54
+ }>();
55
+
56
+ const isTransitioningBack = ref(false);
57
+
58
+ const children = computed(() => flattenVNodeTree(slots.default?.() ?? []));
59
+ const steps = computed(() => unref(children).length);
60
+ const view = computed(() => unref(children)[unref(modelValue)] ?? null);
61
+
62
+ function activate(index: number): void {
63
+ modelValue.value = index;
64
+ }
65
+
66
+ watch(modelValue, (newIndex, oldIndex) => {
67
+ isTransitioningBack.value = newIndex < oldIndex;
68
+ });
69
+ </script>
@@ -0,0 +1,15 @@
1
+ <template>
2
+ <div :class="$style.stepperStep">
3
+ <slot/>
4
+ </div>
5
+ </template>
6
+
7
+ <script
8
+ lang="ts"
9
+ setup>
10
+ import $style from '$flux/css/component/Stepper.module.scss';
11
+
12
+ defineSlots<{
13
+ default(): any;
14
+ }>();
15
+ </script>