@bitrix24/b24ui-nuxt 2.1.3 → 2.1.4

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/meta.d.mts CHANGED
@@ -12086,16 +12086,10 @@ var B24UIMeta = {
12086
12086
  }
12087
12087
  }
12088
12088
  ],
12089
- "slots": [
12090
- {
12091
- "name": "fallback",
12092
- "type": "{} | undefined",
12093
- "description": ""
12094
- }
12095
- ],
12089
+ "slots": [],
12096
12090
  "events": [],
12097
12091
  "exposed": [],
12098
- "hash": "WNaDY6B1xJ7xA0ohtfxzS7iTUGYt8zzKKg3GG9N-lVk"
12092
+ "hash": "gNcve841eye260cg6qWtLrbJEhVCAAZEqbvjcy-hw1U"
12099
12093
  }
12100
12094
  },
12101
12095
  "B24ColorModeImage": {
@@ -50591,7 +50585,7 @@ var B24UIMeta = {
50591
50585
  }
50592
50586
  ],
50593
50587
  "exposed": [],
50594
- "hash": "fsAvorFvSxnI7-ZnaFRXOxDKgpb2gSM_VLWJNNRxU9E"
50588
+ "hash": "DchR7JEFAoPxlZnMYa9Mz_ibXwN55wlt817VlGA0rq8"
50595
50589
  }
50596
50590
  },
50597
50591
  "B24Container": {
@@ -82774,7 +82768,7 @@ var B24UIMeta = {
82774
82768
  }
82775
82769
  ],
82776
82770
  "exposed": [],
82777
- "hash": "KMwA1ZzTZVC3HNDDnbT4-F0XHE5U_9wUb9r0-RcMEAw"
82771
+ "hash": "kTnvAgyFW-xm0udyy9wM1yD3VzzGNyLjueHb9YmY288"
82778
82772
  }
82779
82773
  },
82780
82774
  "B24InputNumber": {
@@ -111336,7 +111330,7 @@ var B24UIMeta = {
111336
111330
  }
111337
111331
  ],
111338
111332
  "exposed": [],
111339
- "hash": "mZPIwMZGx-HfrtuznIa7rY7k3xTS-4-1FwLsi_fFvrQ"
111333
+ "hash": "L-Cf6BrsA61GRhgcvGKTebruHjs-W_33usKwCmqwJjU"
111340
111334
  }
111341
111335
  },
111342
111336
  "B24Separator": {
@@ -120995,17 +120989,17 @@ var B24UIMeta = {
120995
120989
  }
120996
120990
  ],
120997
120991
  "required": false,
120998
- "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }) | undefined',
120992
+ "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }) | undefined',
120999
120993
  "schema": {
121000
120994
  "kind": "enum",
121001
- "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }) | undefined',
120995
+ "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }) | undefined',
121002
120996
  "schema": {
121003
120997
  "0": "undefined",
121004
120998
  "1": "false",
121005
120999
  "2": "true",
121006
121000
  "3": {
121007
121001
  "kind": "object",
121008
- "type": 'Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }',
121002
+ "type": 'Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }',
121009
121003
  "schema": {
121010
121004
  "onChange": {
121011
121005
  "name": "onChange",
@@ -121482,7 +121476,7 @@ var B24UIMeta = {
121482
121476
  "estimateSize": {
121483
121477
  "name": "estimateSize",
121484
121478
  "global": false,
121485
- "description": "Estimated size (in px) of each item",
121479
+ "description": "Estimated size (in px) of each item, or a function that returns the size for a given index",
121486
121480
  "tags": [
121487
121481
  {
121488
121482
  "name": "defaultValue",
@@ -121490,8 +121484,20 @@ var B24UIMeta = {
121490
121484
  }
121491
121485
  ],
121492
121486
  "required": false,
121493
- "type": "number | undefined",
121494
- "schema": "number | undefined"
121487
+ "type": "number | ((index: number) => number) | undefined",
121488
+ "schema": {
121489
+ "kind": "enum",
121490
+ "type": "number | ((index: number) => number) | undefined",
121491
+ "schema": {
121492
+ "0": "undefined",
121493
+ "1": "number",
121494
+ "2": {
121495
+ "kind": "event",
121496
+ "type": "(index: number): number",
121497
+ "schema": []
121498
+ }
121499
+ }
121500
+ }
121495
121501
  }
121496
121502
  }
121497
121503
  }
@@ -123543,7 +123549,7 @@ var B24UIMeta = {
123543
123549
  }
123544
123550
  ],
123545
123551
  "exposed": [],
123546
- "hash": "3WqAtDTzBMFPP6FlhE471iGPPP4q9uOFnnT2jKjsm7k"
123552
+ "hash": "irkn8qnmGXuqh5Of_BGFc3-3FcvgqSuiXVRrnfpA1P8"
123547
123553
  }
123548
123554
  },
123549
123555
  "B24TableWrapper": {
package/dist/meta.mjs CHANGED
@@ -12086,16 +12086,10 @@ const B24UIMeta = {
12086
12086
  }
12087
12087
  }
12088
12088
  ],
12089
- "slots": [
12090
- {
12091
- "name": "fallback",
12092
- "type": "{} | undefined",
12093
- "description": ""
12094
- }
12095
- ],
12089
+ "slots": [],
12096
12090
  "events": [],
12097
12091
  "exposed": [],
12098
- "hash": "WNaDY6B1xJ7xA0ohtfxzS7iTUGYt8zzKKg3GG9N-lVk"
12092
+ "hash": "gNcve841eye260cg6qWtLrbJEhVCAAZEqbvjcy-hw1U"
12099
12093
  }
