sit-onyx 1.0.0-beta.22 → 1.0.0-beta.23
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/types.d.ts +9 -11
- package/dist/composables/useManagedState.d.ts +6 -3
- package/dist/index.cjs +3 -3
- package/dist/index.js +977 -976
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/styles/mixins/list.scss +5 -2
|
@@ -12,21 +12,18 @@ export type SelectSearchProps = {
|
|
|
12
12
|
withSearch: true;
|
|
13
13
|
/**
|
|
14
14
|
* Value of the search input.
|
|
15
|
-
* Property is managed internally, when undefined.
|
|
16
|
-
|
|
17
|
-
searchTerm?: string;
|
|
18
|
-
/**
|
|
19
|
-
* As default, onyx will handle the search by comparing
|
|
15
|
+
* Property is managed internally, when undefined. That means:
|
|
16
|
+
* As default, onyx will handle filtering the options by comparing
|
|
20
17
|
* the option labels with the `searchTerm`.
|
|
21
|
-
*
|
|
22
|
-
*
|
|
18
|
+
*
|
|
19
|
+
* When `searchTerm` is handled by you (not undefined), this behavior is disabled.
|
|
20
|
+
* Then, you can handle the filtering yourself by reducing the `options` as desired.
|
|
23
21
|
* Hint: Cover `valueLabel` to prevent the disappearance of the current selections label
|
|
24
22
|
*/
|
|
25
|
-
|
|
23
|
+
searchTerm?: string;
|
|
26
24
|
} | {
|
|
27
25
|
withSearch?: false;
|
|
28
26
|
searchTerm?: never;
|
|
29
|
-
manualSearch?: never;
|
|
30
27
|
};
|
|
31
28
|
export type SelectModelValueProps<TValue extends SelectOptionValue> = {
|
|
32
29
|
/**
|
|
@@ -60,7 +57,7 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
|
|
|
60
57
|
label?: string;
|
|
61
58
|
};
|
|
62
59
|
};
|
|
63
|
-
export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps, "density" | "modelValue"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
|
|
60
|
+
export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps, "density" | "modelValue" | "showFocus"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
|
|
64
61
|
/**
|
|
65
62
|
* Label that will be shown in the input of OnyxSelect.
|
|
66
63
|
* If unset, will be managed internally by comparing `modelValue` with `options`.
|
|
@@ -90,7 +87,8 @@ export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue
|
|
|
90
87
|
};
|
|
91
88
|
export type SelectOption<TValue extends SelectOptionValue = SelectOptionValue> = Pick<BaseSelectOption<TValue>, "value" | "label" | "disabled" | "truncation"> & Pick<OnyxSelectOptionProps, "icon"> & {
|
|
92
89
|
/**
|
|
93
|
-
* Optional group name. If set, all options will be grouped
|
|
90
|
+
* Optional group name. If set, all options with the same group name will be grouped below that name.
|
|
91
|
+
* If `group` is used for one option, it should be used for all other options as well.
|
|
94
92
|
*/
|
|
95
93
|
group?: string;
|
|
96
94
|
};
|
|
@@ -8,18 +8,21 @@ import { type Ref } from "vue";
|
|
|
8
8
|
* @param prop `toRef(() => props.something)` ref of the optional prop.
|
|
9
9
|
* @param initialState in case of the prop being initially undefined, this will be used as the initial state value.
|
|
10
10
|
* @param emit function that is called when a state write is performed
|
|
11
|
-
* @returns ref of the state
|
|
11
|
+
* @returns ref of the state and isManaged
|
|
12
12
|
*
|
|
13
13
|
* @example ```ts
|
|
14
14
|
* // IMPORTANT: default value MUST be set to undefined
|
|
15
15
|
* const props = withDefaults(defineProps<{ isExpanded?: boolean }>(), { isExpanded: undefined });
|
|
16
16
|
* const emit = defineEmits<{ "update:isExpanded": [isExpanded: boolean] }>();
|
|
17
17
|
*
|
|
18
|
-
* const isExpanded = useManagedState(
|
|
18
|
+
* const { state: isExpanded } = useManagedState(
|
|
19
19
|
* toRef(() => props.isExpanded),
|
|
20
20
|
* false,
|
|
21
21
|
* (v) => emit("update:isExpanded", v ?? false),
|
|
22
22
|
* );
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
export declare const useManagedState: <Prop extends Readonly<Ref<T | undefined>>, T>(prop: Prop, initialState: T, emit: (val: T) => void) =>
|
|
25
|
+
export declare const useManagedState: <Prop extends Readonly<Ref<T | undefined>>, T>(prop: Prop, initialState: T, emit: (val: T) => void) => {
|
|
26
|
+
state: import("vue").WritableComputedRef<T>;
|
|
27
|
+
isManaged: import("vue").ComputedRef<boolean>;
|
|
28
|
+
};
|