@koobiq/react-components 0.0.1-beta.31 → 0.0.1-beta.33
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/DateInput.d.ts +5 -0
- package/dist/components/DateInput/DateInput.js +103 -0
- package/dist/components/DateInput/DateInput.module.css.js +8 -0
- package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.d.ts +7 -0
- package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.js +27 -0
- package/dist/components/DateInput/components/DateInputSegment/DateInputSegment.module.css.js +17 -0
- package/dist/components/DateInput/components/DateInputSegment/index.d.ts +1 -0
- package/dist/components/DateInput/components/index.d.ts +1 -0
- package/dist/components/DateInput/index.d.ts +2 -0
- package/dist/components/DateInput/types.d.ts +47 -0
- package/dist/components/DateInput/types.js +4 -0
- package/dist/components/DatePicker/DatePicker._stories_.d.ts +13 -0
- package/dist/components/DatePicker/DatePicker.d.ts +3 -0
- package/dist/components/DatePicker/index.d.ts +0 -0
- package/dist/components/FieldComponents/FieldCaption/FieldCaption.d.ts +6 -4
- package/dist/components/FieldComponents/FieldCaption/FieldCaption.js +1 -1
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.d.ts +12 -0
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +32 -0
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.module.css.js +20 -0
- package/dist/components/FieldComponents/FieldInputDate/index.d.ts +1 -0
- package/dist/components/FieldComponents/index.d.ts +1 -0
- package/dist/components/Input/Input.d.ts +3 -3
- package/dist/components/Input/Input.js +9 -9
- package/dist/components/Input/types.d.ts +3 -3
- package/dist/components/InputNumber/InputNumber.d.ts +3 -3
- package/dist/components/InputNumber/InputNumber.js +9 -9
- package/dist/components/InputNumber/types.d.ts +3 -3
- package/dist/components/Link/types.d.ts +1 -1
- package/dist/components/Menu/Menu.js +1 -1
- package/dist/components/Popover/Popover.d.ts +0 -3
- package/dist/components/Popover/Popover.js +5 -140
- package/dist/components/Popover/PopoverInner.d.ts +3 -0
- package/dist/components/Popover/PopoverInner.js +142 -0
- package/dist/components/RadioGroup/types.d.ts +1 -1
- package/dist/components/Select/Select.js +15 -7
- package/dist/components/Select/types.d.ts +2 -2
- package/dist/components/Textarea/Textarea.d.ts +3 -3
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +6 -9
- package/dist/components/Textarea/types.d.ts +3 -3
- package/dist/components/index.d.ts +2 -1
- package/dist/index.js +8 -3
- package/dist/style.css +109 -0
- package/package.json +5 -5
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Ref } from 'react';
|
|
2
|
+
import type { DateValue } from '@koobiq/react-primitives';
|
|
3
|
+
import type { DateInputRef, DateInputProps, DateInputComponentProp } from './types';
|
|
4
|
+
export declare function DateInputRender<T extends DateValue>(props: Omit<DateInputProps<T>, 'ref'>, ref: Ref<DateInputRef>): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
export declare const DateInput: DateInputComponentProp;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { createCalendar } from "@internationalized/date";
|
|
4
|
+
import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
|
+
import { useLocale, useDateFieldState, removeDataAttributes, useDateField } from "@koobiq/react-primitives";
|
|
6
|
+
import s from "./DateInput.module.css.js";
|
|
7
|
+
import { FieldInputDate } from "../FieldComponents/FieldInputDate/FieldInputDate.js";
|
|
8
|
+
import { DateInputSegment } from "./components/DateInputSegment/DateInputSegment.js";
|
|
9
|
+
import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
|
|
10
|
+
import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
|
|
11
|
+
import { FieldInputGroup } from "../FieldComponents/FieldInputGroup/FieldInputGroup.js";
|
|
12
|
+
import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
|
|
13
|
+
import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
|
|
14
|
+
function DateInputRender(props, ref) {
|
|
15
|
+
const { errorMessage } = props;
|
|
16
|
+
const { locale } = useLocale();
|
|
17
|
+
const {
|
|
18
|
+
variant = "filled",
|
|
19
|
+
slotProps,
|
|
20
|
+
caption,
|
|
21
|
+
startAddon,
|
|
22
|
+
endAddon,
|
|
23
|
+
isLabelHidden,
|
|
24
|
+
label,
|
|
25
|
+
className,
|
|
26
|
+
style,
|
|
27
|
+
fullWidth,
|
|
28
|
+
isReadOnly,
|
|
29
|
+
"data-testid": testId
|
|
30
|
+
} = props;
|
|
31
|
+
const state = useDateFieldState({
|
|
32
|
+
...removeDataAttributes(props),
|
|
33
|
+
locale,
|
|
34
|
+
createCalendar
|
|
35
|
+
});
|
|
36
|
+
const domRef = useDOMRef(ref);
|
|
37
|
+
const {
|
|
38
|
+
labelProps: labelPropReactAria,
|
|
39
|
+
fieldProps,
|
|
40
|
+
descriptionProps,
|
|
41
|
+
errorMessageProps,
|
|
42
|
+
...validation
|
|
43
|
+
} = useDateField({ ...removeDataAttributes(props) }, state, domRef);
|
|
44
|
+
const { isInvalid, isRequired, isDisabled } = state;
|
|
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, children: label, isRequired },
|
|
62
|
+
labelPropReactAria,
|
|
63
|
+
slotProps?.label
|
|
64
|
+
);
|
|
65
|
+
const groupProps = mergeProps(
|
|
66
|
+
{
|
|
67
|
+
endAddon,
|
|
68
|
+
isInvalid,
|
|
69
|
+
startAddon
|
|
70
|
+
},
|
|
71
|
+
slotProps?.group
|
|
72
|
+
);
|
|
73
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
|
|
74
|
+
const errorProps = mergeProps(
|
|
75
|
+
{
|
|
76
|
+
isInvalid,
|
|
77
|
+
children: typeof errorMessage === "function" ? errorMessage({ ...validation }) : errorMessage
|
|
78
|
+
},
|
|
79
|
+
slotProps?.errorMessage,
|
|
80
|
+
errorMessageProps
|
|
81
|
+
);
|
|
82
|
+
const controlProps = mergeProps(
|
|
83
|
+
{
|
|
84
|
+
variant,
|
|
85
|
+
isInvalid,
|
|
86
|
+
isDisabled,
|
|
87
|
+
ref: domRef
|
|
88
|
+
},
|
|
89
|
+
slotProps?.inputDate,
|
|
90
|
+
fieldProps
|
|
91
|
+
);
|
|
92
|
+
return /* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
|
|
93
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
|
|
94
|
+
/* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInputDate, { ...controlProps, children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateInputSegment, { segment, state }, i)) }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
96
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
97
|
+
] });
|
|
98
|
+
}
|
|
99
|
+
const DateInput = forwardRef(DateInputRender);
|
|
100
|
+
export {
|
|
101
|
+
DateInput,
|
|
102
|
+
DateInputRender
|
|
103
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { DateSegment, DateFieldState } from '@koobiq/react-primitives';
|
|
2
|
+
type DateInputSegmentProps = {
|
|
3
|
+
segment: DateSegment;
|
|
4
|
+
state: DateFieldState;
|
|
5
|
+
};
|
|
6
|
+
export declare function DateInputSegment({ segment, state }: DateInputSegmentProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef } from "react";
|
|
3
|
+
import { clsx } from "@koobiq/react-core";
|
|
4
|
+
import { useDateSegment } from "@koobiq/react-primitives";
|
|
5
|
+
import s from "./DateInputSegment.module.css.js";
|
|
6
|
+
function DateInputSegment({ segment, state }) {
|
|
7
|
+
const ref = useRef(null);
|
|
8
|
+
const { segmentProps } = useDateSegment(segment, state, ref);
|
|
9
|
+
const { text, isPlaceholder, type } = segment;
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"span",
|
|
12
|
+
{
|
|
13
|
+
...segmentProps,
|
|
14
|
+
ref,
|
|
15
|
+
className: clsx(
|
|
16
|
+
s.base,
|
|
17
|
+
s[type],
|
|
18
|
+
state.value !== null && s.hasValue,
|
|
19
|
+
isPlaceholder && s.placeholder
|
|
20
|
+
),
|
|
21
|
+
children: text
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
export {
|
|
26
|
+
DateInputSegment
|
|
27
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const base = "kbq-dateinputsegment-996e10";
|
|
2
|
+
const placeholder = "kbq-dateinputsegment-placeholder-be1df1";
|
|
3
|
+
const literal = "kbq-dateinputsegment-literal-d722fc";
|
|
4
|
+
const hasValue = "kbq-dateinputsegment-hasValue-886d0f";
|
|
5
|
+
const s = {
|
|
6
|
+
base,
|
|
7
|
+
placeholder,
|
|
8
|
+
literal,
|
|
9
|
+
hasValue
|
|
10
|
+
};
|
|
11
|
+
export {
|
|
12
|
+
base,
|
|
13
|
+
s as default,
|
|
14
|
+
hasValue,
|
|
15
|
+
literal,
|
|
16
|
+
placeholder
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DateInputSegment';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './DateInputSegment';
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
|
|
2
|
+
import type { AriaDateFieldProps, DateValue } from '@koobiq/react-primitives';
|
|
3
|
+
import type { FieldCaptionProps, FieldControlProps, FieldErrorProps, FieldInputDateProps, FieldInputGroupProps, FieldLabelProps } from '../FieldComponents';
|
|
4
|
+
export declare const dateInputPropVariant: readonly ["filled", "transparent"];
|
|
5
|
+
export type DateInputPropVariant = (typeof dateInputPropVariant)[number];
|
|
6
|
+
export type DateInputProps<T extends DateValue> = {
|
|
7
|
+
/** Inline styles. */
|
|
8
|
+
style?: CSSProperties;
|
|
9
|
+
/** Additional CSS-classes. */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Unique identifier for testing purposes. */
|
|
12
|
+
'data-testid'?: string | number;
|
|
13
|
+
/** The helper text content. */
|
|
14
|
+
caption?: string | number;
|
|
15
|
+
/**
|
|
16
|
+
* The variant to use.
|
|
17
|
+
* @default filled
|
|
18
|
+
*/
|
|
19
|
+
variant?: DateInputPropVariant;
|
|
20
|
+
/**
|
|
21
|
+
* If true, the input will take up the full width of its container.
|
|
22
|
+
* @default false
|
|
23
|
+
*/
|
|
24
|
+
fullWidth?: boolean;
|
|
25
|
+
/** The props used for each slot inside. */
|
|
26
|
+
slotProps?: {
|
|
27
|
+
root?: FieldControlProps;
|
|
28
|
+
label?: FieldLabelProps;
|
|
29
|
+
group?: FieldInputGroupProps;
|
|
30
|
+
caption?: FieldCaptionProps;
|
|
31
|
+
inputDate?: FieldInputDateProps;
|
|
32
|
+
errorMessage?: FieldErrorProps;
|
|
33
|
+
};
|
|
34
|
+
/** Ref to the control */
|
|
35
|
+
ref?: Ref<HTMLDivElement>;
|
|
36
|
+
/**
|
|
37
|
+
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
38
|
+
* @default false
|
|
39
|
+
*/
|
|
40
|
+
isLabelHidden?: boolean;
|
|
41
|
+
/** Addon placed before the children. */
|
|
42
|
+
startAddon?: ReactNode;
|
|
43
|
+
/** Addon placed after the children. */
|
|
44
|
+
endAddon?: ReactNode;
|
|
45
|
+
} & Omit<AriaDateFieldProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState'>;
|
|
46
|
+
export type DateInputComponentProp = <T extends DateValue>(props: DateInputProps<T>) => ReactElement | null;
|
|
47
|
+
export type DateInputRef = ComponentRef<'div'>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
import { DatePicker } from './DatePicker';
|
|
3
|
+
declare const meta: {
|
|
4
|
+
title: string;
|
|
5
|
+
component: typeof DatePicker;
|
|
6
|
+
parameters: {
|
|
7
|
+
layout: string;
|
|
8
|
+
};
|
|
9
|
+
argTypes: {};
|
|
10
|
+
};
|
|
11
|
+
export default meta;
|
|
12
|
+
type Story = StoryObj<typeof meta>;
|
|
13
|
+
export declare const Base: Story;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { AriaDatePickerProps, DateValue } from '@koobiq/react-primitives';
|
|
2
|
+
export type DatePickerProps<T extends DateValue> = AriaDatePickerProps<T>;
|
|
3
|
+
export declare function DatePicker<T extends DateValue>(props: DatePickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
File without changes
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { type TextProps, type TextRef } from '@koobiq/react-primitives';
|
|
2
|
-
export type FieldCaptionProps = TextProps
|
|
3
|
-
isInvalid?: boolean;
|
|
4
|
-
};
|
|
2
|
+
export type FieldCaptionProps = TextProps;
|
|
5
3
|
export type FieldCaptionRef = TextRef;
|
|
6
|
-
export declare const FieldCaption: import("react").ForwardRefExoticComponent<Omit<
|
|
4
|
+
export declare const FieldCaption: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
|
|
5
|
+
ref?: ((instance: HTMLParagraphElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLParagraphElement> | null | undefined;
|
|
6
|
+
}, "as" | keyof import("@koobiq/react-primitives").TextBaseProps> & import("@koobiq/react-primitives").TextBaseProps & {
|
|
7
|
+
as?: "p" | undefined;
|
|
8
|
+
}, "ref"> & import("react").RefAttributes<HTMLParagraphElement>>;
|
|
@@ -4,7 +4,7 @@ import { isNotNil, clsx } from "@koobiq/react-core";
|
|
|
4
4
|
import { Text } from "@koobiq/react-primitives";
|
|
5
5
|
import s from "./FieldCaption.module.css.js";
|
|
6
6
|
const FieldCaption = forwardRef(
|
|
7
|
-
({ children, className,
|
|
7
|
+
({ children, className, ...other }, ref) => isNotNil(children) ? /* @__PURE__ */ jsx(
|
|
8
8
|
Text,
|
|
9
9
|
{
|
|
10
10
|
className: clsx(s.base, className),
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ReactNode, type Ref } from 'react';
|
|
2
|
+
import type { InputPropVariant } from '../../Input';
|
|
3
|
+
export type FieldInputDateProps = {
|
|
4
|
+
isInvalid?: boolean;
|
|
5
|
+
isDisabled?: boolean;
|
|
6
|
+
variant?: InputPropVariant;
|
|
7
|
+
className?: string;
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
'data-testid'?: string;
|
|
10
|
+
ref?: Ref<HTMLDivElement>;
|
|
11
|
+
};
|
|
12
|
+
export declare const FieldInputDate: import("react").ForwardRefExoticComponent<Omit<FieldInputDateProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { clsx } from "@koobiq/react-core";
|
|
4
|
+
import s from "./FieldInputDate.module.css.js";
|
|
5
|
+
const FieldInputDate = forwardRef(
|
|
6
|
+
({
|
|
7
|
+
isInvalid = false,
|
|
8
|
+
isDisabled = false,
|
|
9
|
+
variant = "filled",
|
|
10
|
+
children,
|
|
11
|
+
className,
|
|
12
|
+
...other
|
|
13
|
+
}, ref) => /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
...other,
|
|
17
|
+
className: clsx(
|
|
18
|
+
s.base,
|
|
19
|
+
s[variant],
|
|
20
|
+
isInvalid && s.invalid,
|
|
21
|
+
isDisabled && s.disabled,
|
|
22
|
+
className
|
|
23
|
+
),
|
|
24
|
+
ref,
|
|
25
|
+
children
|
|
26
|
+
}
|
|
27
|
+
)
|
|
28
|
+
);
|
|
29
|
+
FieldInputDate.displayName = "FieldSelect";
|
|
30
|
+
export {
|
|
31
|
+
FieldInputDate
|
|
32
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const base = "kbq-fieldinputdate-a54331";
|
|
2
|
+
const transparent = "kbq-fieldinputdate-transparent-04d912";
|
|
3
|
+
const filled = "kbq-fieldinputdate-filled-02db7d";
|
|
4
|
+
const invalid = "kbq-fieldinputdate-invalid-d764c6";
|
|
5
|
+
const disabled = "kbq-fieldinputdate-disabled-692832";
|
|
6
|
+
const s = {
|
|
7
|
+
base,
|
|
8
|
+
transparent,
|
|
9
|
+
filled,
|
|
10
|
+
invalid,
|
|
11
|
+
disabled
|
|
12
|
+
};
|
|
13
|
+
export {
|
|
14
|
+
base,
|
|
15
|
+
s as default,
|
|
16
|
+
disabled,
|
|
17
|
+
filled,
|
|
18
|
+
invalid,
|
|
19
|
+
transparent
|
|
20
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './FieldInputDate';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TextField } from '@koobiq/react-primitives';
|
|
2
2
|
import { type FieldLabelProps, type FieldInputGroupProps, type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldControlProps } from '../FieldComponents';
|
|
3
|
-
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "
|
|
3
|
+
export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "validationBehavior" | "validate" | "description" | "inputElementType">, "value" | "caption" | "label" | "style" | "className" | "defaultValue" | "onChange" | "placeholder" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isReadOnly" | "isRequired" | "errorMessage" | "startAddon" | "endAddon" | "isLabelHidden" | keyof {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
error?: boolean;
|
|
6
6
|
required?: boolean;
|
|
@@ -17,12 +17,12 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<
|
|
|
17
17
|
endAddon?: import("react").ReactNode;
|
|
18
18
|
variant?: import("./types").InputPropVariant;
|
|
19
19
|
isInvalid?: boolean;
|
|
20
|
-
errorMessage?:
|
|
20
|
+
errorMessage?: import("react").ReactNode;
|
|
21
21
|
fullWidth?: boolean;
|
|
22
22
|
isDisabled?: boolean;
|
|
23
23
|
isReadOnly?: boolean;
|
|
24
24
|
isLabelHidden?: boolean;
|
|
25
|
-
caption?:
|
|
25
|
+
caption?: import("react").ReactNode;
|
|
26
26
|
isRequired?: boolean;
|
|
27
27
|
style?: import("react").CSSProperties;
|
|
28
28
|
'data-testid'?: string | number;
|
|
@@ -79,7 +79,10 @@ const Input = forwardRef((props, ref) => {
|
|
|
79
79
|
slotProps?.root
|
|
80
80
|
);
|
|
81
81
|
return /* @__PURE__ */ jsx(FieldControl, { as: TextField, inputElementType: "input", ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
|
|
82
|
-
const labelProps = mergeProps(
|
|
82
|
+
const labelProps = mergeProps(
|
|
83
|
+
{ isHidden: isLabelHidden, isRequired: isRequired2, children: label },
|
|
84
|
+
slotProps?.label
|
|
85
|
+
);
|
|
83
86
|
const inputProps = mergeProps(
|
|
84
87
|
{
|
|
85
88
|
variant,
|
|
@@ -97,16 +100,13 @@ const Input = forwardRef((props, ref) => {
|
|
|
97
100
|
},
|
|
98
101
|
slotProps?.group
|
|
99
102
|
);
|
|
100
|
-
const captionProps = mergeProps(
|
|
101
|
-
|
|
102
|
-
slotProps?.caption
|
|
103
|
-
);
|
|
104
|
-
const errorProps = mergeProps({ isInvalid: isInvalid2 }, slotProps?.errorMessage);
|
|
103
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
104
|
+
const errorProps = mergeProps({ isInvalid: isInvalid2, children: errorMessage }, slotProps?.errorMessage);
|
|
105
105
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
106
|
-
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps
|
|
106
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
|
|
107
107
|
/* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
108
|
-
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps
|
|
109
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps
|
|
108
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
109
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
110
110
|
] });
|
|
111
111
|
} });
|
|
112
112
|
});
|
|
@@ -74,7 +74,7 @@ export type InputProps = ExtendableProps<{
|
|
|
74
74
|
*/
|
|
75
75
|
isInvalid?: boolean;
|
|
76
76
|
/** Message for the error state */
|
|
77
|
-
errorMessage?:
|
|
77
|
+
errorMessage?: ReactNode;
|
|
78
78
|
/**
|
|
79
79
|
* If true, the input will take up the full width of its container.
|
|
80
80
|
* @default false
|
|
@@ -96,7 +96,7 @@ export type InputProps = ExtendableProps<{
|
|
|
96
96
|
*/
|
|
97
97
|
isLabelHidden?: boolean;
|
|
98
98
|
/** The helper text content. */
|
|
99
|
-
caption?:
|
|
99
|
+
caption?: ReactNode;
|
|
100
100
|
/**
|
|
101
101
|
* If `true`, the label is displayed as required and the input element is required.
|
|
102
102
|
* @default false
|
|
@@ -115,6 +115,6 @@ export type InputProps = ExtendableProps<{
|
|
|
115
115
|
errorMessage?: FieldErrorProps;
|
|
116
116
|
input?: FieldInputProps<'input'>;
|
|
117
117
|
};
|
|
118
|
-
} & InputDeprecatedProps, Omit<TextFieldProps<HTMLInputElement>, 'description' | 'validationBehavior' | 'validate' | 'children' | '
|
|
118
|
+
} & InputDeprecatedProps, Omit<TextFieldProps<HTMLInputElement>, 'description' | 'validationBehavior' | 'validate' | 'children' | 'inputElementType'>>;
|
|
119
119
|
export type InputRef = ComponentRef<'input'>;
|
|
120
120
|
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NumberField } from '@koobiq/react-primitives';
|
|
2
2
|
import { type FieldControlProps, type FieldLabelProps, type FieldCaptionProps, type FieldErrorProps, type FieldInputGroupProps, type FieldInputProps } from '../FieldComponents';
|
|
3
|
-
export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/numberfield").AriaNumberFieldProps, "inputElementType">, "caption" | "label" | "style" | "className" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isRequired" | "errorMessage" | "startAddon" | "endAddon" | "isLabelHidden" | keyof {
|
|
3
|
+
export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/numberfield").AriaNumberFieldProps, "children" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "label" | "style" | "className" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isRequired" | "errorMessage" | "startAddon" | "endAddon" | "isLabelHidden" | keyof {
|
|
4
4
|
disabled?: boolean;
|
|
5
5
|
error?: boolean;
|
|
6
6
|
required?: boolean;
|
|
@@ -13,11 +13,11 @@ export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit
|
|
|
13
13
|
endAddon?: import("react").ReactNode;
|
|
14
14
|
variant?: import("./types").InputNumberPropVariant;
|
|
15
15
|
isInvalid?: boolean;
|
|
16
|
-
errorMessage?:
|
|
16
|
+
errorMessage?: import("react").ReactNode;
|
|
17
17
|
fullWidth?: boolean;
|
|
18
18
|
isDisabled?: boolean;
|
|
19
19
|
isLabelHidden?: boolean;
|
|
20
|
-
caption?:
|
|
20
|
+
caption?: import("react").ReactNode;
|
|
21
21
|
isRequired?: boolean;
|
|
22
22
|
style?: import("react").CSSProperties;
|
|
23
23
|
'data-testid'?: string | number;
|
|
@@ -81,7 +81,10 @@ const InputNumber = forwardRef(
|
|
|
81
81
|
slotProps?.root
|
|
82
82
|
);
|
|
83
83
|
return /* @__PURE__ */ jsx(FieldControl, { as: NumberField, ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
|
|
84
|
-
const labelProps = mergeProps(
|
|
84
|
+
const labelProps = mergeProps(
|
|
85
|
+
{ isHidden: isLabelHidden, children: label, isRequired: isRequired2 },
|
|
86
|
+
slotProps?.label
|
|
87
|
+
);
|
|
85
88
|
const inputProps = mergeProps(
|
|
86
89
|
{
|
|
87
90
|
variant,
|
|
@@ -91,11 +94,8 @@ const InputNumber = forwardRef(
|
|
|
91
94
|
},
|
|
92
95
|
slotProps?.input
|
|
93
96
|
);
|
|
94
|
-
const captionProps = mergeProps(
|
|
95
|
-
|
|
96
|
-
slotProps?.caption
|
|
97
|
-
);
|
|
98
|
-
const errorProps = mergeProps({ isInvalid: isInvalid2 }, slotProps?.errorMessage);
|
|
97
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
98
|
+
const errorProps = mergeProps({ isInvalid: isInvalid2, children: errorMessage }, slotProps?.errorMessage);
|
|
99
99
|
const groupProps = mergeProps(
|
|
100
100
|
{
|
|
101
101
|
endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
@@ -109,10 +109,10 @@ const InputNumber = forwardRef(
|
|
|
109
109
|
slotProps?.group
|
|
110
110
|
);
|
|
111
111
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
112
|
-
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps
|
|
112
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
|
|
113
113
|
/* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
114
|
-
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps
|
|
115
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps
|
|
114
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
115
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
116
116
|
] });
|
|
117
117
|
} });
|
|
118
118
|
}
|
|
@@ -66,7 +66,7 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
66
66
|
*/
|
|
67
67
|
isInvalid?: boolean;
|
|
68
68
|
/** Message for the error state. */
|
|
69
|
-
errorMessage?:
|
|
69
|
+
errorMessage?: ReactNode;
|
|
70
70
|
/**
|
|
71
71
|
* If true, the input will take up the full width of its container.
|
|
72
72
|
* @default false
|
|
@@ -83,7 +83,7 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
83
83
|
*/
|
|
84
84
|
isLabelHidden?: boolean;
|
|
85
85
|
/** The helper text content. */
|
|
86
|
-
caption?:
|
|
86
|
+
caption?: ReactNode;
|
|
87
87
|
/**
|
|
88
88
|
* If `true`, the label is displayed as required and the input element is required.
|
|
89
89
|
* @default false
|
|
@@ -102,6 +102,6 @@ export type InputNumberProps = ExtendableProps<{
|
|
|
102
102
|
group?: FieldInputGroupProps;
|
|
103
103
|
errorMessage?: FieldErrorProps;
|
|
104
104
|
};
|
|
105
|
-
} & InputNumberDeprecatedProps, Omit<UseNumberFieldProps, 'inputElementType'>>;
|
|
105
|
+
} & InputNumberDeprecatedProps, Omit<UseNumberFieldProps, 'description' | 'validationBehavior' | 'validate' | 'children' | 'inputElementType'>>;
|
|
106
106
|
export type InputNumberRef = ComponentRef<'input'>;
|
|
107
107
|
export {};
|
|
@@ -3,11 +3,11 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef, useRef } from "react";
|
|
4
4
|
import { useDOMRef, mergeProps, clsx, Pressable } from "@koobiq/react-core";
|
|
5
5
|
import { useMenuTriggerState, useMenuTrigger } from "@koobiq/react-primitives";
|
|
6
|
+
import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
6
7
|
import s from "./Menu.module.css.js";
|
|
7
8
|
import { MenuInner } from "./components/MenuInner/MenuInner.js";
|
|
8
9
|
import { Header } from "../Collections/Header.js";
|
|
9
10
|
import { Divider } from "../Collections/Divider.js";
|
|
10
|
-
import { PopoverInner } from "../Popover/Popover.js";
|
|
11
11
|
import { Item } from "../Collections/Item.js";
|
|
12
12
|
import { Section } from "../Collections/Section.js";
|
|
13
13
|
import { ListItemText } from "../List/components/ListItemText/ListItemText.js";
|
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import type { FC } from 'react';
|
|
2
1
|
import { Dialog } from '../Dialog';
|
|
3
|
-
import type { PopoverInnerProps } from './types';
|
|
4
|
-
export declare const PopoverInner: FC<PopoverInnerProps>;
|
|
5
2
|
declare const PopoverComponent: import("react").ForwardRefExoticComponent<import("./types").PopoverBaseProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
6
3
|
type CompoundedComponent = typeof PopoverComponent & {
|
|
7
4
|
Header: typeof Dialog.Header;
|