@bitrix24/b24ui-nuxt 2.0.9 → 2.1.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.
Files changed (143) hide show
  1. package/dist/meta.d.mts +79556 -44766
  2. package/dist/meta.mjs +79556 -44766
  3. package/dist/module.json +1 -1
  4. package/dist/module.mjs +3 -3
  5. package/dist/runtime/components/App.d.vue.ts +1 -1
  6. package/dist/runtime/components/App.vue +2 -1
  7. package/dist/runtime/components/App.vue.d.ts +1 -1
  8. package/dist/runtime/components/Avatar.d.vue.ts +2 -1
  9. package/dist/runtime/components/Avatar.vue.d.ts +2 -1
  10. package/dist/runtime/components/Button.vue +1 -0
  11. package/dist/runtime/components/Calendar.vue +1 -3
  12. package/dist/runtime/components/ChatPrompt.d.vue.ts +2 -2
  13. package/dist/runtime/components/ChatPrompt.vue +5 -5
  14. package/dist/runtime/components/ChatPrompt.vue.d.ts +2 -2
  15. package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +5 -5
  16. package/dist/runtime/components/ChatPromptSubmit.vue +53 -4
  17. package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +5 -5
  18. package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
  19. package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
  20. package/dist/runtime/components/CommandPalette.vue +5 -4
  21. package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -6
  22. package/dist/runtime/components/DashboardSearch.vue +2 -3
  23. package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -6
  24. package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -3
  25. package/dist/runtime/components/DashboardSearchButton.vue +44 -6
  26. package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -3
  27. package/dist/runtime/components/Error.d.vue.ts +1 -1
  28. package/dist/runtime/components/Error.vue.d.ts +1 -1
  29. package/dist/runtime/components/FileUpload.d.vue.ts +3 -2
  30. package/dist/runtime/components/FileUpload.vue +9 -9
  31. package/dist/runtime/components/FileUpload.vue.d.ts +3 -2
  32. package/dist/runtime/components/Form.d.vue.ts +2 -1
  33. package/dist/runtime/components/Form.vue.d.ts +2 -1
  34. package/dist/runtime/components/Input.d.vue.ts +7 -7
  35. package/dist/runtime/components/Input.vue +2 -2
  36. package/dist/runtime/components/Input.vue.d.ts +7 -7
  37. package/dist/runtime/components/InputDate.d.vue.ts +110 -0
  38. package/dist/runtime/components/InputDate.vue +192 -0
  39. package/dist/runtime/components/InputDate.vue.d.ts +110 -0
  40. package/dist/runtime/components/InputMenu.d.vue.ts +7 -128
  41. package/dist/runtime/components/InputMenu.vue +3 -3
  42. package/dist/runtime/components/InputMenu.vue.d.ts +7 -128
  43. package/dist/runtime/components/InputNumber.d.vue.ts +25 -129
  44. package/dist/runtime/components/InputNumber.vue +4 -7
  45. package/dist/runtime/components/InputNumber.vue.d.ts +25 -129
  46. package/dist/runtime/components/InputTags.d.vue.ts +6 -109
  47. package/dist/runtime/components/InputTags.vue +8 -8
  48. package/dist/runtime/components/InputTags.vue.d.ts +6 -109
  49. package/dist/runtime/components/InputTime.d.vue.ts +94 -0
  50. package/dist/runtime/components/InputTime.vue +164 -0
  51. package/dist/runtime/components/InputTime.vue.d.ts +94 -0
  52. package/dist/runtime/components/Link.d.vue.ts +4 -49
  53. package/dist/runtime/components/Link.vue +1 -0
  54. package/dist/runtime/components/Link.vue.d.ts +4 -49
  55. package/dist/runtime/components/Modal.d.vue.ts +1 -1
  56. package/dist/runtime/components/Modal.vue.d.ts +1 -1
  57. package/dist/runtime/components/Pagination.d.vue.ts +2 -2
  58. package/dist/runtime/components/Pagination.vue.d.ts +2 -2
  59. package/dist/runtime/components/PinInput.d.vue.ts +3 -3
  60. package/dist/runtime/components/PinInput.vue.d.ts +3 -3
  61. package/dist/runtime/components/Progress.d.vue.ts +1 -1
  62. package/dist/runtime/components/Progress.vue.d.ts +1 -1
  63. package/dist/runtime/components/Select.d.vue.ts +6 -107
  64. package/dist/runtime/components/Select.vue +3 -3
  65. package/dist/runtime/components/Select.vue.d.ts +6 -107
  66. package/dist/runtime/components/SelectMenu.d.vue.ts +7 -106
  67. package/dist/runtime/components/SelectMenu.vue +3 -3
  68. package/dist/runtime/components/SelectMenu.vue.d.ts +7 -106
  69. package/dist/runtime/components/Slideover.d.vue.ts +1 -1
  70. package/dist/runtime/components/Slideover.vue.d.ts +1 -1
  71. package/dist/runtime/components/Switch.d.vue.ts +2 -1
  72. package/dist/runtime/components/Switch.vue.d.ts +2 -1
  73. package/dist/runtime/components/Table.d.vue.ts +5 -4
  74. package/dist/runtime/components/Table.vue +4 -3
  75. package/dist/runtime/components/Table.vue.d.ts +5 -4
  76. package/dist/runtime/components/Textarea.d.vue.ts +7 -6
  77. package/dist/runtime/components/Textarea.vue +2 -2
  78. package/dist/runtime/components/Textarea.vue.d.ts +7 -6
  79. package/dist/runtime/components/Toast.vue +5 -5
  80. package/dist/runtime/components/Toaster.d.vue.ts +1 -1
  81. package/dist/runtime/components/Toaster.vue.d.ts +1 -1
  82. package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +3 -3
  83. package/dist/runtime/components/color-mode/ColorModeAvatar.vue +16 -4
  84. package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +3 -3
  85. package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +3 -3
  86. package/dist/runtime/components/color-mode/ColorModeButton.vue +54 -6
  87. package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +3 -3
  88. package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +4 -3
  89. package/dist/runtime/components/color-mode/ColorModeImage.vue +4 -0
  90. package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +4 -3
  91. package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
  92. package/dist/runtime/components/color-mode/ColorModeSelect.vue +47 -5
  93. package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
  94. package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +2 -2
  95. package/dist/runtime/components/color-mode/ColorModeSwitch.vue +29 -5
  96. package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +2 -2
  97. package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -6
  98. package/dist/runtime/components/content/ContentSearch.vue +2 -3
  99. package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -6
  100. package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -3
  101. package/dist/runtime/components/content/ContentSearchButton.vue +43 -5
  102. package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -3
  103. package/dist/runtime/components/content/ContentSurround.vue +7 -1
  104. package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +11 -7
  105. package/dist/runtime/components/locale/LocaleSelect.vue +50 -6
  106. package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +11 -7
  107. package/dist/runtime/components/prose/Callout.vue +4 -0
  108. package/dist/runtime/composables/index.d.ts +8 -0
  109. package/dist/runtime/composables/index.js +8 -0
  110. package/dist/runtime/composables/useFileUpload.d.ts +2 -1
  111. package/dist/runtime/composables/useFileUpload.js +13 -4
  112. package/dist/runtime/inertia/components/Link.d.vue.ts +17 -10
  113. package/dist/runtime/inertia/components/Link.vue +8 -6
  114. package/dist/runtime/inertia/components/Link.vue.d.ts +17 -10
  115. package/dist/runtime/inertia/stubs.d.ts +1 -1
  116. package/dist/runtime/types/html.d.ts +8 -0
  117. package/dist/runtime/types/html.js +0 -0
  118. package/dist/runtime/types/index.d.ts +2 -0
  119. package/dist/runtime/types/index.js +2 -0
  120. package/dist/runtime/types/input.d.ts +5 -5
  121. package/dist/runtime/types/utils.d.ts +2 -0
  122. package/dist/runtime/utils/content.d.ts +2 -2
  123. package/dist/runtime/utils/dashboard.d.ts +1 -1
  124. package/dist/runtime/utils/link.d.ts +1 -0
  125. package/dist/runtime/utils/link.js +40 -24
  126. package/dist/runtime/vue/components/Link.d.vue.ts +8 -37
  127. package/dist/runtime/vue/components/Link.vue +6 -11
  128. package/dist/runtime/vue/components/Link.vue.d.ts +8 -37
  129. package/dist/runtime/vue/components/color-mode/ColorModeButton.d.vue.ts +2 -2
  130. package/dist/runtime/vue/components/color-mode/ColorModeButton.vue +55 -5
  131. package/dist/runtime/vue/components/color-mode/ColorModeButton.vue.d.ts +2 -2
  132. package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
  133. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +46 -3
  134. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
  135. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
  136. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +24 -3
  137. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
  138. package/dist/runtime/vue/stubs.d.ts +2 -2
  139. package/dist/runtime/vue/stubs.js +1 -1
  140. package/dist/shared/{b24ui-nuxt.4XNR9Ysu.mjs → b24ui-nuxt.B13KxxqP.mjs} +137 -3
  141. package/dist/unplugin.mjs +1 -1
  142. package/dist/vite.mjs +1 -1
  143. package/package.json +24 -14
