@koobiq/react-components 0.7.0 → 0.8.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/Checkbox/Checkbox.d.ts +1 -1
- package/dist/components/DateInput/DateInput.js +14 -8
- package/dist/components/DateInput/types.d.ts +19 -3
- package/dist/components/DateInput/types.js +5 -0
- package/dist/components/DatePicker/DatePicker.js +5 -1
- package/dist/components/DatePicker/types.d.ts +13 -1
- package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -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/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/FormControlLabel/FormControlLabel.js +33 -0
- package/dist/components/FormControlLabel/FormControlLabel.module.css.js +14 -0
- package/dist/components/FormControlLabel/types.d.ts +6 -31
- package/dist/components/Input/Input.d.ts +8 -4
- package/dist/components/Input/Input.js +14 -8
- package/dist/components/Input/types.d.ts +19 -3
- package/dist/components/Input/types.js +5 -0
- package/dist/components/InputNumber/InputNumber.d.ts +8 -4
- package/dist/components/InputNumber/InputNumber.js +14 -8
- package/dist/components/InputNumber/types.d.ts +19 -3
- package/dist/components/InputNumber/types.js +5 -0
- package/dist/components/List/components/ListSection/ListSection.js +1 -1
- package/dist/components/RadioGroup/RadioGroup.js +71 -18
- 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/index.d.ts +0 -2
- package/dist/components/RadioGroup/types.d.ts +40 -5
- package/dist/components/RadioGroup/types.js +5 -0
- package/dist/components/SearchInput/SearchInput.d.ts +8 -4
- package/dist/components/SearchInput/SearchInput.js +14 -8
- package/dist/components/SearchInput/types.d.ts +19 -3
- package/dist/components/SearchInput/types.js +5 -0
- package/dist/components/Select/Select.js +20 -13
- package/dist/components/Select/Select.module.css.js +0 -6
- package/dist/components/Select/types.d.ts +18 -2
- package/dist/components/Select/types.js +5 -0
- package/dist/components/Textarea/Textarea.d.ts +5 -2
- package/dist/components/Textarea/Textarea.js +7 -4
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +9 -9
- package/dist/components/Textarea/types.d.ts +21 -3
- package/dist/components/Textarea/types.js +5 -0
- package/dist/components/TimePicker/TimePicker.js +21 -15
- package/dist/components/TimePicker/types.d.ts +19 -3
- package/dist/components/TimePicker/types.js +7 -0
- package/dist/components/Toggle/Toggle.d.ts +1 -1
- package/dist/components/Tooltip/Tooltip.d.ts +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/index.js +31 -11
- package/dist/style.css +96 -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.js +0 -24
- 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
|
@@ -5,8 +5,9 @@ import { deprecate } from "@koobiq/logger";
|
|
|
5
5
|
import { useDOMRef, mergeProps } from "@koobiq/react-core";
|
|
6
6
|
import { NumberField } from "@koobiq/react-primitives";
|
|
7
7
|
import { InputNumberCounterControls } from "./components/InputNumberCounterControls.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { FormControl } from "../FormControl/FormControl.js";
|
|
9
|
+
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
10
|
+
import { Field } from "../FieldComponents/Field/Field.js";
|
|
10
11
|
import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
|
|
11
12
|
import { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
|
|
12
13
|
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
@@ -27,6 +28,8 @@ const InputNumber = forwardRef(
|
|
|
27
28
|
readonly,
|
|
28
29
|
isReadOnly: isReadOnlyProp,
|
|
29
30
|
label,
|
|
31
|
+
labelAlign,
|
|
32
|
+
labelPlacement,
|
|
30
33
|
startAddon,
|
|
31
34
|
endAddon,
|
|
32
35
|
errorMessage,
|
|
@@ -68,6 +71,8 @@ const InputNumber = forwardRef(
|
|
|
68
71
|
const rootProps = mergeProps(
|
|
69
72
|
{
|
|
70
73
|
label,
|
|
74
|
+
labelAlign,
|
|
75
|
+
labelPlacement,
|
|
71
76
|
fullWidth,
|
|
72
77
|
isDisabled,
|
|
73
78
|
isRequired,
|
|
@@ -75,12 +80,11 @@ const InputNumber = forwardRef(
|
|
|
75
80
|
isInvalid,
|
|
76
81
|
errorMessage,
|
|
77
82
|
"data-variant": variant,
|
|
78
|
-
"data-fullwidth": fullWidth,
|
|
79
83
|
...other
|
|
80
84
|
},
|
|
81
85
|
slotProps?.root
|
|
82
86
|
);
|
|
83
|
-
return /* @__PURE__ */ jsx(
|
|
87
|
+
return /* @__PURE__ */ jsx(FormControl, { as: NumberField, ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
|
|
84
88
|
const labelProps = mergeProps(
|
|
85
89
|
{ isHidden: isLabelHidden, children: label, isRequired: isRequired2 },
|
|
86
90
|
slotProps?.label
|
|
@@ -110,10 +114,12 @@ const InputNumber = forwardRef(
|
|
|
110
114
|
slotProps?.group
|
|
111
115
|
);
|
|
112
116
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
113
|
-
/* @__PURE__ */ jsx(
|
|
114
|
-
/* @__PURE__ */
|
|
115
|
-
|
|
116
|
-
|
|
117
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
|
|
118
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
119
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
120
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
121
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
122
|
+
] })
|
|
117
123
|
] });
|
|
118
124
|
} });
|
|
119
125
|
}
|
|
@@ -1,9 +1,15 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { NumberField, NumberFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import { type FieldCaptionProps, type
|
|
4
|
+
import { type FieldCaptionProps, type FieldErrorProps, type FieldContentGroupProps, type FieldInputProps, 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 inputNumberPropVariant: readonly ["filled", "transparent"];
|
|
6
8
|
export type InputNumberPropVariant = FieldContentGroupPropVariant;
|
|
9
|
+
export declare const inputNumberPropLabelPlacement: readonly ["top", "side"];
|
|
10
|
+
export type InputNumberPropLabelPlacement = FormControlPropLabelPlacement;
|
|
11
|
+
export declare const inputNumberPropLabelAlign: readonly ["start", "end"];
|
|
12
|
+
export type InputNumberPropLabelAlign = FormControlPropLabelAlign;
|
|
7
13
|
type InputNumberDeprecatedProps = {
|
|
8
14
|
/**
|
|
9
15
|
* If `true`, the component is disabled.
|
|
@@ -65,6 +71,16 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
65
71
|
* @default false
|
|
66
72
|
*/
|
|
67
73
|
isLabelHidden?: boolean;
|
|
74
|
+
/**
|
|
75
|
+
* The label's overall position relative to the element it is labeling.
|
|
76
|
+
* @default 'top'
|
|
77
|
+
*/
|
|
78
|
+
labelPlacement?: InputNumberPropLabelPlacement;
|
|
79
|
+
/**
|
|
80
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
81
|
+
* @default 'start'
|
|
82
|
+
*/
|
|
83
|
+
labelAlign?: InputNumberPropLabelAlign;
|
|
68
84
|
/** The helper text content. */
|
|
69
85
|
caption?: ReactNode;
|
|
70
86
|
/** Inline styles. */
|
|
@@ -73,8 +89,8 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
73
89
|
'data-testid'?: string | number;
|
|
74
90
|
/** The props used for each slot inside. */
|
|
75
91
|
slotProps?: {
|
|
76
|
-
root?:
|
|
77
|
-
label?:
|
|
92
|
+
root?: FormControlProps<typeof NumberField>;
|
|
93
|
+
label?: FormControlLabelProps;
|
|
78
94
|
input?: FieldInputProps;
|
|
79
95
|
caption?: FieldCaptionProps;
|
|
80
96
|
group?: FieldContentGroupProps;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
|
|
2
|
+
import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
|
|
2
3
|
const inputNumberPropVariant = fieldContentGroupPropVariant;
|
|
4
|
+
const inputNumberPropLabelPlacement = formControlPropLabelPlacement;
|
|
5
|
+
const inputNumberPropLabelAlign = formControlPropLabelAlign;
|
|
3
6
|
export {
|
|
7
|
+
inputNumberPropLabelAlign,
|
|
8
|
+
inputNumberPropLabelPlacement,
|
|
4
9
|
inputNumberPropVariant
|
|
5
10
|
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useListBoxSection } from "@koobiq/react-primitives";
|
|
4
4
|
import s from "./ListSection.module.css.js";
|
|
5
|
-
import { ListOption } from "../ListOption/ListOption.js";
|
|
6
5
|
import { Typography } from "../../../Typography/Typography.js";
|
|
6
|
+
import { ListOption } from "../ListOption/ListOption.js";
|
|
7
7
|
function ListSection({ section, state }) {
|
|
8
8
|
const { itemProps, headingProps, groupProps } = useListBoxSection({
|
|
9
9
|
heading: section.rendered,
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs,
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { deprecate } from "@koobiq/logger";
|
|
5
|
-
import { mergeProps
|
|
5
|
+
import { mergeProps } from "@koobiq/react-core";
|
|
6
6
|
import { RadioGroup as RadioGroup$1 } from "@koobiq/react-primitives";
|
|
7
|
-
import
|
|
7
|
+
import s from "./RadioGroup.module.css.js";
|
|
8
8
|
import { RadioGroupContext } from "./RadioContext.js";
|
|
9
|
-
import { RadioGroupDescription } from "./components/RadioGroupDescription/RadioGroupDescription.js";
|
|
10
9
|
import { flex } from "../layout/flex/flex.js";
|
|
10
|
+
import { FormControl } from "../FormControl/FormControl.js";
|
|
11
|
+
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
12
|
+
import { Field } from "../FieldComponents/Field/Field.js";
|
|
13
|
+
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
14
|
+
import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
|
|
11
15
|
const RadioGroup = forwardRef(
|
|
12
16
|
(props, ref) => {
|
|
13
17
|
const {
|
|
@@ -15,21 +19,35 @@ const RadioGroup = forwardRef(
|
|
|
15
19
|
label,
|
|
16
20
|
children,
|
|
17
21
|
slotProps,
|
|
22
|
+
style,
|
|
23
|
+
className,
|
|
18
24
|
description,
|
|
25
|
+
caption: captionProp,
|
|
19
26
|
orientation,
|
|
20
27
|
isInvalid: isInvalidProp,
|
|
21
28
|
isDisabled: isDisabledProp,
|
|
22
29
|
isRequired: isRequiredProp,
|
|
23
30
|
isReadOnly: isReadOnlyProp,
|
|
31
|
+
"data-testid": testId,
|
|
32
|
+
errorMessage,
|
|
33
|
+
labelAlign,
|
|
34
|
+
labelPlacement,
|
|
35
|
+
isLabelHidden,
|
|
24
36
|
disabled,
|
|
25
37
|
error,
|
|
26
38
|
readonly,
|
|
27
39
|
required
|
|
28
40
|
} = props;
|
|
41
|
+
const caption = captionProp ?? description;
|
|
29
42
|
const isDisabled = isDisabledProp ?? disabled ?? false;
|
|
30
43
|
const isInvalid = isInvalidProp ?? error ?? false;
|
|
31
44
|
const isReadOnly = isReadOnlyProp ?? readonly ?? false;
|
|
32
45
|
const isRequired = isRequiredProp ?? required ?? false;
|
|
46
|
+
if (process.env.NODE_ENV !== "production" && "description" in props) {
|
|
47
|
+
deprecate(
|
|
48
|
+
'RadioGroup: the "description" prop is deprecated. Use "caption" prop to replace it.'
|
|
49
|
+
);
|
|
50
|
+
}
|
|
33
51
|
if (process.env.NODE_ENV !== "production" && "disabled" in props) {
|
|
34
52
|
deprecate(
|
|
35
53
|
'RadioGroup: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
|
|
@@ -50,24 +68,59 @@ const RadioGroup = forwardRef(
|
|
|
50
68
|
'RadioGroup: the "required" prop is deprecated. Use "isRequired" prop to replace it.'
|
|
51
69
|
);
|
|
52
70
|
}
|
|
53
|
-
const
|
|
54
|
-
{ ...props, isDisabled, isInvalid, isReadOnly, isRequired },
|
|
71
|
+
const rootProps = mergeProps(
|
|
55
72
|
{
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
73
|
+
style,
|
|
74
|
+
labelPlacement,
|
|
75
|
+
className,
|
|
76
|
+
labelAlign,
|
|
77
|
+
isDisabled,
|
|
78
|
+
isInvalid,
|
|
79
|
+
isReadOnly,
|
|
80
|
+
isRequired,
|
|
81
|
+
...props,
|
|
82
|
+
ref,
|
|
83
|
+
"data-size": size,
|
|
84
|
+
"data-testid": testId,
|
|
85
|
+
"data-invalid": isInvalid,
|
|
86
|
+
"data-disabled": isDisabled,
|
|
87
|
+
"data-required": isRequired,
|
|
88
|
+
"data-readonly": isReadOnly
|
|
63
89
|
},
|
|
64
90
|
slotProps?.root
|
|
65
91
|
);
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
92
|
+
const radioGroupProps = mergeProps(
|
|
93
|
+
{
|
|
94
|
+
className: flex({
|
|
95
|
+
direction: orientation === "horizontal" ? "row" : "column",
|
|
96
|
+
alignItems: orientation === "horizontal" ? "center" : "flex-start",
|
|
97
|
+
gap: "s"
|
|
98
|
+
})
|
|
99
|
+
},
|
|
100
|
+
slotProps?.radioGroup
|
|
101
|
+
);
|
|
102
|
+
return /* @__PURE__ */ jsx(RadioGroupContext.Provider, { value: { size }, children: /* @__PURE__ */ jsx(FormControl, { as: RadioGroup$1, ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2 }) => {
|
|
103
|
+
const labelProps = mergeProps(
|
|
104
|
+
{
|
|
105
|
+
as: "span",
|
|
106
|
+
isRequired: isRequired2,
|
|
107
|
+
children: label,
|
|
108
|
+
className: s.label,
|
|
109
|
+
isHidden: isLabelHidden
|
|
110
|
+
},
|
|
111
|
+
slotProps?.label
|
|
112
|
+
);
|
|
113
|
+
const errorProps = mergeProps({ isInvalid: isInvalid2, children: errorMessage }, slotProps?.errorMessage);
|
|
114
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
115
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
|
|
117
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
118
|
+
/* @__PURE__ */ jsx("div", { ...radioGroupProps, children }),
|
|
119
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
120
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
121
|
+
] })
|
|
122
|
+
] });
|
|
123
|
+
} }) });
|
|
71
124
|
}
|
|
72
125
|
);
|
|
73
126
|
RadioGroup.displayName = "RadioGroup";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type RadioProps as RadioPropsPrimitive } from '@koobiq/react-primitives';
|
|
2
|
-
export declare const Radio: import("react").ForwardRefExoticComponent<Omit<RadioPropsPrimitive, "children" | "style" | "className" | "disabled" | "size" | "
|
|
2
|
+
export declare const Radio: import("react").ForwardRefExoticComponent<Omit<RadioPropsPrimitive, "children" | "style" | "className" | "disabled" | "size" | "labelPlacement" | "slotProps" | "data-testid"> & {
|
|
3
3
|
children?: import("react").ReactNode;
|
|
4
4
|
size?: import("./types").RadioPropSize;
|
|
5
5
|
labelPlacement?: import("./types").RadioPropLabelPlacement;
|
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableComponentPropsWithRef, ExtendableProps } from '@koobiq/react-core';
|
|
3
|
-
import type { RadioGroupProps as RadioGroupPrimitiveProps } from '@koobiq/react-primitives';
|
|
4
|
-
import type {
|
|
3
|
+
import type { RadioGroup as RadioGroupPrimitive, RadioGroupProps as RadioGroupPrimitiveProps } from '@koobiq/react-primitives';
|
|
4
|
+
import type { FieldCaptionProps, FieldErrorProps } from '../FieldComponents';
|
|
5
|
+
import { type FormControlPropLabelAlign, type FormControlPropLabelPlacement, type FormControlProps } from '../FormControl';
|
|
6
|
+
import type { FormControlLabelProps } from '../FormControlLabel';
|
|
5
7
|
export declare const radioGroupPropSize: readonly ["normal", "big"];
|
|
6
8
|
export type RadioGroupPropSize = (typeof radioGroupPropSize)[number];
|
|
7
9
|
export declare const radioGroupPropOrientation: readonly ["horizontal", "vertical"];
|
|
8
10
|
export type RadioGroupPropOrientation = (typeof radioGroupPropOrientation)[number];
|
|
11
|
+
export declare const radioGroupPropLabelPlacement: readonly ["top", "side"];
|
|
12
|
+
export type RadioGroupPropLabelPlacement = FormControlPropLabelPlacement;
|
|
13
|
+
export declare const radioGroupPropLabelAlign: readonly ["start", "end"];
|
|
14
|
+
export type RadioGroupPropLabelAlign = FormControlPropLabelAlign;
|
|
9
15
|
type RadioGroupDeprecatedProps = {
|
|
10
16
|
/**
|
|
11
17
|
* If `true`, the component is disabled.
|
|
@@ -35,10 +41,20 @@ type RadioGroupDeprecatedProps = {
|
|
|
35
41
|
* The "required" prop is deprecated. Use "isRequired" prop to replace it.
|
|
36
42
|
*/
|
|
37
43
|
required?: boolean;
|
|
44
|
+
/**
|
|
45
|
+
* The helper text content.
|
|
46
|
+
* @deprecated
|
|
47
|
+
* The "description" prop is deprecated. Use "caption" prop to replace it.
|
|
48
|
+
*/
|
|
49
|
+
description?: ReactNode;
|
|
38
50
|
};
|
|
39
51
|
export type RadioGroupBaseProps = ExtendableProps<{
|
|
40
52
|
/** Additional CSS-classes. */
|
|
41
53
|
className?: string;
|
|
54
|
+
/** Unique identifier for testing purposes. */
|
|
55
|
+
'data-testid'?: string | number;
|
|
56
|
+
/** The helper text content. */
|
|
57
|
+
caption?: ReactNode;
|
|
42
58
|
/** Inline styles. */
|
|
43
59
|
style?: CSSProperties;
|
|
44
60
|
/** The content of the component. */
|
|
@@ -53,11 +69,30 @@ export type RadioGroupBaseProps = ExtendableProps<{
|
|
|
53
69
|
* @default 'vertical'
|
|
54
70
|
*/
|
|
55
71
|
orientation?: RadioGroupPropOrientation;
|
|
72
|
+
/**
|
|
73
|
+
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
74
|
+
* @default false
|
|
75
|
+
*/
|
|
76
|
+
isLabelHidden?: boolean;
|
|
77
|
+
/** An error message for the field. */
|
|
78
|
+
errorMessage?: ReactNode;
|
|
79
|
+
/**
|
|
80
|
+
* The label's overall position relative to the element it is labeling.
|
|
81
|
+
* @default 'top'
|
|
82
|
+
*/
|
|
83
|
+
labelPlacement?: RadioGroupPropLabelPlacement;
|
|
84
|
+
/**
|
|
85
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
86
|
+
* @default 'start'
|
|
87
|
+
*/
|
|
88
|
+
labelAlign?: RadioGroupPropLabelAlign;
|
|
56
89
|
/** The props used for each slot inside. */
|
|
57
90
|
slotProps?: {
|
|
58
|
-
root?:
|
|
59
|
-
|
|
60
|
-
|
|
91
|
+
root?: FormControlProps<typeof RadioGroupPrimitive>;
|
|
92
|
+
caption?: FieldCaptionProps;
|
|
93
|
+
errorMessage?: FieldErrorProps;
|
|
94
|
+
label?: FormControlLabelProps<'span'>;
|
|
95
|
+
radioGroup?: ComponentPropsWithRef<'div'>;
|
|
61
96
|
};
|
|
62
97
|
} & RadioGroupDeprecatedProps, Omit<RadioGroupPrimitiveProps, 'validate' | 'validationBehavior' | 'validationState' | 'errorMessage'>>;
|
|
63
98
|
export type RadioGroupProps = ExtendableComponentPropsWithRef<RadioGroupBaseProps, 'div'>;
|
|
@@ -1,6 +1,11 @@
|
|
|
1
|
+
import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
|
|
1
2
|
const radioGroupPropSize = ["normal", "big"];
|
|
2
3
|
const radioGroupPropOrientation = ["horizontal", "vertical"];
|
|
4
|
+
const radioGroupPropLabelPlacement = formControlPropLabelPlacement;
|
|
5
|
+
const radioGroupPropLabelAlign = formControlPropLabelAlign;
|
|
3
6
|
export {
|
|
7
|
+
radioGroupPropLabelAlign,
|
|
8
|
+
radioGroupPropLabelPlacement,
|
|
4
9
|
radioGroupPropOrientation,
|
|
5
10
|
radioGroupPropSize
|
|
6
11
|
};
|
|
@@ -1,13 +1,17 @@
|
|
|
1
|
-
import { type FieldCaptionProps, type FieldContentGroupProps, type
|
|
2
|
-
|
|
1
|
+
import { type FieldCaptionProps, type FieldContentGroupProps, type FieldErrorProps, type FieldInputProps } from '../FieldComponents';
|
|
2
|
+
import { type FormControlProps } from '../FormControl';
|
|
3
|
+
import { type FormControlLabelProps } from '../FormControlLabel';
|
|
4
|
+
export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/searchfield").AriaSearchFieldProps, "validationState" | "description" | "errorMessage">, "caption" | "style" | "className" | `data-${string}` | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden"> & {
|
|
3
5
|
className?: string;
|
|
4
6
|
style?: import("react").CSSProperties;
|
|
5
7
|
isLabelHidden?: boolean;
|
|
8
|
+
labelPlacement?: import("./types").SearchInputPropLabelPlacement;
|
|
9
|
+
labelAlign?: import("./types").SearchInputPropLabelAlign;
|
|
6
10
|
startAddon?: import("react").ReactNode;
|
|
7
11
|
endAddon?: import("react").ReactNode;
|
|
8
12
|
slotProps?: {
|
|
9
|
-
root?:
|
|
10
|
-
label?:
|
|
13
|
+
root?: FormControlProps;
|
|
14
|
+
label?: FormControlLabelProps;
|
|
11
15
|
group?: FieldContentGroupProps;
|
|
12
16
|
input?: FieldInputProps;
|
|
13
17
|
caption?: FieldCaptionProps;
|
|
@@ -6,8 +6,9 @@ import { IconMagnifyingGlass16, IconXmarkCircle16 } from "@koobiq/react-icons";
|
|
|
6
6
|
import { useSearchFieldState, removeDataAttributes, useSearchField } from "@koobiq/react-primitives";
|
|
7
7
|
import s from "./SearchInput.module.css.js";
|
|
8
8
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
9
|
+
import { FormControl } from "../FormControl/FormControl.js";
|
|
10
|
+
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
11
|
+
import { Field } from "../FieldComponents/Field/Field.js";
|
|
11
12
|
import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
|
|
12
13
|
import { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
|
|
13
14
|
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
@@ -19,6 +20,8 @@ const SearchInput = forwardRef(
|
|
|
19
20
|
variant = "filled",
|
|
20
21
|
fullWidth = false,
|
|
21
22
|
isLabelHidden = false,
|
|
23
|
+
labelPlacement,
|
|
24
|
+
labelAlign,
|
|
22
25
|
"data-testid": testId,
|
|
23
26
|
style,
|
|
24
27
|
className,
|
|
@@ -45,12 +48,13 @@ const SearchInput = forwardRef(
|
|
|
45
48
|
const rootProps = mergeProps(
|
|
46
49
|
{
|
|
47
50
|
style,
|
|
51
|
+
labelPlacement,
|
|
52
|
+
labelAlign,
|
|
48
53
|
fullWidth,
|
|
49
54
|
"data-testid": testId,
|
|
50
55
|
"data-variant": variant,
|
|
51
56
|
"data-invalid": isInvalid,
|
|
52
57
|
"data-disabled": isDisabled,
|
|
53
|
-
"data-fullwidth": fullWidth,
|
|
54
58
|
"data-required": isRequired,
|
|
55
59
|
"data-readonly": isReadOnly,
|
|
56
60
|
className: clsx(s.base, className)
|
|
@@ -105,11 +109,13 @@ const SearchInput = forwardRef(
|
|
|
105
109
|
slotProps?.errorMessage,
|
|
106
110
|
errorMessagePropsAria
|
|
107
111
|
);
|
|
108
|
-
return /* @__PURE__ */ jsxs(
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
112
|
+
return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
|
|
113
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps, children: label }),
|
|
114
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
115
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
116
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
117
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
118
|
+
] })
|
|
113
119
|
] });
|
|
114
120
|
}
|
|
115
121
|
);
|
|
@@ -1,10 +1,16 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { DataAttributeProps, ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { AriaSearchFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import 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
|
import type { IconButtonProps } from '../IconButton';
|
|
6
8
|
export declare const searchInputPropVariant: readonly ["filled", "transparent"];
|
|
7
9
|
export type SearchInputPropVariant = FieldContentGroupPropVariant;
|
|
10
|
+
export declare const searchInputPropLabelPlacement: readonly ["top", "side"];
|
|
11
|
+
export type SearchInputPropLabelPlacement = FormControlPropLabelPlacement;
|
|
12
|
+
export declare const searchInputPropLabelAlign: readonly ["start", "end"];
|
|
13
|
+
export type SearchInputPropLabelAlign = FormControlPropLabelAlign;
|
|
8
14
|
export type SearchInputProps = ExtendableProps<{
|
|
9
15
|
/** Additional CSS-classes. */
|
|
10
16
|
className?: string;
|
|
@@ -15,14 +21,24 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
15
21
|
* @default false
|
|
16
22
|
*/
|
|
17
23
|
isLabelHidden?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* The label's overall position relative to the element it is labeling.
|
|
26
|
+
* @default 'top'
|
|
27
|
+
*/
|
|
28
|
+
labelPlacement?: SearchInputPropLabelPlacement;
|
|
29
|
+
/**
|
|
30
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
31
|
+
* @default 'start'
|
|
32
|
+
*/
|
|
33
|
+
labelAlign?: SearchInputPropLabelAlign;
|
|
18
34
|
/** Addon placed before the children. */
|
|
19
35
|
startAddon?: ReactNode;
|
|
20
36
|
/** Addon placed after the children. */
|
|
21
37
|
endAddon?: ReactNode;
|
|
22
38
|
/** The props used for each slot inside. */
|
|
23
39
|
slotProps?: {
|
|
24
|
-
root?:
|
|
25
|
-
label?:
|
|
40
|
+
root?: FormControlProps;
|
|
41
|
+
label?: FormControlLabelProps;
|
|
26
42
|
group?: FieldContentGroupProps;
|
|
27
43
|
input?: FieldInputProps;
|
|
28
44
|
caption?: FieldCaptionProps;
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
|
|
2
|
+
import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
|
|
2
3
|
const searchInputPropVariant = fieldContentGroupPropVariant;
|
|
4
|
+
const searchInputPropLabelPlacement = formControlPropLabelPlacement;
|
|
5
|
+
const searchInputPropLabelAlign = formControlPropLabelAlign;
|
|
3
6
|
export {
|
|
7
|
+
searchInputPropLabelAlign,
|
|
8
|
+
searchInputPropLabelPlacement,
|
|
4
9
|
searchInputPropVariant
|
|
5
10
|
};
|
|
@@ -11,8 +11,9 @@ import { SelectList } from "./components/SelectList/SelectList.js";
|
|
|
11
11
|
import { TagGroup } from "./components/TagGroup/TagGroup.js";
|
|
12
12
|
import { List } from "../List/List.js";
|
|
13
13
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { FormControl } from "../FormControl/FormControl.js";
|
|
15
|
+
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
16
|
+
import { Field } from "../FieldComponents/Field/Field.js";
|
|
16
17
|
import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
|
|
17
18
|
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
18
19
|
import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
|
|
@@ -26,6 +27,8 @@ function SelectRender(props, ref) {
|
|
|
26
27
|
"data-testid": testId,
|
|
27
28
|
selectionMode = "single",
|
|
28
29
|
selectedTagsOverflow = "responsive",
|
|
30
|
+
labelPlacement,
|
|
31
|
+
labelAlign,
|
|
29
32
|
isRequired,
|
|
30
33
|
isDisabled,
|
|
31
34
|
caption,
|
|
@@ -71,11 +74,13 @@ function SelectRender(props, ref) {
|
|
|
71
74
|
const { ref: containerRef, width } = useElementSize();
|
|
72
75
|
const rootProps = mergeProps({
|
|
73
76
|
"data-testid": testId,
|
|
74
|
-
"data-fullwidth": fullWidth,
|
|
75
77
|
"data-invalid": isInvalid,
|
|
76
78
|
"data-disabled": props.isDisabled,
|
|
77
79
|
"data-required": props.isRequired,
|
|
78
|
-
className
|
|
80
|
+
className,
|
|
81
|
+
fullWidth,
|
|
82
|
+
labelPlacement,
|
|
83
|
+
labelAlign,
|
|
79
84
|
style
|
|
80
85
|
});
|
|
81
86
|
const listProps = mergeProps(
|
|
@@ -162,15 +167,17 @@ function SelectRender(props, ref) {
|
|
|
162
167
|
};
|
|
163
168
|
const renderValue = renderValueProp || renderDefaultValue;
|
|
164
169
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
|
-
/* @__PURE__ */ jsxs(
|
|
166
|
-
/* @__PURE__ */ jsx(
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
170
|
+
/* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
|
|
171
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
|
|
172
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
173
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldSelect, { ...controlProps, children: renderValue(state, {
|
|
174
|
+
isInvalid,
|
|
175
|
+
isDisabled: props.isDisabled,
|
|
176
|
+
isRequired: props.isRequired
|
|
177
|
+
}) }) }),
|
|
178
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
179
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
180
|
+
] })
|
|
174
181
|
] }),
|
|
175
182
|
/* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(SelectList, { ...listProps }) })
|
|
176
183
|
] });
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const base = "kbq-select-6d31ad";
|
|
2
|
-
const fullWidth = "kbq-select-fullWidth-1dfc13";
|
|
3
1
|
const addon = "kbq-select-addon-cbc524";
|
|
4
2
|
const chevron = "kbq-select-chevron-0b4fa3";
|
|
5
3
|
const list = "kbq-select-list-8ffac0";
|
|
@@ -7,8 +5,6 @@ const popover = "kbq-select-popover-79fc05";
|
|
|
7
5
|
const clearButton = "kbq-select-clearButton-8031a1";
|
|
8
6
|
const clearable = "kbq-select-clearable-2f5092";
|
|
9
7
|
const s = {
|
|
10
|
-
base,
|
|
11
|
-
fullWidth,
|
|
12
8
|
addon,
|
|
13
9
|
chevron,
|
|
14
10
|
list,
|
|
@@ -18,12 +14,10 @@ const s = {
|
|
|
18
14
|
};
|
|
19
15
|
export {
|
|
20
16
|
addon,
|
|
21
|
-
base,
|
|
22
17
|
chevron,
|
|
23
18
|
clearButton,
|
|
24
19
|
clearable,
|
|
25
20
|
s as default,
|
|
26
|
-
fullWidth,
|
|
27
21
|
list,
|
|
28
22
|
popover
|
|
29
23
|
};
|
|
@@ -1,12 +1,18 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { AriaSelectProps, MultiSelectState, useMultiSelectState } from '@koobiq/react-primitives';
|
|
4
|
-
import type
|
|
4
|
+
import { type FieldErrorProps, type FieldSelectProps, type FieldCaptionProps, type FieldContentGroupProps } from '../FieldComponents';
|
|
5
|
+
import { type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
|
|
6
|
+
import type { FormControlLabelProps } from '../FormControlLabel';
|
|
5
7
|
import type { IconButtonProps } from '../IconButton';
|
|
6
8
|
import type { ListProps } from '../List';
|
|
7
9
|
import type { PopoverProps } from '../Popover';
|
|
8
10
|
export declare const selectPropSelectedTagsOverflow: readonly ["multiline", "responsive"];
|
|
9
11
|
export type SelectPropSelectedTagsOverflow = (typeof selectPropSelectedTagsOverflow)[number];
|
|
12
|
+
export declare const selectPropLabelPlacement: readonly ["top", "side"];
|
|
13
|
+
export type SelectPropLabelPlacement = FormControlPropLabelPlacement;
|
|
14
|
+
export declare const selectPropLabelAlign: readonly ["start", "end"];
|
|
15
|
+
export type SelectPropLabelAlign = FormControlPropLabelAlign;
|
|
10
16
|
export type SelectProps<T> = ExtendableProps<{
|
|
11
17
|
/**
|
|
12
18
|
* Defines how selected tags are displayed when they exceed the available space.
|
|
@@ -46,6 +52,16 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
46
52
|
* @default false
|
|
47
53
|
*/
|
|
48
54
|
isLabelHidden?: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* The label's overall position relative to the element it is labeling.
|
|
57
|
+
* @default 'top'
|
|
58
|
+
*/
|
|
59
|
+
labelPlacement?: SelectPropLabelPlacement;
|
|
60
|
+
/**
|
|
61
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
62
|
+
* @default 'start'
|
|
63
|
+
*/
|
|
64
|
+
labelAlign?: SelectPropLabelAlign;
|
|
49
65
|
/** The helper text content. */
|
|
50
66
|
caption?: ReactNode;
|
|
51
67
|
/**
|
|
@@ -66,7 +82,7 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
66
82
|
/** The props used for each slot inside. */
|
|
67
83
|
slotProps?: {
|
|
68
84
|
popover?: PopoverProps;
|
|
69
|
-
label?:
|
|
85
|
+
label?: FormControlLabelProps;
|
|
70
86
|
list?: ListProps<T>;
|
|
71
87
|
control?: FieldSelectProps;
|
|
72
88
|
caption?: FieldCaptionProps;
|