@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
|
@@ -1,143 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { forwardRef
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { Transition } from "react-transition-group";
|
|
7
|
-
import s from "./Popover.module.css.js";
|
|
8
|
-
import { normalizeInlineSize } from "./utils.js";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { useOverlayTriggerState } from "@koobiq/react-primitives";
|
|
5
|
+
import { PopoverInner } from "./PopoverInner.js";
|
|
9
6
|
import { Dialog } from "../Dialog/Dialog.js";
|
|
10
|
-
const PopoverInner = (props) => {
|
|
11
|
-
const {
|
|
12
|
-
offset = 0,
|
|
13
|
-
size = "medium",
|
|
14
|
-
crossOffset = 0,
|
|
15
|
-
hideArrow = false,
|
|
16
|
-
containerPadding = 12,
|
|
17
|
-
arrowBoundaryOffset = 20,
|
|
18
|
-
placement: placementProp = "top",
|
|
19
|
-
maxBlockSize = 480,
|
|
20
|
-
type = "dialog",
|
|
21
|
-
state,
|
|
22
|
-
control,
|
|
23
|
-
children,
|
|
24
|
-
anchorRef,
|
|
25
|
-
slotProps,
|
|
26
|
-
className,
|
|
27
|
-
isNonModal,
|
|
28
|
-
popoverRef,
|
|
29
|
-
portalContainer,
|
|
30
|
-
hideCloseButton,
|
|
31
|
-
disableFocusManagement,
|
|
32
|
-
disableExitOnEscapeKeyDown,
|
|
33
|
-
shouldCloseOnInteractOutside,
|
|
34
|
-
...other
|
|
35
|
-
} = props;
|
|
36
|
-
const showArrow = !hideArrow;
|
|
37
|
-
const domRef = useDOMRef(popoverRef);
|
|
38
|
-
const controlRef = useRef(null);
|
|
39
|
-
const openState = state.isOpen;
|
|
40
|
-
const [opened, { on, off }] = useBoolean(openState);
|
|
41
|
-
const { triggerProps, overlayProps } = useOverlayTrigger(
|
|
42
|
-
{ type },
|
|
43
|
-
{ ...state, isOpen: openState }
|
|
44
|
-
);
|
|
45
|
-
const {
|
|
46
|
-
popoverProps,
|
|
47
|
-
underlayProps,
|
|
48
|
-
arrowProps: arrowPropsCommon,
|
|
49
|
-
placement
|
|
50
|
-
} = usePopover(
|
|
51
|
-
{
|
|
52
|
-
...props,
|
|
53
|
-
offset,
|
|
54
|
-
isNonModal,
|
|
55
|
-
crossOffset,
|
|
56
|
-
containerPadding,
|
|
57
|
-
popoverRef: domRef,
|
|
58
|
-
arrowBoundaryOffset,
|
|
59
|
-
maxHeight: maxBlockSize,
|
|
60
|
-
placement: placementProp,
|
|
61
|
-
shouldCloseOnInteractOutside,
|
|
62
|
-
triggerRef: anchorRef || controlRef,
|
|
63
|
-
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
64
|
-
},
|
|
65
|
-
{ ...state, isOpen: openState || opened }
|
|
66
|
-
);
|
|
67
|
-
const resolvedChildren = () => {
|
|
68
|
-
if (typeof children === "function")
|
|
69
|
-
return cloneElement(children({ close: state.close }), overlayProps);
|
|
70
|
-
if (isValidElement(children)) return cloneElement(children, overlayProps);
|
|
71
|
-
return children;
|
|
72
|
-
};
|
|
73
|
-
const arrowProps = mergeProps(
|
|
74
|
-
{ className: s.arrow },
|
|
75
|
-
arrowPropsCommon,
|
|
76
|
-
slotProps?.arrow
|
|
77
|
-
);
|
|
78
|
-
const dialogProps = mergeProps(
|
|
79
|
-
{
|
|
80
|
-
role: "dialog",
|
|
81
|
-
hideCloseButton,
|
|
82
|
-
className: s.dialog,
|
|
83
|
-
onClose: state.close
|
|
84
|
-
},
|
|
85
|
-
slotProps?.dialog
|
|
86
|
-
);
|
|
87
|
-
const backdropProps = mergeProps(
|
|
88
|
-
{ className: s.underlay },
|
|
89
|
-
slotProps?.backdrop,
|
|
90
|
-
underlayProps
|
|
91
|
-
);
|
|
92
|
-
const transitionProps = mergeProps(
|
|
93
|
-
{
|
|
94
|
-
timeout: 120,
|
|
95
|
-
onEnter: on,
|
|
96
|
-
onExited: off,
|
|
97
|
-
appear: true,
|
|
98
|
-
in: openState,
|
|
99
|
-
nodeRef: domRef,
|
|
100
|
-
unmountOnExit: true
|
|
101
|
-
},
|
|
102
|
-
slotProps?.transition
|
|
103
|
-
);
|
|
104
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
105
|
-
control?.({
|
|
106
|
-
ref: controlRef,
|
|
107
|
-
...triggerProps
|
|
108
|
-
}),
|
|
109
|
-
/* @__PURE__ */ jsx(Transition, { ...transitionProps, children: (transition) => /* @__PURE__ */ jsxs(
|
|
110
|
-
Overlay,
|
|
111
|
-
{
|
|
112
|
-
portalContainer,
|
|
113
|
-
disableFocusManagement,
|
|
114
|
-
children: [
|
|
115
|
-
/* @__PURE__ */ jsx("div", { ...backdropProps }),
|
|
116
|
-
/* @__PURE__ */ jsxs(
|
|
117
|
-
"div",
|
|
118
|
-
{
|
|
119
|
-
ref: domRef,
|
|
120
|
-
"data-size": size,
|
|
121
|
-
"data-arrow": showArrow,
|
|
122
|
-
"data-placement": placement,
|
|
123
|
-
"data-transition": transition,
|
|
124
|
-
className: clsx(s.base, s[size], className),
|
|
125
|
-
...mergeProps(popoverProps, other),
|
|
126
|
-
style: {
|
|
127
|
-
...popoverProps.style,
|
|
128
|
-
"--popover-inline-size": normalizeInlineSize(size)
|
|
129
|
-
},
|
|
130
|
-
children: [
|
|
131
|
-
showArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, "data-placement": placement }),
|
|
132
|
-
/* @__PURE__ */ jsx("div", { className: s.container, children: type === "dialog" ? /* @__PURE__ */ jsx(Dialog, { ...dialogProps, children: resolvedChildren() }) : resolvedChildren() })
|
|
133
|
-
]
|
|
134
|
-
}
|
|
135
|
-
)
|
|
136
|
-
]
|
|
137
|
-
}
|
|
138
|
-
) })
|
|
139
|
-
] });
|
|
140
|
-
};
|
|
141
7
|
const PopoverComponent = forwardRef(
|
|
142
8
|
(props, ref) => {
|
|
143
9
|
const { open, onOpenChange, defaultOpen, ...other } = props;
|
|
@@ -156,6 +22,5 @@ Popover.Header = Dialog.Header;
|
|
|
156
22
|
Popover.Body = Dialog.Body;
|
|
157
23
|
Popover.Footer = Dialog.Footer;
|
|
158
24
|
export {
|
|
159
|
-
Popover
|
|
160
|
-
PopoverInner
|
|
25
|
+
Popover
|
|
161
26
|
};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useRef, cloneElement, isValidElement } from "react";
|
|
3
|
+
import { useDOMRef, useBoolean, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
|
+
import { useOverlayTrigger, usePopover, Overlay } from "@koobiq/react-primitives";
|
|
5
|
+
import { Transition } from "react-transition-group";
|
|
6
|
+
import s from "./Popover.module.css.js";
|
|
7
|
+
import { normalizeInlineSize } from "./utils.js";
|
|
8
|
+
import { Dialog } from "../Dialog/Dialog.js";
|
|
9
|
+
const PopoverInner = (props) => {
|
|
10
|
+
const {
|
|
11
|
+
offset = 0,
|
|
12
|
+
size = "medium",
|
|
13
|
+
crossOffset = 0,
|
|
14
|
+
hideArrow = false,
|
|
15
|
+
containerPadding = 12,
|
|
16
|
+
arrowBoundaryOffset = 20,
|
|
17
|
+
placement: placementProp = "top",
|
|
18
|
+
maxBlockSize = 480,
|
|
19
|
+
type = "dialog",
|
|
20
|
+
state,
|
|
21
|
+
control,
|
|
22
|
+
children,
|
|
23
|
+
anchorRef,
|
|
24
|
+
slotProps,
|
|
25
|
+
className,
|
|
26
|
+
isNonModal,
|
|
27
|
+
popoverRef,
|
|
28
|
+
portalContainer,
|
|
29
|
+
hideCloseButton,
|
|
30
|
+
disableFocusManagement,
|
|
31
|
+
disableExitOnEscapeKeyDown,
|
|
32
|
+
shouldCloseOnInteractOutside,
|
|
33
|
+
...other
|
|
34
|
+
} = props;
|
|
35
|
+
const showArrow = !hideArrow;
|
|
36
|
+
const domRef = useDOMRef(popoverRef);
|
|
37
|
+
const controlRef = useRef(null);
|
|
38
|
+
const openState = state.isOpen;
|
|
39
|
+
const [opened, { on, off }] = useBoolean(openState);
|
|
40
|
+
const { triggerProps, overlayProps } = useOverlayTrigger(
|
|
41
|
+
{ type },
|
|
42
|
+
{ ...state, isOpen: openState }
|
|
43
|
+
);
|
|
44
|
+
const {
|
|
45
|
+
popoverProps,
|
|
46
|
+
underlayProps,
|
|
47
|
+
arrowProps: arrowPropsCommon,
|
|
48
|
+
placement
|
|
49
|
+
} = usePopover(
|
|
50
|
+
{
|
|
51
|
+
...props,
|
|
52
|
+
offset,
|
|
53
|
+
isNonModal,
|
|
54
|
+
crossOffset,
|
|
55
|
+
containerPadding,
|
|
56
|
+
popoverRef: domRef,
|
|
57
|
+
arrowBoundaryOffset,
|
|
58
|
+
maxHeight: maxBlockSize,
|
|
59
|
+
placement: placementProp,
|
|
60
|
+
shouldCloseOnInteractOutside,
|
|
61
|
+
triggerRef: anchorRef || controlRef,
|
|
62
|
+
isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
|
|
63
|
+
},
|
|
64
|
+
{ ...state, isOpen: openState || opened }
|
|
65
|
+
);
|
|
66
|
+
const resolvedChildren = () => {
|
|
67
|
+
if (typeof children === "function")
|
|
68
|
+
return cloneElement(children({ close: state.close }), overlayProps);
|
|
69
|
+
if (isValidElement(children)) return cloneElement(children, overlayProps);
|
|
70
|
+
return children;
|
|
71
|
+
};
|
|
72
|
+
const arrowProps = mergeProps(
|
|
73
|
+
{ className: s.arrow },
|
|
74
|
+
arrowPropsCommon,
|
|
75
|
+
slotProps?.arrow
|
|
76
|
+
);
|
|
77
|
+
const dialogProps = mergeProps(
|
|
78
|
+
{
|
|
79
|
+
role: "dialog",
|
|
80
|
+
hideCloseButton,
|
|
81
|
+
className: s.dialog,
|
|
82
|
+
onClose: state.close
|
|
83
|
+
},
|
|
84
|
+
slotProps?.dialog
|
|
85
|
+
);
|
|
86
|
+
const backdropProps = mergeProps(
|
|
87
|
+
{ className: s.underlay },
|
|
88
|
+
slotProps?.backdrop,
|
|
89
|
+
underlayProps
|
|
90
|
+
);
|
|
91
|
+
const transitionProps = mergeProps(
|
|
92
|
+
{
|
|
93
|
+
timeout: 120,
|
|
94
|
+
onEnter: on,
|
|
95
|
+
onExited: off,
|
|
96
|
+
appear: true,
|
|
97
|
+
in: openState,
|
|
98
|
+
nodeRef: domRef,
|
|
99
|
+
unmountOnExit: true
|
|
100
|
+
},
|
|
101
|
+
slotProps?.transition
|
|
102
|
+
);
|
|
103
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
104
|
+
control?.({
|
|
105
|
+
ref: controlRef,
|
|
106
|
+
...triggerProps
|
|
107
|
+
}),
|
|
108
|
+
/* @__PURE__ */ jsx(Transition, { ...transitionProps, children: (transition) => /* @__PURE__ */ jsxs(
|
|
109
|
+
Overlay,
|
|
110
|
+
{
|
|
111
|
+
portalContainer,
|
|
112
|
+
disableFocusManagement,
|
|
113
|
+
children: [
|
|
114
|
+
/* @__PURE__ */ jsx("div", { ...backdropProps }),
|
|
115
|
+
/* @__PURE__ */ jsxs(
|
|
116
|
+
"div",
|
|
117
|
+
{
|
|
118
|
+
ref: domRef,
|
|
119
|
+
"data-size": size,
|
|
120
|
+
"data-arrow": showArrow,
|
|
121
|
+
"data-placement": placement,
|
|
122
|
+
"data-transition": transition,
|
|
123
|
+
className: clsx(s.base, s[size], className),
|
|
124
|
+
...mergeProps(popoverProps, other),
|
|
125
|
+
style: {
|
|
126
|
+
...popoverProps.style,
|
|
127
|
+
"--popover-inline-size": normalizeInlineSize(size)
|
|
128
|
+
},
|
|
129
|
+
children: [
|
|
130
|
+
showArrow && /* @__PURE__ */ jsx("div", { ...arrowProps, "data-placement": placement }),
|
|
131
|
+
/* @__PURE__ */ jsx("div", { className: s.container, children: type === "dialog" ? /* @__PURE__ */ jsx(Dialog, { ...dialogProps, children: resolvedChildren() }) : resolvedChildren() })
|
|
132
|
+
]
|
|
133
|
+
}
|
|
134
|
+
)
|
|
135
|
+
]
|
|
136
|
+
}
|
|
137
|
+
) })
|
|
138
|
+
] });
|
|
139
|
+
};
|
|
140
|
+
export {
|
|
141
|
+
PopoverInner
|
|
142
|
+
};
|
|
@@ -33,5 +33,5 @@ export type RadioGroupBaseProps = ExtendableProps<{
|
|
|
33
33
|
defaultValue?: UseRadioGroupProps['defaultValue'];
|
|
34
34
|
/** Handler that is called when the value changes. */
|
|
35
35
|
onChange?: UseRadioGroupProps['onChange'];
|
|
36
|
-
}, UseRadioGroupProps
|
|
36
|
+
}, Omit<UseRadioGroupProps, 'validationBehavior' | 'validate' | 'validationState'>>;
|
|
37
37
|
export type RadioGroupProps = ExtendableComponentPropsWithRef<RadioGroupBaseProps, 'div'>;
|
|
@@ -4,9 +4,9 @@ import { deprecate } from "@koobiq/logger";
|
|
|
4
4
|
import { useDOMRef, useBoolean, useElementSize, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
5
|
import { IconChevronDownS16 } from "@koobiq/react-icons";
|
|
6
6
|
import { useSelectState, removeDataAttributes, useSelect, HiddenSelect } from "@koobiq/react-primitives";
|
|
7
|
+
import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
7
8
|
import s from "./Select.module.css.js";
|
|
8
9
|
import { FieldSelect } from "../FieldComponents/FieldSelect/FieldSelect.js";
|
|
9
|
-
import { PopoverInner } from "../Popover/Popover.js";
|
|
10
10
|
import { ListInner } from "../List/List.js";
|
|
11
11
|
import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
|
|
12
12
|
import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
|
|
@@ -114,7 +114,11 @@ function SelectRender(props, ref) {
|
|
|
114
114
|
slotProps?.list,
|
|
115
115
|
menuProps
|
|
116
116
|
);
|
|
117
|
-
const labelProps = mergeProps(
|
|
117
|
+
const labelProps = mergeProps(
|
|
118
|
+
{ isHidden: isLabelHidden, children: label, isRequired },
|
|
119
|
+
slotProps?.label,
|
|
120
|
+
labelPropsAria
|
|
121
|
+
);
|
|
118
122
|
const groupProps = mergeProps(
|
|
119
123
|
{
|
|
120
124
|
slotProps: {
|
|
@@ -142,8 +146,12 @@ function SelectRender(props, ref) {
|
|
|
142
146
|
valueProps,
|
|
143
147
|
triggerProps
|
|
144
148
|
);
|
|
145
|
-
const captionProps = mergeProps({
|
|
146
|
-
const errorProps = mergeProps(
|
|
149
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
|
|
150
|
+
const errorProps = mergeProps(
|
|
151
|
+
{ isInvalid, children: errorMessage },
|
|
152
|
+
slotProps?.errorMessage,
|
|
153
|
+
errorMessageProps
|
|
154
|
+
);
|
|
147
155
|
const popoverProps = mergeProps(
|
|
148
156
|
{
|
|
149
157
|
state,
|
|
@@ -167,7 +175,7 @@ function SelectRender(props, ref) {
|
|
|
167
175
|
const renderValue = renderValueProp || renderDefaultValue;
|
|
168
176
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
169
177
|
/* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
|
|
170
|
-
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps
|
|
178
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
|
|
171
179
|
/* @__PURE__ */ jsx(
|
|
172
180
|
HiddenSelect,
|
|
173
181
|
{
|
|
@@ -179,8 +187,8 @@ function SelectRender(props, ref) {
|
|
|
179
187
|
}
|
|
180
188
|
),
|
|
181
189
|
/* @__PURE__ */ jsx(FieldInputGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldSelect, { ...controlProps, children: renderValue(state?.selectedItem) }) }),
|
|
182
|
-
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps
|
|
183
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps
|
|
190
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
191
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
184
192
|
] }),
|
|
185
193
|
/* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(ListInner, { ...listProps }) })
|
|
186
194
|
] });
|
|
@@ -69,14 +69,14 @@ export type SelectProps<T extends object> = {
|
|
|
69
69
|
*/
|
|
70
70
|
isInvalid?: boolean;
|
|
71
71
|
/** Message for the error state */
|
|
72
|
-
errorMessage?:
|
|
72
|
+
errorMessage?: ReactNode;
|
|
73
73
|
/**
|
|
74
74
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
75
75
|
* @default false
|
|
76
76
|
*/
|
|
77
77
|
isLabelHidden?: boolean;
|
|
78
78
|
/** The helper text content. */
|
|
79
|
-
caption?:
|
|
79
|
+
caption?: ReactNode;
|
|
80
80
|
/**
|
|
81
81
|
* If true, the input will take up the full width of its container.
|
|
82
82
|
* @default false
|
|
@@ -4,17 +4,17 @@ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<{
|
|
|
4
4
|
required?: boolean;
|
|
5
5
|
hiddenLabel?: boolean;
|
|
6
6
|
readonly?: boolean;
|
|
7
|
-
} & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "label" | "className" | "cols" | "rows" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isReadOnly" | "isRequired" | "errorMessage" | "isLabelHidden" | "expand"> & {
|
|
7
|
+
} & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationState" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "label" | "className" | "cols" | "rows" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isReadOnly" | "isRequired" | "errorMessage" | "isLabelHidden" | "expand"> & {
|
|
8
8
|
label?: import("react").ReactNode;
|
|
9
9
|
className?: string;
|
|
10
10
|
variant?: import("./types").TextareaPropVariant;
|
|
11
11
|
isInvalid?: boolean;
|
|
12
12
|
isReadOnly?: boolean;
|
|
13
|
-
errorMessage?:
|
|
13
|
+
errorMessage?: import("react").ReactNode;
|
|
14
14
|
fullWidth?: boolean;
|
|
15
15
|
isDisabled?: boolean;
|
|
16
16
|
isLabelHidden?: boolean;
|
|
17
|
-
caption?:
|
|
17
|
+
caption?: import("react").ReactNode;
|
|
18
18
|
isRequired?: boolean;
|
|
19
19
|
rows?: number;
|
|
20
20
|
cols?: number;
|
package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js
CHANGED
|
@@ -39,23 +39,20 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
|
|
|
39
39
|
},
|
|
40
40
|
slotProps?.textarea
|
|
41
41
|
);
|
|
42
|
-
const captionProps = mergeProps(
|
|
43
|
-
{ isInvalid },
|
|
44
|
-
slotProps?.caption
|
|
45
|
-
);
|
|
42
|
+
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
46
43
|
const errorProps = mergeProps(
|
|
47
|
-
{ isInvalid },
|
|
44
|
+
{ isInvalid, children: errorMessage },
|
|
48
45
|
slotProps?.errorMessage
|
|
49
46
|
);
|
|
50
47
|
const labelProps = mergeProps(
|
|
51
|
-
{ isHidden: isLabelHidden, isRequired },
|
|
48
|
+
{ isHidden: isLabelHidden, children: label, isRequired },
|
|
52
49
|
slotProps?.label
|
|
53
50
|
);
|
|
54
51
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
55
|
-
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps
|
|
52
|
+
/* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
|
|
56
53
|
/* @__PURE__ */ jsx(FieldInput, { as: "textarea", ...textareaProps }),
|
|
57
|
-
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps
|
|
58
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps
|
|
54
|
+
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
55
|
+
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
59
56
|
] });
|
|
60
57
|
});
|
|
61
58
|
TextareaContextConsumer.displayName = "TextareaContextConsumer";
|
|
@@ -69,7 +69,7 @@ export type TextareaProps = ExtendableProps<{
|
|
|
69
69
|
*/
|
|
70
70
|
isReadOnly?: boolean;
|
|
71
71
|
/** Message for the error state */
|
|
72
|
-
errorMessage?:
|
|
72
|
+
errorMessage?: ReactNode;
|
|
73
73
|
/**
|
|
74
74
|
* If true, the input will take up the full width of its container.
|
|
75
75
|
* @default false
|
|
@@ -86,7 +86,7 @@ export type TextareaProps = ExtendableProps<{
|
|
|
86
86
|
*/
|
|
87
87
|
isLabelHidden?: boolean;
|
|
88
88
|
/** The helper text content. */
|
|
89
|
-
caption?:
|
|
89
|
+
caption?: ReactNode;
|
|
90
90
|
/**
|
|
91
91
|
* If `true`, the label is displayed as required and the input element is required.
|
|
92
92
|
* @default false
|
|
@@ -112,6 +112,6 @@ export type TextareaProps = ExtendableProps<{
|
|
|
112
112
|
textarea?: FieldInputProps<'textarea'>;
|
|
113
113
|
errorMessage?: FieldErrorProps;
|
|
114
114
|
};
|
|
115
|
-
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationBehavior' | 'validate' | 'children' | 'style' | 'className' | 'inputElementType'>>;
|
|
115
|
+
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationBehavior' | 'validationState' | 'validate' | 'children' | 'style' | 'className' | 'inputElementType'>>;
|
|
116
116
|
export type TextareaRef = ComponentRef<'textarea'>;
|
|
117
117
|
export {};
|
|
@@ -31,6 +31,7 @@ export * from './ButtonToggleGroup';
|
|
|
31
31
|
export * from './TagGroup';
|
|
32
32
|
export * from './Table';
|
|
33
33
|
export * from './Calendar';
|
|
34
|
+
export * from './DateInput';
|
|
34
35
|
export * from './layout';
|
|
35
|
-
export { useListData } from '@koobiq/react-primitives';
|
|
36
|
+
export { useListData, useDateFormatter, type DateFormatterOptions, } from '@koobiq/react-primitives';
|
|
36
37
|
export { useRouter, RouterProvider } from '@koobiq/react-primitives';
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* empty css */
|
|
2
|
-
import { RouterProvider, useListData, useLocale, useRouter } from "@koobiq/react-primitives";
|
|
2
|
+
import { RouterProvider, useDateFormatter, useListData, useLocale, useRouter } from "@koobiq/react-primitives";
|
|
3
3
|
import { Provider, defaultBreakpoints } from "./components/Provider/Provider.js";
|
|
4
4
|
import { BreakpointsProvider } from "./components/Provider/BreakpointsProvider.js";
|
|
5
5
|
import { ProviderContext, useProvider } from "./components/Provider/ProviderContext.js";
|
|
@@ -50,7 +50,7 @@ import { ModalContent, ModalFooter, ModalHeader } from "./components/Modal/index
|
|
|
50
50
|
import { SidePanel } from "./components/SidePanel/SidePanel.js";
|
|
51
51
|
import { sidePanelPropPosition, sidePanelPropSize } from "./components/SidePanel/types.js";
|
|
52
52
|
import { SidePanelContent, SidePanelFooter, SidePanelHeader } from "./components/SidePanel/index.js";
|
|
53
|
-
import { Popover
|
|
53
|
+
import { Popover } from "./components/Popover/Popover.js";
|
|
54
54
|
import { popoverPropPlacement, popoverPropSize, popoverPropType } from "./components/Popover/types.js";
|
|
55
55
|
import { PopoverContent, PopoverFooter, PopoverHeader } from "./components/Popover/index.js";
|
|
56
56
|
import { Tooltip } from "./components/Tooltip/Tooltip.js";
|
|
@@ -73,6 +73,8 @@ import { Tag } from "./components/TagGroup/Tag.js";
|
|
|
73
73
|
import { tagGroupPropVariant } from "./components/TagGroup/types.js";
|
|
74
74
|
import { Table } from "./components/Table/Table.js";
|
|
75
75
|
import { Calendar } from "./components/Calendar/Calendar.js";
|
|
76
|
+
import { DateInput, DateInputRender } from "./components/DateInput/DateInput.js";
|
|
77
|
+
import { dateInputPropVariant } from "./components/DateInput/types.js";
|
|
76
78
|
import { flex, flexPropAlignItems, flexPropDirection, flexPropFlex, flexPropGap, flexPropJustifyContent, flexPropOrder, flexPropWrap } from "./components/layout/flex/flex.js";
|
|
77
79
|
import { spacing, spacingGap } from "./components/layout/spacing/spacing.js";
|
|
78
80
|
export {
|
|
@@ -87,6 +89,8 @@ export {
|
|
|
87
89
|
Calendar,
|
|
88
90
|
Checkbox,
|
|
89
91
|
Container,
|
|
92
|
+
DateInput,
|
|
93
|
+
DateInputRender,
|
|
90
94
|
Divider,
|
|
91
95
|
FlexBox,
|
|
92
96
|
Grid,
|
|
@@ -109,7 +113,6 @@ export {
|
|
|
109
113
|
PopoverContent,
|
|
110
114
|
PopoverFooter,
|
|
111
115
|
PopoverHeader,
|
|
112
|
-
PopoverInner,
|
|
113
116
|
ProgressBar,
|
|
114
117
|
ProgressSpinner,
|
|
115
118
|
Provider,
|
|
@@ -142,6 +145,7 @@ export {
|
|
|
142
145
|
checkboxPropSize,
|
|
143
146
|
containerMarginsProp,
|
|
144
147
|
containerPositionProp,
|
|
148
|
+
dateInputPropVariant,
|
|
145
149
|
defaultBreakpoints,
|
|
146
150
|
dividerPropDisplay,
|
|
147
151
|
dividerPropOrientation,
|
|
@@ -187,6 +191,7 @@ export {
|
|
|
187
191
|
typographyPropDisplay,
|
|
188
192
|
typographyPropVariant,
|
|
189
193
|
useBreakpoints,
|
|
194
|
+
useDateFormatter,
|
|
190
195
|
useListData,
|
|
191
196
|
useLocale,
|
|
192
197
|
useMatchedBreakpoints,
|
package/dist/style.css
CHANGED
|
@@ -2109,6 +2109,7 @@
|
|
|
2109
2109
|
letter-spacing: var(--kbq-typography-text-compact-letter-spacing);
|
|
2110
2110
|
text-underline-offset: calc(( var(--kbq-typography-text-compact-line-height) - var(--kbq-typography-text-compact-font-size)) / 2);
|
|
2111
2111
|
color: var(--kbq-foreground-contrast-secondary);
|
|
2112
|
+
margin: 0;
|
|
2112
2113
|
transition: color var(--kbq-transition-default);
|
|
2113
2114
|
margin-block-start: var(--kbq-size-xxs);
|
|
2114
2115
|
}
|
|
@@ -2124,6 +2125,7 @@
|
|
|
2124
2125
|
letter-spacing: var(--kbq-typography-text-compact-letter-spacing);
|
|
2125
2126
|
text-underline-offset: calc(( var(--kbq-typography-text-compact-line-height) - var(--kbq-typography-text-compact-font-size)) / 2);
|
|
2126
2127
|
color: var(--kbq-foreground-error);
|
|
2128
|
+
margin: 0;
|
|
2127
2129
|
transition: color var(--kbq-transition-default);
|
|
2128
2130
|
margin-block-start: var(--kbq-size-xxs);
|
|
2129
2131
|
}
|
|
@@ -3748,6 +3750,113 @@
|
|
|
3748
3750
|
color: var(--kbq-states-foreground-disabled);
|
|
3749
3751
|
cursor: not-allowed;
|
|
3750
3752
|
}
|
|
3753
|
+
.kbq-dateinput-a4c39b {
|
|
3754
|
+
min-inline-size: 150px;
|
|
3755
|
+
}
|
|
3756
|
+
.kbq-fieldinputdate-a54331 {
|
|
3757
|
+
--field-input-outline-width: var(--kbq-size-3xs);
|
|
3758
|
+
--field-input-color: var(--kbq-foreground-contrast);
|
|
3759
|
+
--field-input-border-color: var(--kbq-line-contrast-fade);
|
|
3760
|
+
--field-input-outline-color: var(--kbq-states-line-focus-theme);
|
|
3761
|
+
--field-input-bg-color: var(--kbq-background-bg);
|
|
3762
|
+
--field-input-placeholder-color: var(--kbq-foreground-contrast-tertiary);
|
|
3763
|
+
cursor: pointer;
|
|
3764
|
+
outline-offset: -1px;
|
|
3765
|
+
box-sizing: border-box;
|
|
3766
|
+
inline-size: 100%;
|
|
3767
|
+
block-size: var(--kbq-size-3xl);
|
|
3768
|
+
border-radius: var(--kbq-size-s);
|
|
3769
|
+
color: var(--field-input-color);
|
|
3770
|
+
background: var(--field-input-bg-color);
|
|
3771
|
+
border: 1px solid var(--field-input-border-color);
|
|
3772
|
+
outline: var(--field-input-outline-width) solid transparent;
|
|
3773
|
+
padding-block: var(--field-input-padding-block-start) var(--field-input-padding-block-end);
|
|
3774
|
+
padding-inline: var(--field-input-padding-inline-start) var(--field-input-padding-inline-end);
|
|
3775
|
+
font-size: var(--kbq-typography-text-normal-font-size);
|
|
3776
|
+
font-weight: var(--kbq-typography-text-normal-font-weight);
|
|
3777
|
+
line-height: var(--kbq-typography-text-normal-line-height);
|
|
3778
|
+
font-family: var(--kbq-typography-text-normal-font-family);
|
|
3779
|
+
font-style: var(--kbq-typography-text-normal-font-style);
|
|
3780
|
+
text-transform: var(--kbq-typography-text-normal-text-transform);
|
|
3781
|
+
font-feature-settings: var(--kbq-typography-text-normal-font-feature-settings);
|
|
3782
|
+
letter-spacing: var(--kbq-typography-text-normal-letter-spacing);
|
|
3783
|
+
text-underline-offset: calc(( var(--kbq-typography-text-normal-line-height) - var(--kbq-typography-text-normal-font-size)) / 2);
|
|
3784
|
+
transition: color var(--kbq-transition-default), outline-color var(--kbq-transition-default), background-color var(--kbq-transition-default), border-color var(--kbq-transition-default);
|
|
3785
|
+
align-items: center;
|
|
3786
|
+
display: flex;
|
|
3787
|
+
}
|
|
3788
|
+
|
|
3789
|
+
.kbq-fieldinputdate-a54331:focus-within {
|
|
3790
|
+
outline-color: var(--field-input-outline-color);
|
|
3791
|
+
}
|
|
3792
|
+
|
|
3793
|
+
.kbq-fieldinputdate-transparent-04d912 {
|
|
3794
|
+
--field-input-color: var(--kbq-foreground-contrast);
|
|
3795
|
+
--field-input-border-color: transparent;
|
|
3796
|
+
--field-input-outline-color: transparent;
|
|
3797
|
+
--field-input-bg-color: transparent;
|
|
3798
|
+
--field-input-placeholder-color: var(--kbq-foreground-contrast-tertiary);
|
|
3799
|
+
}
|
|
3800
|
+
|
|
3801
|
+
.kbq-fieldinputdate-filled-02db7d {
|
|
3802
|
+
--field-input-color: var(--kbq-foreground-contrast);
|
|
3803
|
+
--field-input-border-color: var(--kbq-line-contrast-fade);
|
|
3804
|
+
--field-input-outline-color: var(--kbq-states-line-focus-theme);
|
|
3805
|
+
--field-input-bg-color: var(--kbq-background-bg);
|
|
3806
|
+
--field-input-placeholder-color: var(--kbq-foreground-contrast-tertiary);
|
|
3807
|
+
}
|
|
3808
|
+
|
|
3809
|
+
.kbq-fieldinputdate-filled-02db7d:where(.kbq-fieldinputdate-invalid-d764c6) {
|
|
3810
|
+
--field-input-color: var(--kbq-foreground-error);
|
|
3811
|
+
--field-input-border-color: var(--kbq-line-error);
|
|
3812
|
+
--field-input-outline-color: var(--kbq-states-line-focus-error);
|
|
3813
|
+
--field-input-bg-color: var(--kbq-states-background-error-less);
|
|
3814
|
+
--field-input-placeholder-color: var(--kbq-foreground-error-tertiary);
|
|
3815
|
+
}
|
|
3816
|
+
|
|
3817
|
+
.kbq-fieldinputdate-transparent-04d912:where(.kbq-fieldinputdate-invalid-d764c6) {
|
|
3818
|
+
--field-input-color: var(--kbq-foreground-error);
|
|
3819
|
+
--field-input-border-color: transparent;
|
|
3820
|
+
--field-input-outline-color: transparent;
|
|
3821
|
+
--field-input-bg-color: transparent;
|
|
3822
|
+
--field-input-placeholder-color: var(--kbq-foreground-error-tertiary);
|
|
3823
|
+
}
|
|
3824
|
+
|
|
3825
|
+
.kbq-fieldinputdate-disabled-692832 {
|
|
3826
|
+
cursor: not-allowed;
|
|
3827
|
+
}
|
|
3828
|
+
|
|
3829
|
+
.kbq-fieldinputdate-filled-02db7d:where(.kbq-fieldinputdate-disabled-692832) {
|
|
3830
|
+
--field-input-color: var(--kbq-states-foreground-disabled);
|
|
3831
|
+
--field-input-border-color: var(--kbq-states-line-disabled);
|
|
3832
|
+
--field-input-bg-color: var(--kbq-states-background-disabled);
|
|
3833
|
+
}
|
|
3834
|
+
|
|
3835
|
+
.kbq-fieldinputdate-transparent-04d912:where(.kbq-fieldinputdate-disabled-692832) {
|
|
3836
|
+
--field-input-color: var(--kbq-states-foreground-disabled);
|
|
3837
|
+
}
|
|
3838
|
+
.kbq-dateinputsegment-996e10 {
|
|
3839
|
+
--date-input-segment-color: var(--field-input-color);
|
|
3840
|
+
color: var(--date-input-segment-color);
|
|
3841
|
+
}
|
|
3842
|
+
|
|
3843
|
+
.kbq-dateinputsegment-996e10:focus {
|
|
3844
|
+
color: var(--date-input-segment-color);
|
|
3845
|
+
background-color: highlight;
|
|
3846
|
+
outline: none;
|
|
3847
|
+
}
|
|
3848
|
+
|
|
3849
|
+
.kbq-dateinputsegment-placeholder-be1df1 {
|
|
3850
|
+
color: var(--field-input-placeholder-color);
|
|
3851
|
+
}
|
|
3852
|
+
|
|
3853
|
+
.kbq-dateinputsegment-literal-d722fc {
|
|
3854
|
+
white-space: pre;
|
|
3855
|
+
}
|
|
3856
|
+
|
|
3857
|
+
.kbq-dateinputsegment-literal-d722fc:not(.kbq-dateinputsegment-hasValue-886d0f) {
|
|
3858
|
+
color: var(--field-input-placeholder-color);
|
|
3859
|
+
}
|
|
3751
3860
|
.kbq-spacing-mbs_0-be7021 {
|
|
3752
3861
|
margin-block-start: 0;
|
|
3753
3862
|
}
|