@koobiq/react-components 0.3.1 → 0.5.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/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/FieldContentGroup.js +5 -6
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.d.ts +3 -2
- 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/List/List.d.ts +2 -1
- package/dist/components/List/List.js +16 -3
- package/dist/components/List/List.module.css.js +4 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Menu/components/MenuInner/MenuInner.js +1 -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/Select.d.ts +3 -2
- package/dist/components/Select/Select.js +83 -101
- package/dist/components/Select/Select.module.css.js +8 -2
- package/dist/components/Select/components/SelectList/SelectList.d.ts +8 -0
- package/dist/components/Select/components/SelectList/SelectList.js +51 -0
- package/dist/components/Select/components/SelectList/SelectList.module.css.js +11 -0
- package/dist/components/Select/components/SelectList/index.d.ts +1 -0
- package/dist/components/Select/components/SelectOption/SelectOption.d.ts +7 -0
- package/dist/components/Select/components/SelectOption/SelectOption.js +42 -0
- package/dist/components/Select/components/SelectOption/index.d.ts +1 -0
- package/dist/components/Select/components/Tag/Tag.d.ts +17 -0
- package/dist/components/Select/components/Tag/Tag.js +64 -0
- package/dist/components/Select/components/Tag/index.d.ts +1 -0
- package/dist/components/Select/components/Tag/intl.json.js +7 -0
- package/dist/components/Select/components/Tag/utils.d.ts +3 -0
- package/dist/components/Select/components/Tag/utils.js +9 -0
- package/dist/components/Select/components/TagGroup/TagGroup.d.ts +13 -0
- package/dist/components/Select/components/TagGroup/TagGroup.js +24 -0
- package/dist/components/Select/components/TagGroup/TagGroup.module.css.js +23 -0
- package/dist/components/Select/components/TagGroup/TagGroupMultiline.d.ts +3 -0
- package/dist/components/Select/components/TagGroup/TagGroupMultiline.js +47 -0
- package/dist/components/Select/components/TagGroup/TagGroupResponsive.d.ts +3 -0
- package/dist/components/Select/components/TagGroup/TagGroupResponsive.js +66 -0
- package/dist/components/Select/components/TagGroup/index.d.ts +1 -0
- package/dist/components/Select/components/TagGroup/utils.d.ts +1 -0
- package/dist/components/Select/components/TagGroup/utils.js +4 -0
- package/dist/components/Select/components/index.d.ts +3 -0
- package/dist/components/Select/intl.d.ts +2 -0
- package/dist/components/Select/intl.js +15 -0
- package/dist/components/Select/types.d.ts +36 -43
- package/dist/components/Select/types.js +7 -0
- 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 +6 -0
- package/dist/style.css +257 -130
- 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>>;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef, Children, isValidElement, cloneElement } from "react";
|
|
3
3
|
import { isNotNil, useFocusRing, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
|
-
import {
|
|
4
|
+
import { Group } from "@koobiq/react-primitives";
|
|
5
5
|
import s from "./FieldContentGroup.module.css.js";
|
|
6
6
|
import { FieldContentGroupContext } from "./FieldContentGroupContext.js";
|
|
7
7
|
import { FieldAddon } from "../FieldAddon/FieldAddon.js";
|
|
@@ -16,10 +16,8 @@ const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
|
16
16
|
slotProps,
|
|
17
17
|
...other
|
|
18
18
|
}, ref) {
|
|
19
|
-
const
|
|
20
|
-
const
|
|
21
|
-
const hasEndAddon = !!endAddon;
|
|
22
|
-
const hasValue = isNotNil(value);
|
|
19
|
+
const hasStartAddon = isNotNil(startAddon);
|
|
20
|
+
const hasEndAddon = isNotNil(endAddon);
|
|
23
21
|
const { focusProps, isFocused } = useFocusRing({ within: true });
|
|
24
22
|
const focusManagedChildren = Children.map(children, (child) => {
|
|
25
23
|
if (!isValidElement(child)) return child;
|
|
@@ -47,7 +45,8 @@ const FieldContentGroup = forwardRef(function FieldContentGroup2({
|
|
|
47
45
|
FieldContentGroupContext.Provider,
|
|
48
46
|
{
|
|
49
47
|
value: {
|
|
50
|
-
|
|
48
|
+
hasStartAddon,
|
|
49
|
+
hasEndAddon,
|
|
51
50
|
isHovered,
|
|
52
51
|
isInvalid,
|
|
53
52
|
isDisabled,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
export type FieldContentGroupContextProps = {
|
|
2
2
|
isDisabled?: boolean;
|
|
3
|
-
|
|
3
|
+
hasStartAddon?: boolean;
|
|
4
|
+
hasEndAddon?: boolean;
|
|
4
5
|
isHovered?: boolean;
|
|
5
6
|
isFocusWithin?: boolean;
|
|
6
7
|
isInvalid?: boolean;
|
|
7
8
|
};
|
|
8
9
|
export declare const FieldContentGroupContext: import("react").Context<FieldContentGroupContextProps>;
|
|
9
|
-
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'>>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Ref } from 'react';
|
|
2
2
|
import { type ListState } from '@koobiq/react-primitives';
|
|
3
|
-
import { Item, Section } from '../Collections';
|
|
3
|
+
import { Item, Section, Divider } from '../Collections';
|
|
4
4
|
import { ListItemText } from './components';
|
|
5
5
|
import type { ListComponent, ListProps } from './types';
|
|
6
6
|
export type ListInnerProps<T extends object> = {
|
|
@@ -12,6 +12,7 @@ declare const ListComponent: ListComponent;
|
|
|
12
12
|
type CompoundedComponent = typeof ListComponent & {
|
|
13
13
|
Item: typeof Item;
|
|
14
14
|
Section: typeof Section;
|
|
15
|
+
Divider: typeof Divider;
|
|
15
16
|
ItemText: typeof ListItemText;
|
|
16
17
|
};
|
|
17
18
|
export declare const List: CompoundedComponent;
|
|
@@ -6,8 +6,10 @@ import { useListBox, useListState } from "@koobiq/react-primitives";
|
|
|
6
6
|
import { utilClasses } from "../../styles/utility.js";
|
|
7
7
|
import s from "./List.module.css.js";
|
|
8
8
|
import { ListSection } from "./components/ListSection/ListSection.js";
|
|
9
|
+
import { Divider } from "../Divider/Divider.js";
|
|
9
10
|
import { Item } from "../Collections/Item.js";
|
|
10
11
|
import { Section } from "../Collections/Section.js";
|
|
12
|
+
import { Divider as Divider$1 } from "../Collections/Divider.js";
|
|
11
13
|
import { ListItemText } from "./components/ListItemText/ListItemText.js";
|
|
12
14
|
import { Typography } from "../Typography/Typography.js";
|
|
13
15
|
import { ListOption } from "./components/ListOption/ListOption.js";
|
|
@@ -33,11 +35,21 @@ function ListInner(props) {
|
|
|
33
35
|
slotProps?.list,
|
|
34
36
|
listBoxProps
|
|
35
37
|
);
|
|
38
|
+
const renderItems = (listState) => [...listState.collection].map((item) => {
|
|
39
|
+
switch (item.type) {
|
|
40
|
+
case "divider":
|
|
41
|
+
return /* @__PURE__ */ jsx(Divider, { className: s.divider }, item.key);
|
|
42
|
+
case "item":
|
|
43
|
+
return /* @__PURE__ */ jsx(ListOption, { item, state }, item.key);
|
|
44
|
+
case "section":
|
|
45
|
+
return /* @__PURE__ */ jsx(ListSection, { section: item, state }, item.key);
|
|
46
|
+
default:
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
});
|
|
36
50
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
37
51
|
isNotNil(label) && /* @__PURE__ */ jsx(Typography, { ...titleProps, children: label }),
|
|
38
|
-
/* @__PURE__ */ jsx("ul", { ...listProps, children:
|
|
39
|
-
(item) => item.type === "section" ? /* @__PURE__ */ jsx(ListSection, { section: item, state }, item.key) : /* @__PURE__ */ jsx(ListOption, { item, state }, item.key)
|
|
40
|
-
) })
|
|
52
|
+
/* @__PURE__ */ jsx("ul", { ...listProps, children: renderItems(state) })
|
|
41
53
|
] });
|
|
42
54
|
}
|
|
43
55
|
function ListRender(props, ref) {
|
|
@@ -48,6 +60,7 @@ const ListComponent = forwardRef(ListRender);
|
|
|
48
60
|
const List = ListComponent;
|
|
49
61
|
List.Item = Item;
|
|
50
62
|
List.Section = Section;
|
|
63
|
+
List.Divider = Divider$1;
|
|
51
64
|
List.ItemText = ListItemText;
|
|
52
65
|
export {
|
|
53
66
|
List,
|
|
@@ -8,9 +8,9 @@ import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
|
8
8
|
import s from "./Menu.module.css.js";
|
|
9
9
|
import { MenuInner } from "./components/MenuInner/MenuInner.js";
|
|
10
10
|
import { Header } from "../Collections/Header.js";
|
|
11
|
-
import { Divider } from "../Collections/Divider.js";
|
|
12
11
|
import { Item } from "../Collections/Item.js";
|
|
13
12
|
import { Section } from "../Collections/Section.js";
|
|
13
|
+
import { Divider } from "../Collections/Divider.js";
|
|
14
14
|
import { ListItemText } from "../List/components/ListItemText/ListItemText.js";
|
|
15
15
|
function MenuRender(props, ref) {
|
|
16
16
|
const {
|
|
@@ -6,9 +6,9 @@ import { useTreeState, useMenu } from "@koobiq/react-primitives";
|
|
|
6
6
|
import { utilClasses } from "../../../../styles/utility.js";
|
|
7
7
|
import s from "./MenuInner.module.css.js";
|
|
8
8
|
import { MenuSection } from "../MenuSection/MenuSection.js";
|
|
9
|
-
import { Divider } from "../../../Divider/Divider.js";
|
|
10
9
|
import { MenuHeader } from "../MenuHeader/MenuHeader.js";
|
|
11
10
|
import { MenuItem } from "../MenuItem/MenuItem.js";
|
|
11
|
+
import { Divider } from "../../../Divider/Divider.js";
|
|
12
12
|
const { list } = utilClasses;
|
|
13
13
|
function MenuInnerRender(props, ref) {
|
|
14
14
|
const state = useTreeState(props);
|
|
@@ -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'>;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { Item, Section } from '../Collections';
|
|
2
|
-
import { ListItemText } from '../List';
|
|
1
|
+
import { Item, Section, Divider } from '../Collections';
|
|
2
|
+
import type { ListItemText } from '../List';
|
|
3
3
|
import type { SelectComponent } from './index';
|
|
4
4
|
declare const SelectComponent: SelectComponent;
|
|
5
5
|
type CompoundedComponent = typeof SelectComponent & {
|
|
6
6
|
Item: typeof Item;
|
|
7
7
|
Section: typeof Section;
|
|
8
|
+
Divider: typeof Divider;
|
|
8
9
|
ItemText: typeof ListItemText;
|
|
9
10
|
};
|
|
10
11
|
export declare const Select: CompoundedComponent;
|