@bitrix24/b24ui-nuxt 0.5.11 → 0.6.1
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/.nuxt/b24ui/advice.ts +10 -2
- package/.nuxt/b24ui/alert.ts +10 -2
- package/.nuxt/b24ui/avatar-group.ts +10 -2
- package/.nuxt/b24ui/avatar.ts +10 -2
- package/.nuxt/b24ui/badge.ts +10 -2
- package/.nuxt/b24ui/button-group.ts +10 -2
- package/.nuxt/b24ui/button.ts +16 -6
- package/.nuxt/b24ui/calendar.ts +10 -2
- package/.nuxt/b24ui/checkbox.ts +10 -2
- package/.nuxt/b24ui/chip.ts +10 -2
- package/.nuxt/b24ui/collapsible.ts +10 -2
- package/.nuxt/b24ui/container.ts +10 -2
- package/.nuxt/b24ui/countdown.ts +10 -2
- package/.nuxt/b24ui/description-list.ts +10 -2
- package/.nuxt/b24ui/dropdown-menu.ts +10 -2
- package/.nuxt/b24ui/form-field.ts +10 -2
- package/.nuxt/b24ui/form.ts +10 -2
- package/.nuxt/b24ui/input-menu.ts +12 -4
- package/.nuxt/b24ui/input-number.ts +10 -2
- package/.nuxt/b24ui/input.ts +10 -2
- package/.nuxt/b24ui/kbd.ts +10 -2
- package/.nuxt/b24ui/link.ts +10 -2
- package/.nuxt/b24ui/modal.ts +10 -2
- package/.nuxt/b24ui/navbar-divider.ts +10 -2
- package/.nuxt/b24ui/navbar-section.ts +10 -2
- package/.nuxt/b24ui/navbar-spacer.ts +10 -2
- package/.nuxt/b24ui/navbar.ts +10 -2
- package/.nuxt/b24ui/navigation-menu.ts +10 -2
- package/.nuxt/b24ui/popover.ts +10 -2
- package/.nuxt/b24ui/progress.ts +10 -2
- package/.nuxt/b24ui/radio-group.ts +10 -2
- package/.nuxt/b24ui/range.ts +10 -2
- package/.nuxt/b24ui/select-menu.ts +14 -6
- package/.nuxt/b24ui/select.ts +12 -4
- package/.nuxt/b24ui/separator.ts +10 -2
- package/.nuxt/b24ui/sidebar-body.ts +10 -2
- package/.nuxt/b24ui/sidebar-footer.ts +10 -2
- package/.nuxt/b24ui/sidebar-header.ts +10 -2
- package/.nuxt/b24ui/sidebar-heading.ts +10 -2
- package/.nuxt/b24ui/sidebar-layout.ts +10 -2
- package/.nuxt/b24ui/sidebar-section.ts +10 -2
- package/.nuxt/b24ui/sidebar-spacer.ts +10 -2
- package/.nuxt/b24ui/sidebar.ts +10 -2
- package/.nuxt/b24ui/skeleton.ts +10 -2
- package/.nuxt/b24ui/slideover.ts +10 -2
- package/.nuxt/b24ui/stacked-layout.ts +10 -2
- package/.nuxt/b24ui/switch.ts +10 -2
- package/.nuxt/b24ui/tabs.ts +10 -2
- package/.nuxt/b24ui/textarea.ts +10 -2
- package/.nuxt/b24ui/toast.ts +10 -2
- package/.nuxt/b24ui/toaster.ts +10 -2
- package/.nuxt/b24ui/tooltip.ts +10 -2
- package/cli/templates.mjs +19 -15
- package/dist/meta.d.mts +5675 -7513
- package/dist/meta.mjs +5675 -7513
- package/dist/module.json +3 -3
- package/dist/module.mjs +2 -2
- package/dist/runtime/components/Advice.vue +27 -55
- package/dist/runtime/components/Advice.vue.d.ts +56 -0
- package/dist/runtime/components/Alert.vue +35 -97
- package/dist/runtime/components/Alert.vue.d.ts +97 -0
- package/dist/runtime/components/App.vue +24 -34
- package/dist/runtime/components/App.vue.d.ts +23 -0
- package/dist/runtime/components/Avatar.vue +43 -82
- package/dist/runtime/components/Avatar.vue.d.ts +62 -0
- package/dist/runtime/components/AvatarGroup.vue +40 -77
- package/dist/runtime/components/AvatarGroup.vue.d.ts +40 -0
- package/dist/runtime/components/Badge.vue +40 -84
- package/dist/runtime/components/Badge.vue.d.ts +78 -0
- package/dist/runtime/components/Button.vue +107 -164
- package/dist/runtime/components/Button.vue.d.ts +115 -0
- package/dist/runtime/components/ButtonGroup.vue +25 -52
- package/dist/runtime/components/ButtonGroup.vue.d.ts +63 -0
- package/dist/runtime/components/Calendar.vue +73 -153
- package/dist/runtime/components/Calendar.vue.d.ts +107 -0
- package/dist/runtime/components/Checkbox.vue +42 -74
- package/dist/runtime/components/Checkbox.vue.d.ts +55 -0
- package/dist/runtime/components/Chip.vue +26 -75
- package/dist/runtime/components/Chip.vue.d.ts +77 -0
- package/dist/runtime/components/Collapsible.vue +22 -41
- package/dist/runtime/components/Collapsible.vue.d.ts +50 -0
- package/dist/runtime/components/Container.vue +15 -28
- package/dist/runtime/components/Container.vue.d.ts +27 -0
- package/dist/runtime/components/Countdown.vue +153 -379
- package/dist/runtime/components/Countdown.vue.d.ts +122 -0
- package/dist/runtime/components/DescriptionList.vue +78 -150
- package/dist/runtime/components/DescriptionList.vue.d.ts +109 -0
- package/dist/runtime/components/DropdownMenu.vue +38 -140
- package/dist/runtime/components/DropdownMenu.vue.d.ts +133 -0
- package/dist/runtime/components/DropdownMenuContent.vue +65 -79
- package/dist/runtime/components/DropdownMenuContent.vue.d.ts +51 -0
- package/dist/runtime/components/Form.vue +132 -218
- package/dist/runtime/components/Form.vue.d.ts +55 -0
- package/dist/runtime/components/FormField.vue +36 -81
- package/dist/runtime/components/FormField.vue.d.ts +73 -0
- package/dist/runtime/components/Input.vue +79 -180
- package/dist/runtime/components/Input.vue.d.ts +135 -0
- package/dist/runtime/components/InputMenu.vue +185 -382
- package/dist/runtime/components/InputMenu.vue.d.ts +357 -0
- package/dist/runtime/components/InputNumber.vue +77 -176
- package/dist/runtime/components/InputNumber.vue.d.ts +238 -0
- package/dist/runtime/components/Kbd.vue +20 -46
- package/dist/runtime/components/Kbd.vue.d.ts +55 -0
- package/dist/runtime/components/Link.vue +99 -179
- package/dist/runtime/components/Link.vue.d.ts +129 -0
- package/dist/runtime/components/LinkBase.vue +33 -42
- package/dist/runtime/components/LinkBase.vue.d.ts +48 -0
- package/dist/runtime/components/Modal.vue +48 -128
- package/dist/runtime/components/Modal.vue.d.ts +124 -0
- package/dist/runtime/components/ModalDialogClose.vue +5 -8
- package/dist/runtime/components/ModalDialogClose.vue.d.ts +10 -0
- package/dist/runtime/components/Navbar.vue +15 -33
- package/dist/runtime/components/Navbar.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarDivider.vue +15 -33
- package/dist/runtime/components/NavbarDivider.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSection.vue +15 -33
- package/dist/runtime/components/NavbarSection.vue.d.ts +46 -0
- package/dist/runtime/components/NavbarSpacer.vue +15 -33
- package/dist/runtime/components/NavbarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/NavigationMenu.vue +74 -209
- package/dist/runtime/components/NavigationMenu.vue.d.ts +159 -0
- package/dist/runtime/components/OverlayProvider.vue +14 -18
- package/dist/runtime/components/OverlayProvider.vue.d.ts +2 -0
- package/dist/runtime/components/Popover.vue +40 -82
- package/dist/runtime/components/Popover.vue.d.ts +79 -0
- package/dist/runtime/components/Progress.vue +70 -137
- package/dist/runtime/components/Progress.vue.d.ts +103 -0
- package/dist/runtime/components/RadioGroup.vue +59 -135
- package/dist/runtime/components/RadioGroup.vue.d.ts +88 -0
- package/dist/runtime/components/Range.vue +46 -86
- package/dist/runtime/components/Range.vue.d.ts +73 -0
- package/dist/runtime/components/Select.vue +110 -261
- package/dist/runtime/components/Select.vue.d.ts +170 -0
- package/dist/runtime/components/SelectMenu.vue +161 -348
- package/dist/runtime/components/SelectMenu.vue.d.ts +217 -0
- package/dist/runtime/components/Separator.vue +28 -72
- package/dist/runtime/components/Separator.vue.d.ts +77 -0
- package/dist/runtime/components/Sidebar.vue +15 -33
- package/dist/runtime/components/Sidebar.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarBody.vue +17 -39
- package/dist/runtime/components/SidebarBody.vue.d.ts +53 -0
- package/dist/runtime/components/SidebarFooter.vue +15 -33
- package/dist/runtime/components/SidebarFooter.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeader.vue +15 -33
- package/dist/runtime/components/SidebarHeader.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarHeading.vue +15 -33
- package/dist/runtime/components/SidebarHeading.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarLayout.vue +34 -71
- package/dist/runtime/components/SidebarLayout.vue.d.ts +65 -0
- package/dist/runtime/components/SidebarSection.vue +15 -33
- package/dist/runtime/components/SidebarSection.vue.d.ts +46 -0
- package/dist/runtime/components/SidebarSpacer.vue +15 -33
- package/dist/runtime/components/SidebarSpacer.vue.d.ts +46 -0
- package/dist/runtime/components/Skeleton.vue +14 -23
- package/dist/runtime/components/Skeleton.vue.d.ts +26 -0
- package/dist/runtime/components/Slideover.vue +50 -132
- package/dist/runtime/components/Slideover.vue.d.ts +127 -0
- package/dist/runtime/components/StackedLayout.vue +34 -74
- package/dist/runtime/components/StackedLayout.vue.d.ts +65 -0
- package/dist/runtime/components/Switch.vue +46 -96
- package/dist/runtime/components/Switch.vue.d.ts +77 -0
- package/dist/runtime/components/Tabs.vue +41 -106
- package/dist/runtime/components/Tabs.vue.d.ts +104 -0
- package/dist/runtime/components/Textarea.vue +92 -202
- package/dist/runtime/components/Textarea.vue.d.ts +141 -0
- package/dist/runtime/components/Toast.vue +47 -106
- package/dist/runtime/components/Toast.vue.d.ts +95 -0
- package/dist/runtime/components/Toaster.vue +70 -116
- package/dist/runtime/components/Toaster.vue.d.ts +70 -0
- package/dist/runtime/components/Tooltip.vue +36 -65
- package/dist/runtime/components/Tooltip.vue.d.ts +65 -0
- package/dist/runtime/components/content/TableWrapper.vue +24 -71
- package/dist/runtime/components/content/TableWrapper.vue.d.ts +83 -0
- package/dist/runtime/composables/useAvatarGroup.d.ts +1 -1
- package/dist/runtime/composables/useButtonGroup.d.ts +2 -2
- package/dist/runtime/composables/useComponentIcons.d.ts +3 -3
- package/dist/runtime/composables/useFormField.d.ts +2 -2
- package/dist/runtime/composables/useOverlay.d.ts +14 -7
- package/dist/runtime/composables/useOverlay.js +14 -6
- package/dist/runtime/prose/A.vue +16 -26
- package/dist/runtime/prose/A.vue.d.ts +27 -0
- package/dist/runtime/prose/Blockquote.vue +14 -26
- package/dist/runtime/prose/Blockquote.vue.d.ts +27 -0
- package/dist/runtime/prose/Code.vue +15 -32
- package/dist/runtime/prose/Code.vue.d.ts +31 -0
- package/dist/runtime/prose/Em.vue +16 -26
- package/dist/runtime/prose/Em.vue.d.ts +27 -0
- package/dist/runtime/prose/H1.vue +14 -26
- package/dist/runtime/prose/H1.vue.d.ts +27 -0
- package/dist/runtime/prose/H2.vue +14 -26
- package/dist/runtime/prose/H2.vue.d.ts +27 -0
- package/dist/runtime/prose/H3.vue +14 -26
- package/dist/runtime/prose/H3.vue.d.ts +27 -0
- package/dist/runtime/prose/H4.vue +14 -26
- package/dist/runtime/prose/H4.vue.d.ts +27 -0
- package/dist/runtime/prose/H5.vue +14 -26
- package/dist/runtime/prose/H5.vue.d.ts +27 -0
- package/dist/runtime/prose/H6.vue +14 -26
- package/dist/runtime/prose/H6.vue.d.ts +27 -0
- package/dist/runtime/prose/Hr.vue +13 -22
- package/dist/runtime/prose/Hr.vue.d.ts +19 -0
- package/dist/runtime/prose/Img.vue +13 -26
- package/dist/runtime/prose/Img.vue.d.ts +19 -0
- package/dist/runtime/prose/Li.vue +14 -26
- package/dist/runtime/prose/Li.vue.d.ts +27 -0
- package/dist/runtime/prose/Ol.vue +14 -26
- package/dist/runtime/prose/Ol.vue.d.ts +27 -0
- package/dist/runtime/prose/P.vue +14 -26
- package/dist/runtime/prose/P.vue.d.ts +27 -0
- package/dist/runtime/prose/Pre.vue +17 -33
- package/dist/runtime/prose/Pre.vue.d.ts +47 -0
- package/dist/runtime/prose/Strong.vue +14 -26
- package/dist/runtime/prose/Strong.vue.d.ts +27 -0
- package/dist/runtime/prose/Table.vue +21 -57
- package/dist/runtime/prose/Table.vue.d.ts +74 -0
- package/dist/runtime/prose/Tbody.vue +14 -26
- package/dist/runtime/prose/Tbody.vue.d.ts +27 -0
- package/dist/runtime/prose/Td.vue +14 -26
- package/dist/runtime/prose/Td.vue.d.ts +27 -0
- package/dist/runtime/prose/Th.vue +14 -26
- package/dist/runtime/prose/Th.vue.d.ts +27 -0
- package/dist/runtime/prose/Thead.vue +14 -26
- package/dist/runtime/prose/Thead.vue.d.ts +27 -0
- package/dist/runtime/prose/Tr.vue +14 -26
- package/dist/runtime/prose/Tr.vue.d.ts +27 -0
- package/dist/runtime/prose/Ul.vue +14 -26
- package/dist/runtime/prose/Ul.vue.d.ts +27 -0
- package/dist/runtime/types/form.d.ts +1 -0
- package/dist/runtime/types/utils.d.ts +42 -3
- package/dist/runtime/utils/link.d.ts +3 -3
- package/dist/runtime/utils/tv.js +2 -2
- package/dist/runtime/vue/components/Link.vue +122 -208
- package/dist/runtime/vue/components/Link.vue.d.ts +129 -0
- package/dist/shared/{b24ui-nuxt.CS9Lf0os.mjs → b24ui-nuxt.wBs9vEU5.mjs} +33 -8
- package/dist/types.d.mts +3 -5
- package/dist/unplugin.mjs +1 -1
- package/dist/vite.mjs +1 -1
- package/package.json +19 -27
- package/dist/meta.cjs +0 -72112
- package/dist/meta.d.cts +0 -72110
- package/dist/meta.d.ts +0 -72110
- package/dist/module.cjs +0 -63
- package/dist/module.d.cts +0 -15
- package/dist/module.d.ts +0 -15
- package/dist/shared/b24ui-nuxt.DrKwIWoc.cjs +0 -7721
- package/dist/types.d.ts +0 -7
- package/dist/unplugin.cjs +0 -236
- package/dist/unplugin.d.cts +0 -33
- package/dist/unplugin.d.ts +0 -33
- package/dist/vite.cjs +0 -21
- package/dist/vite.d.cts +0 -14
- package/dist/vite.d.ts +0 -14
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
2
|
+
import theme from '#build/b24ui/form-field';
|
|
3
|
+
import type { ComponentConfig } from '../types/utils';
|
|
4
|
+
type FormField = ComponentConfig<typeof theme, AppConfig, 'formField'>;
|
|
5
|
+
export interface FormFieldProps {
|
|
6
|
+
/**
|
|
7
|
+
* The element or component this component should render as.
|
|
8
|
+
* @defaultValue 'div'
|
|
9
|
+
*/
|
|
10
|
+
as?: any;
|
|
11
|
+
/** The name of the FormField. Also used to match form errors. */
|
|
12
|
+
name?: string;
|
|
13
|
+
/** A regular expression to match form error names. */
|
|
14
|
+
errorPattern?: RegExp;
|
|
15
|
+
label?: string;
|
|
16
|
+
description?: string;
|
|
17
|
+
help?: string;
|
|
18
|
+
error?: string | boolean;
|
|
19
|
+
hint?: string;
|
|
20
|
+
/**
|
|
21
|
+
* @defaultValue 'md'
|
|
22
|
+
*/
|
|
23
|
+
size?: FormField['variants']['size'];
|
|
24
|
+
/**
|
|
25
|
+
* @defaultValue false
|
|
26
|
+
*/
|
|
27
|
+
required?: boolean;
|
|
28
|
+
/** If true, validation on input will be active immediately instead of waiting for a blur event. */
|
|
29
|
+
eagerValidation?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* Delay in milliseconds before validating the form on input events.
|
|
32
|
+
* @defaultValue `300`
|
|
33
|
+
*/
|
|
34
|
+
validateOnInputDelay?: number;
|
|
35
|
+
class?: any;
|
|
36
|
+
b24ui?: FormField['slots'];
|
|
37
|
+
}
|
|
38
|
+
export interface FormFieldSlots {
|
|
39
|
+
label(props: {
|
|
40
|
+
label?: string;
|
|
41
|
+
}): any;
|
|
42
|
+
hint(props: {
|
|
43
|
+
hint?: string;
|
|
44
|
+
}): any;
|
|
45
|
+
description(props: {
|
|
46
|
+
description?: string;
|
|
47
|
+
}): any;
|
|
48
|
+
help(props: {
|
|
49
|
+
help?: string;
|
|
50
|
+
}): any;
|
|
51
|
+
error(props: {
|
|
52
|
+
error?: string | boolean;
|
|
53
|
+
}): any;
|
|
54
|
+
default(props: {
|
|
55
|
+
error?: string | boolean;
|
|
56
|
+
}): any;
|
|
57
|
+
}
|
|
58
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<FormFieldProps>>, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_TypePropsToOption<FormFieldProps>>> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<FormFieldSlots> & FormFieldSlots>;
|
|
59
|
+
export default _default;
|
|
60
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
61
|
+
type __VLS_TypePropsToOption<T> = {
|
|
62
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
63
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
64
|
+
} : {
|
|
65
|
+
type: import('vue').PropType<T[K]>;
|
|
66
|
+
required: true;
|
|
67
|
+
};
|
|
68
|
+
};
|
|
69
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
70
|
+
new (): {
|
|
71
|
+
$slots: S;
|
|
72
|
+
};
|
|
73
|
+
};
|
|
@@ -1,144 +1,59 @@
|
|
|
1
|
-
<script
|
|
2
|
-
import
|
|
3
|
-
import type { VariantProps } from 'tailwind-variants'
|
|
4
|
-
import type { AppConfig } from '@nuxt/schema'
|
|
5
|
-
import _appConfig from '#build/app.config'
|
|
6
|
-
import theme from '#build/b24ui/input'
|
|
7
|
-
import type { UseComponentIconsProps } from '../composables/useComponentIcons'
|
|
8
|
-
import { tv } from '../utils/tv'
|
|
9
|
-
import type { AvatarProps } from '../types'
|
|
10
|
-
import type { PartialString } from '../types/utils'
|
|
11
|
-
|
|
12
|
-
const appConfigInput = _appConfig as AppConfig & { b24ui: { input: Partial<typeof theme> } }
|
|
13
|
-
|
|
14
|
-
const input = tv({ extend: tv(theme), ...(appConfigInput.b24ui?.input || {}) })
|
|
15
|
-
|
|
16
|
-
type InputVariants = VariantProps<typeof input>
|
|
17
|
-
|
|
18
|
-
export interface InputProps extends UseComponentIconsProps {
|
|
19
|
-
/**
|
|
20
|
-
* The element or component this component should render as.
|
|
21
|
-
* @defaultValue 'div'
|
|
22
|
-
*/
|
|
23
|
-
as?: any
|
|
24
|
-
id?: string
|
|
25
|
-
name?: string
|
|
26
|
-
/**
|
|
27
|
-
* @defaultValue 'text'
|
|
28
|
-
*/
|
|
29
|
-
type?: InputHTMLAttributes['type']
|
|
30
|
-
/**
|
|
31
|
-
* The placeholder text when the input is empty.
|
|
32
|
-
*/
|
|
33
|
-
placeholder?: string
|
|
34
|
-
/**
|
|
35
|
-
* @defaultValue 'primary'
|
|
36
|
-
*/
|
|
37
|
-
color?: InputVariants['color']
|
|
38
|
-
/**
|
|
39
|
-
* @defaultValue 'md'
|
|
40
|
-
*/
|
|
41
|
-
size?: InputVariants['size']
|
|
42
|
-
/**
|
|
43
|
-
* Removes padding from input
|
|
44
|
-
* @defaultValue false
|
|
45
|
-
*/
|
|
46
|
-
noPadding?: boolean
|
|
47
|
-
/**
|
|
48
|
-
* Removes all borders (rings)
|
|
49
|
-
* @defaultValue false
|
|
50
|
-
*/
|
|
51
|
-
noBorder?: boolean
|
|
52
|
-
/**
|
|
53
|
-
* Removes all borders (rings) except the bottom one
|
|
54
|
-
* @defaultValue false
|
|
55
|
-
*/
|
|
56
|
-
underline?: boolean
|
|
57
|
-
/**
|
|
58
|
-
* Rounds the corners of the button
|
|
59
|
-
* @defaultValue false
|
|
60
|
-
*/
|
|
61
|
-
rounded?: boolean
|
|
62
|
-
/**
|
|
63
|
-
* @defaultValue false
|
|
64
|
-
*/
|
|
65
|
-
required?: boolean
|
|
66
|
-
/**
|
|
67
|
-
* @defaultValue 'off'
|
|
68
|
-
*/
|
|
69
|
-
autocomplete?: InputHTMLAttributes['autocomplete']
|
|
70
|
-
/**
|
|
71
|
-
* @defaultValue false
|
|
72
|
-
*/
|
|
73
|
-
autofocus?: boolean
|
|
74
|
-
/**
|
|
75
|
-
* @defaultValue 0
|
|
76
|
-
*/
|
|
77
|
-
autofocusDelay?: number
|
|
78
|
-
/**
|
|
79
|
-
* @defaultValue false
|
|
80
|
-
*/
|
|
81
|
-
disabled?: boolean
|
|
82
|
-
tag?: string
|
|
83
|
-
/**
|
|
84
|
-
* @defaultValue 'primary'
|
|
85
|
-
*/
|
|
86
|
-
tagColor?: InputVariants['tagColor']
|
|
87
|
-
/**
|
|
88
|
-
* Highlight the ring color like a focus state
|
|
89
|
-
* @defaultValue false
|
|
90
|
-
*/
|
|
91
|
-
highlight?: boolean
|
|
92
|
-
class?: any
|
|
93
|
-
b24ui?: PartialString<typeof input.slots>
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
export interface InputEmits {
|
|
97
|
-
(e: 'update:modelValue', payload: string | number): void
|
|
98
|
-
(e: 'blur', event: FocusEvent): void
|
|
99
|
-
(e: 'change', event: Event): void
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
export interface InputSlots {
|
|
103
|
-
leading(props?: {}): any
|
|
104
|
-
default(props?: {}): any
|
|
105
|
-
trailing(props?: {}): any
|
|
106
|
-
}
|
|
1
|
+
<script>
|
|
2
|
+
import theme from "#build/b24ui/input";
|
|
107
3
|
</script>
|
|
108
4
|
|
|
109
|
-
<script setup
|
|
110
|
-
import { ref, computed, onMounted } from
|
|
111
|
-
import { Primitive } from
|
|
112
|
-
import {
|
|
113
|
-
import {
|
|
114
|
-
import {
|
|
115
|
-
import {
|
|
116
|
-
import
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
const props =
|
|
121
|
-
type:
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
5
|
+
<script setup>
|
|
6
|
+
import { ref, computed, onMounted } from "vue";
|
|
7
|
+
import { Primitive } from "reka-ui";
|
|
8
|
+
import { useAppConfig } from "#imports";
|
|
9
|
+
import { useButtonGroup } from "../composables/useButtonGroup";
|
|
10
|
+
import { useComponentIcons } from "../composables/useComponentIcons";
|
|
11
|
+
import { useFormField } from "../composables/useFormField";
|
|
12
|
+
import { looseToNumber } from "../utils";
|
|
13
|
+
import { tv } from "../utils/tv";
|
|
14
|
+
import B24Avatar from "./Avatar.vue";
|
|
15
|
+
defineOptions({ inheritAttrs: false });
|
|
16
|
+
const props = defineProps({
|
|
17
|
+
as: { type: null, required: false },
|
|
18
|
+
id: { type: String, required: false },
|
|
19
|
+
name: { type: String, required: false },
|
|
20
|
+
type: { type: null, required: false, default: "text" },
|
|
21
|
+
placeholder: { type: String, required: false },
|
|
22
|
+
color: { type: null, required: false },
|
|
23
|
+
size: { type: null, required: false },
|
|
24
|
+
noPadding: { type: Boolean, required: false },
|
|
25
|
+
noBorder: { type: Boolean, required: false },
|
|
26
|
+
underline: { type: Boolean, required: false },
|
|
27
|
+
rounded: { type: Boolean, required: false },
|
|
28
|
+
required: { type: Boolean, required: false },
|
|
29
|
+
autocomplete: { type: null, required: false, default: "off" },
|
|
30
|
+
autofocus: { type: Boolean, required: false },
|
|
31
|
+
autofocusDelay: { type: Number, required: false, default: 0 },
|
|
32
|
+
disabled: { type: Boolean, required: false },
|
|
33
|
+
tag: { type: String, required: false },
|
|
34
|
+
tagColor: { type: null, required: false },
|
|
35
|
+
highlight: { type: Boolean, required: false },
|
|
36
|
+
class: { type: null, required: false },
|
|
37
|
+
b24ui: { type: null, required: false },
|
|
38
|
+
icon: { type: [Function, Object], required: false },
|
|
39
|
+
avatar: { type: Object, required: false },
|
|
40
|
+
loading: { type: Boolean, required: false },
|
|
41
|
+
trailing: { type: Boolean, required: false },
|
|
42
|
+
trailingIcon: { type: [Function, Object], required: false }
|
|
43
|
+
});
|
|
44
|
+
const emits = defineEmits(["update:modelValue", "blur", "change"]);
|
|
45
|
+
const slots = defineSlots();
|
|
46
|
+
const [modelValue, modelModifiers] = defineModel({ type: [String, Number, null] });
|
|
47
|
+
const appConfig = useAppConfig();
|
|
48
|
+
const { emitFormBlur, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, emitFormFocus, ariaAttrs } = useFormField(props, { deferInputValidation: true });
|
|
49
|
+
const { orientation, size: buttonGroupSize } = useButtonGroup(props);
|
|
50
|
+
const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
|
|
51
|
+
const inputSize = computed(() => buttonGroupSize.value || formGroupSize.value);
|
|
136
52
|
const isTag = computed(() => {
|
|
137
|
-
return props.tag
|
|
138
|
-
})
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
type: props.type as InputVariants['type'],
|
|
53
|
+
return props.tag;
|
|
54
|
+
});
|
|
55
|
+
const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.input || {} })({
|
|
56
|
+
type: props.type,
|
|
142
57
|
color: color.value,
|
|
143
58
|
size: inputSize?.value,
|
|
144
59
|
loading: props.loading,
|
|
@@ -151,70 +66,54 @@ const b24ui = computed(() => input({
|
|
|
151
66
|
leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
|
|
152
67
|
trailing: Boolean(isTrailing.value || !!slots.trailing),
|
|
153
68
|
buttonGroup: orientation.value
|
|
154
|
-
}))
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// Custom function to handle the v-model properties
|
|
159
|
-
function updateInput(value: string | null) {
|
|
69
|
+
}));
|
|
70
|
+
const inputRef = ref(null);
|
|
71
|
+
function updateInput(value) {
|
|
160
72
|
if (modelModifiers.trim) {
|
|
161
|
-
value = value?.trim() ?? null
|
|
73
|
+
value = value?.trim() ?? null;
|
|
162
74
|
}
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
value = looseToNumber(value)
|
|
75
|
+
if (modelModifiers.number || props.type === "number") {
|
|
76
|
+
value = looseToNumber(value);
|
|
166
77
|
}
|
|
167
|
-
|
|
168
78
|
if (modelModifiers.nullify) {
|
|
169
|
-
value ||= null
|
|
79
|
+
value ||= null;
|
|
170
80
|
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
emitFormInput()
|
|
81
|
+
modelValue.value = value;
|
|
82
|
+
emitFormInput();
|
|
174
83
|
}
|
|
175
|
-
|
|
176
|
-
function onInput(event: Event) {
|
|
84
|
+
function onInput(event) {
|
|
177
85
|
if (!modelModifiers.lazy) {
|
|
178
|
-
updateInput(
|
|
86
|
+
updateInput(event.target.value);
|
|
179
87
|
}
|
|
180
88
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
const value = (event.target as HTMLInputElement).value
|
|
184
|
-
|
|
89
|
+
function onChange(event) {
|
|
90
|
+
const value = event.target.value;
|
|
185
91
|
if (modelModifiers.lazy) {
|
|
186
|
-
updateInput(value)
|
|
92
|
+
updateInput(value);
|
|
187
93
|
}
|
|
188
|
-
|
|
189
|
-
// Update trimmed input so that it has same behavior as native input https://github.com/vuejs/core/blob/5ea8a8a4fab4e19a71e123e4d27d051f5e927172/packages/runtime-dom/src/directives/vModel.ts#L63
|
|
190
94
|
if (modelModifiers.trim) {
|
|
191
|
-
|
|
95
|
+
event.target.value = value.trim();
|
|
192
96
|
}
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
emits('change', event)
|
|
97
|
+
emitFormChange();
|
|
98
|
+
emits("change", event);
|
|
196
99
|
}
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
emits('blur', event)
|
|
100
|
+
function onBlur(event) {
|
|
101
|
+
emitFormBlur();
|
|
102
|
+
emits("blur", event);
|
|
201
103
|
}
|
|
202
|
-
|
|
203
104
|
function autoFocus() {
|
|
204
105
|
if (props.autofocus) {
|
|
205
|
-
inputRef.value?.focus()
|
|
106
|
+
inputRef.value?.focus();
|
|
206
107
|
}
|
|
207
108
|
}
|
|
208
|
-
|
|
209
109
|
onMounted(() => {
|
|
210
110
|
setTimeout(() => {
|
|
211
|
-
autoFocus()
|
|
212
|
-
}, props.autofocusDelay)
|
|
213
|
-
})
|
|
214
|
-
|
|
111
|
+
autoFocus();
|
|
112
|
+
}, props.autofocusDelay);
|
|
113
|
+
});
|
|
215
114
|
defineExpose({
|
|
216
115
|
inputRef
|
|
217
|
-
})
|
|
116
|
+
});
|
|
218
117
|
</script>
|
|
219
118
|
|
|
220
119
|
<template>
|
|
@@ -252,7 +151,7 @@ defineExpose({
|
|
|
252
151
|
/>
|
|
253
152
|
<B24Avatar
|
|
254
153
|
v-else-if="!!avatar"
|
|
255
|
-
:size="
|
|
154
|
+
:size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()"
|
|
256
155
|
v-bind="avatar"
|
|
257
156
|
:class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
|
|
258
157
|
/>
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import type { InputHTMLAttributes } from 'vue';
|
|
2
|
+
import type { AppConfig } from '@nuxt/schema';
|
|
3
|
+
import theme from '#build/b24ui/input';
|
|
4
|
+
import type { UseComponentIconsProps } from '../composables/useComponentIcons';
|
|
5
|
+
import type { ComponentConfig } from '../types/utils';
|
|
6
|
+
type Input = ComponentConfig<typeof theme, AppConfig, 'input'>;
|
|
7
|
+
export interface InputProps extends UseComponentIconsProps {
|
|
8
|
+
/**
|
|
9
|
+
* The element or component this component should render as.
|
|
10
|
+
* @defaultValue 'div'
|
|
11
|
+
*/
|
|
12
|
+
as?: any;
|
|
13
|
+
id?: string;
|
|
14
|
+
name?: string;
|
|
15
|
+
/**
|
|
16
|
+
* @defaultValue 'text'
|
|
17
|
+
*/
|
|
18
|
+
type?: InputHTMLAttributes['type'];
|
|
19
|
+
/**
|
|
20
|
+
* The placeholder text when the input is empty.
|
|
21
|
+
*/
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
/**
|
|
24
|
+
* @defaultValue 'primary'
|
|
25
|
+
*/
|
|
26
|
+
color?: Input['variants']['color'];
|
|
27
|
+
/**
|
|
28
|
+
* @defaultValue 'md'
|
|
29
|
+
*/
|
|
30
|
+
size?: Input['variants']['size'];
|
|
31
|
+
/**
|
|
32
|
+
* Removes padding from input
|
|
33
|
+
* @defaultValue false
|
|
34
|
+
*/
|
|
35
|
+
noPadding?: boolean;
|
|
36
|
+
/**
|
|
37
|
+
* Removes all borders (rings)
|
|
38
|
+
* @defaultValue false
|
|
39
|
+
*/
|
|
40
|
+
noBorder?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Removes all borders (rings) except the bottom one
|
|
43
|
+
* @defaultValue false
|
|
44
|
+
*/
|
|
45
|
+
underline?: boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Rounds the corners of the button
|
|
48
|
+
* @defaultValue false
|
|
49
|
+
*/
|
|
50
|
+
rounded?: boolean;
|
|
51
|
+
/**
|
|
52
|
+
* @defaultValue false
|
|
53
|
+
*/
|
|
54
|
+
required?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* @defaultValue 'off'
|
|
57
|
+
*/
|
|
58
|
+
autocomplete?: InputHTMLAttributes['autocomplete'];
|
|
59
|
+
/**
|
|
60
|
+
* @defaultValue false
|
|
61
|
+
*/
|
|
62
|
+
autofocus?: boolean;
|
|
63
|
+
/**
|
|
64
|
+
* @defaultValue 0
|
|
65
|
+
*/
|
|
66
|
+
autofocusDelay?: number;
|
|
67
|
+
/**
|
|
68
|
+
* @defaultValue false
|
|
69
|
+
*/
|
|
70
|
+
disabled?: boolean;
|
|
71
|
+
tag?: string;
|
|
72
|
+
/**
|
|
73
|
+
* @defaultValue 'primary'
|
|
74
|
+
*/
|
|
75
|
+
tagColor?: Input['variants']['tagColor'];
|
|
76
|
+
/**
|
|
77
|
+
* Highlight the ring color like a focus state
|
|
78
|
+
* @defaultValue false
|
|
79
|
+
*/
|
|
80
|
+
highlight?: boolean;
|
|
81
|
+
class?: any;
|
|
82
|
+
b24ui?: Input['slots'];
|
|
83
|
+
}
|
|
84
|
+
export interface InputEmits {
|
|
85
|
+
(e: 'update:modelValue', payload: string | number): void;
|
|
86
|
+
(e: 'blur', event: FocusEvent): void;
|
|
87
|
+
(e: 'change', event: Event): void;
|
|
88
|
+
}
|
|
89
|
+
export interface InputSlots {
|
|
90
|
+
leading(props?: {}): any;
|
|
91
|
+
default(props?: {}): any;
|
|
92
|
+
trailing(props?: {}): any;
|
|
93
|
+
}
|
|
94
|
+
declare const _default: __VLS_WithTemplateSlots<import("vue").DefineComponent<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
95
|
+
modelValue?: string | number | null;
|
|
96
|
+
} & InputProps>, {
|
|
97
|
+
type: string;
|
|
98
|
+
autocomplete: string;
|
|
99
|
+
autofocusDelay: number;
|
|
100
|
+
}>>, {
|
|
101
|
+
inputRef: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
|
|
102
|
+
}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<__VLS_WithDefaults<__VLS_TypePropsToOption<{
|
|
103
|
+
modelValue?: string | number | null;
|
|
104
|
+
} & InputProps>, {
|
|
105
|
+
type: string;
|
|
106
|
+
autocomplete: string;
|
|
107
|
+
autofocusDelay: number;
|
|
108
|
+
}>>> & Readonly<{}>, {
|
|
109
|
+
type: import("vue").InputTypeHTMLAttribute;
|
|
110
|
+
autocomplete: string;
|
|
111
|
+
autofocusDelay: number;
|
|
112
|
+
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>, Readonly<InputSlots> & InputSlots>;
|
|
113
|
+
export default _default;
|
|
114
|
+
type __VLS_WithDefaults<P, D> = {
|
|
115
|
+
[K in keyof Pick<P, keyof P>]: K extends keyof D ? __VLS_PrettifyLocal<P[K] & {
|
|
116
|
+
default: D[K];
|
|
117
|
+
}> : P[K];
|
|
118
|
+
};
|
|
119
|
+
type __VLS_NonUndefinedable<T> = T extends undefined ? never : T;
|
|
120
|
+
type __VLS_TypePropsToOption<T> = {
|
|
121
|
+
[K in keyof T]-?: {} extends Pick<T, K> ? {
|
|
122
|
+
type: import('vue').PropType<__VLS_NonUndefinedable<T[K]>>;
|
|
123
|
+
} : {
|
|
124
|
+
type: import('vue').PropType<T[K]>;
|
|
125
|
+
required: true;
|
|
126
|
+
};
|
|
127
|
+
};
|
|
128
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
129
|
+
new (): {
|
|
130
|
+
$slots: S;
|
|
131
|
+
};
|
|
132
|
+
};
|
|
133
|
+
type __VLS_PrettifyLocal<T> = {
|
|
134
|
+
[K in keyof T]: T[K];
|
|
135
|
+
} & {};
|