@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
|
@@ -1,44 +1,56 @@
|
|
|
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.
|
|
12
|
-
* @default false
|
|
13
18
|
* @deprecated
|
|
14
19
|
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
15
20
|
*/
|
|
16
21
|
disabled?: boolean;
|
|
17
22
|
/**
|
|
18
23
|
* If `true`, the component will indicate an error.
|
|
19
|
-
* @default false
|
|
20
24
|
* @deprecated
|
|
21
25
|
* The "error" prop is deprecated. Use "isInvalid" prop to replace it.
|
|
22
26
|
*/
|
|
23
27
|
error?: boolean;
|
|
24
28
|
/**
|
|
25
29
|
* It prevents the user from changing the value of the checkbox.
|
|
26
|
-
* @default false
|
|
27
30
|
* @deprecated
|
|
28
31
|
* The "readonly" prop is deprecated. Use "isReadonly" prop to replace it.
|
|
29
32
|
*/
|
|
30
33
|
readonly?: boolean;
|
|
31
34
|
/**
|
|
32
35
|
* If `true`, the input element is required.
|
|
33
|
-
* @default false
|
|
34
36
|
* @deprecated
|
|
35
37
|
* The "required" prop is deprecated. Use "isRequired" prop to replace it.
|
|
36
38
|
*/
|
|
37
39
|
required?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* The helper text content.
|
|
42
|
+
* @deprecated
|
|
43
|
+
* The "description" prop is deprecated. Use "caption" prop to replace it.
|
|
44
|
+
*/
|
|
45
|
+
description?: ReactNode;
|
|
38
46
|
};
|
|
39
47
|
export type RadioGroupBaseProps = ExtendableProps<{
|
|
40
48
|
/** Additional CSS-classes. */
|
|
41
49
|
className?: string;
|
|
50
|
+
/** Unique identifier for testing purposes. */
|
|
51
|
+
'data-testid'?: string | number;
|
|
52
|
+
/** The helper text content. */
|
|
53
|
+
caption?: ReactNode;
|
|
42
54
|
/** Inline styles. */
|
|
43
55
|
style?: CSSProperties;
|
|
44
56
|
/** The content of the component. */
|
|
@@ -53,12 +65,28 @@ export type RadioGroupBaseProps = ExtendableProps<{
|
|
|
53
65
|
* @default 'vertical'
|
|
54
66
|
*/
|
|
55
67
|
orientation?: RadioGroupPropOrientation;
|
|
68
|
+
/**
|
|
69
|
+
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
70
|
+
*/
|
|
71
|
+
isLabelHidden?: boolean;
|
|
72
|
+
/**
|
|
73
|
+
* The label's overall position relative to the element it is labeling.
|
|
74
|
+
* @default 'top'
|
|
75
|
+
*/
|
|
76
|
+
labelPlacement?: RadioGroupPropLabelPlacement;
|
|
77
|
+
/**
|
|
78
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
79
|
+
* @default 'start'
|
|
80
|
+
*/
|
|
81
|
+
labelAlign?: RadioGroupPropLabelAlign;
|
|
56
82
|
/** The props used for each slot inside. */
|
|
57
83
|
slotProps?: {
|
|
58
|
-
root?:
|
|
59
|
-
|
|
60
|
-
|
|
84
|
+
root?: FormControlProps<typeof RadioGroupPrimitive>;
|
|
85
|
+
caption?: FieldCaptionProps;
|
|
86
|
+
errorMessage?: FieldErrorProps;
|
|
87
|
+
label?: FormControlLabelProps<'span'>;
|
|
88
|
+
radioGroup?: ComponentPropsWithRef<'div'>;
|
|
61
89
|
};
|
|
62
|
-
} & RadioGroupDeprecatedProps, Omit<RadioGroupPrimitiveProps, '
|
|
90
|
+
} & RadioGroupDeprecatedProps, Omit<RadioGroupPrimitiveProps, 'validationState'>>;
|
|
63
91
|
export type RadioGroupProps = ExtendableComponentPropsWithRef<RadioGroupBaseProps, 'div'>;
|
|
64
92
|
export {};
|
|
@@ -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,20 +1,23 @@
|
|
|
1
|
-
import { type FieldCaptionProps, type FieldContentGroupProps, type
|
|
2
|
-
|
|
1
|
+
import { type FieldCaptionProps, type FieldContentGroupProps, type FieldInputProps, type FieldErrorProps } 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">, "caption" | "style" | "className" | `data-${string}` | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "startAddon" | "endAddon" | "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;
|
|
14
18
|
errorMessage?: FieldErrorProps;
|
|
15
19
|
clearButton?: import("..").IconButtonProps;
|
|
16
20
|
};
|
|
17
|
-
errorMessage?: import("react").ReactNode;
|
|
18
21
|
caption?: import("react").ReactNode;
|
|
19
22
|
variant?: import("./types").SearchInputPropVariant;
|
|
20
23
|
fullWidth?: boolean;
|
|
@@ -3,11 +3,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
5
|
import { IconMagnifyingGlass16, IconXmarkCircle16 } from "@koobiq/react-icons";
|
|
6
|
-
import { useSearchFieldState, removeDataAttributes, useSearchField } from "@koobiq/react-primitives";
|
|
6
|
+
import { useSearchFieldState, removeDataAttributes, useSearchField, FieldErrorContext } 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";
|
|
@@ -17,18 +18,19 @@ const SearchInput = forwardRef(
|
|
|
17
18
|
const {
|
|
18
19
|
startAddon = /* @__PURE__ */ jsx(IconMagnifyingGlass16, { className: s.searchIcon }),
|
|
19
20
|
variant = "filled",
|
|
20
|
-
fullWidth
|
|
21
|
-
isLabelHidden
|
|
21
|
+
fullWidth,
|
|
22
|
+
isLabelHidden,
|
|
23
|
+
labelPlacement,
|
|
24
|
+
errorMessage,
|
|
25
|
+
labelAlign,
|
|
22
26
|
"data-testid": testId,
|
|
23
27
|
style,
|
|
24
28
|
className,
|
|
25
29
|
caption,
|
|
26
|
-
errorMessage,
|
|
27
30
|
isRequired,
|
|
28
31
|
isReadOnly,
|
|
29
32
|
label,
|
|
30
33
|
endAddon,
|
|
31
|
-
isInvalid,
|
|
32
34
|
isDisabled,
|
|
33
35
|
slotProps
|
|
34
36
|
} = props;
|
|
@@ -40,19 +42,22 @@ const SearchInput = forwardRef(
|
|
|
40
42
|
inputProps: inputPropsAria,
|
|
41
43
|
descriptionProps: descriptionPropsAria,
|
|
42
44
|
errorMessageProps: errorMessagePropsAria,
|
|
43
|
-
clearButtonProps: clearButtonPropsAria
|
|
45
|
+
clearButtonProps: clearButtonPropsAria,
|
|
46
|
+
...validation
|
|
44
47
|
} = useSearchField(removeDataAttributes(props), state, domRef);
|
|
48
|
+
const { isInvalid } = validation;
|
|
45
49
|
const rootProps = mergeProps(
|
|
46
50
|
{
|
|
47
51
|
style,
|
|
52
|
+
labelPlacement,
|
|
53
|
+
labelAlign,
|
|
48
54
|
fullWidth,
|
|
49
55
|
"data-testid": testId,
|
|
50
56
|
"data-variant": variant,
|
|
51
|
-
"data-invalid": isInvalid,
|
|
52
|
-
"data-
|
|
53
|
-
"data-
|
|
54
|
-
"data-required": isRequired,
|
|
55
|
-
"data-readonly": isReadOnly,
|
|
57
|
+
"data-invalid": isInvalid || void 0,
|
|
58
|
+
"data-readonly": isReadOnly || void 0,
|
|
59
|
+
"data-disabled": isDisabled || void 0,
|
|
60
|
+
"data-required": isRequired || void 0,
|
|
56
61
|
className: clsx(s.base, className)
|
|
57
62
|
},
|
|
58
63
|
slotProps?.root
|
|
@@ -101,15 +106,17 @@ const SearchInput = forwardRef(
|
|
|
101
106
|
);
|
|
102
107
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionPropsAria);
|
|
103
108
|
const errorProps = mergeProps(
|
|
104
|
-
{
|
|
109
|
+
{ children: errorMessage },
|
|
105
110
|
slotProps?.errorMessage,
|
|
106
111
|
errorMessagePropsAria
|
|
107
112
|
);
|
|
108
|
-
return /* @__PURE__ */ jsxs(
|
|
109
|
-
/* @__PURE__ */ jsx(
|
|
110
|
-
/* @__PURE__ */
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
|
|
114
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps, children: label }),
|
|
115
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
116
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
117
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
118
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
|
|
119
|
+
] })
|
|
113
120
|
] });
|
|
114
121
|
}
|
|
115
122
|
);
|
|
@@ -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;
|
|
@@ -12,25 +18,32 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
12
18
|
style?: CSSProperties;
|
|
13
19
|
/**
|
|
14
20
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
15
|
-
* @default false
|
|
16
21
|
*/
|
|
17
22
|
isLabelHidden?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* The label's overall position relative to the element it is labeling.
|
|
25
|
+
* @default 'top'
|
|
26
|
+
*/
|
|
27
|
+
labelPlacement?: SearchInputPropLabelPlacement;
|
|
28
|
+
/**
|
|
29
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
30
|
+
* @default 'start'
|
|
31
|
+
*/
|
|
32
|
+
labelAlign?: SearchInputPropLabelAlign;
|
|
18
33
|
/** Addon placed before the children. */
|
|
19
34
|
startAddon?: ReactNode;
|
|
20
35
|
/** Addon placed after the children. */
|
|
21
36
|
endAddon?: ReactNode;
|
|
22
37
|
/** The props used for each slot inside. */
|
|
23
38
|
slotProps?: {
|
|
24
|
-
root?:
|
|
25
|
-
label?:
|
|
39
|
+
root?: FormControlProps;
|
|
40
|
+
label?: FormControlLabelProps;
|
|
26
41
|
group?: FieldContentGroupProps;
|
|
27
42
|
input?: FieldInputProps;
|
|
28
43
|
caption?: FieldCaptionProps;
|
|
29
44
|
errorMessage?: FieldErrorProps;
|
|
30
45
|
clearButton?: IconButtonProps;
|
|
31
46
|
};
|
|
32
|
-
/** An error message for the field. */
|
|
33
|
-
errorMessage?: ReactNode;
|
|
34
47
|
/** The helper text content. */
|
|
35
48
|
caption?: ReactNode;
|
|
36
49
|
/**
|
|
@@ -40,8 +53,7 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
40
53
|
variant?: SearchInputPropVariant;
|
|
41
54
|
/**
|
|
42
55
|
* If `true`, the input will take up the full width of its container.
|
|
43
|
-
* @default false
|
|
44
56
|
*/
|
|
45
57
|
fullWidth?: boolean;
|
|
46
|
-
} & DataAttributeProps, Omit<AriaSearchFieldProps, 'description' | '
|
|
58
|
+
} & DataAttributeProps, Omit<AriaSearchFieldProps, 'description' | 'validationState'>>;
|
|
47
59
|
export type SearchInputRef = ComponentRef<'input'>;
|
|
@@ -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
|
};
|
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback } from "react";
|
|
3
3
|
import { useLocalizedStringFormatter, useDOMRef, useElementSize, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { IconXmarkCircle16, IconChevronDownS16 } from "@koobiq/react-icons";
|
|
5
|
-
import { useMultiSelectState, removeDataAttributes, useMultiSelect } from "@koobiq/react-primitives";
|
|
5
|
+
import { useMultiSelectState, removeDataAttributes, useMultiSelect, FieldErrorContext } from "@koobiq/react-primitives";
|
|
6
6
|
import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
7
7
|
import intlMessages from "./intl.js";
|
|
8
8
|
import s from "./Select.module.css.js";
|
|
@@ -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";
|
|
@@ -21,11 +22,13 @@ import { Section } from "../Collections/Section.js";
|
|
|
21
22
|
import { Divider } from "../Collections/Divider.js";
|
|
22
23
|
function SelectRender(props, ref) {
|
|
23
24
|
const {
|
|
24
|
-
fullWidth
|
|
25
|
-
isClearable
|
|
25
|
+
fullWidth,
|
|
26
|
+
isClearable,
|
|
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,
|
|
@@ -52,13 +55,13 @@ function SelectRender(props, ref) {
|
|
|
52
55
|
onClear?.();
|
|
53
56
|
}, [onClear, state]);
|
|
54
57
|
const {
|
|
55
|
-
isInvalid,
|
|
56
58
|
menuProps,
|
|
57
59
|
valueProps,
|
|
58
60
|
triggerProps,
|
|
59
61
|
labelProps: labelPropsAria,
|
|
60
62
|
descriptionProps,
|
|
61
|
-
errorMessageProps
|
|
63
|
+
errorMessageProps,
|
|
64
|
+
...validation
|
|
62
65
|
} = useMultiSelect(
|
|
63
66
|
removeDataAttributes({
|
|
64
67
|
...props,
|
|
@@ -68,14 +71,17 @@ function SelectRender(props, ref) {
|
|
|
68
71
|
state,
|
|
69
72
|
domRef
|
|
70
73
|
);
|
|
74
|
+
const { isInvalid } = validation;
|
|
71
75
|
const { ref: containerRef, width } = useElementSize();
|
|
72
76
|
const rootProps = mergeProps({
|
|
73
77
|
"data-testid": testId,
|
|
74
|
-
"data-
|
|
75
|
-
"data-
|
|
76
|
-
"data-
|
|
77
|
-
|
|
78
|
-
|
|
78
|
+
"data-invalid": isInvalid || void 0,
|
|
79
|
+
"data-disabled": props.isDisabled || void 0,
|
|
80
|
+
"data-required": props.isRequired || void 0,
|
|
81
|
+
className,
|
|
82
|
+
fullWidth,
|
|
83
|
+
labelPlacement,
|
|
84
|
+
labelAlign,
|
|
79
85
|
style
|
|
80
86
|
});
|
|
81
87
|
const listProps = mergeProps(
|
|
@@ -142,11 +148,7 @@ function SelectRender(props, ref) {
|
|
|
142
148
|
slotProps?.popover
|
|
143
149
|
);
|
|
144
150
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
|
|
145
|
-
const errorProps = mergeProps(
|
|
146
|
-
{ isInvalid, children: errorMessage },
|
|
147
|
-
slotProps?.errorMessage,
|
|
148
|
-
errorMessageProps
|
|
149
|
-
);
|
|
151
|
+
const errorProps = mergeProps({ children: errorMessage }, slotProps?.errorMessage, errorMessageProps);
|
|
150
152
|
const renderDefaultValue = (state2, states) => {
|
|
151
153
|
if (!state2.selectedItems) return null;
|
|
152
154
|
if (selectionMode === "multiple")
|
|
@@ -162,15 +164,17 @@ function SelectRender(props, ref) {
|
|
|
162
164
|
};
|
|
163
165
|
const renderValue = renderValueProp || renderDefaultValue;
|
|
164
166
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
165
|
-
/* @__PURE__ */ jsxs(
|
|
166
|
-
/* @__PURE__ */ jsx(
|
|
167
|
-
/* @__PURE__ */
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
167
|
+
/* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
|
|
168
|
+
/* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
|
|
169
|
+
/* @__PURE__ */ jsxs(Field, { children: [
|
|
170
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldSelect, { ...controlProps, children: renderValue(state, {
|
|
171
|
+
isInvalid,
|
|
172
|
+
isDisabled: props.isDisabled,
|
|
173
|
+
isRequired: props.isRequired
|
|
174
|
+
}) }) }),
|
|
175
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
176
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
|
|
177
|
+
] })
|
|
174
178
|
] }),
|
|
175
179
|
/* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(SelectList, { ...listProps }) })
|
|
176
180
|
] });
|
|
@@ -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
|
};
|
|
@@ -25,11 +25,11 @@ function SelectOption({ item, state }) {
|
|
|
25
25
|
className: clsx(listItem, textVariant["text-normal"], className),
|
|
26
26
|
style,
|
|
27
27
|
ref,
|
|
28
|
-
"data-hovered": isHovered,
|
|
29
|
-
"data-pressed": isPressed,
|
|
30
|
-
"data-disabled": isDisabled,
|
|
31
|
-
"data-selected": isSelected,
|
|
32
|
-
"data-focus-visible": isFocusVisible,
|
|
28
|
+
"data-hovered": isHovered || void 0,
|
|
29
|
+
"data-pressed": isPressed || void 0,
|
|
30
|
+
"data-disabled": isDisabled || void 0,
|
|
31
|
+
"data-selected": isSelected || void 0,
|
|
32
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
33
33
|
children: [
|
|
34
34
|
state.selectionMode === "multiple" && /* @__PURE__ */ jsx(Checkbox, { isDisabled, isSelected, isReadOnly: true }),
|
|
35
35
|
item.rendered
|
|
@@ -1,19 +1,25 @@
|
|
|
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.
|
|
13
19
|
*
|
|
14
20
|
*- `"multiline"` — tags wrap to multiple lines.
|
|
15
21
|
*- `"responsive"` — tags collapse into a summary (e.g., "3 more").
|
|
16
|
-
* @default
|
|
22
|
+
* @default 'responsive'
|
|
17
23
|
*/
|
|
18
24
|
selectedTagsOverflow?: SelectPropSelectedTagsOverflow;
|
|
19
25
|
/** Handler that is called when the clear button is clicked. */
|
|
@@ -28,6 +34,8 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
28
34
|
onSelectionChange?: Parameters<typeof useMultiSelectState>['0']['onSelectionChange'];
|
|
29
35
|
/** The currently selected keys in the collection (controlled). */
|
|
30
36
|
selectedKeys?: Parameters<typeof useMultiSelectState>['0']['selectedKeys'];
|
|
37
|
+
validate?: Parameters<typeof useMultiSelectState>['0']['validate'];
|
|
38
|
+
validationBehavior?: Parameters<typeof useMultiSelectState>['0']['validationBehavior'];
|
|
31
39
|
/**
|
|
32
40
|
* The type of selection that is allowed in the collection.
|
|
33
41
|
* @default 'single'
|
|
@@ -39,18 +47,24 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
39
47
|
endAddon?: ReactNode;
|
|
40
48
|
/** Inline styles. */
|
|
41
49
|
style?: CSSProperties;
|
|
42
|
-
/** An error message for the field. */
|
|
43
|
-
errorMessage?: ReactNode;
|
|
44
50
|
/**
|
|
45
51
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
46
|
-
* @default false
|
|
47
52
|
*/
|
|
48
53
|
isLabelHidden?: boolean;
|
|
54
|
+
/**
|
|
55
|
+
* The label's overall position relative to the element it is labeling.
|
|
56
|
+
* @default 'top'
|
|
57
|
+
*/
|
|
58
|
+
labelPlacement?: SelectPropLabelPlacement;
|
|
59
|
+
/**
|
|
60
|
+
* The label's horizontal alignment relative to the element it is labeling.
|
|
61
|
+
* @default 'start'
|
|
62
|
+
*/
|
|
63
|
+
labelAlign?: SelectPropLabelAlign;
|
|
49
64
|
/** The helper text content. */
|
|
50
65
|
caption?: ReactNode;
|
|
51
66
|
/**
|
|
52
67
|
* If true, the input will take up the full width of its container.
|
|
53
|
-
* @default false
|
|
54
68
|
*/
|
|
55
69
|
fullWidth?: boolean;
|
|
56
70
|
/** Unique identifier for testing purposes. */
|
|
@@ -66,7 +80,7 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
66
80
|
/** The props used for each slot inside. */
|
|
67
81
|
slotProps?: {
|
|
68
82
|
popover?: PopoverProps;
|
|
69
|
-
label?:
|
|
83
|
+
label?: FormControlLabelProps;
|
|
70
84
|
list?: ListProps<T>;
|
|
71
85
|
control?: FieldSelectProps;
|
|
72
86
|
caption?: FieldCaptionProps;
|
|
@@ -74,6 +88,6 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
74
88
|
errorMessage?: FieldErrorProps;
|
|
75
89
|
clearButton?: IconButtonProps;
|
|
76
90
|
};
|
|
77
|
-
}, Omit<AriaSelectProps<T>, 'description' | '
|
|
91
|
+
}, Omit<AriaSelectProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState' | 'selectedKey' | 'onSelectionChange' | 'defaultSelectedKey'>>;
|
|
78
92
|
export type SelectComponent = <T>(props: SelectProps<T>) => ReactElement | null;
|
|
79
93
|
export type SelectRef = ComponentRef<'div'>;
|
|
@@ -1,7 +1,12 @@
|
|
|
1
|
+
import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
|
|
1
2
|
const selectPropSelectedTagsOverflow = [
|
|
2
3
|
"multiline",
|
|
3
4
|
"responsive"
|
|
4
5
|
];
|
|
6
|
+
const selectPropLabelPlacement = formControlPropLabelPlacement;
|
|
7
|
+
const selectPropLabelAlign = formControlPropLabelAlign;
|
|
5
8
|
export {
|
|
9
|
+
selectPropLabelAlign,
|
|
10
|
+
selectPropLabelPlacement,
|
|
6
11
|
selectPropSelectedTagsOverflow
|
|
7
12
|
};
|
|
@@ -48,7 +48,6 @@ export type SidePanelProps = {
|
|
|
48
48
|
control?: SidePanelPropControl;
|
|
49
49
|
/**
|
|
50
50
|
* If `true`, the close button isn't shown.
|
|
51
|
-
* @default false
|
|
52
51
|
*/
|
|
53
52
|
hideCloseButton?: boolean;
|
|
54
53
|
/** Handler that is called when the modal's open state changes. */
|
|
@@ -60,17 +59,14 @@ export type SidePanelProps = {
|
|
|
60
59
|
portalContainer?: Element;
|
|
61
60
|
/**
|
|
62
61
|
* If `true`, the modal window won't close when clicked outside of it.
|
|
63
|
-
* @default false
|
|
64
62
|
*/
|
|
65
63
|
disableExitOnClickOutside?: boolean;
|
|
66
64
|
/**
|
|
67
65
|
* If `true`, the modal window won't close when the ESC key is pressed.
|
|
68
|
-
* @default false
|
|
69
66
|
*/
|
|
70
67
|
disableExitOnEscapeKeyDown?: boolean;
|
|
71
68
|
/**
|
|
72
69
|
* If `true`, the underlay (backdrop) under the modal window isn't shown.
|
|
73
|
-
* @default false
|
|
74
70
|
*/
|
|
75
71
|
hideBackdrop?: boolean;
|
|
76
72
|
/** Additional CSS-classes. */
|
|
@@ -79,7 +75,6 @@ export type SidePanelProps = {
|
|
|
79
75
|
'data-testid'?: string | number;
|
|
80
76
|
/**
|
|
81
77
|
* If `true`, the focus trap in modal window is disabled.
|
|
82
|
-
* @default false
|
|
83
78
|
*/
|
|
84
79
|
disableFocusManagement?: boolean;
|
|
85
80
|
/**
|
|
@@ -21,9 +21,9 @@ import { Cell } from "../Collections/Cell.js";
|
|
|
21
21
|
const textNormal = utilClasses.typography["text-normal"];
|
|
22
22
|
function TableRender(props, ref) {
|
|
23
23
|
const {
|
|
24
|
-
stickyHeader = false,
|
|
25
|
-
fullWidth = false,
|
|
26
24
|
divider = "none",
|
|
25
|
+
stickyHeader,
|
|
26
|
+
fullWidth,
|
|
27
27
|
slotProps,
|
|
28
28
|
selectionMode,
|
|
29
29
|
selectionBehavior,
|
|
@@ -41,9 +41,9 @@ function TableRender(props, ref) {
|
|
|
41
41
|
const tableProps = mergeProps(
|
|
42
42
|
{
|
|
43
43
|
className: clsx(s.base, fullWidth && s.fullWidth, textNormal, className),
|
|
44
|
-
"data-sticky-header": stickyHeader,
|
|
44
|
+
"data-sticky-header": stickyHeader || void 0,
|
|
45
45
|
"data-divider": divider,
|
|
46
|
-
"data-fullwidth": fullWidth,
|
|
46
|
+
"data-fullwidth": fullWidth || void 0,
|
|
47
47
|
ref: domRef,
|
|
48
48
|
style
|
|
49
49
|
},
|
|
@@ -29,11 +29,11 @@ function TableRow({ item, children, state }) {
|
|
|
29
29
|
isFocusVisible && s.focusVisible,
|
|
30
30
|
className
|
|
31
31
|
),
|
|
32
|
-
"data-hovered": isHovered,
|
|
33
|
-
"data-disabled": isDisabled,
|
|
34
|
-
"data-selected": isSelected,
|
|
35
|
-
"data-pressed": isPressed,
|
|
36
|
-
"data-focus-visible": isFocusVisible,
|
|
32
|
+
"data-hovered": isHovered || void 0,
|
|
33
|
+
"data-disabled": isDisabled || void 0,
|
|
34
|
+
"data-selected": isSelected || void 0,
|
|
35
|
+
"data-pressed": isPressed || void 0,
|
|
36
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
37
37
|
...mergeProps(rowProps, hoverProps, focusProps),
|
|
38
38
|
style,
|
|
39
39
|
ref,
|