@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,48 @@
1
+ <template>
2
+ <button
3
+ :class="$style.persona"
4
+ type="button"
5
+ @click="$emit('click', $event)">
6
+ <FluxAvatar
7
+ :alt="avatarAlt"
8
+ :fallback="avatarFallback"
9
+ :fallback-icon="avatarFallbackIcon"
10
+ :fallback-initials="avatarFallbackInitials"
11
+ :size="avatarSize"
12
+ :src="avatarSrc"/>
13
+
14
+ <template v-if="!isCompact">
15
+ <div :class="$style.personaDetails">
16
+ <strong>{{ name }}</strong>
17
+ <span v-if="title">{{ title }}</span>
18
+ </div>
19
+ </template>
20
+ </button>
21
+ </template>
22
+
23
+ <script
24
+ lang="ts"
25
+ setup>
26
+ import type { FluxIconName } from '@flux-ui/types';
27
+ import FluxAvatar from './FluxAvatar.vue';
28
+ import $style from '$flux/css/component/Avatar.module.scss';
29
+
30
+ defineEmits<{
31
+ click: [MouseEvent];
32
+ }>();
33
+
34
+ const {
35
+ avatarFallback = 'colorized',
36
+ avatarFallbackIcon = 'user'
37
+ } = defineProps<{
38
+ readonly avatarAlt?: string;
39
+ readonly avatarFallback?: 'colorized' | 'neutral';
40
+ readonly avatarFallbackIcon?: FluxIconName;
41
+ readonly avatarFallbackInitials?: string;
42
+ readonly avatarSize?: number;
43
+ readonly avatarSrc?: string;
44
+ readonly isCompact?: boolean;
45
+ readonly name: string;
46
+ readonly title?: string;
47
+ }>();
48
+ </script>
@@ -0,0 +1,56 @@
1
+ <template>
2
+ <div
3
+ :class="clsx(
4
+ $style.placeholder,
5
+ isButton && $style.isButton,
6
+ variant === 'extended' && $style.isExtended,
7
+ variant === 'simple' && $style.isSimple,
8
+ variant === 'small' && $style.isSmall
9
+ )"
10
+ role="presentation"
11
+ @click="onClick">
12
+ <FluxIcon
13
+ v-if="icon"
14
+ :class="$style.placeholderIcon"
15
+ :name="icon"/>
16
+
17
+ <div :class="$style.placeholderCaption">
18
+ <strong v-if="title">
19
+ {{ title }}
20
+ </strong>
21
+
22
+ <p v-if="message">
23
+ {{ message }}
24
+ </p>
25
+ </div>
26
+
27
+ <slot/>
28
+ </div>
29
+ </template>
30
+
31
+ <script
32
+ lang="ts"
33
+ setup>
34
+ import type { FluxIconName } from '@flux-ui/types';
35
+ import { clsx } from 'clsx';
36
+ import FluxIcon from './FluxIcon.vue';
37
+ import $style from '$flux/css/component/Placeholder.module.scss';
38
+
39
+ const emit = defineEmits<{
40
+ click: [MouseEvent];
41
+ }>();
42
+
43
+ const {
44
+ variant = 'extended'
45
+ } = defineProps<{
46
+ readonly icon?: FluxIconName;
47
+ readonly isButton?: boolean;
48
+ readonly message?: string;
49
+ readonly title?: string;
50
+ readonly variant?: 'extended' | 'simple' | 'small';
51
+ }>();
52
+
53
+ function onClick(evt: MouseEvent): void {
54
+ emit('click', evt);
55
+ }
56
+ </script>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <router-link
3
+ v-if="componentType === 'route'"
4
+ v-bind="$attrs"
5
+ :rel="rel"
6
+ :target="target"
7
+ :to="to"
8
+ @click="onClick($event)"
9
+ @mouseenter="$emit('mouseenter', $event)"
10
+ @mouseleave="$emit('mouseleave', $event)">
11
+ <slot/>
12
+ </router-link>
13
+
14
+ <a
15
+ v-else-if="componentType === 'link'"
16
+ v-bind="$attrs"
17
+ :href="href"
18
+ :rel="rel"
19
+ :target="target"
20
+ @click="onClick($event)"
21
+ @mouseenter="$emit('mouseenter', $event)"
22
+ @mouseleave="$emit('mouseleave', $event)">
23
+ <slot/>
24
+ </a>
25
+
26
+ <button
27
+ v-else-if="componentType === 'button'"
28
+ v-bind="$attrs"
29
+ @click="onClick($event)"
30
+ @mouseenter="$emit('mouseenter', $event)"
31
+ @mouseleave="$emit('mouseleave', $event)">
32
+ <slot/>
33
+ </button>
34
+
35
+ <div
36
+ v-else
37
+ v-bind="$attrs"
38
+ @click="onClick"
39
+ @mouseenter="$emit('mouseenter', $event)"
40
+ @mouseleave="$emit('mouseleave', $event)">
41
+ <slot/>
42
+ </div>
43
+ </template>
44
+
45
+ <script
46
+ lang="ts"
47
+ setup>
48
+ import type { FluxPressableType, FluxTo } from '@flux-ui/types';
49
+
50
+ const emit = defineEmits<{
51
+ click: [MouseEvent];
52
+ mouseenter: [MouseEvent];
53
+ mouseleave: [MouseEvent];
54
+ }>();
55
+
56
+ defineProps<{
57
+ readonly componentType?: FluxPressableType;
58
+ readonly href?: string;
59
+ readonly rel?: string;
60
+ readonly target?: string;
61
+ readonly to?: FluxTo;
62
+ }>();
63
+
64
+ defineSlots<{
65
+ default(): any;
66
+ }>();
67
+
68
+ function onClick(evt: MouseEvent, navigate?: (evt: MouseEvent) => void): void {
69
+ emit('click', evt);
70
+
71
+ if (evt.defaultPrevented) {
72
+ return;
73
+ }
74
+
75
+ navigate?.(evt);
76
+ }
77
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <FluxButton
3
+ :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, href, rel, target, to}"
4
+ :css-class="$style.primaryButton"
5
+ :css-class-icon="$style.primaryButtonIcon"
6
+ :css-class-label="$style.primaryButtonLabel"
7
+ @click="$emit('click', $event)"
8
+ @mouseenter="$emit('mouseenter', $event)"
9
+ @mouseleave="$emit('mouseleave', $event)">
10
+ <template
11
+ v-for="slot of SLOTS"
12
+ #[slot]>
13
+ <slot :name="slot"/>
14
+ </template>
15
+ </FluxButton>
16
+ </template>
17
+
18
+ <script
19
+ lang="ts"
20
+ setup>
21
+ import type { FluxButtonEmits, FluxButtonProps, FluxButtonSlots } from '@flux-ui/types';
22
+ import FluxButton, { SLOTS } from './FluxButton.vue';
23
+ import $style from '$flux/css/component/Button.module.scss';
24
+
25
+ defineEmits<FluxButtonEmits>();
26
+ defineProps<FluxButtonProps>();
27
+ defineSlots<FluxButtonSlots>();
28
+ </script>
@@ -0,0 +1,75 @@
1
+ <template>
2
+ <FluxStack
3
+ :class="$style.progressBar"
4
+ :gap="6"
5
+ role="progressbar"
6
+ :aria-valuenow="value"
7
+ :aria-valuemax="max"
8
+ :aria-valuemin="min">
9
+ <div :class="isIndeterminate ? $style.progressBarTrackIndeterminate : $style.progressBarTrack">
10
+ <div
11
+ :class="$style.progressBarValue"
12
+ :style="{
13
+ width: `${isIndeterminate ? 100 : position * 100}%`
14
+ }"/>
15
+ </div>
16
+
17
+ <div
18
+ v-if="status"
19
+ :class="$style.progressBarInfo">
20
+ <FluxFadeTransition>
21
+ <span
22
+ :key="status"
23
+ :class="$style.progressBarStatus">
24
+ {{ status }}
25
+ </span>
26
+ </FluxFadeTransition>
27
+
28
+ <FluxFadeTransition>
29
+ <span
30
+ v-if="!isIndeterminate"
31
+ :class="$style.progressBarProgress">
32
+ {{ progress }}
33
+ </span>
34
+ </FluxFadeTransition>
35
+ </div>
36
+ </FluxStack>
37
+ </template>
38
+
39
+ <script
40
+ lang="ts"
41
+ setup>
42
+ import { computed, unref } from 'vue';
43
+ import { FluxFadeTransition } from '$flux/transition';
44
+ import FluxStack from './FluxStack.vue';
45
+ import $style from '$flux/css/component/Progress.module.scss';
46
+
47
+ const {
48
+ isIndeterminate,
49
+ max = 1,
50
+ min = 0,
51
+ value
52
+ } = defineProps<{
53
+ readonly isIndeterminate?: boolean;
54
+ readonly max?: number;
55
+ readonly min?: number;
56
+ readonly status?: string;
57
+ readonly value?: number;
58
+ }>();
59
+
60
+ const position = computed(() => {
61
+ if (isIndeterminate) {
62
+ return 0;
63
+ }
64
+
65
+ return ((value ?? min) - min) / (max - min);
66
+ });
67
+
68
+ const progress = computed(() => new Intl
69
+ .NumberFormat(navigator.language, {
70
+ style: 'percent',
71
+ minimumFractionDigits: 0,
72
+ maximumFractionDigits: 0
73
+ })
74
+ .format(unref(position) ?? 0));
75
+ </script>
@@ -0,0 +1,77 @@
1
+ <template>
2
+ <FluxPane>
3
+ <FluxPaneHeader
4
+ :icon="prompt.icon"
5
+ :title="prompt.title"/>
6
+
7
+ <FluxPaneBody v-html="prompt.message"/>
8
+
9
+ <FluxPaneBody>
10
+ <FluxFormField :label="prompt.fieldLabel">
11
+ <FluxFormInput
12
+ ref="input"
13
+ v-model="value"
14
+ :placeholder="prompt.fieldPlaceholder"
15
+ :type="prompt.fieldType ?? 'text'"
16
+ @keydown="onKeyDown"/>
17
+ </FluxFormField>
18
+ </FluxPaneBody>
19
+
20
+ <FluxPaneFooter>
21
+ <FluxSpacer/>
22
+
23
+ <FluxSecondaryButton
24
+ :label="translate('flux.cancel')"
25
+ @click="prompt.onCancel()"/>
26
+
27
+ <FluxPrimaryButton
28
+ :disabled="!hasValue"
29
+ icon-leading="circle-check"
30
+ :label="translate('flux.ok')"
31
+ @click="prompt.onConfirm(value)"/>
32
+ </FluxPaneFooter>
33
+ </FluxPane>
34
+ </template>
35
+
36
+ <script
37
+ lang="ts"
38
+ setup>
39
+ import type { FluxPromptObject } from '@flux-ui/types';
40
+ import { computed, onMounted, ref, unref, useTemplateRef } from 'vue';
41
+ import { useTranslate } from '$flux/composable/private';
42
+ import FluxFormField from './FluxFormField.vue';
43
+ import FluxFormInput from './FluxFormInput.vue';
44
+ import FluxPane from './FluxPane.vue';
45
+ import FluxPaneBody from './FluxPaneBody.vue';
46
+ import FluxPaneFooter from './FluxPaneFooter.vue';
47
+ import FluxPaneHeader from './FluxPaneHeader.vue';
48
+ import FluxPrimaryButton from './FluxPrimaryButton.vue';
49
+ import FluxSecondaryButton from './FluxSecondaryButton.vue';
50
+ import FluxSpacer from './FluxSpacer.vue';
51
+
52
+ const {
53
+ prompt
54
+ } = defineProps<{
55
+ readonly prompt: FluxPromptObject;
56
+ }>();
57
+
58
+ const inputRef = useTemplateRef('input');
59
+ const translate = useTranslate();
60
+
61
+ const value = ref('');
62
+
63
+ const hasValue = computed(() => unref(value).trim().length > 0);
64
+
65
+ onMounted(() => {
66
+ const input = unref(inputRef);
67
+ requestAnimationFrame(() => input?.$el.querySelector('input')?.focus());
68
+ });
69
+
70
+ function onKeyDown(evt: KeyboardEvent): void {
71
+ if (!unref(hasValue) || evt.key !== 'Enter') {
72
+ return;
73
+ }
74
+
75
+ prompt.onConfirm(unref(value));
76
+ }
77
+ </script>
@@ -0,0 +1,59 @@
1
+ <template>
2
+ <FluxButton
3
+ :="{type, disabled, iconTrailing, isFilled, isLoading, label, size, to}"
4
+ :class="clsx(
5
+ !isDone && !isLoading && $style.isIdle,
6
+ isDone && $style.isDone,
7
+ isLoading && $style.isLoading
8
+ )"
9
+ :css-class="$style.publishButton"
10
+ :css-class-icon="$style.publishButtonIcon"
11
+ :css-class-label="$style.publishButtonLabel"
12
+ @click="$emit('click', $event)"
13
+ @mouseenter="$emit('mouseenter', $event)"
14
+ @mouseleave="$emit('mouseleave', $event)">
15
+ <template #iconLeading>
16
+ <div :class="$style.publishButtonAnimation">
17
+ <FluxIcon
18
+ :class="$style.publishButtonCloud"
19
+ name="cloud"/>
20
+
21
+ <FluxIcon
22
+ :class="$style.publishButtonCloud"
23
+ name="cloud"/>
24
+
25
+ <svg
26
+ :class="$style.publishButtonAnimation"
27
+ viewBox="0 0 512 512">
28
+ <path
29
+ :class="$style.publishButtonAnimationCircle"
30
+ d="M512 256c0 141.4-114.6 256-256 256S0 397.4 0 256 114.6 0 256 0s256 114.6 256 256ZM256 48C141.1 48 48 141.1 48 256s93.1 208 208 208 208-93.1 208-208S370.9 48 256 48Z"/>
31
+
32
+ <path
33
+ :class="$style.publishButtonAnimationArrow"
34
+ d="M272.9 135.7c-4.6-4.9-11-7.7-17.7-7.7-7.7.3-14.1 2.9-17.7 7.8l-87.25 96a23.86 23.86 0 0 0-4.15 25.9c3.8 8.7 12.4 14.3 21 14.3h56l.9 88a24 24 0 0 0 24 24h16c13.25 0 23.1-10.75 23.1-24v-88h56c9.53 0 18.16-5.66 22-14.38a24.03 24.03 0 0 0-4.38-25.91L272.9 135.7Z"/>
35
+
36
+ <path
37
+ :class="$style.publishButtonAnimationCheck"
38
+ d="M243.8 339.8a28.07 28.07 0 0 1-39.6 0l-64-64a28.07 28.07 0 0 1 0-39.6 28.07 28.07 0 0 1 39.6 0l44.2 44.2 108.2-108.2a28.07 28.07 0 0 1 39.6 0 28.07 28.07 0 0 1 0 39.6l-128 128Z"/>
39
+ </svg>
40
+ </div>
41
+ </template>
42
+ </FluxButton>
43
+ </template>
44
+
45
+ <script
46
+ lang="ts"
47
+ setup>
48
+ import type { FluxButtonEmits, FluxButtonProps } from '@flux-ui/types';
49
+ import { clsx } from 'clsx';
50
+ import FluxButton from './FluxButton.vue';
51
+ import FluxIcon from './FluxIcon.vue';
52
+ import $style from '$flux/css/component/Button.module.scss';
53
+
54
+ defineEmits<FluxButtonEmits>();
55
+
56
+ defineProps<Omit<FluxButtonProps, 'iconLeading'> & {
57
+ readonly isDone?: boolean;
58
+ }>();
59
+ </script>
@@ -0,0 +1,109 @@
1
+ <template>
2
+ <FluxButtonGroup
3
+ :class="$style.quantitySelector"
4
+ :aria-disabled="disabled ? true : undefined">
5
+ <FluxSecondaryButton
6
+ :class="$style.quantitySelectorButton"
7
+ :disabled="disabled || modelValue <= min"
8
+ icon-leading="minus"
9
+ tabindex="-1"
10
+ @click="decrement"/>
11
+
12
+ <input
13
+ ref="input"
14
+ v-model="modelValue"
15
+ :class="$style.quantitySelectorInput"
16
+ :style="{
17
+ width: `${width}px`
18
+ }"
19
+ :disabled="disabled"
20
+ tabindex="0"
21
+ type="number"
22
+ :max="max"
23
+ :min="min"
24
+ :step="step"/>
25
+
26
+ <FluxSecondaryButton
27
+ :class="$style.quantitySelectorButton"
28
+ :disabled="disabled || modelValue >= max"
29
+ icon-leading="plus"
30
+ tabindex="-1"
31
+ @click="increment"/>
32
+ </FluxButtonGroup>
33
+ </template>
34
+
35
+ <script
36
+ lang="ts"
37
+ setup>
38
+ import { unrefTemplateElement } from '@flux-ui/internals';
39
+ import { ref, toRef, unref, useTemplateRef, watchEffect } from 'vue';
40
+ import { useDisabled } from '$flux/composable';
41
+ import FluxButtonGroup from './FluxButtonGroup.vue';
42
+ import FluxSecondaryButton from './FluxSecondaryButton.vue';
43
+ import $style from '$flux/css/component/Form.module.scss';
44
+
45
+ const modelValue = defineModel<number>({
46
+ default: 0
47
+ });
48
+
49
+ const {
50
+ disabled: componentDisabled,
51
+ max = 100,
52
+ min = 0,
53
+ step = 1
54
+ } = defineProps<{
55
+ readonly disabled?: boolean;
56
+ readonly max?: number;
57
+ readonly min?: number;
58
+ readonly step?: number;
59
+ }>();
60
+
61
+ const disabled = useDisabled(toRef(() => componentDisabled));
62
+ const inputRef = useTemplateRef('input');
63
+
64
+ const width = ref(0);
65
+
66
+ function decrement(): void {
67
+ if (unref(disabled)) {
68
+ return;
69
+ }
70
+
71
+ modelValue.value = Math.max(min, unref(modelValue) - step);
72
+ }
73
+
74
+ function increment(): void {
75
+ if (unref(disabled)) {
76
+ return;
77
+ }
78
+
79
+ modelValue.value = Math.min(max, unref(modelValue) + step);
80
+ }
81
+
82
+ function sizeToContent(): void {
83
+ const input = unrefTemplateElement<HTMLInputElement>(inputRef);
84
+
85
+ if (!input || isNaN(input.valueAsNumber)) {
86
+ return;
87
+ }
88
+
89
+ width.value = 0;
90
+
91
+ requestAnimationFrame(() => {
92
+ width.value = Math.max(51, input.scrollWidth + 30);
93
+ });
94
+ }
95
+
96
+ watchEffect(() => {
97
+ if (unref(modelValue) > max) {
98
+ increment();
99
+ return;
100
+ }
101
+
102
+ if (unref(modelValue) < min) {
103
+ decrement();
104
+ return;
105
+ }
106
+
107
+ sizeToContent();
108
+ });
109
+ </script>
@@ -0,0 +1,34 @@
1
+ <template>
2
+ <button
3
+ :class="clsx(
4
+ $style.remove,
5
+ isHidden && $style.isHidden
6
+ )"
7
+ type="button"
8
+ @click="emit('click', $event)">
9
+ <FluxIcon
10
+ v-if="icon"
11
+ :name="icon"
12
+ :size="16"/>
13
+ </button>
14
+ </template>
15
+
16
+ <script
17
+ lang="ts"
18
+ setup>
19
+ import type { FluxIconName } from '@flux-ui/types';
20
+ import { clsx } from 'clsx';
21
+ import FluxIcon from './FluxIcon.vue';
22
+ import $style from '$flux/css/component/Remove.module.scss';
23
+
24
+ const emit = defineEmits<{
25
+ click: [MouseEvent];
26
+ }>();
27
+
28
+ const {
29
+ icon = 'xmark'
30
+ } = defineProps<{
31
+ readonly icon?: FluxIconName;
32
+ readonly isHidden?: boolean;
33
+ }>();
34
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <div
3
+ :class="$style.root"
4
+ :inert="inertMain">
5
+ <slot/>
6
+ </div>
7
+
8
+ <FluxOverlay size="medium">
9
+ <FluxAlert
10
+ v-for="alert of alerts"
11
+ :key="alert.id"
12
+ :alert="alert"/>
13
+ </FluxOverlay>
14
+
15
+ <FluxOverlay size="medium">
16
+ <FluxConfirm
17
+ v-for="confirm of confirms"
18
+ :key="confirm.id"
19
+ :confirm="confirm"/>
20
+ </FluxOverlay>
21
+
22
+ <FluxOverlay size="medium">
23
+ <FluxPrompt
24
+ v-for="prompt of prompts"
25
+ :key="prompt.id"
26
+ :prompt="prompt"/>
27
+ </FluxOverlay>
28
+
29
+ <FluxSnackbarProvider/>
30
+ <FluxTooltipProvider/>
31
+ </template>
32
+
33
+ <script
34
+ lang="ts"
35
+ setup>
36
+ import { watch } from 'vue';
37
+ import { useFluxStore } from '$flux/data';
38
+ import FluxAlert from './FluxAlert.vue';
39
+ import FluxConfirm from './FluxConfirm.vue';
40
+ import FluxPrompt from './FluxPrompt.vue';
41
+ import FluxOverlay from './FluxOverlay.vue';
42
+ import FluxSnackbarProvider from './FluxSnackbarProvider.vue';
43
+ import FluxTooltipProvider from './FluxTooltipProvider.vue';
44
+ import $style from '$flux/css/component/Root.module.scss';
45
+
46
+ defineSlots<{
47
+ default(): any;
48
+ }>();
49
+
50
+ const {alerts, confirms, inertMain, prompts} = useFluxStore();
51
+
52
+ watch(inertMain, (inert, _, onCleanup): void => {
53
+ if (!inert) {
54
+ return;
55
+ }
56
+
57
+ document.body.classList.add($style.isLocked);
58
+ onCleanup(() => document.body.classList.remove($style.isLocked));
59
+ }, {immediate: true});
60
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <FluxButton
3
+ :="{type, disabled, iconLeading, iconTrailing, isFilled, isLoading, isSubmit, label, size, href, rel, target, to}"
4
+ :css-class="$style.secondaryButton"
5
+ :css-class-icon="$style.secondaryButtonIcon"
6
+ :css-class-label="$style.secondaryButtonLabel"
7
+ @click="$emit('click', $event)"
8
+ @mouseenter="$emit('mouseenter', $event)"
9
+ @mouseleave="$emit('mouseleave', $event)">
10
+ <template
11
+ v-for="slot of SLOTS"
12
+ #[slot]>
13
+ <slot :name="slot"/>
14
+ </template>
15
+ </FluxButton>
16
+ </template>
17
+
18
+ <script
19
+ lang="ts"
20
+ setup>
21
+ import type { FluxButtonEmits, FluxButtonProps, FluxButtonSlots } from '@flux-ui/types';
22
+ import FluxButton, { SLOTS } from './FluxButton.vue';
23
+ import $style from '$flux/css/component/Button.module.scss';
24
+
25
+ defineEmits<FluxButtonEmits>();
26
+ defineProps<FluxButtonProps>();
27
+ defineSlots<FluxButtonSlots>();
28
+ </script>