@koobiq/react-components 0.11.0 → 0.12.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.
Files changed (159) hide show
  1. package/dist/components/Button/Button.js +1 -1
  2. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  3. package/dist/components/Container/Container.js +13 -4
  4. package/dist/components/Container/types.d.ts +18 -3
  5. package/dist/components/Container/types.js +3 -1
  6. package/dist/components/DateInput/DateInput.js +36 -32
  7. package/dist/components/DateInput/DateInput.module.css.js +4 -1
  8. package/dist/components/DateInput/types.d.ts +10 -12
  9. package/dist/components/DateInput/types.js +5 -5
  10. package/dist/components/DatePicker/DatePicker.js +18 -2
  11. package/dist/components/DatePicker/types.d.ts +2 -2
  12. package/dist/components/Dialog/Dialog.js +2 -2
  13. package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -2
  14. package/dist/components/Form/Form.d.ts +9 -13
  15. package/dist/components/Form/Form.js +29 -32
  16. package/dist/components/Form/Form.module.css.js +19 -7
  17. package/dist/components/Form/FormContext.d.ts +5 -3
  18. package/dist/components/Form/components/FormActions/FormActions.d.ts +7 -0
  19. package/dist/components/Form/components/FormActions/FormActions.js +9 -0
  20. package/dist/components/Form/components/FormActions/index.d.ts +1 -0
  21. package/dist/components/Form/components/FormCaption/FormCaption.d.ts +16 -0
  22. package/dist/components/Form/components/FormCaption/FormCaption.js +17 -0
  23. package/dist/components/Form/components/FormCaption/index.d.ts +1 -0
  24. package/dist/components/Form/components/FormGroup/FormGroup.d.ts +7 -0
  25. package/dist/components/Form/components/FormGroup/FormGroup.js +9 -0
  26. package/dist/components/Form/components/FormGroup/index.d.ts +1 -0
  27. package/dist/components/Form/components/index.d.ts +3 -0
  28. package/dist/components/Form/types.d.ts +7 -3
  29. package/dist/components/Form/utils.js +12 -12
  30. package/dist/components/FormField/FormField.d.ts +22 -0
  31. package/dist/components/FormField/FormField.js +55 -0
  32. package/dist/components/FormField/FormField.module.css.js +17 -0
  33. package/dist/components/FormField/FormFieldAddon/FormFieldAddon.d.ts +10 -0
  34. package/dist/components/{FieldComponents/FieldAddon/FieldAddon.js → FormField/FormFieldAddon/FormFieldAddon.js} +9 -14
  35. package/dist/components/FormField/FormFieldAddon/FormFieldAddon.module.css.js +20 -0
  36. package/dist/components/FormField/FormFieldAddon/index.d.ts +1 -0
  37. package/dist/components/{FieldComponents/FieldCaption/FieldCaption.d.ts → FormField/FormFieldCaption/FormFieldCaption.d.ts} +3 -3
  38. package/dist/components/{FieldComponents/FieldCaption/FieldCaption.js → FormField/FormFieldCaption/FormFieldCaption.js} +4 -4
  39. package/dist/components/{FieldComponents/FieldError/FieldError.module.css.js → FormField/FormFieldCaption/FormFieldCaption.module.css.js} +1 -1
  40. package/dist/components/FormField/FormFieldCaption/index.d.ts +1 -0
  41. package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroup.d.ts +2 -0
  42. package/dist/components/{FieldComponents/FieldContentGroup/FieldContentGroup.js → FormField/FormFieldControlGroup/FormFieldControlGroup.js} +11 -29
  43. package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroup.module.css.js +23 -0
  44. package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroupContext.d.ts +10 -0
  45. package/dist/components/FormField/FormFieldControlGroup/FormFieldControlGroupContext.js +7 -0
  46. package/dist/components/FormField/FormFieldControlGroup/index.d.ts +3 -0
  47. package/dist/components/FormField/FormFieldControlGroup/types.d.ts +30 -0
  48. package/dist/components/FormField/FormFieldControlGroup/types.js +7 -0
  49. package/dist/components/FormField/FormFieldError/FormFieldError.d.ts +8 -0
  50. package/dist/components/FormField/FormFieldError/FormFieldError.js +17 -0
  51. package/dist/components/{FieldComponents/FieldCaption/FieldCaption.module.css.js → FormField/FormFieldError/FormFieldError.module.css.js} +1 -1
  52. package/dist/components/FormField/FormFieldError/index.d.ts +1 -0
  53. package/dist/components/FormField/FormFieldInput/FormFieldInput.d.ts +8 -0
  54. package/dist/components/FormField/FormFieldInput/FormFieldInput.js +12 -0
  55. package/dist/components/{FieldComponents/Field/Field.module.css.js → FormField/FormFieldInput/FormFieldInput.module.css.js} +1 -1
  56. package/dist/components/FormField/FormFieldInput/index.d.ts +1 -0
  57. package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.d.ts +8 -0
  58. package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.js +9 -0
  59. package/dist/components/FormField/FormFieldInputDate/FormFieldInputDate.module.css.js +8 -0
  60. package/dist/components/FormField/FormFieldInputDate/index.d.ts +1 -0
  61. package/dist/components/FormField/FormFieldLabel/FormFieldLabel.d.ts +4 -0
  62. package/dist/components/{FormControlLabel/FormControlLabel.js → FormField/FormFieldLabel/FormFieldLabel.js} +5 -4
  63. package/dist/components/FormField/FormFieldLabel/FormFieldLabel.module.css.js +14 -0
  64. package/dist/components/FormField/FormFieldLabel/index.d.ts +2 -0
  65. package/dist/components/{FormControlLabel → FormField/FormFieldLabel}/types.d.ts +1 -1
  66. package/dist/components/FormField/FormFieldSelect/FormFieldSelect.d.ts +4 -0
  67. package/dist/components/FormField/FormFieldSelect/FormFieldSelect.js +33 -0
  68. package/dist/components/FormField/FormFieldSelect/FormFieldSelect.module.css.js +20 -0
  69. package/dist/components/FormField/FormFieldSelect/index.d.ts +2 -0
  70. package/dist/components/FormField/FormFieldSelect/types.d.ts +7 -0
  71. package/dist/components/FormField/index.d.ts +9 -0
  72. package/dist/components/FormField/types.d.ts +19 -0
  73. package/dist/components/FormField/types.js +6 -0
  74. package/dist/components/Input/Input.d.ts +8 -10
  75. package/dist/components/Input/Input.js +22 -23
  76. package/dist/components/Input/Input.module.css.js +5 -1
  77. package/dist/components/Input/types.d.ts +10 -12
  78. package/dist/components/Input/types.js +5 -5
  79. package/dist/components/InputNumber/InputNumber.d.ts +8 -10
  80. package/dist/components/InputNumber/InputNumber.js +22 -22
  81. package/dist/components/InputNumber/InputNumber.module.css.js +8 -0
  82. package/dist/components/InputNumber/components/InputNumberCounterControls.js +2 -2
  83. package/dist/components/InputNumber/types.d.ts +10 -12
  84. package/dist/components/InputNumber/types.js +5 -5
  85. package/dist/components/List/components/ListSection/ListSection.js +1 -1
  86. package/dist/components/RadioGroup/RadioGroup.js +14 -13
  87. package/dist/components/RadioGroup/RadioGroup.module.css.js +4 -1
  88. package/dist/components/RadioGroup/components/Radio/Radio.d.ts +1 -1
  89. package/dist/components/RadioGroup/types.d.ts +7 -9
  90. package/dist/components/RadioGroup/types.js +3 -3
  91. package/dist/components/SearchInput/SearchInput.d.ts +8 -10
  92. package/dist/components/SearchInput/SearchInput.js +39 -30
  93. package/dist/components/SearchInput/SearchInput.module.css.js +4 -1
  94. package/dist/components/SearchInput/types.d.ts +10 -12
  95. package/dist/components/SearchInput/types.js +5 -5
  96. package/dist/components/Select/Select.js +37 -28
  97. package/dist/components/Select/Select.module.css.js +4 -4
  98. package/dist/components/Select/components/TagGroup/TagGroupMultiline.js +2 -2
  99. package/dist/components/Select/components/TagGroup/TagGroupResponsive.js +2 -2
  100. package/dist/components/Select/types.d.ts +8 -10
  101. package/dist/components/Select/types.js +3 -3
  102. package/dist/components/Textarea/Textarea.d.ts +5 -5
  103. package/dist/components/Textarea/Textarea.js +6 -4
  104. package/dist/components/Textarea/Textarea.module.css.js +8 -2
  105. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
  106. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +24 -20
  107. package/dist/components/Textarea/types.d.ts +8 -10
  108. package/dist/components/Textarea/types.js +5 -5
  109. package/dist/components/TimePicker/TimePicker.js +37 -31
  110. package/dist/components/TimePicker/TimePicker.module.css.js +4 -1
  111. package/dist/components/TimePicker/types.d.ts +9 -11
  112. package/dist/components/TimePicker/types.js +3 -3
  113. package/dist/components/Toggle/Toggle.d.ts +1 -1
  114. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  115. package/dist/components/index.d.ts +1 -2
  116. package/dist/index.js +28 -12
  117. package/dist/style.css +442 -386
  118. package/package.json +5 -5
  119. package/dist/components/FieldComponents/Field/Field.d.ts +0 -4
  120. package/dist/components/FieldComponents/Field/Field.js +0 -10
  121. package/dist/components/FieldComponents/Field/index.d.ts +0 -2
  122. package/dist/components/FieldComponents/Field/types.d.ts +0 -4
  123. package/dist/components/FieldComponents/FieldAddon/FieldAddon.d.ts +0 -11
  124. package/dist/components/FieldComponents/FieldAddon/FieldAddon.module.css.js +0 -20
  125. package/dist/components/FieldComponents/FieldAddon/index.d.ts +0 -1
  126. package/dist/components/FieldComponents/FieldCaption/index.d.ts +0 -1
  127. package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.d.ts +0 -2
  128. package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.module.css.js +0 -29
  129. package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.d.ts +0 -10
  130. package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroupContext.js +0 -7
  131. package/dist/components/FieldComponents/FieldContentGroup/index.d.ts +0 -3
  132. package/dist/components/FieldComponents/FieldContentGroup/types.d.ts +0 -29
  133. package/dist/components/FieldComponents/FieldContentGroup/types.js +0 -4
  134. package/dist/components/FieldComponents/FieldError/FieldError.d.ts +0 -8
  135. package/dist/components/FieldComponents/FieldError/FieldError.js +0 -19
  136. package/dist/components/FieldComponents/FieldError/index.d.ts +0 -1
  137. package/dist/components/FieldComponents/FieldInput/FieldInput.d.ts +0 -12
  138. package/dist/components/FieldComponents/FieldInput/FieldInput.js +0 -34
  139. package/dist/components/FieldComponents/FieldInput/FieldInput.module.css.js +0 -20
  140. package/dist/components/FieldComponents/FieldInput/index.d.ts +0 -1
  141. package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.d.ts +0 -12
  142. package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +0 -32
  143. package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.module.css.js +0 -20
  144. package/dist/components/FieldComponents/FieldInputDate/index.d.ts +0 -1
  145. package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +0 -4
  146. package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +0 -45
  147. package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +0 -26
  148. package/dist/components/FieldComponents/FieldSelect/index.d.ts +0 -2
  149. package/dist/components/FieldComponents/FieldSelect/types.d.ts +0 -11
  150. package/dist/components/FieldComponents/index.d.ts +0 -8
  151. package/dist/components/FormControl/FormControl.d.ts +0 -4
  152. package/dist/components/FormControl/FormControl.js +0 -34
  153. package/dist/components/FormControl/FormControl.module.css.js +0 -17
  154. package/dist/components/FormControl/index.d.ts +0 -2
  155. package/dist/components/FormControl/types.d.ts +0 -19
  156. package/dist/components/FormControl/types.js +0 -6
  157. package/dist/components/FormControlLabel/FormControlLabel.d.ts +0 -4
  158. package/dist/components/FormControlLabel/FormControlLabel.module.css.js +0 -14
  159. package/dist/components/FormControlLabel/index.d.ts +0 -2