@@ -3,7 +3,7 @@ import theme from '#build/b24ui/dashboard-search-button';
3
3
  import type { ButtonProps, ButtonSlots, IconComponent, KbdProps, TooltipProps } from '../types';
4
4
  import type { ComponentConfig } from '../types/tv';
5
5
  type DashboardSearchButton = ComponentConfig<typeof theme, AppConfig, 'dashboardSearchButton'>;
6
- export interface DashboardSearchButtonProps {
6
+ export interface DashboardSearchButtonProps extends Omit<ButtonProps, 'icon' | 'label' | 'color'> {
7
7
  /**
8
8
  * The icon displayed in the button.
9
9
  * @defaultValue icons.search
@@ -20,7 +20,6 @@ export interface DashboardSearchButtonProps {
20
20
  * @defaultValue 'air-tertiary-no-accent'
21
21
  */
22
22
  color?: ButtonProps['color'];
23
- size?: ButtonProps['size'];
24
23
  /**
25
24
  * Whether the button is collapsed.
26
25
  * @defaultValue false
@@ -41,7 +40,7 @@ export interface DashboardSearchButtonProps {
41
40
  class?: any;
42
41
  }
43
42
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<DashboardSearchButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<DashboardSearchButtonProps> & Readonly<{}>, {
44
- color: "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-accent" | "air-secondary-accent-1" | "air-tertiary" | "default" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary-alert" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost";
43
+ color: "default" | "link" | "air-primary" | "air-primary-success" | "air-primary-alert" | "air-primary-copilot" | "air-secondary" | "air-secondary-accent" | "air-secondary-accent-1" | "air-tertiary" | "danger" | "success" | "warning" | "primary" | "secondary" | "collab" | "ai" | "air-secondary-alert" | "air-secondary-accent-2" | "air-secondary-no-accent" | "air-tertiary-accent" | "air-tertiary-no-accent" | "air-selection" | "air-boost";
45
44
  tooltip: boolean | TooltipProps;
46
45
  kbds: KbdProps["value"][] | KbdProps[];
47
46
  collapsed: boolean;
@@ -35,8 +35,8 @@ export interface ErrorSlots {
35
35
  links(props?: {}): any;
36
36
  }
37
37
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ErrorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ErrorProps> & Readonly<{}>, {
38
- clear: boolean | Partial<ButtonProps>;
39
38
  redirect: string;
39
+ clear: boolean | Partial<ButtonProps>;
40
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ErrorSlots>;
41
41
  declare const _default: typeof __VLS_export;
42
42
  export default _default;
@@ -35,8 +35,8 @@ export interface ErrorSlots {
35
35
  links(props?: {}): any;
36
36
  }
37
37
  declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ErrorProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ErrorProps> & Readonly<{}>, {
38
- clear: boolean | Partial<ButtonProps>;
39
38
  redirect: string;
39
+ clear: boolean | Partial<ButtonProps>;
40
40
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, ErrorSlots>;
41
41
  declare const _default: typeof __VLS_export;
42
42
  export default _default;
@@ -2,9 +2,10 @@ import type { AppConfig } from '@nuxt/schema';
2
2
  import type { UseFileDialogReturn } from '@vueuse/core';
3
3
  import theme from '#build/b24ui/file-upload';
4
4
  import type { ButtonProps, IconComponent } from '../types';
5
+ import type { InputHTMLAttributes } from '../types/html';
5
6
  import type { ComponentConfig } from '../types/tv';
6
7
  type FileUpload = ComponentConfig<typeof theme, AppConfig, 'fileUpload'>;
7
- export interface FileUploadProps<M extends boolean = false> {
8
+ export interface FileUploadProps<M extends boolean = false> extends /** @vue-ignore */ Pick<InputHTMLAttributes, 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget'> {
8
9
  /**
9
10
  * The element or component this component should render as.
10
11
  * @defaultValue 'div'
@@ -156,7 +157,7 @@ declare const __VLS_export: <M extends boolean = false>(__VLS_props: NonNullable
156
157
  "onUpdate:modelValue"?: ((value: (M extends true ? File[] : File) | null | undefined) => any) | undefined;
157
158
  }> & import("vue").PublicProps;
158
159
  expose: (exposed: import("vue").ShallowUnwrapRef<{
159
- inputRef: import("vue").Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
160
+ inputRef: Readonly<import("vue").Ref<HTMLInputElement, HTMLInputElement>>;
160
161
  dropzoneRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
161
162
  }>) => void;
162
163
  attrs: any;
@@ -3,8 +3,8 @@ import theme from "#build/b24ui/file-upload";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { computed, watch } from "vue";
7
- import { Primitive } from "reka-ui";
6
+ import { computed, toRef, watch } from "vue";
7
+ import { Primitive, VisuallyHidden } from "reka-ui";
8
8
  import { createReusableTemplate } from "@vueuse/core";
9
9
  import { useAppConfig, useLocale } from "#imports";
10
10
  import { useFormField } from "../composables/useFormField";
@@ -122,13 +122,13 @@ function removeFile(index) {
122
122
  dropzoneRef.value?.focus();
123
123
  }
124
124
  watch(modelValue, (newValue) => {
125
- const hasModelReset = !Array.isArray(newValue) || !newValue.length;
125
+ const hasModelReset = props.multiple ? !newValue?.length : !newValue;
126
126
  if (hasModelReset && inputRef.value) {
127
- inputRef.value.value = "";
127
+ inputRef.value.$el.value = "";
128
128
  }
129
129
  });
130
130
  defineExpose({
131
- inputRef,
131
+ inputRef: toRef(() => inputRef.value?.$el),
132
132
  dropzoneRef
133
133
  });
134
134
  </script>
@@ -254,18 +254,18 @@ defineExpose({
254
254
  <ReuseFilesTemplate v-if="position === 'outside'" />
255
255
  </slot>
256
256
 
257
- <input
257
+ <VisuallyHidden
258
258
  :id="id"
259
259
  ref="inputRef"
260
+ as="input"
260
261
  type="file"
262
+ feature="fully-hidden"
261
263
  :name="name"
262
264
  :accept="accept"
263
265
  :multiple="multiple"
264
266
  :required="required"
265
267
  :disabled="disabled"
266
268
  v-bind="{ ...$attrs, ...ariaAttrs }"
267
- class="sr-only"
268
- tabindex="-1"
269
- >
269
+ />
270
270
  </Primitive>
271
271
  </template>
@@ -2,9 +2,10 @@ import type { AppConfig } from '@nuxt/schema';
2
2
  import type { UseFileDialogReturn } from '@vueuse/core';
3
3
  import theme from '#build/b24ui/file-upload';
4
4
  import type { ButtonProps, IconComponent } from '../types';
5
+ import type { InputHTMLAttributes } from '../types/html';
5
6
  import type { ComponentConfig } from '../types/tv';
6
7
  type FileUpload = ComponentConfig<typeof theme, AppConfig, 'fileUpload'>;
7
- export interface FileUploadProps<M extends boolean = false> {
8
+ export interface FileUploadProps<M extends boolean = false> extends /** @vue-ignore */ Pick<InputHTMLAttributes, 'form' | 'formaction' | 'formenctype' | 'formmethod' | 'formnovalidate' | 'formtarget'> {
8
9
  /**
9
10
  * The element or component this component should render as.
10
11
  * @defaultValue 'div'
@@ -156,7 +157,7 @@ declare const __VLS_export: <M extends boolean = false>(__VLS_props: NonNullable
156
157
  "onUpdate:modelValue"?: ((value: (M extends true ? File[] : File) | null | undefined) => any) | undefined;
157
158
  }> & import("vue").PublicProps;
158
159
  expose: (exposed: import("vue").ShallowUnwrapRef<{
159
- inputRef: import("vue").Ref<HTMLInputElement | undefined, HTMLInputElement | undefined>;
160
+ inputRef: Readonly<import("vue").Ref<HTMLInputElement, HTMLInputElement>>;
160
161
  dropzoneRef: import("vue").Ref<HTMLDivElement | undefined, HTMLDivElement | undefined>;
161
162
  }>) => void;
162
163
  attrs: any;
@@ -1,4 +1,5 @@
1
1
  import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormErrorWithId, InferInput, FormData } from '../types/form';
2
+ import type { FormHTMLAttributes } from '../types/html';
2
3
  export type FormProps<S extends FormSchema, T extends boolean = true, N extends boolean = false> = {
3
4
  id?: string | number;
4
5
  /** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */
@@ -47,7 +48,7 @@ export type FormProps<S extends FormSchema, T extends boolean = true, N extends
47
48
  loadingAuto?: boolean;
48
49
  class?: any;
49
50
  onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => void | Promise<void>) | (() => void | Promise<void>);
50
- };
51
+ } & /** @vue-ignore */ Omit<FormHTMLAttributes, 'name'>;
51
52
  export interface FormEmits<S extends FormSchema, T extends boolean = true> {
52
53
  submit: [event: FormSubmitEvent<FormData<S, T>>];
53
54
  error: [event: FormErrorEvent];
@@ -1,4 +1,5 @@
1
1
  import type { FormSchema, FormError, FormInputEvents, FormErrorEvent, FormSubmitEvent, FormErrorWithId, InferInput, FormData } from '../types/form';
2
+ import type { FormHTMLAttributes } from '../types/html';
2
3
  export type FormProps<S extends FormSchema, T extends boolean = true, N extends boolean = false> = {
3
4
  id?: string | number;
4
5
  /** Schema to validate the form state. Supports Standard Schema objects, Yup, Joi, and Superstructs. */
@@ -47,7 +48,7 @@ export type FormProps<S extends FormSchema, T extends boolean = true, N extends
47
48
  loadingAuto?: boolean;
48
49
  class?: any;
49
50
  onSubmit?: ((event: FormSubmitEvent<FormData<S, T>>) => void | Promise<void>) | (() => void | Promise<void>);
50
- };
51
+ } & /** @vue-ignore */ Omit<FormHTMLAttributes, 'name'>;
51
52
  export interface FormEmits<S extends FormSchema, T extends boolean = true> {
52
53
  submit: [event: FormSubmitEvent<FormData<S, T>>];
53
54
  error: [event: FormErrorEvent];
@@ -1,14 +1,14 @@
1
- import type { InputHTMLAttributes } from 'vue';
2
1
  import type { AppConfig } from '@nuxt/schema';
3
2
  import theme from '#build/b24ui/input';
4
3
  import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
4
  import type { BadgeProps } from '../types';
5
+ import type { InputHTMLAttributes } from '../types/html';
6
6
  import type { ModelModifiers } from '../types/input';
7
7
  import type { AcceptableValue } from '../types/utils';
8
8
  import type { ComponentConfig } from '../types/tv';
9
9
  type Input = ComponentConfig<typeof theme, AppConfig, 'input'>;
10
10
  export type InputValue = AcceptableValue;
11
- export interface InputProps<T extends InputValue = InputValue> extends UseComponentIconsProps {
11
+ export interface InputProps<T extends InputValue = InputValue> extends UseComponentIconsProps, /** @vue-ignore */ Omit<InputHTMLAttributes, 'name' | 'type' | 'placeholder' | 'required' | 'autocomplete' | 'autofocus' | 'disabled'> {
12
12
  /**
13
13
  * The element or component this component should render as.
14
14
  * @defaultValue 'div'
@@ -43,7 +43,7 @@ export interface InputProps<T extends InputValue = InputValue> extends UseCompon
43
43
  */
44
44
  underline?: boolean;
45
45
  /**
46
- * Rounds the corners of the button
46
+ * Rounds the corners of the input
47
47
  * @defaultValue false
48
48
  */
49
49
  rounded?: boolean;
@@ -76,7 +76,7 @@ export interface InputProps<T extends InputValue = InputValue> extends UseCompon
76
76
  highlight?: boolean;
77
77
  modelValue?: T;
78
78
  defaultValue?: T;
79
- modelModifiers?: ModelModifiers;
79
+ modelModifiers?: ModelModifiers<T>;
80
80
  class?: any;
81
81
  b24ui?: Input['slots'];
82
82
  }
@@ -98,16 +98,16 @@ export interface InputSlots {
98
98
  }
99
99
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
100
100
  props: __VLS_PrettifyLocal<InputProps<T> & {
101
- onBlur?: ((event: FocusEvent) => any) | undefined;
102
101
  onChange?: ((event: Event) => any) | undefined;
102
+ onBlur?: ((event: FocusEvent) => any) | undefined;
103
103
  "onUpdate:modelValue"?: ((value: T) => any) | undefined;
104
104
  }> & import("vue").PublicProps;
105
105
  expose: (exposed: import("vue").ShallowUnwrapRef<{
106
- inputRef: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
106
+ inputRef: Readonly<import("vue").ShallowRef<HTMLInputElement | null>>;
107
107
  }>) => void;
108
108
  attrs: any;
109
109
  slots: InputSlots;
110
- emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void);
110
+ emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "update:modelValue", value: T) => void);
111
111
  }>) => import("vue").VNode & {
112
112
  __ctx?: Awaited<typeof __VLS_setup>;
113
113
  };
