@bitrix24/b24ui-nuxt 2.0.8 → 2.1.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.
Files changed (165) hide show
  1. package/dist/meta.d.mts +84957 -50082
  2. package/dist/meta.mjs +84957 -50082
  3. package/dist/module.d.mts +13 -1
  4. package/dist/module.json +1 -1
  5. package/dist/module.mjs +8 -7
  6. package/dist/runtime/air-design-tokens/001_b24_global.css +1 -1
  7. package/dist/runtime/air-design-tokens/003_b24_context_light.css +1 -1
  8. package/dist/runtime/air-design-tokens/004_b24_context_dark.css +1 -1
  9. package/dist/runtime/air-design-tokens/005_b24_context_edge-light.css +1 -1
  10. package/dist/runtime/air-design-tokens/006_b24_context_edge-dark.css +1 -1
  11. package/dist/runtime/air-design-tokens/007_b24_global.css +1 -1
  12. package/dist/runtime/air-design-tokens/008_ui_global.css +1 -1
  13. package/dist/runtime/air-design-tokens/009_b24_tools.css +1 -1
  14. package/dist/runtime/air-design-tokens/components/badge-counter.css +1 -1
  15. package/dist/runtime/air-design-tokens/components/button.css +1 -1
  16. package/dist/runtime/air-design-tokens/components/navigation-menu.css +1 -1
  17. package/dist/runtime/air-design-tokens/components/popup.css +1 -1
  18. package/dist/runtime/air-design-tokens/components/scrollbar.css +1 -2
  19. package/dist/runtime/air-design-tokens/index.css +1 -1
  20. package/dist/runtime/components/Advice.d.vue.ts +1 -1
  21. package/dist/runtime/components/Advice.vue +1 -3
  22. package/dist/runtime/components/Advice.vue.d.ts +1 -1
  23. package/dist/runtime/components/App.d.vue.ts +1 -1
  24. package/dist/runtime/components/App.vue +2 -1
  25. package/dist/runtime/components/App.vue.d.ts +1 -1
  26. package/dist/runtime/components/Avatar.d.vue.ts +2 -1
  27. package/dist/runtime/components/Avatar.vue.d.ts +2 -1
  28. package/dist/runtime/components/Button.vue +1 -0
  29. package/dist/runtime/components/ChatPrompt.d.vue.ts +2 -2
  30. package/dist/runtime/components/ChatPrompt.vue +5 -5
  31. package/dist/runtime/components/ChatPrompt.vue.d.ts +2 -2
  32. package/dist/runtime/components/ChatPromptSubmit.d.vue.ts +5 -5
  33. package/dist/runtime/components/ChatPromptSubmit.vue +53 -4
  34. package/dist/runtime/components/ChatPromptSubmit.vue.d.ts +5 -5
  35. package/dist/runtime/components/Checkbox.d.vue.ts +2 -1
  36. package/dist/runtime/components/Checkbox.vue.d.ts +2 -1
  37. package/dist/runtime/components/CommandPalette.vue +5 -4
  38. package/dist/runtime/components/DashboardSearch.d.vue.ts +3 -6
  39. package/dist/runtime/components/DashboardSearch.vue +2 -3
  40. package/dist/runtime/components/DashboardSearch.vue.d.ts +3 -6
  41. package/dist/runtime/components/DashboardSearchButton.d.vue.ts +2 -3
  42. package/dist/runtime/components/DashboardSearchButton.vue +44 -6
  43. package/dist/runtime/components/DashboardSearchButton.vue.d.ts +2 -3
  44. package/dist/runtime/components/Error.d.vue.ts +1 -1
  45. package/dist/runtime/components/Error.vue.d.ts +1 -1
  46. package/dist/runtime/components/FileUpload.d.vue.ts +3 -2
  47. package/dist/runtime/components/FileUpload.vue +9 -9
  48. package/dist/runtime/components/FileUpload.vue.d.ts +3 -2
  49. package/dist/runtime/components/Form.d.vue.ts +3 -2
  50. package/dist/runtime/components/Form.vue +3 -4
  51. package/dist/runtime/components/Form.vue.d.ts +3 -2
  52. package/dist/runtime/components/Input.d.vue.ts +7 -7
  53. package/dist/runtime/components/Input.vue +2 -2
  54. package/dist/runtime/components/Input.vue.d.ts +7 -7
  55. package/dist/runtime/components/InputDate.d.vue.ts +115 -0
  56. package/dist/runtime/components/InputDate.vue +198 -0
  57. package/dist/runtime/components/InputDate.vue.d.ts +115 -0
  58. package/dist/runtime/components/InputMenu.d.vue.ts +7 -128
  59. package/dist/runtime/components/InputMenu.vue +3 -3
  60. package/dist/runtime/components/InputMenu.vue.d.ts +7 -128
  61. package/dist/runtime/components/InputNumber.d.vue.ts +25 -124
  62. package/dist/runtime/components/InputNumber.vue +3 -3
  63. package/dist/runtime/components/InputNumber.vue.d.ts +25 -124
  64. package/dist/runtime/components/InputTags.d.vue.ts +6 -109
  65. package/dist/runtime/components/InputTags.vue +8 -8
  66. package/dist/runtime/components/InputTags.vue.d.ts +6 -109
  67. package/dist/runtime/components/InputTime.d.vue.ts +99 -0
  68. package/dist/runtime/components/InputTime.vue +170 -0
  69. package/dist/runtime/components/InputTime.vue.d.ts +99 -0
  70. package/dist/runtime/components/Link.d.vue.ts +4 -49
  71. package/dist/runtime/components/Link.vue +1 -0
  72. package/dist/runtime/components/Link.vue.d.ts +4 -49
  73. package/dist/runtime/components/Modal.d.vue.ts +6 -1
  74. package/dist/runtime/components/Modal.vue +37 -9
  75. package/dist/runtime/components/Modal.vue.d.ts +6 -1
  76. package/dist/runtime/components/Pagination.d.vue.ts +2 -2
  77. package/dist/runtime/components/Pagination.vue.d.ts +2 -2
  78. package/dist/runtime/components/PinInput.d.vue.ts +3 -3
  79. package/dist/runtime/components/PinInput.vue.d.ts +3 -3
  80. package/dist/runtime/components/Progress.d.vue.ts +1 -1
  81. package/dist/runtime/components/Progress.vue.d.ts +1 -1
  82. package/dist/runtime/components/Select.d.vue.ts +6 -107
  83. package/dist/runtime/components/Select.vue +3 -3
  84. package/dist/runtime/components/Select.vue.d.ts +6 -107
  85. package/dist/runtime/components/SelectMenu.d.vue.ts +7 -106
  86. package/dist/runtime/components/SelectMenu.vue +3 -3
  87. package/dist/runtime/components/SelectMenu.vue.d.ts +7 -106
  88. package/dist/runtime/components/Slideover.d.vue.ts +1 -1
  89. package/dist/runtime/components/Slideover.vue.d.ts +1 -1
  90. package/dist/runtime/components/Switch.d.vue.ts +2 -1
  91. package/dist/runtime/components/Switch.vue.d.ts +2 -1
  92. package/dist/runtime/components/Table.d.vue.ts +5 -4
  93. package/dist/runtime/components/Table.vue +4 -3
  94. package/dist/runtime/components/Table.vue.d.ts +5 -4
  95. package/dist/runtime/components/Textarea.d.vue.ts +7 -6
  96. package/dist/runtime/components/Textarea.vue +2 -2
  97. package/dist/runtime/components/Textarea.vue.d.ts +7 -6
  98. package/dist/runtime/components/Toast.vue +5 -5
  99. package/dist/runtime/components/Toaster.d.vue.ts +1 -1
  100. package/dist/runtime/components/Toaster.vue.d.ts +1 -1
  101. package/dist/runtime/components/color-mode/ColorModeAvatar.d.vue.ts +3 -3
  102. package/dist/runtime/components/color-mode/ColorModeAvatar.vue +16 -4
  103. package/dist/runtime/components/color-mode/ColorModeAvatar.vue.d.ts +3 -3
  104. package/dist/runtime/components/color-mode/ColorModeButton.d.vue.ts +3 -3
  105. package/dist/runtime/components/color-mode/ColorModeButton.vue +54 -6
  106. package/dist/runtime/components/color-mode/ColorModeButton.vue.d.ts +3 -3
  107. package/dist/runtime/components/color-mode/ColorModeImage.d.vue.ts +4 -3
  108. package/dist/runtime/components/color-mode/ColorModeImage.vue +4 -0
  109. package/dist/runtime/components/color-mode/ColorModeImage.vue.d.ts +4 -3
  110. package/dist/runtime/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
  111. package/dist/runtime/components/color-mode/ColorModeSelect.vue +47 -5
  112. package/dist/runtime/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
  113. package/dist/runtime/components/color-mode/ColorModeSwitch.d.vue.ts +2 -2
  114. package/dist/runtime/components/color-mode/ColorModeSwitch.vue +29 -5
  115. package/dist/runtime/components/color-mode/ColorModeSwitch.vue.d.ts +2 -2
  116. package/dist/runtime/components/content/ContentSearch.d.vue.ts +3 -6
  117. package/dist/runtime/components/content/ContentSearch.vue +2 -3
  118. package/dist/runtime/components/content/ContentSearch.vue.d.ts +3 -6
  119. package/dist/runtime/components/content/ContentSearchButton.d.vue.ts +2 -3
  120. package/dist/runtime/components/content/ContentSearchButton.vue +43 -5
  121. package/dist/runtime/components/content/ContentSearchButton.vue.d.ts +2 -3
  122. package/dist/runtime/components/content/ContentSurround.vue +7 -1
  123. package/dist/runtime/components/locale/LocaleSelect.d.vue.ts +11 -7
  124. package/dist/runtime/components/locale/LocaleSelect.vue +50 -6
  125. package/dist/runtime/components/locale/LocaleSelect.vue.d.ts +11 -7
  126. package/dist/runtime/components/prose/Callout.vue +4 -0
  127. package/dist/runtime/composables/index.d.ts +8 -0
  128. package/dist/runtime/composables/index.js +8 -0
  129. package/dist/runtime/composables/useFileUpload.d.ts +2 -1
  130. package/dist/runtime/composables/useFileUpload.js +13 -4
  131. package/dist/runtime/index.css +1 -1
  132. package/dist/runtime/inertia/components/Link.d.vue.ts +17 -10
  133. package/dist/runtime/inertia/components/Link.vue +8 -6
  134. package/dist/runtime/inertia/components/Link.vue.d.ts +17 -10
  135. package/dist/runtime/inertia/stubs.d.ts +1 -1
  136. package/dist/runtime/plugins/colors.js +4 -8
  137. package/dist/runtime/types/html.d.ts +8 -0
  138. package/dist/runtime/types/index.d.ts +2 -0
  139. package/dist/runtime/types/index.js +2 -0
  140. package/dist/runtime/types/input.d.ts +5 -5
  141. package/dist/runtime/types/utils.d.ts +2 -0
  142. package/dist/runtime/utils/content.d.ts +2 -2
  143. package/dist/runtime/utils/dashboard.d.ts +1 -1
  144. package/dist/runtime/utils/link.d.ts +1 -0
  145. package/dist/runtime/utils/link.js +40 -24
  146. package/dist/runtime/vue/components/Link.d.vue.ts +8 -37
  147. package/dist/runtime/vue/components/Link.vue +6 -11
  148. package/dist/runtime/vue/components/Link.vue.d.ts +8 -37
  149. package/dist/runtime/vue/components/color-mode/ColorModeButton.d.vue.ts +2 -2
  150. package/dist/runtime/vue/components/color-mode/ColorModeButton.vue +55 -5
  151. package/dist/runtime/vue/components/color-mode/ColorModeButton.vue.d.ts +2 -2
  152. package/dist/runtime/vue/components/color-mode/ColorModeSelect.d.vue.ts +5 -3
  153. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue +46 -3
  154. package/dist/runtime/vue/components/color-mode/ColorModeSelect.vue.d.ts +5 -3
  155. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.d.vue.ts +1 -1
  156. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue +24 -3
  157. package/dist/runtime/vue/components/color-mode/ColorModeSwitch.vue.d.ts +1 -1
  158. package/dist/runtime/vue/stubs.d.ts +2 -2
  159. package/dist/runtime/vue/stubs.js +1 -1
  160. package/dist/shared/{b24ui-nuxt.CEMVb5Ee.mjs → b24ui-nuxt.CXLCGBie.mjs} +353 -128
  161. package/dist/unplugin.d.mts +3 -1
  162. package/dist/unplugin.mjs +4 -3
  163. package/dist/vite.mjs +3 -3
  164. package/package.json +27 -17
  165. /package/dist/runtime/{air-design-tokens/002_b24_context_utility.css → types/html.js} +0 -0