12100
12094
  },
12101
12095
  "B24ColorModeImage": {
@@ -50591,7 +50585,7 @@ const B24UIMeta = {
50591
50585
  }
50592
50586
  ],
50593
50587
  "exposed": [],
50594
- "hash": "fsAvorFvSxnI7-ZnaFRXOxDKgpb2gSM_VLWJNNRxU9E"
50588
+ "hash": "DchR7JEFAoPxlZnMYa9Mz_ibXwN55wlt817VlGA0rq8"
50595
50589
  }
50596
50590
  },
50597
50591
  "B24Container": {
@@ -82774,7 +82768,7 @@ const B24UIMeta = {
82774
82768
  }
82775
82769
  ],
82776
82770
  "exposed": [],
82777
- "hash": "KMwA1ZzTZVC3HNDDnbT4-F0XHE5U_9wUb9r0-RcMEAw"
82771
+ "hash": "kTnvAgyFW-xm0udyy9wM1yD3VzzGNyLjueHb9YmY288"
82778
82772
  }
82779
82773
  },
82780
82774
  "B24InputNumber": {
@@ -111336,7 +111330,7 @@ const B24UIMeta = {
111336
111330
  }
111337
111331
  ],
111338
111332
  "exposed": [],
111339
- "hash": "mZPIwMZGx-HfrtuznIa7rY7k3xTS-4-1FwLsi_fFvrQ"
111333
+ "hash": "L-Cf6BrsA61GRhgcvGKTebruHjs-W_33usKwCmqwJjU"
111340
111334
  }
111341
111335
  },
111342
111336
  "B24Separator": {
@@ -120995,17 +120989,17 @@ const B24UIMeta = {
120995
120989
  }
120996
120990
  ],
120997
120991
  "required": false,
