sit-onyx 1.0.0-beta.147 → 1.0.0-beta.149

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,8 +1,8 @@
1
- import type { RequiredMarkerProp } from "../../composables/required";
1
+ import type { RequiredProp } from "../../composables/required";
2
2
  import type { CustomValidityProp } from "../../composables/useCustomValidity";
3
3
  import type { AutofocusProp, BaseSelectOption, Direction, SelectOptionValue } from "../../types";
4
4
  import type { SharedFormElementProps } from "../OnyxFormElement/types";
5
- export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOptionValue> = Pick<BaseSelectOption, "truncation"> & Pick<SharedFormElementProps, "label" | "labelTooltip" | "hideLabel" | "density" | "skeleton" | "disabled"> & {
5
+ export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOptionValue> = Pick<BaseSelectOption, "truncation"> & Pick<SharedFormElementProps, "label" | "labelTooltip" | "hideLabel" | "density" | "skeleton" | "disabled" | "requiredMarker"> & {
6
6
  /**
7
7
  * Checkbox options.
8
8
  */
@@ -27,4 +27,4 @@ export type OnyxCheckboxGroupProps<TValue extends SelectOptionValue = SelectOpti
27
27
  label?: string;
28
28
  };
29
29
  };
30
- export type CheckboxGroupOption<TValue extends SelectOptionValue = SelectOptionValue> = BaseSelectOption<TValue> & RequiredMarkerProp & CustomValidityProp & AutofocusProp;
30
+ export type CheckboxGroupOption<TValue extends SelectOptionValue = SelectOptionValue> = BaseSelectOption<TValue> & RequiredProp & CustomValidityProp & AutofocusProp;
@@ -1,4 +1,5 @@
1
1
  import { type Reactive, type Ref } from "vue";
2
+ import type { RequiredMarkerType } from "../../composables/required";
2
3
  import type { ShowErrorMode } from "../../composables/useErrorClass";
3
4
  /**
4
5
  * Props on the `OnyxForm` component.
@@ -22,6 +23,13 @@ export type FormProps = {
22
23
  * See [:user-invalid](https://drafts.csswg.org/selectors/#user-invalid-pseudo).
23
24
  */
24
25
  showError?: ShowErrorMode;
26
+ /**
27
+ * Required mode: `optional` will show an `(optional)` text after the label for optional form elements.
28
+ * `required` will show an `*` indicator for required inputs after the label instead.
29
+ * No marker will be visible if the label is hidden.
30
+ * @default undefined By default the parents setting is used, if none is defined on any `required` is the default.
31
+ */
32
+ requiredMarker?: RequiredMarkerType;
25
33
  };
26
34
  /**
27
35
  * Props that may be used by the form child components.
@@ -33,11 +41,11 @@ export type FormComputedProps = {
33
41
  * ❗️ DO NOT USE THIS TYPE ❗️
34
42
  *
35
43
  * Manual replication of the `keyof FormProps` type.
36
- * Unfortunately this is necessary because Vue can only supports simple index types.
44
+ * Unfortunately this is necessary because Vue can only support simple index types.
37
45
  *
38
46
  * See discussion in https://github.com/vuejs/core/issues/8286
39
47
  */
40
- export type __DONT_USE_VUE_FIX_KeyOfFormProps = "disabled" | "showError";
48
+ export type __DONT_USE_VUE_FIX_KeyOfFormProps = "disabled" | "showError" | "requiredMarker";
41
49
  /**
42
50
  * Props that may be used by the form child components.
43
51
  */
@@ -87,4 +95,5 @@ export declare const provideFormContext: (formProps: Reactive<FormProps> | undef
87
95
  export declare const useFormContext: (props: Reactive<FormInjectedProps>) => {
88
96
  disabled: Readonly<Ref<boolean, boolean>>;
89
97
  showError: Readonly<Ref<boolean | "touched", boolean | "touched">>;
98
+ requiredMarker: Readonly<Ref<"required" | "optional", "required" | "optional">>;
90
99
  };
@@ -1,5 +1,5 @@
1
1
  import type { DensityProp } from "../../composables/density";
2
- import type { RequiredMarkerProp } from "../../composables/required";
2
+ import type { RequiredProp } from "../../composables/required";
3
3
  import type { CustomMessageType, CustomValidityProp, FormMessages } from "../../composables/useCustomValidity";
4
4
  import type { SharedTextInputProps } from "../../composables/useLenientMaxLengthValidation";
5
5
  import type { SkeletonInjected } from "../../composables/useSkeletonState";
@@ -10,7 +10,7 @@ export type OnyxFormElementProps = Omit<SharedFormElementProps, "error" | "messa
10
10
  message?: FormMessages;
11
11
  successMessages?: FormMessages;
12
12
  };
