@bitrix24/b24ui-nuxt 0.5.8 → 0.5.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/module.cjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  const defu = require('defu');
4
4
  const kit = require('@nuxt/kit');
5
- const templates = require('./shared/b24ui-nuxt.B9fPD5yO.cjs');
5
+ const templates = require('./shared/b24ui-nuxt.BVg3rkkG.cjs');
6
6
  require('node:url');
7
7
  require('scule');
8
8
 
package/dist/module.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "nuxt": ">=3.16.0"
6
6
  },
7
7
  "docs": "https://bitrix24.github.io/b24ui/guide/installation-nuxt-app.html",
8
- "version": "0.5.8",
8
+ "version": "0.5.9",
9
9
  "builder": {
10
10
  "@nuxt/module-builder": "0.8.4",
11
11
  "unbuild": "2.0.0"
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defu } from 'defu';
2
2
  import { defineNuxtModule, createResolver, addVitePlugin, addPlugin, addComponentsDir, addImportsDir, hasNuxtModule, installModule } from '@nuxt/kit';
3
- import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.DBFS6LH7.mjs';
3
+ import { d as defaultOptions, a as getDefaultUiConfig, b as addTemplates } from './shared/b24ui-nuxt.C1lGF53R.mjs';
4
4
  import 'node:url';
5
5
  import 'scule';
6
6
 
