@hina-ui/vue 1.1.0 → 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/dist/index.js +485 -262
- package/dist/index.js.map +1 -1
- package/dist/types/components/accordion/AccordionContent.vue.d.ts.map +1 -1
- package/dist/types/components/avatar/AvatarGroup.vue.d.ts.map +1 -1
- package/dist/types/components/avatar/utils/children.d.ts +3 -0
- package/dist/types/components/avatar/utils/children.d.ts.map +1 -0
- package/dist/types/components/checkbox-group/CheckboxGroup.vue.d.ts +32 -29
- package/dist/types/components/checkbox-group/CheckboxGroup.vue.d.ts.map +1 -1
- package/dist/types/components/collapsible/CollapsibleContent.vue.d.ts.map +1 -1
- package/dist/types/components/combobox/Combobox.vue.d.ts +38 -38
- package/dist/types/components/combobox/Combobox.vue.d.ts.map +1 -1
- package/dist/types/components/combobox/ComboboxList.vue.d.ts +22 -15
- package/dist/types/components/combobox/ComboboxList.vue.d.ts.map +1 -1
- package/dist/types/components/dialog/Dialog.vue.d.ts +22 -16
- package/dist/types/components/dialog/Dialog.vue.d.ts.map +1 -1
- package/dist/types/components/dialog/dialog.variants.d.ts +32 -2
- package/dist/types/components/dialog/dialog.variants.d.ts.map +1 -1
- package/dist/types/components/image/ImageGroup.vue.d.ts.map +1 -1
- package/dist/types/components/image/composables/useImageGroupState.d.ts +7 -0
- package/dist/types/components/image/composables/useImageGroupState.d.ts.map +1 -0
- package/dist/types/components/input/Input.vue.d.ts +3 -3
- package/dist/types/components/input/Input.vue.d.ts.map +1 -1
- package/dist/types/components/input/InputBase.vue.d.ts +3 -3
- package/dist/types/components/input/InputBase.vue.d.ts.map +1 -1
- package/dist/types/components/input/input.variants.d.ts +52 -6
- package/dist/types/components/input/input.variants.d.ts.map +1 -1
- package/dist/types/components/input-group/InputGroup.vue.d.ts +3 -3
- package/dist/types/components/input-group/InputGroup.vue.d.ts.map +1 -1
- package/dist/types/components/input-group/context.d.ts +2 -1
- package/dist/types/components/input-group/context.d.ts.map +1 -1
- package/dist/types/components/input-group/input-group.variants.d.ts +13 -1
- package/dist/types/components/input-group/input-group.variants.d.ts.map +1 -1
- package/dist/types/components/listbox/Listbox.vue.d.ts +36 -29
- package/dist/types/components/listbox/Listbox.vue.d.ts.map +1 -1
- package/dist/types/components/listbox/ListboxOptionContent.vue.d.ts +31 -0
- package/dist/types/components/listbox/ListboxOptionContent.vue.d.ts.map +1 -0
- package/dist/types/components/listbox/listbox.variants.d.ts +19 -1
- package/dist/types/components/listbox/listbox.variants.d.ts.map +1 -1
- package/dist/types/components/multi-combobox/MultiCombobox.vue.d.ts +41 -43
- package/dist/types/components/multi-combobox/MultiCombobox.vue.d.ts.map +1 -1
- package/dist/types/components/multi-combobox/composables/useMultiCombobox.d.ts +27 -0
- package/dist/types/components/multi-combobox/composables/useMultiCombobox.d.ts.map +1 -0
- package/dist/types/components/multi-select/MultiSelect.vue.d.ts +39 -41
- package/dist/types/components/multi-select/MultiSelect.vue.d.ts.map +1 -1
- package/dist/types/components/number-input/NumberInput.vue.d.ts +3 -3
- package/dist/types/components/number-input/NumberInput.vue.d.ts.map +1 -1
- package/dist/types/components/number-input/number-input.variants.d.ts +10 -1
- package/dist/types/components/number-input/number-input.variants.d.ts.map +1 -1
- package/dist/types/components/password-input/PasswordInput.vue.d.ts +3 -3
- package/dist/types/components/password-input/PasswordInput.vue.d.ts.map +1 -1
- package/dist/types/components/radio-group/RadioGroup.vue.d.ts +32 -29
- package/dist/types/components/radio-group/RadioGroup.vue.d.ts.map +1 -1
- package/dist/types/components/scroll-area/scroll-restore.d.ts +0 -1
- package/dist/types/components/scroll-area/scroll-restore.d.ts.map +1 -1
- package/dist/types/components/search-input/SearchInput.vue.d.ts +3 -3
- package/dist/types/components/search-input/SearchInput.vue.d.ts.map +1 -1
- package/dist/types/components/segmented-control/SegmentedControl.vue.d.ts +30 -30
- package/dist/types/components/segmented-control/SegmentedControl.vue.d.ts.map +1 -1
- package/dist/types/components/select/Select.vue.d.ts +41 -37
- package/dist/types/components/select/Select.vue.d.ts.map +1 -1
- package/dist/types/components/select/SelectList.vue.d.ts +22 -15
- package/dist/types/components/select/SelectList.vue.d.ts.map +1 -1
- package/dist/types/components/select/composables/useClearTransition.d.ts +10 -0
- package/dist/types/components/select/composables/useClearTransition.d.ts.map +1 -0
- package/dist/types/components/select/select.variants.d.ts +16 -0
- package/dist/types/components/select/select.variants.d.ts.map +1 -1
- package/dist/types/components/select/types.d.ts +7 -7
- package/dist/types/components/select/types.d.ts.map +1 -1
- package/dist/types/components/textarea/Textarea.vue.d.ts.map +1 -1
- package/dist/types/components/textarea/composables/useTextareaSizing.d.ts +27 -0
- package/dist/types/components/textarea/composables/useTextareaSizing.d.ts.map +1 -0
- package/dist/types/components/textarea/textarea.variants.d.ts +9 -6
- package/dist/types/components/textarea/textarea.variants.d.ts.map +1 -1
- package/dist/types/lib/caret.d.ts +0 -4
- package/dist/types/lib/caret.d.ts.map +1 -1
- package/dist/types/lib/collapse.d.ts +2 -0
- package/dist/types/lib/collapse.d.ts.map +1 -1
- package/dist/types/lib/field-focus.d.ts +0 -4
- package/dist/types/lib/field-focus.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/accordion/AccordionContent.vue +2 -11
- package/src/components/avatar/AvatarGroup.vue +3 -8
- package/src/components/avatar/utils/children.ts +7 -0
- package/src/components/checkbox-group/CheckboxGroup.vue +3 -3
- package/src/components/collapsible/CollapsibleContent.vue +2 -11
- package/src/components/combobox/Combobox.vue +3 -3
- package/src/components/combobox/ComboboxList.vue +3 -3
- package/src/components/dialog/Dialog.vue +70 -39
- package/src/components/dialog/dialog.variants.ts +9 -3
- package/src/components/image/ImageGroup.vue +2 -30
- package/src/components/image/composables/useImageGroupState.ts +35 -0
- package/src/components/input/Input.vue +3 -3
- package/src/components/input/InputBase.vue +5 -5
- package/src/components/input/input.variants.ts +13 -3
- package/src/components/input-group/InputGroup.vue +11 -4
- package/src/components/input-group/context.ts +2 -1
- package/src/components/input-group/input-group.variants.ts +8 -1
- package/src/components/listbox/Listbox.vue +26 -29
- package/src/components/listbox/ListboxOptionContent.vue +28 -0
- package/src/components/listbox/listbox.variants.ts +6 -1
- package/src/components/multi-combobox/MultiCombobox.vue +14 -52
- package/src/components/multi-combobox/composables/useMultiCombobox.ts +63 -0
- package/src/components/multi-select/MultiSelect.vue +3 -4
- package/src/components/number-input/NumberInput.vue +8 -7
- package/src/components/number-input/number-input.variants.ts +5 -1
- package/src/components/password-input/PasswordInput.vue +3 -3
- package/src/components/radio-group/RadioGroup.vue +3 -3
- package/src/components/scroll-area/scroll-restore.ts +0 -5
- package/src/components/search-input/SearchInput.vue +3 -3
- package/src/components/segmented-control/SegmentedControl.vue +3 -3
- package/src/components/select/Select.vue +68 -25
- package/src/components/select/SelectList.vue +3 -3
- package/src/components/select/composables/useClearTransition.ts +25 -0
- package/src/components/select/select.variants.ts +24 -0
- package/src/components/select/types.ts +10 -8
- package/src/components/textarea/Textarea.vue +2 -41
- package/src/components/textarea/composables/useTextareaSizing.ts +54 -0
- package/src/components/textarea/textarea.variants.ts +5 -4
- package/src/lib/caret.ts +0 -4
- package/src/lib/collapse.ts +21 -1
- package/src/lib/field-focus.ts +0 -4
- package/src/styles/interaction.css +4 -2
package/dist/index.js
CHANGED
|
@@ -2,7 +2,7 @@ import { clsx } from "clsx";
|
|
|
2
2
|
import { extendTailwindMerge } from "tailwind-merge";
|
|
3
3
|
import { createTV } from "tailwind-variants";
|
|
4
4
|
import { Fragment, Transition, computed, createBlock, createCommentVNode, createElementBlock, createElementVNode, createSlots, createTextVNode, createVNode, defineComponent, getCurrentInstance, guardReactiveProps, h, inject, isRef, markRaw, mergeModels, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onBeforeUnmount, onBeforeUpdate, onMounted, openBlock, provide, reactive, ref, renderList, renderSlot, resolveDynamicComponent, shallowRef, toDisplayString, toHandlers, toRef, toValue, unref, useAttrs, useId, useModel, useSlots, vModelDynamic, vModelSelect, vModelText, watch, watchEffect, withCtx, withDirectives, withKeys, withModifiers } from "vue";
|
|
5
|
-
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, PinInputInput, PinInputRoot, PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, Primitive, ProgressIndicator, ProgressRoot, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, RatingItem, RatingItemIndicator, RatingRoot, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectTrigger, Separator, SliderRoot, SliderThumb, SliderTrack, SplitterGroup, SplitterPanel, SplitterResizeHandle, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, TagsInputInput, TagsInputItem, TagsInputItemText, TagsInputRoot, TimeFieldInput, TimeFieldRoot, ToastClose, ToastDescription, ToastPortal, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Toggle, ToggleGroupItem, ToggleGroupRoot, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TreeItem, TreeRoot, VisuallyHidden, YearPickerCell, YearPickerCellTrigger, YearPickerGrid, YearPickerGridBody, YearPickerGridRow, YearPickerNext, YearPickerPrev, YearPickerRoot, injectTabsRootContext, injectTooltipProviderContext, useBodyScrollLock, useForwardPropsEmits } from "reka-ui";
|
|
5
|
+
import { AccordionContent, AccordionHeader, AccordionItem, AccordionRoot, AccordionTrigger, AlertDialogCancel, AlertDialogContent, AlertDialogDescription, AlertDialogOverlay, AlertDialogPortal, AlertDialogRoot, AlertDialogTitle, AlertDialogTrigger, AspectRatio, CalendarCell, CalendarCellTrigger, CalendarGrid, CalendarGridBody, CalendarGridHead, CalendarGridRow, CalendarHeadCell, CalendarNext, CalendarPrev, CalendarRoot, CheckboxGroupRoot, CheckboxRoot, CollapsibleContent, CollapsibleRoot, CollapsibleTrigger, ComboboxAnchor, ComboboxContent, ComboboxEmpty, ComboboxGroup, ComboboxInput, ComboboxItem, ComboboxItemIndicator, ComboboxLabel, ComboboxPortal, ComboboxRoot, ComboboxTrigger, ContextMenuCheckboxItem, ContextMenuContent, ContextMenuGroup, ContextMenuItem, ContextMenuItemIndicator, ContextMenuLabel, ContextMenuPortal, ContextMenuRadioGroup, ContextMenuRadioItem, ContextMenuRoot, ContextMenuSeparator, ContextMenuSub, ContextMenuSubContent, ContextMenuSubTrigger, ContextMenuTrigger, DateFieldInput, DateFieldRoot, DateRangeFieldInput, DateRangeFieldRoot, DialogClose, DialogContent, DialogDescription, DialogOverlay, DialogPortal, DialogRoot, DialogTitle, DialogTrigger, DropdownMenuCheckboxItem, DropdownMenuContent, DropdownMenuGroup, DropdownMenuItem, DropdownMenuItemIndicator, DropdownMenuLabel, DropdownMenuPortal, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuRoot, DropdownMenuSeparator, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCardContent, HoverCardPortal, HoverCardRoot, HoverCardTrigger, ListboxContent, ListboxFilter, ListboxGroup, ListboxGroupLabel, ListboxItem, ListboxItemIndicator, ListboxRoot, MenubarCheckboxItem, MenubarContent, MenubarGroup, MenubarItem, MenubarItemIndicator, MenubarLabel, MenubarMenu, MenubarPortal, MenubarRadioGroup, MenubarRadioItem, MenubarRoot, MenubarSeparator, MenubarSub, MenubarSubContent, MenubarSubTrigger, MenubarTrigger, MonthPickerCell, MonthPickerCellTrigger, MonthPickerGrid, MonthPickerGridBody, MonthPickerGridRow, MonthPickerNext, MonthPickerPrev, MonthPickerRoot, NumberFieldDecrement, NumberFieldIncrement, NumberFieldInput, NumberFieldRoot, PinInputInput, PinInputRoot, PopoverAnchor, PopoverContent, PopoverPortal, PopoverRoot, PopoverTrigger, Primitive, ProgressIndicator, ProgressRoot, RadioGroupItem, RadioGroupRoot, RangeCalendarCell, RangeCalendarCellTrigger, RangeCalendarGrid, RangeCalendarGridBody, RangeCalendarGridHead, RangeCalendarGridRow, RangeCalendarHeadCell, RangeCalendarNext, RangeCalendarPrev, RangeCalendarRoot, RatingItem, RatingItemIndicator, RatingRoot, SelectContent, SelectGroup, SelectItem, SelectItemIndicator, SelectItemText, SelectLabel, SelectPortal, SelectRoot, SelectTrigger, Separator, SliderRoot, SliderThumb, SliderTrack, SplitterGroup, SplitterPanel, SplitterResizeHandle, SwitchRoot, TabsContent, TabsList, TabsRoot, TabsTrigger, TagsInputInput, TagsInputItem, TagsInputItemText, TagsInputRoot, TimeFieldInput, TimeFieldRoot, ToastClose, ToastDescription, ToastPortal, ToastProvider, ToastRoot, ToastTitle, ToastViewport, Toggle, ToggleGroupItem, ToggleGroupRoot, TooltipArrow, TooltipContent, TooltipPortal, TooltipProvider, TooltipRoot, TooltipTrigger, TreeItem, TreeRoot, VisuallyHidden, YearPickerCell, YearPickerCellTrigger, YearPickerGrid, YearPickerGridBody, YearPickerGridRow, YearPickerNext, YearPickerPrev, YearPickerRoot, injectListboxItemContext, injectTabsRootContext, injectTooltipProviderContext, useBodyScrollLock, useDirection, useForwardPropsEmits } from "reka-ui";
|
|
6
6
|
import { ArrowLeft, ArrowRight, CalendarClock, CalendarDays, CalendarRange, Check, ChevronDown, ChevronLeft, ChevronRight, ChevronUp, CircleCheck, CircleX, Copy, Download, Eye, EyeOff, File, Inbox, Info, Lightbulb, Megaphone, Minus, PanelLeft, RotateCw, Search, Shrink, Star, TrendingDown, TrendingUp, TriangleAlert, Upload, User, X, ZoomIn, ZoomOut } from "@lucide/vue";
|
|
7
7
|
import { Motion, animate, useMotionValue, useTransform } from "motion-v";
|
|
8
8
|
import { createSharedComposable, useDocumentVisibility, useEventListener, useIntersectionObserver, useIntervalFn, useMediaQuery, useMutationObserver } from "@vueuse/core";
|
|
@@ -4296,6 +4296,11 @@ var Avatar_default = /* @__PURE__ */ defineComponent({
|
|
|
4296
4296
|
}
|
|
4297
4297
|
});
|
|
4298
4298
|
//#endregion
|
|
4299
|
+
//#region src/components/avatar/utils/children.ts
|
|
4300
|
+
function flattenChildren(nodes) {
|
|
4301
|
+
return (nodes ?? []).flatMap((node) => node.type === Fragment ? flattenChildren(node.children) : [node]);
|
|
4302
|
+
}
|
|
4303
|
+
//#endregion
|
|
4299
4304
|
//#region src/components/avatar/avatar-group.variants.ts
|
|
4300
4305
|
var avatarGroupItem = tv({
|
|
4301
4306
|
base: "ring-surface first:me-0 ring-2",
|
|
@@ -4319,10 +4324,7 @@ var AvatarGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
4319
4324
|
setup(__props) {
|
|
4320
4325
|
const props = __props;
|
|
4321
4326
|
const slots = useSlots();
|
|
4322
|
-
|
|
4323
|
-
return (nodes ?? []).flatMap((node) => node.type === Fragment ? flatten(node.children) : [node]);
|
|
4324
|
-
}
|
|
4325
|
-
const children = computed(() => flatten(slots.default?.()));
|
|
4327
|
+
const children = computed(() => flattenChildren(slots.default?.()));
|
|
4326
4328
|
const visible = computed(() => props.max && props.max > 0 ? children.value.slice(0, props.max) : children.value);
|
|
4327
4329
|
const hidden = computed(() => children.value.length - visible.value.length);
|
|
4328
4330
|
const item = computed(() => avatarGroupItem({ size: props.size }));
|
|
@@ -4636,6 +4638,16 @@ function useCollapseHooks(axis = "y") {
|
|
|
4636
4638
|
onBeforeUpdate(remember);
|
|
4637
4639
|
return collapseHooks(axis, () => parent);
|
|
4638
4640
|
}
|
|
4641
|
+
function useCollapseGap() {
|
|
4642
|
+
const content = shallowRef(null);
|
|
4643
|
+
function measure() {
|
|
4644
|
+
const el = content.value?.$el;
|
|
4645
|
+
if (el instanceof Element) writeCollapseGap(el, el.parentElement);
|
|
4646
|
+
}
|
|
4647
|
+
onMounted(measure);
|
|
4648
|
+
onBeforeUpdate(measure);
|
|
4649
|
+
return content;
|
|
4650
|
+
}
|
|
4639
4651
|
//#endregion
|
|
4640
4652
|
//#region src/components/alert/Alert.vue?vue&type=script&setup=true&lang.ts
|
|
4641
4653
|
var _hoisted_1$80 = {
|
|
@@ -5333,10 +5345,6 @@ function controlOf(node) {
|
|
|
5333
5345
|
const control = node.matches(CONTROL) ? node : node.querySelector(CONTROL);
|
|
5334
5346
|
return control instanceof HTMLInputElement || control instanceof HTMLTextAreaElement ? control : null;
|
|
5335
5347
|
}
|
|
5336
|
-
/**
|
|
5337
|
-
* 点击输入面里非交互的部分(附属格、前后缀、空白)时把焦点交给最近的输入区,返回被聚焦的输入区;点击落在交互元素上或者没有可聚焦的输入区时返回 null。
|
|
5338
|
-
* 点击所在的段自己含输入区时只认它、不动光标(段内的处理器已经定过位);否则先向后找,再向前找;落在点击位置之后的输入区把光标放到开头,之前的放到末尾。
|
|
5339
|
-
*/
|
|
5340
5348
|
function focusFieldFrom(root, target) {
|
|
5341
5349
|
if (target.closest(INTERACTIVE)) return null;
|
|
5342
5350
|
const segments = Array.from(root.children);
|
|
@@ -5361,11 +5369,11 @@ function focusFieldFrom(root, target) {
|
|
|
5361
5369
|
//#endregion
|
|
5362
5370
|
//#region src/components/input/input.variants.ts
|
|
5363
5371
|
var inputHost = tv({
|
|
5364
|
-
base: ["group/hn-field
|
|
5372
|
+
base: ["group/hn-field text-fg flex w-full min-w-0 cursor-text items-stretch overflow-hidden rounded-md border font-medium", "data-disabled:cursor-not-allowed data-disabled:opacity-50"],
|
|
5365
5373
|
variants: {
|
|
5366
5374
|
variant: {
|
|
5367
|
-
primary: "border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]",
|
|
5368
|
-
secondary: "border-transparent [--hn-field-bg:var(--hn-bg-inset)]"
|
|
5375
|
+
primary: "hn-field border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]",
|
|
5376
|
+
secondary: "hn-field border-transparent [--hn-field-bg:var(--hn-bg-inset)]"
|
|
5369
5377
|
},
|
|
5370
5378
|
size: {
|
|
5371
5379
|
sm: "h-[var(--hn-control-h-sm)] text-sm [--hn-input-h:var(--hn-control-h-sm)] [--hn-input-px:var(--hn-control-px-sm)] [--hn-input-icon:0.875rem]",
|
|
@@ -5378,6 +5386,10 @@ var inputHost = tv({
|
|
|
5378
5386
|
size: "md"
|
|
5379
5387
|
}
|
|
5380
5388
|
});
|
|
5389
|
+
var textInputHost = tv({
|
|
5390
|
+
extend: inputHost,
|
|
5391
|
+
variants: { variant: { bare: "rounded-none border-0 bg-transparent shadow-none outline-none" } }
|
|
5392
|
+
});
|
|
5381
5393
|
var inputControl = tv({
|
|
5382
5394
|
base: ["h-full min-w-0 flex-1 bg-transparent px-[var(--hn-input-px)] text-inherit outline-none [font:inherit]", "placeholder:text-faint placeholder:font-normal disabled:cursor-not-allowed"],
|
|
5383
5395
|
variants: {
|
|
@@ -5537,7 +5549,7 @@ var InputBase_default = /* @__PURE__ */ defineComponent({
|
|
|
5537
5549
|
"data-invalid": unref(invalid) ? "" : void 0,
|
|
5538
5550
|
"data-disabled": unref(disabled) ? "" : void 0,
|
|
5539
5551
|
"aria-busy": props.loading || void 0,
|
|
5540
|
-
class: normalizeClass(unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(
|
|
5552
|
+
class: normalizeClass(unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(textInputHost)({
|
|
5541
5553
|
variant: props.variant,
|
|
5542
5554
|
size: props.size
|
|
5543
5555
|
}), props.class)),
|
|
@@ -5696,10 +5708,6 @@ var MIRRORED = [
|
|
|
5696
5708
|
"border-bottom-width",
|
|
5697
5709
|
"border-left-width"
|
|
5698
5710
|
];
|
|
5699
|
-
/**
|
|
5700
|
-
* 量出 textarea 光标所在行的顶边(相对 textarea 自身的边框盒)。
|
|
5701
|
-
* 原生没有光标几何 API,只能用同排版的镜像块把光标前的文字排一遍。
|
|
5702
|
-
*/
|
|
5703
5711
|
function caretTop(node, at = node.selectionEnd) {
|
|
5704
5712
|
const style = getComputedStyle(node);
|
|
5705
5713
|
const mirror = node.ownerDocument.createElement("div");
|
|
@@ -5725,13 +5733,63 @@ function caretTop(node, at = node.selectionEnd) {
|
|
|
5725
5733
|
return top;
|
|
5726
5734
|
}
|
|
5727
5735
|
//#endregion
|
|
5736
|
+
//#region src/components/textarea/composables/useTextareaSizing.ts
|
|
5737
|
+
function useTextareaSizing(props, model) {
|
|
5738
|
+
const el = shallowRef(null);
|
|
5739
|
+
const area = shallowRef();
|
|
5740
|
+
const bounds = computed(() => {
|
|
5741
|
+
const options = props.autosize === true ? {} : props.autosize || null;
|
|
5742
|
+
return {
|
|
5743
|
+
min: options?.minRows ?? props.rows,
|
|
5744
|
+
max: options?.maxRows
|
|
5745
|
+
};
|
|
5746
|
+
});
|
|
5747
|
+
function fit() {
|
|
5748
|
+
const node = el.value;
|
|
5749
|
+
if (!node) return;
|
|
5750
|
+
node.style.height = "auto";
|
|
5751
|
+
node.style.height = `${node.scrollHeight}px`;
|
|
5752
|
+
if (document.activeElement === node) reveal(node);
|
|
5753
|
+
}
|
|
5754
|
+
function reveal(node) {
|
|
5755
|
+
const scroller = area.value?.viewport ?? node.closest("[data-overlayscrollbars-initialize]");
|
|
5756
|
+
if (!scroller) return;
|
|
5757
|
+
const box = scroller.getBoundingClientRect();
|
|
5758
|
+
const top = node.getBoundingClientRect().top + caretTop(node);
|
|
5759
|
+
const bottom = top + parseFloat(getComputedStyle(node).lineHeight);
|
|
5760
|
+
if (bottom > box.bottom) scroller.scrollTop += bottom - box.bottom;
|
|
5761
|
+
else if (top < box.top) scroller.scrollTop -= box.top - top;
|
|
5762
|
+
}
|
|
5763
|
+
function focus(event) {
|
|
5764
|
+
const node = el.value;
|
|
5765
|
+
if (!node || node.disabled || event.target === node) return;
|
|
5766
|
+
node.focus();
|
|
5767
|
+
node.setSelectionRange(node.value.length, node.value.length);
|
|
5768
|
+
}
|
|
5769
|
+
onMounted(fit);
|
|
5770
|
+
watch(() => [
|
|
5771
|
+
model.value,
|
|
5772
|
+
props.size,
|
|
5773
|
+
props.variant,
|
|
5774
|
+
bounds.value.min
|
|
5775
|
+
], () => void nextTick(fit));
|
|
5776
|
+
return {
|
|
5777
|
+
el,
|
|
5778
|
+
area,
|
|
5779
|
+
bounds,
|
|
5780
|
+
fit,
|
|
5781
|
+
focus
|
|
5782
|
+
};
|
|
5783
|
+
}
|
|
5784
|
+
//#endregion
|
|
5728
5785
|
//#region src/components/textarea/textarea.variants.ts
|
|
5729
5786
|
var textarea = tv({
|
|
5730
|
-
base: ["
|
|
5787
|
+
base: ["text-fg flex w-full min-w-0 cursor-text flex-col overflow-hidden rounded-md border font-medium", "data-disabled:cursor-not-allowed data-disabled:opacity-50"],
|
|
5731
5788
|
variants: {
|
|
5732
5789
|
variant: {
|
|
5733
|
-
|
|
5734
|
-
|
|
5790
|
+
bare: "rounded-none border-0 bg-transparent shadow-none outline-none [--hn-textarea-border-w:0px]",
|
|
5791
|
+
primary: "hn-field border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]",
|
|
5792
|
+
secondary: "hn-field border-transparent [--hn-field-bg:var(--hn-bg-inset)]"
|
|
5735
5793
|
},
|
|
5736
5794
|
size: {
|
|
5737
5795
|
sm: "text-sm [--hn-textarea-h:var(--hn-control-h-sm)] [--hn-textarea-px:var(--hn-control-px-sm)]",
|
|
@@ -5756,7 +5814,7 @@ var textarea = tv({
|
|
|
5756
5814
|
});
|
|
5757
5815
|
var textareaField = tv({ base: [
|
|
5758
5816
|
"block w-full resize-none overflow-hidden bg-transparent text-inherit outline-none [font:inherit]",
|
|
5759
|
-
"px-[var(--hn-textarea-px)] py-[calc((var(--hn-textarea-h)_-_1lh)/2_-
|
|
5817
|
+
"px-[var(--hn-textarea-px)] py-[calc((var(--hn-textarea-h)_-_1lh)/2_-_var(--hn-textarea-border-w,1px))]",
|
|
5760
5818
|
"placeholder:text-faint placeholder:font-normal disabled:cursor-not-allowed"
|
|
5761
5819
|
] });
|
|
5762
5820
|
//#endregion
|
|
@@ -5796,51 +5854,15 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
5796
5854
|
});
|
|
5797
5855
|
const props = __props;
|
|
5798
5856
|
const model = useModel(__props, "modelValue");
|
|
5799
|
-
const el =
|
|
5800
|
-
const area = shallowRef();
|
|
5801
|
-
const bounds = computed(() => {
|
|
5802
|
-
const options = props.autosize === true ? {} : props.autosize || null;
|
|
5803
|
-
return {
|
|
5804
|
-
min: options?.minRows ?? props.rows,
|
|
5805
|
-
max: options?.maxRows
|
|
5806
|
-
};
|
|
5807
|
-
});
|
|
5808
|
-
function fit() {
|
|
5809
|
-
const node = el.value;
|
|
5810
|
-
if (!node) return;
|
|
5811
|
-
node.style.height = "auto";
|
|
5812
|
-
node.style.height = `${node.scrollHeight}px`;
|
|
5813
|
-
if (document.activeElement === node) reveal(node);
|
|
5814
|
-
}
|
|
5815
|
-
function reveal(node) {
|
|
5816
|
-
const scroller = area.value?.viewport ?? node.closest("[data-overlayscrollbars-initialize]");
|
|
5817
|
-
if (!scroller) return;
|
|
5818
|
-
const box = scroller.getBoundingClientRect();
|
|
5819
|
-
const top = node.getBoundingClientRect().top + caretTop(node);
|
|
5820
|
-
const bottom = top + parseFloat(getComputedStyle(node).lineHeight);
|
|
5821
|
-
if (bottom > box.bottom) scroller.scrollTop += bottom - box.bottom;
|
|
5822
|
-
else if (top < box.top) scroller.scrollTop -= box.top - top;
|
|
5823
|
-
}
|
|
5824
|
-
function focus(event) {
|
|
5825
|
-
const node = el.value;
|
|
5826
|
-
if (!node || node.disabled || event.target === node) return;
|
|
5827
|
-
node.focus();
|
|
5828
|
-
node.setSelectionRange(node.value.length, node.value.length);
|
|
5829
|
-
}
|
|
5830
|
-
onMounted(fit);
|
|
5831
|
-
watch(() => [
|
|
5832
|
-
model.value,
|
|
5833
|
-
props.size,
|
|
5834
|
-
bounds.value.min
|
|
5835
|
-
], () => void nextTick(fit));
|
|
5857
|
+
const { el, area, bounds, fit, focus } = useTextareaSizing(props, model);
|
|
5836
5858
|
return (_ctx, _cache) => {
|
|
5837
5859
|
return openBlock(), createElementBlock("div", {
|
|
5838
5860
|
"data-hn-textarea": "",
|
|
5839
5861
|
"data-invalid": unref(invalid) ? "" : void 0,
|
|
5840
5862
|
"data-disabled": unref(disabled) ? "" : void 0,
|
|
5841
5863
|
style: normalizeStyle({
|
|
5842
|
-
"--hn-textarea-rows": bounds.
|
|
5843
|
-
"--hn-textarea-max-rows": bounds.
|
|
5864
|
+
"--hn-textarea-rows": unref(bounds).min,
|
|
5865
|
+
"--hn-textarea-max-rows": unref(bounds).max
|
|
5844
5866
|
}),
|
|
5845
5867
|
class: normalizeClass(unref(cn)(unref(textarea)({
|
|
5846
5868
|
variant: props.variant,
|
|
@@ -5848,7 +5870,7 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
5848
5870
|
autosize: Boolean(props.autosize),
|
|
5849
5871
|
resize: props.autosize ? "none" : props.resize
|
|
5850
5872
|
}), props.class)),
|
|
5851
|
-
onClick: focus
|
|
5873
|
+
onClick: _cache[2] || (_cache[2] = (...args) => unref(focus) && unref(focus)(...args))
|
|
5852
5874
|
}, [createVNode(ScrollArea_default, {
|
|
5853
5875
|
ref_key: "area",
|
|
5854
5876
|
ref: area,
|
|
@@ -5861,12 +5883,12 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
5861
5883
|
}, _ctx.$attrs, {
|
|
5862
5884
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => model.value = $event),
|
|
5863
5885
|
id: unref(fieldId),
|
|
5864
|
-
rows: bounds.
|
|
5886
|
+
rows: unref(bounds).min,
|
|
5865
5887
|
disabled: unref(disabled),
|
|
5866
5888
|
"aria-invalid": unref(invalid) || void 0,
|
|
5867
5889
|
"aria-describedby": unref(describedBy),
|
|
5868
5890
|
class: unref(textareaField)(),
|
|
5869
|
-
onInput: fit
|
|
5891
|
+
onInput: _cache[1] || (_cache[1] = (...args) => unref(fit) && unref(fit)(...args))
|
|
5870
5892
|
}), null, 16, _hoisted_2$35), [[vModelText, model.value]])]),
|
|
5871
5893
|
_: 1
|
|
5872
5894
|
}, 512)], 14, _hoisted_1$74);
|
|
@@ -5876,13 +5898,19 @@ var Textarea_default = /* @__PURE__ */ defineComponent({
|
|
|
5876
5898
|
//#endregion
|
|
5877
5899
|
//#region src/components/number-input/number-input.variants.ts
|
|
5878
5900
|
var numberInputStepper = tv({
|
|
5879
|
-
base: "
|
|
5880
|
-
variants: {
|
|
5881
|
-
|
|
5882
|
-
|
|
5883
|
-
|
|
5884
|
-
|
|
5885
|
-
|
|
5901
|
+
base: "flex shrink-0 flex-col",
|
|
5902
|
+
variants: {
|
|
5903
|
+
divided: { true: "border-line border-s" },
|
|
5904
|
+
size: {
|
|
5905
|
+
sm: "[&_svg]:size-3",
|
|
5906
|
+
md: "[&_svg]:size-3",
|
|
5907
|
+
lg: "[&_svg]:size-3.5"
|
|
5908
|
+
}
|
|
5909
|
+
},
|
|
5910
|
+
defaultVariants: {
|
|
5911
|
+
size: "md",
|
|
5912
|
+
divided: true
|
|
5913
|
+
}
|
|
5886
5914
|
});
|
|
5887
5915
|
var numberInputStep = tv({
|
|
5888
5916
|
base: [
|
|
@@ -5927,6 +5955,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
5927
5955
|
const emits = __emit;
|
|
5928
5956
|
const t = useUiLocale();
|
|
5929
5957
|
const group = injectInputGroup();
|
|
5958
|
+
const divided = computed(() => (group ? group.variant?.value : props.variant) !== "bare");
|
|
5930
5959
|
const size = computed(() => group ? group.size.value : props.size);
|
|
5931
5960
|
const { id: fieldId, invalid, disabled, describedBy } = useFieldControl({
|
|
5932
5961
|
invalid: () => props.invalid || !!group?.invalid.value,
|
|
@@ -5949,7 +5978,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
5949
5978
|
"data-hn-number-input": "",
|
|
5950
5979
|
"data-invalid": unref(invalid) ? "" : void 0,
|
|
5951
5980
|
"data-disabled": unref(disabled) ? "" : void 0,
|
|
5952
|
-
class: unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(
|
|
5981
|
+
class: unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(textInputHost)({
|
|
5953
5982
|
variant: props.variant,
|
|
5954
5983
|
size: props.size
|
|
5955
5984
|
}), props.class)
|
|
@@ -5966,7 +5995,10 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
5966
5995
|
"class"
|
|
5967
5996
|
]), props.controls ? (openBlock(), createElementBlock("div", {
|
|
5968
5997
|
key: 0,
|
|
5969
|
-
class: normalizeClass(unref(numberInputStepper)({
|
|
5998
|
+
class: normalizeClass(unref(numberInputStepper)({
|
|
5999
|
+
size: size.value,
|
|
6000
|
+
divided: divided.value
|
|
6001
|
+
}))
|
|
5970
6002
|
}, [createVNode(unref(NumberFieldIncrement), {
|
|
5971
6003
|
"aria-label": unref(t).numberInput.increase,
|
|
5972
6004
|
class: normalizeClass(unref(numberInputStep)())
|
|
@@ -5975,7 +6007,7 @@ var NumberInput_default = /* @__PURE__ */ defineComponent({
|
|
|
5975
6007
|
_: 1
|
|
5976
6008
|
}, 8, ["aria-label", "class"]), createVNode(unref(NumberFieldDecrement), {
|
|
5977
6009
|
"aria-label": unref(t).numberInput.decrease,
|
|
5978
|
-
class: normalizeClass(unref(numberInputStep)({ divided:
|
|
6010
|
+
class: normalizeClass(unref(numberInputStep)({ divided: divided.value }))
|
|
5979
6011
|
}, {
|
|
5980
6012
|
default: withCtx(() => [createVNode(unref(ChevronDown))]),
|
|
5981
6013
|
_: 1
|
|
@@ -6124,11 +6156,11 @@ var SearchInput_default = /* @__PURE__ */ defineComponent({
|
|
|
6124
6156
|
});
|
|
6125
6157
|
//#endregion
|
|
6126
6158
|
//#region src/components/input-group/input-group.variants.ts
|
|
6127
|
-
var inputGroup = tv({
|
|
6128
|
-
"[
|
|
6129
|
-
|
|
6130
|
-
|
|
6131
|
-
|
|
6159
|
+
var inputGroup = tv({
|
|
6160
|
+
base: ["[&>button]:h-auto [&>button]:rounded-none [&>button]:[--hn-press-scale:1]", "[&>button:focus-visible]:-outline-offset-2"],
|
|
6161
|
+
variants: { divided: { true: "[&>*+*]:border-s [&>*+*]:border-s-line" } },
|
|
6162
|
+
defaultVariants: { divided: true }
|
|
6163
|
+
});
|
|
6132
6164
|
var inputGroupAddon = tv({ base: "text-muted flex shrink-0 items-center gap-2 px-[var(--hn-input-px)] whitespace-nowrap [&>svg]:size-[var(--hn-input-icon)]" });
|
|
6133
6165
|
//#endregion
|
|
6134
6166
|
//#region src/components/input-group/InputGroup.vue?vue&type=script&setup=true&lang.ts
|
|
@@ -6149,6 +6181,7 @@ var InputGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
6149
6181
|
const props = __props;
|
|
6150
6182
|
const { disabled } = useFieldControl({ disabled: () => props.disabled });
|
|
6151
6183
|
provideInputGroup({
|
|
6184
|
+
variant: computed(() => props.variant),
|
|
6152
6185
|
size: computed(() => props.size),
|
|
6153
6186
|
disabled,
|
|
6154
6187
|
invalid: computed(() => !!props.invalid)
|
|
@@ -6158,10 +6191,10 @@ var InputGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
6158
6191
|
"data-hn-input-group": "",
|
|
6159
6192
|
"data-invalid": props.invalid ? "" : void 0,
|
|
6160
6193
|
"data-disabled": unref(disabled) ? "" : void 0,
|
|
6161
|
-
class: normalizeClass(unref(cn)(unref(
|
|
6194
|
+
class: normalizeClass(unref(cn)(unref(textInputHost)({
|
|
6162
6195
|
variant: props.variant,
|
|
6163
6196
|
size: props.size
|
|
6164
|
-
}), unref(inputGroup)(), props.class)),
|
|
6197
|
+
}), unref(inputGroup)({ divided: props.variant !== "bare" }), props.class)),
|
|
6165
6198
|
onClick: _cache[0] || (_cache[0] = ($event) => unref(focusFieldFrom)($event.currentTarget, $event.target))
|
|
6166
6199
|
}, [renderSlot(_ctx.$slots, "default")], 10, _hoisted_1$72);
|
|
6167
6200
|
};
|
|
@@ -6302,6 +6335,11 @@ var selectTrigger = tv({ base: [
|
|
|
6302
6335
|
"disabled:cursor-not-allowed disabled:opacity-50",
|
|
6303
6336
|
"[&_svg]:size-[var(--hn-input-icon)] [&_svg]:shrink-0"
|
|
6304
6337
|
] });
|
|
6338
|
+
var selectButton = tv({ base: [
|
|
6339
|
+
"group/hn-disclosure flex h-full min-w-0 flex-1 cursor-pointer items-center bg-transparent ps-[var(--hn-input-px)] pe-0 text-start text-inherit outline-none [font:inherit]",
|
|
6340
|
+
"data-placeholder:text-faint data-placeholder:font-normal disabled:cursor-not-allowed",
|
|
6341
|
+
"[&_svg]:size-[var(--hn-input-icon)] [&_svg]:shrink-0"
|
|
6342
|
+
] });
|
|
6305
6343
|
var selectContent = tv({ base: ["hn-anim-pop z-(--hn-z-overlay) flex w-[var(--reka-select-trigger-width)] min-w-40 flex-col overflow-hidden shadow-md outline-none", "[&[data-hn-fresh]_[data-highlighted]:not(:hover)]:[--hn-state-hover-opacity:0]"] });
|
|
6306
6344
|
var selectList = tv({ base: "max-h-[min(20rem,var(--reka-select-content-available-height))]" });
|
|
6307
6345
|
var selectItem = tv({ base: [
|
|
@@ -6313,10 +6351,16 @@ var selectItem = tv({ base: [
|
|
|
6313
6351
|
var selectLabel = tv({ base: "text-muted px-2.5 py-1.5 text-xs font-medium" });
|
|
6314
6352
|
var selectEmpty = tv({ base: "text-muted px-2.5 py-2 text-sm" });
|
|
6315
6353
|
var selectListBody = tv({ base: "flex flex-col p-1" });
|
|
6354
|
+
var selectHost = tv({ base: "relative cursor-pointer" });
|
|
6355
|
+
var selectValue = tv({
|
|
6356
|
+
base: "min-w-0 flex-1 truncate",
|
|
6357
|
+
variants: { clearing: { true: "pe-[var(--hn-input-h)]" } }
|
|
6358
|
+
});
|
|
6359
|
+
var selectClearSlot = tv({ base: [inputActionSlot(), "absolute inset-y-0 end-[var(--hn-input-h)]"] });
|
|
6316
6360
|
//#endregion
|
|
6317
6361
|
//#region src/components/select/types.ts
|
|
6318
6362
|
function isOptionGroup(item) {
|
|
6319
|
-
return "options" in item;
|
|
6363
|
+
return !("value" in item) && "options" in item;
|
|
6320
6364
|
}
|
|
6321
6365
|
function flattenOptions(items) {
|
|
6322
6366
|
return items.flatMap((item) => isOptionGroup(item) ? item.options : [item]);
|
|
@@ -6332,11 +6376,11 @@ var _hoisted_3$18 = {
|
|
|
6332
6376
|
var _hoisted_4$13 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
6333
6377
|
var _hoisted_5$9 = { class: "min-w-0 flex-1" };
|
|
6334
6378
|
var _hoisted_6$7 = { class: "block truncate" };
|
|
6335
|
-
var _hoisted_7$
|
|
6379
|
+
var _hoisted_7$5 = {
|
|
6336
6380
|
key: 0,
|
|
6337
6381
|
class: "text-muted block truncate text-xs"
|
|
6338
6382
|
};
|
|
6339
|
-
var _hoisted_8$
|
|
6383
|
+
var _hoisted_8$1 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
6340
6384
|
//#endregion
|
|
6341
6385
|
//#region src/components/select/SelectList.vue
|
|
6342
6386
|
var SelectList_default = /* @__PURE__ */ defineComponent({
|
|
@@ -6405,9 +6449,9 @@ var SelectList_default = /* @__PURE__ */ defineComponent({
|
|
|
6405
6449
|
class: normalizeClass(unref(selectItem)())
|
|
6406
6450
|
}, {
|
|
6407
6451
|
default: withCtx(() => [createVNode(unref(SelectItemText), { "as-child": "" }, {
|
|
6408
|
-
default: withCtx(() => [createElementVNode("span", _hoisted_5$9, [renderSlot(_ctx.$slots, "option", { option: item }, () => [createElementVNode("span", _hoisted_6$7, toDisplayString(item.label), 1), item.description ? (openBlock(), createElementBlock("span", _hoisted_7$
|
|
6452
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_5$9, [renderSlot(_ctx.$slots, "option", { option: item }, () => [createElementVNode("span", _hoisted_6$7, toDisplayString(item.label), 1), item.description ? (openBlock(), createElementBlock("span", _hoisted_7$5, toDisplayString(item.description), 1)) : createCommentVNode("", true)])])]),
|
|
6409
6453
|
_: 2
|
|
6410
|
-
}, 1024), createElementVNode("span", _hoisted_8$
|
|
6454
|
+
}, 1024), createElementVNode("span", _hoisted_8$1, [createVNode(unref(SelectItemIndicator), null, {
|
|
6411
6455
|
default: withCtx(() => [createVNode(unref(Check))]),
|
|
6412
6456
|
_: 1
|
|
6413
6457
|
})])]),
|
|
@@ -6434,8 +6478,38 @@ var SelectList_default = /* @__PURE__ */ defineComponent({
|
|
|
6434
6478
|
}
|
|
6435
6479
|
});
|
|
6436
6480
|
//#endregion
|
|
6481
|
+
//#region src/components/select/composables/useClearTransition.ts
|
|
6482
|
+
function useClearTransition(visible) {
|
|
6483
|
+
const leaving = ref(false);
|
|
6484
|
+
const reserved = computed(() => visible() || leaving.value);
|
|
6485
|
+
function beforeEnter(element) {
|
|
6486
|
+
leaving.value = false;
|
|
6487
|
+
element.removeAttribute("inert");
|
|
6488
|
+
}
|
|
6489
|
+
function beforeLeave(element) {
|
|
6490
|
+
leaving.value = true;
|
|
6491
|
+
element.setAttribute("inert", "");
|
|
6492
|
+
}
|
|
6493
|
+
function finishLeave() {
|
|
6494
|
+
leaving.value = false;
|
|
6495
|
+
}
|
|
6496
|
+
return {
|
|
6497
|
+
reserved,
|
|
6498
|
+
hooks: {
|
|
6499
|
+
beforeEnter,
|
|
6500
|
+
beforeLeave,
|
|
6501
|
+
afterLeave: finishLeave,
|
|
6502
|
+
leaveCancelled: finishLeave
|
|
6503
|
+
}
|
|
6504
|
+
};
|
|
6505
|
+
}
|
|
6506
|
+
//#endregion
|
|
6437
6507
|
//#region src/components/select/Select.vue?vue&type=script&setup=true&lang.ts
|
|
6438
|
-
var _hoisted_1$70 =
|
|
6508
|
+
var _hoisted_1$70 = [
|
|
6509
|
+
"dir",
|
|
6510
|
+
"data-invalid",
|
|
6511
|
+
"data-disabled"
|
|
6512
|
+
];
|
|
6439
6513
|
//#endregion
|
|
6440
6514
|
//#region src/components/select/Select.vue
|
|
6441
6515
|
var Select_default = /* @__PURE__ */ defineComponent({
|
|
@@ -6445,6 +6519,7 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
6445
6519
|
props: /*@__PURE__*/ mergeModels({
|
|
6446
6520
|
options: {},
|
|
6447
6521
|
placeholder: {},
|
|
6522
|
+
clearable: { type: Boolean },
|
|
6448
6523
|
name: {},
|
|
6449
6524
|
required: { type: Boolean },
|
|
6450
6525
|
autocomplete: {},
|
|
@@ -6462,19 +6537,31 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
6462
6537
|
},
|
|
6463
6538
|
"openModifiers": {}
|
|
6464
6539
|
}),
|
|
6465
|
-
emits: ["update:modelValue", "update:open"],
|
|
6466
|
-
setup(__props) {
|
|
6540
|
+
emits: /*@__PURE__*/ mergeModels(["clear"], ["update:modelValue", "update:open"]),
|
|
6541
|
+
setup(__props, { emit: __emit }) {
|
|
6467
6542
|
const props = __props;
|
|
6543
|
+
const emit = __emit;
|
|
6468
6544
|
const model = useModel(__props, "modelValue");
|
|
6469
6545
|
const open = useModel(__props, "open");
|
|
6470
6546
|
const t = useUiLocale();
|
|
6471
6547
|
const group = injectInputGroup();
|
|
6548
|
+
const direction = useDirection();
|
|
6472
6549
|
const keyboard = ref(false);
|
|
6550
|
+
const host = shallowRef(null);
|
|
6551
|
+
const trigger = shallowRef(null);
|
|
6473
6552
|
const { id: fieldId, invalid, disabled, describedBy } = useFieldControl({
|
|
6474
6553
|
invalid: () => props.invalid || !!group?.invalid.value,
|
|
6475
6554
|
disabled: () => props.disabled || !!group?.disabled.value
|
|
6476
6555
|
});
|
|
6477
6556
|
const selected = computed(() => flattenOptions(props.options).find((option) => option.value === model.value));
|
|
6557
|
+
const clearing = computed(() => !!props.clearable && model.value != null && model.value !== "" && !disabled.value);
|
|
6558
|
+
const { reserved: clearSpace, hooks: clearTransition } = useClearTransition(() => clearing.value);
|
|
6559
|
+
function clear() {
|
|
6560
|
+
if (disabled.value || model.value == null || model.value === "") return;
|
|
6561
|
+
model.value = null;
|
|
6562
|
+
emit("clear");
|
|
6563
|
+
trigger.value?.$el.focus();
|
|
6564
|
+
}
|
|
6478
6565
|
return (_ctx, _cache) => {
|
|
6479
6566
|
return openBlock(), createBlock(unref(SelectRoot), {
|
|
6480
6567
|
modelValue: model.value,
|
|
@@ -6486,30 +6573,57 @@ var Select_default = /* @__PURE__ */ defineComponent({
|
|
|
6486
6573
|
required: props.required,
|
|
6487
6574
|
autocomplete: props.autocomplete
|
|
6488
6575
|
}, {
|
|
6489
|
-
default: withCtx(() => [
|
|
6490
|
-
|
|
6491
|
-
|
|
6576
|
+
default: withCtx(() => [createElementVNode("div", {
|
|
6577
|
+
ref_key: "host",
|
|
6578
|
+
ref: host,
|
|
6579
|
+
dir: unref(direction),
|
|
6492
6580
|
"data-hn-select": "",
|
|
6493
|
-
onKeydown: _cache[0] || (_cache[0] = ($event) => keyboard.value = true),
|
|
6494
|
-
onPointerdown: _cache[1] || (_cache[1] = ($event) => keyboard.value = false),
|
|
6495
6581
|
"data-invalid": unref(invalid) ? "" : void 0,
|
|
6496
6582
|
"data-disabled": unref(disabled) ? "" : void 0,
|
|
6497
|
-
|
|
6498
|
-
class: unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(inputHost)({
|
|
6583
|
+
class: normalizeClass(unref(cn)(unref(group) ? unref(inputEmbedded)() : unref(inputHost)({
|
|
6499
6584
|
variant: props.variant,
|
|
6500
6585
|
size: props.size
|
|
6501
|
-
}), unref(
|
|
6586
|
+
}), unref(selectHost)(), props.class))
|
|
6587
|
+
}, [createVNode(unref(SelectTrigger), mergeProps({
|
|
6588
|
+
ref_key: "trigger",
|
|
6589
|
+
ref: trigger
|
|
6590
|
+
}, _ctx.$attrs, {
|
|
6591
|
+
reference: host.value ?? void 0,
|
|
6592
|
+
id: unref(fieldId),
|
|
6593
|
+
"aria-describedby": unref(describedBy),
|
|
6594
|
+
"aria-invalid": unref(invalid) || void 0,
|
|
6595
|
+
"data-hn-select-trigger": "",
|
|
6596
|
+
onKeydown: _cache[0] || (_cache[0] = ($event) => keyboard.value = true),
|
|
6597
|
+
onPointerdown: _cache[1] || (_cache[1] = ($event) => keyboard.value = false),
|
|
6598
|
+
class: unref(selectButton)()
|
|
6502
6599
|
}), {
|
|
6503
|
-
default: withCtx(() => [createElementVNode("span",
|
|
6600
|
+
default: withCtx(() => [createElementVNode("span", { class: normalizeClass(unref(selectValue)({ clearing: unref(clearSpace) })) }, [selected.value ? renderSlot(_ctx.$slots, "value", { option: selected.value }, () => [createTextVNode(toDisplayString(selected.value.label), 1)], void 0, 0) : (openBlock(), createElementBlock(Fragment, { key: 1 }, [createTextVNode(toDisplayString(props.placeholder ?? unref(t).select.placeholder), 1)], 64))], 2), createElementVNode("span", { class: normalizeClass(unref(inputAdornment)()) }, [createVNode(DisclosureIcon_default)], 2)]),
|
|
6504
6601
|
_: 3
|
|
6505
6602
|
}, 16, [
|
|
6603
|
+
"reference",
|
|
6506
6604
|
"id",
|
|
6507
6605
|
"aria-describedby",
|
|
6508
|
-
"data-invalid",
|
|
6509
|
-
"data-disabled",
|
|
6510
6606
|
"aria-invalid",
|
|
6511
6607
|
"class"
|
|
6512
|
-
]), createVNode(
|
|
6608
|
+
]), createVNode(Transition, mergeProps({
|
|
6609
|
+
"enter-active-class": "hn-transition-base",
|
|
6610
|
+
"enter-from-class": "scale-90 opacity-0",
|
|
6611
|
+
"leave-active-class": "hn-transition",
|
|
6612
|
+
"leave-to-class": "scale-90 opacity-0"
|
|
6613
|
+
}, toHandlers(unref(clearTransition))), {
|
|
6614
|
+
default: withCtx(() => [clearing.value ? (openBlock(), createElementBlock("span", {
|
|
6615
|
+
key: 0,
|
|
6616
|
+
class: normalizeClass(unref(selectClearSlot)())
|
|
6617
|
+
}, [createVNode(InputAction_default, {
|
|
6618
|
+
"data-hn-select-clear": "",
|
|
6619
|
+
label: unref(t).common.clear,
|
|
6620
|
+
onClick: clear
|
|
6621
|
+
}, {
|
|
6622
|
+
default: withCtx(() => [createVNode(unref(X))]),
|
|
6623
|
+
_: 1
|
|
6624
|
+
}, 8, ["label"])], 2)) : createCommentVNode("", true)]),
|
|
6625
|
+
_: 1
|
|
6626
|
+
}, 16)], 10, _hoisted_1$70), createVNode(SelectList_default, {
|
|
6513
6627
|
options: props.options,
|
|
6514
6628
|
keyboard: keyboard.value
|
|
6515
6629
|
}, {
|
|
@@ -6757,11 +6871,11 @@ var _hoisted_3$16 = {
|
|
|
6757
6871
|
var _hoisted_4$11 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
6758
6872
|
var _hoisted_5$8 = { class: "min-w-0 flex-1" };
|
|
6759
6873
|
var _hoisted_6$6 = { class: "block truncate" };
|
|
6760
|
-
var _hoisted_7$
|
|
6874
|
+
var _hoisted_7$4 = {
|
|
6761
6875
|
key: 0,
|
|
6762
6876
|
class: "text-muted block truncate text-xs"
|
|
6763
6877
|
};
|
|
6764
|
-
var _hoisted_8
|
|
6878
|
+
var _hoisted_8 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
6765
6879
|
//#endregion
|
|
6766
6880
|
//#region src/components/combobox/ComboboxList.vue
|
|
6767
6881
|
var ComboboxList_default = /* @__PURE__ */ defineComponent({
|
|
@@ -6826,7 +6940,7 @@ var ComboboxList_default = /* @__PURE__ */ defineComponent({
|
|
|
6826
6940
|
disabled: item.disabled,
|
|
6827
6941
|
class: normalizeClass(unref(selectItem)())
|
|
6828
6942
|
}, {
|
|
6829
|
-
default: withCtx(() => [createElementVNode("span", _hoisted_5$8, [renderSlot(_ctx.$slots, "option", { option: item }, () => [createElementVNode("span", _hoisted_6$6, toDisplayString(item.label), 1), item.description ? (openBlock(), createElementBlock("span", _hoisted_7$
|
|
6943
|
+
default: withCtx(() => [createElementVNode("span", _hoisted_5$8, [renderSlot(_ctx.$slots, "option", { option: item }, () => [createElementVNode("span", _hoisted_6$6, toDisplayString(item.label), 1), item.description ? (openBlock(), createElementBlock("span", _hoisted_7$4, toDisplayString(item.description), 1)) : createCommentVNode("", true)])]), createElementVNode("span", _hoisted_8, [createVNode(unref(ComboboxItemIndicator), null, {
|
|
6830
6944
|
default: withCtx(() => [createVNode(unref(Check))]),
|
|
6831
6945
|
_: 1
|
|
6832
6946
|
})])]),
|
|
@@ -7439,32 +7553,61 @@ var CommandPalette_default = /* @__PURE__ */ defineComponent({
|
|
|
7439
7553
|
}
|
|
7440
7554
|
});
|
|
7441
7555
|
//#endregion
|
|
7556
|
+
//#region src/components/listbox/ListboxOptionContent.vue?vue&type=script&setup=true&lang.ts
|
|
7557
|
+
var _hoisted_1$65 = { class: "min-w-0 flex-1" };
|
|
7558
|
+
var _hoisted_2$30 = { class: "block truncate" };
|
|
7559
|
+
var _hoisted_3$14 = {
|
|
7560
|
+
key: 0,
|
|
7561
|
+
class: "text-muted block truncate text-xs"
|
|
7562
|
+
};
|
|
7563
|
+
var _hoisted_4$9 = {
|
|
7564
|
+
key: 1,
|
|
7565
|
+
class: "flex size-4 shrink-0 items-center justify-center"
|
|
7566
|
+
};
|
|
7567
|
+
//#endregion
|
|
7568
|
+
//#region src/components/listbox/ListboxOptionContent.vue
|
|
7569
|
+
var ListboxOptionContent_default = /* @__PURE__ */ defineComponent({
|
|
7570
|
+
name: "HnListboxOptionContent",
|
|
7571
|
+
inheritAttrs: false,
|
|
7572
|
+
__name: "ListboxOptionContent",
|
|
7573
|
+
props: { option: {} },
|
|
7574
|
+
setup(__props) {
|
|
7575
|
+
const props = __props;
|
|
7576
|
+
const slots = useSlots();
|
|
7577
|
+
const { isSelected: selected } = injectListboxItemContext();
|
|
7578
|
+
return (_ctx, _cache) => {
|
|
7579
|
+
return openBlock(), createElementBlock(Fragment, null, [createElementVNode("span", _hoisted_1$65, [renderSlot(_ctx.$slots, "option", {
|
|
7580
|
+
option: props.option,
|
|
7581
|
+
selected: unref(selected)
|
|
7582
|
+
}, () => [createElementVNode("span", _hoisted_2$30, toDisplayString(props.option.label), 1), props.option.description ? (openBlock(), createElementBlock("span", _hoisted_3$14, toDisplayString(props.option.description), 1)) : createCommentVNode("", true)])]), slots.trailing ? renderSlot(_ctx.$slots, "trailing", {
|
|
7583
|
+
option: props.option,
|
|
7584
|
+
selected: unref(selected)
|
|
7585
|
+
}, void 0, void 0, 0) : (openBlock(), createElementBlock("span", _hoisted_4$9, [createVNode(unref(ListboxItemIndicator), null, {
|
|
7586
|
+
default: withCtx(() => [createVNode(unref(Check))]),
|
|
7587
|
+
_: 1
|
|
7588
|
+
})]))], 64);
|
|
7589
|
+
};
|
|
7590
|
+
}
|
|
7591
|
+
});
|
|
7592
|
+
//#endregion
|
|
7442
7593
|
//#region src/components/listbox/listbox.variants.ts
|
|
7443
7594
|
var listbox = tv({
|
|
7444
7595
|
base: ["flex w-full min-w-0 flex-col overflow-hidden rounded-md data-disabled:opacity-50", "[&:not(:focus-within)_[data-highlighted]:not(:hover)]:[--hn-state-hover-opacity:0]"],
|
|
7445
7596
|
variants: { variant: {
|
|
7446
7597
|
primary: "border-line bg-surface border shadow-sm",
|
|
7447
|
-
secondary: "bg-inset"
|
|
7598
|
+
secondary: "bg-inset",
|
|
7599
|
+
bare: "rounded-none border-0 bg-transparent shadow-none"
|
|
7448
7600
|
} },
|
|
7449
7601
|
defaultVariants: { variant: "primary" }
|
|
7450
7602
|
});
|
|
7451
|
-
var listboxContent = tv({
|
|
7452
|
-
|
|
7453
|
-
|
|
7454
|
-
|
|
7455
|
-
|
|
7456
|
-
|
|
7457
|
-
|
|
7458
|
-
|
|
7459
|
-
};
|
|
7460
|
-
var _hoisted_4$9 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
7461
|
-
var _hoisted_5$6 = { class: "min-w-0 flex-1" };
|
|
7462
|
-
var _hoisted_6$5 = { class: "block truncate" };
|
|
7463
|
-
var _hoisted_7$4 = {
|
|
7464
|
-
key: 0,
|
|
7465
|
-
class: "text-muted block truncate text-xs"
|
|
7466
|
-
};
|
|
7467
|
-
var _hoisted_8 = { class: "flex size-4 shrink-0 items-center justify-center" };
|
|
7603
|
+
var listboxContent = tv({
|
|
7604
|
+
base: "flex flex-col outline-none",
|
|
7605
|
+
variants: { padded: {
|
|
7606
|
+
true: "p-1",
|
|
7607
|
+
false: "p-0"
|
|
7608
|
+
} },
|
|
7609
|
+
defaultVariants: { padded: true }
|
|
7610
|
+
});
|
|
7468
7611
|
//#endregion
|
|
7469
7612
|
//#region src/components/listbox/Listbox.vue
|
|
7470
7613
|
var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
@@ -7475,6 +7618,10 @@ var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
|
7475
7618
|
options: {},
|
|
7476
7619
|
multiple: { type: Boolean },
|
|
7477
7620
|
maxHeight: { default: "20rem" },
|
|
7621
|
+
padded: {
|
|
7622
|
+
type: Boolean,
|
|
7623
|
+
default: true
|
|
7624
|
+
},
|
|
7478
7625
|
variant: {},
|
|
7479
7626
|
disabled: { type: Boolean },
|
|
7480
7627
|
class: {}
|
|
@@ -7486,6 +7633,7 @@ var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
|
7486
7633
|
setup(__props) {
|
|
7487
7634
|
const props = __props;
|
|
7488
7635
|
const model = useModel(__props, "modelValue");
|
|
7636
|
+
const slots = useSlots();
|
|
7489
7637
|
const t = useUiLocale();
|
|
7490
7638
|
const { labelledBy, invalid, disabled, describedBy } = useFieldControl({ disabled: () => props.disabled });
|
|
7491
7639
|
return (_ctx, _cache) => {
|
|
@@ -7503,7 +7651,7 @@ var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
|
7503
7651
|
class: normalizeClass(unref(cn)(unref(listbox)({ variant: props.variant }), props.class))
|
|
7504
7652
|
}, {
|
|
7505
7653
|
default: withCtx(() => [createVNode(ScrollArea_default, { style: normalizeStyle({ maxHeight: props.maxHeight }) }, {
|
|
7506
|
-
default: withCtx(() => [createVNode(unref(ListboxContent), mergeProps(_ctx.$attrs, { class: unref(listboxContent)() }), {
|
|
7654
|
+
default: withCtx(() => [createVNode(unref(ListboxContent), mergeProps(_ctx.$attrs, { class: unref(listboxContent)({ padded: props.padded }) }), {
|
|
7507
7655
|
default: withCtx(() => [(openBlock(true), createElementBlock(Fragment, null, renderList(props.options, (item) => {
|
|
7508
7656
|
return openBlock(), createElementBlock(Fragment, { key: unref(isOptionGroup)(item) ? item.label : item.value }, [unref(isOptionGroup)(item) ? (openBlock(), createBlock(unref(ListboxGroup), { key: 0 }, {
|
|
7509
7657
|
default: withCtx(() => [createVNode(unref(ListboxGroupLabel), { class: normalizeClass(unref(selectLabel)()) }, {
|
|
@@ -7516,10 +7664,15 @@ var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
|
7516
7664
|
disabled: option.disabled,
|
|
7517
7665
|
class: normalizeClass(unref(selectItem)())
|
|
7518
7666
|
}, {
|
|
7519
|
-
default: withCtx(() => [
|
|
7520
|
-
|
|
7521
|
-
|
|
7522
|
-
|
|
7667
|
+
default: withCtx(() => [createVNode(ListboxOptionContent_default, { option }, createSlots({ _: 2 }, [slots.option ? {
|
|
7668
|
+
name: "option",
|
|
7669
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, slotProps))]),
|
|
7670
|
+
key: "0"
|
|
7671
|
+
} : void 0, slots.trailing ? {
|
|
7672
|
+
name: "trailing",
|
|
7673
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "trailing", mergeProps({ ref_for: true }, slotProps))]),
|
|
7674
|
+
key: "1"
|
|
7675
|
+
} : void 0]), 1032, ["option"])]),
|
|
7523
7676
|
_: 2
|
|
7524
7677
|
}, 1032, [
|
|
7525
7678
|
"value",
|
|
@@ -7534,10 +7687,15 @@ var Listbox_default = /* @__PURE__ */ defineComponent({
|
|
|
7534
7687
|
disabled: item.disabled,
|
|
7535
7688
|
class: normalizeClass(unref(selectItem)())
|
|
7536
7689
|
}, {
|
|
7537
|
-
default: withCtx(() => [
|
|
7538
|
-
|
|
7539
|
-
|
|
7540
|
-
|
|
7690
|
+
default: withCtx(() => [createVNode(ListboxOptionContent_default, { option: item }, createSlots({ _: 2 }, [slots.option ? {
|
|
7691
|
+
name: "option",
|
|
7692
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "option", mergeProps({ ref_for: true }, slotProps))]),
|
|
7693
|
+
key: "0"
|
|
7694
|
+
} : void 0, slots.trailing ? {
|
|
7695
|
+
name: "trailing",
|
|
7696
|
+
fn: withCtx((slotProps) => [renderSlot(_ctx.$slots, "trailing", mergeProps({ ref_for: true }, slotProps))]),
|
|
7697
|
+
key: "1"
|
|
7698
|
+
} : void 0]), 1032, ["option"])]),
|
|
7541
7699
|
_: 2
|
|
7542
7700
|
}, 1032, [
|
|
7543
7701
|
"value",
|
|
@@ -7606,8 +7764,8 @@ var _hoisted_3$13 = {
|
|
|
7606
7764
|
class: "size-5 shrink-0"
|
|
7607
7765
|
};
|
|
7608
7766
|
var _hoisted_4$8 = { class: "min-w-0 flex-1" };
|
|
7609
|
-
var _hoisted_5$
|
|
7610
|
-
var _hoisted_6$
|
|
7767
|
+
var _hoisted_5$6 = { class: "block truncate" };
|
|
7768
|
+
var _hoisted_6$5 = {
|
|
7611
7769
|
key: 0,
|
|
7612
7770
|
class: "text-muted block truncate text-xs"
|
|
7613
7771
|
};
|
|
@@ -7739,7 +7897,7 @@ var TreeSelect_default = /* @__PURE__ */ defineComponent({
|
|
|
7739
7897
|
direction: "end",
|
|
7740
7898
|
open: isExpanded
|
|
7741
7899
|
}, null, 8, ["open"])], 10, _hoisted_2$29)) : (openBlock(), createElementBlock("span", _hoisted_3$13)),
|
|
7742
|
-
createElementVNode("span", _hoisted_4$8, [renderSlot(_ctx.$slots, "node", { node: item.value }, () => [createElementVNode("span", _hoisted_5$
|
|
7900
|
+
createElementVNode("span", _hoisted_4$8, [renderSlot(_ctx.$slots, "node", { node: item.value }, () => [createElementVNode("span", _hoisted_5$6, toDisplayString(item.value.label), 1), item.value.description ? (openBlock(), createElementBlock("span", _hoisted_6$5, toDisplayString(item.value.description), 1)) : createCommentVNode("", true)])]),
|
|
7743
7901
|
createElementVNode("span", _hoisted_7$3, [isSelected ? (openBlock(), createBlock(unref(Check), { key: 0 })) : createCommentVNode("", true)])
|
|
7744
7902
|
]),
|
|
7745
7903
|
_: 2
|
|
@@ -9056,6 +9214,54 @@ var TagsInput_default = /* @__PURE__ */ defineComponent({
|
|
|
9056
9214
|
}
|
|
9057
9215
|
});
|
|
9058
9216
|
//#endregion
|
|
9217
|
+
//#region src/components/multi-combobox/composables/useMultiCombobox.ts
|
|
9218
|
+
function useMultiCombobox(options) {
|
|
9219
|
+
const { model, open } = options;
|
|
9220
|
+
const keyboard = ref(false);
|
|
9221
|
+
const input = shallowRef(null);
|
|
9222
|
+
const labels = reactive(/* @__PURE__ */ new Map());
|
|
9223
|
+
watch(options.options, (options) => {
|
|
9224
|
+
for (const option of flattenOptions(options)) labels.set(option.value, option.label);
|
|
9225
|
+
}, {
|
|
9226
|
+
immediate: true,
|
|
9227
|
+
deep: true
|
|
9228
|
+
});
|
|
9229
|
+
const selected = computed(() => model.value.map((value) => ({
|
|
9230
|
+
value,
|
|
9231
|
+
label: labels.get(value) ?? String(value)
|
|
9232
|
+
})));
|
|
9233
|
+
watch(open, (value) => {
|
|
9234
|
+
if (!value) keyboard.value = false;
|
|
9235
|
+
});
|
|
9236
|
+
function remove(value) {
|
|
9237
|
+
if (options.disabled()) return;
|
|
9238
|
+
model.value = model.value.filter((item) => item !== value);
|
|
9239
|
+
}
|
|
9240
|
+
function clear() {
|
|
9241
|
+
if (!model.value.length) return;
|
|
9242
|
+
model.value = [];
|
|
9243
|
+
options.onClear();
|
|
9244
|
+
input.value?.$el.focus();
|
|
9245
|
+
}
|
|
9246
|
+
function onHostClick(event) {
|
|
9247
|
+
if (focusFieldFrom(event.currentTarget, event.target) && !open.value) open.value = true;
|
|
9248
|
+
}
|
|
9249
|
+
function onInputKeydown(event) {
|
|
9250
|
+
keyboard.value = true;
|
|
9251
|
+
if (event.key !== "Backspace" || event.target.value !== "" || !model.value.length) return;
|
|
9252
|
+
model.value = model.value.slice(0, -1);
|
|
9253
|
+
}
|
|
9254
|
+
return {
|
|
9255
|
+
selected,
|
|
9256
|
+
keyboard,
|
|
9257
|
+
input,
|
|
9258
|
+
remove,
|
|
9259
|
+
clear,
|
|
9260
|
+
onHostClick,
|
|
9261
|
+
onInputKeydown
|
|
9262
|
+
};
|
|
9263
|
+
}
|
|
9264
|
+
//#endregion
|
|
9059
9265
|
//#region src/components/multi-combobox/multi-combobox.variants.ts
|
|
9060
9266
|
var multiComboboxHost = tv({
|
|
9061
9267
|
base: "",
|
|
@@ -9114,52 +9320,25 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9114
9320
|
const search = useModel(__props, "search");
|
|
9115
9321
|
const open = useModel(__props, "open");
|
|
9116
9322
|
const t = useUiLocale();
|
|
9117
|
-
const keyboard = ref(false);
|
|
9118
|
-
const input = shallowRef(null);
|
|
9119
9323
|
const { id: fieldId, invalid, disabled, describedBy } = useFieldControl({
|
|
9120
9324
|
invalid: () => props.invalid,
|
|
9121
9325
|
disabled: () => props.disabled
|
|
9122
9326
|
});
|
|
9123
|
-
const
|
|
9124
|
-
|
|
9125
|
-
|
|
9126
|
-
|
|
9127
|
-
|
|
9128
|
-
|
|
9327
|
+
const { selected, keyboard, input, remove, clear, onHostClick, onInputKeydown } = useMultiCombobox({
|
|
9328
|
+
options: () => props.options,
|
|
9329
|
+
model,
|
|
9330
|
+
open,
|
|
9331
|
+
disabled: () => disabled.value,
|
|
9332
|
+
onClear: () => emit("clear")
|
|
9129
9333
|
});
|
|
9130
|
-
const selected = computed(() => model.value.map((value) => ({
|
|
9131
|
-
value,
|
|
9132
|
-
label: labels.get(value) ?? String(value)
|
|
9133
|
-
})));
|
|
9134
9334
|
const chipSize = computed(() => props.size === "sm" ? "sm" : "md");
|
|
9135
9335
|
const clearing = computed(() => props.clearable && selected.value.length > 0 && !disabled.value);
|
|
9136
|
-
watch(open, (value) => {
|
|
9137
|
-
if (!value) keyboard.value = false;
|
|
9138
|
-
});
|
|
9139
|
-
function remove(value) {
|
|
9140
|
-
if (disabled.value) return;
|
|
9141
|
-
model.value = model.value.filter((item) => item !== value);
|
|
9142
|
-
}
|
|
9143
|
-
function clear() {
|
|
9144
|
-
if (!model.value.length) return;
|
|
9145
|
-
model.value = [];
|
|
9146
|
-
emit("clear");
|
|
9147
|
-
input.value?.$el.focus();
|
|
9148
|
-
}
|
|
9149
|
-
function onHostClick(event) {
|
|
9150
|
-
if (focusFieldFrom(event.currentTarget, event.target) && !open.value) open.value = true;
|
|
9151
|
-
}
|
|
9152
|
-
function onInputKeydown(event) {
|
|
9153
|
-
keyboard.value = true;
|
|
9154
|
-
if (event.key !== "Backspace" || event.target.value !== "" || !model.value.length) return;
|
|
9155
|
-
model.value = model.value.slice(0, -1);
|
|
9156
|
-
}
|
|
9157
9336
|
return (_ctx, _cache) => {
|
|
9158
9337
|
return openBlock(), createBlock(unref(ComboboxRoot), {
|
|
9159
9338
|
modelValue: model.value,
|
|
9160
|
-
"onUpdate:modelValue": _cache[
|
|
9339
|
+
"onUpdate:modelValue": _cache[3] || (_cache[3] = ($event) => model.value = $event),
|
|
9161
9340
|
open: open.value,
|
|
9162
|
-
"onUpdate:open": _cache[
|
|
9341
|
+
"onUpdate:open": _cache[4] || (_cache[4] = ($event) => open.value = $event),
|
|
9163
9342
|
disabled: unref(disabled),
|
|
9164
9343
|
"ignore-filter": props.ignoreFilter,
|
|
9165
9344
|
name: props.name,
|
|
@@ -9179,15 +9358,15 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9179
9358
|
size: props.size,
|
|
9180
9359
|
trailing: true
|
|
9181
9360
|
}), unref(multiComboboxHost)({ clearing: clearing.value }), props.class)),
|
|
9182
|
-
onClick: onHostClick
|
|
9183
|
-
}, [createElementVNode("div", { class: normalizeClass(unref(tagsInputList)()) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(selected
|
|
9361
|
+
onClick: _cache[2] || (_cache[2] = (...args) => unref(onHostClick) && unref(onHostClick)(...args))
|
|
9362
|
+
}, [createElementVNode("div", { class: normalizeClass(unref(tagsInputList)()) }, [(openBlock(true), createElementBlock(Fragment, null, renderList(unref(selected), (option) => {
|
|
9184
9363
|
return openBlock(), createBlock(Chip_default, {
|
|
9185
9364
|
key: option.value,
|
|
9186
9365
|
size: chipSize.value,
|
|
9187
9366
|
removable: "",
|
|
9188
9367
|
disabled: unref(disabled),
|
|
9189
9368
|
class: normalizeClass(unref(tagsInputChip)()),
|
|
9190
|
-
onRemove: ($event) => remove(option.value)
|
|
9369
|
+
onRemove: ($event) => unref(remove)(option.value)
|
|
9191
9370
|
}, {
|
|
9192
9371
|
default: withCtx(() => [createElementVNode("span", _hoisted_2$27, toDisplayString(option.label), 1)]),
|
|
9193
9372
|
_: 2
|
|
@@ -9203,13 +9382,13 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9203
9382
|
}, _ctx.$attrs, {
|
|
9204
9383
|
modelValue: search.value,
|
|
9205
9384
|
"onUpdate:modelValue": _cache[0] || (_cache[0] = ($event) => search.value = $event),
|
|
9206
|
-
placeholder: selected.
|
|
9385
|
+
placeholder: unref(selected).length ? void 0 : props.placeholder ?? unref(t).combobox.placeholder,
|
|
9207
9386
|
disabled: unref(disabled),
|
|
9208
9387
|
id: unref(fieldId),
|
|
9209
9388
|
"aria-invalid": unref(invalid) || void 0,
|
|
9210
9389
|
"aria-describedby": unref(describedBy),
|
|
9211
9390
|
class: unref(tagsInputControl)({ size: props.size }),
|
|
9212
|
-
onKeydown: onInputKeydown
|
|
9391
|
+
onKeydown: unref(onInputKeydown)
|
|
9213
9392
|
}), null, 16, [
|
|
9214
9393
|
"modelValue",
|
|
9215
9394
|
"placeholder",
|
|
@@ -9217,7 +9396,8 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9217
9396
|
"id",
|
|
9218
9397
|
"aria-invalid",
|
|
9219
9398
|
"aria-describedby",
|
|
9220
|
-
"class"
|
|
9399
|
+
"class",
|
|
9400
|
+
"onKeydown"
|
|
9221
9401
|
])], 2), createElementVNode("span", { class: normalizeClass(unref(multiComboboxEnd)()) }, [createVNode(Transition, {
|
|
9222
9402
|
"enter-active-class": "hn-transition-base",
|
|
9223
9403
|
"enter-from-class": "scale-90 opacity-0",
|
|
@@ -9230,11 +9410,11 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9230
9410
|
class: normalizeClass(unref(inputActionSlot)())
|
|
9231
9411
|
}, [createVNode(InputAction_default, {
|
|
9232
9412
|
label: unref(t).common.clear,
|
|
9233
|
-
onClick: clear
|
|
9413
|
+
onClick: unref(clear)
|
|
9234
9414
|
}, {
|
|
9235
9415
|
default: withCtx(() => [createVNode(unref(X))]),
|
|
9236
9416
|
_: 1
|
|
9237
|
-
}, 8, ["label"])], 2)) : createCommentVNode("", true)]),
|
|
9417
|
+
}, 8, ["label", "onClick"])], 2)) : createCommentVNode("", true)]),
|
|
9238
9418
|
_: 1
|
|
9239
9419
|
}), createVNode(unref(ComboboxTrigger), {
|
|
9240
9420
|
"aria-label": unref(t).combobox.toggle,
|
|
@@ -9259,7 +9439,7 @@ var MultiCombobox_default = /* @__PURE__ */ defineComponent({
|
|
|
9259
9439
|
_: 1
|
|
9260
9440
|
}), createVNode(ComboboxList_default, {
|
|
9261
9441
|
options: props.options,
|
|
9262
|
-
keyboard: keyboard
|
|
9442
|
+
keyboard: unref(keyboard)
|
|
9263
9443
|
}, {
|
|
9264
9444
|
option: withCtx((slotProps) => [renderSlot(_ctx.$slots, "option", normalizeProps(guardReactiveProps(slotProps)))]),
|
|
9265
9445
|
_: 3
|
|
@@ -11839,31 +12019,38 @@ var FileUpload_default = /* @__PURE__ */ defineComponent({
|
|
|
11839
12019
|
//#endregion
|
|
11840
12020
|
//#region src/components/dialog/dialog.variants.ts
|
|
11841
12021
|
var dialogWrapper = tv({
|
|
11842
|
-
base: "",
|
|
12022
|
+
base: "pointer-events-none fixed inset-0 z-(--hn-z-overlay) grid",
|
|
11843
12023
|
variants: { placement: {
|
|
11844
12024
|
center: "place-items-center p-4",
|
|
12025
|
+
top: "items-start justify-items-center p-4",
|
|
11845
12026
|
bottom: "items-end justify-items-center p-4",
|
|
11846
12027
|
auto: "place-items-center p-4 max-sm:items-end max-sm:justify-items-stretch"
|
|
11847
12028
|
} },
|
|
11848
12029
|
defaultVariants: { placement: "auto" }
|
|
11849
12030
|
});
|
|
11850
12031
|
var dialogCard = tv({
|
|
11851
|
-
base: "",
|
|
12032
|
+
base: "pointer-events-auto flex w-full flex-col shadow-lg outline-none",
|
|
11852
12033
|
variants: {
|
|
12034
|
+
padded: { true: "gap-4 py-(--hn-panel-p)" },
|
|
12035
|
+
fitViewport: { true: "max-h-[calc(100dvh-2rem)]" },
|
|
11853
12036
|
placement: {
|
|
11854
12037
|
center: "hn-anim-modal",
|
|
12038
|
+
top: "hn-anim-sheet-top",
|
|
11855
12039
|
bottom: "hn-anim-sheet-bottom",
|
|
11856
12040
|
auto: "hn-anim-modal max-sm:hn-anim-sheet-bottom max-sm:max-w-none"
|
|
11857
12041
|
},
|
|
11858
12042
|
size: {
|
|
11859
12043
|
sm: "max-w-sm",
|
|
11860
12044
|
md: "max-w-md",
|
|
11861
|
-
lg: "max-w-xl"
|
|
12045
|
+
lg: "max-w-xl",
|
|
12046
|
+
xl: "max-w-2xl",
|
|
12047
|
+
"2xl": "max-w-4xl"
|
|
11862
12048
|
}
|
|
11863
12049
|
},
|
|
11864
12050
|
defaultVariants: {
|
|
11865
12051
|
placement: "auto",
|
|
11866
|
-
size: "md"
|
|
12052
|
+
size: "md",
|
|
12053
|
+
padded: true
|
|
11867
12054
|
}
|
|
11868
12055
|
});
|
|
11869
12056
|
//#endregion
|
|
@@ -12662,8 +12849,8 @@ var _hoisted_1$40 = ["data-dragging"];
|
|
|
12662
12849
|
var _hoisted_2$21 = ["data-disabled"];
|
|
12663
12850
|
var _hoisted_3$9 = { class: "flex items-start justify-between gap-4 px-(--hn-panel-p)" };
|
|
12664
12851
|
var _hoisted_4$7 = { class: "flex min-w-0 flex-col gap-1.5" };
|
|
12665
|
-
var _hoisted_5$
|
|
12666
|
-
var _hoisted_6$
|
|
12852
|
+
var _hoisted_5$5 = { class: "px-(--hn-panel-p) py-1" };
|
|
12853
|
+
var _hoisted_6$4 = {
|
|
12667
12854
|
key: 1,
|
|
12668
12855
|
class: "flex shrink-0 justify-end gap-(--hn-inline-gap) px-(--hn-panel-p)"
|
|
12669
12856
|
};
|
|
@@ -12778,10 +12965,10 @@ var Sheet_default = /* @__PURE__ */ defineComponent({
|
|
|
12778
12965
|
key: 0,
|
|
12779
12966
|
class: "min-h-0 grow"
|
|
12780
12967
|
}, {
|
|
12781
|
-
default: withCtx(() => [createElementVNode("div", _hoisted_5$
|
|
12968
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_5$5, [renderSlot(_ctx.$slots, "content", { close })])]),
|
|
12782
12969
|
_: 3
|
|
12783
12970
|
})) : createCommentVNode("", true),
|
|
12784
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$
|
|
12971
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6$4, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("", true)
|
|
12785
12972
|
]),
|
|
12786
12973
|
_: 3
|
|
12787
12974
|
}, 8, [
|
|
@@ -14539,12 +14726,12 @@ var _hoisted_1$26 = [
|
|
|
14539
14726
|
var _hoisted_2$15 = ["id", "for"];
|
|
14540
14727
|
var _hoisted_3$7 = ["id"];
|
|
14541
14728
|
var _hoisted_4$5 = ["id"];
|
|
14542
|
-
var _hoisted_5$
|
|
14729
|
+
var _hoisted_5$4 = {
|
|
14543
14730
|
key: 0,
|
|
14544
14731
|
"data-hn-form-field-message": "",
|
|
14545
14732
|
class: "hn-collapse [--hn-collapse-out:var(--hn-duration-fast)]"
|
|
14546
14733
|
};
|
|
14547
|
-
var _hoisted_6$
|
|
14734
|
+
var _hoisted_6$3 = { class: "hn-collapse-body" };
|
|
14548
14735
|
var _hoisted_7$2 = ["id"];
|
|
14549
14736
|
//#endregion
|
|
14550
14737
|
//#region src/components/form-field/FormField.vue
|
|
@@ -14662,7 +14849,7 @@ var FormField_default = /* @__PURE__ */ defineComponent({
|
|
|
14662
14849
|
"leave-from-class": "hn-collapse-open",
|
|
14663
14850
|
"leave-to-class": "hn-collapse-closed"
|
|
14664
14851
|
}, toHandlers(unref(hooks))), {
|
|
14665
|
-
default: withCtx(() => [message.value ? (openBlock(), createElementBlock("div", _hoisted_5$
|
|
14852
|
+
default: withCtx(() => [message.value ? (openBlock(), createElementBlock("div", _hoisted_5$4, [createElementVNode("div", _hoisted_6$3, [createElementVNode("p", {
|
|
14666
14853
|
id: unref(messageId),
|
|
14667
14854
|
class: normalizeClass(unref(formFieldMessage)()),
|
|
14668
14855
|
"aria-live": "polite"
|
|
@@ -15185,8 +15372,8 @@ var _hoisted_1$23 = ["data-lang"];
|
|
|
15185
15372
|
var _hoisted_2$13 = { class: "m-0" };
|
|
15186
15373
|
var _hoisted_3$6 = ["innerHTML"];
|
|
15187
15374
|
var _hoisted_4$4 = { key: 1 };
|
|
15188
|
-
var _hoisted_5$
|
|
15189
|
-
var _hoisted_6$
|
|
15375
|
+
var _hoisted_5$3 = { key: 2 };
|
|
15376
|
+
var _hoisted_6$2 = { class: "absolute top-2 end-2 flex items-center gap-2" };
|
|
15190
15377
|
var _hoisted_7$1 = {
|
|
15191
15378
|
key: 0,
|
|
15192
15379
|
class: "text-faint font-mono text-xs select-none"
|
|
@@ -15251,9 +15438,9 @@ var CodeBlock_default = /* @__PURE__ */ defineComponent({
|
|
|
15251
15438
|
style: normalizeStyle(tk.htmlStyle)
|
|
15252
15439
|
}, toDisplayString(tk.content), 5);
|
|
15253
15440
|
}), 128))], 64);
|
|
15254
|
-
}), 128))])) : (openBlock(), createElementBlock("code", _hoisted_5$
|
|
15441
|
+
}), 128))])) : (openBlock(), createElementBlock("code", _hoisted_5$3, toDisplayString(__props.code), 1))])]),
|
|
15255
15442
|
_: 1
|
|
15256
|
-
}, 8, ["label"]), createElementVNode("div", _hoisted_6$
|
|
15443
|
+
}, 8, ["label"]), createElementVNode("div", _hoisted_6$2, [tag.value ? (openBlock(), createElementBlock("span", _hoisted_7$1, toDisplayString(tag.value), 1)) : createCommentVNode("", true), __props.copyable ? (openBlock(), createBlock(CopyButton_default, {
|
|
15257
15444
|
key: 1,
|
|
15258
15445
|
text: props.code,
|
|
15259
15446
|
label: unref(t).codeblock.copy
|
|
@@ -16055,13 +16242,7 @@ var CollapsibleContent_default = /* @__PURE__ */ defineComponent({
|
|
|
16055
16242
|
props: { class: {} },
|
|
16056
16243
|
setup(__props) {
|
|
16057
16244
|
const props = __props;
|
|
16058
|
-
const content =
|
|
16059
|
-
function measure() {
|
|
16060
|
-
const el = content.value?.$el;
|
|
16061
|
-
if (el instanceof Element) writeCollapseGap(el, el.parentElement);
|
|
16062
|
-
}
|
|
16063
|
-
onMounted(measure);
|
|
16064
|
-
onBeforeUpdate(measure);
|
|
16245
|
+
const content = useCollapseGap();
|
|
16065
16246
|
return (_ctx, _cache) => {
|
|
16066
16247
|
return openBlock(), createBlock(unref(CollapsibleContent), {
|
|
16067
16248
|
ref_key: "content",
|
|
@@ -16193,13 +16374,7 @@ var AccordionContent_default = /* @__PURE__ */ defineComponent({
|
|
|
16193
16374
|
props: { class: {} },
|
|
16194
16375
|
setup(__props) {
|
|
16195
16376
|
const props = __props;
|
|
16196
|
-
const content =
|
|
16197
|
-
function measure() {
|
|
16198
|
-
const el = content.value?.$el;
|
|
16199
|
-
if (el instanceof Element) writeCollapseGap(el, el.parentElement);
|
|
16200
|
-
}
|
|
16201
|
-
onMounted(measure);
|
|
16202
|
-
onBeforeUpdate(measure);
|
|
16377
|
+
const content = useCollapseGap();
|
|
16203
16378
|
return (_ctx, _cache) => {
|
|
16204
16379
|
return openBlock(), createBlock(unref(AccordionContent), {
|
|
16205
16380
|
ref_key: "content",
|
|
@@ -16623,11 +16798,11 @@ var _hoisted_3$4 = {
|
|
|
16623
16798
|
class: "hidden h-full shrink-0 lg:block"
|
|
16624
16799
|
};
|
|
16625
16800
|
var _hoisted_4$2 = { class: "flex min-h-0 min-w-0 flex-1 flex-col" };
|
|
16626
|
-
var _hoisted_5$
|
|
16801
|
+
var _hoisted_5$2 = {
|
|
16627
16802
|
key: 0,
|
|
16628
16803
|
class: "border-line bg-canvas shrink-0 border-b"
|
|
16629
16804
|
};
|
|
16630
|
-
var _hoisted_6 = { class: "flex h-14 items-center gap-3 px-4 sm:px-6" };
|
|
16805
|
+
var _hoisted_6$1 = { class: "flex h-14 items-center gap-3 px-4 sm:px-6" };
|
|
16631
16806
|
var _hoisted_7 = { class: "min-h-0 min-w-0 flex-1" };
|
|
16632
16807
|
//#endregion
|
|
16633
16808
|
//#region src/components/app-shell/AppShell.vue
|
|
@@ -16683,7 +16858,7 @@ var AppShell_default = /* @__PURE__ */ defineComponent({
|
|
|
16683
16858
|
return openBlock(), createBlock(TooltipProvider_default, null, {
|
|
16684
16859
|
default: withCtx(() => [createElementVNode("div", { class: normalizeClass(unref(cn)("bg-canvas text-fg flex h-screen flex-col overflow-hidden", props.class)) }, [
|
|
16685
16860
|
_ctx.$slots.banner ? (openBlock(), createElementBlock("div", _hoisted_1$14, [renderSlot(_ctx.$slots, "banner")])) : createCommentVNode("", true),
|
|
16686
|
-
createElementVNode("div", _hoisted_2$10, [_ctx.$slots.sidebar ? (openBlock(), createElementBlock("div", _hoisted_3$4, [renderSlot(_ctx.$slots, "sidebar")])) : createCommentVNode("", true), createElementVNode("div", _hoisted_4$2, [_ctx.$slots.header ? (openBlock(), createElementBlock("header", _hoisted_5$
|
|
16861
|
+
createElementVNode("div", _hoisted_2$10, [_ctx.$slots.sidebar ? (openBlock(), createElementBlock("div", _hoisted_3$4, [renderSlot(_ctx.$slots, "sidebar")])) : createCommentVNode("", true), createElementVNode("div", _hoisted_4$2, [_ctx.$slots.header ? (openBlock(), createElementBlock("header", _hoisted_5$2, [createElementVNode("div", _hoisted_6$1, [renderSlot(_ctx.$slots, "header")])])) : createCommentVNode("", true), createElementVNode("main", _hoisted_7, [createVNode(ScrollArea_default, {
|
|
16687
16862
|
ref_key: "main",
|
|
16688
16863
|
ref: main,
|
|
16689
16864
|
"data-scroll-restore": props.restoreKey,
|
|
@@ -17464,11 +17639,20 @@ var DropdownMenuRadioItem_default = /* @__PURE__ */ defineComponent({
|
|
|
17464
17639
|
});
|
|
17465
17640
|
//#endregion
|
|
17466
17641
|
//#region src/components/dialog/Dialog.vue?vue&type=script&setup=true&lang.ts
|
|
17467
|
-
var _hoisted_1$2 = {
|
|
17642
|
+
var _hoisted_1$2 = {
|
|
17643
|
+
key: 0,
|
|
17644
|
+
class: "flex shrink-0 items-start justify-between gap-4 px-(--hn-panel-p)"
|
|
17645
|
+
};
|
|
17468
17646
|
var _hoisted_2$2 = { class: "flex min-w-0 flex-col gap-1.5" };
|
|
17469
|
-
var _hoisted_3$1 = { class: "
|
|
17647
|
+
var _hoisted_3$1 = { class: "flex min-w-0 items-center gap-2" };
|
|
17470
17648
|
var _hoisted_4$1 = {
|
|
17471
|
-
key:
|
|
17649
|
+
key: 0,
|
|
17650
|
+
class: "text-muted flex shrink-0 [&_svg]:size-5",
|
|
17651
|
+
"aria-hidden": "true"
|
|
17652
|
+
};
|
|
17653
|
+
var _hoisted_5$1 = { class: "px-(--hn-panel-p) py-1" };
|
|
17654
|
+
var _hoisted_6 = {
|
|
17655
|
+
key: 2,
|
|
17472
17656
|
class: "flex shrink-0 justify-end gap-(--hn-inline-gap) px-(--hn-panel-p)"
|
|
17473
17657
|
};
|
|
17474
17658
|
//#endregion
|
|
@@ -17481,6 +17665,14 @@ var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
17481
17665
|
description: {},
|
|
17482
17666
|
size: { default: "md" },
|
|
17483
17667
|
placement: {},
|
|
17668
|
+
header: {
|
|
17669
|
+
type: Boolean,
|
|
17670
|
+
default: true
|
|
17671
|
+
},
|
|
17672
|
+
closable: {
|
|
17673
|
+
type: Boolean,
|
|
17674
|
+
default: true
|
|
17675
|
+
},
|
|
17484
17676
|
locked: {
|
|
17485
17677
|
type: Boolean,
|
|
17486
17678
|
default: false
|
|
@@ -17493,11 +17685,11 @@ var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
17493
17685
|
emits: ["update:open"],
|
|
17494
17686
|
setup(__props) {
|
|
17495
17687
|
const props = __props;
|
|
17688
|
+
const slots = useSlots();
|
|
17496
17689
|
function guard(e) {
|
|
17497
17690
|
if (props.locked) e.preventDefault();
|
|
17498
17691
|
}
|
|
17499
17692
|
const open = useModel(__props, "open");
|
|
17500
|
-
useUiLocale();
|
|
17501
17693
|
function close() {
|
|
17502
17694
|
open.value = false;
|
|
17503
17695
|
}
|
|
@@ -17513,29 +17705,47 @@ var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
17513
17705
|
default: withCtx(() => [renderSlot(_ctx.$slots, "default")]),
|
|
17514
17706
|
_: 3
|
|
17515
17707
|
})) : createCommentVNode("", true), createVNode(unref(DialogPortal), null, {
|
|
17516
|
-
default: withCtx(() => [createVNode(unref(DialogOverlay), { class: "hn-scrim" }), createElementVNode("div", { class: normalizeClass(unref(
|
|
17708
|
+
default: withCtx(() => [createVNode(unref(DialogOverlay), { class: "hn-scrim" }), createElementVNode("div", { class: normalizeClass(unref(dialogWrapper)({ placement: props.placement ?? "auto" })) }, [createVNode(unref(DialogContent), {
|
|
17517
17709
|
"as-child": "",
|
|
17518
17710
|
onEscapeKeyDown: guard,
|
|
17519
17711
|
onInteractOutside: guard
|
|
17520
17712
|
}, {
|
|
17521
|
-
default: withCtx(() => [createVNode(Card_default, {
|
|
17713
|
+
default: withCtx(() => [createVNode(Card_default, mergeProps(props.description ? {} : { "aria-describedby": void 0 }, {
|
|
17522
17714
|
padded: false,
|
|
17523
|
-
class:
|
|
17715
|
+
class: unref(cn)(unref(dialogCard)({
|
|
17524
17716
|
placement: props.placement ?? "auto",
|
|
17525
|
-
size: props.size
|
|
17526
|
-
|
|
17527
|
-
|
|
17528
|
-
|
|
17529
|
-
|
|
17717
|
+
size: props.size,
|
|
17718
|
+
padded: !slots.body,
|
|
17719
|
+
fitViewport: true
|
|
17720
|
+
}), props.class)
|
|
17721
|
+
}), {
|
|
17722
|
+
default: withCtx(() => [!props.header || slots.body ? (openBlock(), createElementBlock(Fragment, { key: 0 }, [createVNode(unref(DialogTitle), { "as-child": "" }, {
|
|
17723
|
+
default: withCtx(() => [createVNode(Heading_default, {
|
|
17724
|
+
level: 2,
|
|
17725
|
+
class: "sr-only"
|
|
17726
|
+
}, {
|
|
17727
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.title), 1)]),
|
|
17728
|
+
_: 1
|
|
17729
|
+
})]),
|
|
17730
|
+
_: 1
|
|
17731
|
+
}), props.description ? (openBlock(), createBlock(unref(DialogDescription), {
|
|
17732
|
+
key: 0,
|
|
17733
|
+
class: "sr-only"
|
|
17734
|
+
}, {
|
|
17735
|
+
default: withCtx(() => [createTextVNode(toDisplayString(props.description), 1)]),
|
|
17736
|
+
_: 1
|
|
17737
|
+
})) : createCommentVNode("", true)], 64)) : createCommentVNode("", true), slots.body ? renderSlot(_ctx.$slots, "body", { close }, void 0, void 0, 1) : (openBlock(), createElementBlock(Fragment, { key: 2 }, [
|
|
17738
|
+
props.header ? (openBlock(), createElementBlock("div", _hoisted_1$2, [createElementVNode("div", _hoisted_2$2, [createElementVNode("div", _hoisted_3$1, [slots.icon ? (openBlock(), createElementBlock("span", _hoisted_4$1, [renderSlot(_ctx.$slots, "icon")])) : createCommentVNode("", true), createVNode(unref(DialogTitle), { "as-child": "" }, {
|
|
17530
17739
|
default: withCtx(() => [createVNode(Heading_default, {
|
|
17531
17740
|
level: 2,
|
|
17532
|
-
size: "lg"
|
|
17741
|
+
size: "lg",
|
|
17742
|
+
class: "min-w-0"
|
|
17533
17743
|
}, {
|
|
17534
|
-
default: withCtx(() => [createTextVNode(toDisplayString(props.title), 1)]),
|
|
17535
|
-
_:
|
|
17744
|
+
default: withCtx(() => [renderSlot(_ctx.$slots, "title", {}, () => [createTextVNode(toDisplayString(props.title), 1)])]),
|
|
17745
|
+
_: 3
|
|
17536
17746
|
})]),
|
|
17537
|
-
_:
|
|
17538
|
-
}), props.description ? (openBlock(), createBlock(unref(DialogDescription), {
|
|
17747
|
+
_: 3
|
|
17748
|
+
})]), props.description ? (openBlock(), createBlock(unref(DialogDescription), {
|
|
17539
17749
|
key: 0,
|
|
17540
17750
|
"as-child": ""
|
|
17541
17751
|
}, {
|
|
@@ -17544,24 +17754,27 @@ var Dialog_default = /* @__PURE__ */ defineComponent({
|
|
|
17544
17754
|
_: 1
|
|
17545
17755
|
})]),
|
|
17546
17756
|
_: 1
|
|
17547
|
-
})) : createCommentVNode("", true)]),
|
|
17757
|
+
})) : createCommentVNode("", true)]), props.closable ? (openBlock(), createBlock(unref(DialogClose), {
|
|
17758
|
+
key: 0,
|
|
17759
|
+
"as-child": ""
|
|
17760
|
+
}, {
|
|
17548
17761
|
default: withCtx(() => [createVNode(CloseButton_default, {
|
|
17549
17762
|
disabled: props.locked,
|
|
17550
17763
|
class: "-mt-1.5 -me-1.5 shrink-0"
|
|
17551
17764
|
}, null, 8, ["disabled"])]),
|
|
17552
17765
|
_: 1
|
|
17553
|
-
})]),
|
|
17766
|
+
})) : createCommentVNode("", true)])) : createCommentVNode("", true),
|
|
17554
17767
|
_ctx.$slots.content ? (openBlock(), createBlock(ScrollArea_default, {
|
|
17555
|
-
key:
|
|
17768
|
+
key: 1,
|
|
17556
17769
|
class: "min-h-0"
|
|
17557
17770
|
}, {
|
|
17558
|
-
default: withCtx(() => [createElementVNode("div",
|
|
17771
|
+
default: withCtx(() => [createElementVNode("div", _hoisted_5$1, [renderSlot(_ctx.$slots, "content", { close })])]),
|
|
17559
17772
|
_: 3
|
|
17560
17773
|
})) : createCommentVNode("", true),
|
|
17561
|
-
_ctx.$slots.footer ? (openBlock(), createElementBlock("div",
|
|
17562
|
-
]),
|
|
17774
|
+
_ctx.$slots.footer ? (openBlock(), createElementBlock("div", _hoisted_6, [renderSlot(_ctx.$slots, "footer", { close })])) : createCommentVNode("", true)
|
|
17775
|
+
], 64))]),
|
|
17563
17776
|
_: 3
|
|
17564
|
-
},
|
|
17777
|
+
}, 16, ["class"])]),
|
|
17565
17778
|
_: 3
|
|
17566
17779
|
})], 2)]),
|
|
17567
17780
|
_: 3
|
|
@@ -18483,6 +18696,39 @@ var Spoiler_default = /* @__PURE__ */ defineComponent({
|
|
|
18483
18696
|
}
|
|
18484
18697
|
});
|
|
18485
18698
|
//#endregion
|
|
18699
|
+
//#region src/components/image/composables/useImageGroupState.ts
|
|
18700
|
+
function useImageGroupState() {
|
|
18701
|
+
const registry = reactive(/* @__PURE__ */ new Map());
|
|
18702
|
+
const open = shallowRef(false);
|
|
18703
|
+
const index = shallowRef(0);
|
|
18704
|
+
function byDom(a, b) {
|
|
18705
|
+
const first = a.source?.();
|
|
18706
|
+
const second = b.source?.();
|
|
18707
|
+
if (!first || !second || first === second) return 0;
|
|
18708
|
+
return first.compareDocumentPosition(second) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
18709
|
+
}
|
|
18710
|
+
const items = computed(() => [...registry.values()].map((read) => read()).sort(byDom));
|
|
18711
|
+
provideImageGroup({
|
|
18712
|
+
register: (id, item) => {
|
|
18713
|
+
registry.set(id, item);
|
|
18714
|
+
},
|
|
18715
|
+
unregister: (id) => {
|
|
18716
|
+
registry.delete(id);
|
|
18717
|
+
},
|
|
18718
|
+
open: (id) => {
|
|
18719
|
+
const at = items.value.findIndex((item) => item.id === id);
|
|
18720
|
+
if (at < 0) return;
|
|
18721
|
+
index.value = at;
|
|
18722
|
+
open.value = true;
|
|
18723
|
+
}
|
|
18724
|
+
});
|
|
18725
|
+
return {
|
|
18726
|
+
items,
|
|
18727
|
+
open,
|
|
18728
|
+
index
|
|
18729
|
+
};
|
|
18730
|
+
}
|
|
18731
|
+
//#endregion
|
|
18486
18732
|
//#region src/components/image/ImageGroup.vue
|
|
18487
18733
|
var ImageGroup_default = /* @__PURE__ */ defineComponent({
|
|
18488
18734
|
name: "HnImageGroup",
|
|
@@ -18490,37 +18736,14 @@ var ImageGroup_default = /* @__PURE__ */ defineComponent({
|
|
|
18490
18736
|
props: { loop: { type: Boolean } },
|
|
18491
18737
|
setup(__props) {
|
|
18492
18738
|
const props = __props;
|
|
18493
|
-
const
|
|
18494
|
-
const open = shallowRef(false);
|
|
18495
|
-
const index = shallowRef(0);
|
|
18496
|
-
function byDom(a, b) {
|
|
18497
|
-
const first = a.source?.();
|
|
18498
|
-
const second = b.source?.();
|
|
18499
|
-
if (!first || !second || first === second) return 0;
|
|
18500
|
-
return first.compareDocumentPosition(second) & Node.DOCUMENT_POSITION_FOLLOWING ? -1 : 1;
|
|
18501
|
-
}
|
|
18502
|
-
const items = computed(() => [...registry.values()].map((read) => read()).sort(byDom));
|
|
18503
|
-
provideImageGroup({
|
|
18504
|
-
register: (id, item) => {
|
|
18505
|
-
registry.set(id, item);
|
|
18506
|
-
},
|
|
18507
|
-
unregister: (id) => {
|
|
18508
|
-
registry.delete(id);
|
|
18509
|
-
},
|
|
18510
|
-
open: (id) => {
|
|
18511
|
-
const at = items.value.findIndex((item) => item.id === id);
|
|
18512
|
-
if (at < 0) return;
|
|
18513
|
-
index.value = at;
|
|
18514
|
-
open.value = true;
|
|
18515
|
-
}
|
|
18516
|
-
});
|
|
18739
|
+
const { items, open, index } = useImageGroupState();
|
|
18517
18740
|
return (_ctx, _cache) => {
|
|
18518
18741
|
return openBlock(), createElementBlock(Fragment, null, [renderSlot(_ctx.$slots, "default"), createVNode(Lightbox_default, {
|
|
18519
|
-
open: open
|
|
18520
|
-
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => open.value = $event),
|
|
18521
|
-
index: index
|
|
18522
|
-
"onUpdate:index": _cache[1] || (_cache[1] = ($event) => index.value = $event),
|
|
18523
|
-
items: items
|
|
18742
|
+
open: unref(open),
|
|
18743
|
+
"onUpdate:open": _cache[0] || (_cache[0] = ($event) => isRef(open) ? open.value = $event : null),
|
|
18744
|
+
index: unref(index),
|
|
18745
|
+
"onUpdate:index": _cache[1] || (_cache[1] = ($event) => isRef(index) ? index.value = $event : null),
|
|
18746
|
+
items: unref(items),
|
|
18524
18747
|
loop: props.loop
|
|
18525
18748
|
}, null, 8, [
|
|
18526
18749
|
"open",
|