frappe-ui 1.0.2 → 1.2.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.
- package/experimental/Calendar/CalendarEventRow.vue +0 -4
- package/experimental/Calendar/calendarUtils.ts +33 -21
- package/experimental/CommandPalette/CommandPaletteItem.vue +9 -1
- package/experimental/MultiEmailInput/MultiEmailInput.vue +64 -12
- package/experimental/MultiEmailInput/types.ts +12 -3
- package/experimental/SpriteIcons/IconPicker.vue +2 -1
- package/experimental/Stepper/StepIndicator.vue +129 -0
- package/experimental/Stepper/Stepper.api.md +117 -0
- package/experimental/Stepper/Stepper.md +95 -0
- package/experimental/Stepper/Stepper.vue +82 -0
- package/experimental/Stepper/StepperHorizontal.vue +93 -0
- package/experimental/Stepper/StepperVertical.vue +291 -0
- package/experimental/Stepper/index.ts +11 -0
- package/experimental/Stepper/resolve.ts +87 -0
- package/experimental/Stepper/types.ts +89 -0
- package/experimental.ts +2 -21
- package/package.json +1 -3
- package/src/charts/CalendarHeatmapChart.vue +353 -0
- package/src/charts/DonutChart.vue +34 -58
- package/src/charts/HeatmapChart.vue +26 -64
- package/src/charts/NumberCard.vue +62 -7
- package/src/charts/PercentageBarChart.vue +243 -0
- package/src/charts/SankeyChart.vue +14 -11
- package/src/charts/ScatterChart.vue +24 -20
- package/src/charts/axisChartCommon.ts +182 -18
- package/src/charts/axisFormat.ts +8 -3
- package/src/charts/calendarHeatmapOptions.ts +604 -0
- package/src/charts/colorMath.ts +26 -0
- package/src/charts/components/ChartContainer.vue +63 -53
- package/src/charts/components/ChartLegend.vue +216 -24
- package/src/charts/components/ChartScale.vue +85 -0
- package/src/charts/core/dataLabelFit.ts +45 -6
- package/src/charts/core/useAxisChart.ts +36 -19
- package/src/charts/core/useChart.ts +6 -1
- package/src/charts/core/usePlotKeyboard.ts +13 -2
- package/src/charts/docs/BarChart.md +11 -3
- package/src/charts/docs/CalendarHeatmapChart.api.md +165 -0
- package/src/charts/docs/CalendarHeatmapChart.md +33 -0
- package/src/charts/docs/ChartContainer.api.md +6 -0
- package/src/charts/docs/ChartLegend.api.md +1 -1
- package/src/charts/docs/ChartLegend.md +25 -3
- package/src/charts/docs/DonutChart.api.md +12 -0
- package/src/charts/docs/DonutChart.md +17 -0
- package/src/charts/docs/HeatmapChart.api.md +1 -1
- package/src/charts/docs/LineChart.md +5 -3
- package/src/charts/docs/NumberCard.api.md +6 -0
- package/src/charts/docs/NumberCard.md +6 -0
- package/src/charts/docs/Overview.md +13 -6
- package/src/charts/docs/PercentageBarChart.api.md +148 -0
- package/src/charts/docs/PercentageBarChart.md +42 -0
- package/src/charts/docs/ScatterChart.md +2 -3
- package/src/charts/donutChartOptions.ts +22 -130
- package/src/charts/format.ts +4 -1
- package/src/charts/heatmapOptions.ts +17 -12
- package/src/charts/hiddenSeries.ts +8 -3
- package/src/charts/index.ts +12 -0
- package/src/charts/legendOverflow.ts +40 -0
- package/src/charts/numberCardFormat.ts +19 -13
- package/src/charts/referenceLines.ts +2 -1
- package/src/charts/scatterOptions.ts +16 -3
- package/src/charts/seriesData.ts +8 -3
- package/src/charts/slices.ts +228 -0
- package/src/charts/tokens.ts +99 -0
- package/src/charts/types.ts +318 -9
- package/src/components/Avatar/Avatar.md +27 -2
- package/src/components/Avatar/Avatar.vue +29 -12
- package/src/components/Breadcrumbs/Breadcrumbs.vue +2 -1
- package/src/components/Combobox/Combobox.vue +9 -2
- package/src/components/Combobox/ComboboxResults.vue +6 -1
- package/src/components/Combobox/utils.ts +2 -1
- package/src/components/DatePicker/DatePicker.md +7 -0
- package/src/components/DatePicker/DatePicker.vue +6 -0
- package/src/components/DatePicker/DateTimePicker.vue +6 -0
- package/src/components/DatePicker/composables.ts +18 -1
- package/src/components/DatePicker/utils.ts +53 -0
- package/src/components/Dialog/Dialog.md +3 -1
- package/src/components/Duration/Duration.api.md +16 -3
- package/src/components/Duration/Duration.md +21 -0
- package/src/components/Duration/Duration.vue +29 -8
- package/src/components/Duration/duration.ts +105 -44
- package/src/components/Duration/index.ts +1 -0
- package/src/components/Duration/types.ts +30 -1
- package/src/components/HoverCard/HoverCard.vue +21 -5
- package/src/components/Menu/utils.ts +3 -2
- package/src/components/MobileNav/MobileNavItem.vue +3 -22
- package/src/components/MultiSelect/MultiSelect.api.md +5 -0
- package/src/components/MultiSelect/MultiSelect.vue +34 -0
- package/src/components/MultiSelect/MultiSelectResults.vue +3 -4
- package/src/components/MultiSelect/types.ts +6 -0
- package/src/components/Select/Select.vue +4 -4
- package/src/components/Select/utils.ts +1 -0
- package/src/components/SettingsDialog/SettingsDialog.api.md +7 -2
- package/src/components/SettingsDialog/SettingsDialog.md +2 -1
- package/src/components/SettingsDialog/SettingsRow.vue +12 -2
- package/src/components/Sidebar/SidebarItem.vue +3 -33
- package/src/components/SidebarRail/SidebarRailItem.vue +4 -17
- package/src/components/Switch/Switch.vue +3 -3
- package/src/components/Tooltip/Tooltip.vue +8 -0
- package/src/components/shared/deferredTrigger.ts +174 -0
- package/src/components/shared/navLink.ts +45 -0
- package/src/components/shared/selection/utils.ts +8 -1
- package/src/data-fetching/useCall/useCall.ts +25 -26
- package/src/data-fetching/useFrappeFetch.ts +48 -2
- package/src/data-fetching/useList/useList.ts +11 -3
- package/src/data-fetching/utils.ts +15 -1
- package/src/molecules/editor/components/MediaNodeView.vue +10 -1
- package/src/molecules/editor/components/MediaResizeGuide.vue +71 -0
- package/src/molecules/editor/components/media-node-view-utils.ts +7 -0
- package/src/molecules/editor/composables/useNodeViewResize.ts +142 -10
- package/src/molecules/editor/extensions/attachment/attachment-engine.ts +1 -1
- package/src/molecules/editor/extensions/content-paste/paste-html-utils.ts +16 -6
- package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +29 -10
- package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +35 -16
- package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +1 -1
- package/src/molecules/editor/extensions/iframe/iframe-extension.ts +30 -30
- package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +1 -1
- package/src/molecules/editor/extensions/link/link-paste-plugin.ts +1 -1
- package/src/molecules/editor/extensions/shared/media-upload-engine.ts +1 -1
- package/src/molecules/editor/useEditor.ts +12 -6
- package/src/molecules/list/ListRow.vue +8 -1
- package/src/utils/dialog.ts +57 -16
- package/src/{molecules/editor/extensions/shared → utils}/url-safety.ts +28 -16
- package/tailwind/content.js +1 -1
- package/tailwind/plugin.js +22 -0
- package/vite/README.md +5 -3
- package/vite/codeLanguages.js +41 -17
- package/vite/doctypeInterfaceGenerator.js +52 -39
- package/vitepress/index.node.ts +0 -2
- package/experimental/TextEditor/TextEditor.api.md +0 -161
- package/experimental/TextEditor/TextEditor.vue +0 -298
- package/experimental/TextEditor/classIcon.ts +0 -21
- package/experimental/TextEditor/commands.js +0 -344
- package/experimental/TextEditor/components/CodeBlockComponent.vue +0 -103
- package/experimental/TextEditor/components/FontColor.vue +0 -153
- package/experimental/TextEditor/components/ImageViewerModal.vue +0 -463
- package/experimental/TextEditor/components/InsertImage.vue +0 -54
- package/experimental/TextEditor/components/InsertLink.vue +0 -13
- package/experimental/TextEditor/components/InsertVideo.vue +0 -14
- package/experimental/TextEditor/components/LinkPopup.vue +0 -99
- package/experimental/TextEditor/components/MediaNodeView.vue +0 -398
- package/experimental/TextEditor/components/MentionList.vue +0 -95
- package/experimental/TextEditor/components/TextEditorBubbleMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFixedMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFloatingMenu.vue +0 -61
- package/experimental/TextEditor/components/TextEditorMenu.vue +0 -218
- package/experimental/TextEditor/components/index.js +0 -0
- package/experimental/TextEditor/extensions/code-block.ts +0 -119
- package/experimental/TextEditor/extensions/color/color-extension.ts +0 -140
- package/experimental/TextEditor/extensions/color/color-styles.css +0 -25
- package/experimental/TextEditor/extensions/color/index.ts +0 -2
- package/experimental/TextEditor/extensions/content-paste-extension.ts +0 -160
- package/experimental/TextEditor/extensions/copy-styles.ts +0 -160
- package/experimental/TextEditor/extensions/emoji/EmojiList.vue +0 -55
- package/experimental/TextEditor/extensions/emoji/emoji-extension.ts +0 -55
- package/experimental/TextEditor/extensions/emoji/emojis.json +0 -7422
- package/experimental/TextEditor/extensions/heading/heading.ts +0 -20
- package/experimental/TextEditor/extensions/highlight/highlight-extension.ts +0 -241
- package/experimental/TextEditor/extensions/highlight/highlight-styles.css +0 -31
- package/experimental/TextEditor/extensions/highlight/index.ts +0 -2
- package/experimental/TextEditor/extensions/iframe/IframeNodeView.vue +0 -308
- package/experimental/TextEditor/extensions/iframe/InsertIframe.vue +0 -209
- package/experimental/TextEditor/extensions/iframe/iframe-extension.ts +0 -404
- package/experimental/TextEditor/extensions/iframe/index.ts +0 -11
- package/experimental/TextEditor/extensions/iframe/utils.ts +0 -283
- package/experimental/TextEditor/extensions/image/image-extension.ts +0 -661
- package/experimental/TextEditor/extensions/image/index.ts +0 -5
- package/experimental/TextEditor/extensions/image-group/ImageGroupNodeView.vue +0 -182
- package/experimental/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +0 -740
- package/experimental/TextEditor/extensions/image-group/image-group-extension.ts +0 -187
- package/experimental/TextEditor/extensions/image-viewer-extension.ts +0 -162
- package/experimental/TextEditor/extensions/link/index.ts +0 -1
- package/experimental/TextEditor/extensions/link/link-extension.ts +0 -323
- package/experimental/TextEditor/extensions/link/linkPasteHandler.ts +0 -51
- package/experimental/TextEditor/extensions/mention/index.ts +0 -1
- package/experimental/TextEditor/extensions/mention/mention-extension.ts +0 -204
- package/experimental/TextEditor/extensions/mention/style.css +0 -11
- package/experimental/TextEditor/extensions/shared/color-utils.ts +0 -236
- package/experimental/TextEditor/extensions/slash-commands/SlashCommandsList.vue +0 -59
- package/experimental/TextEditor/extensions/slash-commands/slash-commands-extension.ts +0 -184
- package/experimental/TextEditor/extensions/suggestion/SuggestionList.vue +0 -130
- package/experimental/TextEditor/extensions/suggestion/createSuggestionExtension.ts +0 -151
- package/experimental/TextEditor/extensions/suggestion/index.ts +0 -5
- package/experimental/TextEditor/extensions/tag/index.ts +0 -1
- package/experimental/TextEditor/extensions/tag/tag-extension.ts +0 -170
- package/experimental/TextEditor/extensions/toc-node/TocNodeView.vue +0 -439
- package/experimental/TextEditor/extensions/toc-node/index.ts +0 -3
- package/experimental/TextEditor/extensions/toc-node/toc-node-extension.ts +0 -167
- package/experimental/TextEditor/extensions/video-extension.ts +0 -653
- package/experimental/TextEditor/hljs-github.css +0 -197
- package/experimental/TextEditor/index.ts +0 -21
- package/experimental/TextEditor/style.css +0 -190
- package/experimental/TextEditor/types.ts +0 -72
- package/experimental/TextEditor/utils.js +0 -11
- package/src/utils/url-validation.ts +0 -39
|
@@ -132,10 +132,6 @@
|
|
|
132
132
|
>
|
|
133
133
|
<!-- Declined reads the same here as on a pill: struck through and
|
|
134
134
|
muted, still plainly the event you said no to. -->
|
|
135
|
-
<!-- leading-5 and leading-4 below, rather than the sizes' own 1.15: at
|
|
136
|
-
13px that leaves a 14.95px line box for glyphs that stand 16px, and
|
|
137
|
-
truncate's overflow-hidden then slices the descender off a g or a y.
|
|
138
|
-
The line box has to clear the ink before it can be clipped for width. -->
|
|
139
135
|
<span
|
|
140
136
|
class="calendar-row-title truncate leading-5"
|
|
141
137
|
:class="[
|
|
@@ -170,13 +170,38 @@ export function findOverlappingEventsCount(
|
|
|
170
170
|
events: CalendarEvent[],
|
|
171
171
|
minuteHeight?: number,
|
|
172
172
|
): CalendarEvent[] {
|
|
173
|
+
// Where an event starts and ends on the grid rather than on the clock: its
|
|
174
|
+
// start, and its start plus the height it is actually painted at.
|
|
175
|
+
const painted = (event: CalendarEvent): [number, number] => {
|
|
176
|
+
const start = event.startTime || 0
|
|
177
|
+
const minutes = (event.endTime || 0) - start
|
|
178
|
+
const end = minuteHeight
|
|
179
|
+
? start + paintedEventHeight(minutes, minuteHeight) / minuteHeight
|
|
180
|
+
: start + minutes
|
|
181
|
+
return [start, end]
|
|
182
|
+
}
|
|
183
|
+
const crosses = (a: [number, number], b: [number, number]) =>
|
|
184
|
+
a[0] < b[1] && b[0] < a[1]
|
|
185
|
+
|
|
173
186
|
// A declined event claims no room: the others lay out as if it were not
|
|
174
187
|
// there, and it sits full width beneath them. Grid events all carry the same
|
|
175
188
|
// z-index, so "beneath" is DOM order — the declined go first, before the
|
|
176
|
-
// events they underlie.
|
|
177
|
-
|
|
189
|
+
// events they underlie. Beneath is still beneath: a pill drawn on a declined
|
|
190
|
+
// event cuts against it as it would against any other, so each declined
|
|
191
|
+
// event is laid out first, and every pill whose extent crosses it is over
|
|
192
|
+
// it. Declined over declined the same, in start order.
|
|
193
|
+
const declined: CalendarEvent[] = []
|
|
194
|
+
for (const event of events
|
|
178
195
|
.filter((event) => event.isDeclined)
|
|
179
|
-
.
|
|
196
|
+
.sort((a, b) => (a.startTime || 0) - (b.startTime || 0))) {
|
|
197
|
+
const own = painted(event)
|
|
198
|
+
declined.push({
|
|
199
|
+
...event,
|
|
200
|
+
hallNumber: 0,
|
|
201
|
+
idx: -1,
|
|
202
|
+
over: declined.filter((other) => crosses(painted(other), own)),
|
|
203
|
+
})
|
|
204
|
+
}
|
|
180
205
|
events = events.filter((event) => !event.isDeclined)
|
|
181
206
|
|
|
182
207
|
// Sort events based on start time
|
|
@@ -198,19 +223,6 @@ export function findOverlappingEventsCount(
|
|
|
198
223
|
}
|
|
199
224
|
}
|
|
200
225
|
|
|
201
|
-
// Where an event starts and ends on the grid rather than on the clock: its
|
|
202
|
-
// start, and its start plus the height it is actually painted at.
|
|
203
|
-
const painted = (event: CalendarEvent): [number, number] => {
|
|
204
|
-
const start = event.startTime || 0
|
|
205
|
-
const minutes = (event.endTime || 0) - start
|
|
206
|
-
const end = minuteHeight
|
|
207
|
-
? start + paintedEventHeight(minutes, minuteHeight) / minuteHeight
|
|
208
|
-
: start + minutes
|
|
209
|
-
return [start, end]
|
|
210
|
-
}
|
|
211
|
-
const crosses = (a: [number, number], b: [number, number]) =>
|
|
212
|
-
a[0] < b[1] && b[0] < a[1]
|
|
213
|
-
|
|
214
226
|
// flattening halls and events — in order, so that everything beneath a pill
|
|
215
227
|
// is laid out, with its own `over`, by the time the pill looks for it
|
|
216
228
|
const placed: CalendarEvent[][] = []
|
|
@@ -218,11 +230,11 @@ export function findOverlappingEventsCount(
|
|
|
218
230
|
const placedHall: CalendarEvent[] = []
|
|
219
231
|
placed.push(placedHall)
|
|
220
232
|
for (const [eventIdx, event] of hall.entries()) {
|
|
221
|
-
// Everything drawn beneath this pill: the
|
|
222
|
-
// under it in full, and the event before it in its
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
.flat()
|
|
233
|
+
// Everything drawn beneath this pill: the declined, the earlier
|
|
234
|
+
// columns, which run under it in full, and the event before it in its
|
|
235
|
+
// own.
|
|
236
|
+
const beneath = declined
|
|
237
|
+
.concat(placed.slice(0, hallIdx).flat())
|
|
226
238
|
.concat(placedHall.slice(Math.max(eventIdx - 1, 0), eventIdx))
|
|
227
239
|
const own = painted(event)
|
|
228
240
|
placedHall.push({
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
:data-state="active ? 'active' : undefined"
|
|
15
15
|
:data-disabled="disabled ? '' : undefined"
|
|
16
16
|
class="mx-2.5 flex min-w-0 cursor-default items-center rounded-4 px-2 py-2 text-base-medium leading-tighter text-ink-gray-8 outline-none data-[state=active]:bg-surface-gray-2 data-[disabled]:cursor-not-allowed data-[disabled]:text-ink-gray-4"
|
|
17
|
-
v-bind="$attrs"
|
|
17
|
+
v-bind="{ ...$attrs, ...checkedHref($attrs) }"
|
|
18
18
|
>
|
|
19
19
|
<slot name="prefix" v-bind="slotProps" />
|
|
20
20
|
<span
|
|
@@ -48,6 +48,7 @@ import {
|
|
|
48
48
|
useCommandPaletteGroupContext,
|
|
49
49
|
useCommandPaletteListContext,
|
|
50
50
|
} from './context'
|
|
51
|
+
import { safeHref } from '#utils/url-safety'
|
|
51
52
|
import type {
|
|
52
53
|
CommandPaletteItemEmits,
|
|
53
54
|
CommandPaletteItemProps,
|
|
@@ -73,6 +74,7 @@ defineSlots<{
|
|
|
73
74
|
}>()
|
|
74
75
|
|
|
75
76
|
const palette = useCommandPaletteContext()
|
|
77
|
+
|
|
76
78
|
const group = useCommandPaletteGroupContext()
|
|
77
79
|
const list = useCommandPaletteListContext()
|
|
78
80
|
|
|
@@ -174,6 +176,12 @@ const slotProps = computed<CommandPaletteItemSlotProps>(() => ({
|
|
|
174
176
|
disabled: props.disabled ?? false,
|
|
175
177
|
}))
|
|
176
178
|
|
|
179
|
+
// Check only an href the caller passed. Adding `href: undefined` would fall
|
|
180
|
+
// through a RouterLink onto its anchor and erase the href it generates.
|
|
181
|
+
function checkedHref(attrs: Record<string, unknown>) {
|
|
182
|
+
return 'href' in attrs ? { href: safeHref(attrs.href) } : {}
|
|
183
|
+
}
|
|
184
|
+
|
|
177
185
|
function onSelect(event: CommandPaletteSelectEvent) {
|
|
178
186
|
emit('select', event)
|
|
179
187
|
if (event.defaultPrevented) return
|
|
@@ -49,7 +49,6 @@ const props = withDefaults(defineProps<MultiEmailInputProps>(), {
|
|
|
49
49
|
loading: false,
|
|
50
50
|
size: 'sm',
|
|
51
51
|
placeholder: 'Add email…',
|
|
52
|
-
emptyText: 'No results',
|
|
53
52
|
loadingText: 'Loading...',
|
|
54
53
|
disabled: false,
|
|
55
54
|
side: 'bottom',
|
|
@@ -153,19 +152,43 @@ const suggestions = computed<MultiEmailOption[]>(() =>
|
|
|
153
152
|
props.options.filter((o) => !selectedSet.value.has(o.value.toLowerCase())),
|
|
154
153
|
)
|
|
155
154
|
|
|
155
|
+
const typed = computed(() => query.value.trim())
|
|
156
|
+
|
|
156
157
|
// Offer an explicit "create" row when the typed value is a valid, new address.
|
|
157
158
|
const showCreateOption = computed(() => {
|
|
158
|
-
const q =
|
|
159
|
+
const q = typed.value
|
|
159
160
|
if (!q || !validate(q)) return false
|
|
160
161
|
const lc = q.toLowerCase()
|
|
161
162
|
if (selectedSet.value.has(lc)) return false
|
|
162
163
|
return !suggestions.value.some((o) => o.value.toLowerCase() === lc)
|
|
163
164
|
})
|
|
164
165
|
|
|
166
|
+
// Most typing here is a new address, so an unmatched query shows nothing
|
|
167
|
+
// unless the host asked for an empty state.
|
|
165
168
|
const showEmpty = computed(
|
|
166
|
-
() =>
|
|
169
|
+
() =>
|
|
170
|
+
typed.value !== '' &&
|
|
171
|
+
Boolean(props.emptyText || slots.empty) &&
|
|
172
|
+
!props.loading &&
|
|
173
|
+
!suggestions.value.length &&
|
|
174
|
+
!showCreateOption.value,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
// The spinner only for a typed query: the fetch primed on focus opens the
|
|
178
|
+
// list once it has results, rather than flashing a spinner over nothing.
|
|
179
|
+
const showLoading = computed(() => props.loading && typed.value !== '')
|
|
180
|
+
|
|
181
|
+
// The list opens only when it has something to show.
|
|
182
|
+
const hasContent = computed(
|
|
183
|
+
() =>
|
|
184
|
+
showLoading.value ||
|
|
185
|
+
(!props.loading &&
|
|
186
|
+
(suggestions.value.length > 0 || showCreateOption.value)) ||
|
|
187
|
+
showEmpty.value,
|
|
167
188
|
)
|
|
168
189
|
|
|
190
|
+
const listOpen = computed(() => open.value && hasContent.value)
|
|
191
|
+
|
|
169
192
|
// Avatar has its own scale (`xs` 16px, `sm` 20px, `md` 24px), and the option
|
|
170
193
|
// row is `min-h-6`/`min-h-7`/`min-h-8`/`min-h-10` plus `ItemListRow`'s own
|
|
171
194
|
// padding. Step the avatar down with the row for the two small sizes rather
|
|
@@ -182,8 +205,10 @@ const boxClasses = computed(() => [
|
|
|
182
205
|
props.disabled && 'cursor-not-allowed bg-surface-gray-1',
|
|
183
206
|
])
|
|
184
207
|
|
|
208
|
+
// Matches the design system's tag: 20px tall, padded 3px 4px 3px 6px, a 12px
|
|
209
|
+
// avatar (8px initials, as the xs avatar's would overflow) and close icon. The padding is 1px less on each side for the border.
|
|
185
210
|
const chipClasses =
|
|
186
|
-
'inline-flex items-center gap-1 rounded-
|
|
211
|
+
'inline-flex h-5 max-w-full items-center gap-1 rounded-2 border border-outline-gray-1 bg-surface-base py-0.5 pl-[5px] pr-[3px] text-xs leading-tighter text-ink-gray-7 transition-colors data-[disabled]:opacity-60 aria-[current=true]:ring-2 aria-[current=true]:ring-outline-gray-3'
|
|
187
212
|
|
|
188
213
|
const inputClasses = computed(() => [
|
|
189
214
|
'min-w-[6rem] flex-1 border-0 bg-transparent p-0.5 text-ink-gray-8 outline-none ring-0 placeholder:text-ink-gray-4 focus:ring-0 disabled:cursor-not-allowed',
|
|
@@ -225,8 +250,32 @@ function onFocus(event: FocusEvent) {
|
|
|
225
250
|
if (!props.options.length && !query.value) emit('update:query', '')
|
|
226
251
|
}
|
|
227
252
|
|
|
253
|
+
// Focus opens the list once; a click reopens it after a pick or Escape.
|
|
254
|
+
function onClick() {
|
|
255
|
+
if (!props.disabled) open.value = true
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
// Reka closes on blur and Escape, and clears the query, only while its list is
|
|
259
|
+
// mounted. A hidden list hears neither, so close the way reka would; otherwise
|
|
260
|
+
// a fetch landing later reopens a field the user has left.
|
|
261
|
+
function close() {
|
|
262
|
+
open.value = false
|
|
263
|
+
query.value = ''
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
function onBlur(event: FocusEvent) {
|
|
267
|
+
emit('blur', event)
|
|
268
|
+
if (listOpen.value) return
|
|
269
|
+
const control = (event.target as HTMLElement).closest('[data-slot="control"]')
|
|
270
|
+
// Same check as reka: a frame later, focus has settled (a chip's delete
|
|
271
|
+
// button stays inside; switching windows keeps the input active).
|
|
272
|
+
requestAnimationFrame(() => {
|
|
273
|
+
if (!control?.contains(document.activeElement)) close()
|
|
274
|
+
})
|
|
275
|
+
}
|
|
276
|
+
|
|
228
277
|
function onEnter() {
|
|
229
|
-
const q =
|
|
278
|
+
const q = typed.value
|
|
230
279
|
if (!q) return
|
|
231
280
|
// Valid addresses and matching suggestions are committed by Combobox selecting
|
|
232
281
|
// the highlighted row (the create row's value IS the typed address). Only when
|
|
@@ -293,7 +342,7 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
293
342
|
v-model="model"
|
|
294
343
|
multiple
|
|
295
344
|
ignore-filter
|
|
296
|
-
:open="
|
|
345
|
+
:open="listOpen"
|
|
297
346
|
:disabled="disabled"
|
|
298
347
|
class="relative"
|
|
299
348
|
@update:open="open = $event"
|
|
@@ -328,6 +377,7 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
328
377
|
:remove-tag="() => removeAt(chip.index)"
|
|
329
378
|
>
|
|
330
379
|
<Avatar
|
|
380
|
+
class="size-3 [&>div]:text-[8px]"
|
|
331
381
|
:image="chip.option?.avatar"
|
|
332
382
|
:label="chip.label"
|
|
333
383
|
size="xs"
|
|
@@ -335,7 +385,7 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
335
385
|
<span class="truncate">{{ chip.label }}</span>
|
|
336
386
|
<TagsInputItemDelete
|
|
337
387
|
:aria-label="`Remove ${chip.value}`"
|
|
338
|
-
class="-
|
|
388
|
+
class="inline-flex shrink-0 items-center justify-center rounded-1 text-ink-gray-7 transition hover:text-ink-gray-9"
|
|
339
389
|
>
|
|
340
390
|
<span class="lucide-x size-3" />
|
|
341
391
|
</TagsInputItemDelete>
|
|
@@ -352,9 +402,11 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
352
402
|
:class="inputClasses"
|
|
353
403
|
v-bind="inputAriaAttrs"
|
|
354
404
|
@keydown.enter.prevent="onEnter"
|
|
405
|
+
@keydown.esc="close"
|
|
355
406
|
@paste="onPaste"
|
|
356
407
|
@focus="onFocus"
|
|
357
|
-
@
|
|
408
|
+
@click="onClick"
|
|
409
|
+
@blur="onBlur"
|
|
358
410
|
/>
|
|
359
411
|
</ComboboxInput>
|
|
360
412
|
</TagsInputRoot>
|
|
@@ -373,7 +425,7 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
373
425
|
>
|
|
374
426
|
<ComboboxViewport class="max-h-60 overflow-auto p-1">
|
|
375
427
|
<div
|
|
376
|
-
v-if="
|
|
428
|
+
v-if="showLoading"
|
|
377
429
|
data-slot="loading"
|
|
378
430
|
class="flex items-center gap-2 px-2 py-1.5 text-base text-ink-gray-5"
|
|
379
431
|
>
|
|
@@ -386,11 +438,11 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
386
438
|
highlighted row, and Enter commits what the user typed. -->
|
|
387
439
|
<ComboboxItem
|
|
388
440
|
v-if="showCreateOption"
|
|
389
|
-
:value="
|
|
441
|
+
:value="typed"
|
|
390
442
|
data-slot="item"
|
|
391
443
|
data-create="true"
|
|
392
444
|
:data-size="size"
|
|
393
|
-
:text-value="
|
|
445
|
+
:text-value="typed"
|
|
394
446
|
:class="[itemClasses, itemRootSizeClasses(size)]"
|
|
395
447
|
>
|
|
396
448
|
<ItemListRow :size="toItemListSize(size)">
|
|
@@ -404,7 +456,7 @@ defineSlots<MultiEmailInputSlots>()
|
|
|
404
456
|
</template>
|
|
405
457
|
<template #label>
|
|
406
458
|
<div class="min-w-0 truncate text-ink-gray-8">
|
|
407
|
-
{{ createLabel(
|
|
459
|
+
{{ createLabel(typed) }}
|
|
408
460
|
</div>
|
|
409
461
|
</template>
|
|
410
462
|
</ItemListRow>
|
|
@@ -52,7 +52,10 @@ export interface MultiEmailInputProps extends InputLabelingProps {
|
|
|
52
52
|
*/
|
|
53
53
|
options?: MultiEmailOption[]
|
|
54
54
|
|
|
55
|
-
/**
|
|
55
|
+
/**
|
|
56
|
+
* Shows a spinner in place of the results for a typed query. With an empty
|
|
57
|
+
* query the list stays closed until results arrive.
|
|
58
|
+
*/
|
|
56
59
|
loading?: boolean
|
|
57
60
|
|
|
58
61
|
/** Size of the control and option rows. */
|
|
@@ -61,7 +64,10 @@ export interface MultiEmailInputProps extends InputLabelingProps {
|
|
|
61
64
|
/** Placeholder shown when there are no chips. */
|
|
62
65
|
placeholder?: string
|
|
63
66
|
|
|
64
|
-
/**
|
|
67
|
+
/**
|
|
68
|
+
* Copy shown when a typed query matches nothing. Unset by default: the list
|
|
69
|
+
* stays closed instead, since most typing here is a new address.
|
|
70
|
+
*/
|
|
65
71
|
emptyText?: string
|
|
66
72
|
|
|
67
73
|
/** Shown beside the spinner while `loading`. */
|
|
@@ -126,7 +132,10 @@ export interface MultiEmailInputSlots {
|
|
|
126
132
|
/** Replaces the suffix region of a suggestion row. */
|
|
127
133
|
'item-suffix'?: (props: MultiEmailItemSlotProps) => any
|
|
128
134
|
|
|
129
|
-
/**
|
|
135
|
+
/**
|
|
136
|
+
* Rendered when a typed query matches nothing. Without it or `emptyText`,
|
|
137
|
+
* the list stays closed instead.
|
|
138
|
+
*/
|
|
130
139
|
empty?: (props: { query: string }) => any
|
|
131
140
|
}
|
|
132
141
|
|
|
@@ -167,6 +167,7 @@ defineExpose({
|
|
|
167
167
|
<Icon
|
|
168
168
|
:name="internalModelValue || 'circle-dashed'"
|
|
169
169
|
class="w-4 h-4 flex-shrink-0"
|
|
170
|
+
:class="internalModelValue ? 'text-ink-gray-8' : 'text-ink-gray-4'"
|
|
170
171
|
/>
|
|
171
172
|
<ComboboxInput
|
|
172
173
|
:value="searchTerm"
|
|
@@ -207,7 +208,7 @@ defineExpose({
|
|
|
207
208
|
:key="iconName"
|
|
208
209
|
@click="handleIconClick(iconName)"
|
|
209
210
|
type="button"
|
|
210
|
-
class="w-8 h-8 flex items-center justify-center rounded-4 hover:bg-surface-gray-3 transition-colors"
|
|
211
|
+
class="w-8 h-8 flex items-center justify-center rounded-4 text-ink-gray-7 hover:bg-surface-gray-3 transition-colors"
|
|
211
212
|
:class="{
|
|
212
213
|
'bg-surface-gray-3': internalModelValue === iconName,
|
|
213
214
|
}"
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span
|
|
3
|
+
data-slot="step-indicator"
|
|
4
|
+
:data-state="state"
|
|
5
|
+
:data-loading="running || undefined"
|
|
6
|
+
class="relative inline-flex shrink-0 items-center justify-center"
|
|
7
|
+
:class="[sizeClass, colorClass]"
|
|
8
|
+
>
|
|
9
|
+
<template v-if="running">
|
|
10
|
+
<span
|
|
11
|
+
class="lucide-circle absolute inset-0 size-full text-ink-gray-3"
|
|
12
|
+
aria-hidden="true"
|
|
13
|
+
/>
|
|
14
|
+
<span
|
|
15
|
+
class="fui-step-arc lucide-circle absolute inset-0 size-full"
|
|
16
|
+
aria-hidden="true"
|
|
17
|
+
/>
|
|
18
|
+
</template>
|
|
19
|
+
<span
|
|
20
|
+
v-else
|
|
21
|
+
class="absolute inset-0 size-full"
|
|
22
|
+
:class="icon"
|
|
23
|
+
aria-hidden="true"
|
|
24
|
+
/>
|
|
25
|
+
<span
|
|
26
|
+
v-if="number != null"
|
|
27
|
+
class="relative text-2xs-medium tabular-nums leading-none"
|
|
28
|
+
:class="state === 'upcoming' ? 'text-ink-gray-5' : 'text-ink-gray-9'"
|
|
29
|
+
aria-hidden="true"
|
|
30
|
+
>
|
|
31
|
+
{{ number }}
|
|
32
|
+
</span>
|
|
33
|
+
<span class="sr-only">{{ stateLabel }}</span>
|
|
34
|
+
</span>
|
|
35
|
+
</template>
|
|
36
|
+
|
|
37
|
+
<script setup lang="ts">
|
|
38
|
+
import { computed } from 'vue'
|
|
39
|
+
import type { StepState } from './types'
|
|
40
|
+
|
|
41
|
+
const props = defineProps<{
|
|
42
|
+
state: StepState
|
|
43
|
+
/** Indicator diameter: 20, 16 or 14px. */
|
|
44
|
+
size: 'md' | 'sm' | 'xs'
|
|
45
|
+
/** The current step is running. */
|
|
46
|
+
loading?: boolean
|
|
47
|
+
/** Top-level steps only; shown while the step is not finished. */
|
|
48
|
+
index?: number
|
|
49
|
+
}>()
|
|
50
|
+
|
|
51
|
+
// Literal class strings so Tailwind's scanner picks every icon up.
|
|
52
|
+
const ICONS: Record<StepState, string> = {
|
|
53
|
+
upcoming: 'lucide-circle',
|
|
54
|
+
current: 'lucide-circle',
|
|
55
|
+
complete: 'lucide-circle-check',
|
|
56
|
+
failed: 'lucide-circle-alert',
|
|
57
|
+
skipped: 'lucide-circle-minus',
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const COLORS: Record<StepState, string> = {
|
|
61
|
+
upcoming: 'text-ink-gray-4',
|
|
62
|
+
current: 'text-ink-gray-9',
|
|
63
|
+
complete: 'text-ink-gray-8',
|
|
64
|
+
failed: 'text-ink-red-7',
|
|
65
|
+
skipped: 'text-ink-gray-4',
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const LABELS: Record<StepState, string> = {
|
|
69
|
+
upcoming: 'not started',
|
|
70
|
+
current: 'current',
|
|
71
|
+
complete: 'completed',
|
|
72
|
+
failed: 'failed',
|
|
73
|
+
skipped: 'skipped',
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const running = computed(() => props.state === 'current' && props.loading)
|
|
77
|
+
const unfinished = computed(
|
|
78
|
+
() => props.state === 'current' || props.state === 'upcoming',
|
|
79
|
+
)
|
|
80
|
+
const number = computed(() =>
|
|
81
|
+
props.index != null && unfinished.value ? props.index + 1 : null,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
// A current sub-step (no number) marks itself with a dot instead.
|
|
85
|
+
const icon = computed(() =>
|
|
86
|
+
props.state === 'current' && number.value == null
|
|
87
|
+
? 'lucide-circle-dot'
|
|
88
|
+
: ICONS[props.state],
|
|
89
|
+
)
|
|
90
|
+
const colorClass = computed(() => COLORS[props.state])
|
|
91
|
+
const stateLabel = computed(() =>
|
|
92
|
+
running.value ? 'running' : LABELS[props.state],
|
|
93
|
+
)
|
|
94
|
+
const sizeClass = computed(
|
|
95
|
+
() => ({ md: 'size-5', sm: 'size-4', xs: 'size-3.5' })[props.size],
|
|
96
|
+
)
|
|
97
|
+
</script>
|
|
98
|
+
|
|
99
|
+
<style scoped>
|
|
100
|
+
/* Registered so the angle interpolates. The icon itself never rotates — only
|
|
101
|
+
the paint inside its mask does, the same technique Spinner uses, so the
|
|
102
|
+
circle cannot wobble on fractional pixels. */
|
|
103
|
+
@property --fui-step-arc-angle {
|
|
104
|
+
syntax: '<angle>';
|
|
105
|
+
inherits: false;
|
|
106
|
+
initial-value: 0deg;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
.fui-step-arc {
|
|
110
|
+
background: conic-gradient(
|
|
111
|
+
from var(--fui-step-arc-angle),
|
|
112
|
+
transparent 0 45%,
|
|
113
|
+
var(--ink-gray-8) 100%
|
|
114
|
+
);
|
|
115
|
+
animation: fui-step-arc 1.6s linear infinite;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
@keyframes fui-step-arc {
|
|
119
|
+
to {
|
|
120
|
+
--fui-step-arc-angle: 360deg;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
@media (prefers-reduced-motion: reduce) {
|
|
125
|
+
.fui-step-arc {
|
|
126
|
+
animation: none;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<!-- Auto Generated by scripts/propsgen.ts -->
|
|
2
|
+
<script setup>
|
|
3
|
+
import PropsTable from '@/components/Docs/PropsTable.vue'
|
|
4
|
+
import SlotsTable from '@/components/Docs/SlotsTable.vue'
|
|
5
|
+
import EmitsTable from '@/components/Docs/EmitsTable.vue'
|
|
6
|
+
|
|
7
|
+
const propsData = [
|
|
8
|
+
{
|
|
9
|
+
name: 'steps',
|
|
10
|
+
description: 'Steps in order.',
|
|
11
|
+
required: true,
|
|
12
|
+
type: 'StepItem[]'
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: 'modelValue',
|
|
16
|
+
description: 'Value of the current step; may be a sub-step\'s value.',
|
|
17
|
+
required: false,
|
|
18
|
+
type: 'StepValue | null',
|
|
19
|
+
default: 'null'
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'completed',
|
|
23
|
+
description: 'Every step is done. Wins over `modelValue`.',
|
|
24
|
+
required: false,
|
|
25
|
+
type: 'boolean',
|
|
26
|
+
default: 'false'
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'loading',
|
|
30
|
+
description: 'The current step is running: its indicator\'s outline spins.',
|
|
31
|
+
required: false,
|
|
32
|
+
type: 'boolean',
|
|
33
|
+
default: 'false'
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'failed',
|
|
37
|
+
description: 'The current step failed.',
|
|
38
|
+
required: false,
|
|
39
|
+
type: 'boolean',
|
|
40
|
+
default: 'false'
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'vertical',
|
|
44
|
+
description: 'Lays the steps out as a vertical list instead of a segmented bar.',
|
|
45
|
+
required: false,
|
|
46
|
+
type: 'boolean',
|
|
47
|
+
default: 'false'
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'edge',
|
|
51
|
+
description: 'Vertical only: the side the indicators sit on.',
|
|
52
|
+
required: false,
|
|
53
|
+
type: 'StepperEdge',
|
|
54
|
+
default: '"start"'
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'size',
|
|
58
|
+
description: 'Size of the indicators and text.',
|
|
59
|
+
required: false,
|
|
60
|
+
type: 'StepperSize',
|
|
61
|
+
default: '"md"'
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
name: 'substeps',
|
|
65
|
+
description: 'Vertical only: show sub-steps for every step, or only the current one.',
|
|
66
|
+
required: false,
|
|
67
|
+
type: '"all" | "current"',
|
|
68
|
+
default: '"all"'
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'clickable',
|
|
72
|
+
description: 'Finished steps become buttons that set `v-model`. Off while `completed`\nis set, since `completed` would override the value a click sets.',
|
|
73
|
+
required: false,
|
|
74
|
+
type: 'boolean',
|
|
75
|
+
default: 'false'
|
|
76
|
+
}
|
|
77
|
+
]
|
|
78
|
+
|
|
79
|
+
const slotsData = [
|
|
80
|
+
{
|
|
81
|
+
name: 'step-prefix',
|
|
82
|
+
description: 'Replaces a step\'s indicator.',
|
|
83
|
+
type: 'StepSlotProps'
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
name: 'step-label',
|
|
87
|
+
description: 'Replaces a step\'s label.',
|
|
88
|
+
type: 'StepSlotProps'
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
name: 'step-description',
|
|
92
|
+
description: 'Replaces a step\'s description (vertical only).',
|
|
93
|
+
type: 'StepSlotProps'
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
name: 'step-suffix',
|
|
97
|
+
description: 'Replaces a step\'s trailing meta text (vertical only).',
|
|
98
|
+
type: 'StepSlotProps'
|
|
99
|
+
}
|
|
100
|
+
]
|
|
101
|
+
|
|
102
|
+
const emitsData = [
|
|
103
|
+
{
|
|
104
|
+
name: 'update:modelValue',
|
|
105
|
+
description: 'Fired when a finished step is clicked (`clickable` only).',
|
|
106
|
+
type: '[value: StepValue]'
|
|
107
|
+
}
|
|
108
|
+
]
|
|
109
|
+
</script>
|
|
110
|
+
|
|
111
|
+
## API Reference
|
|
112
|
+
|
|
113
|
+
<PropsTable name="Stepper" :data="propsData"/>
|
|
114
|
+
|
|
115
|
+
<SlotsTable :data="slotsData"/>
|
|
116
|
+
|
|
117
|
+
<EmitsTable :data="emitsData"/>
|