@stenajs-webui/forms 20.6.11 → 20.7.0

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,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { ChangeEvent, ComponentPropsWithoutRef } from "react";
3
3
  import { FullOnChangeProps } from "../types";
4
- export declare type CheckboxSize = "standard" | "small";
4
+ export type CheckboxSize = "standard" | "small";
5
5
  export interface CheckboxProps extends FullOnChangeProps<boolean, ChangeEvent<HTMLInputElement>>, Omit<ComponentPropsWithoutRef<"input">, "size" | "value"> {
6
6
  indeterminate?: boolean;
7
7
  size?: CheckboxSize;
@@ -2,7 +2,7 @@ import * as React from "react";
2
2
  import { PropsWithChildren } from "react";
3
3
  import { ValueAndOnValueChangeProps } from "../types";
4
4
  import { SelectElementProps } from "@stenajs-webui/core";
5
- export declare type SelectBorderVariant = "normalBorder" | "onlyTopBorder" | "onlyBottomBorder";
5
+ export type SelectBorderVariant = "normalBorder" | "onlyTopBorder" | "onlyBottomBorder";
6
6
  export interface LabelledSelectProps extends ValueAndOnValueChangeProps<string>, PropsWithChildren, Omit<SelectElementProps, "value"> {
7
7
  id?: string;
8
8
  name: string;
@@ -11,5 +11,5 @@ export interface LabelledSelectProps extends ValueAndOnValueChangeProps<string>,
11
11
  borderVariant?: SelectBorderVariant;
12
12
  variant?: LabelledSelectVariant;
13
13
  }
14
- export declare type LabelledSelectVariant = "normal" | "error";
14
+ export type LabelledSelectVariant = "normal" | "error";
15
15
  export declare const LabelledSelect: React.FC<LabelledSelectProps>;
@@ -1,9 +1,9 @@
1
1
  import * as React from "react";
2
2
  import { InputElementProps } from "@stenajs-webui/core";
3
3
  import { ValueAndOnValueChangeProps } from "../types";
4
- export declare type LabelledTextInputVariant = "normal" | "error";
5
- export declare type LabelledTextInputSize = "medium" | "large";
6
- export declare type LabelledTextInputBorderVariant = "normalBorder" | "onlyTop" | "onlyBottom";
4
+ export type LabelledTextInputVariant = "normal" | "error";
5
+ export type LabelledTextInputSize = "medium" | "large";
6
+ export type LabelledTextInputBorderVariant = "normalBorder" | "onlyTop" | "onlyBottom";
7
7
  export interface LabelledTextInputProps extends Omit<InputElementProps, "value" | "size">, ValueAndOnValueChangeProps<string> {
8
8
  id?: string;
9
9
  label?: string;
@@ -1,4 +1,4 @@
1
1
  import { ValueAndOnValueChangeProps } from "../../types";
2
2
  import { NumericTextInputProps } from "../NumericTextInput";
3
- export declare type NumericInputValueProps = ValueAndOnValueChangeProps<number | undefined>;
4
- export declare const useNumericInputValue: (value: number | undefined, onValueChange?: ((value: number | undefined) => void) | undefined) => Partial<NumericTextInputProps>;
3
+ export type NumericInputValueProps = ValueAndOnValueChangeProps<number | undefined>;
4
+ export declare const useNumericInputValue: (value: number | undefined, onValueChange?: (value: number | undefined) => void) => Partial<NumericTextInputProps>;
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { ChangeEvent, ComponentPropsWithoutRef } from "react";
3
3
  import { FullOnChangeProps } from "../types";
4
- export declare type RadioButtonSize = "standard" | "small";
4
+ export type RadioButtonSize = "standard" | "small";
5
5
  export interface RadioButtonProps extends FullOnChangeProps<string, ChangeEvent<HTMLInputElement>>, Omit<ComponentPropsWithoutRef<"input">, "size" | "value"> {
6
6
  size?: RadioButtonSize;
7
7
  }
@@ -1,8 +1,10 @@
1
1
  import { IconDefinition } from "@fortawesome/fontawesome-svg-core";
2
2
  import * as React from "react";
3
+ import { ReactNode } from "react";
3
4
  import { RadioButtonProps } from "./RadioButton";
4
- export declare type RadioButtonBoxVariant = "normal" | "danger";
5
- export interface RadioButtonBoxProps extends RadioButtonProps {
5
+ export type RadioButtonBoxVariant = "normal" | "danger";
6
+ export type RadioButtonBoxProps = RadioButtonBoxNoRightProps | RadioButtonBoxIconProps | RadioButtonBoxContentRightProps;
7
+ interface RadioButtonBoxCommonProps extends RadioButtonProps {
6
8
  label?: string;
7
9
  /**
8
10
  * If set, this label is used by screen readers instead of label prop.
@@ -11,7 +13,17 @@ export interface RadioButtonBoxProps extends RadioButtonProps {
11
13
  */
12
14
  screenReaderLabel?: string;
13
15
  variant?: RadioButtonBoxVariant;
14
- icon?: IconDefinition;
15
16
  radioButtonClassName?: string;
16
17
  }
18
+ export interface RadioButtonBoxNoRightProps extends RadioButtonBoxCommonProps {
19
+ }
20
+ export interface RadioButtonBoxIconProps extends RadioButtonBoxCommonProps {
21
+ icon: IconDefinition;
22
+ contentRight?: never;
23
+ }
24
+ export interface RadioButtonBoxContentRightProps extends RadioButtonBoxCommonProps {
25
+ icon?: never;
26
+ contentRight: ReactNode;
27
+ }
17
28
  export declare const RadioButtonBox: React.FC<RadioButtonBoxProps>;
29
+ export {};
@@ -1,7 +1,7 @@
1
1
  import * as React from "react";
2
2
  import { ChangeEvent, ComponentPropsWithoutRef } from "react";
3
3
  import { FullOnChangeProps } from "../types";
4
- declare type Resize = "none" | "both" | "horizontal" | "vertical" | "inherit" | "initial" | "revert" | "unset";
4
+ type Resize = "none" | "both" | "horizontal" | "vertical" | "inherit" | "initial" | "revert" | "unset";
5
5
  export interface TextAreaProps extends Omit<ComponentPropsWithoutRef<"textarea">, "value">, FullOnChangeProps<string, ChangeEvent<HTMLTextAreaElement>> {
6
6
  resize?: Resize;
7
7
  readOnly?: boolean;
@@ -4,7 +4,7 @@ import * as React from "react";
4
4
  import { ChangeEvent, CSSProperties } from "react";
5
5
  import { MoveDirection } from "../../../hooks/UseKeyboardNavigation";
6
6
  import { FullOnChangeProps } from "../types";
7
- export declare type TextInputVariant = "standard" | "loading" | "warning" | "error" | "modified" | "success";
7
+ export type TextInputVariant = "standard" | "loading" | "warning" | "error" | "modified" | "success";
8
8
  interface ExtraContent {
9
9
  /** React node to put to the left. Left icon is ignored if this is set. */
10
10
  contentLeft?: React.ReactNode;
@@ -1,7 +1,7 @@
1
1
  import { ChangeEvent } from "react";
2
- export declare type FullOnChangeProps<TValue, TEvent extends ChangeEvent> = ValueProps<TValue> & OnChangeProps<TEvent> & OnValueChangeProps<TValue>;
3
- export declare type ValueAndOnChangeProps<TValue, TEvent extends ChangeEvent> = ValueProps<TValue> & OnChangeProps<TEvent>;
4
- export declare type ValueAndOnValueChangeProps<TValue> = ValueProps<TValue> & OnValueChangeProps<TValue>;
2
+ export type FullOnChangeProps<TValue, TEvent extends ChangeEvent> = ValueProps<TValue> & OnChangeProps<TEvent> & OnValueChangeProps<TValue>;
3
+ export type ValueAndOnChangeProps<TValue, TEvent extends ChangeEvent> = ValueProps<TValue> & OnChangeProps<TEvent>;
4
+ export type ValueAndOnValueChangeProps<TValue> = ValueProps<TValue> & OnValueChangeProps<TValue>;
5
5
  interface ValueProps<TValue> {
6
6
  /** The value of the input. */
7
7
  value?: TValue;
@@ -1,6 +1,6 @@
1
1
  import { FocusEventHandler, KeyboardEventHandler, RefObject } from "react";
2
- export declare type MoveDirection = "right" | "left" | "down" | "up";
3
- export declare type TextInputElement = HTMLTextAreaElement | HTMLInputElement;
2
+ export type MoveDirection = "right" | "left" | "down" | "up";
3
+ export type TextInputElement = HTMLTextAreaElement | HTMLInputElement;
4
4
  export declare const useKeyboardNavigation: <TElement extends TextInputElement>(ref: RefObject<TElement>, onKeyDown: KeyboardEventHandler<TElement> | undefined, onEnter: (() => void) | undefined, onEsc: (() => void) | undefined, onMove: ((direction: MoveDirection) => void) | undefined, onDone: ((value: string) => void) | undefined, onBlur: FocusEventHandler<TElement> | undefined, onFocus: FocusEventHandler<TElement> | undefined) => {
5
5
  onKeyDownHandler: KeyboardEventHandler<TElement>;
6
6
  onBlurHandler: FocusEventHandler<TElement>;