sit-onyx 1.0.0-beta.47 → 1.0.0-beta.48
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/OnyxButton/OnyxButton.vue.d.ts +1 -1
- package/dist/components/OnyxButton/types.d.ts +2 -1
- package/dist/components/OnyxCheckboxGroup/types.d.ts +2 -1
- package/dist/components/OnyxForm/OnyxForm.core.d.ts +58 -0
- package/dist/components/OnyxForm/OnyxForm.vue.d.ts +25 -0
- package/dist/components/OnyxForm/types.d.ts +3 -0
- package/dist/components/OnyxIconButton/OnyxIconButton.vue.d.ts +1 -1
- package/dist/components/OnyxIconButton/types.d.ts +2 -1
- package/dist/components/OnyxInput/OnyxInput.vue.d.ts +1 -1
- package/dist/components/OnyxInput/types.d.ts +2 -1
- package/dist/components/OnyxRadioGroup/types.d.ts +2 -1
- package/dist/components/OnyxSelect/types.d.ts +6 -1
- package/dist/components/OnyxSelectInput/types.d.ts +2 -1
- package/dist/components/OnyxStepper/OnyxStepper.vue.d.ts +1 -1
- package/dist/components/OnyxStepper/types.d.ts +2 -1
- package/dist/components/OnyxSwitch/OnyxSwitch.vue.d.ts +1 -1
- package/dist/components/OnyxSwitch/types.d.ts +2 -1
- package/dist/components/OnyxTextarea/OnyxTextarea.vue.d.ts +1 -1
- package/dist/index.cjs +4 -4
- package/dist/index.js +1596 -1587
- package/dist/types/components.d.ts +2 -1
- package/package.json +2 -2
|
@@ -2,7 +2,7 @@ import type { OnyxButtonProps } from "./types";
|
|
|
2
2
|
declare const _default: import("vue").DefineComponent<OnyxButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<OnyxButtonProps> & Readonly<{}>, {
|
|
3
3
|
type: import("./types").ButtonType;
|
|
4
4
|
color: import("./types").ButtonColor;
|
|
5
|
-
disabled: boolean
|
|
5
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
6
6
|
loading: boolean;
|
|
7
7
|
mode: import("./types").ButtonMode;
|
|
8
8
|
skeleton: boolean;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { AutofocusProp } from "../../types";
|
|
3
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
3
4
|
export type OnyxButtonProps = DensityProp & AutofocusProp & {
|
|
4
5
|
/**
|
|
5
6
|
* The text content of the button.
|
|
@@ -8,7 +9,7 @@ export type OnyxButtonProps = DensityProp & AutofocusProp & {
|
|
|
8
9
|
/**
|
|
9
10
|
* If the button should be disabled or not.
|
|
10
11
|
*/
|
|
11
|
-
disabled?: boolean
|
|
12
|
+
disabled?: FormInjected<boolean>;
|
|
12
13
|
/**
|
|
13
14
|
* Shows a loading indicator.
|
|
14
15
|
*/
|
|
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
|
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
4
|
import type { AutofocusProp, BaseSelectOption, Direction, SelectOptionValue } from "../../types";
|
|
5
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
5
6
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
6
7
|
export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & Pick<BaseSelectOption, "truncation"> & Pick<OnyxFormElementProps, "label" | "hideLabel"> & {
|
|
7
8
|
/**
|
|
@@ -30,7 +31,7 @@ export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOpti
|
|
|
30
31
|
/**
|
|
31
32
|
* Whether all checkboxes should be disabled.
|
|
32
33
|
*/
|
|
33
|
-
disabled?: boolean
|
|
34
|
+
disabled?: FormInjected<boolean>;
|
|
34
35
|
/**
|
|
35
36
|
* If set, the specified number of skeleton radio buttons will be shown.
|
|
36
37
|
*/
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { type Reactive, type Ref } from "vue";
|
|
2
|
+
/**
|
|
3
|
+
* Props on the `OnyxForm` component.
|
|
4
|
+
* These are injected, so that they can be used in the form child components.
|
|
5
|
+
*/
|
|
6
|
+
export type FormInjectedProps = {
|
|
7
|
+
disabled: boolean;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Props that may be used by the form child components.
|
|
11
|
+
*/
|
|
12
|
+
type LocalProps = {
|
|
13
|
+
[TKey in keyof FormInjectedProps]?: FormInjected<FormInjectedProps[TKey]>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Symbol for the injected form injected properties.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FORM_INJECTED_SYMBOL: unique symbol;
|
|
19
|
+
export type FORM_INJECTED = typeof FORM_INJECTED_SYMBOL;
|
|
20
|
+
/**
|
|
21
|
+
* Prop type used by form child elements, which indicates that the prop value is taken from the parent form by default.
|
|
22
|
+
* The props **MUST** use `FORM_INJECTED_SYMBOL` as default value.
|
|
23
|
+
* `useFormContext` is used to access the injected form properties.
|
|
24
|
+
*
|
|
25
|
+
* @example
|
|
26
|
+
* ```ts
|
|
27
|
+
* const props = withDefaults(defineProps<OnyxComponentProps>(), {
|
|
28
|
+
* readonly: FORM_INJECTED_SYMBOL,
|
|
29
|
+
* disabled: FORM_INJECTED_SYMBOL,
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* const { disabled, readonly } = useFormContext(props);
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export type FormInjected<T> = T | FORM_INJECTED;
|
|
36
|
+
export declare const provideFormContext: (formProps: Reactive<FormInjectedProps> | undefined) => void;
|
|
37
|
+
/**
|
|
38
|
+
* Provides the injected form properties (if available).
|
|
39
|
+
* Otherwise a defined default is used.
|
|
40
|
+
* A prop defined on the child component will always take precedence over the injected form properties.
|
|
41
|
+
*
|
|
42
|
+
* The props **MUST** use `FORM_INJECTED_SYMBOL` as default value.
|
|
43
|
+
* The type `FormInjected<T>` can be used as PropType wrapper.
|
|
44
|
+
*
|
|
45
|
+
* @example
|
|
46
|
+
* ```ts
|
|
47
|
+
* const props = withDefaults(defineProps<OnyxComponentProps>(), {
|
|
48
|
+
* readonly: FORM_INJECTED_SYMBOL, // By default, the forms injected value is used
|
|
49
|
+
* disabled: FORM_INJECTED_SYMBOL, // By default, the forms injected value is used
|
|
50
|
+
* });
|
|
51
|
+
*
|
|
52
|
+
* const { disabled, readonly } = useFormContext(props);
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
export declare const useFormContext: (props: Reactive<LocalProps>) => {
|
|
56
|
+
disabled: Ref<boolean, boolean>;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { OnyxFormProps } from "./types";
|
|
2
|
+
declare function __VLS_template(): {
|
|
3
|
+
slots: Readonly<{
|
|
4
|
+
/**
|
|
5
|
+
* Any form content
|
|
6
|
+
*/
|
|
7
|
+
default?(): unknown;
|
|
8
|
+
}> & {
|
|
9
|
+
/**
|
|
10
|
+
* Any form content
|
|
11
|
+
*/
|
|
12
|
+
default?(): unknown;
|
|
13
|
+
};
|
|
14
|
+
refs: {};
|
|
15
|
+
attrs: Partial<{}>;
|
|
16
|
+
};
|
|
17
|
+
type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
18
|
+
declare const __VLS_component: import("vue").DefineComponent<OnyxFormProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<OnyxFormProps> & Readonly<{}>, {}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
19
|
+
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
20
|
+
export default _default;
|
|
21
|
+
type __VLS_WithTemplateSlots<T, S> = T & {
|
|
22
|
+
new (): {
|
|
23
|
+
$slots: S;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
@@ -14,7 +14,7 @@ type __VLS_TemplateResult = ReturnType<typeof __VLS_template>;
|
|
|
14
14
|
declare const __VLS_component: import("vue").DefineComponent<OnyxIconButtonProps, {}, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<OnyxIconButtonProps> & Readonly<{}>, {
|
|
15
15
|
type: import("../..").ButtonType;
|
|
16
16
|
color: import("../..").ButtonColor;
|
|
17
|
-
disabled: boolean
|
|
17
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
18
18
|
skeleton: boolean;
|
|
19
19
|
}, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {}, any>;
|
|
20
20
|
declare const _default: __VLS_WithTemplateSlots<typeof __VLS_component, __VLS_TemplateResult["slots"]>;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { AutofocusProp } from "../../types";
|
|
3
3
|
import type { ButtonColor, ButtonType } from "../OnyxButton/types";
|
|
4
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
4
5
|
export type OnyxIconButtonProps = DensityProp & AutofocusProp & {
|
|
5
6
|
/**
|
|
6
7
|
* The aria-label of the button.
|
|
@@ -9,7 +10,7 @@ export type OnyxIconButtonProps = DensityProp & AutofocusProp & {
|
|
|
9
10
|
/**
|
|
10
11
|
* If the button should be disabled or not.
|
|
11
12
|
*/
|
|
12
|
-
disabled?: boolean
|
|
13
|
+
disabled?: FormInjected<boolean>;
|
|
13
14
|
/**
|
|
14
15
|
* The button type.
|
|
15
16
|
*/
|
|
@@ -8,8 +8,8 @@ declare const _default: import("vue").DefineComponent<OnyxInputProps, {}, {}, {}
|
|
|
8
8
|
}>, {
|
|
9
9
|
type: import("./types").InputType;
|
|
10
10
|
required: boolean;
|
|
11
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
11
12
|
autocapitalize: import("./types").Autocapitalize;
|
|
12
|
-
disabled: boolean;
|
|
13
13
|
loading: boolean;
|
|
14
14
|
skeleton: boolean;
|
|
15
15
|
modelValue: string;
|
|
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
|
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
4
|
import type { AutofocusProp } from "../../types";
|
|
5
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
5
6
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
6
7
|
export type OnyxInputProps = DensityProp & RequiredMarkerProp & CustomValidityProp & Omit<OnyxFormElementProps, "modelValue" | "errorMessages"> & AutofocusProp & {
|
|
7
8
|
/**
|
|
@@ -49,7 +50,7 @@ export type OnyxInputProps = DensityProp & RequiredMarkerProp & CustomValidityPr
|
|
|
49
50
|
/**
|
|
50
51
|
* Whether the input should be disabled.
|
|
51
52
|
*/
|
|
52
|
-
disabled?: boolean
|
|
53
|
+
disabled?: FormInjected<boolean>;
|
|
53
54
|
/**
|
|
54
55
|
* Whether the input is loading. User interaction will be disabled.
|
|
55
56
|
*/
|
|
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
|
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
4
|
import type { AutofocusProp, BaseSelectOption, Direction, SelectOptionValue } from "../../types";
|
|
5
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
5
6
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
6
7
|
export type OnyxRadioGroupProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & RequiredMarkerProp & CustomValidityProp & Pick<BaseSelectOption, "truncation"> & Pick<OnyxFormElementProps, "label" | "hideLabel"> & {
|
|
7
8
|
/**
|
|
@@ -21,7 +22,7 @@ export type OnyxRadioGroupProps<TValue extends SelectOptionValue = SelectOptionV
|
|
|
21
22
|
/**
|
|
22
23
|
* Disable the radio group.
|
|
23
24
|
*/
|
|
24
|
-
disabled?: boolean
|
|
25
|
+
disabled?: FormInjected<boolean>;
|
|
25
26
|
/**
|
|
26
27
|
* Direction of the checkboxes. Can be vertical (default) or horizontal.
|
|
27
28
|
*/
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { ManagedProp } from "../../composables/useManagedState";
|
|
3
3
|
import type { AutofocusProp, BaseSelectOption, SelectOptionValue } from "../../types";
|
|
4
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
4
5
|
import type { OnyxSelectInputProps } from "../OnyxSelectInput/types";
|
|
5
6
|
import type { OnyxSelectOptionProps } from "../OnyxSelectOption/types";
|
|
6
7
|
export type SelectSearchProps = {
|
|
@@ -58,7 +59,11 @@ export type SelectModelValueProps<TValue extends SelectOptionValue> = {
|
|
|
58
59
|
label?: string;
|
|
59
60
|
};
|
|
60
61
|
};
|
|
61
|
-
export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps, "density" | "modelValue" | "showFocus"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
|
|
62
|
+
export type OnyxSelectProps<TValue extends SelectOptionValue = SelectOptionValue> = DensityProp & SelectModelValueProps<TValue> & SelectSearchProps & Omit<OnyxSelectInputProps, "density" | "modelValue" | "showFocus" | "disabled"> & AutofocusProp & Pick<BaseSelectOption, "truncation"> & {
|
|
63
|
+
/**
|
|
64
|
+
* Whether the select should be disabled.
|
|
65
|
+
*/
|
|
66
|
+
disabled?: FormInjected<boolean>;
|
|
62
67
|
/**
|
|
63
68
|
* Label that will be shown in the input of OnyxSelect.
|
|
64
69
|
* If unset, will be managed internally by comparing `modelValue` with `options`.
|
|
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
|
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
4
|
import type { AutofocusProp } from "../../types";
|
|
5
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
5
6
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
6
7
|
export declare const MULTISELECT_TEXT_MODE: readonly ["summary", "preview"];
|
|
7
8
|
export type MultiselectTextMode = (typeof MULTISELECT_TEXT_MODE)[number];
|
|
@@ -20,7 +21,7 @@ export type OnyxSelectInputProps = DensityProp & RequiredMarkerProp & CustomVali
|
|
|
20
21
|
/**
|
|
21
22
|
* Whether the select should be disabled.
|
|
22
23
|
*/
|
|
23
|
-
disabled?: boolean
|
|
24
|
+
disabled?: FormInjected<boolean>;
|
|
24
25
|
/**
|
|
25
26
|
* Whether to show a skeleton select.
|
|
26
27
|
*/
|
|
@@ -6,7 +6,7 @@ declare const _default: import("vue").DefineComponent<OnyxStepperProps, {}, {},
|
|
|
6
6
|
onValidityChange?: ((validity: ValidityState) => any) | undefined;
|
|
7
7
|
"onUpdate:modelValue"?: ((value?: number | undefined) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
|
-
disabled: boolean
|
|
9
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
10
10
|
loading: boolean;
|
|
11
11
|
skeleton: boolean;
|
|
12
12
|
step: number;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DensityProp } from "../../composables/density";
|
|
2
2
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
3
3
|
import type { AutofocusProp } from "../../types";
|
|
4
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
4
5
|
import type { OnyxFormElementProps } from "../OnyxFormElement/types";
|
|
5
6
|
import type { Autocomplete } from "../OnyxInput/types";
|
|
6
7
|
export type OnyxStepperProps = DensityProp & CustomValidityProp & Omit<OnyxFormElementProps, "modelValue" | "errorMessages" | "withCounter" | "maxlength"> & AutofocusProp & {
|
|
@@ -40,7 +41,7 @@ export type OnyxStepperProps = DensityProp & CustomValidityProp & Omit<OnyxFormE
|
|
|
40
41
|
/**
|
|
41
42
|
* Whether to disable the input and prevent user interaction.
|
|
42
43
|
*/
|
|
43
|
-
disabled?: boolean
|
|
44
|
+
disabled?: FormInjected<boolean>;
|
|
44
45
|
/**
|
|
45
46
|
* Whether the input should be readonly.
|
|
46
47
|
*/
|
|
@@ -6,7 +6,7 @@ declare const _default: import("vue").DefineComponent<OnyxSwitchProps, {}, {}, {
|
|
|
6
6
|
onValidityChange?: ((validity: ValidityState) => any) | undefined;
|
|
7
7
|
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
|
-
disabled: boolean
|
|
9
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
10
10
|
loading: boolean;
|
|
11
11
|
skeleton: boolean;
|
|
12
12
|
modelValue: boolean;
|
|
@@ -2,6 +2,7 @@ import type { DensityProp } from "../../composables/density";
|
|
|
2
2
|
import type { RequiredMarkerProp } from "../../composables/required";
|
|
3
3
|
import type { CustomValidityProp } from "../../composables/useCustomValidity";
|
|
4
4
|
import type { AutofocusProp, TruncationType } from "../../types";
|
|
5
|
+
import type { FormInjected } from "../OnyxForm/OnyxForm.core";
|
|
5
6
|
export type OnyxSwitchProps = DensityProp & RequiredMarkerProp & CustomValidityProp & AutofocusProp & {
|
|
6
7
|
/**
|
|
7
8
|
* Whether the switch should be checked or not.
|
|
@@ -14,7 +15,7 @@ export type OnyxSwitchProps = DensityProp & RequiredMarkerProp & CustomValidityP
|
|
|
14
15
|
/**
|
|
15
16
|
* Whether to disable the switch and prevent user interaction.
|
|
16
17
|
*/
|
|
17
|
-
disabled?: boolean
|
|
18
|
+
disabled?: FormInjected<boolean>;
|
|
18
19
|
/**
|
|
19
20
|
* Shows a loading indicator.
|
|
20
21
|
*/
|
|
@@ -7,8 +7,8 @@ declare const _default: import("vue").DefineComponent<OnyxTextareaProps, {}, {},
|
|
|
7
7
|
"onUpdate:modelValue"?: ((value: string) => any) | undefined;
|
|
8
8
|
}>, {
|
|
9
9
|
required: boolean;
|
|
10
|
+
disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
|
|
10
11
|
autocapitalize: import("../..").Autocapitalize;
|
|
11
|
-
disabled: boolean;
|
|
12
12
|
skeleton: boolean;
|
|
13
13
|
modelValue: string;
|
|
14
14
|
readonly: boolean;
|