@koobiq/react-components 0.4.0 → 0.5.1
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/DateInput/types.d.ts +3 -3
- package/dist/components/DateInput/types.js +2 -1
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.d.ts +2 -2
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.d.ts +1 -1
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.js +2 -2
- package/dist/components/FieldComponents/FieldContentGroup/types.d.ts +4 -4
- package/dist/components/FieldComponents/FieldContentGroup/types.js +4 -0
- package/dist/components/FieldComponents/FieldInput/FieldInput.d.ts +2 -2
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.d.ts +2 -2
- package/dist/components/FieldComponents/FieldSelect/types.d.ts +2 -2
- package/dist/components/Input/Input.d.ts +3 -3
- package/dist/components/Input/types.d.ts +4 -4
- package/dist/components/Input/types.js +2 -1
- package/dist/components/InputNumber/InputNumber.d.ts +2 -2
- package/dist/components/InputNumber/components/InputNumberCounterControls.js +2 -2
- package/dist/components/InputNumber/types.d.ts +3 -3
- package/dist/components/InputNumber/types.js +2 -1
- package/dist/components/SearchInput/SearchInput.d.ts +21 -0
- package/dist/components/SearchInput/SearchInput.js +119 -0
- package/dist/components/SearchInput/SearchInput.module.css.js +17 -0
- package/dist/components/SearchInput/index.d.ts +2 -0
- package/dist/components/SearchInput/types.d.ts +47 -0
- package/dist/components/SearchInput/types.js +5 -0
- 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 +3 -3
- package/dist/components/Textarea/types.d.ts +2 -2
- package/dist/components/Textarea/types.js +2 -1
- package/dist/components/TimePicker/types.d.ts +2 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/index.js +4 -0
- package/dist/style.css +38 -5
- package/package.json +5 -5
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { AriaDateFieldProps, DateValue } from '@koobiq/react-primitives';
|
|
3
|
-
import type
|
|
3
|
+
import { type FieldCaptionProps, type FieldControlProps, type FieldErrorProps, type FieldInputDateProps, type FieldContentGroupProps, type FieldLabelProps, type FieldContentGroupPropVariant } from '../FieldComponents';
|
|
4
4
|
export declare const dateInputPropVariant: readonly ["filled", "transparent"];
|
|
5
|
-
export type DateInputPropVariant =
|
|
5
|
+
export type DateInputPropVariant = FieldContentGroupPropVariant;
|
|
6
6
|
export type DateInputProps<T extends DateValue> = {
|
|
7
7
|
/** Inline styles. */
|
|
8
8
|
style?: CSSProperties;
|
|
@@ -26,7 +26,7 @@ export type DateInputProps<T extends DateValue> = {
|
|
|
26
26
|
slotProps?: {
|
|
27
27
|
root?: FieldControlProps;
|
|
28
28
|
label?: FieldLabelProps;
|
|
29
|
-
group?:
|
|
29
|
+
group?: FieldContentGroupProps;
|
|
30
30
|
caption?: FieldCaptionProps;
|
|
31
31
|
inputDate?: FieldInputDateProps;
|
|
32
32
|
errorMessage?: FieldErrorProps;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const FieldContentGroup: import("react").ForwardRefExoticComponent<Omit<
|
|
1
|
+
import type { FieldContentGroupProps } from './index';
|
|
2
|
+
export declare const FieldContentGroup: import("react").ForwardRefExoticComponent<Omit<FieldContentGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -7,4 +7,4 @@ export type FieldContentGroupContextProps = {
|
|
|
7
7
|
isInvalid?: boolean;
|
|
8
8
|
};
|
|
9
9
|
export declare const FieldContentGroupContext: import("react").Context<FieldContentGroupContextProps>;
|
|
10
|
-
export declare const
|
|
10
|
+
export declare const useFieldContentGroup: () => FieldContentGroupContextProps;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createContext, useContext } from "react";
|
|
2
2
|
const FieldContentGroupContext = createContext({});
|
|
3
|
-
const
|
|
3
|
+
const useFieldContentGroup = () => useContext(FieldContentGroupContext);
|
|
4
4
|
export {
|
|
5
5
|
FieldContentGroupContext,
|
|
6
|
-
|
|
6
|
+
useFieldContentGroup
|
|
7
7
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
|
|
3
3
|
import type { FieldAddonProps } from '../FieldAddon';
|
|
4
|
-
export declare const
|
|
5
|
-
export type
|
|
6
|
-
export type
|
|
4
|
+
export declare const fieldContentGroupPropVariant: readonly ["filled", "transparent"];
|
|
5
|
+
export type FieldContentGroupPropVariant = (typeof fieldContentGroupPropVariant)[number];
|
|
6
|
+
export type FieldContentGroupProps = ExtendableComponentPropsWithRef<{
|
|
7
7
|
/** The content of the component. */
|
|
8
8
|
children?: ReactNode;
|
|
9
9
|
/** Addon placed before the children. */
|
|
@@ -14,7 +14,7 @@ export type FieldInputGroupProps = ExtendableComponentPropsWithRef<{
|
|
|
14
14
|
* The variant to use.
|
|
15
15
|
* @default 'filled'
|
|
16
16
|
*/
|
|
17
|
-
variant?:
|
|
17
|
+
variant?: FieldContentGroupPropVariant;
|
|
18
18
|
/** Whether the input is disabled. */
|
|
19
19
|
isDisabled?: boolean;
|
|
20
20
|
/** Additional CSS-classes. */
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { ComponentPropsWithRef } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldContentGroupPropVariant } from '../FieldContentGroup';
|
|
3
3
|
export type FieldInputBaseProps = {
|
|
4
4
|
isInvalid?: boolean;
|
|
5
5
|
isDisabled?: boolean;
|
|
6
6
|
className?: string;
|
|
7
7
|
'data-testid'?: string;
|
|
8
8
|
as?: 'input' | 'textarea';
|
|
9
|
-
variant?:
|
|
9
|
+
variant?: FieldContentGroupPropVariant;
|
|
10
10
|
};
|
|
11
11
|
export declare const FieldInput: import("@koobiq/react-core").PolyForwardComponent<"input", FieldInputBaseProps, "input" | "textarea">;
|
|
12
12
|
export type FieldInputProps<As extends 'input' | 'textarea' = 'input'> = ComponentPropsWithRef<typeof FieldInput<As>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type ReactNode, type Ref } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldContentGroupPropVariant } from '../FieldContentGroup';
|
|
3
3
|
export type FieldInputDateProps = {
|
|
4
4
|
isInvalid?: boolean;
|
|
5
5
|
isDisabled?: boolean;
|
|
@@ -7,6 +7,6 @@ export type FieldInputDateProps = {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
'data-testid'?: string;
|
|
9
9
|
ref?: Ref<HTMLDivElement>;
|
|
10
|
-
variant?:
|
|
10
|
+
variant?: FieldContentGroupPropVariant;
|
|
11
11
|
};
|
|
12
12
|
export declare const FieldInputDate: import("react").ForwardRefExoticComponent<Omit<FieldInputDateProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import type {
|
|
2
|
+
import type { FieldContentGroupPropVariant } from '../FieldContentGroup';
|
|
3
3
|
export type FieldSelectBaseProps = {
|
|
4
4
|
isInvalid?: boolean;
|
|
5
5
|
isDisabled?: boolean;
|
|
@@ -7,5 +7,5 @@ export type FieldSelectBaseProps = {
|
|
|
7
7
|
children?: ReactNode;
|
|
8
8
|
'data-testid'?: string;
|
|
9
9
|
placeholder?: string | number;
|
|
10
|
-
variant?:
|
|
10
|
+
variant?: FieldContentGroupPropVariant;
|
|
11
11
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { TextField } from '@koobiq/react-primitives';
|
|
2
|
-
import { type FieldLabelProps, type
|
|
2
|
+
import { type FieldLabelProps, type FieldContentGroupProps, type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldControlProps } from '../FieldComponents';
|
|
3
3
|
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "style" | "className" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
error?: boolean;
|
|
@@ -21,9 +21,9 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
|
21
21
|
root?: FieldControlProps<typeof TextField<HTMLInputElement>>;
|
|
22
22
|
label?: FieldLabelProps;
|
|
23
23
|
caption?: FieldCaptionProps;
|
|
24
|
-
group?:
|
|
24
|
+
group?: FieldContentGroupProps;
|
|
25
25
|
errorMessage?: FieldErrorProps;
|
|
26
|
-
input?: FieldInputProps
|
|
26
|
+
input?: FieldInputProps;
|
|
27
27
|
};
|
|
28
28
|
} & {
|
|
29
29
|
disabled?: boolean;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { TextField, TextFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import type
|
|
4
|
+
import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldLabelProps, type FieldContentGroupProps, type FieldControlProps, type FieldContentGroupPropVariant } from '../FieldComponents';
|
|
5
5
|
export declare const inputPropVariant: readonly ["filled", "transparent"];
|
|
6
|
-
export type InputPropVariant =
|
|
6
|
+
export type InputPropVariant = FieldContentGroupPropVariant;
|
|
7
7
|
type InputDeprecatedProps = {
|
|
8
8
|
/**
|
|
9
9
|
* If `true`, the component is disabled.
|
|
@@ -76,9 +76,9 @@ export type InputProps = ExtendableProps<{
|
|
|
76
76
|
root?: FieldControlProps<typeof TextField<HTMLInputElement>>;
|
|
77
77
|
label?: FieldLabelProps;
|
|
78
78
|
caption?: FieldCaptionProps;
|
|
79
|
-
group?:
|
|
79
|
+
group?: FieldContentGroupProps;
|
|
80
80
|
errorMessage?: FieldErrorProps;
|
|
81
|
-
input?: FieldInputProps
|
|
81
|
+
input?: FieldInputProps;
|
|
82
82
|
};
|
|
83
83
|
} & InputDeprecatedProps, Omit<TextFieldProps<HTMLInputElement>, 'description' | 'validationBehavior' | 'validate' | 'children' | 'inputElementType'>>;
|
|
84
84
|
export type InputRef = ComponentRef<'input'>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { NumberField } from '@koobiq/react-primitives';
|
|
2
|
-
import { type FieldControlProps, type FieldLabelProps, type FieldCaptionProps, type FieldErrorProps, type
|
|
2
|
+
import { type FieldControlProps, type FieldLabelProps, type FieldCaptionProps, type FieldErrorProps, type FieldContentGroupProps, type FieldInputProps } from '../FieldComponents';
|
|
3
3
|
export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").NumberFieldProps, "children" | "validationState" | "description" | "inputElementType">, "caption" | "style" | "className" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
error?: boolean;
|
|
@@ -22,7 +22,7 @@ export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit
|
|
|
22
22
|
label?: FieldLabelProps;
|
|
23
23
|
input?: FieldInputProps;
|
|
24
24
|
caption?: FieldCaptionProps;
|
|
25
|
-
group?:
|
|
25
|
+
group?: FieldContentGroupProps;
|
|
26
26
|
errorMessage?: FieldErrorProps;
|
|
27
27
|
};
|
|
28
28
|
} & {
|
|
@@ -2,10 +2,10 @@ import { jsxs, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { clsx } from "@koobiq/react-core";
|
|
3
3
|
import { IconChevronUpS16, IconChevronDownS16 } from "@koobiq/react-icons";
|
|
4
4
|
import s from "./InputNumberCounterControls.module.css.js";
|
|
5
|
-
import {
|
|
5
|
+
import { useFieldContentGroup } from "../../FieldComponents/FieldContentGroup/FieldContentGroupContext.js";
|
|
6
6
|
import { IconButton } from "../../IconButton/IconButton.js";
|
|
7
7
|
const InputNumberCounterControls = () => {
|
|
8
|
-
const { isInvalid } =
|
|
8
|
+
const { isInvalid } = useFieldContentGroup();
|
|
9
9
|
const variant = isInvalid ? "error" : "fade-contrast";
|
|
10
10
|
return /* @__PURE__ */ jsxs("div", { className: s.base, children: [
|
|
11
11
|
/* @__PURE__ */ jsx(
|
|
@@ -1,9 +1,9 @@
|
|
|
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
|
|
4
|
+
import { type FieldCaptionProps, type FieldControlProps, type FieldErrorProps, type FieldContentGroupProps, type FieldInputProps, type FieldLabelProps, type FieldContentGroupPropVariant } from '../FieldComponents';
|
|
5
5
|
export declare const inputNumberPropVariant: readonly ["filled", "transparent"];
|
|
6
|
-
export type InputNumberPropVariant =
|
|
6
|
+
export type InputNumberPropVariant = FieldContentGroupPropVariant;
|
|
7
7
|
type InputNumberDeprecatedProps = {
|
|
8
8
|
/**
|
|
9
9
|
* If `true`, the component is disabled.
|
|
@@ -77,7 +77,7 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
77
77
|
label?: FieldLabelProps;
|
|
78
78
|
input?: FieldInputProps;
|
|
79
79
|
caption?: FieldCaptionProps;
|
|
80
|
-
group?:
|
|
80
|
+
group?: FieldContentGroupProps;
|
|
81
81
|
errorMessage?: FieldErrorProps;
|
|
82
82
|
};
|
|
83
83
|
} & InputNumberDeprecatedProps, Omit<NumberFieldProps, 'description' | 'children' | 'inputElementType' | 'validationState'>>;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type FieldCaptionProps, type FieldContentGroupProps, type FieldControlProps, type FieldErrorProps, type FieldInputProps, type FieldLabelProps } from '../FieldComponents';
|
|
2
|
+
export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/searchfield").AriaSearchFieldProps, "validationState" | "description" | "errorMessage">, "caption" | "style" | "className" | "variant" | "slotProps" | "fullWidth" | `data-${string}` | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden"> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
style?: import("react").CSSProperties;
|
|
5
|
+
isLabelHidden?: boolean;
|
|
6
|
+
startAddon?: import("react").ReactNode;
|
|
7
|
+
endAddon?: import("react").ReactNode;
|
|
8
|
+
slotProps?: {
|
|
9
|
+
root?: FieldControlProps;
|
|
10
|
+
label?: FieldLabelProps;
|
|
11
|
+
group?: FieldContentGroupProps;
|
|
12
|
+
input?: FieldInputProps;
|
|
13
|
+
caption?: FieldCaptionProps;
|
|
14
|
+
errorMessage?: FieldErrorProps;
|
|
15
|
+
clearButton?: import("..").IconButtonProps;
|
|
16
|
+
};
|
|
17
|
+
errorMessage?: import("react").ReactNode;
|
|
18
|
+
caption?: import("react").ReactNode;
|
|
19
|
+
variant?: import("./types").SearchInputPropVariant;
|
|
20
|
+
fullWidth?: boolean;
|
|
21
|
+
} & import("@koobiq/react-core").DataAttributeProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
|
+
import { IconMagnifyingGlass16, IconXmarkCircle16 } from "@koobiq/react-icons";
|
|
6
|
+
import { useSearchFieldState, removeDataAttributes, useSearchField } from "@koobiq/react-primitives";
|
|
7
|
+
import s from "./SearchInput.module.css.js";
|
|
8
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
9
|
+
import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
|
|
10
|
+
import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
|
|
11
|
+
import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
|
|
12
|
+
import { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
|
|
13
|
+
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
14
|
+
import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
|
|
15
|
+
const SearchInput = forwardRef(
|
|
16
|
+
(props, ref) => {
|
|
17
|
+
const {
|
|
18
|
+
startAddon = /* @__PURE__ */ jsx(IconMagnifyingGlass16, { className: s.searchIcon }),
|
|
19
|
+
variant = "filled",
|
|
20
|
+
fullWidth = false,
|
|
21
|
+
isLabelHidden = false,
|
|
22
|
+
"data-testid": testId,
|
|
23
|
+
style,
|
|
24
|
+
className,
|
|
25
|
+
caption,
|
|
26
|
+
errorMessage,
|
|
27
|
+
isRequired,
|
|
28
|
+
isReadOnly,
|
|
29
|
+
label,
|
|
30
|
+
endAddon,
|
|
31
|
+
isInvalid,
|
|
32
|
+
isDisabled,
|
|
33
|
+
slotProps
|
|
34
|
+
} = props;
|
|
35
|
+
const state = useSearchFieldState(removeDataAttributes(props));
|
|
36
|
+
const domRef = useDOMRef(ref);
|
|
37
|
+
const hasClearButton = state.value !== "" && !isDisabled && !isReadOnly;
|
|
38
|
+
const {
|
|
39
|
+
labelProps: labelPropsAria,
|
|
40
|
+
inputProps: inputPropsAria,
|
|
41
|
+
descriptionProps: descriptionPropsAria,
|
|
42
|
+
errorMessageProps: errorMessagePropsAria,
|
|
43
|
+
clearButtonProps: clearButtonPropsAria
|
|
44
|
+
} = useSearchField(removeDataAttributes(props), state, domRef);
|
|
45
|
+
const rootProps = mergeProps(
|
|
46
|
+
{
|
|
47
|
+
style,
|
|
48
|
+
fullWidth,
|
|
49
|
+
"data-testid": testId,
|
|
50
|
+
"data-variant": variant,
|
|
51
|
+
"data-invalid": isInvalid,
|
|
52
|
+
"data-disabled": isDisabled,
|
|
53
|
+
"data-fullwidth": fullWidth,
|
|
54
|
+
"data-required": isRequired,
|
|
55
|
+
"data-readonly": isReadOnly,
|
|
56
|
+
className: clsx(s.base, className)
|
|
57
|
+
},
|
|
58
|
+
slotProps?.root
|
|
59
|
+
);
|
|
60
|
+
const labelProps = mergeProps(
|
|
61
|
+
{ isHidden: isLabelHidden, isRequired, children: label },
|
|
62
|
+
slotProps?.label,
|
|
63
|
+
labelPropsAria
|
|
64
|
+
);
|
|
65
|
+
const inputProps = mergeProps(
|
|
66
|
+
{
|
|
67
|
+
variant,
|
|
68
|
+
isInvalid,
|
|
69
|
+
isDisabled,
|
|
70
|
+
ref: domRef,
|
|
71
|
+
className: s.input
|
|
72
|
+
},
|
|
73
|
+
slotProps?.input,
|
|
74
|
+
inputPropsAria
|
|
75
|
+
);
|
|
76
|
+
const groupProps = mergeProps(
|
|
77
|
+
{
|
|
78
|
+
slotProps: { startAddon: { className: s.startAddon } },
|
|
79
|
+
startAddon,
|
|
80
|
+
endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
81
|
+
hasClearButton && /* @__PURE__ */ jsx(
|
|
82
|
+
IconButton,
|
|
83
|
+
{
|
|
84
|
+
...clearButtonPropsAria,
|
|
85
|
+
variant: isInvalid ? "error" : "fade-contrast",
|
|
86
|
+
...slotProps?.clearButton,
|
|
87
|
+
className: clsx(
|
|
88
|
+
s.clearButton,
|
|
89
|
+
slotProps?.clearButton?.className
|
|
90
|
+
),
|
|
91
|
+
children: /* @__PURE__ */ jsx(IconXmarkCircle16, {})
|
|
92
|
+
}
|
|
93
|
+
),
|
|
94
|
+
endAddon
|
|
95
|
+
] }),
|
|
96
|
+
variant,
|
|
97
|
+
isInvalid,
|
|
98
|
+
isDisabled
|
|
99
|
+
},
|
|
100
|
+
slotProps?.group
|
|
101
|
+
);
|
|
102
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionPropsAria);
|
|
103
|
+
const errorProps = mergeProps(
|
|
104
|
+
{ isInvalid, children: errorMessage },
|
|
105
|
+
slotProps?.errorMessage,
|
|
106
|
+
errorMessagePropsAria
|
|
107
|
+
);
|
|
108
|
+
return /* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
|
|
109
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps, children: label }),
|
|
110
|
+
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
111
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
112
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
113
|
+
] });
|
|
114
|
+
}
|
|
115
|
+
);
|
|
116
|
+
SearchInput.displayName = "SearchInput";
|
|
117
|
+
export {
|
|
118
|
+
SearchInput
|
|
119
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const input = "kbq-searchinput-input-f896b1";
|
|
2
|
+
const startAddon = "kbq-searchinput-startAddon-08187f";
|
|
3
|
+
const searchIcon = "kbq-searchinput-searchIcon-8bce0f";
|
|
4
|
+
const clearButton = "kbq-searchinput-clearButton-71f872";
|
|
5
|
+
const s = {
|
|
6
|
+
input,
|
|
7
|
+
startAddon,
|
|
8
|
+
searchIcon,
|
|
9
|
+
clearButton
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
clearButton,
|
|
13
|
+
s as default,
|
|
14
|
+
input,
|
|
15
|
+
searchIcon,
|
|
16
|
+
startAddon
|
|
17
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ComponentRef, CSSProperties, ReactNode } from 'react';
|
|
2
|
+
import type { DataAttributeProps, ExtendableProps } from '@koobiq/react-core';
|
|
3
|
+
import type { AriaSearchFieldProps } from '@koobiq/react-primitives';
|
|
4
|
+
import type { FieldCaptionProps, FieldErrorProps, FieldInputProps, FieldLabelProps, FieldContentGroupProps, FieldContentGroupPropVariant, FieldControlProps } from '../FieldComponents';
|
|
5
|
+
import type { IconButtonProps } from '../IconButton';
|
|
6
|
+
export declare const searchInputPropVariant: readonly ["filled", "transparent"];
|
|
7
|
+
export type SearchInputPropVariant = FieldContentGroupPropVariant;
|
|
8
|
+
export type SearchInputProps = ExtendableProps<{
|
|
9
|
+
/** Additional CSS-classes. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Inline styles */
|
|
12
|
+
style?: CSSProperties;
|
|
13
|
+
/**
|
|
14
|
+
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
isLabelHidden?: boolean;
|
|
18
|
+
/** Addon placed before the children. */
|
|
19
|
+
startAddon?: ReactNode;
|
|
20
|
+
/** Addon placed after the children. */
|
|
21
|
+
endAddon?: ReactNode;
|
|
22
|
+
/** The props used for each slot inside. */
|
|
23
|
+
slotProps?: {
|
|
24
|
+
root?: FieldControlProps;
|
|
25
|
+
label?: FieldLabelProps;
|
|
26
|
+
group?: FieldContentGroupProps;
|
|
27
|
+
input?: FieldInputProps;
|
|
28
|
+
caption?: FieldCaptionProps;
|
|
29
|
+
errorMessage?: FieldErrorProps;
|
|
30
|
+
clearButton?: IconButtonProps;
|
|
31
|
+
};
|
|
32
|
+
/** An error message for the field. */
|
|
33
|
+
errorMessage?: ReactNode;
|
|
34
|
+
/** The helper text content. */
|
|
35
|
+
caption?: ReactNode;
|
|
36
|
+
/**
|
|
37
|
+
* The variant to use.
|
|
38
|
+
* @default 'filled'
|
|
39
|
+
*/
|
|
40
|
+
variant?: SearchInputPropVariant;
|
|
41
|
+
/**
|
|
42
|
+
* If `true`, the input will take up the full width of its container.
|
|
43
|
+
* @default false
|
|
44
|
+
*/
|
|
45
|
+
fullWidth?: boolean;
|
|
46
|
+
} & DataAttributeProps, Omit<AriaSearchFieldProps, 'description' | 'errorMessage' | 'validationState'>>;
|
|
47
|
+
export type SearchInputRef = ComponentRef<'input'>;
|
|
@@ -3,14 +3,14 @@ import { useLocalizedStringFormatter, clsx } from "@koobiq/react-core";
|
|
|
3
3
|
import intlMessages from "../../intl.js";
|
|
4
4
|
import s from "./TagGroup.module.css.js";
|
|
5
5
|
import { Tag } from "../Tag/Tag.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useFieldContentGroup } from "../../../FieldComponents/FieldContentGroup/FieldContentGroupContext.js";
|
|
7
7
|
const TagGroupMultiline = ({
|
|
8
8
|
state,
|
|
9
9
|
states
|
|
10
10
|
}) => {
|
|
11
11
|
const { isDisabled, isInvalid } = states;
|
|
12
12
|
const t = useLocalizedStringFormatter(intlMessages);
|
|
13
|
-
const { hasStartAddon } =
|
|
13
|
+
const { hasStartAddon } = useFieldContentGroup();
|
|
14
14
|
return /* @__PURE__ */ jsx(
|
|
15
15
|
"div",
|
|
16
16
|
{
|
|
@@ -3,7 +3,7 @@ import { useHideOverflowItems, useLocalizedStringFormatter, clsx } from "@koobiq
|
|
|
3
3
|
import intlMessages from "../../intl.js";
|
|
4
4
|
import s from "./TagGroup.module.css.js";
|
|
5
5
|
import { getHiddenCount } from "./utils.js";
|
|
6
|
-
import {
|
|
6
|
+
import { useFieldContentGroup } from "../../../FieldComponents/FieldContentGroup/FieldContentGroupContext.js";
|
|
7
7
|
import { Tag } from "../Tag/Tag.js";
|
|
8
8
|
const TagGroupResponsive = ({
|
|
9
9
|
state,
|
|
@@ -17,7 +17,7 @@ const TagGroupResponsive = ({
|
|
|
17
17
|
});
|
|
18
18
|
const hiddenCount = getHiddenCount(visibleMap);
|
|
19
19
|
const t = useLocalizedStringFormatter(intlMessages);
|
|
20
|
-
const { hasStartAddon } =
|
|
20
|
+
const { hasStartAddon } = useFieldContentGroup();
|
|
21
21
|
return /* @__PURE__ */ jsxs(
|
|
22
22
|
"div",
|
|
23
23
|
{
|
|
@@ -1,7 +1,7 @@
|
|
|
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 { FieldErrorProps, FieldLabelProps, FieldSelectProps, FieldCaptionProps,
|
|
4
|
+
import type { FieldErrorProps, FieldLabelProps, FieldSelectProps, FieldCaptionProps, FieldContentGroupProps } from '../FieldComponents';
|
|
5
5
|
import type { IconButtonProps } from '../IconButton';
|
|
6
6
|
import type { ListProps } from '../List';
|
|
7
7
|
import type { PopoverProps } from '../Popover';
|
|
@@ -68,9 +68,9 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
68
68
|
popover?: PopoverProps;
|
|
69
69
|
label?: FieldLabelProps;
|
|
70
70
|
list?: ListProps<T>;
|
|
71
|
-
control?: FieldSelectProps
|
|
71
|
+
control?: FieldSelectProps;
|
|
72
72
|
caption?: FieldCaptionProps;
|
|
73
|
-
group?:
|
|
73
|
+
group?: FieldContentGroupProps;
|
|
74
74
|
errorMessage?: FieldErrorProps;
|
|
75
75
|
clearButton?: IconButtonProps;
|
|
76
76
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ComponentRef, ReactNode } from 'react';
|
|
2
2
|
import type { ExtendableProps } from '@koobiq/react-core';
|
|
3
3
|
import type { TextFieldProps } from '@koobiq/react-primitives';
|
|
4
|
-
import type
|
|
4
|
+
import { type FieldCaptionProps, type FieldContentGroupPropVariant, type FieldErrorProps, type FieldInputProps, type FieldLabelProps } from '../FieldComponents';
|
|
5
5
|
export declare const textareaPropVariant: readonly ["filled", "transparent"];
|
|
6
|
-
export type TextareaPropVariant =
|
|
6
|
+
export type TextareaPropVariant = FieldContentGroupPropVariant;
|
|
7
7
|
export declare const textareaPropExpand: readonly ["auto-size", "vertical-resize"];
|
|
8
8
|
export type TextareaPropExpand = (typeof textareaPropExpand)[number];
|
|
9
9
|
type TextareaDeprecatedProps = {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
|
|
2
|
+
const textareaPropVariant = fieldContentGroupPropVariant;
|
|
2
3
|
const textareaPropExpand = ["auto-size", "vertical-resize"];
|
|
3
4
|
export {
|
|
4
5
|
textareaPropExpand,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
2
|
import type { AriaTimeFieldProps, TimeValue } from '@koobiq/react-primitives';
|
|
3
3
|
import type { DateInputPropVariant } from '../DateInput';
|
|
4
|
-
import type { FieldCaptionProps, FieldControlProps, FieldErrorProps, FieldInputDateProps,
|
|
4
|
+
import type { FieldCaptionProps, FieldControlProps, FieldErrorProps, FieldInputDateProps, FieldContentGroupProps, FieldLabelProps } from '../FieldComponents';
|
|
5
5
|
export type TimePickerProps<T extends TimeValue> = {
|
|
6
6
|
/** Inline styles. */
|
|
7
7
|
style?: CSSProperties;
|
|
@@ -25,7 +25,7 @@ export type TimePickerProps<T extends TimeValue> = {
|
|
|
25
25
|
slotProps?: {
|
|
26
26
|
root?: FieldControlProps;
|
|
27
27
|
label?: FieldLabelProps;
|
|
28
|
-
group?:
|
|
28
|
+
group?: FieldContentGroupProps;
|
|
29
29
|
caption?: FieldCaptionProps;
|
|
30
30
|
inputDate?: FieldInputDateProps;
|
|
31
31
|
errorMessage?: FieldErrorProps;
|
|
@@ -34,6 +34,7 @@ export * from './Calendar';
|
|
|
34
34
|
export * from './DateInput';
|
|
35
35
|
export * from './DatePicker';
|
|
36
36
|
export * from './TimePicker';
|
|
37
|
+
export * from './SearchInput';
|
|
37
38
|
export * from './layout';
|
|
38
39
|
export { useListData, type ListData, type ListOptions, type TimeValue, type DateValue, } from '@koobiq/react-primitives';
|
|
39
40
|
export { useRouter, useLocale, type Locale, RouterProvider, useDateFormatter, } from '@koobiq/react-core';
|
package/dist/index.js
CHANGED
|
@@ -77,6 +77,8 @@ import { DateInput, DateInputRender } from "./components/DateInput/DateInput.js"
|
|
|
77
77
|
import { dateInputPropVariant } from "./components/DateInput/types.js";
|
|
78
78
|
import { DatePicker, DatePickerRender } from "./components/DatePicker/DatePicker.js";
|
|
79
79
|
import { TimePicker, TimePickerRender } from "./components/TimePicker/TimePicker.js";
|
|
80
|
+
import { SearchInput } from "./components/SearchInput/SearchInput.js";
|
|
81
|
+
import { searchInputPropVariant } from "./components/SearchInput/types.js";
|
|
80
82
|
import { flex, flexPropAlignItems, flexPropDirection, flexPropFlex, flexPropGap, flexPropJustifyContent, flexPropOrder, flexPropWrap } from "./components/layout/flex/flex.js";
|
|
81
83
|
import { spacing, spacingGap } from "./components/layout/spacing/spacing.js";
|
|
82
84
|
export {
|
|
@@ -127,6 +129,7 @@ export {
|
|
|
127
129
|
RadioGroupDescription,
|
|
128
130
|
RadioGroupLabel,
|
|
129
131
|
RouterProvider,
|
|
132
|
+
SearchInput,
|
|
130
133
|
Select,
|
|
131
134
|
SidePanel,
|
|
132
135
|
SidePanelContent,
|
|
@@ -178,6 +181,7 @@ export {
|
|
|
178
181
|
radioGroupPropSize,
|
|
179
182
|
radioPropLabelPlacement,
|
|
180
183
|
radioPropSize,
|
|
184
|
+
searchInputPropVariant,
|
|
181
185
|
selectPropSelectedTagsOverflow,
|
|
182
186
|
sidePanelPropPlacement,
|
|
183
187
|
sidePanelPropPosition,
|
package/dist/style.css
CHANGED
|
@@ -1944,7 +1944,7 @@
|
|
|
1944
1944
|
letter-spacing: var(--kbq-typography-text-normal-letter-spacing);
|
|
1945
1945
|
text-underline-offset: calc(( var(--kbq-typography-text-normal-line-height) - var(--kbq-typography-text-normal-font-size)) / 2);
|
|
1946
1946
|
color: var(--kbq-foreground-contrast-secondary);
|
|
1947
|
-
margin-block-end: var(--kbq-size-
|
|
1947
|
+
margin-block-end: var(--kbq-size-xs);
|
|
1948
1948
|
}
|
|
1949
1949
|
|
|
1950
1950
|
.kbq-fieldlabel-hidden-9f53e4 {
|
|
@@ -2014,6 +2014,16 @@
|
|
|
2014
2014
|
inset: 0;
|
|
2015
2015
|
}
|
|
2016
2016
|
|
|
2017
|
+
.kbq-fieldcontentgroup-d85be3 + * {
|
|
2018
|
+
margin: 0;
|
|
2019
|
+
margin-block-start: var(--kbq-size-xs);
|
|
2020
|
+
}
|
|
2021
|
+
|
|
2022
|
+
.kbq-fieldcontentgroup-d85be3 + * + * {
|
|
2023
|
+
margin: 0;
|
|
2024
|
+
margin-block-start: var(--kbq-size-xxs);
|
|
2025
|
+
}
|
|
2026
|
+
|
|
2017
2027
|
.kbq-fieldcontentgroup-hasStartAddon-62fb80 {
|
|
2018
2028
|
--field-control-start-addon-inline-size: 36px;
|
|
2019
2029
|
}
|
|
@@ -2168,9 +2178,7 @@
|
|
|
2168
2178
|
letter-spacing: var(--kbq-typography-text-compact-letter-spacing);
|
|
2169
2179
|
text-underline-offset: calc(( var(--kbq-typography-text-compact-line-height) - var(--kbq-typography-text-compact-font-size)) / 2);
|
|
2170
2180
|
color: var(--kbq-foreground-contrast-secondary);
|
|
2171
|
-
margin: 0;
|
|
2172
2181
|
transition: color var(--kbq-transition-default);
|
|
2173
|
-
margin-block-start: var(--kbq-size-xxs);
|
|
2174
2182
|
}
|
|
2175
2183
|
.kbq-fielderror-a0b0a4 {
|
|
2176
2184
|
inline-size: 100%;
|
|
@@ -2184,9 +2192,7 @@
|
|
|
2184
2192
|
letter-spacing: var(--kbq-typography-text-compact-letter-spacing);
|
|
2185
2193
|
text-underline-offset: calc(( var(--kbq-typography-text-compact-line-height) - var(--kbq-typography-text-compact-font-size)) / 2);
|
|
2186
2194
|
color: var(--kbq-foreground-error);
|
|
2187
|
-
margin: 0;
|
|
2188
2195
|
transition: color var(--kbq-transition-default);
|
|
2189
|
-
margin-block-start: var(--kbq-size-xxs);
|
|
2190
2196
|
}
|
|
2191
2197
|
.kbq-textarea-auto-size-566580 {
|
|
2192
2198
|
resize: none;
|
|
@@ -4028,6 +4034,33 @@
|
|
|
4028
4034
|
.kbq-timepicker-startAddon-46c835 > :not(.kbq-timepicker-clock-920ed0) {
|
|
4029
4035
|
pointer-events: all;
|
|
4030
4036
|
}
|
|
4037
|
+
.kbq-searchinput-input-f896b1::-webkit-search-decoration {
|
|
4038
|
+
appearance: none;
|
|
4039
|
+
}
|
|
4040
|
+
|
|
4041
|
+
.kbq-searchinput-input-f896b1::-webkit-search-cancel-button {
|
|
4042
|
+
appearance: none;
|
|
4043
|
+
}
|
|
4044
|
+
|
|
4045
|
+
.kbq-searchinput-input-f896b1::-webkit-search-results-button {
|
|
4046
|
+
appearance: none;
|
|
4047
|
+
}
|
|
4048
|
+
|
|
4049
|
+
.kbq-searchinput-input-f896b1::-webkit-search-results-decoration {
|
|
4050
|
+
appearance: none;
|
|
4051
|
+
}
|
|
4052
|
+
|
|
4053
|
+
.kbq-searchinput-startAddon-08187f {
|
|
4054
|
+
pointer-events: none;
|
|
4055
|
+
}
|
|
4056
|
+
|
|
4057
|
+
.kbq-searchinput-startAddon-08187f > :not(.kbq-searchinput-searchIcon-8bce0f) {
|
|
4058
|
+
pointer-events: all;
|
|
4059
|
+
}
|
|
4060
|
+
|
|
4061
|
+
.kbq-searchinput-clearButton-71f872 {
|
|
4062
|
+
margin-inline-end: calc(-1 * var(--kbq-size-xxs));
|
|
4063
|
+
}
|
|
4031
4064
|
.kbq-spacing-mbs_0-be7021 {
|
|
4032
4065
|
margin-block-start: 0;
|
|
4033
4066
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koobiq/react-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"@koobiq/design-tokens": "^3.14.0",
|
|
29
29
|
"@types/react-transition-group": "^4.4.12",
|
|
30
30
|
"react-transition-group": "^4.4.5",
|
|
31
|
-
"@koobiq/
|
|
32
|
-
"@koobiq/
|
|
33
|
-
"@koobiq/react-icons": "0.
|
|
34
|
-
"@koobiq/react-primitives": "0.
|
|
31
|
+
"@koobiq/react-core": "0.5.1",
|
|
32
|
+
"@koobiq/logger": "0.5.1",
|
|
33
|
+
"@koobiq/react-icons": "0.5.1",
|
|
34
|
+
"@koobiq/react-primitives": "0.5.1"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@koobiq/design-tokens": "^3.14.0",
|