@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
@@ -62,7 +62,7 @@ const Button = polymorphicForwardRef(
62
62
  "data-variant": variant,
63
63
  "data-loading": isLoading || void 0,
64
64
  "data-fullwidth": fullWidth || void 0,
65
- "data-onlyicon": iconOnly || void 0,
65
+ "data-onlyicon": !!iconOnly || void 0,
66
66
  ...other,
67
67
  ref,
68
68
  children: [
@@ -1,5 +1,5 @@
1
1
  import { type CheckboxProps as CheckboxPropsPrimitive } from '@koobiq/react-primitives';
2
- export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<CheckboxPropsPrimitive, "validationState" | "inputRef">, "children" | "style" | "className" | "size" | "labelPlacement" | "slotProps" | "data-testid" | keyof {
2
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<CheckboxPropsPrimitive, "validationState" | "inputRef">, "children" | "style" | "className" | "size" | "data-testid" | "slotProps" | "labelPlacement" | keyof {
3
3
  disabled?: boolean;
4
4
  error?: boolean;
5
5
  checked?: boolean;
@@ -11,7 +11,8 @@ const Container = polymorphicForwardRef(
11
11
  const {
12
12
  as: Tag = "div",
13
13
  margins: marginsProp = 0,
14
- position: positionProp = "center",
14
+ position: positionProp,
15
+ placement: placementProp,
15
16
  fixed,
16
17
  isFixed: isFixedProp,
17
18
  children,
@@ -26,14 +27,22 @@ const Container = polymorphicForwardRef(
26
27
  'Container: the "fixed" prop is deprecated. Use "isFixed" prop to replace it.'
27
28
  );
28
29
  }
30
+ if (process.env.NODE_ENV !== "production" && "position" in props) {
31
+ deprecate(
32
+ 'Container: the "position" prop is deprecated. Use "placement" prop to replace it.'
33
+ );
34
+ }
29
35
  const breakpoints = useMatchedBreakpoints();
30
36
  const maxInlineSize = getResponsiveValue(maxInlineSizeProp, breakpoints);
31
- const position = getResponsiveValue(positionProp, breakpoints);
37
+ const placement = getResponsiveValue(
38
+ placementProp ?? positionProp ?? "center",
39
+ breakpoints
40
+ );
32
41
  const margins = getResponsiveValue(marginsProp, breakpoints);
33
42
  const style = {
34
43
  ...styleProp,
35
44
  "--container-max-inline-size": isFixed ? void 0 : normalizeMaxInlineSize(maxInlineSize),
36
- "--container-position": normalizePosition(position),
45
+ "--container-placement": normalizePosition(placement),
37
46
  "--container-margins": normalizeMargins(margins)
38
47
  };
39
48
  return /* @__PURE__ */ jsx(
@@ -41,7 +50,7 @@ const Container = polymorphicForwardRef(
41
50
  {
42
51
  "data-fixed": isFixed || void 0,
43
52
  "data-margins": margins,
44
- "data-position": position,
53
+ "data-placement": placement,
45
54
  className: clsx(s.base, className),
46
55
  style,
47
56
  ...other,
@@ -3,8 +3,16 @@ import type { ResponsiveValue } from '../../utils';
3
3
  export declare const containerMarginsProp: readonly [0, "3xs", "xxs", "xs", "s", "m", "l", "xl", "xxl", "3xl", "4xl", "5xl", "6xl", "7xl"];
4
4
  export type ContainerMarginsProp = (typeof containerMarginsProp)[number];
5
5
  export type ContainerMaxInlineSizeProp = CSSProperties['maxInlineSize'];
6
+ export declare const containerPlacementProp: readonly ["start", "center", "end"];
7
+ export type ContainerPlacementProp = (typeof containerPlacementProp)[number];
8
+ /**
9
+ * @deprecated
10
+ */
6
11
  export declare const containerPositionProp: readonly ["start", "center", "end"];
7
- export type ContainerPositionProp = (typeof containerPositionProp)[number];
12
+ /**
13
+ * @deprecated
14
+ */
15
+ export type ContainerPositionProp = ContainerPlacementProp;
8
16
  type ContainerDeprecatedProps = {
9
17
  /**
10
18
  * If `true`, doesn't set the max-inline-size of the container.
@@ -12,13 +20,20 @@ type ContainerDeprecatedProps = {
12
20
  * The "fixed" prop is deprecated. Use "isFixed" prop to replace it.
13
21
  */
14
22
  fixed?: boolean;
15
- };
16
- export type ContainerBaseProps = {
17
23
  /**
18
24
  * Container position.
19
25
  * @default 'center'
26
+ * @deprecated
27
+ * The "position" prop is deprecated. Use "placement" prop to replace it.
20
28
  */
21
29
  position?: ContainerPositionProp | ResponsiveValue<ContainerPositionProp>;
30
+ };
31
+ export type ContainerBaseProps = {
32
+ /**
33
+ * Container placement.
34
+ * @default 'center'
35
+ */
36
+ placement?: ContainerPlacementProp | ResponsiveValue<ContainerPlacementProp>;
22
37
  /** Determine the max-inline-size of the container. */
23
38
  maxInlineSize?: ContainerMaxInlineSizeProp | ResponsiveValue<ContainerMaxInlineSizeProp>;
24
39
  /**
@@ -14,8 +14,10 @@ const containerMarginsProp = [
14
14
  "6xl",
15
15
  "7xl"
16
16
  ];
17
- const containerPositionProp = ["start", "center", "end"];
17
+ const containerPlacementProp = ["start", "center", "end"];
18
+ const containerPositionProp = containerPlacementProp;
18
19
  export {
19
20
  containerMarginsProp,
21
+ containerPlacementProp,
20
22
  containerPositionProp
21
23
  };
@@ -5,14 +5,9 @@ import { createCalendar } from "@internationalized/date";
5
5
  import { useLocale, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
6
6
  import { useDateFieldState, removeDataAttributes, useSlottedContext, FormContext, useDateField, FieldErrorContext } from "@koobiq/react-primitives";
7
7
  import s from "./DateInput.module.css.js";
8
- import { FieldInputDate } from "../FieldComponents/FieldInputDate/FieldInputDate.js";
9
8
  import { DateSegment } from "../DateSegment/DateSegment.js";
10
- import { FormControl } from "../FormControl/FormControl.js";
11
- import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
12
- import { Field } from "../FieldComponents/Field/Field.js";
13
- import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
14
- import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
15
- import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
9
+ import { useForm } from "../Form/FormContext.js";
10
+ import { FormField } from "../FormField/FormField.js";
16
11
  function DateInputRender(props, ref) {
17
12
  const { locale } = useLocale();
18
13
  const {
@@ -29,11 +24,16 @@ function DateInputRender(props, ref) {
29
24
  className,
30
25
  style,
31
26
  fullWidth,
32
- isReadOnly,
27
+ isRequired,
28
+ isDisabled: isDisabledProp,
29
+ isReadOnly: isReadOnlyProp,
33
30
  "data-testid": testId
34
31
  } = props;
32
+ const { isDisabled: formIsDisabled, isReadOnly: formIsReadOnly } = useForm();
33
+ const isDisabled = isDisabledProp ?? formIsDisabled;
34
+ const isReadOnly = isReadOnlyProp ?? formIsReadOnly;
35
35
  const state = useDateFieldState({
36
- ...removeDataAttributes(props),
36
+ ...removeDataAttributes({ ...props, isDisabled, isReadOnly }),
37
37
  locale,
38
38
  createCalendar
39
39
  });
@@ -48,11 +48,13 @@ function DateInputRender(props, ref) {
48
48
  inputProps,
49
49
  ...validation
50
50
  } = useDateField(
51
- { ...removeDataAttributes(props), validationBehavior },
51
+ {
52
+ ...removeDataAttributes({ ...props, isDisabled, isReadOnly }),
53
+ validationBehavior
54
+ },
52
55
  state,
53
56
  domRef
54
57
  );
55
- const { isRequired, isDisabled } = state;
56
58
  const { isInvalid } = validation;
57
59
  const rootProps = mergeProps(
58
60
  {
@@ -81,37 +83,39 @@ function DateInputRender(props, ref) {
81
83
  isInvalid,
82
84
  isDisabled,
83
85
  startAddon,
84
- variant
86
+ variant,
87
+ onMouseDown: (e) => {
88
+ if (e.currentTarget !== e.target) return;
89
+ e.preventDefault();
90
+ labelPropReactAria?.onClick?.(e);
91
+ }
85
92
  },
86
93
  slotProps?.group
87
94
  );
88
- const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
95
+ const captionProps = mergeProps(
96
+ { children: caption },
97
+ descriptionProps,
98
+ slotProps?.caption
99
+ );
89
100
  const errorProps = mergeProps(
90
- {
91
- children: errorMessage
92
- },
93
- slotProps?.errorMessage,
94
- errorMessageProps
101
+ { children: errorMessage },
102
+ errorMessageProps,
103
+ slotProps?.errorMessage
95
104
  );
96
105
  const controlProps = mergeProps(
97
- {
98
- variant,
99
- isInvalid,
100
- isDisabled,
101
- ref: domRef
102
- },
103
- slotProps?.inputDate,
104
- fieldProps
106
+ { ref: domRef },
107
+ fieldProps,
108
+ slotProps?.inputDate
105
109
  );
106
- return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
107
- /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
108
- /* @__PURE__ */ jsxs(Field, { children: [
109
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsxs(FieldInputDate, { ...controlProps, children: [
110
+ return /* @__PURE__ */ jsxs(FormField, { ...rootProps, children: [
111
+ /* @__PURE__ */ jsx(FormField.Label, { ...labelProps }),
112
+ /* @__PURE__ */ jsxs("div", { className: s.body, children: [
113
+ /* @__PURE__ */ jsx(FormField.ControlGroup, { ...groupProps, children: /* @__PURE__ */ jsxs(FormField.InputDate, { ...controlProps, children: [
110
114
  state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)),
111
115
  /* @__PURE__ */ jsx("input", { ...inputProps })
112
116
  ] }) }),
113
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
114
- /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
117
+ /* @__PURE__ */ jsx(FormField.Caption, { ...captionProps }),
118
+ /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FormField.Error, { ...errorProps }) })
115
119
  ] })
116
120
  ] });
117
121
  }
@@ -1,8 +1,11 @@
1
1
  const base = "kbq-dateinput-a4c39b";
2
+ const body = "kbq-dateinput-body-64bfc5";
2
3
  const s = {
3
- base
4
+ base,
5
+ body
4
6
  };
5
7
  export {
6
8
  base,
9
+ body,
7
10
  s as default
8
11
  };
@@ -1,14 +1,12 @@
1
1
  import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
2
  import type { AriaDateFieldProps, DateValue } from '@koobiq/react-primitives';
3
- import { type FieldCaptionProps, type FieldErrorProps, type FieldInputDateProps, type FieldContentGroupProps, type FieldContentGroupPropVariant } from '../FieldComponents';
4
- import { type FormControlProps, type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
5
- import type { FormControlLabelProps } from '../FormControlLabel';
3
+ import type { FormFieldProps, FormFieldLabelProps, FormFieldErrorProps, FormFieldCaptionProps, FormFieldPropLabelAlign, FormFieldInputDateProps, FormFieldControlGroupProps, FormFieldPropLabelPlacement, FormFieldControlGroupPropVariant } from '../FormField';
6
4
  export declare const dateInputPropVariant: readonly ["filled", "transparent"];
7
- export type DateInputPropVariant = FieldContentGroupPropVariant;
5
+ export type DateInputPropVariant = FormFieldControlGroupPropVariant;
8
6
  export declare const dateInputPropLabelPlacement: readonly ["top", "side"];
9
- export type DateInputPropLabelPlacement = FormControlPropLabelPlacement;
7
+ export type DateInputPropLabelPlacement = FormFieldPropLabelPlacement;
10
8
  export declare const dateInputPropLabelAlign: readonly ["start", "end"];
11
- export type DateInputPropLabelAlign = FormControlPropLabelAlign;
9
+ export type DateInputPropLabelAlign = FormFieldPropLabelAlign;
12
10
  export type DateInputProps<T extends DateValue> = {
13
11
  /** Inline styles. */
14
12
  style?: CSSProperties;
@@ -29,12 +27,12 @@ export type DateInputProps<T extends DateValue> = {
29
27
  fullWidth?: boolean;
30
28
  /** The props used for each slot inside. */
31
29
  slotProps?: {
32
- root?: FormControlProps;
33
- label?: FormControlLabelProps;
34
- group?: FieldContentGroupProps;
35
- caption?: FieldCaptionProps;
36
- inputDate?: FieldInputDateProps;
37
- errorMessage?: FieldErrorProps;
30
+ root?: FormFieldProps;
31
+ label?: FormFieldLabelProps;
32
+ group?: FormFieldControlGroupProps;
33
+ caption?: FormFieldCaptionProps;
34
+ inputDate?: FormFieldInputDateProps;
35
+ errorMessage?: FormFieldErrorProps;
38
36
  };
39
37
  /** Ref to the control */
40
38
  ref?: Ref<HTMLDivElement>;
@@ -1,8 +1,8 @@
1
- import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
2
- import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
3
- const dateInputPropVariant = fieldContentGroupPropVariant;
4
- const dateInputPropLabelPlacement = formControlPropLabelPlacement;
5
- const dateInputPropLabelAlign = formControlPropLabelAlign;
1
+ import { formFieldControlGroupPropVariant } from "../FormField/FormFieldControlGroup/types.js";
2
+ import { formFieldPropLabelPlacement, formFieldPropLabelAlign } from "../FormField/types.js";
3
+ const dateInputPropVariant = formFieldControlGroupPropVariant;
4
+ const dateInputPropLabelPlacement = formFieldPropLabelPlacement;
5
+ const dateInputPropLabelAlign = formFieldPropLabelAlign;
6
6
  export {
7
7
  dateInputPropLabelAlign,
8
8
  dateInputPropLabelPlacement,
@@ -8,6 +8,7 @@ import { PopoverInner } from "../Popover/PopoverInner.js";
8
8
  import s from "./DatePicker.module.css.js";
9
9
  import { DateInput } from "../DateInput/DateInput.js";
10
10
  import { Calendar } from "../Calendar/Calendar.js";
11
+ import { useForm } from "../Form/FormContext.js";
11
12
  import { IconButton } from "../IconButton/IconButton.js";
12
13
  function DatePickerRender(props, ref) {
13
14
  const anchorRef = useRef(null);
@@ -20,13 +21,23 @@ function DatePickerRender(props, ref) {
20
21
  fullWidth,
21
22
  errorMessage,
22
23
  labelPlacement,
24
+ isDisabled: isDisabledProp,
25
+ isReadOnly: isReadOnlyProp,
23
26
  labelAlign,
24
27
  startAddon,
25
28
  endAddon,
26
29
  "data-testid": testId
27
30
  } = props;
31
+ const { isDisabled: formIsDisabled, isReadOnly: formIsReadOnly } = useForm();
32
+ const isDisabled = isDisabledProp ?? formIsDisabled;
33
+ const isReadOnly = isReadOnlyProp ?? formIsReadOnly;
28
34
  const state = useDatePickerState(
29
- removeDataAttributes({ ...props, description: caption })
35
+ removeDataAttributes({
36
+ ...props,
37
+ isDisabled,
38
+ isReadOnly,
39
+ description: caption
40
+ })
30
41
  );
31
42
  const {
32
43
  isInvalid,
@@ -37,7 +48,12 @@ function DatePickerRender(props, ref) {
37
48
  dialogProps,
38
49
  calendarProps: calendarPropsAria
39
50
  } = useDatePicker(
40
- removeDataAttributes({ ...props, description: caption }),
51
+ removeDataAttributes({
52
+ ...props,
53
+ isDisabled,
54
+ isReadOnly,
55
+ description: caption
56
+ }),
41
57
  state,
42
58
  anchorRef
43
59
  );
@@ -2,7 +2,7 @@ import type { CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
2
  import type { AriaDatePickerProps, DateValue } from '@koobiq/react-primitives';
3
3
  import type { CalendarProps } from '../Calendar';
4
4
  import type { DateInputPropLabelAlign, DateInputPropLabelPlacement, DateInputProps, DateInputRef } from '../DateInput';
5
- import type { FormControlLabelProps } from '../FormControlLabel';
5
+ import type { FormFieldLabelProps } from '../FormField';
6
6
  import type { PopoverProps } from '../Popover';
7
7
  export type DatePickerProps<T extends DateValue> = {
8
8
  /**
@@ -36,7 +36,7 @@ export type DatePickerProps<T extends DateValue> = {
36
36
  /** The props used for each slot inside. */
37
37
  slotProps?: {
38
38
  root?: DateInputProps<T>;
39
- label?: FormControlLabelProps;
39
+ label?: FormFieldLabelProps;
40
40
  popover?: PopoverProps;
41
41
  calendar?: CalendarProps<T>;
42
42
  };
@@ -38,8 +38,8 @@ const DialogComponent = forwardRef(
38
38
  };
39
39
  const { ref: bodyRef, height } = useElementSize();
40
40
  useEffect(() => {
41
- if (bodyRef.current) updateOverflow(bodyRef.current);
42
- }, [bodyRef.current, height]);
41
+ updateOverflow(bodyRef.current);
42
+ }, [height]);
43
43
  useEventListener({
44
44
  element: bodyRef,
45
45
  eventName: "scroll",
@@ -4,10 +4,10 @@ export type DialogCloseButtonRef = ComponentRef<'button'>;
4
4
  export type DialogCloseButtonProps = ButtonProps;
5
5
  export declare const DialogCloseButton: import("react").ForwardRefExoticComponent<Omit<Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
6
6
  ref?: ((instance: HTMLButtonElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLButtonElement> | null | undefined;
7
- }, "children" | "value" | "form" | "style" | "as" | "className" | "autoFocus" | "id" | "tabIndex" | "rel" | "aria-controls" | "aria-describedby" | "aria-details" | "aria-expanded" | "aria-haspopup" | "aria-label" | "aria-labelledby" | "aria-pressed" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onClick" | "name" | "target" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "variant" | "fullWidth" | "isDisabled" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange" | "preventFocusOnPress" | "excludeFromTabOrder" | keyof import("@react-types/shared").HoverEvents | "isLoading" | "onlyIcon" | "startIcon" | "endIcon" | "data-testid" | keyof {
7
+ }, "children" | "value" | "form" | "style" | "as" | "className" | "autoFocus" | "id" | "tabIndex" | "rel" | "aria-controls" | "aria-describedby" | "aria-details" | "aria-expanded" | "aria-haspopup" | "aria-label" | "aria-labelledby" | "aria-pressed" | "onFocus" | "onBlur" | "onKeyDown" | "onKeyUp" | "onClick" | "name" | "target" | "type" | "formAction" | "formEncType" | "formMethod" | "formNoValidate" | "formTarget" | "data-testid" | "isDisabled" | "variant" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange" | "preventFocusOnPress" | "excludeFromTabOrder" | keyof import("@react-types/shared").HoverEvents | "isLoading" | "fullWidth" | "onlyIcon" | "startIcon" | "endIcon" | keyof {
8
8
  progress?: boolean;
9
9
  disabled?: boolean;
10
- }> & Omit<Omit<import("@koobiq/react-primitives").ButtonBaseProps, "slot">, "children" | "style" | "className" | "variant" | "fullWidth" | "onlyIcon" | "startIcon" | "endIcon" | "data-testid" | keyof {
10
+ }> & Omit<Omit<import("@koobiq/react-primitives").ButtonBaseProps, "slot">, "children" | "style" | "className" | "data-testid" | "variant" | "fullWidth" | "onlyIcon" | "startIcon" | "endIcon" | keyof {
11
11
  progress?: boolean;
12
12
  disabled?: boolean;
13
13
  }> & {
@@ -1,19 +1,15 @@
1
- export declare const FormComponent: import("react").ForwardRefExoticComponent<{
2
- labelPlacement?: import("..").FormControlPropLabelPlacement | import("../../utils").ResponsiveValue<import("..").FormControlPropLabelPlacement>;
3
- labelAlign?: import("..").FormControlPropLabelAlign | import("../../utils").ResponsiveValue<import("..").FormControlPropLabelAlign>;
1
+ import { FormGroup, FormCaption, FormActions } from './components';
2
+ declare const FormComponent: import("react").ForwardRefExoticComponent<{
3
+ isDisabled?: boolean;
4
+ isReadOnly?: boolean;
5
+ labelPlacement?: import("..").FormFieldPropLabelPlacement | import("../../utils").ResponsiveValue<import("..").FormFieldPropLabelPlacement>;
6
+ labelAlign?: import("..").FormFieldPropLabelAlign | import("../../utils").ResponsiveValue<import("..").FormFieldPropLabelAlign>;
4
7
  labelInlineSize?: import("./types").FormPropLabelInlineSize | import("../../utils").ResponsiveValue<import("./types").FormPropLabelInlineSize>;
5
8
  } & import("@koobiq/react-primitives").FormProps & import("react").RefAttributes<HTMLFormElement>>;
6
- export declare const Fieldset: import("@koobiq/react-core").PolyForwardComponent<"div", {
7
- className?: string;
8
- }, import("react").ElementType>;
9
- export declare const Legend: import("@koobiq/react-core").PolyForwardComponent<"p", Omit<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLParagraphElement>, HTMLParagraphElement>, "ref"> & {
10
- ref?: ((instance: HTMLParagraphElement | null) => void | import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof import("react").DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES]) | import("react").RefObject<HTMLParagraphElement> | null | undefined;
11
- }, "as" | keyof import("..").TypographyBaseProps> & import("..").TypographyBaseProps & {
12
- as?: "p" | undefined;
13
- }, import("react").ElementType>;
14
9
  type CompoundedComponent = typeof FormComponent & {
15
- Fieldset: typeof Fieldset;
16
- Legend: typeof Legend;
10
+ Group: typeof FormGroup;
11
+ Caption: typeof FormCaption;
12
+ Actions: typeof FormActions;
17
13
  };
18
14
  export declare const Form: CompoundedComponent;
19
15
  export {};
@@ -1,11 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
- import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
3
+ import { clsx } from "@koobiq/react-core";
4
4
  import { Form as Form$1 } from "@koobiq/react-primitives";
5
5
  import s from "./Form.module.css.js";
6
6
  import { FormContext } from "./FormContext.js";
7
7
  import { templatePresets } from "./utils.js";
8
- import { Typography } from "../Typography/Typography.js";
8
+ import { FormGroup } from "./components/FormGroup/FormGroup.js";
9
+ import { FormCaption } from "./components/FormCaption/FormCaption.js";
10
+ import { FormActions } from "./components/FormActions/FormActions.js";
9
11
  import { useMatchedBreakpoints } from "../Provider/BreakpointsContext.js";
10
12
  import { getResponsiveValue } from "../../utils/getResponsiveValue/getResponsiveValue.js";
11
13
  const FormComponent = forwardRef((props, ref) => {
@@ -13,6 +15,8 @@ const FormComponent = forwardRef((props, ref) => {
13
15
  labelPlacement: labelPlacementProp,
14
16
  labelAlign: labelAlignProp,
15
17
  labelInlineSize: labelInlineSizeProp,
18
+ isReadOnly,
19
+ isDisabled,
16
20
  className,
17
21
  style,
18
22
  ...other
@@ -23,41 +27,34 @@ const FormComponent = forwardRef((props, ref) => {
23
27
  const labelInlineSize = getResponsiveValue(labelInlineSizeProp, breakpoints);
24
28
  const orientation = labelPlacement === "side" ? "horizontal" : "vertical";
25
29
  const formStyle = labelInlineSize ? {
26
- "--template-columns": templatePresets[labelInlineSize]
30
+ "--label-inline-size": templatePresets[labelInlineSize]
27
31
  } : void 0;
28
- return /* @__PURE__ */ jsx(FormContext.Provider, { value: { labelPlacement, labelAlign }, children: /* @__PURE__ */ jsx(
29
- Form$1,
32
+ return /* @__PURE__ */ jsx(
33
+ FormContext.Provider,
30
34
  {
31
- "data-orientation": orientation,
32
- className: clsx(s.base, s[orientation], className),
33
- style: { ...style, ...formStyle },
34
- ...other,
35
- ref
35
+ value: { labelPlacement, labelAlign, isDisabled, isReadOnly },
36
+ children: /* @__PURE__ */ jsx(
37
+ Form$1,
38
+ {
39
+ "data-label-align": labelAlign,
40
+ "data-orientation": orientation,
41
+ "data-label-placement": labelPlacement,
42
+ "data-readonly": isReadOnly || void 0,
43
+ "data-disabled": isDisabled || void 0,
44
+ className: clsx(s.base, s[orientation], className),
45
+ style: { ...style, ...formStyle },
46
+ ...other,
47
+ ref
48
+ }
49
+ )
36
50
  }
37
- ) });
51
+ );
38
52
  });
39
- const Fieldset = polymorphicForwardRef(
40
- ({ className, as: Tag = "fieldset", ...other }, ref) => /* @__PURE__ */ jsx(Tag, { className: clsx(s.fieldset, className), ...other, ref })
41
- );
42
- const Legend = polymorphicForwardRef(
43
- ({ className, as = "p", ...other }, ref) => /* @__PURE__ */ jsx(
44
- Typography,
45
- {
46
- as,
47
- variant: "text-big",
48
- className: clsx(s.legend, className),
49
- ...other,
50
- ref
51
- }
52
- )
53
- );
54
53
  FormComponent.displayName = "Form";
55
54
  const Form = FormComponent;
56
- Form.Fieldset = Fieldset;
57
- Form.Legend = Legend;
55
+ Form.Group = FormGroup;
56
+ Form.Caption = FormCaption;
57
+ Form.Actions = FormActions;
58
58
  export {
59
- Fieldset,
60
- Form,
61
- FormComponent,
62
- Legend
59
+ Form
63
60
  };
@@ -1,17 +1,29 @@
1
1
  const base = "kbq-form-40d37e";
2
- const fieldset = "kbq-form-fieldset-b2924b";
3
- const legend = "kbq-form-legend-91e738";
2
+ const group = "kbq-form-group-4158f5";
3
+ const caption = "kbq-form-caption-052541";
4
+ const top = "kbq-form-top-605582";
5
+ const bottom = "kbq-form-bottom-c13772";
6
+ const vertical = "kbq-form-vertical-2f3a00";
4
7
  const horizontal = "kbq-form-horizontal-52dea8";
8
+ const actions = "kbq-form-actions-22aca9";
5
9
  const s = {
6
10
  base,
7
- fieldset,
8
- legend,
9
- horizontal
11
+ group,
12
+ caption,
13
+ top,
14
+ bottom,
15
+ vertical,
16
+ horizontal,
17
+ actions
10
18
  };
11
19
  export {
20
+ actions,
12
21
  base,
22
+ bottom,
23
+ caption,
13
24
  s as default,
14
- fieldset,
25
+ group,
15
26
  horizontal,
16
- legend
27
+ top,
28
+ vertical
17
29
  };
@@ -1,7 +1,9 @@
1
- import type { FormControlPropLabelAlign, FormControlPropLabelPlacement } from '../FormControl';
1
+ import type { FormFieldPropLabelAlign, FormFieldPropLabelPlacement } from '../FormField';
2
2
  export type FormContextProps = {
3
- labelPlacement?: FormControlPropLabelPlacement;
4
- labelAlign?: FormControlPropLabelAlign;
3
+ labelPlacement?: FormFieldPropLabelPlacement;
4
+ labelAlign?: FormFieldPropLabelAlign;
5
+ isDisabled?: boolean;
6
+ isReadOnly?: boolean;
5
7
  };
6
8
  export declare const FormContext: import("react").Context<FormContextProps>;
7
9
  export declare const useForm: () => FormContextProps;
@@ -0,0 +1,7 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ export type FormActionsBaseProps = {
3
+ /** Additional CSS-classes. */
4
+ className?: string;
5
+ };
6
+ export declare const FormActions: import("@koobiq/react-core").PolyForwardComponent<"div", FormActionsBaseProps, ElementType>;
7
+ export type FormActionsProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormActions<As>>;
@@ -0,0 +1,9 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
3
+ import s from "../../Form.module.css.js";
4
+ const FormActions = polymorphicForwardRef(
5
+ ({ className, as: Tag = "div", ...other }, ref) => /* @__PURE__ */ jsx(Tag, { className: clsx(s.actions, className), ...other, ref })
6
+ );
7
+ export {
8
+ FormActions
9
+ };
@@ -0,0 +1 @@
1
+ export * from './FormActions';
@@ -0,0 +1,16 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ export declare const formCaptionPropSide: readonly ["top", "bottom"];
3
+ export type FormCaptionPropSide = (typeof formCaptionPropSide)[number];
4
+ export type FormCaptionBaseProps = {
5
+ /** Additional CSS-classes. */
6
+ className?: string;
7
+ /**
8
+ * Placement of the caption relative to the form.
9
+ * - `top` — renders the caption above the form.
10
+ * - `bottom` — renders the caption below the form.
11
+ * @default 'top'
12
+ */
13
+ side?: FormCaptionPropSide;
14
+ };
15
+ export declare const FormCaption: import("@koobiq/react-core").PolyForwardComponent<"div", FormCaptionBaseProps, ElementType>;
16
+ export type FormCationProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormCaption<As>>;
@@ -0,0 +1,17 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
3
+ import s from "../../Form.module.css.js";
4
+ const FormCaption = polymorphicForwardRef(
5
+ ({ className, as: Tag = "div", side = "top", ...other }, ref) => /* @__PURE__ */ jsx(
6
+ Tag,
7
+ {
8
+ className: clsx(s.caption, s[side], className),
9
+ "data-side": side,
10
+ ...other,
11
+ ref
12
+ }
13
+ )
14
+ );
15
+ export {
16
+ FormCaption
17
+ };
@@ -0,0 +1 @@
1
+ export * from './FormCaption';
@@ -0,0 +1,7 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ export type FormGroupBaseProps = {
3
+ /** Additional CSS-classes. */
4
+ className?: string;
5
+ };
6
+ export declare const FormGroup: import("@koobiq/react-core").PolyForwardComponent<"div", FormGroupBaseProps, ElementType>;
7
+ export type FormGroupProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormGroup<As>>;