@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,353 @@
1
+ <template>
2
+ <div :class="$style.datePicker">
3
+ <div :class="$style.datePickerHeader">
4
+ <FluxFadeTransition>
5
+ <FluxSecondaryButton
6
+ v-if="viewMode === 'date'"
7
+ :disabled="!isWithinBoundary(viewDatePrevious, 'month')"
8
+ icon-leading="angle-left"
9
+ :aria-label="translate('flux.previous')"
10
+ @click="previousMonth"/>
11
+ </FluxFadeTransition>
12
+
13
+ <div
14
+ :class="$style.datePickerHeaderView"
15
+ :id="id"
16
+ aria-live="polite"
17
+ role="presentation">
18
+ <button
19
+ :class="$style.datePickerHeaderViewButton"
20
+ type="button"
21
+ @click="setView('month')">
22
+ {{ viewMonth }}
23
+ </button>
24
+
25
+ <button
26
+ :class="$style.datePickerHeaderViewButton"
27
+ type="button"
28
+ @click="setView('year')">
29
+ {{ viewYear }}
30
+ </button>
31
+ </div>
32
+
33
+ <FluxFadeTransition>
34
+ <FluxSecondaryButton
35
+ v-if="viewMode === 'date'"
36
+ :disabled="!isWithinBoundary(viewDateNext, 'month')"
37
+ icon-leading="angle-right"
38
+ :aria-label="translate('flux.next')"
39
+ @click="nextMonth"/>
40
+ </FluxFadeTransition>
41
+ </div>
42
+
43
+ <FluxVerticalWindowTransition :is-back="viewMode === 'date'">
44
+ <div
45
+ v-if="viewMode === 'date'"
46
+ key="date"
47
+ :class="$style.datePickerDates"
48
+ :aria-labelledby="id">
49
+ <FluxWindowTransition :is-back="isTransitioningToPast">
50
+ <div
51
+ :key="viewDate.month"
52
+ :class="$style.datePickerDatesGrid">
53
+ <template
54
+ v-for="day of days"
55
+ :key="day">
56
+ <span :class="$style.datePickerDay">{{ day }}</span>
57
+ </template>
58
+
59
+ <template
60
+ v-for="date of dates"
61
+ :key="date">
62
+ <button
63
+ :class="clsx(
64
+ $style.datePickerDate,
65
+ isDisabled(date) && $style.isDisabled,
66
+ isWithinRange(date, 'end') && $style.isRangeEnd,
67
+ isWithinRange(date) && $style.isRangeEntry,
68
+ isWithinRange(date, 'start') && $style.isRangeStart,
69
+ isWithinSelection(date, 'end') && $style.isSelectionEnd,
70
+ isWithinSelection(date) && $style.isSelectionEntry,
71
+ isWithinSelection(date, 'start') && $style.isSelectionStart,
72
+ isSelected(date) && $style.isSelected
73
+ )"
74
+ tabindex="-1"
75
+ type="button"
76
+ @click="setDate(date)"
77
+ @mouseover="onDateMouseOver(date)"
78
+ @mouseout="onDateMouseOut">
79
+ {{ date.toLocaleString({day: 'numeric'}) }}
80
+ </button>
81
+ </template>
82
+ </div>
83
+ </FluxWindowTransition>
84
+ </div>
85
+
86
+ <div
87
+ v-else-if="viewMode === 'month'"
88
+ key="month"
89
+ :class="$style.datePickerMonths">
90
+ <template
91
+ v-for="month of months"
92
+ :key="month">
93
+ <FluxSecondaryButton
94
+ :disabled="!isWithinBoundary(month.date, 'month')"
95
+ :label="month.label"
96
+ tabindex="-1"
97
+ @click="setViewMonth(month.date)"/>
98
+ </template>
99
+ </div>
100
+
101
+ <div
102
+ v-else-if="viewMode === 'year'"
103
+ key="year"
104
+ :class="$style.datePickerYears">
105
+ <FluxSecondaryButton
106
+ icon-leading="angle-left"
107
+ tabindex="-1"
108
+ @click="previousYears"/>
109
+
110
+ <template
111
+ v-for="year of years"
112
+ :key="year">
113
+ <FluxSecondaryButton
114
+ :label="year.toString()"
115
+ tabindex="-1"
116
+ @click="setViewYear(year)"/>
117
+ </template>
118
+
119
+ <FluxSecondaryButton
120
+ icon-leading="angle-right"
121
+ tabindex="-1"
122
+ @click="nextYears"/>
123
+ </div>
124
+ </FluxVerticalWindowTransition>
125
+ </div>
126
+ </template>
127
+
128
+ <script
129
+ lang="ts"
130
+ setup>
131
+ import { useCalendar, useCalendarMonthSwitcher, useCalendarYearSwitcher } from '@flux-ui/internals';
132
+ import { clsx } from 'clsx';
133
+ import { DateTime } from 'luxon';
134
+ import { computed, ref, unref, useId } from 'vue';
135
+ import { useTranslate } from '$flux/composable/private';
136
+ import { FluxFadeTransition, FluxVerticalWindowTransition, FluxWindowTransition } from '$flux/transition';
137
+ import FluxSecondaryButton from './FluxSecondaryButton.vue';
138
+ import $style from '$flux/css/component/DatePicker.module.scss';
139
+
140
+ const modelValue = defineModel<DateTime | DateTime[] | null>({
141
+ default: null,
142
+ required: true
143
+ });
144
+
145
+ const {
146
+ max,
147
+ min,
148
+ rangeMode
149
+ } = defineProps<{
150
+ readonly max?: DateTime;
151
+ readonly min?: DateTime;
152
+ readonly rangeMode?: 'range' | 'week' | 'month';
153
+ }>();
154
+
155
+ const id = useId();
156
+ const translate = useTranslate();
157
+
158
+ const {
159
+ isTransitioningToPast,
160
+ viewDate,
161
+ viewDateNext,
162
+ viewDatePrevious,
163
+ viewMonth,
164
+ viewYear,
165
+ dates,
166
+ days,
167
+ setViewDate,
168
+ nextMonth,
169
+ previousMonth
170
+ } = useCalendar(getInitialDate());
171
+
172
+ const {
173
+ months
174
+ } = useCalendarMonthSwitcher(viewDate, 'short');
175
+
176
+ const {
177
+ years,
178
+ next: nextYears,
179
+ previous: previousYears
180
+ } = useCalendarYearSwitcher(viewDate);
181
+
182
+ const selection = ref<[DateTime | null, DateTime | null]>([null, null]);
183
+ const viewMode = ref<'date' | 'month' | 'year'>('date');
184
+
185
+ const maxDate = computed(() => (max ?? DateTime.now().endOf('year').plus({year: 100})).startOf('day'));
186
+ const minDate = computed(() => (min ?? DateTime.now().startOf('year').minus({year: 100})).startOf('day'));
187
+ const normalizedSelection = computed(() => {
188
+ const [start, end] = unref(selection);
189
+
190
+ if (!start || !end) {
191
+ return [start, end];
192
+ }
193
+
194
+ if (start > end) {
195
+ return [end, start];
196
+ } else {
197
+ return [start, end];
198
+ }
199
+ });
200
+
201
+ function getInitialDate(): DateTime {
202
+ const value = unref(modelValue);
203
+ let date: DateTime;
204
+
205
+ if (!value) {
206
+ date = DateTime.now();
207
+ } else if (Array.isArray(value)) {
208
+ date = value[1];
209
+ } else {
210
+ date = value as DateTime;
211
+ }
212
+
213
+ return date.startOf('day');
214
+ }
215
+
216
+ function isDisabled(date: DateTime): boolean {
217
+ if (unref(viewDate).month !== date.month) {
218
+ return true;
219
+ }
220
+
221
+ return !isWithinBoundary(date);
222
+ }
223
+
224
+ function isSelected(date: DateTime): boolean {
225
+ if (rangeMode) {
226
+ return false;
227
+ }
228
+
229
+ const value = unref(modelValue) as (DateTime | DateTime[]);
230
+
231
+ if (!value || Array.isArray(value)) {
232
+ return false;
233
+ }
234
+
235
+ return value.hasSame(date, 'day');
236
+ }
237
+
238
+ function isWithinBoundary(date: DateTime, unit?: 'month'): boolean {
239
+ if (unit === 'month') {
240
+ return unref(maxDate).endOf('month') >= date && unref(minDate).startOf('month') <= date;
241
+ }
242
+
243
+ return unref(maxDate) >= date && unref(minDate) <= date;
244
+ }
245
+
246
+ function isWithinRange(date: DateTime, edge?: 'start' | 'end'): boolean {
247
+ if (!rangeMode) {
248
+ return false;
249
+ }
250
+
251
+ const value = unref(modelValue);
252
+
253
+ if (!value || !Array.isArray(value)) {
254
+ return false;
255
+ }
256
+
257
+ if (edge) {
258
+ const index = edge === 'start' ? 0 : 1;
259
+
260
+ return value[index].hasSame(date, 'day');
261
+ }
262
+
263
+ return date >= value[0].startOf('day') && date <= value[1].startOf('day');
264
+ }
265
+
266
+ function isWithinSelection(date: DateTime, edge?: 'start' | 'end'): boolean {
267
+ const [selectionStart, selectionEnd] = unref(normalizedSelection);
268
+
269
+ if (!selectionStart || !selectionEnd) {
270
+ return false;
271
+ }
272
+
273
+ if (edge) {
274
+ return (edge === 'start' ? selectionStart : selectionEnd)?.hasSame(date, 'day');
275
+ }
276
+
277
+ return date >= selectionStart && date <= selectionEnd;
278
+ }
279
+
280
+ function setDate(date: DateTime): void {
281
+ switch (rangeMode) {
282
+ case 'range':
283
+ const [start] = unref(selection);
284
+
285
+ if (!start) {
286
+ selection.value = [date, date];
287
+ } else {
288
+ if (date >= start) {
289
+ modelValue.value = [start, date];
290
+ } else {
291
+ modelValue.value = [date, start];
292
+ }
293
+
294
+ selection.value = [null, null];
295
+ }
296
+ break;
297
+
298
+ case 'month':
299
+ modelValue.value = [date.startOf('month'), date.endOf('month')];
300
+ break;
301
+
302
+ case 'week':
303
+ modelValue.value = [date.startOf('week'), date.endOf('week')];
304
+ break;
305
+
306
+ default:
307
+ modelValue.value = date;
308
+ break;
309
+ }
310
+ }
311
+
312
+ function setView(view: 'date' | 'month' | 'year'): void {
313
+ viewMode.value = unref(viewMode) === view ? 'date' : view;
314
+ }
315
+
316
+ function setViewMonth(month: DateTime): void {
317
+ setView('date');
318
+ setViewDate(month);
319
+ }
320
+
321
+ function setViewYear(year: number): void {
322
+ setView('date');
323
+ setViewDate(unref(viewDate).set({year}));
324
+ }
325
+
326
+ function onDateMouseOver(date: DateTime): void {
327
+ if (!rangeMode) {
328
+ return;
329
+ }
330
+
331
+ switch (rangeMode) {
332
+ case 'range':
333
+ selection.value = [selection.value[0], date];
334
+ break;
335
+
336
+ case 'month':
337
+ selection.value = [date.startOf('month'), date.endOf('month')];
338
+ break;
339
+
340
+ case 'week':
341
+ selection.value = [date.startOf('week'), date.endOf('week')];
342
+ break;
343
+ }
344
+ }
345
+
346
+ function onDateMouseOut(): void {
347
+ if (!rangeMode || rangeMode === 'range') {
348
+ return;
349
+ }
350
+
351
+ selection.value = [null, null];
352
+ }
353
+ </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.destructiveButton"
5
+ :css-class-icon="$style.destructiveButtonIcon"
6
+ :css-class-label="$style.destructiveButtonLabel"
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,22 @@
1
+ <template>
2
+ <slot/>
3
+ </template>
4
+
5
+ <script
6
+ lang="ts"
7
+ setup>
8
+ import { provide, toRef } from 'vue';
9
+ import { FluxDisabledInjectionKey } from '$flux/data';
10
+
11
+ defineOptions({
12
+ inheritAttrs: false
13
+ });
14
+
15
+ const {
16
+ disabled = true
17
+ } = defineProps<{
18
+ readonly disabled?: boolean;
19
+ }>();
20
+
21
+ provide(FluxDisabledInjectionKey, toRef(() => disabled));
22
+ </script>
@@ -0,0 +1,37 @@
1
+ <template>
2
+ <div
3
+ :class="clsx(
4
+ contentPlacement === 'start' && $style.dividerContentStart,
5
+ contentPlacement === 'center' && $style.dividerContentCenter,
6
+ contentPlacement === 'end' && $style.dividerContentEnd
7
+ )"
8
+ role="separator"
9
+ aria-orientation="horizontal">
10
+ <div
11
+ v-if="slots.default"
12
+ :class="$style.dividerContent">
13
+ <slot/>
14
+ </div>
15
+
16
+ <hr
17
+ v-else
18
+ :class="$style.dividerLine">
19
+ </div>
20
+ </template>
21
+
22
+ <script
23
+ lang="ts"
24
+ setup>
25
+ import { clsx } from 'clsx';
26
+ import $style from '$flux/css/component/Divider.module.scss';
27
+
28
+ const {
29
+ contentPlacement = 'center'
30
+ } = defineProps<{
31
+ readonly contentPlacement?: 'start' | 'center' | 'end';
32
+ }>();
33
+
34
+ const slots = defineSlots<{
35
+ default?(): any;
36
+ }>();
37
+ </script>
@@ -0,0 +1,72 @@
1
+ <template>
2
+ <svg
3
+ ref="svg"
4
+ :class="$style.dotPattern">
5
+ <defs>
6
+ <pattern
7
+ :id="id"
8
+ :width="width"
9
+ :height="height"
10
+ patternContentUnits="userSpaceOnUse"
11
+ patternUnits="userSpaceOnUse"
12
+ :x="-1"
13
+ :y="-1">
14
+ <circle
15
+ :r="cr"
16
+ :cx="width / 2 - cx"
17
+ :cy="height / 2 - cy"/>
18
+ </pattern>
19
+ </defs>
20
+
21
+ <rect
22
+ width="100%"
23
+ height="100%"
24
+ stroke-width="0"
25
+ :fill="`url(#${id})`"/>
26
+ </svg>
27
+ </template>
28
+
29
+ <script
30
+ lang="ts"
31
+ setup>
32
+ import { ref, useId, useTemplateRef, watch } from 'vue';
33
+ import $style from '$flux/css/component/Visual.module.scss';
34
+
35
+ const {
36
+ width = 16,
37
+ height = 16,
38
+ cr = 1,
39
+ cx = 1,
40
+ cy = 1
41
+ } = defineProps<{
42
+ readonly width?: number;
43
+ readonly height?: number;
44
+ readonly cr?: number;
45
+ readonly cx?: number;
46
+ readonly cy?: number;
47
+ }>();
48
+
49
+ const svgRef = useTemplateRef<HTMLElement>('svg');
50
+ const id = useId();
51
+
52
+ const svgWidth = ref(0);
53
+ const svgHeight = ref(0);
54
+
55
+ watch(svgRef, (svg, _, onCleanup) => {
56
+ if (!svg) {
57
+ return;
58
+ }
59
+
60
+ const onResize = () => {
61
+ svgWidth.value = svg.clientWidth;
62
+ svgHeight.value = svg.clientHeight;
63
+ };
64
+
65
+ window.addEventListener('resize', onResize, {passive: true});
66
+ onResize();
67
+
68
+ onCleanup(() => {
69
+ window.removeEventListener('resize', onResize);
70
+ });
71
+ }, {immediate: true});
72
+ </script>