@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,99 @@
1
+ <template>
2
+ <FluxDropZone
3
+ accept="image/*"
4
+ :disabled="!isEditable"
5
+ :is-empty="items && items.length === 0"
6
+ is-multiple
7
+ placeholder-icon="image"
8
+ :placeholder-button="translate('flux.galleryPlaceholderButton')"
9
+ :placeholder-message="translate('flux.galleryPlaceholderMessage')"
10
+ :placeholder-title="translate('flux.galleryPlaceholderTitle')"
11
+ @select-multiple="onFilesSelected">
12
+ <template #default="{showPicker}">
13
+ <TransitionGroup
14
+ :class="$style.gallery"
15
+ :move-class="$style.galleryMove"
16
+ tag="div">
17
+ <template
18
+ v-if="items"
19
+ v-for="(item, index) of items">
20
+ <FluxGalleryItem
21
+ v-if="typeof item === 'string'"
22
+ :is-deletable="isEditable"
23
+ :key="item"
24
+ :url="item"
25
+ @delete="$emit('delete', index)"/>
26
+
27
+ <FluxGalleryItem
28
+ v-else
29
+ :is-deletable="isEditable"
30
+ :key="item.url"
31
+ :focal-point="item"
32
+ :url="item.url"
33
+ @delete="$emit('delete', index)"/>
34
+ </template>
35
+
36
+ <slot/>
37
+
38
+ <FluxGalleryItem
39
+ v-for="item of pendingItems"
40
+ is-pending
41
+ :key="item"
42
+ :url="item"/>
43
+
44
+ <button
45
+ v-if="isEditable"
46
+ key="gallery-add"
47
+ :class="$style.galleryAdd"
48
+ type="button"
49
+ @click="showPicker()">
50
+ <FluxIcon name="plus"/>
51
+ </button>
52
+ </TransitionGroup>
53
+ </template>
54
+ </FluxDropZone>
55
+ </template>
56
+
57
+ <script
58
+ lang="ts"
59
+ setup>
60
+ import type { FluxFocalPointObject } from '@flux-ui/types';
61
+ import { useTranslate } from '$flux/composable/private';
62
+ import FluxDropZone from './FluxDropZone.vue';
63
+ import FluxGalleryItem from './FluxGalleryItem.vue';
64
+ import FluxIcon from './FluxIcon.vue';
65
+ import $style from '$flux/css/component/Gallery.module.scss';
66
+
67
+ const emit = defineEmits<{
68
+ delete: [number];
69
+ upload: [File[]];
70
+ }>();
71
+
72
+ defineProps<{
73
+ readonly isEditable?: boolean;
74
+ readonly items?: (string | (FluxFocalPointObject & { readonly url: string; }))[];
75
+ readonly pendingItems?: string[];
76
+ }>();
77
+
78
+ defineSlots<{
79
+ default(): any;
80
+ }>();
81
+
82
+ const translate = useTranslate();
83
+
84
+ function onFilesSelected(files: FileList): void {
85
+ const images: File[] = [];
86
+
87
+ for (let i = 0; i < files.length; ++i) {
88
+ const file = files.item(i);
89
+
90
+ if (!file || !file.type.startsWith('image/')) {
91
+ continue;
92
+ }
93
+
94
+ images.push(file);
95
+ }
96
+
97
+ emit('upload', images);
98
+ }
99
+ </script>
@@ -0,0 +1,49 @@
1
+ <template>
2
+ <div
3
+ :class="$style.galleryItem"
4
+ @mouseenter.capture="isDeleteVisible = true"
5
+ @mouseout.capture="isDeleteVisible = false">
6
+ <FluxFocalPointImage
7
+ :class="$style.galleryItemImage"
8
+ :focal-point="focalPoint"
9
+ :src="url"/>
10
+
11
+ <FluxRemove
12
+ v-if="isDeletable"
13
+ :is-hidden="!isDeleteVisible"
14
+ tabindex="-1"
15
+ @click="emit('delete')"/>
16
+
17
+ <div
18
+ v-if="isPending"
19
+ :class="$style.galleryItemLoader">
20
+ <FluxSpinner :size="24"/>
21
+ </div>
22
+ </div>
23
+ </template>
24
+
25
+ <script
26
+ lang="ts"
27
+ setup>
28
+ import type { FluxFocalPointObject } from '@flux-ui/types';
29
+ import { ref } from 'vue';
30
+ import FluxFocalPointImage from './FluxFocalPointImage.vue';
31
+ import FluxRemove from './FluxRemove.vue';
32
+ import FluxSpinner from './FluxSpinner.vue';
33
+ import $style from '$flux/css/component/Gallery.module.scss';
34
+
35
+ const emit = defineEmits<{
36
+ delete: [];
37
+ }>();
38
+
39
+ const {
40
+ focalPoint
41
+ } = defineProps<{
42
+ readonly focalPoint?: FluxFocalPointObject;
43
+ readonly isDeletable?: boolean;
44
+ readonly isPending?: boolean;
45
+ readonly url: string;
46
+ }>();
47
+
48
+ const isDeleteVisible = ref(false);
49
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div
3
+ :class="$style.grid"
4
+ :style="{
5
+ '--gap': `${gap}px`,
6
+ '--columns': columns
7
+ }">
8
+ <slot/>
9
+ </div>
10
+ </template>
11
+
12
+ <script
13
+ lang="ts"
14
+ setup>
15
+ import $style from '$flux/css/component/Grid.module.scss';
16
+
17
+ const {
18
+ columns = 12,
19
+ gap = 30
20
+ } = defineProps<{
21
+ readonly columns?: number;
22
+ readonly gap?: number;
23
+ }>();
24
+
25
+ defineSlots<{
26
+ default(): any;
27
+ }>();
28
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <div
3
+ :class="$style.gridColumn"
4
+ :style="{
5
+ '--xs': xs ?? 12,
6
+ '--sm': sm ?? xs ?? 12,
7
+ '--md': md ?? sm ?? xs ?? 12,
8
+ '--lg': lg ?? md ?? sm ?? xs ?? 12,
9
+ '--xl': xl ?? lg ?? md ?? sm ?? xs ?? 12
10
+ }">
11
+ <slot/>
12
+ </div>
13
+ </template>
14
+
15
+ <script
16
+ lang="ts"
17
+ setup>
18
+ import $style from '$flux/css/component/Grid.module.scss';
19
+
20
+ defineProps<{
21
+ readonly xs?: number;
22
+ readonly sm?: number;
23
+ readonly md?: number;
24
+ readonly lg?: number;
25
+ readonly xl?: number;
26
+ }>();
27
+
28
+ defineSlots<{
29
+ default(): any;
30
+ }>();
31
+ </script>
@@ -0,0 +1,60 @@
1
+ <template>
2
+ <svg
3
+ ref="svg"
4
+ :class="$style.gridPattern">
5
+ <defs>
6
+ <pattern
7
+ :id="id"
8
+ :width="width"
9
+ :height="height"
10
+ patternUnits="userSpaceOnUse"
11
+ :x="-1"
12
+ :y="-1">
13
+ <path
14
+ :d="`M.5 ${height}V.5H${width}`"
15
+ fill="none"
16
+ :stroke-dasharray="strokeDasharray"/>
17
+ </pattern>
18
+ </defs>
19
+
20
+ <rect
21
+ width="100%"
22
+ height="100%"
23
+ stroke-width="0"
24
+ :fill="`url(#${id})`"/>
25
+
26
+ <svg
27
+ v-if="squares"
28
+ style="overflow: visible;">
29
+ <rect
30
+ v-for="[x, y] of squares"
31
+ :key="`${x}-${y}`"
32
+ :width="width - 1"
33
+ :height="height - 1"
34
+ :x="x * width"
35
+ :y="y * height"
36
+ stroke-width="0"/>
37
+ </svg>
38
+ </svg>
39
+ </template>
40
+
41
+ <script
42
+ lang="ts"
43
+ setup>
44
+ import { useId } from 'vue';
45
+ import $style from '$flux/css/component/Visual.module.scss';
46
+
47
+ const {
48
+ width = 42,
49
+ height = 42,
50
+ strokeDasharray = 0,
51
+ squares
52
+ } = defineProps<{
53
+ readonly width?: number;
54
+ readonly height?: number;
55
+ readonly strokeDasharray?: number | string;
56
+ readonly squares?: Array<[x: number, y: number]>;
57
+ }>();
58
+
59
+ const id = useId();
60
+ </script>
@@ -0,0 +1,79 @@
1
+ <template>
2
+ <svg
3
+ v-if="definition"
4
+ :viewBox="`0 0 ${definition.width} ${definition.height}`"
5
+ :class="$style.fontAwesomeIcon"
6
+ :style="{
7
+ fontSize: size && `${size}px`,
8
+ scale: definition.scale > 1 ? definition.scale : undefined
9
+ }"
10
+ focusable="false"
11
+ role="img"
12
+ aria-hidden="true"
13
+ @click="onClick">
14
+ <path
15
+ v-for="path in definition.paths"
16
+ :d="path"
17
+ fill="currentColor"/>
18
+ </svg>
19
+
20
+ <i
21
+ v-else-if="name"
22
+ :class="$style.materialSymbolIcon"
23
+ :style="{
24
+ fontSize: size && `${size}px`
25
+ }"
26
+ role="img"
27
+ aria-hidden="true"
28
+ @click="onClick">
29
+ {{ name }}
30
+ </i>
31
+
32
+ <i
33
+ v-else
34
+ :class="$style.icon"/>
35
+ </template>
36
+
37
+ <script
38
+ lang="ts"
39
+ setup>
40
+ import { warn } from '@flux-ui/internals';
41
+ import type { FluxIconName } from '@flux-ui/types';
42
+ import { computed } from 'vue';
43
+ import { iconRegistry } from '$flux/data';
44
+ import $style from '$flux/css/component/Icon.module.scss';
45
+
46
+ const emit = defineEmits<{
47
+ click: [MouseEvent];
48
+ }>();
49
+
50
+ const {
51
+ name
52
+ } = defineProps<{
53
+ readonly size?: number | string;
54
+ readonly name?: FluxIconName;
55
+ }>();
56
+
57
+ const definition = computed(() => {
58
+ if (!name) {
59
+ return null;
60
+ }
61
+
62
+ const icon = iconRegistry[name];
63
+
64
+ if (!icon) {
65
+ warn(`Unknown icon: ${name}`);
66
+
67
+ return null;
68
+ }
69
+
70
+ return {
71
+ width: icon[0],
72
+ height: icon[1],
73
+ paths: (Array.isArray(icon[4]) ? icon[4] : [icon[4]]) as string[],
74
+ scale: Math.max(1, icon[0] / 512)
75
+ };
76
+ });
77
+
78
+ const onClick = (evt: MouseEvent) => emit('click', evt);
79
+ </script>
@@ -0,0 +1,28 @@
1
+ <template>
2
+ <div :class="$style.info">
3
+ <FluxIcon
4
+ v-if="icon"
5
+ :class="$style.infoIcon"
6
+ :name="icon"/>
7
+
8
+ <div :class="$style.infoBody">
9
+ <slot/>
10
+ </div>
11
+ </div>
12
+ </template>
13
+
14
+ <script
15
+ setup
16
+ lang="ts">
17
+ import type { FluxIconName } from '@flux-ui/types';
18
+ import FluxIcon from './FluxIcon.vue';
19
+ import $style from '$flux/css/component/Info.module.scss';
20
+
21
+ defineProps<{
22
+ readonly icon?: FluxIconName;
23
+ }>();
24
+
25
+ defineSlots<{
26
+ default(): any;
27
+ }>();
28
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <FluxStack
3
+ direction="vertical"
4
+ :gap="21">
5
+ <slot/>
6
+ </FluxStack>
7
+ </template>
8
+
9
+ <script
10
+ setup
11
+ lang="ts">
12
+ import FluxStack from './FluxStack.vue';
13
+
14
+ defineSlots<{
15
+ default(): any;
16
+ }>();
17
+ </script>
@@ -0,0 +1,27 @@
1
+ <template>
2
+ <div :class="direction === 'horizontal' ? $style.legendHorizontal : $style.legendVertical">
3
+ <template v-for="item of items">
4
+ <span
5
+ :class="$style.legendItem"
6
+ :style="{
7
+ '--color': item.color
8
+ }">
9
+ {{ item.label }}
10
+ </span>
11
+ </template>
12
+ </div>
13
+ </template>
14
+
15
+ <script
16
+ lang="ts"
17
+ setup>
18
+ import type { FluxDirection, FluxLegendObject } from '@flux-ui/types';
19
+ import $style from '$flux/css/component/Legend.module.scss';
20
+
21
+ const {
22
+ direction = 'horizontal'
23
+ } = defineProps<{
24
+ readonly direction?: FluxDirection;
25
+ readonly items: FluxLegendObject[];
26
+ }>();
27
+ </script>
@@ -0,0 +1,35 @@
1
+ <template>
2
+ <FluxButton
3
+ :="{type, disabled, iconLeading: icon, iconTrailing: 'arrow-right-long', isFilled, label, href, rel, target, to}"
4
+ :css-class="$style.linkButton"
5
+ :css-class-icon="$style.linkButtonIcon"
6
+ :css-class-label="$style.linkButtonLabel"
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, FluxIconName } from '@flux-ui/types';
22
+ import FluxButton, { SLOTS } from './FluxButton.vue';
23
+ import $style from '$flux/css/component/Button.module.scss';
24
+
25
+ const emit = defineEmits<FluxButtonEmits>();
26
+
27
+ const {
28
+ type = 'button'
29
+ } = defineProps<FluxButtonProps & {
30
+ readonly icon?: FluxIconName;
31
+ readonly label?: string;
32
+ }>();
33
+
34
+ defineSlots<FluxButtonSlots>();
35
+ </script>
@@ -0,0 +1,31 @@
1
+ <template>
2
+ <nav
3
+ ref="element"
4
+ :class="isLarge ? $style.menuLarge : $style.menuNormal"
5
+ role="menu"
6
+ aria-orientation="vertical">
7
+ <slot/>
8
+ </nav>
9
+ </template>
10
+
11
+ <script
12
+ lang="ts"
13
+ setup>
14
+ import { useFocusZone } from '@flux-ui/internals';
15
+ import { useTemplateRef } from 'vue';
16
+ import $style from '$flux/css/component/Menu.module.scss';
17
+
18
+ defineProps<{
19
+ readonly isLarge?: boolean;
20
+ }>();
21
+
22
+ defineSlots<{
23
+ default(): any;
24
+ }>();
25
+
26
+ const elementRef = useTemplateRef('element');
27
+
28
+ useFocusZone(elementRef, {
29
+ direction: 'vertical'
30
+ });
31
+ </script>
@@ -0,0 +1,21 @@
1
+ <template>
2
+ <div
3
+ :class="isHorizontal ? $style.menuGroupHorizontal : $style.menuGroupVertical"
4
+ role="group">
5
+ <slot/>
6
+ </div>
7
+ </template>
8
+
9
+ <script
10
+ lang="ts"
11
+ setup>
12
+ import $style from '$flux/css/component/Menu.module.scss';
13
+
14
+ defineProps<{
15
+ readonly isHorizontal?: boolean;
16
+ }>();
17
+
18
+ defineSlots<{
19
+ default(): any;
20
+ }>();
21
+ </script>
@@ -0,0 +1,84 @@
1
+ <template>
2
+ <FluxButton
3
+ :="{type, disabled, iconLeading, iconTrailing, isLoading, label, href, rel, target, to}"
4
+ :css-class="$style.menuItem"
5
+ :css-class-icon="$style.menuItemIcon"
6
+ :css-class-label="$style.menuItemLabel"
7
+ is-filled
8
+ :role="isSelectable ? 'menuitemradio' : 'menuitem'"
9
+ :class="{
10
+ [$style.menuItemActive]: isActive,
11
+ [$style.menuItemDestructive]: isDestructive,
12
+ [$style.menuItemHighlighted]: isHighlighted,
13
+ [$style.menuItemIndented]: isIndented,
14
+ [$style.menuItemSelected]: isSelectable && isSelected
15
+ }"
16
+ :aria-checked="isSelectable ? isSelected : undefined"
17
+ @click="$emit('click', $event)">
18
+ <template
19
+ v-if="isSelectable && (!iconLeading || isSelected)"
20
+ #iconLeading>
21
+ <FluxIcon
22
+ :class="$style.menuItemSelectableIcon"
23
+ :name="isSelected ? 'circle-check' : undefined"/>
24
+ </template>
25
+
26
+ <template
27
+ v-else-if="imageSrc"
28
+ #iconLeading>
29
+ <img
30
+ :class="$style.menuItemImage"
31
+ :src="imageSrc"
32
+ alt=""/>
33
+ </template>
34
+
35
+ <template
36
+ v-if="command || commandIcon || commandLoading"
37
+ #after>
38
+ <FluxSpinner
39
+ v-if="commandLoading"
40
+ :class="$style.menuItemCommandIcon"
41
+ :size="16"/>
42
+
43
+ <template v-else>
44
+ <kbd
45
+ v-if="command"
46
+ :class="$style.menuItemCommand">
47
+ {{ command }}
48
+ </kbd>
49
+
50
+ <FluxIcon
51
+ v-if="commandIcon"
52
+ :class="$style.menuItemCommandIcon"
53
+ :name="commandIcon"/>
54
+ </template>
55
+ </template>
56
+ </FluxButton>
57
+ </template>
58
+
59
+ <script
60
+ lang="ts"
61
+ setup>
62
+ import type { FluxButtonEmits, FluxButtonProps, FluxIconName } from '@flux-ui/types';
63
+ import FluxButton from './FluxButton.vue';
64
+ import FluxIcon from './FluxIcon.vue';
65
+ import FluxSpinner from './FluxSpinner.vue';
66
+ import $style from '$flux/css/component/Menu.module.scss';
67
+
68
+ defineEmits<FluxButtonEmits>();
69
+
70
+ const {
71
+ type = 'button'
72
+ } = defineProps<Omit<FluxButtonProps, 'isFilled' | 'isSubmit' | 'size'> & {
73
+ readonly command?: string;
74
+ readonly commandIcon?: FluxIconName;
75
+ readonly commandLoading?: boolean;
76
+ readonly imageSrc?: string;
77
+ readonly isActive?: boolean;
78
+ readonly isDestructive?: boolean;
79
+ readonly isHighlighted?: boolean;
80
+ readonly isIndented?: boolean;
81
+ readonly isSelectable?: boolean;
82
+ readonly isSelected?: boolean;
83
+ }>();
84
+ </script>
@@ -0,0 +1,38 @@
1
+ <template>
2
+ <FluxMenuGroup :is-horizontal="isHorizontal">
3
+ <template v-for="item in items">
4
+ <component :is="item"/>
5
+ </template>
6
+ </FluxMenuGroup>
7
+ </template>
8
+
9
+ <script
10
+ lang="ts"
11
+ setup>
12
+ import { flattenVNodeTree } from '@flux-ui/internals';
13
+ import { cloneVNode, computed, unref, VNode } from 'vue';
14
+ import FluxMenuGroup from './FluxMenuGroup.vue';
15
+
16
+ const modelValue = defineModel<number>({
17
+ required: true
18
+ });
19
+
20
+ const {
21
+ mode = 'highlight'
22
+ } = defineProps<{
23
+ readonly isHorizontal?: boolean;
24
+ readonly mode?: 'highlight' | 'select';
25
+ }>();
26
+
27
+ const slots = defineSlots<{
28
+ default(): any;
29
+ }>();
30
+
31
+ const items = computed(() => flattenVNodeTree(slots.default())
32
+ .map((item: VNode, index: number) => cloneVNode(item, {
33
+ isHighlighted: mode === 'highlight' && unref(modelValue) === index,
34
+ isSelectable: mode === 'select',
35
+ isSelected: mode === 'select' && unref(modelValue) === index,
36
+ onClick: () => modelValue.value = index
37
+ })));
38
+ </script>
@@ -0,0 +1,33 @@
1
+ <template>
2
+ <div
3
+ :class="$style.menuSubHeader"
4
+ role="presentation">
5
+ <FluxIcon
6
+ v-if="iconLeading"
7
+ :class="$style.menuSubHeaderIcon"
8
+ :name="iconLeading"/>
9
+
10
+ <span :class="$style.menuSubHeaderLabel">
11
+ {{ label }}
12
+ </span>
13
+
14
+ <FluxIcon
15
+ v-if="iconTrailing"
16
+ :class="$style.menuSubHeaderIcon"
17
+ :name="iconTrailing"/>
18
+ </div>
19
+ </template>
20
+
21
+ <script
22
+ lang="ts"
23
+ setup>
24
+ import type { FluxIconName } from '@flux-ui/types';
25
+ import FluxIcon from './FluxIcon.vue';
26
+ import $style from '$flux/css/component/Menu.module.scss';
27
+
28
+ defineProps<{
29
+ readonly iconLeading?: FluxIconName;
30
+ readonly iconTrailing?: FluxIconName;
31
+ readonly label: string;
32
+ }>();
33
+ </script>
@@ -0,0 +1,17 @@
1
+ <template>
2
+ <div
3
+ :class="$style.menuTitle"
4
+ role="presentation">
5
+ {{ title }}
6
+ </div>
7
+ </template>
8
+
9
+ <script
10
+ lang="ts"
11
+ setup>
12
+ import $style from '$flux/css/component/Menu.module.scss';
13
+
14
+ defineProps<{
15
+ readonly title: string;
16
+ }>();
17
+ </script>