@@ -1,8 +1,8 @@
1
- import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
1
+ import { formFieldPropLabelPlacement, formFieldPropLabelAlign } from "../FormField/types.js";
2
2
  const radioGroupPropSize = ["normal", "big"];
3
3
  const radioGroupPropOrientation = ["horizontal", "vertical"];
4
- const radioGroupPropLabelPlacement = formControlPropLabelPlacement;
5
- const radioGroupPropLabelAlign = formControlPropLabelAlign;
4
+ const radioGroupPropLabelPlacement = formFieldPropLabelPlacement;
5
+ const radioGroupPropLabelAlign = formFieldPropLabelAlign;
6
6
  export {
7
7
  radioGroupPropLabelAlign,
8
8
  radioGroupPropLabelPlacement,
@@ -1,7 +1,5 @@
1
- import { type FieldCaptionProps, type FieldContentGroupProps, type FieldInputProps, type FieldErrorProps } from '../FieldComponents';
2
- import { type FormControlProps } from '../FormControl';
3
- import { type FormControlLabelProps } from '../FormControlLabel';
4
- export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/searchfield").AriaSearchFieldProps, "validationState" | "description">, "caption" | "style" | "className" | "variant" | "labelPlacement" | "labelAlign" | `data-${string}` | "fullWidth" | "slotProps" | "startAddon" | "endAddon" | "isLabelHidden"> & {
1
+ import type { FormFieldProps, FormFieldLabelProps, FormFieldInputProps, FormFieldErrorProps, FormFieldCaptionProps, FormFieldControlGroupProps } from '../FormField';
2
+ export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/searchfield").AriaSearchFieldProps, "description" | "validationState">, "caption" | "style" | "className" | `data-${string}` | "startAddon" | "endAddon" | "variant" | "slotProps" | "labelPlacement" | "labelAlign" | "fullWidth" | "isLabelHidden"> & {
5
3
  className?: string;
6
4
  style?: import("react").CSSProperties;
7
5
  isLabelHidden?: boolean;
@@ -10,12 +8,12 @@ export declare const SearchInput: import("react").ForwardRefExoticComponent<Omit
10
8
  startAddon?: import("react").ReactNode;
11
9
  endAddon?: import("react").ReactNode;
12
10
  slotProps?: {
13
- root?: FormControlProps;
14
- label?: FormControlLabelProps;
15
- group?: FieldContentGroupProps;
16
- input?: FieldInputProps;
17
- caption?: FieldCaptionProps;
18
- errorMessage?: FieldErrorProps;
11
+ root?: FormFieldProps;
12
+ label?: FormFieldLabelProps;
13
+ group?: FormFieldControlGroupProps;
14
+ input?: FormFieldInputProps;
15
+ caption?: FormFieldCaptionProps;
16
+ errorMessage?: FormFieldErrorProps;
19
17
  clearButton?: import("..").IconButtonProps;
20
18
  };
21
19
  caption?: import("react").ReactNode;
@@ -5,14 +5,9 @@ import { useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
5
5
  import { IconMagnifyingGlass16, IconXmarkCircle16 } from "@koobiq/react-icons";
6
6
  import { useSearchFieldState, removeDataAttributes, useSlottedContext, FormContext, useSearchField, FieldErrorContext } from "@koobiq/react-primitives";
7
7
  import s from "./SearchInput.module.css.js";
8
+ import { useForm } from "../Form/FormContext.js";
8
9
  import { IconButton } from "../IconButton/IconButton.js";
9
- import { FormControl } from "../FormControl/FormControl.js";
10
- import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
11
- import { Field } from "../FieldComponents/Field/Field.js";
12
- import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
13
- import { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
14
- import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
15
- import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
10
+ import { FormField } from "../FormField/FormField.js";
16
11
  const SearchInput = forwardRef(
17
12
  (props, ref) => {
18
13
  const {
@@ -28,14 +23,19 @@ const SearchInput = forwardRef(
28
23
  className,
29
24
  caption,
30
25
  isRequired,
31
- isReadOnly,
26
+ isReadOnly: isReadOnlyProp,
32
27
  label,
33
28
  endAddon,
34
- isDisabled,
29
+ isDisabled: isDisabledProp,
35
30
  slotProps
36
31
  } = props;
37
- const state = useSearchFieldState(removeDataAttributes(props));
38
- const domRef = useDOMRef(ref);
32
+ const { isDisabled: formIsDisabled, isReadOnly: formIsReadOnly } = useForm();
33
+ const isDisabled = isDisabledProp ?? formIsDisabled;
34
+ const isReadOnly = isReadOnlyProp ?? formIsReadOnly;
35
+ const state = useSearchFieldState(
36
+ removeDataAttributes({ ...props, isDisabled, isReadOnly })
37
+ );
38
+ const inputRef = useDOMRef(ref);
39
39
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext) || {};
40
40
  const validationBehavior = props.validationBehavior ?? formValidationBehavior ?? "aria";
41
41
  const hasClearButton = state.value !== "" && !isDisabled && !isReadOnly;
@@ -47,9 +47,12 @@ const SearchInput = forwardRef(
47
47
  clearButtonProps: clearButtonPropsAria,
48
48
  ...validation
49
49
  } = useSearchField(
50
- { ...removeDataAttributes(props), validationBehavior },
50
+ {
51
+ ...removeDataAttributes({ ...props, isDisabled, isReadOnly }),
52
+ validationBehavior
53
+ },
51
54
  state,
52
- domRef
55
+ inputRef
53
56
  );
54
57
  const { isInvalid } = validation;
55
58
  const rootProps = mergeProps(
@@ -70,19 +73,16 @@ const SearchInput = forwardRef(
70
73
  );
71
74
  const labelProps = mergeProps(
72
75
  { isHidden: isLabelHidden, isRequired, children: label },
73
- slotProps?.label,
74
- labelPropsAria
76
+ labelPropsAria,
77
+ slotProps?.label
75
78
  );
76
79
  const inputProps = mergeProps(
77
80
  {
78
- variant,
79
- isInvalid,
80
- isDisabled,
81
- ref: domRef,
81
+ ref: inputRef,
82
82
  className: s.input
83
83
  },
84
- slotProps?.input,
85
- inputPropsAria
84
+ inputPropsAria,
85
+ slotProps?.input
86
86
  );
87
87
  const groupProps = mergeProps(
88
88
  {
@@ -104,24 +104,33 @@ const SearchInput = forwardRef(
104
104
  ),
105
105
  endAddon
106
106
  ] }),
107
+ onMouseDown: (e) => {
108
+ if (e.currentTarget !== e.target) return;
109
+ e.preventDefault();
110
+ inputRef?.current?.focus();
111
+ },
107
112
  variant,
108
113
  isInvalid,
109
114
  isDisabled
110
115
  },
111
116
  slotProps?.group
112
117
  );
113
- const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionPropsAria);
118
+ const captionProps = mergeProps(
119
+ { children: caption },
120
+ descriptionPropsAria,
121
+ slotProps?.caption
122
+ );
114
123
  const errorProps = mergeProps(
115
124
  { children: errorMessage },
116
- slotProps?.errorMessage,
117
- errorMessagePropsAria
125
+ errorMessagePropsAria,
126
+ slotProps?.errorMessage
118
127
  );
119
- return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
120
- /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps, children: label }),
121
- /* @__PURE__ */ jsxs(Field, { children: [
122
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
123
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
124
- /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
128
+ return /* @__PURE__ */ jsxs(FormField, { ...rootProps, children: [
129
+ /* @__PURE__ */ jsx(FormField.Label, { ...labelProps, children: label }),
130
+ /* @__PURE__ */ jsxs("div", { className: s.body, children: [
131
+ /* @__PURE__ */ jsx(FormField.ControlGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FormField.Input, { ...inputProps }) }),
132
+ /* @__PURE__ */ jsx(FormField.Caption, { ...captionProps }),
133
+ /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FormField.Error, { ...errorProps }) })
125
134
  ] })
126
135
  ] });
