@koobiq/react-components 0.8.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/Alert/Alert.js +5 -3
- package/dist/components/Alert/types.d.ts +0 -3
- package/dist/components/Backdrop/Backdrop.js +1 -1
- package/dist/components/Backdrop/types.d.ts +4 -1
- package/dist/components/Button/Button.js +7 -7
- package/dist/components/Button/types.d.ts +0 -4
- package/dist/components/ButtonToggleGroup/ButtonToggleGroup.js +6 -6
- package/dist/components/ButtonToggleGroup/components/ButtonToggle/ButtonToggle.js +6 -6
- package/dist/components/ButtonToggleGroup/components/ButtonToggle/types.d.ts +0 -1
- package/dist/components/ButtonToggleGroup/types.d.ts +0 -3
- package/dist/components/Checkbox/Checkbox.js +6 -6
- package/dist/components/Checkbox/types.d.ts +0 -5
- package/dist/components/Container/Container.js +2 -2
- package/dist/components/Container/types.d.ts +0 -2
- package/dist/components/DateInput/DateInput.js +15 -11
- package/dist/components/DateInput/types.d.ts +1 -3
- package/dist/components/DatePicker/types.d.ts +1 -2
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Dialog/types.d.ts +0 -1
- package/dist/components/Divider/Divider.js +5 -4
- package/dist/components/Divider/types.d.ts +0 -2
- package/dist/components/FieldComponents/FieldAddon/FieldAddon.js +4 -4
- package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.js +2 -2
- package/dist/components/FieldComponents/FieldError/FieldError.d.ts +4 -2
- package/dist/components/FieldComponents/FieldError/FieldError.js +6 -8
- package/dist/components/FieldComponents/FieldInput/FieldInput.js +3 -3
- package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +2 -2
- package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +3 -3
- package/dist/components/FormControl/FormControl.js +2 -2
- package/dist/components/FormControlLabel/FormControlLabel.js +1 -8
- package/dist/components/IconButton/IconButton.js +4 -4
- package/dist/components/IconButton/types.d.ts +0 -3
- package/dist/components/Input/Input.d.ts +2 -3
- package/dist/components/Input/Input.js +11 -7
- package/dist/components/Input/Input.module.css.js +4 -0
- package/dist/components/Input/types.d.ts +1 -10
- package/dist/components/InputNumber/InputNumber.d.ts +2 -3
- package/dist/components/InputNumber/InputNumber.js +7 -7
- package/dist/components/InputNumber/types.d.ts +0 -9
- package/dist/components/Link/Link.js +3 -3
- package/dist/components/Link/types.d.ts +0 -5
- package/dist/components/List/components/ListOption/ListOption.js +5 -5
- package/dist/components/Modal/Modal.js +1 -1
- package/dist/components/Modal/types.d.ts +1 -5
- package/dist/components/Popover/PopoverInner.js +2 -2
- package/dist/components/Popover/types.d.ts +0 -4
- package/dist/components/RadioGroup/RadioGroup.js +8 -11
- package/dist/components/RadioGroup/components/Radio/types.d.ts +0 -1
- package/dist/components/RadioGroup/types.d.ts +1 -8
- package/dist/components/SearchInput/SearchInput.d.ts +2 -3
- package/dist/components/SearchInput/SearchInput.js +13 -12
- package/dist/components/SearchInput/types.d.ts +1 -5
- package/dist/components/Select/Select.js +11 -14
- package/dist/components/Select/components/SelectOption/SelectOption.js +5 -5
- package/dist/components/Select/types.d.ts +4 -6
- package/dist/components/SidePanel/SidePanel.js +1 -1
- package/dist/components/SidePanel/types.d.ts +0 -5
- package/dist/components/Table/Table.js +4 -4
- package/dist/components/Table/components/TableRow/TableRow.js +5 -5
- package/dist/components/Table/types.d.ts +0 -2
- package/dist/components/TagGroup/components/Tag/Tag.js +6 -6
- package/dist/components/Textarea/Textarea.d.ts +1 -2
- package/dist/components/Textarea/Textarea.js +6 -6
- package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +1 -1
- package/dist/components/Textarea/types.d.ts +1 -10
- package/dist/components/TimePicker/TimePicker.d.ts +1 -1
- package/dist/components/TimePicker/TimePicker.js +15 -11
- package/dist/components/TimePicker/types.d.ts +0 -2
- package/dist/components/Toggle/Toggle.js +3 -3
- package/dist/components/Toggle/types.d.ts +0 -3
- package/dist/components/Tooltip/Tooltip.js +9 -9
- package/dist/components/Tooltip/types.d.ts +0 -3
- package/dist/style.css +7 -0
- package/package.json +5 -5
|
@@ -3,7 +3,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
3
3
|
import { forwardRef } from "react";
|
|
4
4
|
import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
5
5
|
import { IconMagnifyingGlass16, IconXmarkCircle16 } from "@koobiq/react-icons";
|
|
6
|
-
import { useSearchFieldState, removeDataAttributes, useSearchField } from "@koobiq/react-primitives";
|
|
6
|
+
import { useSearchFieldState, removeDataAttributes, useSearchField, FieldErrorContext } from "@koobiq/react-primitives";
|
|
7
7
|
import s from "./SearchInput.module.css.js";
|
|
8
8
|
import { IconButton } from "../IconButton/IconButton.js";
|
|
9
9
|
import { FormControl } from "../FormControl/FormControl.js";
|
|
@@ -18,20 +18,19 @@ const SearchInput = forwardRef(
|
|
|
18
18
|
const {
|
|
19
19
|
startAddon = /* @__PURE__ */ jsx(IconMagnifyingGlass16, { className: s.searchIcon }),
|
|
20
20
|
variant = "filled",
|
|
21
|
-
fullWidth
|
|
22
|
-
isLabelHidden
|
|
21
|
+
fullWidth,
|
|
22
|
+
isLabelHidden,
|
|
23
23
|
labelPlacement,
|
|
24
|
+
errorMessage,
|
|
24
25
|
labelAlign,
|
|
25
26
|
"data-testid": testId,
|
|
26
27
|
style,
|
|
27
28
|
className,
|
|
28
29
|
caption,
|
|
29
|
-
errorMessage,
|
|
30
30
|
isRequired,
|
|
31
31
|
isReadOnly,
|
|
32
32
|
label,
|
|
33
33
|
endAddon,
|
|
34
|
-
isInvalid,
|
|
35
34
|
isDisabled,
|
|
36
35
|
slotProps
|
|
37
36
|
} = props;
|
|
@@ -43,8 +42,10 @@ const SearchInput = forwardRef(
|
|
|
43
42
|
inputProps: inputPropsAria,
|
|
44
43
|
descriptionProps: descriptionPropsAria,
|
|
45
44
|
errorMessageProps: errorMessagePropsAria,
|
|
46
|
-
clearButtonProps: clearButtonPropsAria
|
|
45
|
+
clearButtonProps: clearButtonPropsAria,
|
|
46
|
+
...validation
|
|
47
47
|
} = useSearchField(removeDataAttributes(props), state, domRef);
|
|
48
|
+
const { isInvalid } = validation;
|
|
48
49
|
const rootProps = mergeProps(
|
|
49
50
|
{
|
|
50
51
|
style,
|
|
@@ -53,10 +54,10 @@ const SearchInput = forwardRef(
|
|
|
53
54
|
fullWidth,
|
|
54
55
|
"data-testid": testId,
|
|
55
56
|
"data-variant": variant,
|
|
56
|
-
"data-invalid": isInvalid,
|
|
57
|
-
"data-
|
|
58
|
-
"data-
|
|
59
|
-
"data-
|
|
57
|
+
"data-invalid": isInvalid || void 0,
|
|
58
|
+
"data-readonly": isReadOnly || void 0,
|
|
59
|
+
"data-disabled": isDisabled || void 0,
|
|
60
|
+
"data-required": isRequired || void 0,
|
|
60
61
|
className: clsx(s.base, className)
|
|
61
62
|
},
|
|
62
63
|
slotProps?.root
|
|
@@ -105,7 +106,7 @@ const SearchInput = forwardRef(
|
|
|
105
106
|
);
|
|
106
107
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionPropsAria);
|
|
107
108
|
const errorProps = mergeProps(
|
|
108
|
-
{
|
|
109
|
+
{ children: errorMessage },
|
|
109
110
|
slotProps?.errorMessage,
|
|
110
111
|
errorMessagePropsAria
|
|
111
112
|
);
|
|
@@ -114,7 +115,7 @@ const SearchInput = forwardRef(
|
|
|
114
115
|
/* @__PURE__ */ jsxs(Field, { children: [
|
|
115
116
|
/* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
|
|
116
117
|
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
117
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
118
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
|
|
118
119
|
] })
|
|
119
120
|
] });
|
|
120
121
|
}
|
|
@@ -18,7 +18,6 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
18
18
|
style?: CSSProperties;
|
|
19
19
|
/**
|
|
20
20
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
21
|
-
* @default false
|
|
22
21
|
*/
|
|
23
22
|
isLabelHidden?: boolean;
|
|
24
23
|
/**
|
|
@@ -45,8 +44,6 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
45
44
|
errorMessage?: FieldErrorProps;
|
|
46
45
|
clearButton?: IconButtonProps;
|
|
47
46
|
};
|
|
48
|
-
/** An error message for the field. */
|
|
49
|
-
errorMessage?: ReactNode;
|
|
50
47
|
/** The helper text content. */
|
|
51
48
|
caption?: ReactNode;
|
|
52
49
|
/**
|
|
@@ -56,8 +53,7 @@ export type SearchInputProps = ExtendableProps<{
|
|
|
56
53
|
variant?: SearchInputPropVariant;
|
|
57
54
|
/**
|
|
58
55
|
* If `true`, the input will take up the full width of its container.
|
|
59
|
-
* @default false
|
|
60
56
|
*/
|
|
61
57
|
fullWidth?: boolean;
|
|
62
|
-
} & DataAttributeProps, Omit<AriaSearchFieldProps, 'description' | '
|
|
58
|
+
} & DataAttributeProps, Omit<AriaSearchFieldProps, 'description' | 'validationState'>>;
|
|
63
59
|
export type SearchInputRef = ComponentRef<'input'>;
|
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef, useCallback } from "react";
|
|
3
3
|
import { useLocalizedStringFormatter, useDOMRef, useElementSize, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { IconXmarkCircle16, IconChevronDownS16 } from "@koobiq/react-icons";
|
|
5
|
-
import { useMultiSelectState, removeDataAttributes, useMultiSelect } from "@koobiq/react-primitives";
|
|
5
|
+
import { useMultiSelectState, removeDataAttributes, useMultiSelect, FieldErrorContext } from "@koobiq/react-primitives";
|
|
6
6
|
import { PopoverInner } from "../Popover/PopoverInner.js";
|
|
7
7
|
import intlMessages from "./intl.js";
|
|
8
8
|
import s from "./Select.module.css.js";
|
|
@@ -22,8 +22,8 @@ import { Section } from "../Collections/Section.js";
|
|
|
22
22
|
import { Divider } from "../Collections/Divider.js";
|
|
23
23
|
function SelectRender(props, ref) {
|
|
24
24
|
const {
|
|
25
|
-
fullWidth
|
|
26
|
-
isClearable
|
|
25
|
+
fullWidth,
|
|
26
|
+
isClearable,
|
|
27
27
|
"data-testid": testId,
|
|
28
28
|
selectionMode = "single",
|
|
29
29
|
selectedTagsOverflow = "responsive",
|
|
@@ -55,13 +55,13 @@ function SelectRender(props, ref) {
|
|
|
55
55
|
onClear?.();
|
|
56
56
|
}, [onClear, state]);
|
|
57
57
|
const {
|
|
58
|
-
isInvalid,
|
|
59
58
|
menuProps,
|
|
60
59
|
valueProps,
|
|
61
60
|
triggerProps,
|
|
62
61
|
labelProps: labelPropsAria,
|
|
63
62
|
descriptionProps,
|
|
64
|
-
errorMessageProps
|
|
63
|
+
errorMessageProps,
|
|
64
|
+
...validation
|
|
65
65
|
} = useMultiSelect(
|
|
66
66
|
removeDataAttributes({
|
|
67
67
|
...props,
|
|
@@ -71,12 +71,13 @@ function SelectRender(props, ref) {
|
|
|
71
71
|
state,
|
|
72
72
|
domRef
|
|
73
73
|
);
|
|
74
|
+
const { isInvalid } = validation;
|
|
74
75
|
const { ref: containerRef, width } = useElementSize();
|
|
75
76
|
const rootProps = mergeProps({
|
|
76
77
|
"data-testid": testId,
|
|
77
|
-
"data-invalid": isInvalid,
|
|
78
|
-
"data-disabled": props.isDisabled,
|
|
79
|
-
"data-required": props.isRequired,
|
|
78
|
+
"data-invalid": isInvalid || void 0,
|
|
79
|
+
"data-disabled": props.isDisabled || void 0,
|
|
80
|
+
"data-required": props.isRequired || void 0,
|
|
80
81
|
className,
|
|
81
82
|
fullWidth,
|
|
82
83
|
labelPlacement,
|
|
@@ -147,11 +148,7 @@ function SelectRender(props, ref) {
|
|
|
147
148
|
slotProps?.popover
|
|
148
149
|
);
|
|
149
150
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
|
|
150
|
-
const errorProps = mergeProps(
|
|
151
|
-
{ isInvalid, children: errorMessage },
|
|
152
|
-
slotProps?.errorMessage,
|
|
153
|
-
errorMessageProps
|
|
154
|
-
);
|
|
151
|
+
const errorProps = mergeProps({ children: errorMessage }, slotProps?.errorMessage, errorMessageProps);
|
|
155
152
|
const renderDefaultValue = (state2, states) => {
|
|
156
153
|
if (!state2.selectedItems) return null;
|
|
157
154
|
if (selectionMode === "multiple")
|
|
@@ -176,7 +173,7 @@ function SelectRender(props, ref) {
|
|
|
176
173
|
isRequired: props.isRequired
|
|
177
174
|
}) }) }),
|
|
178
175
|
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
179
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
176
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
|
|
180
177
|
] })
|
|
181
178
|
] }),
|
|
182
179
|
/* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(SelectList, { ...listProps }) })
|
|
@@ -25,11 +25,11 @@ function SelectOption({ item, state }) {
|
|
|
25
25
|
className: clsx(listItem, textVariant["text-normal"], className),
|
|
26
26
|
style,
|
|
27
27
|
ref,
|
|
28
|
-
"data-hovered": isHovered,
|
|
29
|
-
"data-pressed": isPressed,
|
|
30
|
-
"data-disabled": isDisabled,
|
|
31
|
-
"data-selected": isSelected,
|
|
32
|
-
"data-focus-visible": isFocusVisible,
|
|
28
|
+
"data-hovered": isHovered || void 0,
|
|
29
|
+
"data-pressed": isPressed || void 0,
|
|
30
|
+
"data-disabled": isDisabled || void 0,
|
|
31
|
+
"data-selected": isSelected || void 0,
|
|
32
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
33
33
|
children: [
|
|
34
34
|
state.selectionMode === "multiple" && /* @__PURE__ */ jsx(Checkbox, { isDisabled, isSelected, isReadOnly: true }),
|
|
35
35
|
item.rendered
|
|
@@ -19,7 +19,7 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
19
19
|
*
|
|
20
20
|
*- `"multiline"` — tags wrap to multiple lines.
|
|
21
21
|
*- `"responsive"` — tags collapse into a summary (e.g., "3 more").
|
|
22
|
-
* @default
|
|
22
|
+
* @default 'responsive'
|
|
23
23
|
*/
|
|
24
24
|
selectedTagsOverflow?: SelectPropSelectedTagsOverflow;
|
|
25
25
|
/** Handler that is called when the clear button is clicked. */
|
|
@@ -34,6 +34,8 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
34
34
|
onSelectionChange?: Parameters<typeof useMultiSelectState>['0']['onSelectionChange'];
|
|
35
35
|
/** The currently selected keys in the collection (controlled). */
|
|
36
36
|
selectedKeys?: Parameters<typeof useMultiSelectState>['0']['selectedKeys'];
|
|
37
|
+
validate?: Parameters<typeof useMultiSelectState>['0']['validate'];
|
|
38
|
+
validationBehavior?: Parameters<typeof useMultiSelectState>['0']['validationBehavior'];
|
|
37
39
|
/**
|
|
38
40
|
* The type of selection that is allowed in the collection.
|
|
39
41
|
* @default 'single'
|
|
@@ -45,11 +47,8 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
45
47
|
endAddon?: ReactNode;
|
|
46
48
|
/** Inline styles. */
|
|
47
49
|
style?: CSSProperties;
|
|
48
|
-
/** An error message for the field. */
|
|
49
|
-
errorMessage?: ReactNode;
|
|
50
50
|
/**
|
|
51
51
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
52
|
-
* @default false
|
|
53
52
|
*/
|
|
54
53
|
isLabelHidden?: boolean;
|
|
55
54
|
/**
|
|
@@ -66,7 +65,6 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
66
65
|
caption?: ReactNode;
|
|
67
66
|
/**
|
|
68
67
|
* If true, the input will take up the full width of its container.
|
|
69
|
-
* @default false
|
|
70
68
|
*/
|
|
71
69
|
fullWidth?: boolean;
|
|
72
70
|
/** Unique identifier for testing purposes. */
|
|
@@ -90,6 +88,6 @@ export type SelectProps<T> = ExtendableProps<{
|
|
|
90
88
|
errorMessage?: FieldErrorProps;
|
|
91
89
|
clearButton?: IconButtonProps;
|
|
92
90
|
};
|
|
93
|
-
}, Omit<AriaSelectProps<T>, 'description' | '
|
|
91
|
+
}, Omit<AriaSelectProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState' | 'selectedKey' | 'onSelectionChange' | 'defaultSelectedKey'>>;
|
|
94
92
|
export type SelectComponent = <T>(props: SelectProps<T>) => ReactElement | null;
|
|
95
93
|
export type SelectRef = ComponentRef<'div'>;
|
|
@@ -48,7 +48,6 @@ export type SidePanelProps = {
|
|
|
48
48
|
control?: SidePanelPropControl;
|
|
49
49
|
/**
|
|
50
50
|
* If `true`, the close button isn't shown.
|
|
51
|
-
* @default false
|
|
52
51
|
*/
|
|
53
52
|
hideCloseButton?: boolean;
|
|
54
53
|
/** Handler that is called when the modal's open state changes. */
|
|
@@ -60,17 +59,14 @@ export type SidePanelProps = {
|
|
|
60
59
|
portalContainer?: Element;
|
|
61
60
|
/**
|
|
62
61
|
* If `true`, the modal window won't close when clicked outside of it.
|
|
63
|
-
* @default false
|
|
64
62
|
*/
|
|
65
63
|
disableExitOnClickOutside?: boolean;
|
|
66
64
|
/**
|
|
67
65
|
* If `true`, the modal window won't close when the ESC key is pressed.
|
|
68
|
-
* @default false
|
|
69
66
|
*/
|
|
70
67
|
disableExitOnEscapeKeyDown?: boolean;
|
|
71
68
|
/**
|
|
72
69
|
* If `true`, the underlay (backdrop) under the modal window isn't shown.
|
|
73
|
-
* @default false
|
|
74
70
|
*/
|
|
75
71
|
hideBackdrop?: boolean;
|
|
76
72
|
/** Additional CSS-classes. */
|
|
@@ -79,7 +75,6 @@ export type SidePanelProps = {
|
|
|
79
75
|
'data-testid'?: string | number;
|
|
80
76
|
/**
|
|
81
77
|
* If `true`, the focus trap in modal window is disabled.
|
|
82
|
-
* @default false
|
|
83
78
|
*/
|
|
84
79
|
disableFocusManagement?: boolean;
|
|
85
80
|
/**
|
|
@@ -21,9 +21,9 @@ import { Cell } from "../Collections/Cell.js";
|
|
|
21
21
|
const textNormal = utilClasses.typography["text-normal"];
|
|
22
22
|
function TableRender(props, ref) {
|
|
23
23
|
const {
|
|
24
|
-
stickyHeader = false,
|
|
25
|
-
fullWidth = false,
|
|
26
24
|
divider = "none",
|
|
25
|
+
stickyHeader,
|
|
26
|
+
fullWidth,
|
|
27
27
|
slotProps,
|
|
28
28
|
selectionMode,
|
|
29
29
|
selectionBehavior,
|
|
@@ -41,9 +41,9 @@ function TableRender(props, ref) {
|
|
|
41
41
|
const tableProps = mergeProps(
|
|
42
42
|
{
|
|
43
43
|
className: clsx(s.base, fullWidth && s.fullWidth, textNormal, className),
|
|
44
|
-
"data-sticky-header": stickyHeader,
|
|
44
|
+
"data-sticky-header": stickyHeader || void 0,
|
|
45
45
|
"data-divider": divider,
|
|
46
|
-
"data-fullwidth": fullWidth,
|
|
46
|
+
"data-fullwidth": fullWidth || void 0,
|
|
47
47
|
ref: domRef,
|
|
48
48
|
style
|
|
49
49
|
},
|
|
@@ -29,11 +29,11 @@ function TableRow({ item, children, state }) {
|
|
|
29
29
|
isFocusVisible && s.focusVisible,
|
|
30
30
|
className
|
|
31
31
|
),
|
|
32
|
-
"data-hovered": isHovered,
|
|
33
|
-
"data-disabled": isDisabled,
|
|
34
|
-
"data-selected": isSelected,
|
|
35
|
-
"data-pressed": isPressed,
|
|
36
|
-
"data-focus-visible": isFocusVisible,
|
|
32
|
+
"data-hovered": isHovered || void 0,
|
|
33
|
+
"data-disabled": isDisabled || void 0,
|
|
34
|
+
"data-selected": isSelected || void 0,
|
|
35
|
+
"data-pressed": isPressed || void 0,
|
|
36
|
+
"data-focus-visible": isFocusVisible || void 0,
|
|
37
37
|
...mergeProps(rowProps, hoverProps, focusProps),
|
|
38
38
|
style,
|
|
39
39
|
ref,
|
|
@@ -20,12 +20,10 @@ export type TableProps<T> = Pick<TableStateProps<T>, 'selectionBehavior' | 'sele
|
|
|
20
20
|
divider?: TablePropDivider;
|
|
21
21
|
/**
|
|
22
22
|
* If `true`, the button will take up the full width of its container.
|
|
23
|
-
* @default false
|
|
24
23
|
*/
|
|
25
24
|
fullWidth?: boolean;
|
|
26
25
|
/**
|
|
27
26
|
* Flag indicating a fixed table header.
|
|
28
|
-
* @default false
|
|
29
27
|
*/
|
|
30
28
|
stickyHeader?: boolean;
|
|
31
29
|
/**
|
|
@@ -37,12 +37,12 @@ function Tag(props) {
|
|
|
37
37
|
),
|
|
38
38
|
style,
|
|
39
39
|
"data-variant": variant,
|
|
40
|
-
"data-focused": isFocused,
|
|
41
|
-
"data-pressed": isPressed,
|
|
42
|
-
"data-hovered": isHovered,
|
|
43
|
-
"aria-disabled": isDisabled,
|
|
44
|
-
"data-disabled": isDisabled,
|
|
45
|
-
"data-focus-visible": isFocusVisible
|
|
40
|
+
"data-focused": isFocused || void 0,
|
|
41
|
+
"data-pressed": isPressed || void 0,
|
|
42
|
+
"data-hovered": isHovered || void 0,
|
|
43
|
+
"aria-disabled": isDisabled || void 0,
|
|
44
|
+
"data-disabled": isDisabled || void 0,
|
|
45
|
+
"data-focus-visible": isFocusVisible || void 0
|
|
46
46
|
},
|
|
47
47
|
rowProps,
|
|
48
48
|
hoverProps,
|
|
@@ -4,11 +4,10 @@ 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" | "validationState" | "
|
|
7
|
+
} & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationState" | "description" | "inputElementType">, "caption" | "style" | "className" | "cols" | "rows" | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "data-testid" | "isLabelHidden" | "expand"> & {
|
|
8
8
|
className?: string;
|
|
9
9
|
style?: import("react").CSSProperties;
|
|
10
10
|
variant?: import("./types").TextareaPropVariant;
|
|
11
|
-
errorMessage?: import("react").ReactNode;
|
|
12
11
|
fullWidth?: boolean;
|
|
13
12
|
isLabelHidden?: boolean;
|
|
14
13
|
labelPlacement?: import("./types").TextareaPropLabelPlacement;
|
|
@@ -9,7 +9,7 @@ import { FormControl } from "../FormControl/FormControl.js";
|
|
|
9
9
|
const Textarea = forwardRef((props, ref) => {
|
|
10
10
|
const {
|
|
11
11
|
variant = "filled",
|
|
12
|
-
fullWidth
|
|
12
|
+
fullWidth,
|
|
13
13
|
hiddenLabel,
|
|
14
14
|
isLabelHidden: isLabelHiddenProp,
|
|
15
15
|
disabled,
|
|
@@ -31,11 +31,11 @@ const Textarea = forwardRef((props, ref) => {
|
|
|
31
31
|
label,
|
|
32
32
|
...other
|
|
33
33
|
} = props;
|
|
34
|
-
const isDisabled = isDisabledProp ?? disabled
|
|
35
|
-
const isRequired = isRequiredProp ?? required
|
|
36
|
-
const isReadOnly = isReadOnlyProp ?? readonly
|
|
37
|
-
const isInvalid = isInvalidProp ?? error
|
|
38
|
-
const isLabelHidden = isLabelHiddenProp ?? hiddenLabel
|
|
34
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
35
|
+
const isRequired = isRequiredProp ?? required;
|
|
36
|
+
const isReadOnly = isReadOnlyProp ?? readonly;
|
|
37
|
+
const isInvalid = isInvalidProp ?? error;
|
|
38
|
+
const isLabelHidden = isLabelHiddenProp ?? hiddenLabel;
|
|
39
39
|
if (process.env.NODE_ENV !== "production" && "disabled" in props) {
|
|
40
40
|
deprecate(
|
|
41
41
|
'Textarea: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
|
package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js
CHANGED
|
@@ -43,7 +43,7 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
|
|
|
43
43
|
);
|
|
44
44
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption);
|
|
45
45
|
const errorProps = mergeProps(
|
|
46
|
-
{
|
|
46
|
+
{ children: errorMessage, className: s.error },
|
|
47
47
|
slotProps?.errorMessage
|
|
48
48
|
);
|
|
49
49
|
const groupProps = {
|
|
@@ -15,35 +15,30 @@ export type TextareaPropLabelAlign = FormControlPropLabelAlign;
|
|
|
15
15
|
type TextareaDeprecatedProps = {
|
|
16
16
|
/**
|
|
17
17
|
* If `true`, the component is disabled.
|
|
18
|
-
* @default false
|
|
19
18
|
* @deprecated
|
|
20
19
|
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
21
20
|
*/
|
|
22
21
|
disabled?: boolean;
|
|
23
22
|
/**
|
|
24
23
|
* If `true`, the input will indicate an error.
|
|
25
|
-
* @default false
|
|
26
24
|
* @deprecated
|
|
27
25
|
* The "error" prop is deprecated. Use "isInvalid" prop to replace it.
|
|
28
26
|
*/
|
|
29
27
|
error?: boolean;
|
|
30
28
|
/**
|
|
31
29
|
* If `true`, the label is displayed as required and the input element is required.
|
|
32
|
-
* @default false
|
|
33
30
|
* @deprecated
|
|
34
31
|
* The "required" prop is deprecated. Use "isRequired" prop to replace it.
|
|
35
32
|
*/
|
|
36
33
|
required?: boolean;
|
|
37
34
|
/**
|
|
38
35
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
39
|
-
* @default false
|
|
40
36
|
* @deprecated
|
|
41
37
|
* The "hiddenLabel" prop is deprecated. Use "isLabelHidden" prop to replace it.
|
|
42
38
|
*/
|
|
43
39
|
hiddenLabel?: boolean;
|
|
44
40
|
/**
|
|
45
41
|
* If `true`, the input can be selected but not changed by the user.
|
|
46
|
-
* @default false
|
|
47
42
|
* @deprecated
|
|
48
43
|
* The "readonly" prop is deprecated. Use "isReadOnly" prop to replace it.
|
|
49
44
|
*/
|
|
@@ -59,16 +54,12 @@ export type TextareaProps = ExtendableProps<{
|
|
|
59
54
|
* @default 'filled'
|
|
60
55
|
*/
|
|
61
56
|
variant?: TextareaPropVariant;
|
|
62
|
-
/** An error message for the field. */
|
|
63
|
-
errorMessage?: ReactNode;
|
|
64
57
|
/**
|
|
65
58
|
* If true, the input will take up the full width of its container.
|
|
66
|
-
* @default false
|
|
67
59
|
*/
|
|
68
60
|
fullWidth?: boolean;
|
|
69
61
|
/**
|
|
70
62
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
71
|
-
* @default false
|
|
72
63
|
*/
|
|
73
64
|
isLabelHidden?: boolean;
|
|
74
65
|
/**
|
|
@@ -103,6 +94,6 @@ export type TextareaProps = ExtendableProps<{
|
|
|
103
94
|
textarea?: FieldInputProps<'textarea'>;
|
|
104
95
|
errorMessage?: FieldErrorProps;
|
|
105
96
|
};
|
|
106
|
-
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | '
|
|
97
|
+
}, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationState' | 'children' | 'style' | 'className' | 'inputElementType'>>;
|
|
107
98
|
export type TextareaRef = ComponentRef<'textarea'>;
|
|
108
99
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type Ref } from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type TimeValue } from '@koobiq/react-primitives';
|
|
3
3
|
import type { TimePickerComponent, TimePickerProps, TimePickerRef } from './types';
|
|
4
4
|
export declare function TimePickerRender<T extends TimeValue>(props: Omit<TimePickerProps<T>, 'ref'>, ref: Ref<TimePickerRef>): import("react/jsx-runtime").JSX.Element;
|
|
5
5
|
export declare const TimePicker: TimePickerComponent;
|
|
@@ -2,7 +2,7 @@ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
3
|
import { useLocale, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
|
|
4
4
|
import { IconClock16 } from "@koobiq/react-icons";
|
|
5
|
-
import { useTimeFieldState, removeDataAttributes, useTimeField } from "@koobiq/react-primitives";
|
|
5
|
+
import { useTimeFieldState, removeDataAttributes, useTimeField, FieldErrorContext } from "@koobiq/react-primitives";
|
|
6
6
|
import s from "./TimePicker.module.css.js";
|
|
7
7
|
import { FormControl } from "../FormControl/FormControl.js";
|
|
8
8
|
import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
|
|
@@ -18,6 +18,7 @@ function TimePickerRender(props, ref) {
|
|
|
18
18
|
const {
|
|
19
19
|
isLabelHidden,
|
|
20
20
|
labelPlacement,
|
|
21
|
+
errorMessage,
|
|
21
22
|
labelAlign,
|
|
22
23
|
caption,
|
|
23
24
|
label,
|
|
@@ -28,7 +29,6 @@ function TimePickerRender(props, ref) {
|
|
|
28
29
|
className,
|
|
29
30
|
endAddon,
|
|
30
31
|
startAddon,
|
|
31
|
-
errorMessage,
|
|
32
32
|
"data-testid": testId
|
|
33
33
|
} = props;
|
|
34
34
|
const state = useTimeFieldState({
|
|
@@ -40,9 +40,11 @@ function TimePickerRender(props, ref) {
|
|
|
40
40
|
fieldProps,
|
|
41
41
|
descriptionProps,
|
|
42
42
|
errorMessageProps,
|
|
43
|
+
inputProps,
|
|
43
44
|
...validation
|
|
44
45
|
} = useTimeField(removeDataAttributes(props), state, domRef);
|
|
45
|
-
const {
|
|
46
|
+
const { isDisabled, isRequired, isReadOnly } = state;
|
|
47
|
+
const { isInvalid } = validation;
|
|
46
48
|
const rootProps = mergeProps(
|
|
47
49
|
{
|
|
48
50
|
style,
|
|
@@ -51,10 +53,10 @@ function TimePickerRender(props, ref) {
|
|
|
51
53
|
labelAlign,
|
|
52
54
|
"data-testid": testId,
|
|
53
55
|
"data-variant": variant,
|
|
54
|
-
"data-invalid": isInvalid,
|
|
55
|
-
"data-disabled": isDisabled,
|
|
56
|
-
"data-required": isRequired,
|
|
57
|
-
"data-readonly": isReadOnly,
|
|
56
|
+
"data-invalid": isInvalid || void 0,
|
|
57
|
+
"data-disabled": isDisabled || void 0,
|
|
58
|
+
"data-required": isRequired || void 0,
|
|
59
|
+
"data-readonly": isReadOnly || void 0,
|
|
58
60
|
className: clsx(s.base, className)
|
|
59
61
|
},
|
|
60
62
|
slotProps?.root
|
|
@@ -90,8 +92,7 @@ function TimePickerRender(props, ref) {
|
|
|
90
92
|
const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
|
|
91
93
|
const errorProps = mergeProps(
|
|
92
94
|
{
|
|
93
|
-
|
|
94
|
-
children: typeof errorMessage === "function" ? errorMessage({ ...validation }) : errorMessage
|
|
95
|
+
children: errorMessage
|
|
95
96
|
},
|
|
96
97
|
slotProps?.errorMessage,
|
|
97
98
|
errorMessageProps
|
|
@@ -104,11 +105,14 @@ function TimePickerRender(props, ref) {
|
|
|
104
105
|
{
|
|
105
106
|
...groupProps,
|
|
106
107
|
slotProps: { startAddon: { className: s.startAddon } },
|
|
107
|
-
children: /* @__PURE__ */
|
|
108
|
+
children: /* @__PURE__ */ jsxs(FieldInputDate, { ...controlProps, children: [
|
|
109
|
+
state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)),
|
|
110
|
+
/* @__PURE__ */ jsx("input", { ...inputProps })
|
|
111
|
+
] })
|
|
108
112
|
}
|
|
109
113
|
),
|
|
110
114
|
/* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
|
|
111
|
-
/* @__PURE__ */ jsx(FieldError, { ...errorProps })
|
|
115
|
+
/* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
|
|
112
116
|
] })
|
|
113
117
|
] });
|
|
114
118
|
}
|
|
@@ -24,7 +24,6 @@ export type TimePickerProps<T extends TimeValue> = {
|
|
|
24
24
|
variant?: DateInputPropVariant;
|
|
25
25
|
/**
|
|
26
26
|
* If true, the input will take up the full width of its container.
|
|
27
|
-
* @default false
|
|
28
27
|
*/
|
|
29
28
|
fullWidth?: boolean;
|
|
30
29
|
/** The props used for each slot inside. */
|
|
@@ -40,7 +39,6 @@ export type TimePickerProps<T extends TimeValue> = {
|
|
|
40
39
|
ref?: Ref<HTMLDivElement>;
|
|
41
40
|
/**
|
|
42
41
|
* If `true`, the label is hidden. Be sure to add aria-label to the input element.
|
|
43
|
-
* @default false
|
|
44
42
|
*/
|
|
45
43
|
isLabelHidden?: boolean;
|
|
46
44
|
/**
|
|
@@ -25,11 +25,11 @@ const Toggle = forwardRef(
|
|
|
25
25
|
className,
|
|
26
26
|
...other
|
|
27
27
|
} = props;
|
|
28
|
-
const isDisabled = isDisabledProp ?? disabled
|
|
28
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
29
29
|
const isSelected = isSelectedProp ?? checked;
|
|
30
|
-
const isInvalid = isInvalidProp ?? error
|
|
30
|
+
const isInvalid = isInvalidProp ?? error;
|
|
31
31
|
const defaultSelected = defaultSelectedProp ?? defaultChecked;
|
|
32
|
-
const isReadOnly = isReadOnlyProp ?? readonly
|
|
32
|
+
const isReadOnly = isReadOnlyProp ?? readonly;
|
|
33
33
|
if (process.env.NODE_ENV !== "production" && "disabled" in props) {
|
|
34
34
|
deprecate(
|
|
35
35
|
'Toggle: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
|
|
@@ -8,14 +8,12 @@ export type TogglePropLabelPlacement = (typeof togglePropLabelPlacement)[number]
|
|
|
8
8
|
type ToggleDeprecatedProps = {
|
|
9
9
|
/**
|
|
10
10
|
* If `true`, the component is disabled.
|
|
11
|
-
* @default false
|
|
12
11
|
* @deprecated
|
|
13
12
|
* The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
|
|
14
13
|
*/
|
|
15
14
|
disabled?: boolean;
|
|
16
15
|
/**
|
|
17
16
|
* If `true`, the component will indicate an error.
|
|
18
|
-
* @default false
|
|
19
17
|
* @deprecated
|
|
20
18
|
* The "error" prop is deprecated. Use "isInvalid" prop to replace it.
|
|
21
19
|
*/
|
|
@@ -28,7 +26,6 @@ type ToggleDeprecatedProps = {
|
|
|
28
26
|
checked?: boolean;
|
|
29
27
|
/**
|
|
30
28
|
* It prevents the user from changing the value of the checkbox.
|
|
31
|
-
* @default false
|
|
32
29
|
* @deprecated
|
|
33
30
|
* The "readonly" prop is deprecated. Use "isReadonly" prop to replace it.
|
|
34
31
|
*/
|
|
@@ -9,15 +9,15 @@ import { utilClasses } from "../../styles/utility.js";
|
|
|
9
9
|
import s from "./Tooltip.module.css.js";
|
|
10
10
|
const Tooltip = forwardRef((props, ref) => {
|
|
11
11
|
const {
|
|
12
|
+
variant = "contrast",
|
|
13
|
+
placement: placementProp = "top",
|
|
14
|
+
closeDelay = 120,
|
|
12
15
|
delay = 120,
|
|
13
|
-
disabled,
|
|
14
|
-
open,
|
|
15
16
|
isDisabled: isDisabledProp,
|
|
16
17
|
isOpen: isOpenProp,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
placement: placementProp = "top",
|
|
18
|
+
disabled,
|
|
19
|
+
open,
|
|
20
|
+
hideArrow,
|
|
21
21
|
control,
|
|
22
22
|
children,
|
|
23
23
|
anchorRef,
|
|
@@ -30,7 +30,7 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
30
30
|
...other
|
|
31
31
|
} = props;
|
|
32
32
|
const isOpen = isOpenProp ?? open;
|
|
33
|
-
const isDisabled = isDisabledProp ?? disabled
|
|
33
|
+
const isDisabled = isDisabledProp ?? disabled;
|
|
34
34
|
if (process.env.NODE_ENV !== "production" && "open" in props) {
|
|
35
35
|
deprecate(
|
|
36
36
|
'Tooltip: the "open" prop is deprecated. Use "isOpen" prop to replace it.'
|
|
@@ -114,9 +114,9 @@ const Tooltip = forwardRef((props, ref) => {
|
|
|
114
114
|
"div",
|
|
115
115
|
{
|
|
116
116
|
...tooltipProps,
|
|
117
|
-
"data-arrow": showArrow,
|
|
117
|
+
"data-arrow": showArrow || void 0,
|
|
118
118
|
"data-variant": variant,
|
|
119
|
-
"data-placement": placement,
|
|
119
|
+
"data-placement": placement || void 0,
|
|
120
120
|
"data-transition": transition,
|
|
121
121
|
children: [
|
|
122
122
|
showArrow && /* @__PURE__ */ jsx(
|