@hina-ui/vue 1.1.0 → 1.3.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 +1062 -528
- package/dist/index.js.map +1 -1
- package/dist/types/components/accordion/AccordionContent.vue.d.ts.map +1 -1
- package/dist/types/components/alert-dialog/AlertDialog.vue.d.ts +4 -0
- package/dist/types/components/alert-dialog/AlertDialog.vue.d.ts.map +1 -1
- package/dist/types/components/alert-dialog/alert-dialog.variants.d.ts +5 -0
- package/dist/types/components/alert-dialog/alert-dialog.variants.d.ts.map +1 -0
- package/dist/types/components/alert-dialog/composables/useAlertDialogConfirm.d.ts +9 -0
- package/dist/types/components/alert-dialog/composables/useAlertDialogConfirm.d.ts.map +1 -0
- package/dist/types/components/alert-dialog/composables/useConfirmDelay.d.ts +3 -0
- package/dist/types/components/alert-dialog/composables/useConfirmDelay.d.ts.map +1 -0
- package/dist/types/components/anchor/Anchor.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/code-block/CodeBlock.vue.d.ts.map +1 -1
- package/dist/types/components/code-block/code-block.variants.d.ts +6 -0
- package/dist/types/components/code-block/code-block.variants.d.ts.map +1 -0
- package/dist/types/components/code-block/composables/useCodeHighlight.d.ts +7 -0
- package/dist/types/components/code-block/composables/useCodeHighlight.d.ts.map +1 -0
- 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/dropdown-menu/DropdownMenu.vue.d.ts +18 -6
- package/dist/types/components/dropdown-menu/DropdownMenu.vue.d.ts.map +1 -1
- package/dist/types/components/highlight/Highlight.vue.d.ts +2 -0
- package/dist/types/components/highlight/Highlight.vue.d.ts.map +1 -1
- package/dist/types/components/highlight/composables/useHighlightMotion.d.ts +10 -0
- package/dist/types/components/highlight/composables/useHighlightMotion.d.ts.map +1 -0
- 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/lightbox/LightboxThumbs.vue.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/popover/Popover.vue.d.ts +19 -6
- package/dist/types/components/popover/Popover.vue.d.ts.map +1 -1
- package/dist/types/components/popover/PopoverContent.vue.d.ts +29 -0
- package/dist/types/components/popover/PopoverContent.vue.d.ts.map +1 -0
- package/dist/types/components/popover/composables/usePopoverCloseFocus.d.ts +2 -0
- package/dist/types/components/popover/composables/usePopoverCloseFocus.d.ts.map +1 -0
- 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/ScrollArea.vue.d.ts.map +1 -1
- package/dist/types/components/scroll-area/composables/useScrollFocus.d.ts +17 -0
- package/dist/types/components/scroll-area/composables/useScrollFocus.d.ts.map +1 -0
- 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/tabs/TabsTrigger.vue.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/anchored-overlay.d.ts +23 -0
- package/dist/types/lib/anchored-overlay.d.ts.map +1 -0
- 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/alert-dialog/AlertDialog.vue +24 -36
- package/src/components/alert-dialog/alert-dialog.variants.ts +17 -0
- package/src/components/alert-dialog/composables/useAlertDialogConfirm.ts +29 -0
- package/src/components/alert-dialog/composables/useConfirmDelay.ts +37 -0
- package/src/components/anchor/Anchor.vue +1 -0
- 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/code-block/CodeBlock.vue +15 -30
- package/src/components/code-block/code-block.variants.ts +21 -0
- package/src/components/code-block/composables/useCodeHighlight.ts +30 -0
- 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/dropdown-menu/DropdownMenu.vue +16 -4
- package/src/components/highlight/Highlight.vue +5 -4
- package/src/components/highlight/composables/useHighlightMotion.ts +22 -0
- 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/lightbox/LightboxThumbs.vue +1 -0
- 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/popover/Popover.vue +21 -5
- package/src/components/popover/PopoverContent.vue +25 -0
- package/src/components/popover/composables/usePopoverCloseFocus.ts +17 -0
- package/src/components/radio-group/RadioGroup.vue +3 -3
- package/src/components/scroll-area/ScrollArea.vue +7 -5
- package/src/components/scroll-area/composables/useScrollFocus.ts +39 -0
- 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 +9 -4
- 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/tabs/TabsTrigger.vue +6 -1
- 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/anchored-overlay.ts +110 -0
- 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/src/styles/typography.css +9 -4
|
@@ -1,20 +1,27 @@
|
|
|
1
1
|
import { type SelectItems, type SelectOption } from './types';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
})
|
|
2
|
+
declare const __VLS_export: <T extends SelectOption = SelectOption>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_exposed?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
|
|
3
|
+
props: import("vue").PublicProps & __VLS_PrettifyLocal<{
|
|
4
|
+
options: SelectItems<T>;
|
|
5
|
+
keyboard?: boolean;
|
|
6
|
+
}> & (typeof globalThis extends {
|
|
7
|
+
__VLS_PROPS_FALLBACK: infer P;
|
|
8
|
+
} ? P : {});
|
|
9
|
+
expose: (exposed: {}) => void;
|
|
10
|
+
attrs: any;
|
|
11
|
+
slots: {
|
|
12
|
+
option?(props: {
|
|
13
|
+
option: T;
|
|
14
|
+
}): unknown;
|
|
15
|
+
};
|
|
16
|
+
emit: {};
|
|
17
|
+
}>) => import("vue").VNode & {
|
|
18
|
+
__ctx?: NonNullable<Awaited<typeof __VLS_setup>>;
|
|
10
19
|
};
|
|
11
|
-
declare const __VLS_base: import("vue").DefineComponent<__VLS_Props, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<__VLS_Props> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
12
|
-
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
13
20
|
declare const _default: typeof __VLS_export;
|
|
14
21
|
export default _default;
|
|
15
|
-
type
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
};
|
|
22
|
+
type __VLS_PrettifyLocal<T> = (T extends any ? {
|
|
23
|
+
[K in keyof T]: T[K];
|
|
24
|
+
} : {
|
|
25
|
+
[K in keyof T as K]: T[K];
|
|
26
|
+
}) & {};
|
|
20
27
|
//# sourceMappingURL=SelectList.vue.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectList.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/select/SelectList.vue"],"names":[],"mappings":"AAqIE,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"SelectList.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/select/SelectList.vue"],"names":[],"mappings":"AAqIE,OAAO,EAAiB,KAAK,WAAW,EAAE,KAAK,YAAY,EAAE,MAAM,SAAS,CAAA;AAE5E,QAAA,MAAM,YAAY,GAAK,CAAC,SAAS,YAAY,GAAG,YAAY,EAC7D,aAAa,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,OAAO,CAAC,EAC9D,YAAY,mBAAmB,CAAC,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,OAAO,CAAC,CAAC,EAC3G,gBAAgB,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,QAAQ,CAAC,EAClE;WAmXO,OAAO,KAAK,EAAE,WAAW,GAAG,mBAAmB;iBAhXvB,WAAW,CAAC,CAAC,CAAC;mBAAa,OAAO;MAgXQ,GAAG,CAAC,OAAO,UAAU,SAAS;QAAE,oBAAoB,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,CAAC,GAAG,EAAE,CAAC;YAC1I,CAAC,OAAO,EAAE,EAAE,KAAK,IAAI;WACtB,GAAG;;uBA7W2B;YAAE,MAAM,EAAE,CAAC,CAAA;SAAE,GAAG,OAAO;;UA+WtD,EAAE;EAEL,KACQ,OAAO,KAAK,EAAE,KAAK,GAAG;IAAE,KAAK,CAAC,EAAE,WAAW,CAAC,OAAO,CAAC,OAAO,WAAW,CAAC,CAAC,CAAA;CAAI,CAAC;wBACpE,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,mBAAmB,CAAC,CAAC,IAAI,CAAC,CAAC,SAAS,GAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,GAAG;KAAG,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CAAG,CAAC,GAAG,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare function useClearTransition(visible: () => boolean): {
|
|
2
|
+
reserved: import("vue").ComputedRef<boolean>;
|
|
3
|
+
hooks: {
|
|
4
|
+
beforeEnter: (element: Element) => void;
|
|
5
|
+
beforeLeave: (element: Element) => void;
|
|
6
|
+
afterLeave: () => void;
|
|
7
|
+
leaveCancelled: () => void;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
//# sourceMappingURL=useClearTransition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useClearTransition.d.ts","sourceRoot":"","sources":["../../../../../src/components/select/composables/useClearTransition.ts"],"names":[],"mappings":"AAEA,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,OAAO;;;+BAIzB,OAAO;+BAKP,OAAO;;;;EAatC"}
|
|
@@ -1,8 +1,24 @@
|
|
|
1
1
|
export declare const selectTrigger: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
2
|
+
export declare const selectButton: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
2
3
|
export declare const selectContent: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
3
4
|
export declare const selectList: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "max-h-[min(20rem,var(--reka-select-content-available-height))]", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
4
5
|
export declare const selectItem: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
5
6
|
export declare const selectLabel: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "text-muted px-2.5 py-1.5 text-xs font-medium", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
6
7
|
export declare const selectEmpty: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "text-muted px-2.5 py-2 text-sm", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
7
8
|
export declare const selectListBody: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "flex flex-col p-1", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
9
|
+
export declare const selectHost: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, "relative cursor-pointer", {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
10
|
+
export declare const selectValue: import("tailwind-variants").TVReturnType<{
|
|
11
|
+
clearing: {
|
|
12
|
+
true: "pe-[var(--hn-input-h)]";
|
|
13
|
+
};
|
|
14
|
+
}, undefined, "min-w-0 flex-1 truncate", {
|
|
15
|
+
clearing: {
|
|
16
|
+
true: "pe-[var(--hn-input-h)]";
|
|
17
|
+
};
|
|
18
|
+
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
19
|
+
clearing: {
|
|
20
|
+
true: "pe-[var(--hn-input-h)]";
|
|
21
|
+
};
|
|
22
|
+
}, undefined>>;
|
|
23
|
+
export declare const selectClearSlot: import("tailwind-variants").TVReturnType<{} | {} | {}, undefined, string[], {} | {}, undefined, import("tailwind-variants").TVReturnTypeLike<unknown, undefined>>;
|
|
8
24
|
//# sourceMappingURL=select.variants.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.variants.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.variants.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa,mKAOxB,CAAA;AAEF,eAAO,MAAM,YAAY,mKAMvB,CAAA;AAEF,eAAO,MAAM,aAAa,mKAKxB,CAAA;AAEF,eAAO,MAAM,UAAU,2NAErB,CAAA;AAEF,eAAO,MAAM,UAAU,mKAOrB,CAAA;AAEF,eAAO,MAAM,WAAW,yMAEtB,CAAA;AAEF,eAAO,MAAM,WAAW,2LAEtB,CAAA;AAEF,eAAO,MAAM,cAAc,8KAEzB,CAAA;AAEF,eAAO,MAAM,UAAU,oLAErB,CAAA;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;cAKtB,CAAA;AAEF,eAAO,MAAM,eAAe,mKAE1B,CAAA"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export
|
|
1
|
+
export type SelectOption<T extends object = object> = {
|
|
2
2
|
value: string | number;
|
|
3
3
|
label: string;
|
|
4
4
|
description?: string;
|
|
5
5
|
disabled?: boolean;
|
|
6
|
-
}
|
|
7
|
-
export interface SelectOptionGroup {
|
|
6
|
+
} & T;
|
|
7
|
+
export interface SelectOptionGroup<T extends SelectOption = SelectOption> {
|
|
8
8
|
label: string;
|
|
9
|
-
options:
|
|
9
|
+
options: T[];
|
|
10
10
|
}
|
|
11
|
-
export type SelectItems = Array<
|
|
12
|
-
export declare function isOptionGroup(item:
|
|
13
|
-
export declare function flattenOptions(items: SelectItems):
|
|
11
|
+
export type SelectItems<T extends SelectOption = SelectOption> = Array<T | SelectOptionGroup<T>>;
|
|
12
|
+
export declare function isOptionGroup<T extends SelectOption>(item: T | SelectOptionGroup<T>): item is SelectOptionGroup<T>;
|
|
13
|
+
export declare function flattenOptions<T extends SelectOption>(items: SelectItems<T>): T[];
|
|
14
14
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/select/types.ts"],"names":[],"mappings":"AAAA,MAAM,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/select/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,IAAI;IACpD,KAAK,EAAE,MAAM,GAAG,MAAM,CAAA;IACtB,KAAK,EAAE,MAAM,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAA;CACnB,GAAG,CAAC,CAAA;AAEL,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY;IACtE,KAAK,EAAE,MAAM,CAAA;IACb,OAAO,EAAE,CAAC,EAAE,CAAA;CACb;AAED,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,YAAY,GAAG,YAAY,IAAI,KAAK,CAAC,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,CAAC,CAAA;AAEhG,wBAAgB,aAAa,CAAC,CAAC,SAAS,YAAY,EAClD,IAAI,EAAE,CAAC,GAAG,iBAAiB,CAAC,CAAC,CAAC,GAC7B,IAAI,IAAI,iBAAiB,CAAC,CAAC,CAAC,CAE9B;AAED,wBAAgB,cAAc,CAAC,CAAC,SAAS,YAAY,EAAE,KAAK,EAAE,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAEjF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TabsTrigger.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/TabsTrigger.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TabsTrigger.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/tabs/TabsTrigger.vue"],"names":[],"mappings":"AAmDE,KAAK,WAAW,GAAG;IACjB,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AA0EJ,QAAA,IAAI,QAAQ,IAAY,CAAE;AAC1B,KAAK,WAAW,GAAG,EAAE,GACnB;IAAE,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,OAAO,QAAQ,KAAK,GAAG,CAAA;CAAE,CAAC;AAKhD,QAAA,MAAM,UAAU,kSAEd,CAAC;AACH,QAAA,MAAM,YAAY,EAAS,eAAe,CAAC,OAAO,UAAU,EAAE,WAAW,CAAC,CAAC;wBACtD,OAAO,YAAY;AAAxC,wBAAyC;AACzC,KAAK,eAAe,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,GAAG;IAChC,QAAO;QACN,MAAM,EAAE,CAAC,CAAC;KACV,CAAA;CACD,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Textarea.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/textarea/Textarea.vue"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Textarea.vue.d.ts","sourceRoot":"","sources":["../../../../src/components/textarea/Textarea.vue"],"names":[],"mappings":"AAgFE,OAAO,EAA2B,KAAK,gBAAgB,EAAE,MAAM,qBAAqB,CAAA;AAcpF,KAAK,WAAW,GAAG;IACf,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;IACrC,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC/B,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3D,MAAM,CAAC,EAAE,gBAAgB,CAAC,QAAQ,CAAC,CAAA;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,OAAO,CAAC,EAAE,OAAO,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;CACf,CAAC;AAWN,KAAK,gBAAgB,GAAG;IACxB,UAAU,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAMF,KAAK,iBAAiB,GAAG,WAAW,GAAG,gBAAgB,CAAC;AAsFxD,QAAA,MAAM,YAAY;;;;;UA/GL,MAAM;6EAmHjB,CAAC;wBACkB,OAAO,YAAY;AAAxC,wBAAyC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { TextareaVariants } from '../textarea.variants';
|
|
3
|
+
interface TextareaSizingProps {
|
|
4
|
+
autosize?: boolean | {
|
|
5
|
+
minRows?: number;
|
|
6
|
+
maxRows?: number;
|
|
7
|
+
};
|
|
8
|
+
rows: number;
|
|
9
|
+
size?: TextareaVariants['size'];
|
|
10
|
+
variant?: TextareaVariants['variant'];
|
|
11
|
+
}
|
|
12
|
+
export declare function useTextareaSizing(props: TextareaSizingProps, model: Ref<string | undefined>): {
|
|
13
|
+
el: import("vue").ShallowRef<HTMLTextAreaElement | null, HTMLTextAreaElement | null>;
|
|
14
|
+
area: import("vue").ShallowRef<{
|
|
15
|
+
viewport?: HTMLElement;
|
|
16
|
+
} | undefined, {
|
|
17
|
+
viewport?: HTMLElement;
|
|
18
|
+
} | undefined>;
|
|
19
|
+
bounds: import("vue").ComputedRef<{
|
|
20
|
+
min: number;
|
|
21
|
+
max: number | undefined;
|
|
22
|
+
}>;
|
|
23
|
+
fit: () => void;
|
|
24
|
+
focus: (event: MouseEvent) => void;
|
|
25
|
+
};
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=useTextareaSizing.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useTextareaSizing.d.ts","sourceRoot":"","sources":["../../../../../src/components/textarea/composables/useTextareaSizing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAoD,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AAEhF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAA;AAE5D,UAAU,mBAAmB;IAC3B,QAAQ,CAAC,EAAE,OAAO,GAAG;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,CAAA;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,CAAC,EAAE,gBAAgB,CAAC,MAAM,CAAC,CAAA;IAC/B,OAAO,CAAC,EAAE,gBAAgB,CAAC,SAAS,CAAC,CAAA;CACtC;AAED,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,mBAAmB,EAAE,KAAK,EAAE,GAAG,CAAC,MAAM,GAAG,SAAS,CAAC;;;mBAErD,WAAW;;mBAAX,WAAW;;;;;;;mBA0B1B,UAAU;EAcjC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { type VariantProps } from '../../lib/tv';
|
|
2
2
|
export declare const textarea: import("tailwind-variants").TVReturnType<{
|
|
3
3
|
variant: {
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
bare: "rounded-none border-0 bg-transparent shadow-none outline-none [--hn-textarea-border-w:0px]";
|
|
5
|
+
primary: "hn-field border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]";
|
|
6
|
+
secondary: "hn-field border-transparent [--hn-field-bg:var(--hn-bg-inset)]";
|
|
6
7
|
};
|
|
7
8
|
size: {
|
|
8
9
|
sm: "text-sm [--hn-textarea-h:var(--hn-control-h-sm)] [--hn-textarea-px:var(--hn-control-px-sm)]";
|
|
@@ -19,8 +20,9 @@ export declare const textarea: import("tailwind-variants").TVReturnType<{
|
|
|
19
20
|
};
|
|
20
21
|
}, undefined, string[], {
|
|
21
22
|
variant: {
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
bare: "rounded-none border-0 bg-transparent shadow-none outline-none [--hn-textarea-border-w:0px]";
|
|
24
|
+
primary: "hn-field border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]";
|
|
25
|
+
secondary: "hn-field border-transparent [--hn-field-bg:var(--hn-bg-inset)]";
|
|
24
26
|
};
|
|
25
27
|
size: {
|
|
26
28
|
sm: "text-sm [--hn-textarea-h:var(--hn-control-h-sm)] [--hn-textarea-px:var(--hn-control-px-sm)]";
|
|
@@ -37,8 +39,9 @@ export declare const textarea: import("tailwind-variants").TVReturnType<{
|
|
|
37
39
|
};
|
|
38
40
|
}, undefined, import("tailwind-variants").TVReturnTypeLike<{
|
|
39
41
|
variant: {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
+
bare: "rounded-none border-0 bg-transparent shadow-none outline-none [--hn-textarea-border-w:0px]";
|
|
43
|
+
primary: "hn-field border-line [--hn-field-bg:var(--hn-surface)] [--hn-field-shadow:var(--hn-shadow-sm)]";
|
|
44
|
+
secondary: "hn-field border-transparent [--hn-field-bg:var(--hn-bg-inset)]";
|
|
42
45
|
};
|
|
43
46
|
size: {
|
|
44
47
|
sm: "text-sm [--hn-textarea-h:var(--hn-control-h-sm)] [--hn-textarea-px:var(--hn-control-px-sm)]";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"textarea.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/textarea/textarea.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAEpD,eAAO,MAAM,QAAQ
|
|
1
|
+
{"version":3,"file":"textarea.variants.d.ts","sourceRoot":"","sources":["../../../../src/components/textarea/textarea.variants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAM,KAAK,YAAY,EAAE,MAAM,cAAc,CAAA;AAEpD,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;cAmCnB,CAAA;AAEF,eAAO,MAAM,aAAa,mKAMxB,CAAA;AAEF,MAAM,MAAM,gBAAgB,GAAG,YAAY,CAAC,OAAO,QAAQ,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type Ref } from 'vue';
|
|
2
|
+
import type { DropdownMenuContentEmits } from 'reka-ui';
|
|
3
|
+
export declare function useAnchoredOverlay(props: {
|
|
4
|
+
anchor?: HTMLElement | null;
|
|
5
|
+
modal: boolean;
|
|
6
|
+
}, open: Ref<boolean | undefined>, emit: <K extends keyof DropdownMenuContentEmits>(event: K, ...args: DropdownMenuContentEmits[K]) => void, openAutoFocus?: (event: Event) => void): {
|
|
7
|
+
trigger: import("vue").ShallowRef<{
|
|
8
|
+
$el: HTMLElement;
|
|
9
|
+
} | null, {
|
|
10
|
+
$el: HTMLElement;
|
|
11
|
+
} | null>;
|
|
12
|
+
reference: import("vue").ComputedRef<HTMLElement | undefined>;
|
|
13
|
+
visible: import("vue").WritableComputedRef<boolean, boolean>;
|
|
14
|
+
events: {
|
|
15
|
+
onCloseAutoFocus: (event: Event) => void;
|
|
16
|
+
onInteractOutside: (event: import("reka-ui").PointerDownOutsideEvent | import("reka-ui").FocusOutsideEvent) => void;
|
|
17
|
+
onPointerDownOutside: (event: import("reka-ui").PointerDownOutsideEvent) => void;
|
|
18
|
+
onFocusOutside: (event: import("reka-ui").FocusOutsideEvent) => void;
|
|
19
|
+
onEscapeKeyDown: (event: KeyboardEvent) => void;
|
|
20
|
+
onOpenAutoFocus?: ((event: Event) => void) | undefined;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=anchored-overlay.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchored-overlay.d.ts","sourceRoot":"","sources":["../../../src/lib/anchored-overlay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAyC,KAAK,GAAG,EAAE,MAAM,KAAK,CAAA;AACrE,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAA;AAEvD,wBAAgB,kBAAkB,CAChC,KAAK,EAAE;IAAE,MAAM,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;IAAC,KAAK,EAAE,OAAO,CAAA;CAAE,EACtD,IAAI,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC,EAC9B,IAAI,EAAE,CAAC,CAAC,SAAS,MAAM,wBAAwB,EAC7C,KAAK,EAAE,CAAC,EACR,GAAG,IAAI,EAAE,wBAAwB,CAAC,CAAC,CAAC,KACjC,IAAI,EACT,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI;;aAEJ,WAAW;;aAAX,WAAW;;;;;;;;;;;;EAiG9C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"caret.d.ts","sourceRoot":"","sources":["../../../src/lib/caret.ts"],"names":[],"mappings":"AAwBA
|
|
1
|
+
{"version":3,"file":"caret.d.ts","sourceRoot":"","sources":["../../../src/lib/caret.ts"],"names":[],"mappings":"AAwBA,wBAAgB,QAAQ,CAAC,IAAI,EAAE,mBAAmB,EAAE,EAAE,SAAoB,GAAG,MAAM,CAuBlF"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type ComponentPublicInstance } from 'vue';
|
|
1
2
|
export type CollapseAxis = 'y' | 'x';
|
|
2
3
|
export declare function collapseGapOf(parent: Element | null, axis?: CollapseAxis): string;
|
|
3
4
|
export declare function writeCollapseGap(el: Element, parent: Element | null, axis?: CollapseAxis): void;
|
|
@@ -11,4 +12,5 @@ export declare function useCollapseHooks(axis?: CollapseAxis): {
|
|
|
11
12
|
afterEnter: (el: Element) => void;
|
|
12
13
|
beforeLeave: (el: Element) => void;
|
|
13
14
|
};
|
|
15
|
+
export declare function useCollapseGap(): import("vue").ShallowRef<ComponentPublicInstance | null, ComponentPublicInstance | null>;
|
|
14
16
|
//# sourceMappingURL=collapse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"collapse.d.ts","sourceRoot":"","sources":["../../../src/lib/collapse.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"collapse.d.ts","sourceRoot":"","sources":["../../../src/lib/collapse.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,uBAAuB,EAC7B,MAAM,KAAK,CAAA;AAEZ,MAAM,MAAM,YAAY,GAAG,GAAG,GAAG,GAAG,CAAA;AAEpC,wBAAgB,aAAa,CAAC,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,GAAE,YAAkB,UAM7E;AAED,wBAAgB,gBAAgB,CAAC,EAAE,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI,EAAE,IAAI,GAAE,YAAkB,QAE7F;AAED,wBAAgB,aAAa,CAAC,IAAI,GAAE,YAAkB,EAAE,QAAQ,CAAC,EAAE,MAAM,OAAO,GAAG,IAAI;sBAC5D,OAAO;qBAQR,OAAO;sBAJN,OAAO;EASjC;AAED,wBAAgB,gBAAgB,CAAC,IAAI,GAAE,YAAkB;sBAf9B,OAAO;qBAQR,OAAO;sBAJN,OAAO;EAuBjC;AAED,wBAAgB,cAAc,6FAY7B"}
|
|
@@ -1,6 +1,2 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 点击输入面里非交互的部分(附属格、前后缀、空白)时把焦点交给最近的输入区,返回被聚焦的输入区;点击落在交互元素上或者没有可聚焦的输入区时返回 null。
|
|
3
|
-
* 点击所在的段自己含输入区时只认它、不动光标(段内的处理器已经定过位);否则先向后找,再向前找;落在点击位置之后的输入区把光标放到开头,之前的放到末尾。
|
|
4
|
-
*/
|
|
5
1
|
export declare function focusFieldFrom(root: HTMLElement, target: HTMLElement): HTMLInputElement | HTMLTextAreaElement | null;
|
|
6
2
|
//# sourceMappingURL=field-focus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"field-focus.d.ts","sourceRoot":"","sources":["../../../src/lib/field-focus.ts"],"names":[],"mappings":"AAUA
|
|
1
|
+
{"version":3,"file":"field-focus.d.ts","sourceRoot":"","sources":["../../../src/lib/field-focus.ts"],"names":[],"mappings":"AAUA,wBAAgB,cAAc,CAAC,IAAI,EAAE,WAAW,EAAE,MAAM,EAAE,WAAW,iDAyBpE"}
|
package/package.json
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { onBeforeUpdate, onMounted, shallowRef, type ComponentPublicInstance } from 'vue'
|
|
3
2
|
import { AccordionContent as RekaAccordionContent } from 'reka-ui'
|
|
4
3
|
import { cn } from '../../lib/cn'
|
|
5
|
-
import {
|
|
4
|
+
import { useCollapseGap } from '../../lib/collapse'
|
|
6
5
|
import { accordionContent } from './accordion.variants'
|
|
7
6
|
|
|
8
7
|
defineOptions({ name: 'HnAccordionContent' })
|
|
9
8
|
|
|
10
9
|
const props = defineProps<{ class?: string }>()
|
|
11
10
|
|
|
12
|
-
const content =
|
|
13
|
-
|
|
14
|
-
function measure() {
|
|
15
|
-
const el = content.value?.$el as Element | undefined
|
|
16
|
-
if (el instanceof Element) writeCollapseGap(el, el.parentElement)
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
onMounted(measure)
|
|
20
|
-
onBeforeUpdate(measure)
|
|
11
|
+
const content = useCollapseGap()
|
|
21
12
|
</script>
|
|
22
13
|
|
|
23
14
|
<template>
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { ref } from 'vue'
|
|
3
2
|
import {
|
|
4
3
|
AlertDialogCancel,
|
|
5
4
|
AlertDialogContent,
|
|
@@ -17,6 +16,14 @@
|
|
|
17
16
|
import { dialogCard, dialogWrapper } from '../dialog/dialog.variants'
|
|
18
17
|
import Heading from '../heading/Heading.vue'
|
|
19
18
|
import Text from '../text/Text.vue'
|
|
19
|
+
import { useAlertDialogConfirm } from './composables/useAlertDialogConfirm'
|
|
20
|
+
import { useConfirmDelay } from './composables/useConfirmDelay'
|
|
21
|
+
import {
|
|
22
|
+
alertDialogHeader,
|
|
23
|
+
alertDialogContent,
|
|
24
|
+
alertDialogActions,
|
|
25
|
+
alertDialogCountdown,
|
|
26
|
+
} from './alert-dialog.variants'
|
|
20
27
|
|
|
21
28
|
defineOptions({ name: 'HnAlertDialog' })
|
|
22
29
|
|
|
@@ -25,6 +32,7 @@
|
|
|
25
32
|
title: string
|
|
26
33
|
description?: string
|
|
27
34
|
confirmText?: string
|
|
35
|
+
confirmDelay?: number
|
|
28
36
|
cancelText?: string
|
|
29
37
|
tone?: 'accent' | 'danger'
|
|
30
38
|
size?: 'sm' | 'md'
|
|
@@ -32,31 +40,19 @@
|
|
|
32
40
|
onConfirm?: () => unknown
|
|
33
41
|
class?: string
|
|
34
42
|
}>(),
|
|
35
|
-
{ tone: 'accent', size: 'sm' },
|
|
43
|
+
{ tone: 'accent', size: 'sm', confirmDelay: 0 },
|
|
36
44
|
)
|
|
37
|
-
const emit = defineEmits<{ cancel: [] }>()
|
|
45
|
+
const emit = defineEmits<{ cancel: []; error: [error: unknown] }>()
|
|
38
46
|
|
|
39
47
|
const open = defineModel<boolean>('open')
|
|
40
|
-
const busy = ref(false)
|
|
41
48
|
const t = useUiLocale()
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const result = props.onConfirm?.()
|
|
50
|
-
if (result instanceof Promise) {
|
|
51
|
-
busy.value = true
|
|
52
|
-
try {
|
|
53
|
-
await result
|
|
54
|
-
} finally {
|
|
55
|
-
busy.value = false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
open.value = false
|
|
59
|
-
}
|
|
49
|
+
const remaining = useConfirmDelay(open, () => props.confirmDelay)
|
|
50
|
+
const { busy, guard, confirm } = useAlertDialogConfirm(
|
|
51
|
+
props,
|
|
52
|
+
open,
|
|
53
|
+
error => emit('error', error),
|
|
54
|
+
() => remaining.value > 0,
|
|
55
|
+
)
|
|
60
56
|
</script>
|
|
61
57
|
|
|
62
58
|
<template>
|
|
@@ -66,14 +62,7 @@
|
|
|
66
62
|
</AlertDialogTrigger>
|
|
67
63
|
<AlertDialogPortal>
|
|
68
64
|
<AlertDialogOverlay class="hn-scrim" />
|
|
69
|
-
<div
|
|
70
|
-
:class="
|
|
71
|
-
cn(
|
|
72
|
-
'pointer-events-none fixed inset-0 z-(--hn-z-overlay) grid',
|
|
73
|
-
dialogWrapper({ placement: props.placement ?? 'auto' }),
|
|
74
|
-
)
|
|
75
|
-
"
|
|
76
|
-
>
|
|
65
|
+
<div :class="dialogWrapper({ placement: props.placement ?? 'auto' })">
|
|
77
66
|
<AlertDialogContent as-child @escape-key-down="guard">
|
|
78
67
|
<Card
|
|
79
68
|
:padded="false"
|
|
@@ -81,14 +70,12 @@
|
|
|
81
70
|
:aria-busy="busy || undefined"
|
|
82
71
|
:class="
|
|
83
72
|
cn(
|
|
84
|
-
'pointer-events-auto flex w-full flex-col gap-4 shadow-lg outline-none',
|
|
85
|
-
'py-(--hn-panel-p)',
|
|
86
73
|
dialogCard({ placement: props.placement ?? 'auto', size: props.size }),
|
|
87
74
|
props.class,
|
|
88
75
|
)
|
|
89
76
|
"
|
|
90
77
|
>
|
|
91
|
-
<div class="
|
|
78
|
+
<div :class="alertDialogHeader()">
|
|
92
79
|
<AlertDialogTitle as-child>
|
|
93
80
|
<Heading :level="2" size="lg">{{ props.title }}</Heading>
|
|
94
81
|
</AlertDialogTitle>
|
|
@@ -96,17 +83,18 @@
|
|
|
96
83
|
<Text tone="muted">{{ props.description }}</Text>
|
|
97
84
|
</AlertDialogDescription>
|
|
98
85
|
</div>
|
|
99
|
-
<div v-if="$slots.content" class="
|
|
86
|
+
<div v-if="$slots.content" :class="alertDialogContent()">
|
|
100
87
|
<slot name="content" />
|
|
101
88
|
</div>
|
|
102
|
-
<div class="
|
|
89
|
+
<div :class="alertDialogActions()">
|
|
103
90
|
<AlertDialogCancel as-child>
|
|
104
91
|
<Button variant="soft" tone="neutral" :disabled="busy" @click="emit('cancel')">
|
|
105
92
|
{{ props.cancelText ?? t.common.cancel }}
|
|
106
93
|
</Button>
|
|
107
94
|
</AlertDialogCancel>
|
|
108
|
-
<Button :tone="props.tone" :loading="busy" @click="confirm">
|
|
95
|
+
<Button :tone="props.tone" :loading="busy" :disabled="remaining > 0" @click="confirm">
|
|
109
96
|
{{ props.confirmText ?? t.common.confirm }}
|
|
97
|
+
<span v-if="remaining > 0" :class="alertDialogCountdown()">({{ remaining }})</span>
|
|
110
98
|
</Button>
|
|
111
99
|
</div>
|
|
112
100
|
</Card>
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { tv } from '../../lib/tv'
|
|
2
|
+
|
|
3
|
+
export const alertDialogHeader = tv({
|
|
4
|
+
base: 'flex min-w-0 flex-col gap-1.5 px-(--hn-panel-p)',
|
|
5
|
+
})
|
|
6
|
+
|
|
7
|
+
export const alertDialogContent = tv({
|
|
8
|
+
base: 'px-(--hn-panel-p)',
|
|
9
|
+
})
|
|
10
|
+
|
|
11
|
+
export const alertDialogActions = tv({
|
|
12
|
+
base: 'flex justify-end gap-(--hn-inline-gap) px-(--hn-panel-p)',
|
|
13
|
+
})
|
|
14
|
+
|
|
15
|
+
export const alertDialogCountdown = tv({
|
|
16
|
+
base: 'tabular-nums',
|
|
17
|
+
})
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ref, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function useAlertDialogConfirm(
|
|
4
|
+
props: { onConfirm?: () => unknown },
|
|
5
|
+
open: Ref<boolean | undefined>,
|
|
6
|
+
onError: (error: unknown) => void,
|
|
7
|
+
blocked: () => boolean = () => false,
|
|
8
|
+
) {
|
|
9
|
+
const busy = ref(false)
|
|
10
|
+
|
|
11
|
+
function guard(event: Event) {
|
|
12
|
+
if (busy.value) event.preventDefault()
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
async function confirm() {
|
|
16
|
+
if (!open.value || busy.value || blocked()) return
|
|
17
|
+
busy.value = true
|
|
18
|
+
try {
|
|
19
|
+
await props.onConfirm?.()
|
|
20
|
+
open.value = false
|
|
21
|
+
} catch (error) {
|
|
22
|
+
onError(error)
|
|
23
|
+
} finally {
|
|
24
|
+
busy.value = false
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return { busy, guard, confirm }
|
|
29
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { onMounted, onScopeDispose, ref, watch, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
export function useConfirmDelay(open: Ref<boolean | undefined>, delay: () => number) {
|
|
4
|
+
const remaining = ref(0)
|
|
5
|
+
let mounted = false
|
|
6
|
+
let timer: ReturnType<typeof setTimeout> | undefined
|
|
7
|
+
|
|
8
|
+
function stop() {
|
|
9
|
+
clearTimeout(timer)
|
|
10
|
+
timer = undefined
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
function restart() {
|
|
14
|
+
stop()
|
|
15
|
+
if (!open.value) return
|
|
16
|
+
const seconds = Math.ceil(delay())
|
|
17
|
+
remaining.value = Number.isFinite(seconds) && seconds > 0 ? seconds : 0
|
|
18
|
+
if (!mounted || !remaining.value) return
|
|
19
|
+
|
|
20
|
+
const deadline = performance.now() + remaining.value * 1000
|
|
21
|
+
function tick() {
|
|
22
|
+
const milliseconds = deadline - performance.now()
|
|
23
|
+
remaining.value = Math.max(0, Math.ceil(milliseconds / 1000))
|
|
24
|
+
timer = remaining.value > 0 ? setTimeout(tick, Math.min(1000, milliseconds)) : undefined
|
|
25
|
+
}
|
|
26
|
+
tick()
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
watch([open, delay], restart, { immediate: true, flush: 'sync' })
|
|
30
|
+
onMounted(() => {
|
|
31
|
+
mounted = true
|
|
32
|
+
restart()
|
|
33
|
+
})
|
|
34
|
+
onScopeDispose(stop)
|
|
35
|
+
|
|
36
|
+
return remaining
|
|
37
|
+
}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed, useSlots
|
|
2
|
+
import { computed, useSlots } from 'vue'
|
|
3
3
|
import { cn } from '../../lib/cn'
|
|
4
4
|
import Avatar from './Avatar.vue'
|
|
5
|
+
import { flattenChildren } from './utils/children'
|
|
5
6
|
import type { AvatarVariants } from './avatar.variants'
|
|
6
7
|
import { avatarGroupItem } from './avatar-group.variants'
|
|
7
8
|
import { provideAvatarGroup } from './context'
|
|
@@ -16,13 +17,7 @@
|
|
|
16
17
|
|
|
17
18
|
const slots = useSlots()
|
|
18
19
|
|
|
19
|
-
|
|
20
|
-
return (nodes ?? []).flatMap(node =>
|
|
21
|
-
node.type === Fragment ? flatten(node.children as VNode[]) : [node],
|
|
22
|
-
)
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
const children = computed(() => flatten(slots.default?.()))
|
|
20
|
+
const children = computed(() => flattenChildren(slots.default?.()))
|
|
26
21
|
const visible = computed(() =>
|
|
27
22
|
props.max && props.max > 0 ? children.value.slice(0, props.max) : children.value,
|
|
28
23
|
)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
<script setup lang="ts">
|
|
1
|
+
<script setup lang="ts" generic="T extends SelectOption = SelectOption">
|
|
2
2
|
import { CheckboxGroupRoot } from 'reka-ui'
|
|
3
3
|
import { cn } from '../../lib/cn'
|
|
4
4
|
import { shieldFormField, useFieldControl } from '../form-field/context'
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
defineOptions({ name: 'HnCheckboxGroup' })
|
|
15
15
|
|
|
16
16
|
const props = defineProps<{
|
|
17
|
-
options:
|
|
17
|
+
options: T[]
|
|
18
18
|
orientation?: CheckboxGroupVariants['orientation']
|
|
19
19
|
size?: CheckboxVariants['size']
|
|
20
20
|
controlPlacement?: CheckboxVariants['controlPlacement']
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
})
|
|
33
33
|
shieldFormField()
|
|
34
34
|
|
|
35
|
-
defineSlots<{ option(props: { option:
|
|
35
|
+
defineSlots<{ option?(props: { option: T }): unknown }>()
|
|
36
36
|
</script>
|
|
37
37
|
|
|
38
38
|
<template>
|