@koobiq/react-components 0.7.1 → 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.
Files changed (122) hide show
  1. package/dist/components/Alert/Alert.js +5 -3
  2. package/dist/components/Alert/types.d.ts +0 -3
  3. package/dist/components/Backdrop/Backdrop.js +1 -1
  4. package/dist/components/Backdrop/types.d.ts +4 -1
  5. package/dist/components/Button/Button.js +7 -7
  6. package/dist/components/Button/types.d.ts +0 -4
  7. package/dist/components/ButtonToggleGroup/ButtonToggleGroup.js +6 -6
  8. package/dist/components/ButtonToggleGroup/components/ButtonToggle/ButtonToggle.js +6 -6
  9. package/dist/components/ButtonToggleGroup/components/ButtonToggle/types.d.ts +0 -1
  10. package/dist/components/ButtonToggleGroup/types.d.ts +0 -3
  11. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  12. package/dist/components/Checkbox/Checkbox.js +6 -6
  13. package/dist/components/Checkbox/types.d.ts +0 -5
  14. package/dist/components/Container/Container.js +2 -2
  15. package/dist/components/Container/types.d.ts +0 -2
  16. package/dist/components/DateInput/DateInput.js +27 -17
  17. package/dist/components/DateInput/types.d.ts +20 -6
  18. package/dist/components/DateInput/types.js +5 -0
  19. package/dist/components/DatePicker/DatePicker.js +5 -1
  20. package/dist/components/DatePicker/types.d.ts +14 -3
  21. package/dist/components/Dialog/Dialog.js +1 -1
  22. package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -2
  23. package/dist/components/Dialog/types.d.ts +0 -1
  24. package/dist/components/Divider/Divider.js +5 -4
  25. package/dist/components/Divider/types.d.ts +0 -2
  26. package/dist/components/FieldComponents/Field/Field.d.ts +4 -0
  27. package/dist/components/FieldComponents/Field/Field.js +10 -0
  28. package/dist/components/FieldComponents/Field/Field.module.css.js +8 -0
  29. package/dist/components/FieldComponents/Field/index.d.ts +2 -0
  30. package/dist/components/FieldComponents/Field/types.d.ts +4 -0
  31. package/dist/components/FieldComponents/FieldAddon/FieldAddon.js +4 -4
  32. package/dist/components/FieldComponents/FieldContentGroup/FieldContentGroup.js +2 -2
  33. package/dist/components/FieldComponents/FieldError/FieldError.d.ts +4 -2
  34. package/dist/components/FieldComponents/FieldError/FieldError.js +6 -8
  35. package/dist/components/FieldComponents/FieldInput/FieldInput.js +3 -3
  36. package/dist/components/FieldComponents/FieldInputDate/FieldInputDate.js +2 -2
  37. package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +3 -3
  38. package/dist/components/FieldComponents/index.d.ts +1 -2
  39. package/dist/components/FormControl/FormControl.d.ts +4 -0
  40. package/dist/components/FormControl/FormControl.js +33 -0
  41. package/dist/components/FormControl/FormControl.module.css.js +17 -0
  42. package/dist/components/FormControl/index.d.ts +2 -0
  43. package/dist/components/FormControl/types.d.ts +19 -0
  44. package/dist/components/FormControl/types.js +6 -0
  45. package/dist/components/FormControlLabel/FormControlLabel.d.ts +4 -2
  46. package/dist/components/{FieldComponents/FieldLabel/FieldLabel.js → FormControlLabel/FormControlLabel.js} +7 -7
  47. package/dist/components/FormControlLabel/FormControlLabel.module.css.js +14 -0
  48. package/dist/components/FormControlLabel/types.d.ts +6 -31
  49. package/dist/components/IconButton/IconButton.js +4 -4
  50. package/dist/components/IconButton/types.d.ts +0 -3
  51. package/dist/components/Input/Input.d.ts +8 -5
  52. package/dist/components/Input/Input.js +25 -15
  53. package/dist/components/Input/Input.module.css.js +4 -0
  54. package/dist/components/Input/types.d.ts +20 -13
  55. package/dist/components/Input/types.js +5 -0
  56. package/dist/components/InputNumber/InputNumber.d.ts +8 -5
  57. package/dist/components/InputNumber/InputNumber.js +21 -15
  58. package/dist/components/InputNumber/types.d.ts +19 -12
  59. package/dist/components/InputNumber/types.js +5 -0
  60. package/dist/components/Link/Link.js +3 -3
  61. package/dist/components/Link/types.d.ts +0 -5
  62. package/dist/components/List/components/ListOption/ListOption.js +5 -5
  63. package/dist/components/List/components/ListSection/ListSection.js +1 -1
  64. package/dist/components/Modal/Modal.js +1 -1
  65. package/dist/components/Modal/types.d.ts +1 -5
  66. package/dist/components/Popover/PopoverInner.js +2 -2
  67. package/dist/components/Popover/types.d.ts +0 -4
  68. package/dist/components/RadioGroup/RadioGroup.js +73 -23
  69. package/dist/components/RadioGroup/RadioGroup.module.css.js +8 -0
  70. package/dist/components/RadioGroup/components/Radio/Radio.d.ts +1 -1
  71. package/dist/components/RadioGroup/components/Radio/types.d.ts +0 -1
  72. package/dist/components/RadioGroup/components/index.d.ts +0 -2
  73. package/dist/components/RadioGroup/types.d.ts +38 -10
  74. package/dist/components/RadioGroup/types.js +5 -0
  75. package/dist/components/SearchInput/SearchInput.d.ts +8 -5
  76. package/dist/components/SearchInput/SearchInput.js +26 -19
  77. package/dist/components/SearchInput/types.d.ts +20 -8
  78. package/dist/components/SearchInput/types.js +5 -0
  79. package/dist/components/Select/Select.js +30 -26
  80. package/dist/components/Select/Select.module.css.js +0 -6
  81. package/dist/components/Select/components/SelectOption/SelectOption.js +5 -5
  82. package/dist/components/Select/types.d.ts +22 -8
  83. package/dist/components/Select/types.js +5 -0
  84. package/dist/components/SidePanel/SidePanel.js +1 -1
  85. package/dist/components/SidePanel/types.d.ts +0 -5
  86. package/dist/components/Table/Table.js +4 -4
  87. package/dist/components/Table/components/TableRow/TableRow.js +5 -5
  88. package/dist/components/Table/types.d.ts +0 -2
  89. package/dist/components/TagGroup/components/Tag/Tag.js +6 -6
  90. package/dist/components/Textarea/Textarea.d.ts +4 -3
  91. package/dist/components/Textarea/Textarea.js +13 -10
  92. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
  93. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +10 -10
  94. package/dist/components/Textarea/types.d.ts +19 -12
  95. package/dist/components/Textarea/types.js +5 -0
  96. package/dist/components/TimePicker/TimePicker.d.ts +1 -1
  97. package/dist/components/TimePicker/TimePicker.js +34 -24
  98. package/dist/components/TimePicker/types.d.ts +19 -5
  99. package/dist/components/TimePicker/types.js +7 -0
  100. package/dist/components/Toggle/Toggle.d.ts +1 -1
  101. package/dist/components/Toggle/Toggle.js +3 -3
  102. package/dist/components/Toggle/types.d.ts +0 -3
  103. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  104. package/dist/components/Tooltip/Tooltip.js +9 -9
  105. package/dist/components/Tooltip/types.d.ts +0 -3
  106. package/dist/components/index.d.ts +2 -0
  107. package/dist/index.js +31 -11
  108. package/dist/style.css +103 -80
  109. package/package.json +5 -5
  110. package/dist/components/FieldComponents/FieldControl/FieldControl.d.ts +0 -8
  111. package/dist/components/FieldComponents/FieldControl/FieldControl.js +0 -17
  112. package/dist/components/FieldComponents/FieldControl/FieldControl.module.css.js +0 -11
  113. package/dist/components/FieldComponents/FieldControl/index.d.ts +0 -1
  114. package/dist/components/FieldComponents/FieldLabel/FieldLabel.d.ts +0 -9
  115. package/dist/components/FieldComponents/FieldLabel/FieldLabel.module.css.js +0 -14
  116. package/dist/components/FieldComponents/FieldLabel/index.d.ts +0 -1
  117. package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.d.ts +0 -7
  118. package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.js +0 -21
  119. package/dist/components/RadioGroup/components/RadioGroupDescription/index.d.ts +0 -1
  120. package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.d.ts +0 -6
  121. package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.js +0 -14
  122. package/dist/components/RadioGroup/components/RadioGroupLabel/index.d.ts +0 -1