@@ -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. */
@@ -38,7 +39,7 @@ export type FormProps<S extends FormSchema, T extends boolean = true, N extends
38
39
  * If true, this form will attach to its parent Form and validate at the same time.
39
40
  * @defaultValue `false`
40
41
  */
41
- nested?: N;
42
+ nested?: N & boolean;
42
43
  /**
43
44
  * When `true`, all form elements will be disabled on `@submit` event.
44
45
  * This will cause any focused input elements to lose their focus state.
@@ -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];
@@ -22,7 +22,7 @@ const props = defineProps({
22
22
  name: { type: null, required: false },
23
23
  validateOnInputDelay: { type: Number, required: false, default: 300 },
24
24
  transform: { type: null, required: false, default: () => true },
25
- nested: { type: null, required: false },
25
+ nested: { type: Boolean, required: false },
26
26
  loadingAuto: { type: Boolean, required: false, default: true },
27
27
  class: { type: null, required: false },
28
28
  onSubmit: { type: Function, required: false }
@@ -33,12 +33,11 @@ const appConfig = useAppConfig();
33
33
  const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.form || {} }));
34
34
  const formId = props.id ?? useId();
35
35
  const bus = useEventBus(`form-${formId}`);
36
- const isNested = props.nested?.toString() === "" || props.nested === true;
37
- const parentBus = isNested && inject(
36
+ const parentBus = props.nested === true && inject(
38
37
  formBusInjectionKey,
39
38
  void 0
40
39
  );
41
- const parentState = isNested ? inject(formStateInjectionKey, void 0) : void 0;
40
+ const parentState = props.nested === true ? inject(formStateInjectionKey, void 0) : void 0;
42
41
  const state = computed(() => {
43
42
  if (parentState?.value) {
44
43
  return props.name ? getAtPath(parentState.value, props.name) : parentState.value;
@@ -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. */
@@ -38,7 +39,7 @@ export type FormProps<S extends FormSchema, T extends boolean = true, N extends
38
39
  * If true, this form will attach to its parent Form and validate at the same time.