120998
- "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }) | undefined',
120992
+ "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }) | undefined',
120999
120993
  "schema": {
121000
120994
  "kind": "enum",
121001
- "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }) | undefined',
120995
+ "type": 'boolean | (Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }) | undefined',
121002
120996
  "schema": {
121003
120997
  "0": "undefined",
121004
120998
  "1": "false",
121005
120999
  "2": "true",
121006
121000
  "3": {
121007
121001
  "kind": "object",
121008
- "type": 'Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | undefined; }',
121002
+ "type": 'Partial<Omit<VirtualizerOptions<Element, Element>, "getScrollElement" | "count" | "estimateSize" | "overscan">> & { overscan?: number | undefined; estimateSize?: number | ((index: number) => number) | undefined; }',
121009
121003
  "schema": {
121010
121004
  "onChange": {
121011
121005
  "name": "onChange",
@@ -121482,7 +121476,7 @@ const B24UIMeta = {
121482
121476
  "estimateSize": {
121483
121477
  "name": "estimateSize",
121484
121478
  "global": false,
121485
- "description": "Estimated size (in px) of each item",
121479
+ "description": "Estimated size (in px) of each item, or a function that returns the size for a given index",
121486
121480
  "tags": [
121487
121481
  {
121488
121482
  "name": "defaultValue",
@@ -121490,8 +121484,20 @@ const B24UIMeta = {
121490
121484
  }
121491
121485
  ],
121492
121486
  "required": false,
121493
- "type": "number | undefined",
121494
- "schema": "number | undefined"
121487
+ "type": "number | ((index: number) => number) | undefined",
121488
+ "schema": {
121489
+ "kind": "enum",
121490
+ "type": "number | ((index: number) => number) | undefined",
121491
+ "schema": {
121492
+ "0": "undefined",
121493
+ "1": "number",
121494
+ "2": {
121495
+ "kind": "event",
121496
+ "type": "(index: number): number",
121497
+ "schema": []
121498
+ }
121499
+ }
121500
+ }
121495
121501
  }
121496
121502
  }
121497
121503
  }
@@ -123543,7 +123549,7 @@ const B24UIMeta = {
123543
123549
  }
123544
123550
  ],
123545
123551
  "exposed": [],
123546
- "hash": "3WqAtDTzBMFPP6FlhE471iGPPP4q9uOFnnT2jKjsm7k"
123552
+ "hash": "irkn8qnmGXuqh5Of_BGFc3-3FcvgqSuiXVRrnfpA1P8"
123547
123553
  }
123548
123554
  },
123549
123555
  "B24TableWrapper": {
package/dist/module.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bitrix24/b24ui-nuxt",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "docs": "https://bitrix24.github.io/b24ui/guide/installation-nuxt-app.html",
5
5
  "configKey": "b24ui",
6
6
  "compatibility": {
package/dist/module.mjs CHANGED
@@ -1,6 +1,6 @@
1
1
  import { defu } from 'defu';
2
2
  import { defineNuxtModule, createResolver, addPlugin, hasNuxtModule, addComponentsDir, addImportsDir, installModule } from '@nuxt/kit';
3
- import { d as defaultOptions, v as version, n as name, a as getDefaultConfig, b as addTemplates } from './shared/b24ui-nuxt.mq1NUekN.mjs';
3
+ import { d as defaultOptions, v as version, n as name, a as getDefaultConfig, b as addTemplates } from './shared/b24ui-nuxt.Bs0V9FLV.mjs';
4
4
  import 'node:url';
5
5
  import 'scule';
6
6
  import 'knitwork';
@@ -11,9 +11,10 @@ import { useFuse } from "@vueuse/integrations/useFuse";
11
11
  import { useAppConfig } from "#imports";
12
12
  import { useLocale } from "../composables/useLocale";
13
13
  import { omit, get } from "../utils";
14
- import { tv } from "../utils/tv";
15
14
  import { highlight } from "../utils/fuse";
16
15
  import { pickLinkProps } from "../utils/link";
16
+ import { getEstimateSize } from "../utils/virtualizer";
17
+ import { tv } from "../utils/tv";
17
18
  import icons from "../dictionary/icons";
18
19
  import B24Avatar from "./Avatar.vue";
19
20
  import B24Button from "./Button.vue";
@@ -58,7 +59,12 @@ const { t } = useLocale();
58
59
  const appConfig = useAppConfig();
59
60
  const rootProps = useForwardPropsEmits(reactivePick(props, "as", "disabled", "multiple", "modelValue", "defaultValue", "highlightOnHover"), emits);
60
61
  const inputProps = useForwardProps(reactivePick(props, "loading"));
61
- const virtualizerProps = toRef(() => !!props.virtualize && defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, { estimateSize: 32 }));
62
+ const virtualizerProps = toRef(() => {
63
+ if (!props.virtualize) return false;
64
+ return defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
65
+ estimateSize: getEstimateSize(filteredItems.value, "md", props.descriptionKey)
66
+ });
67
+ });
62
68
  const [DefineItemTemplate, ReuseItemTemplate] = createReusableTemplate({
63
69
  props: {
64
70
  item: {
@@ -15,6 +15,7 @@ import { useFormField } from "../composables/useFormField";
15
15
  import { useLocale } from "../composables/useLocale";
16
16
  import { usePortal } from "../composables/usePortal";
17
17
  import { compare, get, getDisplayValue, isArrayOfArray } from "../utils";
18
+ import { getEstimateSize } from "../utils/virtualizer";
18
19
  import { tv } from "../utils/tv";
19
20
  import icons from "../dictionary/icons";
20
21
  import B24Badge from "./Badge.vue";
@@ -80,16 +81,12 @@ const rootProps = useForwardPropsEmits(reactivePick(props, "as", "modelValue", "
80
81
  const portalProps = usePortal(toRef(() => props.portal));
81
82
  const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
82
83
  const arrowProps = toRef(() => defu(typeof props.arrow === "boolean" ? {} : props.arrow, { width: 20, height: 10 }));
83
- const virtualizerProps = toRef(() => !!props.virtualize && defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
84
- estimateSize: {
85
- xss: 20,
86
- xs: 24,
87
- sm: 28,
88
- md: 32,
89
- lg: 36,
90
- xl: 40
91
- }[props.size || "md"]
92
- }));
84
+ const virtualizerProps = toRef(() => {
85
+ if (!props.virtualize) return false;
86
+ return defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
87
+ estimateSize: getEstimateSize(items.value, inputSize.value || "md", props.descriptionKey)
88
+ });
89
+ });
93
90
  const { emitFormBlur, emitFormFocus, emitFormChange, emitFormInput, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
94
91
  const { orientation, size: fieldGroupSize } = useFieldGroup(props);
95
92
  const { isLeading, isTrailing, leadingIconName, trailingIconName } = useComponentIcons(toRef(() => defu(props, { trailingIcon: icons.chevronDown })));
@@ -230,6 +227,11 @@ function onRemoveTag(event, modelValue) {
230
227
  onUpdate(filteredValue);
231
228
  }
232
229
  }
230
+ function onCreate(e) {
231
+ e.preventDefault();
232
+ e.stopPropagation();
233
+ emits("create", searchTerm.value);
234
+ }
233
235
  function onSelect(e, item) {
234
236
  if (!isInputItem(item)) {
235
237
  return;
@@ -254,7 +256,7 @@ defineExpose({
254
256
  data-slot="item"
255
257
  :class="b24ui.item({ addNew: true, class: props.b24ui?.item })"
256
258
  :value="searchTerm"
257
- @select.prevent="emits('create', searchTerm)"
259
+ @select="onCreate"
258
260
  >
259
261
  <span data-slot="itemLabel" :class="b24ui.itemLabel({ addNew: true, class: props.b24ui?.itemLabel })">
260
262
  <slot name="create-item-label" :item="searchTerm">
@@ -353,7 +355,6 @@ defineExpose({
353
355
  ignore-filter
354
356
  @update:model-value="onUpdate"
355
357
  @update:open="onUpdateOpen"
356
- @keydown.enter="$event.preventDefault()"
357
358
  >
358
359
  <B24Badge
359
360
  v-if="!multiple && isTag"
@@ -410,7 +411,7 @@ defineExpose({
410
411
  :placeholder="placeholder"
411
412
  data-slot="tagsInput"
412
413
  :class="b24ui.tagsInput({ class: props.b24ui?.tagsInput })"
413
- @keydown.enter.prevent
414
+ @change.stop
414
415
  />
415
416
  </ComboboxInput>
416
417
  </TagsInputRoot>
@@ -426,6 +427,7 @@ defineExpose({
426
427
  :required="required"
427
428
  @blur="onBlur"
428
429
  @focus="onFocus"
430
+ @change.stop
429
431
  @update:model-value="searchTerm = $event"
430
432
  />
431
433
 
@@ -14,6 +14,7 @@ import { useFormField } from "../composables/useFormField";
14
14
  import { useLocale } from "../composables/useLocale";
15
15
  import { usePortal } from "../composables/usePortal";
16
16
  import { compare, get, getDisplayValue, isArrayOfArray } from "../utils";
17
+ import { getEstimateSize } from "../utils/virtualizer";
17
18
  import { tv } from "../utils/tv";
18
19
  import icons from "../dictionary/icons";
19
20
  import B24Badge from "./Badge.vue";
@@ -77,16 +78,12 @@ const rootProps = useForwardPropsEmits(reactivePick(props, "modelValue", "defaul
77
78
  const portalProps = usePortal(toRef(() => props.portal));
78
79
  const contentProps = toRef(() => defu(props.content, { side: "bottom", sideOffset: 8, collisionPadding: 8, position: "popper" }));
79
80
  const arrowProps = toRef(() => defu(typeof props.arrow === "boolean" ? {} : props.arrow, { width: 20, height: 10 }));
80
- const virtualizerProps = toRef(() => !!props.virtualize && defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
81
- estimateSize: {
82
- xss: 20,
83
- xs: 24,
84
- sm: 28,
85
- md: 32,
86
- lg: 36,
87
- xl: 40
88
- }[props.size || "md"]
89
- }));
81
+ const virtualizerProps = toRef(() => {
82
+ if (!props.virtualize) return false;
83
+ return defu(typeof props.virtualize === "boolean" ? {} : props.virtualize, {
84
+ estimateSize: getEstimateSize(items.value, props.size || "md", props.descriptionKey)
85
+ });
86
+ });
90
87
  const searchInputProps = toRef(() => defu(props.searchInput, { placeholder: t("selectMenu.search"), type: "text", size: "md" }));
91
88
  const { emitFormBlur, emitFormFocus, emitFormInput, emitFormChange, size: formGroupSize, color, id, name, highlight, disabled, ariaAttrs } = useFormField(props);
92
89
  const { orientation, size: fieldGroupSize } = useFieldGroup(props);
@@ -218,6 +215,11 @@ function onUpdateOpen(value) {
218
215
  clearTimeout(timeoutId);
219
216
  }
220
217
  }
218
+ function onCreate(e) {
219
+ e.preventDefault();
220
+ e.stopPropagation();
221
+ emits("create", searchTerm.value);
222
+ }
221
223
  function onSelect(e, item) {
222
224
  if (!isSelectItem(item)) {
223
225
  return;
@@ -242,7 +244,7 @@ defineExpose({
242
244
  data-slot="item"
243
245
  :class="b24ui.item({ addNew: true, class: props.b24ui?.item })"
244
246
  :value="searchTerm"
245
- @select.prevent="emits('create', searchTerm)"
247
+ @select="onCreate"
246
248
  >
247
249
  <span data-slot="itemLabel" :class="b24ui.itemLabel({ addNew: true, class: props.b24ui?.itemLabel })">
248
250
  <slot name="create-item-label" :item="searchTerm">
@@ -440,6 +442,7 @@ defineExpose({
440
442
  v-bind="searchInputProps"
441
443
  data-slot="input"
442
444
  :class="b24ui.input({ class: props.b24ui?.input })"
445
+ @change.stop
443
446
  />
444
447
  </ComboboxInput>
445
448
 
@@ -63,10 +63,10 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
63
63
  */
64
64
  overscan?: number;
65
65
  /**
66
- * Estimated size (in px) of each item
66
+ * Estimated size (in px) of each item, or a function that returns the size for a given index
67
67
  * @defaultValue 65
68
68
  */
69
- estimateSize?: number;
69
+ estimateSize?: number | ((index: number) => number);
70
70
  });
71
71
  /**
72
72
  * The text to display when the table is empty.
@@ -225,7 +225,20 @@ const virtualizer = !!props.virtualize && useVirtualizer({
225
225
  return rows.value.length;
226
226
  },
227
227
  getScrollElement: () => rootRef.value?.$el,
228
- estimateSize: () => virtualizerProps.value.estimateSize
228
+ estimateSize: (index) => {
229
+ const estimate = virtualizerProps.value.estimateSize;
230
+ return typeof estimate === "function" ? estimate(index) : estimate;
231
+ }
232
+ });
233
+ const renderedSize = computed(() => {
234
+ if (!virtualizer) {
235
+ return 0;
236
+ }
237
+ const virtualItems = virtualizer.value.getVirtualItems();
238
+ if (!virtualItems?.length) {
239
+ return 0;
240
+ }
241
+ return virtualItems.reduce((sum, item) => sum + item.size, 0);
229
242
  });
230
243
  function valueUpdater(updaterOrValue, ref2) {
231
244
  ref2.value = typeof updaterOrValue === "function" ? updaterOrValue(ref2.value) : updaterOrValue;
@@ -406,7 +419,7 @@ defineExpose({
406
419
  data-slot="tfoot"
407
420
  :class="b24ui.tfoot({ class: [props.b24ui?.tfoot] })"
408
421
  :style="virtualizer ? {
409
- transform: `translateY(${virtualizer.getTotalSize() - virtualizer.getVirtualItems().length * virtualizerProps.estimateSize}px)`
422
+ transform: `translateY(${virtualizer.getTotalSize() - renderedSize}px)`
410
423
  } : void 0"
411
424
  >
412
425
  <tr data-slot="separator" :class="b24ui.separator({ class: [props.b24ui?.separator] })" />
@@ -63,10 +63,10 @@ export interface TableProps<T extends TableData = TableData> extends TableOption
63
63
  */
64
64
  overscan?: number;
65
65
  /**
66
- * Estimated size (in px) of each item
66
+ * Estimated size (in px) of each item, or a function that returns the size for a given index
67
67
  * @defaultValue 65
68
68
  */
69
- estimateSize?: number;
69
+ estimateSize?: number | ((index: number) => number);
70
70
  });
71
71
  /**
72
72
  * The text to display when the table is empty.
@@ -5,15 +5,8 @@ export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
5
5
  */
6
6
  color?: ButtonProps['color'];
7
7
  }
8
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
8
+ declare const __VLS_export: import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
9
9
  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";
10
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
- fallback(props?: {}): any;
12
- }>;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
11
  declare const _default: typeof __VLS_export;
14
12
  export default _default;
15
- type __VLS_WithSlots<T, S> = T & {
16
- new (): {
17
- $slots: S;
18
- };
19
- };
@@ -57,7 +57,6 @@ const props = defineProps({
57
57
  viewTransition: { type: Boolean, required: false },
58
58
  replace: { type: Boolean, required: false }
59
59
  });
60
- defineSlots();
61
60
  const { t } = useLocale();
62
61
  const colorMode = useColorMode();
63
62
  const buttonProps = useForwardProps(reactiveOmit(props, "icon"));
@@ -72,21 +71,17 @@ const isDark = computed({
72
71
  </script>
73
72
 
74
73
  <template>
75
- <ClientOnly v-if="!colorMode?.forced">
76
- <B24Button
77
- v-bind="{
74
+ <B24Button
75
+ v-bind="{
78
76
  ...buttonProps,
79
- 'icon': props.icon || (isDark ? icons.dark : icons.light),
80
77
  'aria-label': isDark ? t('colorMode.switchToLight') : t('colorMode.switchToDark'),
81
78
  ...$attrs
82
79
  }"
83
- @click="isDark = !isDark"
84
- />
85
-
86
- <template #fallback>
87
- <slot name="fallback">
88
- <div class="w-[32px] h-[34px]" />
89
- </slot>
80
+ @click="isDark = !isDark"
81
+ >
82
+ <template #leading="{ b24ui }">
83
+ <Component :is="icons.dark" data-slot="leadingIcon" :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })" class="hidden dark:inline" />
84
+ <Component :is="icons.light" data-slot="leadingIcon" :class="b24ui.leadingIcon({ class: props.b24ui?.leadingIcon })" class="inline dark:hidden" />
90
85
  </template>
91
- </ClientOnly>
86
+ </B24Button>
92
87
  </template>
@@ -5,15 +5,8 @@ export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
5
5
  */
6
6
  color?: ButtonProps['color'];
7
7
  }
8
- declare const __VLS_export: __VLS_WithSlots<import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
8
+ declare const __VLS_export: import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
9
9
  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";
10
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>, {
11
- fallback(props?: {}): any;
12
- }>;
10
+ }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
13
11
  declare const _default: typeof __VLS_export;
14
12
  export default _default;
15
- type __VLS_WithSlots<T, S> = T & {
16
- new (): {
17
- $slots: S;
18
- };
19
- };
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Get estimate size for virtualizers that checks each item individually
3
+ * NOTE: This requires Reka UI to support functions for estimateSize (https://github.com/unovue/reka-ui/pull/2288)
4
+ * Until then, we check if ANY item has a description and use that for all items
5
+ */
6
+ export declare function getEstimateSize(items: any[], size: 'xss' | 'xs' | 'sm' | 'md' | 'lg' | 'xl', descriptionKey?: string): number;
@@ -0,0 +1,32 @@
1
+ import { get } from "./index.js";
2
+ function hasDescription(item, descriptionKey) {
3
+ if (typeof item !== "object" || item === null) {
4
+ return false;
5
+ }
6
+ const value = get(item, descriptionKey);
7
+ return value !== void 0 && value !== null && value !== "";
8
+ }
9
+ function getSize(size, hasDescription2) {
10
+ if (hasDescription2) {
11
+ return {
12
+ xss: 40,
13
+ xs: 44,
14
+ sm: 48,
15
+ md: 52,
16
+ lg: 56,
17
+ xl: 60
18
+ }[size];
19
+ }
20
+ return {
21
+ xss: 20,
22
+ xs: 24,
23
+ sm: 28,
24
+ md: 32,
25
+ lg: 36,
26
+ xl: 40
27
+ }[size];
28
+ }
29
+ export function getEstimateSize(items, size, descriptionKey) {
30
+ const anyHasDescription = descriptionKey ? items.some((item) => hasDescription(item, descriptionKey)) : false;
31
+ return getSize(size, anyHasDescription);
32
+ }
@@ -8,7 +8,7 @@ import { globSync } from 'tinyglobby';
8
8
  import { defuFn } from 'defu';
9
9
 
10
10
  const name = "@bitrix24/b24ui-nuxt";
11
- const version = "2.1.3";
11
+ const version = "2.1.4";
12
12
 
13
13
  function getDefaultConfig(theme) {
14
14
  return {
@@ -102,30 +102,32 @@ function resolveComponentDependencies(component, dependencyGraph, resolved = /*
102
102
  }
103
103
  return resolved;
104
104
  }
105
- async function detectUsedComponents(rootDir, prefix, componentDir, includeComponents) {
105
+ async function detectUsedComponents(dirs, prefix, componentDir, includeComponents) {
106
106
  const detectedComponents = /* @__PURE__ */ new Set();
107
107
  if (includeComponents && includeComponents.length > 0) {
108
108
  for (const component of includeComponents) {
109
109
  detectedComponents.add(component);
110
110
  }
111
111
  }
112
- const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
113
- cwd: rootDir,
114
- ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
115
- });
116
112
  const componentPattern = new RegExp(`<(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)|\\b(?:Lazy)?${prefix}([A-Z][a-zA-Z]+)\\b`, "g");
117
- for (const file of appFiles) {
118
- try {
119
- const filePath = join(rootDir, file);
120
- const content = await readFile(filePath, "utf-8");
121
- const matches = content.matchAll(componentPattern);
122
- for (const match of matches) {
123
- const componentName = match[1] || match[2];
124
- if (componentName) {
125
- detectedComponents.add(componentName);
113
+ for (const dir of dirs) {
114
+ const appFiles = globSync(["**/*.{vue,ts,js,tsx,jsx}"], {
115
+ cwd: dir,
116
+ ignore: ["node_modules/**", ".nuxt/**", "dist/**"]
117
+ });
118
+ for (const file of appFiles) {
119
+ try {
120
+ const filePath = join(dir, file);
121
+ const content = await readFile(filePath, "utf-8");
122
+ const matches = content.matchAll(componentPattern);
123
+ for (const match of matches) {
124
+ const componentName = match[1] || match[2];
125
+ if (componentName) {
126
+ detectedComponents.add(componentName);
127
+ }
126
128
  }
129
+ } catch {
127
130
  }
128
- } catch {
129
131
  }
130
132
  }
131
133
  if (detectedComponents.size === 0) {
@@ -10343,8 +10345,12 @@ function getTemplates(options, uiConfig, nuxt, resolve) {
10343
10345
  async function generateSources() {
10344
10346
  let sources = "";
10345
10347
  if (!!nuxt && !!resolve && options.experimental?.componentDetection) {
10346
- const detectedComponents = await detectUsedComponents(
10348
+ const dirs = [.../* @__PURE__ */ new Set([
10347
10349
  nuxt.options.rootDir,
10350
+ ...nuxt.options._layers?.map((layer) => layer.config.rootDir).filter(Boolean) || []
10351
+ ])];
10352
+ const detectedComponents = await detectUsedComponents(
10353
+ dirs,
10348
10354
  "B24",
10349
10355
  resolve("./runtime/components"),
10350
10356
  Array.isArray(options.experimental.componentDetection) ? options.experimental.componentDetection : void 0
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 getDefaultConfig } from './shared/b24ui-nuxt.mq1NUekN.mjs';
6
+ import { g as getTemplates, d as defaultOptions, a as getDefaultConfig } from './shared/b24ui-nuxt.Bs0V9FLV.mjs';
7
7
  import fs from 'node:fs';
8
8
  import path from 'node:path';
9
9
  import MagicString from 'magic-string';
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.mq1NUekN.mjs';
7
+ import './shared/b24ui-nuxt.Bs0V9FLV.mjs';
8
8
  import 'scule';
9
9
  import 'knitwork';
10
10
  import '@nuxt/kit';
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": "2.1.3",
4
+ "version": "2.1.4",
5
5
  "repository": {
6
6
  "type": "git",
7
7
  "url": "git+https://github.com/bitrix24/b24ui.git"
@@ -1,12 +0,0 @@
1
- import type { ButtonProps } from '../../../types';
2
- export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
3
- /**
4
- * @defaultValue 'air-tertiary-no-accent'
5
- */
6
- color?: ButtonProps['color'];
7
- }
8
- declare const __VLS_export: import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
9
- 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";
10
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
- declare const _default: typeof __VLS_export;
12
- export default _default;
@@ -1,83 +0,0 @@
1
- <script>
2
-
3
- </script>
4
-
5
- <script setup>
6
- import { computed } from "vue";
7
- import { useForwardProps } from "reka-ui";
8
- import { reactiveOmit } from "@vueuse/core";
9
- import { useColorMode } from "#imports";
10
- import { useLocale } from "../../../composables/useLocale";
11
- import icons from "../../../dictionary/icons";
12
- import B24Button from "../../../components/Button.vue";
13
- defineOptions({ inheritAttrs: false });
14
- const props = defineProps({
15
- color: { type: null, required: false, default: "air-tertiary-no-accent" },
16
- label: { type: String, required: false },
17
- activeColor: { type: null, required: false },
18
- depth: { type: null, required: false },
19
- activeDepth: { type: null, required: false },
20
- size: { type: null, required: false },
21
- rounded: { type: Boolean, required: false },
22
- block: { type: Boolean, required: false },
23
- loadingAuto: { type: Boolean, required: false },
24
- normalCase: { type: Boolean, required: false },
25
- useWait: { type: Boolean, required: false },
26
- useClock: { type: Boolean, required: false },
27
- useDropdown: { type: Boolean, required: false },
28
- onClick: { type: [Function, Array], required: false },
29
- class: { type: null, required: false },
30
- activeClass: { type: String, required: false },
31
- inactiveClass: { type: String, required: false },
32
- b24ui: { type: null, required: false },
33
- icon: { type: [Function, Object], required: false },
34
- avatar: { type: Object, required: false },
35
- loading: { type: Boolean, required: false },
36
- as: { type: null, required: false },
37
- type: { type: null, required: false },
38
- disabled: { type: Boolean, required: false },
39
- active: { type: Boolean, required: false },
40
- exact: { type: Boolean, required: false },
41
- exactQuery: { type: [Boolean, String], required: false },
42
- exactHash: { type: Boolean, required: false },
43
- isAction: { type: Boolean, required: false },
44
- to: { type: null, required: false },
45
- href: { type: null, required: false },
46
- external: { type: Boolean, required: false },
47
- target: { type: [String, Object, null], required: false },
48
- rel: { type: [String, Object, null], required: false },
49
- noRel: { type: Boolean, required: false },
50
- prefetchedClass: { type: String, required: false },
51
- prefetch: { type: Boolean, required: false },
52
- prefetchOn: { type: [String, Object], required: false },
53
- noPrefetch: { type: Boolean, required: false },
54
- trailingSlash: { type: String, required: false },
55
- exactActiveClass: { type: String, required: false },
56
- ariaCurrentValue: { type: String, required: false },
57
- viewTransition: { type: Boolean, required: false },
58
- replace: { type: Boolean, required: false }
59
- });
60
- const { t } = useLocale();
61
- const colorMode = useColorMode();
62
- const buttonProps = useForwardProps(reactiveOmit(props, "icon"));
63
- const isDark = computed({
64
- get() {
65
- return colorMode.value === "dark";
66
- },
67
- set(_isDark) {
68
- colorMode.preference = _isDark ? "dark" : "light";
69
- }
70
- });
71
- </script>
72
-
73
- <template>
74
- <B24Button
75
- v-bind="{
76
- ...buttonProps,
77
- 'icon': props.icon || (isDark ? icons.dark : icons.light),
78
- 'aria-label': isDark ? t('colorMode.switchToLight') : t('colorMode.switchToDark'),
79
- ...$attrs
80
- }"
81
- @click="isDark = !isDark"
82
- />
83
- </template>
@@ -1,12 +0,0 @@
1
- import type { ButtonProps } from '../../../types';
2
- export interface ColorModeButtonProps extends Omit<ButtonProps, 'color'> {
3
- /**
4
- * @defaultValue 'air-tertiary-no-accent'
5
- */
6
- color?: ButtonProps['color'];
7
- }
8
- declare const __VLS_export: import("vue").DefineComponent<ColorModeButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<ColorModeButtonProps> & Readonly<{}>, {
9
- 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";
10
- }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
11
- declare const _default: typeof __VLS_export;
12
- export default _default;