@bitrix24/b24ui-nuxt 0.4.10 → 0.5.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 (55) hide show
  1. package/.nuxt/b24ui/collapsible.ts +6 -0
  2. package/.nuxt/b24ui/index.ts +2 -0
  3. package/.nuxt/b24ui/navigation-menu.ts +312 -0
  4. package/.nuxt/b24ui/sidebar-body.ts +1 -1
  5. package/.nuxt/b24ui/sidebar-footer.ts +1 -1
  6. package/.nuxt/b24ui/sidebar-header.ts +1 -1
  7. package/.nuxt/b24ui/sidebar-heading.ts +1 -1
  8. package/.nuxt/b24ui/sidebar-section.ts +1 -1
  9. package/cli/package.json +1 -1
  10. package/dist/meta.cjs +9778 -588
  11. package/dist/meta.d.cts +9778 -588
  12. package/dist/meta.d.mts +9778 -588
  13. package/dist/meta.d.ts +9778 -588
  14. package/dist/meta.mjs +9778 -588
  15. package/dist/module.cjs +1 -1
  16. package/dist/module.json +1 -1
  17. package/dist/module.mjs +1 -1
  18. package/dist/runtime/components/Collapsible.vue +56 -0
  19. package/dist/runtime/components/DropdownMenu.vue +3 -1
  20. package/dist/runtime/components/Form.vue +21 -1
  21. package/dist/runtime/components/FormField.vue +5 -0
  22. package/dist/runtime/components/Navbar.vue +1 -2
  23. package/dist/runtime/components/NavbarDivider.vue +1 -2
  24. package/dist/runtime/components/NavbarSection.vue +1 -2
  25. package/dist/runtime/components/NavbarSpacer.vue +1 -2
  26. package/dist/runtime/components/NavigationMenu.vue +345 -0
  27. package/dist/runtime/components/Sidebar.vue +1 -2
  28. package/dist/runtime/components/SidebarFooter.vue +1 -2
  29. package/dist/runtime/components/SidebarHeader.vue +1 -2
  30. package/dist/runtime/components/SidebarHeading.vue +1 -2
  31. package/dist/runtime/components/SidebarLayout.vue +34 -8
  32. package/dist/runtime/components/SidebarSection.vue +1 -2
  33. package/dist/runtime/components/SidebarSpacer.vue +1 -2
  34. package/dist/runtime/components/StackedLayout.vue +1 -3
  35. package/dist/runtime/composables/defineLocale.js +1 -0
  36. package/dist/runtime/composables/defineShortcuts.js +1 -0
  37. package/dist/runtime/composables/useKbd.js +1 -1
  38. package/dist/runtime/composables/useLocale.js +2 -2
  39. package/dist/runtime/composables/useOverlay.js +1 -1
  40. package/dist/runtime/index.css +1 -1
  41. package/dist/runtime/types/form.d.ts +1 -3
  42. package/dist/runtime/types/index.d.ts +2 -0
  43. package/dist/runtime/types/index.js +2 -0
  44. package/dist/runtime/utils/form.d.ts +0 -4
  45. package/dist/runtime/utils/form.js +2 -47
  46. package/dist/runtime/utils/link.d.ts +8 -8
  47. package/dist/runtime/utils/tv.js +1 -1
  48. package/dist/runtime/vue/stubs.d.ts +1 -1
  49. package/dist/shared/{b24ui-nuxt._rviRWFf.mjs → b24ui-nuxt.Bj4fKDSa.mjs} +375 -4
  50. package/dist/shared/{b24ui-nuxt.CY35QViH.cjs → b24ui-nuxt.DHbGsmbj.cjs} +375 -4
  51. package/dist/unplugin.cjs +1 -1
  52. package/dist/unplugin.mjs +1 -1
  53. package/dist/vite.cjs +1 -1
  54. package/dist/vite.mjs +1 -1
  55. package/package.json +6 -6
@@ -1,16 +1,14 @@
1
1
  <script lang="ts">
