sit-onyx 1.0.0-beta.16 → 1.0.0-beta.18

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.
@@ -3,13 +3,13 @@ import type { OnyxSelectProps, SelectOption } from "./types";
3
3
  declare const _default: <TValue extends SelectOptionValue = SelectOptionValue>(__VLS_props: NonNullable<Awaited<typeof __VLS_setup>>["props"], __VLS_ctx?: __VLS_Prettify<Pick<NonNullable<Awaited<typeof __VLS_setup>>, "attrs" | "emit" | "slots">>, __VLS_expose?: NonNullable<Awaited<typeof __VLS_setup>>["expose"], __VLS_setup?: Promise<{
4
4
  props: __VLS_Prettify<Pick<Partial<{}> & Omit<{
5
5
  onValidityChange?: ((validity: ValidityState) => any) | undefined;
6
- "onUpdate:modelValue"?: ((value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => any) | undefined;
6
+ "onUpdate:modelValue"?: ((value: TValue | TValue[] | undefined) => any) | undefined;
7
7
  "onUpdate:open"?: ((open: boolean) => any) | undefined;
8
8
  "onUpdate:searchTerm"?: ((searchTerm: string) => any) | undefined;
9
9
  onLazyLoad?: (() => any) | undefined;
10
10
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{}>> & {
11
11
  onValidityChange?: ((validity: ValidityState) => any) | undefined;
12
- "onUpdate:modelValue"?: ((value: SelectOption<TValue> | SelectOption<TValue>[] | undefined) => any) | undefined;
12
+ "onUpdate:modelValue"?: ((value: TValue | TValue[] | undefined) => any) | undefined;
13
13
  "onUpdate:open"?: ((open: boolean) => any) | undefined;
14
14
  "onUpdate:searchTerm"?: ((searchTerm: string) => any) | undefined;
15
15
  onLazyLoad?: (() => any) | undefined;
@@ -55,7 +55,7 @@ declare const _default: <TValue extends SelectOptionValue = SelectOptionValue>(_
55
55
  */
56
56
  option?(props: SelectOption<TValue>): unknown;
57
57
  }>;
58
- 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
+ emit: (((evt: "validityChange", validity: ValidityState) => void) & ((evt: "update:modelValue", value: TValue | TValue[] | undefined) => void) & ((evt: "update:open", open: boolean) => void) & ((evt: "update:searchTerm", searchTerm: string) => void) & ((evt: "lazyLoad") => void)) & {};
59
59
  }>) => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
60
60
  [key: string]: any;
61
61
  }> & {
@@ -15,9 +15,18 @@ export type SelectSearchProps = {
15
15
  * Property is managed internally, when undefined.
16
16
  */
17
17
  searchTerm?: string;
18
+ /**
19
+ * As default, onyx will handle the search by comparing
20
+ * the option labels with the `searchTerm`.
21
+ * When `manualSearch` is set, this behavior is disabled.
22
+ * Handle your own filtering by reducing the `options` as desired.
23
+ * Hint: Cover `valueLabel` to prevent the disappearance of the current selections label
24
+ */
25
+ manualSearch?: boolean;
18
26
  } | {
19
27
  withSearch?: false;
20
28
  searchTerm?: never;
29
+ manualSearch?: never;
21
30
  };
22
31
  export type SelectModelValueProps<TValue extends SelectOptionValue> = {
23
32
  /**
@@ -25,9 +34,9 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
25
34
  */
26
35
  multiple?: false;
27
36
  /**
28
- * Current value.
37
+ * Value of the currently selected option.
29
38
  */
30
- modelValue?: SelectOption<TValue>;
39
+ modelValue?: TValue;
31
40
  withCheckAll?: never;
32
41
  } | {
33
42
  /**
@@ -35,9 +44,9 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
35
44
  */
36
45
  multiple: true;
37
46
  /**
38
- * Current value / selected option(s).
47
+ * Values of the currently selected options.
39
48
  */
40
- modelValue?: SelectOption<TValue>[];
49
+ modelValue?: TValue[];
41
50
  /**
42
51
  * If true, a checkbox will be displayed to check/uncheck all options.
43
52
  * Disabled and skeleton checkboxes will be excluded from the check/uncheck behavior.
@@ -51,7 +60,14 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
51
60
  label?: string;
52
61
  };
53
62
  };
54
- export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps<TValue>, "density" | "modelValue"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
63
+ export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps, "density" | "modelValue"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
64
+ /**
65
+ * Label that will be shown in the input of OnyxSelect.
66
+ * If unset, will be managed internally by comparing `modelValue` with `options`.
67
+ * Recommended to be used if not all options can be provided at once
68
+ * or a manual search is implemented.
69
+ */
70
+ valueLabel?: string | string[];
55
71
  /**
56
72
  * If true, the select popover is expanded and visible.
57
73
  * Property is managed internally, when undefined.
@@ -7,7 +7,7 @@ declare const _default: <TValue extends SelectOptionValue>(__VLS_props: NonNulla
7
7
  } & import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps & Readonly<import("vue").ExtractPropTypes<{}>> & {
8
8
  onClick?: (() => any) | undefined;
9
9
  onValidityChange?: ((validity: ValidityState) => any) | undefined;
10
- }, never>, "onClick" | "onValidityChange"> & OnyxSelectInputProps<TValue>> & import("vue").PublicProps;
10
+ }, never>, "onClick" | "onValidityChange"> & OnyxSelectInputProps> & import("vue").PublicProps;
11
11
  expose(exposed: import("vue").ShallowUnwrapRef<{
12
12
  focus: () => void | undefined;
13
13
  }>): void;
@@ -1,29 +1,22 @@
1
- import type { SelectOption } from "../..";
2
1
  import type { DensityProp } from "../../composables/density";
3
2
  import type { RequiredMarkerProp } from "../../composables/required";
4
3
  import type { CustomValidityProp } from "../../composables/useCustomValidity";
5
- import type { AutofocusProp, SelectOptionValue } from "../../types";
4
+ import type { AutofocusProp } from "../../types";
6
5
  import type { OnyxFormElementProps } from "../OnyxFormElement/types";
7
6
  export declare const MULTISELECT_TEXT_MODE: readonly ["summary", "preview"];
8
7
  export type MultiselectTextMode = (typeof MULTISELECT_TEXT_MODE)[number];
9
- /**
10
- * Whether multiple values can be selected.
11
- */
12
- export type SelectionInput<TValue extends SelectOptionValue = SelectOptionValue> = {
8
+ export type OnyxSelectInputProps = DensityProp & RequiredMarkerProp & CustomValidityProp & AutofocusProp & Omit<OnyxFormElementProps, "modelValue" | "maxlength" | "withCounter"> & {
13
9
  /**
14
- * Current value of the select.
10
+ * Current label(s) of the select.
15
11
  */
16
- modelValue?: SelectInputModelValue<TValue>[];
12
+ modelValue?: string[];
17
13
  /**
18
- * How a multiselect value will be displayed in the input.
14
+ * How multiselect labels will be displayed in the input.
19
15
  * - summary (default): will show "x Selected" if more than 1 is selected.
20
16
  * - preview: will show the names of the selection as a truncated list.
21
17
  * A number-badge appears next to it including a tooltip with all selected names.
22
18
  */
23
19
  textMode?: MultiselectTextMode;
24
- };
25
- export type SelectInputModelValue<TValue extends SelectOptionValue = SelectOptionValue> = Pick<SelectOption<TValue>, "value" | "label">;
26
- export type OnyxSelectInputProps<TValue extends SelectOptionValue> = DensityProp & RequiredMarkerProp & CustomValidityProp & SelectionInput<TValue> & AutofocusProp & Omit<OnyxFormElementProps, "modelValue" | "maxlength" | "withCounter"> & {
27
20
  /**
28
21
  * Whether the select should be disabled.
29
22
  */