39
40
  * @defaultValue `false`
40
41
  */
41
- nested?: N;
42
+ nested?: N & boolean;
42
43
  /**
43
44
  * When `true`, all form elements will be disabled on `@submit` event.
44
45
  * This will cause any focused input elements to lose their focus state.
@@ -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,115 @@
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
+ /**
65
+ * The locale to use for formatting and parsing numbers.
66
+ * @defaultValue B24App.locale.code
67
+ */
68
+ locale?: string;
69
+ defaultValue?: InputDateDefaultValue<R>;
70
+ modelValue?: InputDateModelValue<R>;
71
+ class?: any;
72
+ b24ui?: InputDate['slots'];
73
+ }
74
+ export interface InputDateEmits<R extends boolean> extends Omit<DateFieldRootEmits & DateRangeFieldRootEmits, 'update:modelValue'> {
75
+ 'update:modelValue': [date: InputDateModelValue<R>];
76
+ 'change': [event: Event];
77
+ 'blur': [event: FocusEvent];
78
+ 'focus': [event: FocusEvent];
79
+ }
80
+ export interface InputDateSlots {
81
+ leading(props: {
82
+ b24ui: InputDate['b24ui'];
83
+ }): any;
84
+ default(props: {
85
+ b24ui: InputDate['b24ui'];
86
+ }): any;
87
+ trailing(props: {
88
+ b24ui: InputDate['b24ui'];
89
+ }): any;
90
+ separator(props: {
91
+ b24ui: InputDate['b24ui'];
92
+ }): any;
93
+ }
94
+ 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<{
95
+ props: __VLS_PrettifyLocal<InputDateProps<R> & {
96
+ onChange?: ((event: Event) => any) | undefined;
97
+ onBlur?: ((event: FocusEvent) => any) | undefined;
98
+ onFocus?: ((event: FocusEvent) => any) | undefined;
99
+ "onUpdate:modelValue"?: ((date: InputDateModelValue<R>) => any) | undefined;
100
+ "onUpdate:placeholder"?: ((...args: DateValue[]) => any) | undefined;
101
+ }> & import("vue").PublicProps;
102
+ expose: (exposed: import("vue").ShallowUnwrapRef<{
103
+ inputsRef: import("vue").Ref<ComponentPublicInstance[], ComponentPublicInstance[]>;
104
+ }>) => void;
105
+ attrs: any;
106
+ slots: InputDateSlots;
107
+ 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);
108
+ }>) => import("vue").VNode & {
109
+ __ctx?: Awaited<typeof __VLS_setup>;
110
+ };
111
+ declare const _default: typeof __VLS_export;
112
+ export default _default;
113
+ type __VLS_PrettifyLocal<T> = {
114
+ [K in keyof T as K]: T[K];
115
+ } & {};
@@ -0,0 +1,198 @@
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 { useLocale } from "../composables/useLocale";
15
+ import { tv } from "../utils/tv";
16
+ import icons from "../dictionary/icons";
17
+ import B24Badge from "./Badge.vue";
18
+ import B24Avatar from "./Avatar.vue";
19
+ defineOptions({ inheritAttrs: false });
20
+ const props = defineProps({
21
+ as: { type: null, 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
+ tag: { type: String, required: false },
29
+ tagColor: { type: null, required: false },
30
+ highlight: { type: Boolean, required: false },
31
+ autofocus: { type: Boolean, required: false },
32
+ autofocusDelay: { type: Number, required: false, default: 0 },
33
+ separatorIcon: { type: [Function, Object], required: false },
34
+ range: { type: Boolean, required: false },
35
+ locale: { type: String, required: false },
36
+ defaultValue: { type: null, required: false },
37
+ modelValue: { type: null, required: false },
38
+ class: { type: null, required: false },
39
+ b24ui: { type: null, required: false },
40
+ icon: { type: [Function, Object], required: false },
41
+ avatar: { type: Object, required: false },
42
+ loading: { type: Boolean, required: false },
43
+ trailing: { type: Boolean, required: false },
44
+ trailingIcon: { type: [Function, Object], required: false },
45
+ defaultPlaceholder: { type: null, required: false },
46
+ placeholder: { type: null, required: false },
47
+ hourCycle: { type: null, required: false },
48
+ step: { type: Object, required: false },
49
+ granularity: { type: String, required: false },
50
+ hideTimeZone: { type: Boolean, required: false },
51
+ maxValue: { type: null, required: false },
52
+ minValue: { type: null, required: false },
53
+ disabled: { type: Boolean, required: false },
54
+ readonly: { type: Boolean, required: false },
55
+ isDateUnavailable: { type: Function, required: false },
56
+ id: { type: String, required: false },
57
+ name: { type: String, required: false },
58
+ required: { type: Boolean, required: false }
59
+ });
60
+ const emits = defineEmits(["update:modelValue", "change", "blur", "focus", "update:placeholder"]);
61
+ const slots = defineSlots();
62
+ const { code: codeLocale, dir } = useLocale();
63
+ const appConfig = useAppConfig();
64
+ const rootProps = useForwardPropsEmits(reactiveOmit(props, "id", "name", "range", "modelValue", "defaultValue", "color", "size", "highlight", "disabled", "autofocus", "autofocusDelay", "icon", "avatar", "trailingIcon", "loading", "separatorIcon", "class", "b24ui"), emits);
65
+ const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
66
+ const { orientation, size: fieldGroupSize } = useFieldGroup(props);
67
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props);
68
+ const [DefineSegmentsTemplate, ReuseSegmentsTemplate] = createReusableTemplate();
69
+ const locale = computed(() => props.locale || codeLocale.value);
70
+ const inputSize = computed(() => fieldGroupSize.value || formGroupSize.value);
71
+ const isTag = computed(() => {
72
+ return props.tag;
73
+ });
74
+ const b24ui = computed(() => tv({ extend: tv(theme), ...appConfig.b24ui?.inputDate || {} })({
75
+ color: color.value,
76
+ size: inputSize.value,
77
+ loading: props.loading,
78
+ highlight: highlight.value,
79
+ rounded: Boolean(props.rounded),
80
+ noPadding: Boolean(props.noPadding),
81
+ noBorder: Boolean(props.noBorder),
82
+ underline: Boolean(props.underline),
83
+ leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
84
+ trailing: Boolean(isTrailing.value || !!slots.trailing),
85
+ fieldGroup: orientation.value
86
+ }));
87
+ const inputsRef = ref([]);
88
+ function onUpdate(value) {
89
+ const event = new Event("change", { target: { value } });
90
+ emits("change", event);
91
+ emitFormChange();
92
+ emitFormInput();
93
+ }
94
+ function onBlur(event) {
95
+ emitFormBlur();
96
+ emits("blur", event);
97
+ }
98
+ function onFocus(event) {
99
+ emitFormFocus();
100
+ emits("focus", event);
101
+ }
102
+ function autoFocus() {
103
+ if (props.autofocus) {
104
+ inputsRef.value[0]?.$el?.focus();
105
+ }
106
+ }
107
+ onMounted(() => {
108
+ setTimeout(() => {
109
+ autoFocus();
110
+ }, props.autofocusDelay);
111
+ });
112
+ const DateField = computed(() => props.range ? RangeDateField : SingleDateField);
113
+ defineExpose({
114
+ inputsRef
115
+ });
116
+ </script>
117
+
118
+ <template>
119
+ <DefineSegmentsTemplate v-slot="{ segments, type }">
120
+ <DateField.Input
121
+ v-for="(segment, index) in segments"
122
+ :key="`${segment.part}-${index}`"
123
+ :ref="(el) => inputsRef[index] = el"
124
+ :type="type"
125
+ :part="segment.part"
126
+ :class="b24ui.segment({ class: props.b24ui?.segment })"
127
+ :data-segment="segment.part"
128
+ >
129
+ {{ segment.value.trim() }}
130
+ </DateField.Input>
131
+ </DefineSegmentsTemplate>
132
+
133
+ <DateField.Root
134
+ v-bind="{ ...rootProps, ...$attrs, ...ariaAttrs }"
135
+ :id="id"
136
+ v-slot="{ segments }"
137
+ :model-value="modelValue"
138
+ :default-value="defaultValue"
139
+ :name="name"
140
+ :disabled="disabled"
141
+ :locale="locale"
142
+ :dir="dir"
143
+ :class="b24ui.base({ class: [props.b24ui?.base, props.class] })"
144
+ @update:model-value="onUpdate"
145
+ @blur="onBlur"
146
+ @focus="onFocus"
147
+ >
148
+ <B24Badge
149
+ v-if="isTag"
150
+ :class="b24ui.tag({ class: props.b24ui?.tag })"
151
+ :color="props.tagColor"
152
+ :label="props.tag"
153
+ size="xs"
154
+ />
155
+
156
+ <template v-if="Array.isArray(segments)">
157
+ <ReuseSegmentsTemplate :segments="segments" />
158
+ </template>
159
+ <template v-else>
160
+ <ReuseSegmentsTemplate :segments="segments.start" type="start" />
161
+ <slot name="separator" :b24ui="b24ui">
162
+ <Component
163
+ :is="separatorIcon || icons.minus"
164
+ :class="b24ui.separatorIcon({ class: props.b24ui?.separatorIcon })"
165
+ />
166
+ </slot>
167
+ <ReuseSegmentsTemplate :segments="segments.end" type="end" />
168
+ </template>
169
+
170
+ <slot :b24ui="b24ui" />
171
+
172
+ <span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
173
+ <slot name="leading" :b24ui="b24ui">
174
+ <Component
175
+ :is="leadingIconName"
176
+ v-if="isLeading && leadingIconName"
177
+ :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
178
+ />
179
+ <B24Avatar
180
+ v-else-if="!!avatar"
181
+ :size="props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()"
182
+ v-bind="avatar"
183
+ :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
184
+ />
185
+ </slot>
186
+ </span>
187
+
188
+ <span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
189
+ <slot name="trailing" :b24ui="b24ui">
190
+ <Component
191
+ :is="trailingIconName"
192
+ v-if="trailingIconName"
193
+ :class="b24ui.trailingIcon({ class: props.b24ui?.trailingIcon })"
194
+ />
195
+ </slot>
196
+ </span>
197
+ </DateField.Root>
198
+ </template>