@@ -3,7 +3,7 @@ import theme from "#build/b24ui/input";
3
3
  </script>
4
4
 
5
5
  <script setup>
6
- import { ref, computed, onMounted } from "vue";
6
+ import { useTemplateRef, computed, onMounted } from "vue";
7
7
  import { Primitive } from "reka-ui";
8
8
  import { useVModel } from "@vueuse/core";
9
9
  import { useAppConfig } from "#imports";
@@ -71,7 +71,7 @@ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.input |
71
71
  trailing: Boolean(isTrailing.value || !!slots.trailing),
72
72
  fieldGroup: orientation.value
73
73
  }));
74
- const inputRef = ref(null);
74
+ const inputRef = useTemplateRef("inputRef");
75
75
  function updateInput(value) {
76
76
  if (props.modelModifiers?.trim) {
77
77
  value = value?.trim() ?? null;
@@ -1,14 +1,14 @@
1
- import type { InputHTMLAttributes } from 'vue';
2
1
  import type { AppConfig } from '@nuxt/schema';
3
2
  import theme from '#build/b24ui/input';
4
3
  import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
4
  import type { BadgeProps } from '../types';
5
+ import type { InputHTMLAttributes } from '../types/html';
6
6
  import type { ModelModifiers } from '../types/input';
7
7
  import type { AcceptableValue } from '../types/utils';
8
8
  import type { ComponentConfig } from '../types/tv';
9
9
  type Input = ComponentConfig<typeof theme, AppConfig, 'input'>;
10
10
  export type InputValue = AcceptableValue;
11
- export interface InputProps<T extends InputValue = InputValue> extends UseComponentIconsProps {
11
+ export interface InputProps<T extends InputValue = InputValue> extends UseComponentIconsProps, /** @vue-ignore */ Omit<InputHTMLAttributes, 'name' | 'type' | 'placeholder' | 'required' | 'autocomplete' | 'autofocus' | 'disabled'> {
12
12
  /**
13
13
  * The element or component this component should render as.
14
14
  * @defaultValue 'div'
@@ -43,7 +43,7 @@ export interface InputProps<T extends InputValue = InputValue> extends UseCompon
43
43
  */
44
44
  underline?: boolean;
45
45
  /**
46
- * Rounds the corners of the button
46
+ * Rounds the corners of the input
47
47
  * @defaultValue false
48
48
  */
49
49
  rounded?: boolean;
@@ -76,7 +76,7 @@ export interface InputProps<T extends InputValue = InputValue> extends UseCompon
76
76
  highlight?: boolean;
77
77
  modelValue?: T;
78
78
  defaultValue?: T;
79
- modelModifiers?: ModelModifiers;
79
+ modelModifiers?: ModelModifiers<T>;
80
80
  class?: any;
81
81
  b24ui?: Input['slots'];
82
82
  }
@@ -98,16 +98,16 @@ export interface InputSlots {
98
98
  }
99
99
  declare const __VLS_export: <T extends InputValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
100
100
  props: __VLS_PrettifyLocal<InputProps<T> & {
101
- onBlur?: ((event: FocusEvent) => any) | undefined;
102
101
  onChange?: ((event: Event) => any) | undefined;
102
+ onBlur?: ((event: FocusEvent) => any) | undefined;
103
103
  "onUpdate:modelValue"?: ((value: T) => any) | undefined;
104
104
  }> & import("vue").PublicProps;
105
105
  expose: (exposed: import("vue").ShallowUnwrapRef<{
106
- inputRef: import("vue").Ref<HTMLInputElement | null, HTMLInputElement | null>;
106
+ inputRef: Readonly<import("vue").ShallowRef<HTMLInputElement | null>>;
107
107
  }>) => void;
108
108
  attrs: any;
109
109
  slots: InputSlots;
110
- emit: ((evt: "blur", event: FocusEvent) => void) & ((evt: "change", event: Event) => void) & ((evt: "update:modelValue", value: T) => void);
110
+ emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "update:modelValue", value: T) => void);
111
111
  }>) => import("vue").VNode & {
112
112
  __ctx?: Awaited<typeof __VLS_setup>;
113
113
  };
