sit-onyx 1.0.0-alpha.152 → 1.0.0-alpha.154
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/components/OnyxSelect/OnyxSelect.vue.d.ts +3 -1
- package/dist/components/OnyxSelect/types.d.ts +6 -0
- package/dist/composables/useManagedState.d.ts +26 -0
- package/dist/i18n/index.d.ts +29 -4
- package/dist/index.cjs +4 -4
- package/dist/index.d.ts +2 -1
- package/dist/index.js +820 -792
- package/dist/utils/plugin.d.ts +1 -0
- package/package.json +1 -1
|
@@ -5,11 +5,13 @@ declare const _default: <TValue extends SelectOptionValue = SelectOptionValue>(_
|
|
|
5
5
|
props: __VLS_Prettify<__VLS_OmitKeepDiscriminatedUnion<(Partial<{}> & Omit<{
|
|
6
6
|
"onUpdate:modelValue"?: ((value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => any) | undefined;
|
|
7
7
|
onValidityChange?: ((validity: ValidityState) => any) | undefined;
|
|
8
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
8
9
|
"onUpdate:searchTerm"?: ((searchTerm: string) => any) | undefined;
|
|
9
10
|
onLazyLoad?: (() => any) | undefined;
|
|
10
11
|
} & import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps & Readonly<import('vue').ExtractPropTypes<{}>> & {
|
|
11
12
|
"onUpdate:modelValue"?: ((value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => any) | undefined;
|
|
12
13
|
onValidityChange?: ((validity: ValidityState) => any) | undefined;
|
|
14
|
+
"onUpdate:open"?: ((open: boolean) => any) | undefined;
|
|
13
15
|
"onUpdate:searchTerm"?: ((searchTerm: string) => any) | undefined;
|
|
14
16
|
onLazyLoad?: (() => any) | undefined;
|
|
15
17
|
}, never>) & ({} & OnyxSelectProps<TValue>), keyof import('vue').VNodeProps | keyof import('vue').AllowedComponentProps>> & {} & (import('vue').VNodeProps & import('vue').AllowedComponentProps & import('vue').ComponentCustomProps);
|
|
@@ -54,7 +56,7 @@ declare const _default: <TValue extends SelectOptionValue = SelectOptionValue>(_
|
|
|
54
56
|
*/
|
|
55
57
|
option?(props: SelectOption<TValue>): unknown;
|
|
56
58
|
}>;
|
|
57
|
-
emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => void) & ((evt: "update:searchTerm", searchTerm: string) => void) & ((evt: "lazyLoad") => void);
|
|
59
|
+
emit: ((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "update:searchTerm", searchTerm: string) => void) & ((evt: "lazyLoad") => void);
|
|
58
60
|
}>) => import('vue').VNode<import('vue').RendererNode, import('vue').RendererElement, {
|
|
59
61
|
[key: string]: any;
|
|
60
62
|
}> & {
|
|
@@ -13,6 +13,7 @@ export type SelectSearchProps = {
|
|
|
13
13
|
withSearch: true;
|
|
14
14
|
/**
|
|
15
15
|
* Value of the search input.
|
|
16
|
+
* Property is managed internally, when undefined.
|
|
16
17
|
*/
|
|
17
18
|
searchTerm?: string;
|
|
18
19
|
} | {
|
|
@@ -52,6 +53,11 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
|
|
|
52
53
|
};
|
|
53
54
|
};
|
|
54
55
|
export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps<TValue>, "density" | "modelValue"> & AutofocusProp & {
|
|
56
|
+
/**
|
|
57
|
+
* If true, the select popover is expanded and visible.
|
|
58
|
+
* Property is managed internally, when undefined.
|
|
59
|
+
*/
|
|
60
|
+
open?: boolean;
|
|
55
61
|
/**
|
|
56
62
|
* Label describing the list of options to support assistive technologies.
|
|
57
63
|
* @example: { label: "Your Animal", listLabel: "List of animals" }
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Composable for conditionally managing state based on the prop value.
|
|
5
|
+
*
|
|
6
|
+
* When the prop value is not undefined, the prop value is always used.
|
|
7
|
+
* If the prop value is undefined, then the internal state is used instead.
|
|
8
|
+
*
|
|
9
|
+
* @param prop `toRef(() => props.something)` ref of the optional prop.
|
|
10
|
+
* @param initialState in case of the prop being initially undefined, this will be used as the initial state value.
|
|
11
|
+
* @param emit function that is called when a state write is performed
|
|
12
|
+
* @returns ref of the state
|
|
13
|
+
*
|
|
14
|
+
* @example ```ts
|
|
15
|
+
* // IMPORTANT: default value MUST be set to undefined
|
|
16
|
+
* const props = withDefaults(defineProps<{ isExpanded?: boolean }>(), { isExpanded: undefined });
|
|
17
|
+
* const emit = defineEmits<{ "update:isExpanded": [isExpanded: boolean] }>();
|
|
18
|
+
*
|
|
19
|
+
* const isExpanded = useManagedState(
|
|
20
|
+
* toRef(() => props.isExpanded),
|
|
21
|
+
* false,
|
|
22
|
+
* (v) => emit("update:isExpanded", v ?? false),
|
|
23
|
+
* );
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const useManagedState: <Prop extends Readonly<Ref<T | undefined>>, T>(prop: Prop, initialState: T, emit: (val: T) => void) => import('vue').WritableComputedRef<T>;
|
package/dist/i18n/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FlattenedKeysOf } from '../types/i18n';
|
|
2
2
|
import { DeepPartial } from '../types/utils';
|
|
3
|
-
import { App, MaybeRef } from 'vue';
|
|
3
|
+
import { App, ComputedRef, MaybeRef } from 'vue';
|
|
4
4
|
import { default as enUS } from './locales/en-US.json';
|
|
5
5
|
|
|
6
6
|
/**
|
|
@@ -22,6 +22,8 @@ export type ProvideI18nOptions = {
|
|
|
22
22
|
* all onyx messages will be updated if it changes (if locale is supported).
|
|
23
23
|
* If a message is missing for your currently set locale, English will be used as fallback.
|
|
24
24
|
*
|
|
25
|
+
* The should be in the BCP 47 format as it's used to localize date times using the native [Intl API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl)
|
|
26
|
+
*
|
|
25
27
|
* @default "en-US"
|
|
26
28
|
*/
|
|
27
29
|
locale?: MaybeRef<string>;
|
|
@@ -41,18 +43,41 @@ export type ProvideI18nOptions = {
|
|
|
41
43
|
* ```
|
|
42
44
|
*/
|
|
43
45
|
messages?: Record<string, DeepPartial<OnyxTranslations>>;
|
|
46
|
+
/**
|
|
47
|
+
* Custom translation function. This option can be used to pass a custom function for translations to onyx in case you want your i18n library to handle them.
|
|
48
|
+
* @example
|
|
49
|
+
* ```ts
|
|
50
|
+
* import { useI18n } from "vue-i18n";
|
|
51
|
+
*
|
|
52
|
+
* const { t } = useI18n();
|
|
53
|
+
* {
|
|
54
|
+
* t: computed((key, placeholders) => t(`onyx.${key}`, placeholders?.n ?? 1, { named: placeholders }))
|
|
55
|
+
* }
|
|
56
|
+
* ```
|
|
57
|
+
*
|
|
58
|
+
* Note: If a custom `t` function is used, passed messages will not be used.
|
|
59
|
+
*/
|
|
60
|
+
t?: ComputedRef<TranslationFunction>;
|
|
44
61
|
};
|
|
62
|
+
export type TranslationFunction = (key: OnyxTranslationKey,
|
|
63
|
+
/** Named values to interpolate into the translation. The property `n` is special as it represents the number of elements for pluralization. */
|
|
64
|
+
placeholders?: Record<string, string | number | undefined> & {
|
|
65
|
+
n?: number;
|
|
66
|
+
}) => string;
|
|
45
67
|
/**
|
|
46
68
|
* Provides a global i18n instance that is used by onyx.
|
|
47
69
|
* Must only be called once in the `App.vue` file of a project that consumes onyx.
|
|
48
70
|
*/
|
|
49
|
-
export declare const provideI18n: (app: App, options?: ProvideI18nOptions) =>
|
|
71
|
+
export declare const provideI18n: (app: App, options?: ProvideI18nOptions) => {
|
|
72
|
+
t: ComputedRef<TranslationFunction>;
|
|
73
|
+
locale: ComputedRef<string>;
|
|
74
|
+
};
|
|
50
75
|
/**
|
|
51
76
|
* Injects the onyx i18n instance.
|
|
52
77
|
* Creates a fallback if provide was never called.
|
|
53
78
|
*/
|
|
54
79
|
export declare const injectI18n: () => {
|
|
55
|
-
|
|
56
|
-
|
|
80
|
+
t: ComputedRef<TranslationFunction>;
|
|
81
|
+
locale: ComputedRef<string>;
|
|
57
82
|
};
|
|
58
83
|
export {};
|