@teammodlr/ui-kit 2.1.45 → 2.1.47

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.
@@ -1,3 +1,4 @@
1
1
  export type Size = 'xs' | 'sm' | 'md' | 'lg' | 'xl';
2
2
  export type Color = 'white' | 'black' | 'blue' | 'green' | 'red' | 'yellow' | 'gray';
3
3
  export type Variant = 'default' | 'tertiary' | 'primary' | 'dark' | 'success' | 'warning' | 'error';
4
+ export type MaybeArray<T> = T | T[];
@@ -0,0 +1,7 @@
1
+ declare function call(funcs: MaybeArray<() => void>): void;
2
+ declare function call<A1>(funcs: MaybeArray<(a1: A1) => void>, a1: A1): void;
3
+ declare function call<A1, A2>(funcs: MaybeArray<(a1: A1, a2: A2) => void>, a1: A1, a2: A2): void;
4
+ declare function call<A1, A2, A3>(funcs: MaybeArray<(a1: A1, a2: A2, a3: A3) => void>, a1: A1, a2: A2, a3: A3): void;
5
+ declare function call<A1, A2, A3, A4>(funcs: MaybeArray<(a1: A1, a2: A2, a3: A3, a4: A4) => void>, a1: A1, a2: A2, a3: A3, a4: A4): void;
6
+ export { call };
7
+ export type MaybeArray<T> = T | T[];
@@ -1,2 +1,3 @@
1
- import type { InjectionKey } from 'vue';
1
+ import { type InjectionKey } from 'vue';
2
2
  export declare function createInjectionKey<T>(key: string): InjectionKey<T>;
3
+ export declare function createContext<ContextValue>(providerComponentName: string | string[], contextName?: string): readonly [<T extends ContextValue | null | undefined = ContextValue>(fallback?: T) => T extends null ? ContextValue | null : ContextValue, (contextValue: ContextValue) => ContextValue];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teammodlr/ui-kit",
3
- "version": "2.1.45",
3
+ "version": "2.1.47",
4
4
  "description": "",
5
5
  "main": "lib/index.cjs.js",
6
6
  "module": "lib/index.es.js",
@@ -89,4 +89,4 @@
89
89
  "maska": "^2.1.9",
90
90
  "treemate": "^0.3.11"
91
91
  }
92
- }
92
+ }
@@ -1,26 +1,31 @@
1
- <script lang="ts">
2
- export interface ConfigProviderProps {
3
- useId?: () => string
4
- }
5
- export default {
6
- name: 'ConfigProvider',
7
- }
8
- </script>
9
-
10
- <script setup lang="ts">
11
- import {provide} from "vue";
12
- import type {ConfigProviderInjection} from "./types";
13
-
14
- const props = withDefaults(defineProps<ConfigProviderProps>(), {
15
- useId: undefined
16
- })
17
-
18
- const api: ConfigProviderInjection = {
19
- useId: props['useId'],
20
- } as const;
21
-
22
- provide('m-config', api);
23
- </script>
24
- <template>
25
- <slot />
26
- </template>
1
+ <script lang="ts">
2
+ import { createContext } from "../../utils/injection";
3
+
4
+ interface ConfigProviderContextValue {
5
+ useId?: () => string
6
+ }
7
+
8
+ export const [injectConfigProviderContext, provideConfigProviderContext] = createContext<ConfigProviderContextValue>('ConfigProvider');
9
+
10
+ export interface ConfigProviderProps {
11
+ useId?: () => string
12
+ }
13
+
14
+ export default {
15
+ name: 'ConfigProvider',
16
+ }
17
+ </script>
18
+
19
+ <script setup lang="ts">
20
+
21
+ const props = withDefaults(defineProps<ConfigProviderProps>(), {
22
+ useId: undefined
23
+ })
24
+
25
+ provideConfigProviderContext({
26
+ useId: props.useId
27
+ })
28
+ </script>
29
+ <template>
30
+ <slot />
31
+ </template>