@@ -0,0 +1,110 @@
1
+ import type { ComponentPublicInstance } from 'vue';
2
+ import type { DateFieldRootProps, DateFieldRootEmits, DateRangeFieldRootProps, DateRangeFieldRootEmits, DateValue } from 'reka-ui';
3
+ import type { AppConfig } from '@nuxt/schema';
4
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons';
5
+ import type { BadgeProps, IconComponent } from '../types';
6
+ import type { ComponentConfig } from '../types/tv';
7
+ import theme from '#build/b24ui/input-date';
8
+ type InputDate = ComponentConfig<typeof theme, AppConfig, 'inputDate'>;
9
+ type _DateFieldRootProps = Omit<DateFieldRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale'>;
10
+ type _RangeDateFieldRootProps = Omit<DateRangeFieldRootProps, 'as' | 'asChild' | 'modelValue' | 'defaultValue' | 'dir' | 'locale'>;
11
+ type InputDateDefaultValue<R extends boolean = false> = R extends true ? DateRangeFieldRootProps['defaultValue'] : DateFieldRootProps['defaultValue'];
12
+ type InputDateModelValue<R extends boolean = false> = (R extends true ? DateRangeFieldRootProps['modelValue'] : DateFieldRootProps['modelValue']) | undefined;
13
+ export interface InputDateProps<R extends boolean = false> extends UseComponentIconsProps, _DateFieldRootProps, _RangeDateFieldRootProps {
14
+ /**
15
+ * The element or component this component should render as.
16
+ * @defaultValue 'div'
17
+ */
18
+ as?: any;
19
+ /**
20
+ * @defaultValue 'air-primary'
21
+ */
22
+ color?: InputDate['variants']['color'];
23
+ /**
24
+ * @defaultValue 'md'
25
+ */
26
+ size?: InputDate['variants']['size'];
27
+ /**
28
+ * Removes padding from input
29
+ * @defaultValue false
30
+ */
31
+ noPadding?: boolean;
32
+ /**
33
+ * Removes all borders (rings)
34
+ * @defaultValue false
35
+ */
36
+ noBorder?: boolean;
37
+ /**
38
+ * Removes all borders (rings) except the bottom one
39
+ * @defaultValue false
40
+ */
41
+ underline?: boolean;
42
+ /**
43
+ * Rounds the corners of the input
44
+ * @defaultValue false
45
+ */
46
+ rounded?: boolean;
47
+ tag?: string;
48
+ /**
49
+ * @defaultValue 'air-primary'
50
+ */
51
+ tagColor?: BadgeProps['color'];
52
+ /** Highlight the ring color like a focus state. */
53
+ highlight?: boolean;
54
+ autofocus?: boolean;
55
+ autofocusDelay?: number;
56
+ /**
57
+ * The icon to use as a range separator.
58
+ * @defaultValue icons.minus
59
+ * @IconComponent
60
+ */
61
+ separatorIcon?: IconComponent;
62
+ /** Whether or not a range of dates can be selected */
63
+ range?: R & boolean;
64
+ defaultValue?: InputDateDefaultValue<R>;
65
+ modelValue?: InputDateModelValue<R>;
66
+ class?: any;
67
+ b24ui?: InputDate['slots'];
68
+ }
69
+ export interface InputDateEmits<R extends boolean> extends Omit<DateFieldRootEmits & DateRangeFieldRootEmits, 'update:modelValue'> {
70
+ 'update:modelValue': [date: InputDateModelValue<R>];
71
+ 'change': [event: Event];
72
+ 'blur': [event: FocusEvent];
73
+ 'focus': [event: FocusEvent];
74
+ }
75
+ export interface InputDateSlots {
76
+ leading(props: {
77
+ b24ui: InputDate['b24ui'];
78
+ }): any;
79
+ default(props: {
80
+ b24ui: InputDate['b24ui'];
81
+ }): any;
82
+ trailing(props: {
83
+ b24ui: InputDate['b24ui'];
84
+ }): any;
85
+ separator(props: {
86
+ b24ui: InputDate['b24ui'];
87
+ }): any;
88
+ }
89
+ declare const __VLS_export: <R extends boolean>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_PrettifyLocal<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
90
+ props: __VLS_PrettifyLocal<InputDateProps<R> & {
91
+ onChange?: ((event: Event) => any) | undefined;
92
+ onBlur?: ((event: FocusEvent) => any) | undefined;
93
+ onFocus?: ((event: FocusEvent) => any) | undefined;
94
+ "onUpdate:modelValue"?: ((date: InputDateModelValue<R>) => any) | undefined;
95
+ "onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
96
+ }> & import("vue").PublicProps;
97
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
98
+ inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
99
+ }>) => void;
100
+ attrs: any;
101
+ slots: InputDateSlots;
102
+ emit: ((evt: "change", event: Event) => void) & ((evt: "blur", event: FocusEvent) => void) & ((evt: "focus", event: FocusEvent) => void) & ((evt: "update:modelValue", date: InputDateModelValue<R>) => void) & ((evt: "update:placeholder", ...args: [date: DateValue] & [date: DateValue]) => void);
103
+ }>) => import("vue").VNode & {
104
+ __ctx?: Awaited<typeof __VLS_setup>;
105
+ };
106
+ declare const _default: typeof __VLS_export;
107
+ export default _default;
108
+ type __VLS_PrettifyLocal<T> = {
109
+ [K in keyof T as K]: T[K];
110
+ } & {};
@@ -0,0 +1,192 @@
1
+ <script>
2
+ import theme from "#build/b24ui/input-date";
3
+ </script>
4
+
5
+ <script setup>
6
+ import { computed, onMounted, ref } from "vue";
7
+ import { useForwardPropsEmits } from "reka-ui";
8
+ import { DateField as SingleDateField, DateRangeField as RangeDateField } from "reka-ui/namespaced";
9
+ import { reactiveOmit, createReusableTemplate } from "@vueuse/core";
10
+ import { useAppConfig } from "#imports";
11
+ import { useFieldGroup } from "../composables/useFieldGroup";
12
+ import { useComponentIcons } from "../composables/useComponentIcons";
13
+ import { useFormField } from "../composables/useFormField";
14
+ import { tv } from "../utils/tv";
15
+ import icons from "../dictionary/icons";
16
+ import B24Badge from "./Badge.vue";
17
+ import B24Avatar from "./Avatar.vue";
18
+ defineOptions({ inheritAttrs: false });
19
+ const props = defineProps({
20
+ as: { type: null, required: false },
21
+ color: { type: null, required: false },
22
+ size: { type: null, required: false },
23
+ noPadding: { type: Boolean, required: false },
24
+ noBorder: { type: Boolean, required: false },
25
+ underline: { type: Boolean, required: false },
26
+ rounded: { type: Boolean, required: false },
27
+ tag: { type: String, required: false },
28
+ tagColor: { type: null, required: false },
29
+ highlight: { type: Boolean, required: false },
30
+ autofocus: { type: Boolean, required: false },
31
+ autofocusDelay: { type: Number, required: false, default: 0 },
32
+ separatorIcon: { type: [Function, Object], required: false },
33
+ range: { type: Boolean, required: false },
34
+ defaultValue: { type: null, required: false },
35
+ modelValue: { type: null, 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
+ defaultPlaceholder: { type: null, required: false },
44
+ placeholder: { type: null, required: false },
45
+ hourCycle: { type: null, required: false },
46
+ step: { type: Object, required: false },
47
+ granularity: { type: String, required: false },
48
+ hideTimeZone: { type: Boolean, required: false },
49
+ maxValue: { type: null, required: false },
50
+ minValue: { type: null, required: false },
51
+ disabled: { type: Boolean, required: false },
52
+ readonly: { type: Boolean, required: false },
53
+ isDateUnavailable: { type: Function, required: false },
54
+ id: { type: String, required: false },
55
+ name: { type: String, required: false },
56
+ required: { type: Boolean, required: false }
57
+ });
58
+ const emits = defineEmits(["update:modelValue", "change", "blur", "focus", "update:placeholder"]);
59
+ const slots = defineSlots();
60
+ const appConfig = useAppConfig();
61
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, "id", "name", "range", "modelValue", "defaultValue", "color", "size", "highlight", "disabled", "autofocus", "autofocusDelay", "icon", "avatar", "trailingIcon", "loading", "separatorIcon", "class", "b24ui"), emits);
62
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
63
+ const { orientation, size: fieldGroupSize } = useFieldGroup(props);
64
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
65
+ const [DefineSegmentsTemplate, ReuseSegmentsTemplate] = createReusableTemplate();
66
+ const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
67
+ const isTag = computed(() => {
68
+ return props.tag;
69
+ });
70
+ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.inputDate || {} })({
71
+ color: color.value,
72
+ size: inputSize.value,
73
+ loading: props.loading,
74
+ highlight: highlight.value,
75
+ rounded: Boolean(props.rounded),
76
+ noPadding: Boolean(props.noPadding),
77
+ noBorder: Boolean(props.noBorder),
78
+ underline: Boolean(props.underline),
79
+ leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
80
+ trailing: Boolean(isTrailing.value || !!slots.trailing),
81
+ fieldGroup: orientation.value
82
+ }));
83
+ const inputsRef = ref([]);
84
+ function onUpdate(value) {
85
+ const event = new Event("change", { target: { value } });
86
+ emits("change", event);
87
+ emitFormChange();
88
+ emitFormInput();
89
+ }
90
+ function onBlur(event) {
91
+ emitFormBlur();
92
+ emits("blur", event);
93
+ }
94
+ function onFocus(event) {
95
+ emitFormFocus();
96
+ emits("focus", event);
97
+ }
98
+ function autoFocus() {
99
+ if (props.autofocus) {
100
+ inputsRef.value[0]?.$el?.focus();
101
+ }
102
+ }
103
+ onMounted(() => {
104
+ setTimeout(() => {
105
+ autoFocus();
106
+ }, props.autofocusDelay);
107
+ });
108
+ const DateField = computed(() => props.range ? RangeDateField : SingleDateField);
109
+ defineExpose({
110
+ inputsRef
111
+ });
112
+ </script>
113
+
114
+ <template>
115
+ <DefineSegmentsTemplate v-slot="{ segments, type }">
116
+ <DateField.Input
117
+ v-for="(segment, index) in segments"
118
+ :key="`${segment.part}-${index}`"
119
+ :ref="(el) => inputsRef[index] = el"
120
+ :type="type"
121
+ :part="segment.part"
122
+ :class="b24ui.segment({ class: props.b24ui?.segment })"
123
+ :data-segment="segment.part"
124
+ >
125
+ {{ segment.value.trim() }}
126
+ </DateField.Input>
127
+ </DefineSegmentsTemplate>
128
+
129
+ <DateField.Root
130
+ v-bind="{ ...rootProps, ...$attrs, ...ariaAttrs }"
131
+ :id="id"
132
+ v-slot="{ segments }"
133
+ :model-value="modelValue"
134
+ :default-value="defaultValue"
135
+ :name="name"
136
+ :disabled="disabled"
137
+ :class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
138
+ @update:model-value="onUpdate"
139
+ @blur="onBlur"
140
+ @focus="onFocus"
141
+ >
142
+ <B24Badge
143
+ v-if="isTag"
144
+ :class="b24ui.tag({ class: props.b24ui?.tag })"
145
+ :color="props.tagColor"
146
+ :label="props.tag"
147
+ size="xs"
148
+ />
149
+
150
+ <template v-if="Array.isArray(segments)">
151
+ <ReuseSegmentsTemplate :segments="segments" />
152
+ </template>
153
+ <template v-else>
154
+ <ReuseSegmentsTemplate :segments="segments.start" type="start" />
155
+ <slot name="separator" :b24ui="b24ui">
156
+ <Component
157
+ :is="separatorIcon || icons.minus"
158
+ :class="b24ui.separatorIcon({ class: props.b24ui?.separatorIcon })"
159
+ />
160
+ </slot>
161
+ <ReuseSegmentsTemplate :segments="segments.end" type="end" />
162
+ </template>
163
+
164
+ <slot :b24ui="b24ui" />
165
+
166
+ <span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
167
+ <slot name="leading" :b24ui="b24ui">
168
+ <Component
169
+ :is="leadingIconName"
170
+ v-if="isLeading && leadingIconName"
171
+ :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
172
+ />
173
+ <B24Avatar
174
+ v-else-if="!!avatar"
175
+ :size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()"
176
+ v-bind="avatar"
177
+ :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
178
+ />
179
+ </slot>
180
+ </span>
181
+
182
+ <span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
183
+ <slot name="trailing" :b24ui="b24ui">
184
+ <Component
185
+ :is="trailingIconName"
186
+ v-if="trailingIconName"
187
+ :class="b24ui.trailingIcon({ class: props.b24ui?.trailingIcon })"
188
+ />
189
+ </slot>
190
+ </span>
191
+ </DateField.Root>
192
+ </template>