2
- // import type { VariantProps } from 'tailwind-variants'
3
2
  import type { AppConfig } from '@nuxt/schema'
4
3
  import _appConfig from '#build/app.config'
5
4
  import theme from '#build/b24ui/sidebar-layout'
6
5
  import { tv } from '../utils/tv'
6
+ import { useRoute } from 'vue-router'
7
7
 
8
8
  const appConfigSidebarLayout = _appConfig as AppConfig & { b24ui: { sidebarLayout: Partial<typeof theme> } }
9
9
 
10
10
  const sidebarLayout = tv({ extend: tv(theme), ...(appConfigSidebarLayout.b24ui?.sidebarLayout || {}) })
11
11
 
12
- // type SidebarLayoutVariants = VariantProps<typeof sidebarLayout>
13
-
14
12
  export interface SidebarLayoutProps {
15
13
  /**
16
14
  * The element or component this component should render as.
@@ -26,8 +24,10 @@ export interface SidebarLayoutProps {
26
24
  export interface SidebarLayoutSlots {
27
25
  /**
28
26
  * Menu for all screen sizes.
27
+ * @param props
28
+ * @param props.handleClick - Handler for navigation click events
29
29
  */
30
- sidebar(props?: {}): any
30
+ sidebar(props: { handleClick: () => void }): any
31
31
  /**
32
32
  * Menu for mobile screen sizes.
33
33
  */
@@ -40,7 +40,7 @@ export interface SidebarLayoutSlots {
40
40
  </script>
41
41
 
42
42
  <script setup lang="ts">
43
- import { computed } from 'vue'
43
+ import { ref, computed, watch, onUnmounted } from 'vue'
44
44
  import { Primitive } from 'reka-ui'
45
45
  import B24Slideover from './Slideover.vue'
46
46
  import B24Sidebar from './Sidebar.vue'
@@ -55,12 +55,34 @@ const props = withDefaults(defineProps<SidebarLayoutProps>(), {
55
55
  })
56
56
  const slots = defineSlots<SidebarLayoutSlots>()
57
57
 
58
+ const route = useRoute()
58
59
  const isUseSideBar = computed(() => !!slots.sidebar)
60
+ const openSidebarSlideover = ref(false)
59
61
 
60
62
  const b24ui = computed(() => sidebarLayout({
61
63
  useSidebar: isUseSideBar.value,
62
64
  useLightContent: Boolean(props.useLightContent)
63
65
  }))
66
+
67
+ const closeModal = () => {
68
+ if (openSidebarSlideover.value) {
69
+ openSidebarSlideover.value = false
70
+ }
71
+ }
72
+
73
+ const stopWatcher = watch(
74
+ () => route.path,
75
+ () => closeModal(),
76
+ { immediate: true }
77
+ )
78
+
79
+ onUnmounted(() => {
80
+ stopWatcher()
81
+ })
82
+
83
+ const handleNavigationClick = () => {
84
+ closeModal()
85
+ }
64
86
  </script>
65
87
 
66
88
  <template>
@@ -68,14 +90,18 @@ const b24ui = computed(() => sidebarLayout({
68
90
  <template v-if="isUseSideBar">
69
91
  <div :class="b24ui.sidebar({ class: props.b24ui?.sidebar })">
70
92
  <B24Sidebar>
71
- <slot name="sidebar" />
93
+ <slot name="sidebar" :handle-click="handleNavigationClick" />
72
94
  </B24Sidebar>
73
95
  </div>
74
96
  </template>
75
97
 
76
98
  <header :class="b24ui.header({ class: props.b24ui?.header })">
77
- <div :class="b24ui.headerPaddings({ class: props.b24ui?.headerPaddings })">
99
+ <div
100
+ v-if="isUseSideBar"
101
+ :class="b24ui.headerPaddings({ class: props.b24ui?.headerPaddings })"
102
+ >
78
103
  <B24Slideover
104
+ v-model:open="openSidebarSlideover"
79
105
  title="Navigation"
80
106
  description="Content navigation"
81
107
  side="left"
@@ -104,7 +130,7 @@ const b24ui = computed(() => sidebarLayout({
104
130
  </B24ModalDialogClose>
105
131
  </div>
106
132
 
107
- <slot name="sidebar" />
133
+ <slot name="sidebar" :handle-click="handleNavigationClick" />
108
134
  </B24Sidebar>
109
135
  </div>
110
136
  </template>
@@ -24,7 +24,6 @@ export interface SidebarSectionSlots {
24
24
  </script>
25
25
 
26
26
  <script setup lang="ts">
27
- import { computed } from 'vue'
28
27
  import { Primitive } from 'reka-ui'
29
28
 
30
29
  const props = withDefaults(defineProps<SidebarSectionProps>(), {
@@ -33,7 +32,7 @@ const props = withDefaults(defineProps<SidebarSectionProps>(), {
33
32
  defineSlots<SidebarSectionSlots>()
34
33
 
35
34
  // eslint-disable-next-line vue/no-dupe-keys
36
- const b24ui = computed(() => sidebarSection({}))
35
+ const b24ui = sidebarSection()
37
36
  </script>
38
37
 
39
38
  <template>
@@ -24,7 +24,6 @@ export interface SidebarSpacerSlots {
24
24
  </script>
25
25
 
26
26
  <script setup lang="ts">
27
- import { computed } from 'vue'
28
27
  import { Primitive } from 'reka-ui'
29
28
 
30
29
  const props = withDefaults(defineProps<SidebarSpacerProps>(), {
@@ -33,7 +32,7 @@ const props = withDefaults(defineProps<SidebarSpacerProps>(), {
33
32
  defineSlots<SidebarSpacerSlots>()
34
33
 
35
34
  // eslint-disable-next-line vue/no-dupe-keys
36
- const b24ui = computed(() => sidebarSpacer({}))
35
+ const b24ui = sidebarSpacer()
37
36
  </script>
38
37
 
39
38
  <template>
@@ -27,7 +27,6 @@ export interface StackedLayoutSlots {
27
27
  </script>
28
28
 
29
29
  <script setup lang="ts">
30
- import { computed } from 'vue'
31
30
  import { Primitive } from 'reka-ui'
32
31
 
33
32
  const props = withDefaults(defineProps<StackedLayoutProps>(), {
@@ -36,8 +35,7 @@ const props = withDefaults(defineProps<StackedLayoutProps>(), {
36
35
  const slots = defineSlots<StackedLayoutSlots>()
37
36
 
38
37
  // eslint-disable-next-line vue/no-dupe-keys
39
- const b24ui = computed(() => stackedLayout({
40
- }))
38
+ const b24ui = stackedLayout()
41
39
  </script>
42
40
 
43
41
  <template>
@@ -1,4 +1,5 @@
1
1
  import { defu } from "defu";
2
+ // @__NO_SIDE_EFFECTS__
2
3
  export function defineLocale(options) {
3
4
  return defu(options, { dir: "ltr" });
4
5
  }
@@ -21,6 +21,7 @@ export function extractShortcuts(items) {
21
21
  traverse(items.flat());
22
22
  return shortcuts;
23
23
  }
24
+ // @__NO_SIDE_EFFECTS__
24
25
  export function defineShortcuts(config, options = {}) {
25
26
  const chainedInputs = ref([]);
26
27
  const clearChainedInput = () => {
@@ -49,4 +49,4 @@ const _useKbd = () => {
49
49
  getKbdKey
50
50
  };
51
51
  };
52
- export const useKbd = createSharedComposable(_useKbd);
52
+ export const useKbd = /* @__PURE__ */ createSharedComposable(_useKbd);
@@ -2,9 +2,9 @@ import { computed, inject, toRef } from "vue";
2
2
  import { createSharedComposable } from "@vueuse/core";
3
3
  import { buildLocaleContext } from "../utils/locale.js";
4
4
  import en from "../locale/en.js";
5
- export const localeContextInjectionKey = Symbol("bitrix24-ui.locale-context");
5
+ export const localeContextInjectionKey = Symbol.for("bitrix24-ui.locale-context");
6
6
  const _useLocale = (localeOverrides) => {
7
7
  const locale = localeOverrides || toRef(inject(localeContextInjectionKey));
8
8
  return buildLocaleContext(computed(() => locale.value || en));
9
9
  };
10
- export const useLocale = createSharedComposable(_useLocale);
10
+ export const useLocale = /* @__PURE__ */ createSharedComposable(_useLocale);
@@ -68,4 +68,4 @@ function _useOverlay() {
68
68
  unMount
69
69
  };
70
70
  }
71
- export const useOverlay = createSharedComposable(_useOverlay);
71
+ export const useOverlay = /* @__PURE__ */ createSharedComposable(_useOverlay);
@@ -1 +1 @@
1
- @plugin "@bitrix24/b24style";@import "#build/b24ui.css";@import "./keyframes.css";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{--b24ui-header-height:calc(var(--spacing)*16);body{@apply antialiased scheme-light dark:scheme-dark}}@layer theme{:host,:root{--spacing:.25rem}}.scrollbar-thin{scrollbar-width:thin}.scrollbar-transparent{scrollbar-color:hsla(0,0%,100%,.21) transparent}.scrollbar-transparent:hover{scrollbar-color:rgba(82,92,105,.36) transparent}.dark .scrollbar-transparent{scrollbar-color:rgba(0,0,0,.21) transparent}.dark .scrollbar-transparent:hover{scrollbar-color:#515a67 transparent}
1
+ @plugin "@bitrix24/b24style";@import "#build/b24ui.css";@import "./keyframes.css";@variant light (&:where(.light, .light *));@variant dark (&:where(.dark, .dark *));@layer base{--b24ui-header-height:calc(var(--spacing)*16);body{@apply antialiased scheme-light dark:scheme-dark}}@layer theme{:host,:root{--spacing:.25rem}}.scrollbar-thin{scrollbar-width:thin}.scrollbar-transparent{scrollbar-color:transparent transparent;scrollbar-gutter:stable}.scrollbar-transparent:hover{scrollbar-color:rgba(82,92,105,.36) transparent}.dark .scrollbar-transparent{scrollbar-color:rgba(0,0,0,.21) transparent}.dark .scrollbar-transparent:hover{scrollbar-color:#515a67 transparent}
@@ -1,9 +1,7 @@
1
1
  import type { StandardSchemaV1 } from '@standard-schema/spec';
2
2
  import type { ComputedRef, DeepReadonly, Ref } from 'vue';
3
- import type { ZodSchema } from 'zod';
4
3
  import type { Schema as JoiSchema } from 'joi';
5
4
  import type { ObjectSchema as YupObjectSchema } from 'yup';
6
- import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
7
5
  import type { GetObjectField } from './utils';
8
6
  import type { Struct as SuperstructSchema } from 'superstruct';
9
7
  export interface Form<T extends object> {
@@ -24,7 +22,7 @@ export interface Form<T extends object> {
24
22
  touchedFields: DeepReadonly<Set<keyof T>>;
25
23
  blurredFields: DeepReadonly<Set<keyof T>>;
26
24
  }
27
- export type FormSchema<T extends object> = ZodSchema | YupObjectSchema<T> | ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
25
+ export type FormSchema<T extends object> = YupObjectSchema<T> | JoiSchema<T> | SuperstructSchema<any, any> | StandardSchemaV1;
28
26
  export type FormInputEvents = 'input' | 'blur' | 'change' | 'focus';
29
27
  export interface FormError<P extends string = string> {
30
28
  name?: P;
@@ -9,6 +9,7 @@ export * from '../components/ButtonGroup.vue';
9
9
  export * from '../components/Calendar.vue';
10
10
  export * from '../components/Checkbox.vue';
11
11
  export * from '../components/Chip.vue';
12
+ export * from '../components/Collapsible.vue';
12
13
  export * from '../components/Container.vue';
13
14
  export * from '../components/Countdown.vue';
14
15
  export * from '../components/DescriptionList.vue';
@@ -22,6 +23,7 @@ export * from '../components/Kbd.vue';
22
23
  export * from '../components/Link.vue';
23
24
  export * from '../components/Modal.vue';
24
25
  export * from '../components/ModalDialogClose.vue';
26
+ export * from '../components/NavigationMenu.vue';
25
27
  export * from '../components/Popover.vue';
26
28
  export * from '../components/Progress.vue';
27
29
  export * from '../components/RadioGroup.vue';
@@ -9,6 +9,7 @@ export * from "../components/ButtonGroup.vue";
9
9
  export * from "../components/Calendar.vue";
10
10
  export * from "../components/Checkbox.vue";
11
11
  export * from "../components/Chip.vue";
12
+ export * from "../components/Collapsible.vue";
12
13
  export * from "../components/Container.vue";
13
14
  export * from "../components/Countdown.vue";
14
15
  export * from "../components/DescriptionList.vue";
@@ -22,6 +23,7 @@ export * from "../components/Kbd.vue";
22
23
  export * from "../components/Link.vue";
23
24
  export * from "../components/Modal.vue";
24
25
  export * from "../components/ModalDialogClose.vue";
26
+ export * from "../components/NavigationMenu.vue";
25
27
  export * from "../components/Popover.vue";
26
28
  export * from "../components/Progress.vue";
27
29
  export * from "../components/RadioGroup.vue";
@@ -1,17 +1,13 @@
1
1
  import type { StandardSchemaV1 } from '@standard-schema/spec';
2
- import type { ZodSchema } from 'zod';
3
2
  import type { ValidationError as JoiError, Schema as JoiSchema } from 'joi';
4
3
  import type { ObjectSchema as YupObjectSchema, ValidationError as YupError } from 'yup';
5
- import type { GenericSchema as ValibotSchema, GenericSchemaAsync as ValibotSchemaAsync, SafeParser as ValibotSafeParser, SafeParserAsync as ValibotSafeParserAsync } from 'valibot';
6
4
  import type { Struct } from 'superstruct';
7
5
  import type { FormSchema, ValidateReturnSchema } from '../types/form';
8
6
  export declare function isYupSchema(schema: any): schema is YupObjectSchema<any>;
9
7
  export declare function isYupError(error: any): error is YupError;
10
8
  export declare function isSuperStructSchema(schema: any): schema is Struct<any, any>;
11
- export declare function isZodSchema(schema: any): schema is ZodSchema;
12
9
  export declare function isJoiSchema(schema: any): schema is JoiSchema;
13
10
  export declare function isJoiError(error: any): error is JoiError;
14
- export declare function isValibotSchema(schema: any): schema is ValibotSchema | ValibotSchemaAsync | ValibotSafeParser<any, any> | ValibotSafeParserAsync<any, any>;
15
11
  export declare function isStandardSchema(schema: any): schema is StandardSchemaV1;
16
12
  export declare function validateStandardSchema(state: any, schema: StandardSchemaV1): Promise<ValidateReturnSchema<typeof state>>;
17
13
  export declare function validateSchema<T extends object>(state: T, schema: FormSchema<T>): Promise<ValidateReturnSchema<typeof state>>;
@@ -7,18 +7,12 @@ export function isYupError(error) {
7
7
  export function isSuperStructSchema(schema) {
8
8
  return "schema" in schema && typeof schema.coercer === "function" && typeof schema.validator === "function" && typeof schema.refiner === "function";
9
9
  }
10
- export function isZodSchema(schema) {
11
- return schema.parse !== void 0;
12
- }
13
10
  export function isJoiSchema(schema) {
14
11
  return schema.validateAsync !== void 0 && schema.id !== void 0;
15
12
  }
16
13
  export function isJoiError(error) {
17
14
  return error.isJoi === true;
18
15
  }
19
- export function isValibotSchema(schema) {
20
- return "_run" in schema || typeof schema === "function" && "schema" in schema;
21
- }
22
16
  export function isStandardSchema(schema) {
23
17
  return "~standard" in schema;
24
18
  }
@@ -77,23 +71,6 @@ async function validateSuperstructSchema(state, schema) {
77
71
  result
78
72
  };
79
73
  }
80
- async function validateZodSchema(state, schema) {
81
- const result = await schema.safeParseAsync(state);
82
- if (result.success === false) {
83
- const errors = result.error.issues.map((issue) => ({
84
- name: issue.path.join("."),
85
- message: issue.message
86
- }));
87
- return {
88
- errors,
89
- result: null
90
- };
91
- }
92
- return {
93
- result: result.data,
94
- errors: null
95
- };
96
- }
97
74
  async function validateJoiSchema(state, schema) {
98
75
  try {
99
76
  const result = await schema.validateAsync(state, { abortEarly: false });
@@ -116,33 +93,11 @@ async function validateJoiSchema(state, schema) {
116
93
  }
117
94
  }
118
95
  }
119
- async function validateValibotSchema(state, schema) {
120
- const result = await ("_run" in schema ? schema._run({ typed: false, value: state }, {}) : schema(state));
121
- if (!result.issues || result.issues.length === 0) {
122
- const output = "output" in result ? result.output : "value" in result ? result.value : null;
123
- return {
124
- errors: null,
125
- result: output
126
- };
127
- }
128
- const errors = result.issues.map((issue) => ({
129
- name: issue.path?.map((item) => item.key).join(".") || "",
130
- message: issue.message
131
- }));
132
- return {
133
- errors,
134
- result: null
135
- };
136
- }
137
96
  export function validateSchema(state, schema) {
138
- if (isZodSchema(schema)) {
139
- return validateZodSchema(state, schema);
97
+ if (isStandardSchema(schema)) {
98
+ return validateStandardSchema(state, schema);
140
99
  } else if (isJoiSchema(schema)) {
141
100
  return validateJoiSchema(state, schema);
142
- } else if (isStandardSchema(schema)) {
143
- return validateStandardSchema(state, schema);
144
- } else if (isValibotSchema(schema)) {
145
- return validateValibotSchema(state, schema);
146
101
  } else if (isYupSchema(schema)) {
147
102
  return validateYupSchema(state, schema);
148
103
  } else if (isSuperStructSchema(schema)) {
@@ -6,24 +6,24 @@ export declare function pickLinkProps(link: LinkProps & {
6
6
  replace: any;
7
7
  type: any;
8
8
  title: any;
9
- href: any;
10
- target: any;
11
- as: any;
12
- prefetch: any;
13
- rel: any;
14
- external: any;
15
- exact: any;
16
9
  active: any;
17
- disabled: any;
18
10
  activeClass: any;
19
11
  ariaCurrentValue: any;
20
12
  ariaLabel: any;
13
+ as: any;
14
+ disabled: any;
15
+ exact: any;
21
16
  exactActiveClass: any;
22
17
  exactHash: any;
23
18
  exactQuery: any;
19
+ external: any;
20
+ href: any;
24
21
  inactiveClass: any;
25
22
  noPrefetch: any;
26
23
  noRel: any;
24
+ prefetch: any;
27
25
  prefetchedClass: any;
26
+ rel: any;
27
+ target: any;
28
28
  to: any;
29
29
  };
@@ -1,4 +1,4 @@
1
1
  import { createTV } from "tailwind-variants";
2
2
  import _appConfig from "#build/app.config";
3
3
  const appConfigTv = _appConfig;
4
- export const tv = createTV(appConfigTv.b24ui?.tv);
4
+ export const tv = /* @__PURE__ */ createTV(appConfigTv.b24ui?.tv);
@@ -12,7 +12,7 @@ export declare const useColorMode: () => {
12
12
  preference?: undefined;
13
13
  readonly value?: undefined;
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
  };