13
- export type SharedFormElementProps = RequiredMarkerProp & FormInjectedProps & DensityProp & CustomValidityProp & AutofocusProp & {
13
+ export type SharedFormElementProps = FormInjectedProps & RequiredProp & DensityProp & CustomValidityProp & AutofocusProp & {
14
14
  /**
15
15
  * The id of a labelable form-related element.
16
16
  * If not given an id will be generated.
@@ -51,6 +51,7 @@ declare const __VLS_component: import("vue").DefineComponent<__VLS_PublicProps,
51
51
  readonly: boolean;
52
52
  skeleton: import("../../composables/useSkeletonState").SkeletonInjected;
53
53
  showError: boolean | symbol | "touched";
54
+ requiredMarker: symbol | "required" | "optional";
54
55
  hideSuccessIcon: boolean;
55
56
  hideClearIcon: boolean;
56
57
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
@@ -10,8 +10,9 @@ declare const _default: import("vue").DefineComponent<__VLS_Props, {
10
10
  "onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
11
11
  }>, {
12
12
  loading: boolean;
13
- disabled: import("../OnyxForm/OnyxForm.core").FormInjected<boolean>;
13
+ disabled: boolean | symbol;
14
14
  skeleton: import("../../composables/useSkeletonState").SkeletonInjected;
15
+ requiredMarker: symbol | "required" | "optional";
15
16
  modelValue: boolean;
16
17
  truncation: import("../../index.ts").TruncationType;
17
18
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
@@ -17,6 +17,8 @@ declare const _default: import("vue").DefineComponent<__VLS_PublicProps, {
17
17
  disabled: boolean | symbol;
18
18
  readonly: boolean;
19
19
  skeleton: import("../../composables/useSkeletonState").SkeletonInjected;
20
+ showError: boolean | symbol | "touched";
21
+ requiredMarker: symbol | "required" | "optional";
20
22
  disableManualResize: boolean;
21
23
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, false, {
22
24
  inputRef: HTMLTextAreaElement;
@@ -1,8 +1,5 @@
1
- import type { DensityProp } from "../../composables/density";
2
- import type { RequiredMarkerProp } from "../../composables/required";
3
- import type { CustomValidityProp } from "../../composables/useCustomValidity";
4
1
  import type { OnyxInputProps } from "../OnyxInput/types";
5
- export type OnyxTextareaProps = DensityProp & RequiredMarkerProp & CustomValidityProp & Pick<OnyxInputProps, "label" | "labelTooltip" | "hideLabel" | "placeholder" | "autocapitalize" | "autofocus" | "name" | "readonly" | "disabled" | "minlength" | "maxlength" | "withCounter" | "message" | "success" | "skeleton"> & {
2
+ export type OnyxTextareaProps = Omit<OnyxInputProps, "autocomplete" | "hideClearIcon" | "hideSuccessIcon" | "loading" | "pattern" | "type"> & {
6
3
  /**
7
4
  * Override the default autosize behavior (height adjusts based on the current value).
8
5
  * By default, the textarea will autosize while maintaining at least 3 and at most 10 rows.
@@ -1,24 +1,18 @@
1
+ import { type Ref } from "vue";
1
2
  export declare const RequiredMarkerTypes: readonly ["optional", "required"];
2
3
  export type RequiredMarkerType = (typeof RequiredMarkerTypes)[number];
3
- export type RequiredMarkerProp = {
4
+ export type RequiredProp = {
4
5
  /**
5
6
  * Whether the a value for this form element is required.
6
7
  */
7
8
  required?: boolean;
8
- /**
9
- * Required mode: `optional` will show an `(optional)` text after the label for optional inputs.
10
- * `required` will show an `*` indicator for required inputs after the label instead.
11
- * No marker will be visible if the label is hidden.
12
- * @default undefined By default the parents setting is used, if none is defined on any `required` is the default.
13
- */
14
- requiredMarker?: RequiredMarkerType;
15
9
  };
16
- export declare const useRequired: (props: RequiredMarkerProp) => {
10
+ export declare const useRequired: (props: RequiredProp, requiredMarker: Readonly<Ref<RequiredMarkerType>>) => {
17
11
  /**
18
12
  * Class that configures which type of required marker is used.
19
13
  */
20
14
  requiredTypeClass: import("vue").ComputedRef<{
21
- [x: string]: "required" | "optional" | undefined;
15
+ [x: string]: boolean;
22
16
  }>;
23
17
  requiredMarkerClass: import("vue").ComputedRef<{
24
18
  "onyx-required-marker": boolean | undefined;
@@ -6,7 +6,7 @@ import type { MaxLength } from "./useLenientMaxLengthValidation";
6
6
  export type CustomMessageType = string | FormMessages;
7
7
  export type CustomValidityProp = {
8
8
  /**
9
- * Custom error message to show. Will only show up after the user has interacted with the input.
9
+ * Custom error message to show. Takes precedence over intrinsic error messages.
10
10
  */
11
11
  customError?: CustomMessageType;
12
12
  };