@@ -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,20 +4,21 @@ 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" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "style" | "className" | "cols" | "rows" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "errorMessage" | "isLabelHidden" | "expand"> & {
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;
13
+ labelPlacement?: import("./types").TextareaPropLabelPlacement;
14
+ labelAlign?: import("./types").TextareaPropLabelAlign;
14
15
  caption?: import("react").ReactNode;
15
16
  rows?: number;
16
17
  cols?: number;
17
18
  expand?: import("./types").TextareaPropExpand;
18
19
  'data-testid'?: string | number;
19
20
  slotProps?: {
20
- label?: import("../FieldComponents").FieldLabelProps;
21
+ label?: import("..").FormControlLabelProps;
21
22
  caption?: import("../FieldComponents").FieldCaptionProps;
22
23
  textarea?: import("../FieldComponents").FieldInputProps<"textarea">;
23
24
  errorMessage?: import("../FieldComponents").FieldErrorProps;
@@ -5,11 +5,11 @@ 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 { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
8
+ import { FormControl } from "../FormControl/FormControl.js";
9
9
  const Textarea = forwardRef((props, ref) => {
10
10
  const {
11
11
  variant = "filled",
12
- fullWidth = false,
12
+ fullWidth,
13
13
  hiddenLabel,
14
14
  isLabelHidden: isLabelHiddenProp,
15
15
  disabled,
@@ -20,6 +20,8 @@ const Textarea = forwardRef((props, ref) => {
20
20
  isRequired: isRequiredProp,
21
21
  readonly,
22
22
  isReadOnly: isReadOnlyProp,
23
+ labelPlacement,
24
+ labelAlign,
23
25
  rows,
24
26
  cols,
25
27
  expand,
@@ -29,11 +31,11 @@ const Textarea = forwardRef((props, ref) => {
29
31
  label,
30
32
  ...other
31
33
  } = props;
32
- const isDisabled = isDisabledProp ?? disabled ?? false;
33
- const isRequired = isRequiredProp ?? required ?? false;
34
- const isReadOnly = isReadOnlyProp ?? readonly ?? false;
35
- const isInvalid = isInvalidProp ?? error ?? false;
36
- const isLabelHidden = isLabelHiddenProp ?? hiddenLabel ?? false;
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;
37
39
  if (process.env.NODE_ENV !== "production" && "disabled" in props) {
38
40
  deprecate(
39
41
  'Textarea: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
@@ -68,12 +70,13 @@ const Textarea = forwardRef((props, ref) => {
68
70
  isReadOnly,
69
71
  isInvalid,
70
72
  errorMessage,
71
- "data-variant": variant,
72
- "data-fullwidth": fullWidth
73
+ labelPlacement,
74
+ labelAlign,
75
+ "data-variant": variant
73
76
  },
74
77
  other
75
78
  );
76
- return /* @__PURE__ */ jsx(FieldControl, { as: TextField, inputElementType: "textarea", ...rootProps, children: (values) => /* @__PURE__ */ jsx(
79
+ return /* @__PURE__ */ jsx(FormControl, { as: TextField, inputElementType: "textarea", ...rootProps, children: (values) => /* @__PURE__ */ jsx(
77
80
  TextareaContextConsumer,
78
81
  {
79
82
  ...values,
@@ -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" | "slotProps" | "errorMessage" | "isLabelHidden" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;
6
+ } & Pick<TextareaProps, "caption" | "label" | "cols" | "rows" | "labelPlacement" | "variant" | "slotProps" | "errorMessage" | "isLabelHidden" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -4,7 +4,8 @@ import { useDOMRef, mergeProps } from "@koobiq/react-core";
4
4
  import { useTextareaContext } from "@koobiq/react-primitives";
5
5
  import s from "../../Textarea.module.css.js";
6
6
  import { useTextareaAutosize } from "../../utils/useTextareaAutosize.js";
7
- import { FieldLabel } from "../../../FieldComponents/FieldLabel/FieldLabel.js";
7
+ import { FormControlLabel } from "../../../FormControlLabel/FormControlLabel.js";
8
+ import { Field } from "../../../FieldComponents/Field/Field.js";
8
9
  import { FieldContentGroup } from "../../../FieldComponents/FieldContentGroup/FieldContentGroup.js";
9
10
  import { FieldInput } from "../../../FieldComponents/FieldInput/FieldInput.js";
10
11
  import { FieldCaption } from "../../../FieldComponents/FieldCaption/FieldCaption.js";
@@ -42,7 +43,7 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
42
43
  );
43
44
  const captionProps = mergeProps({ children: caption }, slotProps?.caption);
44
45
  const errorProps = mergeProps(
45
- { isInvalid, children: errorMessage },
46
+ { children: errorMessage, className: s.error },
46
47
  slotProps?.errorMessage
47
48
  );
48
49
  const groupProps = {
@@ -50,15 +51,14 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
50
51
  isInvalid,
51
52
  isDisabled
52
53
  };
53
- const labelProps = mergeProps(
54
- { isHidden: isLabelHidden, children: label, isRequired },
55
- slotProps?.label
56
- );
54
+ const labelProps = mergeProps({ isHidden: isLabelHidden, children: label, isRequired }, slotProps?.label);
57
55
  return /* @__PURE__ */ jsxs(Fragment, { children: [
58
- /* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
59
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { as: "textarea", ...textareaProps }) }),
60
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
61
- /* @__PURE__ */ jsx(FieldError, { ...errorProps })
56
+ /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
57
+ /* @__PURE__ */ jsxs(Field, { children: [
58
+ /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { as: "textarea", ...textareaProps }) }),
59
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
60
+ /* @__PURE__ */ jsx(FieldError, { ...errorProps })
61
+ ] })
62
62
  ] });
63
63
  });
64
64
  TextareaContextConsumer.displayName = "TextareaContextConsumer";
@@ -1,43 +1,44 @@
1
1
  import type { ComponentRef, CSSProperties, ReactNode } from 'react';
2
2
  import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { TextFieldProps } from '@koobiq/react-primitives';
4
- import { type FieldCaptionProps, type FieldContentGroupPropVariant, type FieldErrorProps, type FieldInputProps, type FieldLabelProps } from '../FieldComponents';
4
+ import { type FieldCaptionProps, type FieldContentGroupPropVariant, type FieldErrorProps, type FieldInputProps } from '../FieldComponents';
5
+ import { type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
6
+ import type { FormControlLabelProps } from '../FormControlLabel';
5
7
  export declare const textareaPropVariant: readonly ["filled", "transparent"];
6
8
  export type TextareaPropVariant = FieldContentGroupPropVariant;
7
9
  export declare const textareaPropExpand: readonly ["auto-size", "vertical-resize"];
8
10
  export type TextareaPropExpand = (typeof textareaPropExpand)[number];
11
+ export declare const textareaPropLabelPlacement: readonly ["top", "side"];
12
+ export type TextareaPropLabelPlacement = FormControlPropLabelPlacement;
13
+ export declare const textareaPropLabelAlign: readonly ["start", "end"];
14
+ export type TextareaPropLabelAlign = FormControlPropLabelAlign;
9
15
  type TextareaDeprecatedProps = {
10
16
  /**
11
17
  * If `true`, the component is disabled.
12
- * @default false
13
18
  * @deprecated
14
19
  * The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
15
20
  */
16
21
  disabled?: boolean;
17
22
  /**
18
23
  * If `true`, the input will indicate an error.
19
- * @default false
20
24
  * @deprecated
21
25
  * The "error" prop is deprecated. Use "isInvalid" prop to replace it.
22
26
  */
23
27
  error?: boolean;
24
28
  /**
25
29
  * If `true`, the label is displayed as required and the input element is required.
26
- * @default false
27
30
  * @deprecated
28
31
  * The "required" prop is deprecated. Use "isRequired" prop to replace it.
29
32
  */
30
33
  required?: boolean;
31
34
  /**
32
35
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
33
- * @default false
34
36
  * @deprecated
35
37
  * The "hiddenLabel" prop is deprecated. Use "isLabelHidden" prop to replace it.
36
38
  */
37
39
  hiddenLabel?: boolean;
38
40
  /**
39
41
  * If `true`, the input can be selected but not changed by the user.
40
- * @default false
41
42
  * @deprecated
42
43
  * The "readonly" prop is deprecated. Use "isReadOnly" prop to replace it.
43
44
  */
@@ -53,18 +54,24 @@ export type TextareaProps = ExtendableProps<{
53
54
  * @default 'filled'
54
55
  */
55
56
  variant?: TextareaPropVariant;
56
- /** An error message for the field. */
57
- errorMessage?: ReactNode;
58
57
  /**
59
58
  * If true, the input will take up the full width of its container.
60
- * @default false
61
59
  */
62
60
  fullWidth?: boolean;
63
61
  /**
64
62
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
65
- * @default false
66
63
  */
67
64
  isLabelHidden?: boolean;
65
+ /**
66
+ * The label's overall position relative to the element it is labeling.
67
+ * @default 'top'
68
+ */
69
+ labelPlacement?: TextareaPropLabelPlacement;
70
+ /**
71
+ * The label's horizontal alignment relative to the element it is labeling.
72
+ * @default 'start'
73
+ */
74
+ labelAlign?: TextareaPropLabelAlign;
68
75
  /** The helper text content. */
69
76
  caption?: ReactNode;
70
77
  /** The rows property specifies the visible height of a text area, in lines. */
@@ -82,11 +89,11 @@ export type TextareaProps = ExtendableProps<{
82
89
  'data-testid'?: string | number;
83
90
  /** The props used for each slot inside. */
84
91
  slotProps?: {
85
- label?: FieldLabelProps;
92
+ label?: FormControlLabelProps;
86
93
  caption?: FieldCaptionProps;
87
94
  textarea?: FieldInputProps<'textarea'>;
88
95
  errorMessage?: FieldErrorProps;
89
96
  };
90
- }, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationBehavior' | 'validationState' | 'validate' | 'children' | 'style' | 'className' | 'inputElementType'>>;
97
+ }, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationState' | 'children' | 'style' | 'className' | 'inputElementType'>>;
91
98
  export type TextareaRef = ComponentRef<'textarea'>;
92
99
  export {};
@@ -1,7 +1,12 @@
1
1
  import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
2
+ import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
2
3
  const textareaPropVariant = fieldContentGroupPropVariant;
3
4
  const textareaPropExpand = ["auto-size", "vertical-resize"];
5
+ const textareaPropLabelPlacement = formControlPropLabelPlacement;
6
+ const textareaPropLabelAlign = formControlPropLabelAlign;
4
7
  export {
5
8
  textareaPropExpand,
9
+ textareaPropLabelAlign,
10
+ textareaPropLabelPlacement,
6
11
  textareaPropVariant
7
12
  };
@@ -1,5 +1,5 @@
1
1
  import { type Ref } from 'react';
2
- import type { TimeValue } from '@koobiq/react-primitives';
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,10 +2,11 @@ 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
- import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
8
- import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
7
+ import { FormControl } from "../FormControl/FormControl.js";
8
+ import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
9
+ import { Field } from "../FieldComponents/Field/Field.js";
9
10
  import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
10
11
  import { FieldInputDate } from "../FieldComponents/FieldInputDate/FieldInputDate.js";
11
12
  import { DateSegment } from "../DateSegment/DateSegment.js";
@@ -16,6 +17,9 @@ function TimePickerRender(props, ref) {
16
17
  const domRef = useDOMRef(ref);
17
18
  const {
18
19
  isLabelHidden,
20
+ labelPlacement,
21
+ errorMessage,
22
+ labelAlign,
19
23
  caption,
20
24
  label,
21
25
  slotProps,
@@ -25,7 +29,6 @@ function TimePickerRender(props, ref) {
25
29
  className,
26
30
  endAddon,
27
31
  startAddon,
28
- errorMessage,
29
32
  "data-testid": testId
30
33
  } = props;
31
34
  const state = useTimeFieldState({
@@ -37,20 +40,23 @@ function TimePickerRender(props, ref) {
37
40
  fieldProps,
38
41
  descriptionProps,
39
42
  errorMessageProps,
43
+ inputProps,
40
44
  ...validation
41
45
  } = useTimeField(removeDataAttributes(props), state, domRef);
42
- const { isInvalid, isDisabled, isRequired, isReadOnly } = state;
46
+ const { isDisabled, isRequired, isReadOnly } = state;
47
+ const { isInvalid } = validation;
43
48
  const rootProps = mergeProps(
44
49
  {
45
50
  style,
46
51
  fullWidth,
52
+ labelPlacement,
53
+ labelAlign,
47
54
  "data-testid": testId,
48
55
  "data-variant": variant,
49
- "data-invalid": isInvalid,
50
- "data-disabled": isDisabled,
51
- "data-fullwidth": fullWidth,
52
- "data-required": isRequired,
53
- "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,
54
60
  className: clsx(s.base, className)
55
61
  },
56
62
  slotProps?.root
@@ -86,24 +92,28 @@ function TimePickerRender(props, ref) {
86
92
  const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
87
93
  const errorProps = mergeProps(
88
94
  {
89
- isInvalid,
90
- children: typeof errorMessage === "function" ? errorMessage({ ...validation }) : errorMessage
95
+ children: errorMessage
91
96
  },
92
97
  slotProps?.errorMessage,
93
98
  errorMessageProps
94
99
  );
95
- return /* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
96
- /* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
97
- /* @__PURE__ */ jsx(
98
- FieldContentGroup,
99
- {
100
- ...groupProps,
101
- slotProps: { startAddon: { className: s.startAddon } },
102
- children: /* @__PURE__ */ jsx(FieldInputDate, { ...controlProps, children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)) })
103
- }
104
- ),
105
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
106
- /* @__PURE__ */ jsx(FieldError, { ...errorProps })
100
+ return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
101
+ /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
102
+ /* @__PURE__ */ jsxs(Field, { children: [
103
+ /* @__PURE__ */ jsx(
104
+ FieldContentGroup,
105
+ {
106
+ ...groupProps,
107
+ slotProps: { startAddon: { className: s.startAddon } },
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
+ ] })
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
115
+ /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
116
+ ] })
107
117
  ] });
108
118
  }
109
119
  const TimePicker = forwardRef(TimePickerRender);
@@ -1,7 +1,13 @@
1
1
  import type { ComponentRef, CSSProperties, ReactElement, ReactNode, Ref } from 'react';
2
2
  import type { AriaTimeFieldProps, TimeValue } from '@koobiq/react-primitives';
3
3
  import type { DateInputPropVariant } from '../DateInput';
4
- import type { FieldCaptionProps, FieldControlProps, FieldErrorProps, FieldInputDateProps, FieldContentGroupProps, FieldLabelProps } from '../FieldComponents';
4
+ import { type FieldCaptionProps, type FieldErrorProps, type FieldInputDateProps, type FieldContentGroupProps } from '../FieldComponents';
5
+ import { type FormControlProps, type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
6
+ import type { FormControlLabelProps } from '../FormControlLabel';
7
+ export declare const timePickerPropLabelPlacement: readonly ["top", "side"];
8
+ export type TimePickerPropLabelPlacement = FormControlPropLabelPlacement;
9
+ export declare const timePickerPropLabelAlign: readonly ["start", "end"];
10
+ export type TimePickerPropLabelAlign = FormControlPropLabelAlign;
5
11
  export type TimePickerProps<T extends TimeValue> = {
6
12
  /** Inline styles. */
7
13
  style?: CSSProperties;
@@ -18,13 +24,12 @@ export type TimePickerProps<T extends TimeValue> = {
18
24
  variant?: DateInputPropVariant;
19
25
  /**
20
26
  * If true, the input will take up the full width of its container.
21
- * @default false
22
27
  */
23
28
  fullWidth?: boolean;
24
29
  /** The props used for each slot inside. */
25
30
  slotProps?: {
26
- root?: FieldControlProps;
27
- label?: FieldLabelProps;
31
+ root?: FormControlProps;
32
+ label?: FormControlLabelProps;
28
33
  group?: FieldContentGroupProps;
29
34
  caption?: FieldCaptionProps;
30
35
  inputDate?: FieldInputDateProps;
@@ -34,9 +39,18 @@ export type TimePickerProps<T extends TimeValue> = {
34
39
  ref?: Ref<HTMLDivElement>;
35
40
  /**
36
41
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
37
- * @default false
38
42
  */
39
43
  isLabelHidden?: boolean;
44
+ /**
45
+ * The label's overall position relative to the element it is labeling.
46
+ * @default 'top'
47
+ */
48
+ labelPlacement?: TimePickerPropLabelPlacement;
49
+ /**
50
+ * The label's horizontal alignment relative to the element it is labeling.
51
+ * @default 'start'
52
+ */
53
+ labelAlign?: TimePickerPropLabelAlign;
40
54
  /** Addon placed before the children. */
41
55
  startAddon?: ReactNode;
42
56
  /** Addon placed after the children. */
@@ -0,0 +1,7 @@
1
+ import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
2
+ const timePickerPropLabelPlacement = formControlPropLabelPlacement;
3
+ const timePickerPropLabelAlign = formControlPropLabelAlign;
4
+ export {
5
+ timePickerPropLabelAlign,
6
+ timePickerPropLabelPlacement
7
+ };
@@ -1,5 +1,5 @@
1
1
  import { type SwitchProps } from '@koobiq/react-primitives';
2
- export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<Omit<SwitchProps, "inputRef">, "children" | "style" | "className" | "size" | "slotProps" | "labelPlacement" | keyof {
2
+ export declare const Toggle: import("react").ForwardRefExoticComponent<Omit<Omit<SwitchProps, "inputRef">, "children" | "style" | "className" | "size" | "labelPlacement" | "slotProps" | keyof {
3
3
  disabled?: boolean;
4
4
  error?: boolean;
5
5
  checked?: boolean;
@@ -25,11 +25,11 @@ const Toggle = forwardRef(
25
25
  className,
26
26
  ...other
27
27
  } = props;
28
- const isDisabled = isDisabledProp ?? disabled ?? false;
28
+ const isDisabled = isDisabledProp ?? disabled;
29
29
  const isSelected = isSelectedProp ?? checked;
30
- const isInvalid = isInvalidProp ?? error ?? false;
30
+ const isInvalid = isInvalidProp ?? error;
31
31
  const defaultSelected = defaultSelectedProp ?? defaultChecked;
32
- const isReadOnly = isReadOnlyProp ?? readonly ?? false;
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
  */
@@ -1,4 +1,4 @@
1
- export declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<import("@react-types/tooltip").TooltipTriggerProps, "children" | "className" | "id" | "offset" | "variant" | `data-${string}` | "placement" | "control" | "portalContainer" | "anchorRef" | "hideArrow" | "arrowBoundaryOffset" | "crossOffset" | "delay" | "closeDelay" | keyof {
1
+ export declare const Tooltip: import("react").ForwardRefExoticComponent<Omit<import("@react-types/tooltip").TooltipTriggerProps, "children" | "className" | "id" | "offset" | `data-${string}` | "variant" | "placement" | "control" | "portalContainer" | "anchorRef" | "hideArrow" | "arrowBoundaryOffset" | "crossOffset" | "delay" | "closeDelay" | keyof {
2
2
  open?: boolean;
3
3
  disabled?: boolean;
4
4
  }> & {
@@ -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
- closeDelay = 120,
18
- hideArrow = false,
19
- variant = "contrast",
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 ?? false;
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(
@@ -11,14 +11,12 @@ export type TooltipPropPlacement = (typeof tooltipPropPlacement)[number];
11
11
  type TooltipDeprecatedProps = {
12
12
  /**
13
13
  * If `true`, the component is shown.
14
- * @default false
15
14
  * @deprecated
16
15
  * The "open" prop is deprecated. Use "isOpen" prop to replace it.
17
16
  */
18
17
  open?: boolean;
19
18
  /**
20
19
  * If `true`, the component is disabled.
21
- * @deprecated
22
20
  * The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
23
21
  */
24
22
  disabled?: boolean;
@@ -59,7 +57,6 @@ export type TooltipProps = ExtendableProps<{
59
57
  crossOffset?: number;
60
58
  /**
61
59
  * If `true`, the arrow isn't shown.
62
- * @default false
63
60
  */
64
61
  hideArrow?: boolean;
65
62
  /**
@@ -1,6 +1,8 @@
1
1
  export * from './Provider';
2
2
  export * from './FlexBox';
3
3
  export * from './Container';
4
+ export * from './FormControl';
5
+ export * from './FormControlLabel';
4
6
  export * from './Alert';
5
7
  export * from './Button';
6
8
  export * from './IconButton';