@koobiq/react-components 0.11.0 → 0.12.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/Button/Button.js +1 -1
- package/dist/components/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/Container/Container.js +13 -4
- package/dist/components/Container/types.d.ts +18 -3
- package/dist/components/Container/types.js +3 -1
- package/dist/components/DateInput/DateInput.js +36 -32
- package/dist/components/DateInput/DateInput.module.css.js +4 -1
- package/dist/components/DateInput/types.d.ts +10 -12
- package/dist/components/DateInput/types.js +5 -5
- package/dist/components/DatePicker/DatePicker.js +18 -2
- package/dist/components/DatePicker/types.d.ts +2 -2
- package/dist/components/Dialog/Dialog.js +2 -2
- package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -2
- package/dist/components/Form/Form.d.ts +9 -13
- package/dist/components/Form/Form.js +29 -32
- package/dist/components/Form/Form.module.css.js +19 -7
- package/dist/components/Form/FormContext.d.ts +5 -3
- package/dist/components/Form/components/FormActions/FormActions.d.ts +7 -0
- package/dist/components/Form/components/FormActions/FormActions.js +9 -0
- package/dist/components/Form/components/FormActions/index.d.ts +1 -0
- package/dist/components/Form/components/FormCaption/FormCaption.d.ts +16 -0
- package/dist/components/Form/components/FormCaption/FormCaption.js +17 -0
- package/dist/components/Form/components/FormCaption/index.d.ts +1 -0
- package/dist/components/Form/components/FormGroup/FormGroup.d.ts +7 -0
- package/dist/components/Form/components/FormGroup/FormGroup.js +9 -0
- package/dist/components/Form/components/FormGroup/index.d.ts +1 -0
- package/dist/components/Form/components/index.d.ts +3 -0
- package/dist/components/Form/types.d.ts +7 -3
- package/dist/components/Form/utils.js +12 -12
- package/dist/components/FormField/FormField.d.ts +22 -0
- package/dist/components/FormField/FormField.js +55 -0
- package/dist/components/FormField/FormField.module.css.js +17 -0
- package/dist/components/FormField/FormFieldAddon/FormFieldAddon.d.ts +10 -0
- package/dist/components/{FieldComponents/FieldAddon/FieldAddon.js → FormField/FormFieldAddon/FormFieldAddon.js} +9 -14
- package/dist/components/FormField/FormFieldAddon/FormFieldAddon.module.css.js +20 -0
- package/dist/components/FormField/FormFieldAddon/index.d.ts +1 -0
- package/dist/components/{FieldComponents/FieldCaption/FieldCaption.d.ts → FormField/FormFieldCaption/FormFieldCaption.d.ts} +3 -3
- package/dist/components/{FieldComponents/FieldCaption/FieldCaption.js → FormField/FormFieldCaption/FormFieldCaption.js} +4 -4
- package/dist/components/{FieldComponents/FieldError/FieldError.module.css.js → FormField/FormFieldCaption/FormFieldCaption.module.css.js} +1 -1
- package/dist/components/FormField/FormFieldCaption/index.d.ts +1 -0
- package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroup.d.ts +2 -0
- package/dist/components/{FieldComponents/FieldContentGroup/FieldContentGroup.js → FormField/FormFieldControlGroup/FormFieldControlGroup.js} +11 -29
- package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroup.module.css.js +23 -0
- package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroupContext.d.ts +10 -0
- package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroupContext.js +7 -0
- package/dist/components/FormField/FormFieldControlGroup/index.d.ts +3 -0
- package/dist/components/FormField/FormFieldControlGroup/types.d.ts +30 -0
- package/dist/components/FormField/FormFieldControlGroup/types.js +7 -0
- package/dist/components/FormField/FormFieldError/FormFieldError.d.ts +8 -0
- package/dist/components/FormField/FormFieldError/FormFieldError.js +17 -0
- package/dist/components/{FieldComponents/FieldCaption/FieldCaption.module.css.js → FormField/FormFieldError/FormFieldError.module.css.js} +1 -1
- package/dist/components/FormField/FormFieldError/index.d.ts +1 -0
- package/dist/components/FormField/FormFieldInput/FormFieldInput.d.ts +8 -0
- package/dist/components/FormField/FormFieldInput/FormFieldInput.js +12 -0
- package/dist/components/{FieldComponents/Field/Field.module.css.js → FormField/FormFieldInput/FormFieldInput.module.css.js} +1 -1
- package/dist/components/FormField/FormFieldInput/index.d.ts +1 -0
- package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.d.ts +8 -0
- package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.js +9 -0
- package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.module.css.js +8 -0
- package/dist/components/FormField/FormFieldInputDate/index.d.ts +1 -0
- package/dist/components/FormField/FormFieldLabel/FormFieldLabel.d.ts +4 -0
- package/dist/components/{FormControlLabel/FormControlLabel.js → FormField/FormFieldLabel/FormFieldLabel.js} +5 -4
- package/dist/components/FormField/FormFieldLabel/FormFieldLabel.module.css.js +14 -0
- package/dist/components/FormField/FormFieldLabel/index.d.ts +2 -0
- package/dist/components/{FormControlLabel → FormField/FormFieldLabel}/types.d.ts +1 -1
- package/dist/components/FormField/FormFieldSelect/FormFieldSelect.d.ts +4 -0
- package/dist/components/FormField/FormFieldSelect/FormFieldSelect.js +33 -0
- package/dist/components/FormField/FormFieldSelect/FormFieldSelect.module.css.js +20 -0
- package/dist/components/FormField/FormFieldSelect/index.d.ts +2 -0
- package/dist/components/FormField/FormFieldSelect/types.d.ts +7 -0
- package/dist/components/FormField/index.d.ts +9 -0
- package/dist/components/FormField/types.d.ts +19 -0
- package/dist/components/FormField/types.js +6 -0
- package/dist/components/Input/Input.d.ts +8 -10
- package/dist/components/Input/Input.js +22 -23
- package/dist/components/Input/Input.module.css.js +5 -1
- package/dist/components/Input/types.d.ts +10 -12
- package/dist/components/Input/types.js +5 -5
- package/dist/components/InputNumber/InputNumber.d.ts +8 -10
- package/dist/components/InputNumber/InputNumber.js +22 -22
- package/dist/components/InputNumber/InputNumber.module.css.js +8 -0
- package/dist/components/InputNumber/components/InputNumberCounterControls.js +2 -2
- package/dist/components/InputNumber/types.d.ts +10 -12
- package/dist/components/InputNumber/types.js +5 -5
- package/dist/components/List/components/ListSection/ListSection.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +14 -13
- package/dist/components/RadioGroup/RadioGroup.module.css.js +4 -1
- package/dist/components/RadioGroup/components/Radio/Radio.d.ts +1 -1
- package/dist/components/RadioGroup/types.d.ts +7 -9
- package/dist/components/RadioGroup/types.js +3 -3
- package/dist/components/SearchInput/SearchInput.d.ts +8 -10
- package/dist/components/SearchInput/SearchInput.js +39 -30
- package/dist/components/SearchInput/SearchInput.module.css.js +4 -1
- package/dist/components/SearchInput/types.d.ts +10 -12
- package/dist/components/SearchInput/types.js +5 -5
- package/dist/components/Select/Select.js +37 -28
- package/dist/components/Select/Select.module.css.js +4 -4
- package/dist/components/Select/components/TagGroup/TagGroupMultiline.js +2 -2
- package/dist/components/Select/components/TagGroup/TagGroupResponsive.js +2 -2
- package/dist/components/Select/types.d.ts +8 -10
- package/dist/components/Select/types.js +3 -3
- package/dist/components/Textarea/Textarea.d.ts +5 -5
- package/dist/components/Textarea/Textarea.js +6 -4
- package/dist/components/Textarea/Textarea.module.css.js +8 -2
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +24 -20
- package/dist/components/Textarea/types.d.ts +8 -10
- package/dist/components/Textarea/types.js +5 -5
- package/dist/components/TimePicker/TimePicker.js +37 -31
- package/dist/components/TimePicker/TimePicker.module.css.js +4 -1
- package/dist/components/TimePicker/types.d.ts +9 -11
- package/dist/components/TimePicker/types.js +3 -3
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/index.d.ts +1 -2
- package/dist/index.js +28 -12
- package/dist/style.css +442 -386
- package/package.json +5 -5
- package/dist/components/FieldComponents/Field/Field.d.ts +0 -4
- package/dist/components/FieldComponents/Field/Field.js +0 -10
- package/dist/components/FieldComponents/Field/index.d.ts +0 -2
- package/dist/components/FieldComponents/Field/types.d.ts +0 -4
- package/dist/components/FieldComponents/FieldAddon/FieldAddon.d.ts +0 -11
- package/dist/components/FieldComponents/FieldAddon/FieldAddon.module.css.js +0 -20
- package/dist/components/FieldComponents/FieldAddon/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldCaption/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.d.ts +0 -2
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.module.css.js +0 -29
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.d.ts +0 -10
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.js +0 -7
- package/dist/components/FieldComponents/FieldContentGroup/index.d.ts +0 -3
- package/dist/components/FieldComponents/FieldContentGroup/types.d.ts +0 -29
- package/dist/components/FieldComponents/FieldContentGroup/types.js +0 -4
- package/dist/components/FieldComponents/FieldError/FieldError.d.ts +0 -8
- package/dist/components/FieldComponents/FieldError/FieldError.js +0 -19
- package/dist/components/FieldComponents/FieldError/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldInput/FieldInput.d.ts +0 -12
- package/dist/components/FieldComponents/FieldInput/FieldInput.js +0 -34
- package/dist/components/FieldComponents/FieldInput/FieldInput.module.css.js +0 -20
- package/dist/components/FieldComponents/FieldInput/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.d.ts +0 -12
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +0 -32
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.module.css.js +0 -20
- package/dist/components/FieldComponents/FieldInputDate/index.d.ts +0 -1
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +0 -4
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +0 -45
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +0 -26
- package/dist/components/FieldComponents/FieldSelect/index.d.ts +0 -2
- package/dist/components/FieldComponents/FieldSelect/types.d.ts +0 -11
- package/dist/components/FieldComponents/index.d.ts +0 -8
- package/dist/components/FormControl/FormControl.d.ts +0 -4
- package/dist/components/FormControl/FormControl.js +0 -34
- package/dist/components/FormControl/FormControl.module.css.js +0 -17
- package/dist/components/FormControl/index.d.ts +0 -2
- package/dist/components/FormControl/types.d.ts +0 -19
- package/dist/components/FormControl/types.js +0 -6
- package/dist/components/FormControlLabel/FormControlLabel.d.ts +0 -4
- package/dist/components/FormControlLabel/FormControlLabel.module.css.js +0 -14
- package/dist/components/FormControlLabel/index.d.ts +0 -2
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
|
+
import s from "../../Form.module.css.js";
|
|
4
|
+
const FormGroup = polymorphicForwardRef(
|
|
5
|
+
({ className, as: Tag = "div", ...other }, ref) => /* @__PURE__ */ jsx(Tag, { className: clsx(s.group, className), ...other, ref })
|
|
6
|
+
);
|
|
7
|
+
export {
|
|
8
|
+
FormGroup
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormGroup';
|
|
@@ -1,22 +1,26 @@
|
|
|
1
1
|
import type { ComponentRef } from 'react';
|
|
2
2
|
import type { FormProps as FormPropsPrimitive } from '@koobiq/react-primitives';
|
|
3
3
|
import type { ResponsiveValue } from '../../utils';
|
|
4
|
-
import type {
|
|
4
|
+
import type { FormFieldPropLabelAlign, FormFieldPropLabelPlacement } from '../FormField';
|
|
5
5
|
export declare const formPropLabelInlineSize: readonly ["80", "128", "160", "200", "240", "280", "320", "360", "400", "1/4", "2/5", "1/2", "max-content"];
|
|
6
6
|
export type FormPropLabelInlineSize = (typeof formPropLabelInlineSize)[number];
|
|
7
7
|
export type FormProps = {
|
|
8
|
+
/** Whether the Form elements are disabled. */
|
|
9
|
+
isDisabled?: boolean;
|
|
10
|
+
/** Whether the Form elements can be selected but not changed by the user. */
|
|
11
|
+
isReadOnly?: boolean;
|
|
8
12
|
/**
|
|
9
13
|
* The label's overall position relative to the element it is labeling.
|
|
10
14
|
* Responsive values allowed.
|
|
11
15
|
* @default 'top'
|
|
12
16
|
*/
|
|
13
|
-
labelPlacement?:
|
|
17
|
+
labelPlacement?: FormFieldPropLabelPlacement | ResponsiveValue<FormFieldPropLabelPlacement>;
|
|
14
18
|
/**
|
|
15
19
|
* The label's horizontal alignment relative to the element it is labeling.
|
|
16
20
|
* Responsive values allowed.
|
|
17
21
|
* @default 'start'
|
|
18
22
|
*/
|
|
19
|
-
labelAlign?:
|
|
23
|
+
labelAlign?: FormFieldPropLabelAlign | ResponsiveValue<FormFieldPropLabelAlign>;
|
|
20
24
|
/**
|
|
21
25
|
* Size of the label column when `labelPlacement="side"`.
|
|
22
26
|
* Ignored for `"top"`.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
const templatePresets = {
|
|
2
2
|
"max-content": void 0,
|
|
3
|
-
"1/4": "
|
|
4
|
-
"2/5": "
|
|
5
|
-
"1/2": "
|
|
6
|
-
"80": "80px
|
|
7
|
-
"128": "128px
|
|
8
|
-
"160": "160px
|
|
9
|
-
"200": "200px
|
|
10
|
-
"240": "240px
|
|
11
|
-
"280": "280px
|
|
12
|
-
"320": "320px
|
|
13
|
-
"360": "360px
|
|
14
|
-
"400": "400px
|
|
3
|
+
"1/4": "25%",
|
|
4
|
+
"2/5": "40%",
|
|
5
|
+
"1/2": "50%",
|
|
6
|
+
"80": "80px",
|
|
7
|
+
"128": "128px",
|
|
8
|
+
"160": "160px",
|
|
9
|
+
"200": "200px",
|
|
10
|
+
"240": "240px",
|
|
11
|
+
"280": "280px",
|
|
12
|
+
"320": "320px",
|
|
13
|
+
"360": "360px",
|
|
14
|
+
"400": "400px"
|
|
15
15
|
};
|
|
16
16
|
export {
|
|
17
17
|
templatePresets
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import { FormFieldCaption } from './FormFieldCaption';
|
|
3
|
+
import { FormFieldControlGroup } from './FormFieldControlGroup';
|
|
4
|
+
import { FormFieldError } from './FormFieldError';
|
|
5
|
+
import { FormFieldInput } from './FormFieldInput';
|
|
6
|
+
import { FormFieldInputDate } from './FormFieldInputDate';
|
|
7
|
+
import { FormFieldLabel } from './FormFieldLabel';
|
|
8
|
+
import { FormFieldSelect } from './FormFieldSelect';
|
|
9
|
+
import type { FormFieldBaseProps } from './types';
|
|
10
|
+
export declare const FormFieldComponent: import("@koobiq/react-core").PolyForwardComponent<"div", FormFieldBaseProps, ElementType>;
|
|
11
|
+
type CompoundedComponent = typeof FormFieldComponent & {
|
|
12
|
+
Label: typeof FormFieldLabel;
|
|
13
|
+
Error: typeof FormFieldError;
|
|
14
|
+
Caption: typeof FormFieldCaption;
|
|
15
|
+
ControlGroup: typeof FormFieldControlGroup;
|
|
16
|
+
Input: typeof FormFieldInput;
|
|
17
|
+
InputDate: typeof FormFieldInputDate;
|
|
18
|
+
Select: typeof FormFieldSelect;
|
|
19
|
+
};
|
|
20
|
+
export declare const FormField: CompoundedComponent;
|
|
21
|
+
export type FormFieldProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormField<As>>;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
|
+
import s from "./FormField.module.css.js";
|
|
4
|
+
import { useForm } from "../Form/FormContext.js";
|
|
5
|
+
import { FormFieldLabel } from "./FormFieldLabel/FormFieldLabel.js";
|
|
6
|
+
import { FormFieldError } from "./FormFieldError/FormFieldError.js";
|
|
7
|
+
import { FormFieldCaption } from "./FormFieldCaption/FormFieldCaption.js";
|
|
8
|
+
import { FormFieldControlGroup } from "./FormFieldControlGroup/FormFieldControlGroup.js";
|
|
9
|
+
import { FormFieldInput } from "./FormFieldInput/FormFieldInput.js";
|
|
10
|
+
import { FormFieldInputDate } from "./FormFieldInputDate/FormFieldInputDate.js";
|
|
11
|
+
import { FormFieldSelect } from "./FormFieldSelect/FormFieldSelect.js";
|
|
12
|
+
const FormFieldComponent = polymorphicForwardRef((props, ref) => {
|
|
13
|
+
const {
|
|
14
|
+
as: Tag = "div",
|
|
15
|
+
fullWidth,
|
|
16
|
+
className,
|
|
17
|
+
labelAlign: labelAlignProp,
|
|
18
|
+
labelPlacement: labelPlacementProp,
|
|
19
|
+
...other
|
|
20
|
+
} = props;
|
|
21
|
+
const { labelPlacement: formLabelPlacement, labelAlign: formLabelAlign } = useForm();
|
|
22
|
+
const labelPlacement = labelPlacementProp ?? formLabelPlacement ?? "top";
|
|
23
|
+
const labelAlign = labelAlignProp ?? formLabelAlign ?? "start";
|
|
24
|
+
return /* @__PURE__ */ jsx(
|
|
25
|
+
Tag,
|
|
26
|
+
{
|
|
27
|
+
className: clsx(
|
|
28
|
+
s.base,
|
|
29
|
+
className,
|
|
30
|
+
s[labelAlign],
|
|
31
|
+
s[labelPlacement],
|
|
32
|
+
fullWidth && s.fullWidth
|
|
33
|
+
),
|
|
34
|
+
"data-slot": "form-field",
|
|
35
|
+
"data-label-align": labelAlign,
|
|
36
|
+
"data-label-placement": labelPlacement,
|
|
37
|
+
"data-fullwidth": fullWidth || void 0,
|
|
38
|
+
...other,
|
|
39
|
+
ref
|
|
40
|
+
}
|
|
41
|
+
);
|
|
42
|
+
});
|
|
43
|
+
const FormField = FormFieldComponent;
|
|
44
|
+
FormField.Label = FormFieldLabel;
|
|
45
|
+
FormField.Error = FormFieldError;
|
|
46
|
+
FormField.Caption = FormFieldCaption;
|
|
47
|
+
FormField.ControlGroup = FormFieldControlGroup;
|
|
48
|
+
FormField.Input = FormFieldInput;
|
|
49
|
+
FormField.InputDate = FormFieldInputDate;
|
|
50
|
+
FormField.Select = FormFieldSelect;
|
|
51
|
+
FormField.displayName = "FormField";
|
|
52
|
+
export {
|
|
53
|
+
FormField,
|
|
54
|
+
FormFieldComponent
|
|
55
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const base = "kbq-formfield-b52e32";
|
|
2
|
+
const fullWidth = "kbq-formfield-fullWidth-8515a1";
|
|
3
|
+
const top = "kbq-formfield-top-f0a5c0";
|
|
4
|
+
const side = "kbq-formfield-side-9d854f";
|
|
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,10 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
export declare const formFieldAddonPropPlacement: readonly ["start", "end"];
|
|
4
|
+
export type FormFieldAddonPlacement = (typeof formFieldAddonPropPlacement)[number];
|
|
5
|
+
export type FormFieldAddonProps = ExtendableComponentPropsWithRef<{
|
|
6
|
+
children?: ReactNode;
|
|
7
|
+
placement?: FormFieldAddonPlacement;
|
|
8
|
+
}, 'div'>;
|
|
9
|
+
export type FormFieldAddonRef = ComponentRef<'div'>;
|
|
10
|
+
export declare const FormFieldAddon: import("react").ForwardRefExoticComponent<Omit<FormFieldAddonProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,16 +1,11 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { isNotNil, clsx } from "@koobiq/react-core";
|
|
4
|
-
import s from "./
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
isDisabled,
|
|
10
|
-
className,
|
|
11
|
-
children,
|
|
12
|
-
...other
|
|
13
|
-
}, ref) => isNotNil(children) ? /* @__PURE__ */ jsx(
|
|
4
|
+
import s from "./FormFieldAddon.module.css.js";
|
|
5
|
+
import { useFormFieldControlGroup } from "../FormFieldControlGroup/FormFieldControlGroupContext.js";
|
|
6
|
+
const FormFieldAddon = forwardRef(({ placement = "start", className, children, ...other }, ref) => {
|
|
7
|
+
const { isInvalid, isDisabled } = useFormFieldControlGroup();
|
|
8
|
+
return isNotNil(children) ? /* @__PURE__ */ jsx(
|
|
14
9
|
"div",
|
|
15
10
|
{
|
|
16
11
|
className: clsx(
|
|
@@ -28,9 +23,9 @@ const FieldAddon = forwardRef(
|
|
|
28
23
|
ref,
|
|
29
24
|
children
|
|
30
25
|
}
|
|
31
|
-
) : null
|
|
32
|
-
);
|
|
33
|
-
|
|
26
|
+
) : null;
|
|
27
|
+
});
|
|
28
|
+
FormFieldAddon.displayName = "FormFieldAddon";
|
|
34
29
|
export {
|
|
35
|
-
|
|
30
|
+
FormFieldAddon
|
|
36
31
|
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const base = "kbq-formfieldaddon-3e3223";
|
|
2
|
+
const invalid = "kbq-formfieldaddon-invalid-6f8de4";
|
|
3
|
+
const disabled = "kbq-formfieldaddon-disabled-d4ab91";
|
|
4
|
+
const start = "kbq-formfieldaddon-start-a88be1";
|
|
5
|
+
const end = "kbq-formfieldaddon-end-fb2bf3";
|
|
6
|
+
const s = {
|
|
7
|
+
base,
|
|
8
|
+
invalid,
|
|
9
|
+
disabled,
|
|
10
|
+
start,
|
|
11
|
+
end
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
base,
|
|
15
|
+
s as default,
|
|
16
|
+
disabled,
|
|
17
|
+
end,
|
|
18
|
+
invalid,
|
|
19
|
+
start
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormFieldAddon';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type TextProps, type TextRef } from '@koobiq/react-primitives';
|
|
2
|
-
export type
|
|
3
|
-
export type
|
|
4
|
-
export declare const
|
|
2
|
+
export type FormFieldCaptionProps = TextProps;
|
|
3
|
+
export type FormFieldCaptionRef = TextRef;
|
|
4
|
+
export declare const FormFieldCaption: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
5
5
|
ref?: ((instance: HTMLParagraphElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLParagraphElement> | null | undefined;
|
|
6
6
|
}, "as" | keyof import("@koobiq/react-primitives").TextBaseProps> & import("@koobiq/react-primitives").TextBaseProps & {
|
|
7
7
|
as?: "p" | undefined;
|
|
@@ -2,8 +2,8 @@ import { jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { isNotNil, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { Text } from "@koobiq/react-primitives";
|
|
5
|
-
import s from "./
|
|
6
|
-
const
|
|
5
|
+
import s from "./FormFieldCaption.module.css.js";
|
|
6
|
+
const FormFieldCaption = forwardRef(
|
|
7
7
|
({ children, className, ...other }, ref) => isNotNil(children) ? /* @__PURE__ */ jsx(
|
|
8
8
|
Text,
|
|
9
9
|
{
|
|
@@ -15,7 +15,7 @@ const FieldCaption = forwardRef(
|
|
|
15
15
|
}
|
|
16
16
|
) : null
|
|
17
17
|
);
|
|
18
|
-
|
|
18
|
+
FormFieldCaption.displayName = "FormFieldCaption";
|
|
19
19
|
export {
|
|
20
|
-
|
|
20
|
+
FormFieldCaption
|
|
21
21
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormFieldCaption';
|
|
@@ -2,10 +2,10 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, Children, isValidElement, cloneElement } from "react";
|
|
3
3
|
import { isNotNil, useFocusRing, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { Group } from "@koobiq/react-primitives";
|
|
5
|
-
import s from "./
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
const
|
|
5
|
+
import s from "./FormFieldControlGroup.module.css.js";
|
|
6
|
+
import { FormFieldControlGroupContext } from "./FormFieldControlGroupContext.js";
|
|
7
|
+
import { FormFieldAddon } from "../FormFieldAddon/FormFieldAddon.js";
|
|
8
|
+
const FormFieldControlGroup = forwardRef(function FieldContentGroup({
|
|
9
9
|
variant = "filled",
|
|
10
10
|
isInvalid,
|
|
11
11
|
isDisabled,
|
|
@@ -30,11 +30,11 @@ const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
|
30
30
|
className: clsx(
|
|
31
31
|
s.base,
|
|
32
32
|
s[variant],
|
|
33
|
+
isFocused && s.focused,
|
|
33
34
|
isInvalid && s.invalid,
|
|
34
35
|
isDisabled && s.disabled,
|
|
35
|
-
isFocused && s.focused,
|
|
36
|
-
hasStartAddon && s.hasStartAddon,
|
|
37
36
|
hasEndAddon && s.hasEndAddon,
|
|
37
|
+
hasStartAddon && s.hasStartAddon,
|
|
38
38
|
className
|
|
39
39
|
),
|
|
40
40
|
isInvalid,
|
|
@@ -42,7 +42,7 @@ const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
|
42
42
|
...other,
|
|
43
43
|
ref,
|
|
44
44
|
children: ({ isHovered, isFocusWithin }) => /* @__PURE__ */ jsxs(
|
|
45
|
-
|
|
45
|
+
FormFieldControlGroupContext.Provider,
|
|
46
46
|
{
|
|
47
47
|
value: {
|
|
48
48
|
hasStartAddon,
|
|
@@ -53,34 +53,16 @@ const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
|
53
53
|
isFocusWithin
|
|
54
54
|
},
|
|
55
55
|
children: [
|
|
56
|
-
/* @__PURE__ */ jsx(
|
|
57
|
-
FieldAddon,
|
|
58
|
-
{
|
|
59
|
-
placement: "start",
|
|
60
|
-
isInvalid,
|
|
61
|
-
isDisabled,
|
|
62
|
-
...slotProps?.startAddon,
|
|
63
|
-
children: startAddon
|
|
64
|
-
}
|
|
65
|
-
),
|
|
56
|
+
/* @__PURE__ */ jsx(FormFieldAddon, { placement: "start", ...slotProps?.startAddon, children: startAddon }),
|
|
66
57
|
focusManagedChildren,
|
|
67
|
-
/* @__PURE__ */ jsx(
|
|
68
|
-
FieldAddon,
|
|
69
|
-
{
|
|
70
|
-
placement: "end",
|
|
71
|
-
isInvalid,
|
|
72
|
-
isDisabled,
|
|
73
|
-
...slotProps?.endAddon,
|
|
74
|
-
children: endAddon
|
|
75
|
-
}
|
|
76
|
-
)
|
|
58
|
+
/* @__PURE__ */ jsx(FormFieldAddon, { placement: "end", ...slotProps?.endAddon, children: endAddon })
|
|
77
59
|
]
|
|
78
60
|
}
|
|
79
61
|
)
|
|
80
62
|
}
|
|
81
63
|
);
|
|
82
64
|
});
|
|
83
|
-
|
|
65
|
+
FormFieldControlGroup.displayName = "FormFieldControlGroup";
|
|
84
66
|
export {
|
|
85
|
-
|
|
67
|
+
FormFieldControlGroup
|
|
86
68
|
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
const base = "kbq-formfieldcontrolgroup-e5c3bd";
|
|
2
|
+
const disabled = "kbq-formfieldcontrolgroup-disabled-16937d";
|
|
3
|
+
const transparent = "kbq-formfieldcontrolgroup-transparent-85bd5d";
|
|
4
|
+
const filled = "kbq-formfieldcontrolgroup-filled-c28a4b";
|
|
5
|
+
const focused = "kbq-formfieldcontrolgroup-focused-43f1f7";
|
|
6
|
+
const invalid = "kbq-formfieldcontrolgroup-invalid-f901a7";
|
|
7
|
+
const s = {
|
|
8
|
+
base,
|
|
9
|
+
disabled,
|
|
10
|
+
transparent,
|
|
11
|
+
filled,
|
|
12
|
+
focused,
|
|
13
|
+
invalid
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
base,
|
|
17
|
+
s as default,
|
|
18
|
+
disabled,
|
|
19
|
+
filled,
|
|
20
|
+
focused,
|
|
21
|
+
invalid,
|
|
22
|
+
transparent
|
|
23
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export type FormFieldControlGroupContextProps = {
|
|
2
|
+
isDisabled?: boolean;
|
|
3
|
+
hasStartAddon?: boolean;
|
|
4
|
+
hasEndAddon?: boolean;
|
|
5
|
+
isHovered?: boolean;
|
|
6
|
+
isFocusWithin?: boolean;
|
|
7
|
+
isInvalid?: boolean;
|
|
8
|
+
};
|
|
9
|
+
export declare const FormFieldControlGroupContext: import("react").Context<FormFieldControlGroupContextProps>;
|
|
10
|
+
export declare const useFormFieldControlGroup: () => FormFieldControlGroupContextProps;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { ComponentRef, ReactNode } from 'react';
|
|
2
|
+
import type { DataAttributeProps, ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
|
+
import type { FormFieldAddonProps } from '../FormFieldAddon';
|
|
4
|
+
export declare const formFieldControlGroupPropVariant: readonly ["filled", "transparent"];
|
|
5
|
+
export type FormFieldControlGroupPropVariant = (typeof formFieldControlGroupPropVariant)[number];
|
|
6
|
+
export type FormFieldControlGroupProps = ExtendableComponentPropsWithRef<{
|
|
7
|
+
/** The content of the component. */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** Addon placed before the children. */
|
|
10
|
+
startAddon?: ReactNode;
|
|
11
|
+
/** Addon placed after the children. */
|
|
12
|
+
endAddon?: ReactNode;
|
|
13
|
+
/**
|
|
14
|
+
* The variant to use.
|
|
15
|
+
* @default 'filled'
|
|
16
|
+
*/
|
|
17
|
+
variant?: FormFieldControlGroupPropVariant;
|
|
18
|
+
/** Whether the input is disabled. */
|
|
19
|
+
isDisabled?: boolean;
|
|
20
|
+
/** Additional CSS-classes. */
|
|
21
|
+
className?: string;
|
|
22
|
+
/** Whether the input value is invalid. */
|
|
23
|
+
isInvalid?: boolean;
|
|
24
|
+
/** The props used for each slot inside. */
|
|
25
|
+
slotProps?: {
|
|
26
|
+
startAddon?: FormFieldAddonProps;
|
|
27
|
+
endAddon?: FormFieldAddonProps;
|
|
28
|
+
};
|
|
29
|
+
} & DataAttributeProps, 'div'>;
|
|
30
|
+
export type FormFieldControlGroupRef = ComponentRef<'div'>;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import { type ValidationResult } from '@koobiq/react-core';
|
|
3
|
+
import { type TextProps, type TextRef } from '@koobiq/react-primitives';
|
|
4
|
+
export type FormFieldErrorProps = Omit<TextProps, 'children'> & {
|
|
5
|
+
children?: ReactNode | ((v: ValidationResult) => ReactNode);
|
|
6
|
+
};
|
|
7
|
+
export type FormFieldErrorRef = TextRef;
|
|
8
|
+
export declare const FormFieldError: import("react").ForwardRefExoticComponent<Omit<FormFieldErrorProps, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsx } from "@koobiq/react-core";
|
|
4
|
+
import { FieldError } from "@koobiq/react-primitives";
|
|
5
|
+
import s from "./FormFieldError.module.css.js";
|
|
6
|
+
const FormFieldError = forwardRef(({ className, ...other }, ref) => /* @__PURE__ */ jsx(
|
|
7
|
+
FieldError,
|
|
8
|
+
{
|
|
9
|
+
className: clsx(s.base, className),
|
|
10
|
+
...other,
|
|
11
|
+
ref
|
|
12
|
+
}
|
|
13
|
+
));
|
|
14
|
+
FormFieldError.displayName = "FormFieldError";
|
|
15
|
+
export {
|
|
16
|
+
FormFieldError
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormFieldError';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type FormFieldInputBaseProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
'data-testid'?: string;
|
|
5
|
+
as?: 'input' | 'textarea';
|
|
6
|
+
};
|
|
7
|
+
export declare const FormFieldInput: import("@koobiq/react-core").PolyForwardComponent<"input", FormFieldInputBaseProps, "input" | "textarea">;
|
|
8
|
+
export type FormFieldInputProps<As extends 'input' | 'textarea' = 'input'> = ComponentPropsWithRef<typeof FormFieldInput<As>>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
|
|
3
|
+
import { Input, Textarea } from "@koobiq/react-primitives";
|
|
4
|
+
import s from "./FormFieldInput.module.css.js";
|
|
5
|
+
const FormFieldInput = polymorphicForwardRef(({ as = "input", className, ...other }, ref) => {
|
|
6
|
+
const Tag = as === "input" ? Input : Textarea;
|
|
7
|
+
return /* @__PURE__ */ jsx(Tag, { ...other, className: clsx(s.base, className), ref });
|
|
8
|
+
});
|
|
9
|
+
FormFieldInput.displayName = "FormFieldInput";
|
|
10
|
+
export {
|
|
11
|
+
FormFieldInput
|
|
12
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormFieldInput';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
export type FormFieldInputDateProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
children?: ReactNode;
|
|
5
|
+
'data-testid'?: string;
|
|
6
|
+
ref?: Ref<HTMLDivElement>;
|
|
7
|
+
};
|
|
8
|
+
export declare const FormFieldInputDate: import("react").ForwardRefExoticComponent<Omit<FormFieldInputDateProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsx } from "@koobiq/react-core";
|
|
4
|
+
import s from "./FormFieldInputDate.module.css.js";
|
|
5
|
+
const FormFieldInputDate = forwardRef(({ children, className, ...other }, ref) => /* @__PURE__ */ jsx("div", { ...other, className: clsx(s.base, className), ref, children }));
|
|
6
|
+
FormFieldInputDate.displayName = "FormFieldInputDate";
|
|
7
|
+
export {
|
|
8
|
+
FormFieldInputDate
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FormFieldInputDate';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { FormFieldLabelBaseProps } from './types';
|
|
3
|
+
export declare const FormFieldLabel: import("@koobiq/react-core").PolyForwardComponent<"label", FormFieldLabelBaseProps, ElementType>;
|
|
4
|
+
export type FormFieldLabelProps<As extends ElementType = 'label'> = ComponentPropsWithRef<typeof FormFieldLabel<As>>;
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
2
|
import { polymorphicForwardRef, isNotNil, clsx } from "@koobiq/react-core";
|
|
3
3
|
import { Label } from "@koobiq/react-primitives";
|
|
4
|
-
import s from "./
|
|
5
|
-
const
|
|
4
|
+
import s from "./FormFieldLabel.module.css.js";
|
|
5
|
+
const FormFieldLabel = polymorphicForwardRef(
|
|
6
6
|
({ children, className, isHidden, isRequired, as = "label", ...other }, ref) => isNotNil(children) ? /* @__PURE__ */ jsxs(
|
|
7
7
|
Label,
|
|
8
8
|
{
|
|
9
9
|
as,
|
|
10
|
+
"data-slot": "form-field-label",
|
|
10
11
|
className: clsx(s.base, isHidden && s.hidden, className),
|
|
11
12
|
...other,
|
|
12
13
|
ref,
|
|
@@ -20,7 +21,7 @@ const FormControlLabel = polymorphicForwardRef(
|
|
|
20
21
|
}
|
|
21
22
|
) : null
|
|
22
23
|
);
|
|
23
|
-
|
|
24
|
+
FormFieldLabel.displayName = "FormFieldLabel";
|
|
24
25
|
export {
|
|
25
|
-
|
|
26
|
+
FormFieldLabel
|
|
26
27
|
};
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { ComponentPropsWithRef, ElementType } from 'react';
|
|
2
|
+
import type { FormFieldSelectBaseProps } from './index';
|
|
3
|
+
export declare const FormFieldSelect: import("@koobiq/react-core").PolyForwardComponent<"div", FormFieldSelectBaseProps, ElementType>;
|
|
4
|
+
export type FormFieldSelectProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormFieldSelect<As>>;
|