127
136
  }
@@ -2,13 +2,16 @@ const input = "kbq-searchinput-input-f896b1";
2
2
  const startAddon = "kbq-searchinput-startAddon-08187f";
3
3
  const searchIcon = "kbq-searchinput-searchIcon-8bce0f";
4
4
  const clearButton = "kbq-searchinput-clearButton-71f872";
5
+ const body = "kbq-searchinput-body-972749";
5
6
  const s = {
6
7
  input,
7
8
  startAddon,
8
9
  searchIcon,
9
- clearButton
10
+ clearButton,
11
+ body
10
12
  };
11
13
  export {
14
+ body,
12
15
  clearButton,
13
16
  s as default,
14
17
  input,
@@ -1,16 +1,14 @@
1
1
  import type { ComponentRef, CSSProperties, ReactNode } from 'react';
2
2
  import type { DataAttributeProps, ExtendableProps } from '@koobiq/react-core';
3
3
  import type { AriaSearchFieldProps } from '@koobiq/react-primitives';
4
- import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldContentGroupProps, type FieldContentGroupPropVariant } from '../FieldComponents';
5
- import { type FormControlProps, type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
6
- import type { FormControlLabelProps } from '../FormControlLabel';
4
+ import type { FormFieldProps, FormFieldLabelProps, FormFieldInputProps, FormFieldErrorProps, FormFieldCaptionProps, FormFieldPropLabelAlign, FormFieldControlGroupProps, FormFieldPropLabelPlacement, FormFieldControlGroupPropVariant } from '../FormField';
7
5
  import type { IconButtonProps } from '../IconButton';
8
6
  export declare const searchInputPropVariant: readonly ["filled", "transparent"];
9
- export type SearchInputPropVariant = FieldContentGroupPropVariant;
7
+ export type SearchInputPropVariant = FormFieldControlGroupPropVariant;
10
8
  export declare const searchInputPropLabelPlacement: readonly ["top", "side"];
11
- export type SearchInputPropLabelPlacement = FormControlPropLabelPlacement;
9
+ export type SearchInputPropLabelPlacement = FormFieldPropLabelPlacement;
12
10
  export declare const searchInputPropLabelAlign: readonly ["start", "end"];
13
- export type SearchInputPropLabelAlign = FormControlPropLabelAlign;
11
+ export type SearchInputPropLabelAlign = FormFieldPropLabelAlign;
14
12
  export type SearchInputProps = ExtendableProps<{
15
13
  /** Additional CSS-classes. */
16
14
  className?: string;
@@ -36,12 +34,12 @@ export type SearchInputProps = ExtendableProps<{
36
34
  endAddon?: ReactNode;
37
35
  /** The props used for each slot inside. */
38
36
  slotProps?: {
39
- root?: FormControlProps;
40
- label?: FormControlLabelProps;
41
- group?: FieldContentGroupProps;
42
- input?: FieldInputProps;
43
- caption?: FieldCaptionProps;
44
- errorMessage?: FieldErrorProps;
37
+ root?: FormFieldProps;
38
+ label?: FormFieldLabelProps;
39
+ group?: FormFieldControlGroupProps;
40
+ input?: FormFieldInputProps;
41
+ caption?: FormFieldCaptionProps;
42
+ errorMessage?: FormFieldErrorProps;
45
43
  clearButton?: IconButtonProps;
46
44
  };
47
45
  /** The helper text content. */
@@ -1,8 +1,8 @@
1
- import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
2
- import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
3
- const searchInputPropVariant = fieldContentGroupPropVariant;
4
- const searchInputPropLabelPlacement = formControlPropLabelPlacement;
5
- const searchInputPropLabelAlign = formControlPropLabelAlign;
1
+ import { formFieldControlGroupPropVariant } from "../FormField/FormFieldControlGroup/types.js";
2
+ import { formFieldPropLabelPlacement, formFieldPropLabelAlign } from "../FormField/types.js";
3
+ const searchInputPropVariant = formFieldControlGroupPropVariant;
4
+ const searchInputPropLabelPlacement = formFieldPropLabelPlacement;
5
+ const searchInputPropLabelAlign = formFieldPropLabelAlign;
6
6
  export {
7
7
  searchInputPropLabelAlign,
8
8
  searchInputPropLabelPlacement,
@@ -1,22 +1,17 @@
1
1
  import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef, useCallback } from "react";
3
- import { useLocalizedStringFormatter, useDOMRef, useElementSize, mergeProps, clsx } from "@koobiq/react-core";
3
+ import { useLocalizedStringFormatter, useDOMRef, useElementSize, mergeProps } from "@koobiq/react-core";
4
4
  import { IconXmarkCircle16, IconChevronDownS16 } from "@koobiq/react-icons";
5
5
  import { useSlottedContext, FormContext, 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";
9
- import { FieldSelect } from "../FieldComponents/FieldSelect/FieldSelect.js";
10
9
  import { SelectList } from "./components/SelectList/SelectList.js";
11
10
  import { TagGroup } from "./components/TagGroup/TagGroup.js";
12
11
  import { List } from "../List/List.js";
12
+ import { useForm } from "../Form/FormContext.js";
13
13
  import { IconButton } from "../IconButton/IconButton.js";
14
- import { FormControl } from "../FormControl/FormControl.js";
15
- import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
16
- import { Field } from "../FieldComponents/Field/Field.js";
17
- import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
18
- import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
19
- import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
14
+ import { FormField } from "../FormField/FormField.js";
20
15
  import { Item } from "../Collections/Item.js";
21
16
  import { Section } from "../Collections/Section.js";
22
17
  import { Divider } from "../Collections/Divider.js";
@@ -31,7 +26,7 @@ function SelectRender(props, ref) {
31
26
  labelPlacement,
32
27
  labelAlign,
33
28
  isRequired,
34
- isDisabled,
29
+ isDisabled: isDisabledProp,
35
30
  caption,
36
31
  errorMessage,
37
32
  className,
@@ -45,16 +40,18 @@ function SelectRender(props, ref) {
45
40
  label,
46
41
  renderValue: renderValueProp
47
42
  } = props;
43
+ const { isDisabled: formIsDisabled } = useForm();
44
+ const isDisabled = isDisabledProp ?? formIsDisabled;
48
45
  const t = useLocalizedStringFormatter(intlMessages);
49
46
  const domRef = useDOMRef(ref);
50
47
  const { validationBehavior: formValidationBehavior } = useSlottedContext(FormContext) || {};
51
48
  const validationBehavior = props.validationBehavior ?? formValidationBehavior ?? "aria";
52
49
  const state = useMultiSelectState(
53
- removeDataAttributes({ ...props, selectionMode })
50
+ removeDataAttributes({ ...props, isDisabled, selectionMode })
54
51
  );
55
52
  const hasClearButton = isClearable && !isDisabled && state.selectedItems;
56
53
  const handleClear = useCallback(() => {
57
- state.selectionManager.clearSelection();
54
+ state.selectionManager.setSelectedKeys(/* @__PURE__ */ new Set());
58
55
  onClear?.();
59
56
  }, [onClear, state]);
60
57
  const {
@@ -69,6 +66,7 @@ function SelectRender(props, ref) {
69
66
  removeDataAttributes({
70
67
  ...props,
71
68
  selectionMode,
69
+ isDisabled,
72
70
  disallowEmptySelection: true,
73
71
  validationBehavior
74
72
  }),
@@ -80,8 +78,8 @@ function SelectRender(props, ref) {
80
78
  const rootProps = mergeProps({
81
79
  "data-testid": testId,
82
80
  "data-invalid": isInvalid || void 0,
83
- "data-disabled": props.isDisabled || void 0,
84
- "data-required": props.isRequired || void 0,
81
+ "data-disabled": isDisabled || void 0,
82
+ "data-required": isRequired || void 0,
85
83
  className,
86
84
  fullWidth,
87
85
  labelPlacement,
@@ -114,8 +112,13 @@ function SelectRender(props, ref) {
114
112
  endAddon: { className: s.addon },
115
113
  startAddon: { className: s.addon }
116
114
  },
117
- className: clsx(isClearable && s.clearable),
118
115
  startAddon,
116
+ onMouseDown: (e) => {
117
+ if (e.currentTarget !== e.target || isDisabled) return;
118
+ e.preventDefault();
119
+ domRef?.current?.focus();
120
+ state.open();
121
+ },
119
122
  endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
120
123
  endAddon,
121
124
  hasClearButton && /* @__PURE__ */ jsx(IconButton, { ...clearButtonProps, children: /* @__PURE__ */ jsx(IconXmarkCircle16, {}) }),
@@ -130,13 +133,11 @@ function SelectRender(props, ref) {
130
133
  const controlProps = mergeProps(
131
134
  {
132
135
  ref: domRef,
133
- placeholder,
134
- isInvalid,
135
- isDisabled
136
+ placeholder
136
137
  },
137
- slotProps?.control,
138
138
  valueProps,
139
- triggerProps
139
+ triggerProps,
140
+ slotProps?.control
140
141
  );
141
142
  const popoverProps = mergeProps(
142
143
  {
@@ -144,15 +145,23 @@ function SelectRender(props, ref) {
144
145
  offset: 4,
145
146
  size: width,
146
147
  hideArrow: true,
147
- anchorRef: domRef,
148
+ anchorRef: containerRef,
148
149
  className: s.popover,
149
150
  placement: "bottom start",
150
151
  type: "listbox"
151
152
  },
152
153
  slotProps?.popover
153
154
  );
154
- const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
155
- const errorProps = mergeProps({ children: errorMessage }, slotProps?.errorMessage, errorMessageProps);
155
+ const captionProps = mergeProps(
156
+ { children: caption },
157
+ descriptionProps,
158
+ slotProps?.caption
159
+ );
160
+ const errorProps = mergeProps(
161
+ { children: errorMessage },
162
+ errorMessageProps,
163
+ slotProps?.errorMessage
164
+ );
156
165
  const renderDefaultValue = (state2, states) => {
157
166
  if (!state2.selectedItems?.length) return null;
158
167
  if (selectionMode === "multiple")
@@ -168,16 +177,16 @@ function SelectRender(props, ref) {
168
177
  };
169
178
  const renderValue = renderValueProp || renderDefaultValue;
170
179
  return /* @__PURE__ */ jsxs(Fragment, { children: [
171
- /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
172
- /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
173
- /* @__PURE__ */ jsxs(Field, { children: [
174
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldSelect, { ...controlProps, children: renderValue(state, {
180
+ /* @__PURE__ */ jsxs(FormField, { ...rootProps, children: [
181
+ /* @__PURE__ */ jsx(FormField.Label, { ...labelProps }),
182
+ /* @__PURE__ */ jsxs("div", { className: s.body, children: [
183
+ /* @__PURE__ */ jsx(FormField.ControlGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FormField.Select, { ...controlProps, children: renderValue(state, {
175
184
  isInvalid,
176
185
  isDisabled: props.isDisabled,
177
186
  isRequired: props.isRequired
178
187
  }) }) }),
179
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
180
- /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
188
+ /* @__PURE__ */ jsx(FormField.Caption, { ...captionProps }),
189
+ /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FormField.Error, { ...errorProps }) })
181
190
  ] })
182
191
  ] }),
183
192
  /* @__PURE__ */ jsx(PopoverInner, { ...popoverProps, children: /* @__PURE__ */ jsx(SelectList, { ...listProps }) })
@@ -1,22 +1,22 @@
1
1
  const addon = "kbq-select-addon-cbc524";
2
2
  const chevron = "kbq-select-chevron-0b4fa3";
3
+ const body = "kbq-select-body-69aa88";
3
4
  const list = "kbq-select-list-8ffac0";
4
5
  const popover = "kbq-select-popover-79fc05";
5
6
  const clearButton = "kbq-select-clearButton-8031a1";
6
- const clearable = "kbq-select-clearable-2f5092";
7
7
  const s = {
8
8
  addon,
9
9
  chevron,
10
+ body,
10
11
  list,
11
12
  popover,
12
- clearButton,
13
- clearable
13
+ clearButton
14
14
  };
15
15
  export {
16
16
  addon,
17
+ body,
17
18
  chevron,
18
19
  clearButton,
19
- clearable,
20
20
  s as default,
21
21
  list,
22
22
  popover
@@ -3,14 +3,14 @@ import { useLocalizedStringFormatter, clsx } from "@koobiq/react-core";
3
3
  import intlMessages from "../../intl.js";
4
4
  import s from "./TagGroup.module.css.js";
5
5
  import { Tag } from "../Tag/Tag.js";
6
- import { useFieldContentGroup } from "../../../FieldComponents/FieldContentGroup/FieldContentGroupContext.js";
6
+ import { useFormFieldControlGroup } from "../../../FormField/FormFieldControlGroup/FormFieldControlGroupContext.js";
7
7
  const TagGroupMultiline = ({
8
8
  state,
9
9
  states
10
10
  }) => {
11
11
  const { isDisabled, isInvalid } = states;
12
12
  const t = useLocalizedStringFormatter(intlMessages);
13
- const { hasStartAddon } = useFieldContentGroup();
13
+ const { hasStartAddon } = useFormFieldControlGroup();
14
14
  return /* @__PURE__ */ jsx(
15
15
  "div",
16
16
  {
@@ -3,7 +3,7 @@ import { useHideOverflowItems, useLocalizedStringFormatter, clsx } from "@koobiq
3
3
  import intlMessages from "../../intl.js";
4
4
  import s from "./TagGroup.module.css.js";
5
5
  import { getHiddenCount } from "./utils.js";
6
- import { useFieldContentGroup } from "../../../FieldComponents/FieldContentGroup/FieldContentGroupContext.js";
6
+ import { useFormFieldControlGroup } from "../../../FormField/FormFieldControlGroup/FormFieldControlGroupContext.js";
7
7
  import { Tag } from "../Tag/Tag.js";
8
8
  const TagGroupResponsive = ({
9
9
  state,
@@ -17,7 +17,7 @@ const TagGroupResponsive = ({
17
17
  });
18
18
  const hiddenCount = getHiddenCount(visibleMap);
19
19
  const t = useLocalizedStringFormatter(intlMessages);
20
- const { hasStartAddon } = useFieldContentGroup();
20
+ const { hasStartAddon } = useFormFieldControlGroup();
21
21
  return /* @__PURE__ */ jsxs(
22
22
  "div",
23
23
  {
@@ -1,18 +1,16 @@
1
1
  import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
2
  import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { AriaSelectProps, MultiSelectState, useMultiSelectState } from '@koobiq/react-primitives';
4
- import { type FieldErrorProps, type FieldSelectProps, type FieldCaptionProps, type FieldContentGroupProps } from '../FieldComponents';
5
- import { type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
6
- import type { FormControlLabelProps } from '../FormControlLabel';
4
+ import type { FormFieldLabelProps, FormFieldErrorProps, FormFieldSelectProps, FormFieldCaptionProps, FormFieldPropLabelAlign, FormFieldControlGroupProps, FormFieldPropLabelPlacement } from '../FormField';
7
5
  import type { IconButtonProps } from '../IconButton';
8
6
  import type { PopoverProps } from '../Popover';
9
7
  import type { SelectListProps } from './components';
10
8
  export declare const selectPropSelectedTagsOverflow: readonly ["multiline", "responsive"];
11
9
  export type SelectPropSelectedTagsOverflow = (typeof selectPropSelectedTagsOverflow)[number];
12
10
  export declare const selectPropLabelPlacement: readonly ["top", "side"];
13
- export type SelectPropLabelPlacement = FormControlPropLabelPlacement;
11
+ export type SelectPropLabelPlacement = FormFieldPropLabelPlacement;
14
12
  export declare const selectPropLabelAlign: readonly ["start", "end"];
15
- export type SelectPropLabelAlign = FormControlPropLabelAlign;
13
+ export type SelectPropLabelAlign = FormFieldPropLabelAlign;
16
14
  export type SelectProps<T> = ExtendableProps<{
17
15
  /**
18
16
  * Defines how selected tags are displayed when they exceed the available space.
@@ -82,12 +80,12 @@ export type SelectProps<T> = ExtendableProps<{
82
80
  /** The props used for each slot inside. */
83
81
  slotProps?: {
84
82
  popover?: PopoverProps;
85
- label?: FormControlLabelProps;
83
+ label?: FormFieldLabelProps;
86
84
  list?: Omit<SelectListProps<object>, 'state'>;
87
- control?: FieldSelectProps;
88
- caption?: FieldCaptionProps;
89
- group?: FieldContentGroupProps;
90
- errorMessage?: FieldErrorProps;
85
+ control?: FormFieldSelectProps;
86
+ caption?: FormFieldCaptionProps;
87
+ group?: FormFieldControlGroupProps;
88
+ errorMessage?: FormFieldErrorProps;
91
89
  clearButton?: IconButtonProps;
92
90
  };
93
91
  }, Omit<AriaSelectProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState' | 'selectedKey' | 'onSelectionChange' | 'defaultSelectedKey'>>;
@@ -1,10 +1,10 @@
1
- import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
1
+ import { formFieldPropLabelPlacement, formFieldPropLabelAlign } from "../FormField/types.js";
2
2
  const selectPropSelectedTagsOverflow = [
3
3
  "multiline",
4
4
  "responsive"
5
5
  ];
6
- const selectPropLabelPlacement = formControlPropLabelPlacement;
7
- const selectPropLabelAlign = formControlPropLabelAlign;
6
+ const selectPropLabelPlacement = formFieldPropLabelPlacement;
7
+ const selectPropLabelAlign = formFieldPropLabelAlign;
8
8
  export {
9
9
  selectPropLabelAlign,
10
10
  selectPropLabelPlacement,
@@ -4,7 +4,7 @@ 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" | "description" | "inputElementType">, "caption" | "style" | "className" | "cols" | "rows" | "variant" | "labelPlacement" | "labelAlign" | "fullWidth" | "slotProps" | "data-testid" | "isLabelHidden" | "expand"> & {
7
+ } & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "description" | "validationState" | "inputElementType">, "caption" | "style" | "className" | "cols" | "rows" | "data-testid" | "variant" | "slotProps" | "labelPlacement" | "labelAlign" | "fullWidth" | "isLabelHidden" | "expand"> & {
8
8
  className?: string;
9
9
  style?: import("react").CSSProperties;
10
10
  variant?: import("./types").TextareaPropVariant;
@@ -18,9 +18,9 @@ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<{
18
18
  expand?: import("./types").TextareaPropExpand;
19
19
  'data-testid'?: string | number;
20
20
  slotProps?: {
21
- label?: import("..").FormControlLabelProps;
22
- caption?: import("../FieldComponents").FieldCaptionProps;
23
- textarea?: import("../FieldComponents").FieldInputProps<"textarea">;
24
- errorMessage?: import("../FieldComponents").FieldErrorProps;
21
+ label?: import("..").FormFieldLabelProps;
22
+ caption?: import("..").FormFieldCaptionProps;
23
+ textarea?: import("..").FormFieldInputProps<"textarea">;
24
+ errorMessage?: import("..").FormFieldErrorProps;
25
25
  };
26
26
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -5,7 +5,8 @@ import { deprecate } from "@koobiq/logger";
5
5
  import { mergeProps } from "@koobiq/react-core";
6
6
  import { TextField } from "@koobiq/react-primitives";
7
7
  import { TextareaContextConsumer } from "./components/TextareaContextConsumer/TextareaContextConsumer.js";
8
- import { FormControl } from "../FormControl/FormControl.js";
8
+ import { useForm } from "../Form/FormContext.js";
9
+ import { FormField } from "../FormField/FormField.js";
9
10
  const Textarea = forwardRef((props, ref) => {
10
11
  const {
11
12
  variant = "filled",
@@ -31,9 +32,10 @@ const Textarea = forwardRef((props, ref) => {
31
32
  label,
32
33
  ...other
33
34
  } = props;
34
- const isDisabled = isDisabledProp ?? disabled;
35
+ const { isDisabled: formIsDisabled, isReadOnly: formIsReadOnly } = useForm();
36
+ const isDisabled = isDisabledProp ?? disabled ?? formIsDisabled;
37
+ const isReadOnly = isReadOnlyProp ?? readonly ?? formIsReadOnly;
35
38
  const isRequired = isRequiredProp ?? required;
36
- const isReadOnly = isReadOnlyProp ?? readonly;
37
39
  const isInvalid = isInvalidProp ?? error;
38
40
  const isLabelHidden = isLabelHiddenProp ?? hiddenLabel;
39
41
  if (process.env.NODE_ENV !== "production" && "disabled" in props) {
@@ -76,7 +78,7 @@ const Textarea = forwardRef((props, ref) => {
76
78
  },
77
79
  other
78
80
  );
79
- return /* @__PURE__ */ jsx(FormControl, { as: TextField, inputElementType: "textarea", ...rootProps, children: (values) => /* @__PURE__ */ jsx(
81
+ return /* @__PURE__ */ jsx(FormField, { as: TextField, inputElementType: "textarea", ...rootProps, children: (values) => /* @__PURE__ */ jsx(
80
82
  TextareaContextConsumer,
81
83
  {
82
84
  ...values,
@@ -1,7 +1,13 @@
1
+ const body = "kbq-textarea-body-943a69";
2
+ const group = "kbq-textarea-group-c8f6ff";
1
3
  const s = {
2
4
  "auto-size": "kbq-textarea-auto-size-566580",
3
- "vertical-resize": "kbq-textarea-vertical-resize-bde131"
5
+ "vertical-resize": "kbq-textarea-vertical-resize-bde131",
6
+ body,
7
+ group
4
8
  };
5
9
  export {
6
- s as default
10
+ body,
11
+ s as default,
12
+ group
7
13
  };
@@ -3,4 +3,4 @@ export declare const TextareaContextConsumer: import("react").ForwardRefExoticCo
3
3
  isRequired?: boolean;
4
4
  isInvalid?: boolean;
5
5
  isDisabled?: boolean;
6
- } & Pick<TextareaProps, "caption" | "label" | "cols" | "rows" | "variant" | "labelPlacement" | "slotProps" | "errorMessage" | "isLabelHidden" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;
6
+ } & Pick<TextareaProps, "caption" | "label" | "cols" | "rows" | "variant" | "slotProps" | "labelPlacement" | "errorMessage" | "isLabelHidden" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;