@@ -155,12 +155,6 @@ const b24ui = computed(() => input({
155
155
 
156
156
  const inputRef = ref<HTMLInputElement | null>(null)
157
157
 
158
- function autoFocus() {
159
- if (props.autofocus) {
160
- inputRef.value?.focus()
161
- }
162
- }
163
-
164
158
  // Custom function to handle the v-model properties
165
159
  function updateInput(value: string | null) {
166
160
  if (modelModifiers.trim) {
@@ -206,15 +200,21 @@ function onBlur(event: FocusEvent) {
206
200
  emits('blur', event)
207
201
  }
208
202
 
209
- defineExpose({
210
- inputRef
211
- })
203
+ function autoFocus() {
204
+ if (props.autofocus) {
205
+ inputRef.value?.focus()
206
+ }
207
+ }
212
208
 
213
209
  onMounted(() => {
214
210
  setTimeout(() => {
215
211
  autoFocus()
216
212
  }, props.autofocusDelay)
217
213
  })
214
+
215
+ defineExpose({
216
+ inputRef
217
+ })
218
218
  </script>
219
219
 
220
220
  <template>
@@ -165,18 +165,6 @@ const decrementIcon = computed(() => props.decrementIcon || (props.orientation =
165
165
 
166
166
  const inputRef = ref<InstanceType<typeof NumberFieldInput> | null>(null)
167
167
 
168
- function autoFocus() {
169
- if (props.autofocus) {
170
- inputRef.value?.$el?.focus()
171
- }
172
- }
173
-
174
- onMounted(() => {
175
- setTimeout(() => {
176
- autoFocus()
177
- }, props.autofocusDelay)
178
- })
179
-
180
168
  function onUpdate(value: number) {
181
169
  // @ts-expect-error - 'target' does not exist in type 'EventInit'
182
170
  const event = new Event('change', { target: { value } })
@@ -191,6 +179,18 @@ function onBlur(event: FocusEvent) {
191
179
  emits('blur', event)
192
180
  }
193
181
 
182
+ function autoFocus() {
183
+ if (props.autofocus) {
184
+ inputRef.value?.$el?.focus()
185
+ }
186
+ }
187
+
188
+ onMounted(() => {
189
+ setTimeout(() => {
190
+ autoFocus()
191
+ }, props.autofocusDelay)
192
+ })
193
+
194
194
  defineExpose({
195
195
  inputRef
196
196
  })
@@ -3,7 +3,9 @@ import type { VariantProps } from 'tailwind-variants'
3
3
  import type { AppConfig } from '@nuxt/schema'
4
4
  import _appConfig from '#build/app.config'
5
5
  import theme from '#build/b24ui/textarea'
6
+ import type { UseComponentIconsProps } from '../composables/useComponentIcons'
6
7
  import { tv } from '../utils/tv'
8
+ import type { AvatarProps } from '../types'
7
9
  import type { PartialString } from '../types/utils'
8
10
 
9
11
  const appConfigTextarea = _appConfig as AppConfig & { b24ui: { textarea: Partial<typeof theme> } }
@@ -12,7 +14,7 @@ const textarea = tv({ extend: tv(theme), ...(appConfigTextarea.b24ui?.textarea |
12
14
 
13
15
  type TextareaVariants = VariantProps<typeof textarea>
14
16
 
15
- export interface TextareaProps {
17
+ export interface TextareaProps extends UseComponentIconsProps {
16
18
  /**
17
19
  * The element or component this component should render as.
18
20
  * @defaultValue 'div'
@@ -60,6 +62,14 @@ export interface TextareaProps {
60
62
  * @defaultValue 0
61
63
  */
62
64
  autofocusDelay?: number
65
+ /**
66
+ * @defaultValue false
67
+ */
68
+ autoresize?: boolean
69
+ /**
70
+ * @defaultValue 0
71
+ */
72
+ autoresizeDelay?: number
63
73
  /**
64
74
  * @defaultValue false
65
75
  */
@@ -72,10 +82,6 @@ export interface TextareaProps {
72
82
  * @defaultValue 5
73
83
  */
74
84
  maxrows?: number
75
- /**
76
- * @defaultValue false
77
- */
78
- autoresize?: boolean
79
85
  tag?: string
80
86
  /**
81
87
  * @defaultValue 'primary'
@@ -97,29 +103,35 @@ export interface TextareaEmits {
97
103
  }
98
104
 
99
105
  export interface TextareaSlots {
106
+ leading(props?: {}): any
100
107
  default(props?: {}): any
108
+ trailing(props?: {}): any
101
109
  }
102
110
  </script>
103
111
 
104
112
  <script setup lang="ts">
105
113
  import { ref, computed, onMounted, nextTick, watch } from 'vue'
106
114
  import { Primitive } from 'reka-ui'
115
+ import { useComponentIcons } from '../composables/useComponentIcons'
107
116
  import { useFormField } from '../composables/useFormField'
108
117
  import { looseToNumber } from '../utils'
118
+ import B24Avatar from './Avatar.vue'
109
119
 
110
120
  defineOptions({ inheritAttrs: false })
111
121
 
112
122
  const props = withDefaults(defineProps<TextareaProps>(), {
113
123
  rows: 3,
114
124
  maxrows: 5,
115
- autofocusDelay: 0
125
+ autofocusDelay: 0,
126
+ autoresizeDelay: 0
116
127
  })
117
- defineSlots<TextareaSlots>()
128
+ const slots = defineSlots<TextareaSlots>()
118
129
  const emits = defineEmits<TextareaEmits>()
119
130
 
120
131
  const [modelValue, modelModifiers] = defineModel<string | number | null>()
121
132
 
122
133
  const { emitFormFocus, emitFormBlur, emitFormInput, emitFormChange, color, id, name, highlight, disabled, ariaAttrs } = useFormField<TextareaProps>(props, { deferInputValidation: true })
134
+ const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(props)
123
135
 
124
136
  const isTag = computed(() => {
125
137
  return props.tag
@@ -127,22 +139,20 @@ const isTag = computed(() => {
127
139
 
128
140
  const b24ui = computed(() => textarea({
129
141
  color: color.value,
142
+ loading: props.loading,
130
143
  highlight: highlight.value,
144
+ autoresize: Boolean(props.autoresize),
131
145
  tagColor: props.tagColor,
132
146
  rounded: Boolean(props.rounded),
133
147
  noPadding: Boolean(props.noPadding),
134
148
  noBorder: Boolean(props.noBorder),
135
- underline: Boolean(props.underline)
149
+ underline: Boolean(props.underline),
150
+ leading: Boolean(isLeading.value || !!props.avatar || !!slots.leading),
151
+ trailing: Boolean(isTrailing.value || !!slots.trailing)
136
152
  }))
137
153
 
138
154
  const textareaRef = ref<HTMLTextAreaElement | null>(null)
139
155
 
140
- function autoFocus() {
141
- if (props.autofocus) {
142
- textareaRef.value?.focus()
143
- }
144
- }
145
-
146
156
  // Custom function to handle the v-model properties
147
157
  function updateInput(value: string | null) {
148
158
  if (modelModifiers.trim) {
@@ -190,18 +200,14 @@ function onBlur(event: FocusEvent) {
190
200
  emits('blur', event)
191
201
  }
192
202
 
193
- onMounted(() => {
194
- setTimeout(() => {
195
- autoFocus()
196
- }, props.autofocusDelay)
197
- })
203
+ function autoFocus() {
204
+ if (props.autofocus) {
205
+ textareaRef.value?.focus()
206
+ }
207
+ }
198
208
 
199
209
  function autoResize() {
200
- if (props.autoresize) {
201
- if (!textareaRef.value) {
202
- return
203
- }
204
-
210
+ if (props.autoresize && textareaRef.value) {
205
211
  textareaRef.value.rows = props.rows
206
212
  const overflow = textareaRef.value.style.overflow
207
213
  textareaRef.value.style.overflow = 'hidden'
@@ -226,14 +232,18 @@ watch(modelValue, () => {
226
232
  nextTick(autoResize)
227
233
  })
228
234
 
229
- defineExpose({
230
- textareaRef
231
- })
232
-
233
235
  onMounted(() => {
236
+ setTimeout(() => {
237
+ autoFocus()
238
+ }, props.autofocusDelay)
239
+
234
240
  setTimeout(() => {
235
241
  autoResize()
236
- }, 100)
242
+ }, props.autoresizeDelay)
243
+ })
244
+
245
+ defineExpose({
246
+ textareaRef
237
247
  })
238
248
  </script>
239
249
 
@@ -261,5 +271,31 @@ onMounted(() => {
261
271
  />
262
272
 
263
273
  <slot />
274
+
275
+ <span v-if="isLeading || !!avatar || !!slots.leading" :class="b24ui.leading({ class: props.b24ui?.leading })">
276
+ <slot name="leading">
277
+ <Component
278
+ :is="leadingIconName"
279
+ v-if="isLeading && leadingIconName"
280
+ :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })"
281
+ />
282
+ <B24Avatar
283
+ v-else-if="!!avatar"
284
+ :size="((props.b24ui?.leadingAvatarSize || b24ui.leadingAvatarSize()) as AvatarProps['size'])"
285
+ v-bind="avatar"
286
+ :class="b24ui.leadingAvatar({ class: props.b24ui?.leadingAvatar })"
287
+ />
288
+ </slot>
289
+ </span>
290
+
291
+ <span v-if="isTrailing || !!slots.trailing" :class="b24ui.trailing({ class: props.b24ui?.trailing })">
292
+ <slot name="trailing">
293
+ <Component
294
+ :is="trailingIconName"
295
+ v-if="trailingIconName"
296
+ :class="b24ui.trailingIcon({ class: props.b24ui?.trailingIcon })"
297
+ />
298
+ </slot>
299
+ </span>
264
300
  </Primitive>
265
301
  </template>
@@ -22,6 +22,6 @@ export interface UseComponentIconsProps {
22
22
  export declare function useComponentIcons(componentProps: MaybeRefOrGetter<UseComponentIconsProps>): {
23
23
  isLeading: import("vue").ComputedRef<any>;
24
24
  isTrailing: import("vue").ComputedRef<boolean>;
25
- leadingIconName: import("vue").ComputedRef<IconComponent | undefined>;
26
- trailingIconName: import("vue").ComputedRef<IconComponent | undefined>;
25
+ leadingIconName: import("vue").ComputedRef<import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}> | undefined>;
26
+ trailingIconName: import("vue").ComputedRef<import("vue").FunctionalComponent<import("vue").HTMLAttributes & import("vue").VNodeProps, {}, any, {}> | undefined>;
27
27
  };
@@ -9,10 +9,10 @@ export { useConfetti } from '../composables/useConfetti';
9
9
  export { useOverlay } from '../composables/useOverlay';
10
10
  export declare const useColorMode: () => {
11
11
  forced: boolean;
12
- preference?: "dark" | "light" | "system";
12
+ preference?: "light" | "dark" | "system";
13
13
  readonly value?: import("@vueuse/core").BasicColorMode;
14
14
  } | {
15
- preference: "dark" | "light" | "system";
15
+ preference: "light" | "dark" | "system";
16
16
  readonly value: import("@vueuse/core").BasicColorMode;
17
17
  forced: boolean;
18
18
  };
@@ -6222,6 +6222,12 @@ const textarea = {
6222
6222
  "font-b24-primary font-regular text-md leading-normal",
6223
6223
  "align-middle"
6224
6224
  ].join(" "),
6225
+ leading: "absolute start-0 flex items-start inset-y-1.5 px-1.5",
6226
+ leadingIcon: "shrink-0 text-base-400 inset-y-1.5 size-lg2",
6227
+ leadingAvatar: "shrink-0",
6228
+ leadingAvatarSize: "xs",
6229
+ trailing: "absolute end-0 flex items-start inset-y-1.5 px-1.5",
6230
+ trailingIcon: "shrink-0 text-base-400 size-lg2",
6225
6231
  tag: [
6226
6232
  "pointer-events-none select-none",
6227
6233
  "absolute z-10 -top-1.5 right-3 h-sm px-1.5 flex flex-col justify-center items-center",
@@ -6230,6 +6236,11 @@ const textarea = {
6230
6236
  },
6231
6237
  variants: {
6232
6238
  ...buttonGroupVariantWithRoot,
6239
+ autoresize: {
6240
+ true: {
6241
+ base: "resize-none"
6242
+ }
6243
+ },
6233
6244
  color: {
6234
6245
  default: "",
6235
6246
  danger: "",
@@ -6281,6 +6292,15 @@ const textarea = {
6281
6292
  underline: {
6282
6293
  true: "ring-0 focus-visible:ring-0 border-b border-b-base-300 rounded-none"
6283
6294
  },
6295
+ leading: {
6296
+ true: ""
6297
+ },
6298
+ trailing: {
6299
+ true: ""
6300
+ },
6301
+ loading: {
6302
+ true: ""
6303
+ },
6284
6304
  highlight: {
6285
6305
  true: ""
6286
6306
  }
@@ -6509,8 +6529,37 @@ const textarea = {
6509
6529
  noBorder: false,
6510
6530
  underline: true,
6511
6531
  class: "border-b-ai-500 dark:border-b-ai-600"
6512
- }
6532
+ },
6533
+ // endregion ////
6534
+ // endregion ////
6535
+ // region leading ////
6536
+ {
6537
+ leading: true,
6538
+ class: "ps-8"
6539
+ },
6513
6540
  // endregion ////
6541
+ // region trailing ////
6542
+ {
6543
+ trailing: true,
6544
+ class: "pe-8"
6545
+ },
6546
+ // endregion ////
6547
+ // region loading ////
6548
+ {
6549
+ loading: true,
6550
+ leading: true,
6551
+ class: {
6552
+ leadingIcon: "size-[21px]"
6553
+ }
6554
+ },
6555
+ {
6556
+ loading: true,
6557
+ leading: false,
6558
+ trailing: true,
6559
+ class: {
6560
+ trailingIcon: "size-[21px]"
6561
+ }
6562
+ }
6514
6563
  // endregion ////
6515
6564
  ],
6516
6565
  defaultVariants: {
@@ -6220,6 +6220,12 @@ const textarea = {
6220
6220
  "font-b24-primary font-regular text-md leading-normal",
6221
6221
  "align-middle"
6222
6222
  ].join(" "),
6223
+ leading: "absolute start-0 flex items-start inset-y-1.5 px-1.5",
6224
+ leadingIcon: "shrink-0 text-base-400 inset-y-1.5 size-lg2",
6225
+ leadingAvatar: "shrink-0",
6226
+ leadingAvatarSize: "xs",
6227
+ trailing: "absolute end-0 flex items-start inset-y-1.5 px-1.5",
6228
+ trailingIcon: "shrink-0 text-base-400 size-lg2",
6223
6229
  tag: [
6224
6230
  "pointer-events-none select-none",
6225
6231
  "absolute z-10 -top-1.5 right-3 h-sm px-1.5 flex flex-col justify-center items-center",
@@ -6228,6 +6234,11 @@ const textarea = {
6228
6234
  },
6229
6235
  variants: {
6230
6236
  ...buttonGroupVariantWithRoot,
6237
+ autoresize: {
6238
+ true: {
6239
+ base: "resize-none"
6240
+ }
6241
+ },
6231
6242
  color: {
6232
6243
  default: "",
6233
6244
  danger: "",
@@ -6279,6 +6290,15 @@ const textarea = {
6279
6290
  underline: {
6280
6291
  true: "ring-0 focus-visible:ring-0 border-b border-b-base-300 rounded-none"
6281
6292
  },
6293
+ leading: {
6294
+ true: ""
6295
+ },
6296
+ trailing: {
6297
+ true: ""
6298
+ },
6299
+ loading: {
6300
+ true: ""
6301
+ },
6282
6302
  highlight: {
6283
6303
  true: ""
6284
6304
  }
@@ -6507,8 +6527,37 @@ const textarea = {
6507
6527
  noBorder: false,
6508
6528
  underline: true,
6509
6529
  class: "border-b-ai-500 dark:border-b-ai-600"
6510
- }
6530
+ },
6531
+ // endregion ////
6532
+ // endregion ////
6533
+ // region leading ////
6534
+ {
6535
+ leading: true,
6536
+ class: "ps-8"
6537
+ },
6511
6538
  // endregion ////
6539
+ // region trailing ////
6540
+ {
6541
+ trailing: true,
6542
+ class: "pe-8"
6543
+ },
6544
+ // endregion ////
6545
+ // region loading ////
6546
+ {
6547
+ loading: true,
6548
+ leading: true,
6549
+ class: {
6550
+ leadingIcon: "size-[21px]"
6551
+ }
6552
+ },
6553
+ {
6554
+ loading: true,
6555
+ leading: false,
6556
+ trailing: true,
6557
+ class: {
6558
+ trailingIcon: "size-[21px]"
6559
+ }
6560
+ }
6512
6561
  // endregion ////
6513
6562
  ],
6514
6563
  defaultVariants: {
package/dist/unplugin.cjs CHANGED
@@ -5,7 +5,7 @@ const pathe = require('pathe');
5
5
  const unplugin = require('unplugin');
6
6
  const defu = require('defu');
7
7
  const tailwind = require('@tailwindcss/vite');
8
- const templates = require('./shared/b24ui-nuxt.B9fPD5yO.cjs');
8
+ const templates = require('./shared/b24ui-nuxt.BVg3rkkG.cjs');
9
9
  const tinyglobby = require('tinyglobby');
10
10
  const knitwork = require('knitwork');
11
11
  const MagicString = require('magic-string');
package/dist/unplugin.mjs CHANGED
@@ -3,7 +3,7 @@ import { join, normalize } from 'pathe';
3
3
  import { createUnplugin } from 'unplugin';
4
4
  import { defu } from 'defu';
5
5
  import tailwind from '@tailwindcss/vite';
6
- import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.DBFS6LH7.mjs';
6
+ import { g as getTemplates, d as defaultOptions, a as getDefaultUiConfig } from './shared/b24ui-nuxt.C1lGF53R.mjs';
7
7
  import { globSync } from 'tinyglobby';
8
8
  import { genSafeVariableName } from 'knitwork';
9
9
  import MagicString from 'magic-string';
package/dist/vite.cjs CHANGED
@@ -6,7 +6,7 @@ require('pathe');
6
6
  require('unplugin');
7
7
  require('defu');
8
8
  require('@tailwindcss/vite');
9
- require('./shared/b24ui-nuxt.B9fPD5yO.cjs');
9
+ require('./shared/b24ui-nuxt.BVg3rkkG.cjs');
10
10
  require('scule');
11
11
  require('@nuxt/kit');
12
12
  require('tinyglobby');
package/dist/vite.mjs CHANGED
@@ -4,7 +4,7 @@ import 'pathe';
4
4
  import 'unplugin';
5
5
  import 'defu';
6
6
  import '@tailwindcss/vite';
7
- import './shared/b24ui-nuxt.DBFS6LH7.mjs';
7
+ import './shared/b24ui-nuxt.C1lGF53R.mjs';
8
8
  import 'scule';
9
9
  import '@nuxt/kit';
10
10
  import 'tinyglobby';
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@bitrix24/b24ui-nuxt",
3
3
  "description": "Bitrix24 UI-Kit for developing web applications REST API for NUXT & VUE",
4
- "version": "0.5.8",
4
+ "version": "0.5.9",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/bitrix24/b24ui.git"
@@ -72,8 +72,8 @@
72
72
  "@bitrix24/b24style": "^1.0.1",
73
73
  "@internationalized/date": "^3.7.0",
74
74
  "@internationalized/number": "^3.6.0",
75
- "@nuxt/kit": "^3.16.1",
76
- "@nuxt/schema": "^3.16.1",
75
+ "@nuxt/kit": "^3.16.2",
76
+ "@nuxt/schema": "^3.16.2",
77
77
  "@nuxtjs/color-mode": "^3.5.2",
78
78
  "@standard-schema/spec": "^1.0.0",
79
79
  "@tailwindcss/postcss": "^4.0.17",
@@ -121,7 +121,7 @@
121
121
  "embla-carousel": "^8.5.2",
122
122
  "eslint": "^9.23.0",
123
123
  "happy-dom": "^17.4.4",
124
- "nuxt": "^3.16.1",
124
+ "nuxt": "^3.16.2",
125
125
  "nuxt-component-meta": "^0.10.0",
126
126
  "vitepress": "^1.5.0",
127
127
  "vitest": "^3.1.1",