@koobiq/react-components 0.7.1 → 0.9.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.
- package/dist/components/Alert/Alert.js +5 -3
- package/dist/components/Alert/types.d.ts +0 -3
- package/dist/components/Backdrop/Backdrop.js +1 -1
- package/dist/components/Backdrop/types.d.ts +4 -1
- package/dist/components/Button/Button.js +7 -7
- package/dist/components/Button/types.d.ts +0 -4
- package/dist/components/ButtonToggleGroup/ButtonToggleGroup.js +6 -6
- package/dist/components/ButtonToggleGroup/components/ButtonToggle/ButtonToggle.js +6 -6
- package/dist/components/ButtonToggleGroup/components/ButtonToggle/types.d.ts +0 -1
- package/dist/components/ButtonToggleGroup/types.d.ts +0 -3
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Checkbox/Checkbox.js +6 -6
- package/dist/components/Checkbox/types.d.ts +0 -5
- package/dist/components/Container/Container.js +2 -2
- package/dist/components/Container/types.d.ts +0 -2
- package/dist/components/DateInput/DateInput.js +27 -17
- package/dist/components/DateInput/types.d.ts +20 -6
- package/dist/components/DateInput/types.js +5 -0
- package/dist/components/DatePicker/DatePicker.js +5 -1
- package/dist/components/DatePicker/types.d.ts +14 -3
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -2
- package/dist/components/Dialog/types.d.ts +0 -1
- package/dist/components/Divider/Divider.js +5 -4
- package/dist/components/Divider/types.d.ts +0 -2
- package/dist/components/FieldComponents/Field/Field.d.ts +4 -0
- package/dist/components/FieldComponents/Field/Field.js +10 -0
- package/dist/components/FieldComponents/Field/Field.module.css.js +8 -0
- package/dist/components/FieldComponents/Field/index.d.ts +2 -0
- package/dist/components/FieldComponents/Field/types.d.ts +4 -0
- package/dist/components/FieldComponents/FieldAddon/FieldAddon.js +4 -4
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.js +2 -2
- package/dist/components/FieldComponents/FieldError/FieldError.d.ts +4 -2
- package/dist/components/FieldComponents/FieldError/FieldError.js +6 -8
- package/dist/components/FieldComponents/FieldInput/FieldInput.js +3 -3
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +2 -2
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +3 -3
- package/dist/components/FieldComponents/index.d.ts +1 -2
- package/dist/components/FormControl/FormControl.d.ts +4 -0
- package/dist/components/FormControl/FormControl.js +33 -0
- package/dist/components/FormControl/FormControl.module.css.js +17 -0
- package/dist/components/FormControl/index.d.ts +2 -0
- package/dist/components/FormControl/types.d.ts +19 -0
- package/dist/components/FormControl/types.js +6 -0
- package/dist/components/FormControlLabel/FormControlLabel.d.ts +4 -2
- package/dist/components/{FieldComponents/FieldLabel/FieldLabel.js → FormControlLabel/FormControlLabel.js} +7 -7
- package/dist/components/FormControlLabel/FormControlLabel.module.css.js +14 -0
- package/dist/components/FormControlLabel/types.d.ts +6 -31
- package/dist/components/IconButton/IconButton.js +4 -4
- package/dist/components/IconButton/types.d.ts +0 -3
- package/dist/components/Input/Input.d.ts +8 -5
- package/dist/components/Input/Input.js +25 -15
- package/dist/components/Input/Input.module.css.js +4 -0
- package/dist/components/Input/types.d.ts +20 -13
- package/dist/components/Input/types.js +5 -0
- package/dist/components/InputNumber/InputNumber.d.ts +8 -5
- package/dist/components/InputNumber/InputNumber.js +21 -15
- package/dist/components/InputNumber/types.d.ts +19 -12
- package/dist/components/InputNumber/types.js +5 -0
- package/dist/components/Link/Link.js +3 -3
- package/dist/components/Link/types.d.ts +0 -5
- package/dist/components/List/components/ListOption/ListOption.js +5 -5
- package/dist/components/List/components/ListSection/ListSection.js +1 -1
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/types.d.ts +1 -5
- package/dist/components/Popover/PopoverInner.js +2 -2
- package/dist/components/Popover/types.d.ts +0 -4
- package/dist/components/RadioGroup/RadioGroup.js +73 -23
- package/dist/components/RadioGroup/RadioGroup.module.css.js +8 -0
- package/dist/components/RadioGroup/components/Radio/Radio.d.ts +1 -1
- package/dist/components/RadioGroup/components/Radio/types.d.ts +0 -1
- package/dist/components/RadioGroup/components/index.d.ts +0 -2
- package/dist/components/RadioGroup/types.d.ts +38 -10
- package/dist/components/RadioGroup/types.js +5 -0
- package/dist/components/SearchInput/SearchInput.d.ts +8 -5
- package/dist/components/SearchInput/SearchInput.js +26 -19
- package/dist/components/SearchInput/types.d.ts +20 -8
- package/dist/components/SearchInput/types.js +5 -0
- package/dist/components/Select/Select.js +30 -26
- package/dist/components/Select/Select.module.css.js +0 -6
- package/dist/components/Select/components/SelectOption/SelectOption.js +5 -5
- package/dist/components/Select/types.d.ts +22 -8
- package/dist/components/Select/types.js +5 -0
- package/dist/components/SidePanel/SidePanel.js +1 -1
- package/dist/components/SidePanel/types.d.ts +0 -5
- package/dist/components/Table/Table.js +4 -4
- package/dist/components/Table/components/TableRow/TableRow.js +5 -5
- package/dist/components/Table/types.d.ts +0 -2
- package/dist/components/TagGroup/components/Tag/Tag.js +6 -6
- package/dist/components/Textarea/Textarea.d.ts +4 -3
- package/dist/components/Textarea/Textarea.js +13 -10
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +10 -10
- package/dist/components/Textarea/types.d.ts +19 -12
- package/dist/components/Textarea/types.js +5 -0
- package/dist/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/components/TimePicker/TimePicker.js +34 -24
- package/dist/components/TimePicker/types.d.ts +19 -5
- package/dist/components/TimePicker/types.js +7 -0
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Toggle/Toggle.js +3 -3
- package/dist/components/Toggle/types.d.ts +0 -3
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.js +9 -9
- package/dist/components/Tooltip/types.d.ts +0 -3
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +31 -11
- package/dist/style.css +103 -80
- package/package.json +5 -5
- package/dist/components/FieldComponents/FieldControl/FieldControl.d.ts +0 -8
- package/dist/components/FieldComponents/FieldControl/FieldControl.js +0 -17
- package/dist/components/FieldComponents/FieldControl/FieldControl.module.css.js +0 -11
- package/dist/components/FieldComponents/FieldControl/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldLabel/FieldLabel.d.ts +0 -9
- package/dist/components/FieldComponents/FieldLabel/FieldLabel.module.css.js +0 -14
- package/dist/components/FieldComponents/FieldLabel/index.d.ts +0 -1
- package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.d.ts +0 -7
- package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.js +0 -21
- package/dist/components/RadioGroup/components/RadioGroupDescription/index.d.ts +0 -1
- package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.d.ts +0 -6
- package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.js +0 -14
- package/dist/components/RadioGroup/components/RadioGroupLabel/index.d.ts +0 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
|
+
import s from "./Field.module.css.js";
|
|
4
|
+
const Field = polymorphicForwardRef(
|
|
5
|
+
({ as: Tag = "div", className, ...other }, ref) => /* @__PURE__ */ jsx(Tag, { className: clsx(s.base, className), ...other, ref })
|
|
6
|
+
);
|
|
7
|
+
Field.displayName = "Field";
|
|
8
|
+
export {
|
|
9
|
+
Field
|
|
10
|
+
};
|
|
@@ -5,8 +5,8 @@ import s from "./FieldAddon.module.css.js";
|
|
|
5
5
|
const FieldAddon = forwardRef(
|
|
6
6
|
({
|
|
7
7
|
placement = "start",
|
|
8
|
-
isInvalid
|
|
9
|
-
isDisabled
|
|
8
|
+
isInvalid,
|
|
9
|
+
isDisabled,
|
|
10
10
|
className,
|
|
11
11
|
children,
|
|
12
12
|
...other
|
|
@@ -21,8 +21,8 @@ const FieldAddon = forwardRef(
|
|
|
21
21
|
className
|
|
22
22
|
),
|
|
23
23
|
"data-placement": placement,
|
|
24
|
-
"data-invalid": isInvalid,
|
|
25
|
-
"data-disabled": isDisabled,
|
|
24
|
+
"data-invalid": isInvalid || void 0,
|
|
25
|
+
"data-disabled": isDisabled || void 0,
|
|
26
26
|
"data-testid": `field-addon-${placement}`,
|
|
27
27
|
...other,
|
|
28
28
|
ref,
|
|
@@ -7,8 +7,8 @@ import { FieldContentGroupContext } from "./FieldContentGroupContext.js";
|
|
|
7
7
|
import { FieldAddon } from "../FieldAddon/FieldAddon.js";
|
|
8
8
|
const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
9
9
|
variant = "filled",
|
|
10
|
-
isInvalid
|
|
11
|
-
isDisabled
|
|
10
|
+
isInvalid,
|
|
11
|
+
isDisabled,
|
|
12
12
|
children,
|
|
13
13
|
className,
|
|
14
14
|
startAddon,
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ValidationResult } from '@koobiq/react-core';
|
|
1
3
|
import { type TextProps, type TextRef } from '@koobiq/react-primitives';
|
|
2
|
-
export type FieldErrorProps = TextProps & {
|
|
3
|
-
|
|
4
|
+
export type FieldErrorProps = Omit<TextProps, 'children'> & {
|
|
5
|
+
children?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
4
6
|
};
|
|
5
7
|
export type FieldErrorRef = TextRef;
|
|
6
8
|
export declare const FieldError: import("react").ForwardRefExoticComponent<Omit<FieldErrorProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { clsx } from "@koobiq/react-core";
|
|
4
|
+
import { FieldError as FieldError$1 } from "@koobiq/react-primitives";
|
|
5
5
|
import s from "./FieldError.module.css.js";
|
|
6
6
|
const FieldError = forwardRef(
|
|
7
|
-
({
|
|
8
|
-
|
|
7
|
+
({ className, ...other }, ref) => /* @__PURE__ */ jsx(
|
|
8
|
+
FieldError$1,
|
|
9
9
|
{
|
|
10
10
|
className: clsx(s.base, className),
|
|
11
|
-
slot: "errorMessage",
|
|
12
11
|
...other,
|
|
13
|
-
ref
|
|
14
|
-
children
|
|
12
|
+
ref
|
|
15
13
|
}
|
|
16
|
-
)
|
|
14
|
+
)
|
|
17
15
|
);
|
|
18
16
|
FieldError.displayName = "FieldError";
|
|
19
17
|
export {
|
|
@@ -4,10 +4,10 @@ import { Input, Textarea } from "@koobiq/react-primitives";
|
|
|
4
4
|
import s from "./FieldInput.module.css.js";
|
|
5
5
|
const FieldInput = polymorphicForwardRef(
|
|
6
6
|
({
|
|
7
|
-
isInvalid = false,
|
|
8
|
-
as = "input",
|
|
9
|
-
isDisabled = false,
|
|
10
7
|
variant = "filled",
|
|
8
|
+
as = "input",
|
|
9
|
+
isInvalid,
|
|
10
|
+
isDisabled,
|
|
11
11
|
className,
|
|
12
12
|
...other
|
|
13
13
|
}, ref) => {
|
|
@@ -4,9 +4,9 @@ import { clsx } from "@koobiq/react-core";
|
|
|
4
4
|
import s from "./FieldInputDate.module.css.js";
|
|
5
5
|
const FieldInputDate = forwardRef(
|
|
6
6
|
({
|
|
7
|
-
isInvalid = false,
|
|
8
|
-
isDisabled = false,
|
|
9
7
|
variant = "filled",
|
|
8
|
+
isInvalid,
|
|
9
|
+
isDisabled,
|
|
10
10
|
children,
|
|
11
11
|
className,
|
|
12
12
|
...other
|
|
@@ -5,10 +5,10 @@ import s from "./FieldSelect.module.css.js";
|
|
|
5
5
|
import { isPrimitiveNode } from "./utils.js";
|
|
6
6
|
const FieldSelect = polymorphicForwardRef(
|
|
7
7
|
({
|
|
8
|
-
as = "div",
|
|
9
|
-
isInvalid = false,
|
|
10
|
-
isDisabled = false,
|
|
11
8
|
variant = "filled",
|
|
9
|
+
as = "div",
|
|
10
|
+
isInvalid,
|
|
11
|
+
isDisabled,
|
|
12
12
|
placeholder,
|
|
13
13
|
children,
|
|
14
14
|
className,
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { FormControlBaseProps } from './types';
|
|
3
|
+
export declare const FormControl: import("@koobiq/react-core").PolyForwardComponent<"div", FormControlBaseProps, ElementType>;
|
|
4
|
+
export type FormControlProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormControl<As>>;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
|
+
import s from "./FormControl.module.css.js";
|
|
4
|
+
const FormControl = polymorphicForwardRef(
|
|
5
|
+
({
|
|
6
|
+
labelPlacement = "top",
|
|
7
|
+
labelAlign = "start",
|
|
8
|
+
as: Tag = "div",
|
|
9
|
+
fullWidth,
|
|
10
|
+
className,
|
|
11
|
+
...other
|
|
12
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
13
|
+
Tag,
|
|
14
|
+
{
|
|
15
|
+
className: clsx(
|
|
16
|
+
s.base,
|
|
17
|
+
className,
|
|
18
|
+
s[labelAlign],
|
|
19
|
+
s[labelPlacement],
|
|
20
|
+
fullWidth && s.fullWidth
|
|
21
|
+
),
|
|
22
|
+
"data-label-align": labelAlign,
|
|
23
|
+
"data-label-placement": labelPlacement,
|
|
24
|
+
"data-fullwidth": fullWidth || void 0,
|
|
25
|
+
...other,
|
|
26
|
+
ref
|
|
27
|
+
}
|
|
28
|
+
)
|
|
29
|
+
);
|
|
30
|
+
FormControl.displayName = "FormControl";
|
|
31
|
+
export {
|
|
32
|
+
FormControl
|
|
33
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const base = "kbq-formcontrol-dbb0e4";
|
|
2
|
+
const fullWidth = "kbq-formcontrol-fullWidth-b3e32c";
|
|
3
|
+
const top = "kbq-formcontrol-top-17ba41";
|
|
4
|
+
const side = "kbq-formcontrol-side-3e528f";
|
|
5
|
+
const s = {
|
|
6
|
+
base,
|
|
7
|
+
fullWidth,
|
|
8
|
+
top,
|
|
9
|
+
side
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
base,
|
|
13
|
+
s as default,
|
|
14
|
+
fullWidth,
|
|
15
|
+
side,
|
|
16
|
+
top
|
|
17
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { DataAttributeProps } from '@koobiq/react-core';
|
|
2
|
+
export declare const formControlPropLabelPlacement: readonly ["top", "side"];
|
|
3
|
+
export type FormControlPropLabelPlacement = (typeof formControlPropLabelPlacement)[number];
|
|
4
|
+
export declare const formControlPropLabelAlign: readonly ["start", "end"];
|
|
5
|
+
export type FormControlPropLabelAlign = (typeof formControlPropLabelAlign)[number];
|
|
6
|
+
export type FormControlBaseProps = {
|
|
7
|
+
fullWidth?: boolean;
|
|
8
|
+
className?: string;
|
|
9
|
+
/**
|
|
10
|
+
* The label's overall position relative to the element it is labeling.
|
|
11
|
+
* @default 'top'
|
|
12
|
+
*/
|
|
13
|
+
labelPlacement?: FormControlPropLabelPlacement;
|
|
14
|
+
/**
|
|
15
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
16
|
+
* @default 'start'
|
|
17
|
+
*/
|
|
18
|
+
labelAlign?: FormControlPropLabelAlign;
|
|
19
|
+
} & DataAttributeProps;
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { FormControlLabelBaseProps } from './types';
|
|
3
|
+
export declare const FormControlLabel: import("@koobiq/react-core").PolyForwardComponent<"label", FormControlLabelBaseProps, ElementType>;
|
|
4
|
+
export type FormControlLabelProps<As extends ElementType = 'label'> = ComponentPropsWithRef<typeof FormControlLabel<As>>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
3
|
-
import { isNotNil, clsx } from "@koobiq/react-core";
|
|
2
|
+
import { polymorphicForwardRef, isNotNil, clsx } from "@koobiq/react-core";
|
|
4
3
|
import { Label } from "@koobiq/react-primitives";
|
|
5
|
-
import s from "./
|
|
6
|
-
const
|
|
7
|
-
({ children, className, isHidden
|
|
4
|
+
import s from "./FormControlLabel.module.css.js";
|
|
5
|
+
const FormControlLabel = polymorphicForwardRef(
|
|
6
|
+
({ children, className, isHidden, isRequired, as = "label", ...other }, ref) => isNotNil(children) ? /* @__PURE__ */ jsxs(
|
|
8
7
|
Label,
|
|
9
8
|
{
|
|
9
|
+
as,
|
|
10
10
|
className: clsx(s.base, isHidden && s.hidden, className),
|
|
11
11
|
...other,
|
|
12
12
|
ref,
|
|
@@ -20,7 +20,7 @@ const FieldLabel = forwardRef(
|
|
|
20
20
|
}
|
|
21
21
|
) : null
|
|
22
22
|
);
|
|
23
|
-
|
|
23
|
+
FormControlLabel.displayName = "FormControlLabel";
|
|
24
24
|
export {
|
|
25
|
-
|
|
25
|
+
FormControlLabel
|
|
26
26
|
};
|
|
@@ -1,32 +1,7 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
export type FormControlLabelPropLabelPlacement = (typeof formControlLabelPlacement)[number];
|
|
7
|
-
export type FormControlLabelProps = ExtendableComponentPropsWithRef<{
|
|
8
|
-
/** The content to display as the label. */
|
|
9
|
-
label?: ReactNode;
|
|
10
|
-
/**
|
|
11
|
-
* If `true`, the component is disabled.
|
|
12
|
-
* @default false
|
|
13
|
-
*/
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
/** The helper text content. */
|
|
16
|
-
caption?: ReactNode;
|
|
17
|
-
/** The content of the component. */
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
export type FormControlLabelBaseProps = {
|
|
3
|
+
isHidden?: boolean;
|
|
4
|
+
className?: string;
|
|
5
|
+
isRequired?: boolean;
|
|
18
6
|
children?: ReactNode;
|
|
19
|
-
|
|
20
|
-
* Size.
|
|
21
|
-
* @default 'normal'
|
|
22
|
-
*/
|
|
23
|
-
size?: FormControlLabelPropSize;
|
|
24
|
-
/**
|
|
25
|
-
* The position of the label.
|
|
26
|
-
* @default 'end'
|
|
27
|
-
*/
|
|
28
|
-
labelPlacement?: FormControlLabelPropLabelPlacement;
|
|
29
|
-
slotProps?: {
|
|
30
|
-
content?: ComponentPropsWithRef<'div'>;
|
|
31
|
-
};
|
|
32
|
-
}, 'label'>;
|
|
7
|
+
};
|
|
@@ -18,8 +18,8 @@ const IconButton = polymorphicForwardRef(
|
|
|
18
18
|
className,
|
|
19
19
|
...other
|
|
20
20
|
} = props;
|
|
21
|
-
const isCompact = isCompactProp ?? compact
|
|
22
|
-
const isDisabled = isDisabledProp ?? disabled
|
|
21
|
+
const isCompact = isCompactProp ?? compact;
|
|
22
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
23
23
|
if (process.env.NODE_ENV !== "production" && "compact" in props) {
|
|
24
24
|
deprecate(
|
|
25
25
|
'IconButton: the "compact" prop is deprecated. Use "isCompact" prop to replace it.'
|
|
@@ -54,9 +54,9 @@ const IconButton = polymorphicForwardRef(
|
|
|
54
54
|
as: Tag,
|
|
55
55
|
isDisabled,
|
|
56
56
|
className: classNameFn,
|
|
57
|
-
"data-compact": isCompact,
|
|
58
|
-
"data-variant": variant,
|
|
59
57
|
"data-size": size,
|
|
58
|
+
"data-variant": variant,
|
|
59
|
+
"data-compact": isCompact || void 0,
|
|
60
60
|
...other,
|
|
61
61
|
ref,
|
|
62
62
|
children
|
|
@@ -8,14 +8,12 @@ export type IconButtonPropSize = (typeof iconButtonPropSize)[number];
|
|
|
8
8
|
type IconButtonBaseDeprecatedProps = {
|
|
9
9
|
/**
|
|
10
10
|
* If `true`, the component is disabled.
|
|
11
|
-
* @default false
|
|
12
11
|
* @deprecated
|
|
13
12
|
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
14
13
|
*/
|
|
15
14
|
disabled?: boolean;
|
|
16
15
|
/**
|
|
17
16
|
* If `true`, reduce the size of the component canvas.
|
|
18
|
-
* @default false
|
|
19
17
|
* @deprecated
|
|
20
18
|
* The "compact" prop is deprecated. Use "isCompact" prop to replace it.
|
|
21
19
|
*/
|
|
@@ -36,7 +34,6 @@ export type IconButtonBaseProps = ExtendableProps<{
|
|
|
36
34
|
size?: IconButtonPropSize;
|
|
37
35
|
/**
|
|
38
36
|
* If `true`, reduce the size of the component canvas.
|
|
39
|
-
* @default false
|
|
40
37
|
*/
|
|
41
38
|
isCompact?: boolean;
|
|
42
39
|
/** Additional CSS-classes. */
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { TextField } from '@koobiq/react-primitives';
|
|
2
|
-
import { type
|
|
3
|
-
|
|
2
|
+
import { type FieldContentGroupProps, type FieldCaptionProps, type FieldInputProps, type FieldErrorProps } from '../FieldComponents';
|
|
3
|
+
import { type FormControlProps } from '../FormControl';
|
|
4
|
+
import { type FormControlLabelProps } from '../FormControlLabel';
|
|
5
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "validationState" | "description" | "inputElementType">, "caption" | "style" | "className" | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "data-testid" | "startAddon" | "endAddon" | "isLabelHidden" | keyof {
|
|
4
6
|
disabled?: boolean;
|
|
5
7
|
error?: boolean;
|
|
6
8
|
required?: boolean;
|
|
@@ -11,15 +13,16 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
|
11
13
|
startAddon?: import("react").ReactNode;
|
|
12
14
|
endAddon?: import("react").ReactNode;
|
|
13
15
|
variant?: import("./types").InputPropVariant;
|
|
14
|
-
errorMessage?: import("react").ReactNode;
|
|
15
16
|
fullWidth?: boolean;
|
|
16
17
|
isLabelHidden?: boolean;
|
|
18
|
+
labelPlacement?: import("./types").InputPropLabelPlacement;
|
|
19
|
+
labelAlign?: import("./types").InputPropLabelAlign;
|
|
17
20
|
caption?: import("react").ReactNode;
|
|
18
21
|
style?: import("react").CSSProperties;
|
|
19
22
|
'data-testid'?: string | number;
|
|
20
23
|
slotProps?: {
|
|
21
|
-
root?:
|
|
22
|
-
label?:
|
|
24
|
+
root?: FormControlProps<typeof TextField<HTMLInputElement>>;
|
|
25
|
+
label?: FormControlLabelProps;
|
|
23
26
|
caption?: FieldCaptionProps;
|
|
24
27
|
group?: FieldContentGroupProps;
|
|
25
28
|
errorMessage?: FieldErrorProps;
|
|
@@ -4,8 +4,10 @@ import { forwardRef } from "react";
|
|
|
4
4
|
import { deprecate } from "@koobiq/logger";
|
|
5
5
|
import { useDOMRef, mergeProps } from "@koobiq/react-core";
|
|
6
6
|
import { TextField } from "@koobiq/react-primitives";
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
7
|
+
import s from "./Input.module.css.js";
|
|
8
|
+
import { FormControl } from "../FormControl/FormControl.js";
|
|
9
|
+
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
10
|
+
import { Field } from "../FieldComponents/Field/Field.js";
|
|
9
11
|
import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
|
|
10
12
|
import { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
|
|
11
13
|
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
@@ -13,7 +15,7 @@ import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
|
|
|
13
15
|
const Input = forwardRef((props, ref) => {
|
|
14
16
|
const {
|
|
15
17
|
variant = "filled",
|
|
16
|
-
fullWidth
|
|
18
|
+
fullWidth,
|
|
17
19
|
hiddenLabel,
|
|
18
20
|
isLabelHidden: isLabelHiddenProp,
|
|
19
21
|
disabled,
|
|
@@ -24,6 +26,8 @@ const Input = forwardRef((props, ref) => {
|
|
|
24
26
|
isRequired: isRequiredProp,
|
|
25
27
|
readonly,
|
|
26
28
|
isReadOnly: isReadOnlyProp,
|
|
29
|
+
labelPlacement,
|
|
30
|
+
labelAlign,
|
|
27
31
|
label,
|
|
28
32
|
startAddon,
|
|
29
33
|
endAddon,
|
|
@@ -32,11 +36,11 @@ const Input = forwardRef((props, ref) => {
|
|
|
32
36
|
caption,
|
|
33
37
|
...other
|
|
34
38
|
} = props;
|
|
35
|
-
const isDisabled = isDisabledProp ?? disabled
|
|
36
|
-
const isRequired = isRequiredProp ?? required
|
|
37
|
-
const isReadOnly = isReadOnlyProp ?? readonly
|
|
38
|
-
const isInvalid = isInvalidProp ?? error
|
|
39
|
-
const isLabelHidden = isLabelHiddenProp ?? hiddenLabel
|
|
39
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
40
|
+
const isRequired = isRequiredProp ?? required;
|
|
41
|
+
const isReadOnly = isReadOnlyProp ?? readonly;
|
|
42
|
+
const isInvalid = isInvalidProp ?? error;
|
|
43
|
+
const isLabelHidden = isLabelHiddenProp ?? hiddenLabel;
|
|
40
44
|
if (process.env.NODE_ENV !== "production" && "disabled" in props) {
|
|
41
45
|
deprecate(
|
|
42
46
|
'Input: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
|
|
@@ -72,13 +76,14 @@ const Input = forwardRef((props, ref) => {
|
|
|
72
76
|
isReadOnly,
|
|
73
77
|
isInvalid,
|
|
74
78
|
errorMessage,
|
|
79
|
+
labelPlacement,
|
|
80
|
+
labelAlign,
|
|
75
81
|
"data-variant": variant,
|
|
76
|
-
"data-fullwidth": fullWidth,
|
|
77
82
|
...other
|
|
78
83
|
},
|
|
79
84
|
slotProps?.root
|
|
80
85
|
);
|
|
81
|
-
return /* @__PURE__ */ jsx(
|
|
86
|
+
return /* @__PURE__ */ jsx(FormControl, { as: TextField, inputElementType: "input", ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
|
|
82
87
|
const labelProps = mergeProps(
|
|
83
88
|
{ isHidden: isLabelHidden, isRequired: isRequired2, children: label },
|
|
84
89
|
slotProps?.label
|
|
@@ -103,12 +108,17 @@ const Input = forwardRef((props, ref) => {
|
|
|
103
108
|
slotProps?.group
|
|
104
109
|
);
|
|
105
110
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
106
|
-
const errorProps = mergeProps(
|
|
111
|
+
const errorProps = mergeProps(
|
|
112
|
+
{ children: errorMessage, className: s.error },
|
|
113
|
+
slotProps?.errorMessage
|
|
114
|
+
);
|
|
107
115
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
108
|
-
/* @__PURE__ */ jsx(
|
|
109
|
-
/* @__PURE__ */
|
|
110
|
-
|
|
111
|
-
|
|
116
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
|
|
117
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
119
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
120
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
121
|
+
] })
|
|
112
122
|
] });
|
|
113
123
|
} });
|
|
114
124
|
});
|
|
@@ -1,41 +1,42 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { TextField, TextFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type
|
|
4
|
+
import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldContentGroupProps, type FieldContentGroupPropVariant } from '../FieldComponents';
|
|
5
|
+
import { type FormControlProps, type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
|
|
6
|
+
import type { FormControlLabelProps } from '../FormControlLabel';
|
|
5
7
|
export declare const inputPropVariant: readonly ["filled", "transparent"];
|
|
8
|
+
export declare const inputPropLabelPlacement: readonly ["top", "side"];
|
|
6
9
|
export type InputPropVariant = FieldContentGroupPropVariant;
|
|
10
|
+
export type InputPropLabelPlacement = FormControlPropLabelPlacement;
|
|
11
|
+
export declare const inputPropLabelAlign: readonly ["start", "end"];
|
|
12
|
+
export type InputPropLabelAlign = FormControlPropLabelAlign;
|
|
7
13
|
type InputDeprecatedProps = {
|
|
8
14
|
/**
|
|
9
15
|
* If `true`, the component is disabled.
|
|
10
|
-
* @default false
|
|
11
16
|
* @deprecated
|
|
12
17
|
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
13
18
|
*/
|
|
14
19
|
disabled?: boolean;
|
|
15
20
|
/**
|
|
16
21
|
* If `true`, the input will indicate an error.
|
|
17
|
-
* @default false
|
|
18
22
|
* @deprecated
|
|
19
23
|
* The "error" prop is deprecated. Use "isInvalid" prop to replace it.
|
|
20
24
|
*/
|
|
21
25
|
error?: boolean;
|
|
22
26
|
/**
|
|
23
27
|
* If `true`, the label is displayed as required and the input element is required.
|
|
24
|
-
* @default false
|
|
25
28
|
* @deprecated
|
|
26
29
|
* The "required" prop is deprecated. Use "isRequired" prop to replace it.
|
|
27
30
|
*/
|
|
28
31
|
required?: boolean;
|
|
29
32
|
/**
|
|
30
33
|
* If `true`, the input can be selected but not changed by the user.
|
|
31
|
-
* @default false
|
|
32
34
|
* @deprecated
|
|
33
35
|
* The "readonly" prop is deprecated. Use "isReadOnly" prop to replace it.
|
|
34
36
|
*/
|
|
35
37
|
readonly?: boolean;
|
|
36
38
|
/**
|
|
37
39
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
38
|
-
* @default false
|
|
39
40
|
* @deprecated
|
|
40
41
|
* The "hiddenLabel" prop is deprecated. Use "isLabelHidden" prop to replace it.
|
|
41
42
|
*/
|
|
@@ -53,18 +54,24 @@ export type InputProps = ExtendableProps<{
|
|
|
53
54
|
* @default 'filled'
|
|
54
55
|
*/
|
|
55
56
|
variant?: InputPropVariant;
|
|
56
|
-
/** An error message for the field. */
|
|
57
|
-
errorMessage?: ReactNode;
|
|
58
57
|
/**
|
|
59
58
|
* If true, the input will take up the full width of its container.
|
|
60
|
-
* @default false
|
|
61
59
|
*/
|
|
62
60
|
fullWidth?: boolean;
|
|
63
61
|
/**
|
|
64
62
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
65
|
-
* @default false
|
|
66
63
|
*/
|
|
67
64
|
isLabelHidden?: boolean;
|
|
65
|
+
/**
|
|
66
|
+
* The label's overall position relative to the element it is labeling.
|
|
67
|
+
* @default 'top'
|
|
68
|
+
*/
|
|
69
|
+
labelPlacement?: InputPropLabelPlacement;
|
|
70
|
+
/**
|
|
71
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
72
|
+
* @default 'start'
|
|
73
|
+
*/
|
|
74
|
+
labelAlign?: InputPropLabelAlign;
|
|
68
75
|
/** The helper text content. */
|
|
69
76
|
caption?: ReactNode;
|
|
70
77
|
/** Inline styles. */
|
|
@@ -73,13 +80,13 @@ export type InputProps = ExtendableProps<{
|
|
|
73
80
|
'data-testid'?: string | number;
|
|
74
81
|
/** The props used for each slot inside. */
|
|
75
82
|
slotProps?: {
|
|
76
|
-
root?:
|
|
77
|
-
label?:
|
|
83
|
+
root?: FormControlProps<typeof TextField<HTMLInputElement>>;
|
|
84
|
+
label?: FormControlLabelProps;
|
|
78
85
|
caption?: FieldCaptionProps;
|
|
79
86
|
group?: FieldContentGroupProps;
|
|
80
87
|
errorMessage?: FieldErrorProps;
|
|
81
88
|
input?: FieldInputProps;
|
|
82
89
|
};
|
|
83
|
-
} & InputDeprecatedProps, Omit<TextFieldProps<HTMLInputElement>, 'description' | '
|
|
90
|
+
} & InputDeprecatedProps, Omit<TextFieldProps<HTMLInputElement>, 'description' | 'children' | 'inputElementType' | 'validationState'>>;
|
|
84
91
|
export type InputRef = ComponentRef<'input'>;
|
|
85
92
|
export {};
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
|
|
2
|
+
import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
|
|
2
3
|
const inputPropVariant = fieldContentGroupPropVariant;
|
|
4
|
+
const inputPropLabelPlacement = formControlPropLabelPlacement;
|
|
5
|
+
const inputPropLabelAlign = formControlPropLabelAlign;
|
|
3
6
|
export {
|
|
7
|
+
inputPropLabelAlign,
|
|
8
|
+
inputPropLabelPlacement,
|
|
4
9
|
inputPropVariant
|
|
5
10
|
};
|