@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
@@ -12,7 +12,7 @@ const Alert = polymorphicForwardRef(
12
12
  const {
13
13
  status = "info",
14
14
  as: Tag = "div",
15
- hideIcon = false,
15
+ hideIcon,
16
16
  colored,
17
17
  compact,
18
18
  isColored: isColoredProp,
@@ -26,8 +26,8 @@ const Alert = polymorphicForwardRef(
26
26
  children,
27
27
  ...other
28
28
  } = props;
29
- const isColored = isColoredProp ?? colored ?? false;
30
- const isCompact = isCompactProp ?? compact ?? false;
29
+ const isColored = isColoredProp ?? colored;
30
+ const isCompact = isCompactProp ?? compact;
31
31
  if (process.env.NODE_ENV !== "production" && "colored" in props) {
32
32
  deprecate(
33
33
  'Alert: the "colored" prop is deprecated. Use "isColored" prop to replace it.'
@@ -66,6 +66,8 @@ const Alert = polymorphicForwardRef(
66
66
  Tag,
67
67
  {
68
68
  role: "alert",
69
+ "data-colored": isColored || void 0,
70
+ "data-compact": isCompact || void 0,
69
71
  ...other,
70
72
  ref,
71
73
  className: clsx(
@@ -24,19 +24,16 @@ export type AlertBaseProps = {
24
24
  status?: AlertPropStatus;
25
25
  /**
26
26
  * If `true`, compact mode will be enabled in the alert.
27
- * @default false
28
27
  */
29
28
  isCompact?: boolean;
30
29
  /**
31
30
  * If `true`, background color will be enabled in the alert.
32
- * @default false
33
31
  */
34
32
  isColored?: boolean;
35
33
  /** Additional CSS-classes. */
36
34
  className?: string;
37
35
  /**
38
36
  * If `true`, the status icon will be hidden in the component.
39
- * @default false
40
37
  */
41
38
  hideIcon?: boolean;
42
39
  /** Title content. */
@@ -18,7 +18,7 @@ const Backdrop = polymorphicForwardRef(
18
18
  className,
19
19
  ...other
20
20
  } = props;
21
- const isOpen = isOpenProp ?? open ?? false;
21
+ const isOpen = isOpenProp ?? open;
22
22
  const domRef = useDOMRef(ref);
23
23
  if (process.env.NODE_ENV !== "production" && "open" in props) {
24
24
  deprecate(
@@ -16,7 +16,10 @@ export type BackdropBaseProps = {
16
16
  children?: ReactNode;
17
17
  /** Inline styles. */
18
18
  style?: CSSProperties;
19
- /** The duration of the transition, in milliseconds. */
19
+ /**
20
+ * The duration of the transition, in milliseconds.
21
+ * @default 300
22
+ */
20
23
  duration?: number;
21
24
  /** z-index. */
22
25
  zIndex?: CSSProperties['zIndex'];
@@ -9,8 +9,8 @@ const Button = polymorphicForwardRef(
9
9
  const {
10
10
  as: Tag = "button",
11
11
  variant = "contrast-filled",
12
- onlyIcon = false,
13
- fullWidth = false,
12
+ onlyIcon,
13
+ fullWidth,
14
14
  isLoading: isLoadingProp,
15
15
  isDisabled: isDisabledProp,
16
16
  progress,
@@ -21,8 +21,8 @@ const Button = polymorphicForwardRef(
21
21
  className,
22
22
  ...other
23
23
  } = props;
24
- const isLoading = isLoadingProp ?? progress ?? false;
25
- const isDisabled = isDisabledProp ?? disabled ?? false;
24
+ const isLoading = isLoadingProp ?? progress;
25
+ const isDisabled = isDisabledProp ?? disabled;
26
26
  if (process.env.NODE_ENV !== "production" && "progress" in props) {
27
27
  deprecate(
28
28
  'Button: the "progress" prop is deprecated. Use "isLoading" prop to replace it.'
@@ -60,9 +60,9 @@ const Button = polymorphicForwardRef(
60
60
  isDisabled,
61
61
  className: classNameFn,
62
62
  "data-variant": variant,
63
- "data-loading": isLoading,
64
- "data-fullwidth": fullWidth,
65
- "data-onlyicon": iconOnly,
63
+ "data-loading": isLoading || void 0,
64
+ "data-fullwidth": fullWidth || void 0,
65
+ "data-onlyicon": iconOnly || void 0,
66
66
  ...other,
67
67
  ref,
68
68
  children: [
@@ -6,14 +6,12 @@ export type ButtonPropVariant = (typeof buttonPropVariant)[number];
6
6
  type ButtonDeprecatedProps = {
7
7
  /**
8
8
  * If `true`, the progress indicator is shown and the button becomes disabled.
9
- * @default false
10
9
  * @deprecated
11
10
  * The "progress" prop is deprecated. Use "isLoading" prop to replace it.
12
11
  */
13
12
  progress?: boolean;
14
13
  /**
15
14
  * If `true`, the component is disabled.
16
- * @default false
17
15
  * @deprecated
18
16
  * The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
19
17
  */
@@ -29,7 +27,6 @@ export type ButtonBaseProps = ExtendableProps<{
29
27
  variant?: ButtonPropVariant;
30
28
  /**
31
29
  * If `true`, only the icon is shown, and the button has same sides.
32
- * @default false
33
30
  */
34
31
  onlyIcon?: boolean;
35
32
  /** Additional CSS-classes. */
@@ -38,7 +35,6 @@ export type ButtonBaseProps = ExtendableProps<{
38
35
  style?: CSSProperties;
39
36
  /**
40
37
  * If `true`, the button will take up the full width of its container.
41
- * @default false
42
38
  */
43
39
  fullWidth?: boolean;
44
40
  /** Icon placed before the children. */
@@ -12,9 +12,9 @@ import { getSelectedToggleButton, getToggleButtonStyle } from "./utils.js";
12
12
  const MAX_ITEMS = 5;
13
13
  const ButtonToggleGroup = forwardRef((props, ref) => {
14
14
  const {
15
- fullWidth = false,
16
- isDisabled = false,
17
- hasEqualItemSize = false,
15
+ fullWidth,
16
+ isDisabled,
17
+ hasEqualItemSize,
18
18
  style,
19
19
  className,
20
20
  slotProps,
@@ -81,9 +81,9 @@ const ButtonToggleGroup = forwardRef((props, ref) => {
81
81
  hasEqualItemSize && s.hasEqualItemSize,
82
82
  className
83
83
  ),
84
- "data-fullwidth": fullWidth,
85
- "data-animated": isAnimated,
86
- "data-equal-item-size": hasEqualItemSize,
84
+ "data-fullwidth": fullWidth || void 0,
85
+ "data-animated": isAnimated || void 0,
86
+ "data-equal-item-size": hasEqualItemSize || void 0,
87
87
  ref: domRef,
88
88
  style
89
89
  },
@@ -11,7 +11,7 @@ const textNormalMedium = utilClasses.typography["text-normal-medium"];
11
11
  const ButtonToggle = forwardRef(
12
12
  (props, ref) => {
13
13
  const {
14
- isDisabled: isDisabledProp = false,
14
+ isDisabled: isDisabledProp,
15
15
  children,
16
16
  id,
17
17
  icon,
@@ -53,11 +53,11 @@ const ButtonToggle = forwardRef(
53
53
  isFocusVisible && s.focusVisible,
54
54
  className
55
55
  ),
56
- "data-hovered": isHovered,
57
- "data-pressed": isPressed,
58
- "data-selected": isSelected,
59
- "data-disabled": isDisabled,
60
- "data-focus-visible": isFocusVisible,
56
+ "data-hovered": isHovered || void 0,
57
+ "data-pressed": isPressed || void 0,
58
+ "data-selected": isSelected || void 0,
59
+ "data-disabled": isDisabled || void 0,
60
+ "data-focus-visible": isFocusVisible || void 0,
61
61
  ref: rootRef
62
62
  },
63
63
  controlProps,
@@ -9,7 +9,6 @@ export type ButtonToggleProps = ExtendableComponentPropsWithRef<{
9
9
  icon?: ReactNode;
10
10
  /**
11
11
  * If `true`, the component is disabled.
12
- * @default false
13
12
  */
14
13
  isDisabled?: boolean;
15
14
  /** Additional CSS-classes. */
@@ -5,19 +5,16 @@ export type ButtonToggleGroupKey = string | number;
5
5
  export type ButtonToggleGroupBaseProps = {
6
6
  /**
7
7
  * Whether all items are disabled.
8
- * @default false
9
8
  */
10
9
  isDisabled?: boolean;
11
10
  /**
12
11
  * If `true`, the button will take up the full width of its container.
13
- * @default false
14
12
  */
15
13
  fullWidth?: boolean;
16
14
  /** The contents of the collection. */
17
15
  children?: Array<ReactElement<ButtonToggleProps>>;
18
16
  /**
19
17
  * If `true`, each item's width will be equal.
20
- * @default false
21
18
  */
22
19
  hasEqualItemSize?: boolean;
23
20
  /** The currently selected key in the collection (controlled). */
@@ -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" | "slotProps" | "data-testid" | "labelPlacement" | keyof {
2
+ export declare const Checkbox: import("react").ForwardRefExoticComponent<Omit<Omit<CheckboxPropsPrimitive, "validationState" | "inputRef">, "children" | "style" | "className" | "size" | "labelPlacement" | "slotProps" | "data-testid" | keyof {
3
3
  disabled?: boolean;
4
4
  error?: boolean;
5
5
  checked?: boolean;
@@ -31,13 +31,13 @@ const Checkbox = forwardRef(
31
31
  slotProps,
32
32
  ...other
33
33
  } = props;
34
- const isDisabled = isDisabledProp ?? disabled ?? false;
35
- const isInvalid = isInvalidProp ?? error ?? false;
34
+ const isDisabled = isDisabledProp ?? disabled;
35
+ const isInvalid = isInvalidProp ?? error;
36
36
  const isSelected = isSelectedProp ?? checked;
37
37
  const defaultSelected = defaultSelectedProp ?? defaultChecked;
38
- const isReadOnly = isReadOnlyProp ?? readonly ?? false;
39
- const isRequired = isRequiredProp ?? required ?? false;
40
- const isIndeterminate = isIndeterminateProp ?? indeterminate ?? false;
38
+ const isReadOnly = isReadOnlyProp ?? readonly;
39
+ const isRequired = isRequiredProp ?? required;
40
+ const isIndeterminate = isIndeterminateProp ?? indeterminate;
41
41
  const commonProps = {
42
42
  isIndeterminate,
43
43
  isDisabled,
@@ -108,7 +108,7 @@ const Checkbox = forwardRef(
108
108
  Checkbox$1,
109
109
  {
110
110
  "data-size": size,
111
- "data-indeterminate": isIndeterminate,
111
+ "data-indeterminate": isIndeterminate || void 0,
112
112
  "data-label-placement": labelPlacement,
113
113
  ...commonProps,
114
114
  ref,
@@ -9,14 +9,12 @@ export type CheckboxPropOnChange = (selected: boolean) => void;
9
9
  type CheckboxDeprecatedProps = {
10
10
  /**
11
11
  * If `true`, the component is disabled.
12
- * @default false
13
12
  * @deprecated
14
13
  * The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
15
14
  */
16
15
  disabled?: boolean;
17
16
  /**
18
17
  * If `true`, the component will indicate an error.
19
- * @default false
20
18
  * @deprecated
21
19
  * The "error" prop is deprecated. Use "isInvalid" prop to replace it.
22
20
  */
@@ -29,21 +27,18 @@ type CheckboxDeprecatedProps = {
29
27
  checked?: boolean;
30
28
  /**
31
29
  * It prevents the user from changing the value of the checkbox.
32
- * @default false
33
30
  * @deprecated
34
31
  * The "readonly" prop is deprecated. Use "isReadonly" prop to replace it.
35
32
  */
36
33
  readonly?: boolean;
37
34
  /**
38
35
  * If `true`, the input element is required.
39
- * @default false
40
36
  * @deprecated
41
37
  * The "required" prop is deprecated. Use "isRequired" prop to replace it.
42
38
  */
43
39
  required?: boolean;
44
40
  /**
45
41
  * If `true`, the component appears indeterminate.
46
- * @default false
47
42
  * @deprecated
48
43
  * The "indeterminate" prop is deprecated. Use "isIndeterminate" prop to replace it.
49
44
  */
@@ -20,7 +20,7 @@ const Container = polymorphicForwardRef(
20
20
  style: styleProp,
21
21
  ...other
22
22
  } = props;
23
- const isFixed = isFixedProp ?? fixed ?? false;
23
+ const isFixed = isFixedProp ?? fixed;
24
24
  if (process.env.NODE_ENV !== "production" && "fixed" in props) {
25
25
  deprecate(
26
26
  'Container: the "fixed" prop is deprecated. Use "isFixed" prop to replace it.'
@@ -39,7 +39,7 @@ const Container = polymorphicForwardRef(
39
39
  return /* @__PURE__ */ jsx(
40
40
  Tag,
41
41
  {
42
- "data-fixed": isFixed,
42
+ "data-fixed": isFixed || void 0,
43
43
  "data-margins": margins,
44
44
  "data-position": position,
45
45
  className: clsx(s.base, className),
@@ -8,7 +8,6 @@ export type ContainerPositionProp = (typeof containerPositionProp)[number];
8
8
  type ContainerDeprecatedProps = {
9
9
  /**
10
10
  * If `true`, doesn't set the max-inline-size of the container.
11
- * @default false
12
11
  * @deprecated
13
12
  * The "fixed" prop is deprecated. Use "isFixed" prop to replace it.
14
13
  */
@@ -29,7 +28,6 @@ export type ContainerBaseProps = {
29
28
  margins?: ContainerMarginsProp | ResponsiveValue<ContainerMarginsProp>;
30
29
  /**
31
30
  * If `true`, doesn't set the max-inline-size of the container.
32
- * @default false
33
31
  */
34
32
  isFixed?: boolean;
35
33
  /** The content of the component. */
@@ -3,25 +3,28 @@ import { jsxs, jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
4
  import { createCalendar } from "@internationalized/date";
5
5
  import { useLocale, useDOMRef, mergeProps, clsx } from "@koobiq/react-core";
6
- import { useDateFieldState, removeDataAttributes, useDateField } from "@koobiq/react-primitives";
6
+ import { useDateFieldState, removeDataAttributes, useDateField, FieldErrorContext } from "@koobiq/react-primitives";
7
7
  import s from "./DateInput.module.css.js";
8
8
  import { FieldInputDate } from "../FieldComponents/FieldInputDate/FieldInputDate.js";
9
9
  import { DateSegment } from "../DateSegment/DateSegment.js";
10
- import { FieldControl } from "../FieldComponents/FieldControl/FieldControl.js";
11
- import { FieldLabel } from "../FieldComponents/FieldLabel/FieldLabel.js";
10
+ import { FormControl } from "../FormControl/FormControl.js";
11
+ import { FormControlLabel } from "../FormControlLabel/FormControlLabel.js";
12
+ import { Field } from "../FieldComponents/Field/Field.js";
12
13
  import { FieldContentGroup } from "../FieldComponents/FieldContentGroup/FieldContentGroup.js";
13
14
  import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
14
15
  import { FieldError } from "../FieldComponents/FieldError/FieldError.js";
15
16
  function DateInputRender(props, ref) {
16
- const { errorMessage } = props;
17
17
  const { locale } = useLocale();
18
18
  const {
19
19
  variant = "filled",
20
20
  slotProps,
21
21
  caption,
22
22
  startAddon,
23
+ errorMessage,
23
24
  endAddon,
24
25
  isLabelHidden,
26
+ labelPlacement,
27
+ labelAlign,
25
28
  label,
26
29
  className,
27
30
  style,
@@ -40,20 +43,23 @@ function DateInputRender(props, ref) {
40
43
  fieldProps,
41
44
  descriptionProps,
42
45
  errorMessageProps,
46
+ inputProps,
43
47
  ...validation
44
48
  } = useDateField({ ...removeDataAttributes(props) }, state, domRef);
45
- const { isInvalid, isRequired, isDisabled } = state;
49
+ const { isRequired, isDisabled } = state;
50
+ const { isInvalid } = validation;
46
51
  const rootProps = mergeProps(
47
52
  {
48
53
  style,
49
54
  fullWidth,
55
+ labelPlacement,
56
+ labelAlign,
50
57
  "data-testid": testId,
51
58
  "data-variant": variant,
52
- "data-invalid": isInvalid,
53
- "data-disabled": isDisabled,
54
- "data-fullwidth": fullWidth,
55
- "data-required": isRequired,
56
- "data-readonly": isReadOnly,
59
+ "data-invalid": isInvalid || void 0,
60
+ "data-disabled": isDisabled || void 0,
61
+ "data-required": isRequired || void 0,
62
+ "data-readonly": isReadOnly || void 0,
57
63
  className: clsx(s.base, className)
58
64
  },
59
65
  slotProps?.root
@@ -76,8 +82,7 @@ function DateInputRender(props, ref) {
76
82
  const captionProps = mergeProps({ children: caption }, slotProps?.caption, descriptionProps);
77
83
  const errorProps = mergeProps(
78
84
  {
79
- isInvalid,
80
- children: typeof errorMessage === "function" ? errorMessage({ ...validation }) : errorMessage
85
+ children: errorMessage
81
86
  },
82
87
  slotProps?.errorMessage,
83
88
  errorMessageProps
@@ -92,11 +97,16 @@ function DateInputRender(props, ref) {
92
97
  slotProps?.inputDate,
93
98
  fieldProps
94
99
  );
95
- return /* @__PURE__ */ jsxs(FieldControl, { ...rootProps, children: [
96
- /* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
97
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInputDate, { ...controlProps, children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)) }) }),
98
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
99
- /* @__PURE__ */ jsx(FieldError, { ...errorProps })
100
+ return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
101
+ /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
102
+ /* @__PURE__ */ jsxs(Field, { children: [
103
+ /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsxs(FieldInputDate, { ...controlProps, children: [
104
+ state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)),
105
+ /* @__PURE__ */ jsx("input", { ...inputProps })
106
+ ] }) }),
107
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
108
+ /* @__PURE__ */ jsx(FieldErrorContext.Provider, { value: validation, children: /* @__PURE__ */ jsx(FieldError, { ...errorProps }) })
109
+ ] })
100
110
  ] });
101
111
  }
102
112
  const DateInput = forwardRef(DateInputRender);
@@ -1,8 +1,14 @@
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 FieldControlProps, type FieldErrorProps, type FieldInputDateProps, type FieldContentGroupProps, type FieldLabelProps, type FieldContentGroupPropVariant } from '../FieldComponents';
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';
4
6
  export declare const dateInputPropVariant: readonly ["filled", "transparent"];
5
7
  export type DateInputPropVariant = FieldContentGroupPropVariant;
8
+ export declare const dateInputPropLabelPlacement: readonly ["top", "side"];
9
+ export type DateInputPropLabelPlacement = FormControlPropLabelPlacement;
10
+ export declare const dateInputPropLabelAlign: readonly ["start", "end"];
11
+ export type DateInputPropLabelAlign = FormControlPropLabelAlign;
6
12
  export type DateInputProps<T extends DateValue> = {
7
13
  /** Inline styles. */
8
14
  style?: CSSProperties;
@@ -19,13 +25,12 @@ export type DateInputProps<T extends DateValue> = {
19
25
  variant?: DateInputPropVariant;
20
26
  /**
21
27
  * If true, the input will take up the full width of its container.
22
- * @default false
23
28
  */
24
29
  fullWidth?: boolean;
25
30
  /** The props used for each slot inside. */
26
31
  slotProps?: {
27
- root?: FieldControlProps;
28
- label?: FieldLabelProps;
32
+ root?: FormControlProps;
33
+ label?: FormControlLabelProps;
29
34
  group?: FieldContentGroupProps;
30
35
  caption?: FieldCaptionProps;
31
36
  inputDate?: FieldInputDateProps;
@@ -35,13 +40,22 @@ export type DateInputProps<T extends DateValue> = {
35
40
  ref?: Ref<HTMLDivElement>;
36
41
  /**
37
42
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
38
- * @default false
39
43
  */
40
44
  isLabelHidden?: boolean;
45
+ /**
46
+ * The label's overall position relative to the element it is labeling.
47
+ * @default 'top'
48
+ */
49
+ labelPlacement?: DateInputPropLabelPlacement;
50
+ /**
51
+ * The label's horizontal alignment relative to the element it is labeling.
52
+ * @default 'start'
53
+ */
54
+ labelAlign?: DateInputPropLabelAlign;
41
55
  /** Addon placed before the children. */
42
56
  startAddon?: ReactNode;
43
57
  /** Addon placed after the children. */
44
58
  endAddon?: ReactNode;
45
- } & Omit<AriaDateFieldProps<T>, 'description' | 'validationBehavior' | 'validate' | 'validationState'>;
59
+ } & Omit<AriaDateFieldProps<T>, 'description' | 'validationState'>;
46
60
  export type DateInputComponent = <T extends DateValue>(props: DateInputProps<T>) => ReactElement | null;
47
61
  export type DateInputRef = ComponentRef<'div'>;
@@ -1,5 +1,10 @@
1
1
  import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
2
+ import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
2
3
  const dateInputPropVariant = fieldContentGroupPropVariant;
4
+ const dateInputPropLabelPlacement = formControlPropLabelPlacement;
5
+ const dateInputPropLabelAlign = formControlPropLabelAlign;
3
6
  export {
7
+ dateInputPropLabelAlign,
8
+ dateInputPropLabelPlacement,
4
9
  dateInputPropVariant
5
10
  };
@@ -19,6 +19,8 @@ function DatePickerRender(props, ref) {
19
19
  slotProps,
20
20
  fullWidth,
21
21
  errorMessage,
22
+ labelPlacement,
23
+ labelAlign,
22
24
  startAddon,
23
25
  endAddon,
24
26
  "data-testid": testId
@@ -48,10 +50,12 @@ function DatePickerRender(props, ref) {
48
50
  fullWidth,
49
51
  className,
50
52
  startAddon,
53
+ labelPlacement,
54
+ labelAlign,
51
55
  errorMessage,
52
56
  "data-testid": testId,
53
57
  slotProps: {
54
- label: labelProps,
58
+ label: mergeProps(labelProps, slotProps?.label),
55
59
  group: {
56
60
  endAddon: /* @__PURE__ */ jsxs(Fragment, { children: [
57
61
  endAddon,
@@ -1,12 +1,12 @@
1
1
  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
- import type { DateInputProps, DateInputRef } from '../DateInput';
4
+ import type { DateInputPropLabelAlign, DateInputPropLabelPlacement, DateInputProps, DateInputRef } from '../DateInput';
5
+ import type { FormControlLabelProps } from '../FormControlLabel';
5
6
  import type { PopoverProps } from '../Popover';
6
7
  export type DatePickerProps<T extends DateValue> = {
7
8
  /**
8
9
  * If true, the input will take up the full width of its container.
9
- * @default false
10
10
  */
11
11
  fullWidth?: boolean;
12
12
  /** The helper text content. */
@@ -21,14 +21,25 @@ export type DatePickerProps<T extends DateValue> = {
21
21
  style?: CSSProperties;
22
22
  /** Unique identifier for testing purposes. */
23
23
  'data-testid'?: string | number;
24
+ /**
25
+ * The label's overall position relative to the element it is labeling.
26
+ * @default 'top'
27
+ */
28
+ labelPlacement?: DateInputPropLabelPlacement;
29
+ /**
30
+ * The label's horizontal alignment relative to the element it is labeling.
31
+ * @default 'start'
32
+ */
33
+ labelAlign?: DateInputPropLabelAlign;
24
34
  /** Ref to the DateInput. */
25
35
  ref?: Ref<DateInputRef>;
26
36
  /** The props used for each slot inside. */
27
37
  slotProps?: {
28
38
  root?: DateInputProps<T>;
39
+ label?: FormControlLabelProps;
29
40
  popover?: PopoverProps;
30
41
  calendar?: CalendarProps<T>;
31
42
  };
32
- } & Omit<AriaDatePickerProps<T>, 'description' | 'validate' | 'validationBehavior' | 'validationState'>;
43
+ } & Omit<AriaDatePickerProps<T>, 'description' | 'validationState'>;
33
44
  export type DatePickerComponent = <T extends DateValue>(props: DatePickerProps<T>) => ReactElement | null;
34
45
  export type DatePickerRef = DateInputRef;
@@ -19,7 +19,7 @@ const DialogComponent = forwardRef(
19
19
  const rootProps = mergeProps(
20
20
  {
21
21
  className: clsx(s.base, utilClasses.typography["text-normal"]),
22
- "data-close-button": showCloseButton,
22
+ "data-close-button": showCloseButton || void 0,
23
23
  "data-top-overflow": topOverflow,
24
24
  "data-bottom-overflow": bottomOverflow
25
25
  },
@@ -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" | "isDisabled" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange" | "preventFocusOnPress" | "excludeFromTabOrder" | keyof import("@react-types/shared").HoverEvents | "isLoading" | "variant" | "onlyIcon" | "fullWidth" | "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" | "fullWidth" | "isDisabled" | "onPress" | "onPressStart" | "onPressEnd" | "onPressChange" | "onPressUp" | "onFocusChange" | "preventFocusOnPress" | "excludeFromTabOrder" | keyof import("@react-types/shared").HoverEvents | "isLoading" | "variant" | "onlyIcon" | "startIcon" | "endIcon" | "data-testid" | keyof {
8
8
  progress?: boolean;
9
9
  disabled?: boolean;
10
- }> & Omit<Omit<import("@koobiq/react-primitives").ButtonBaseProps, "slot">, "children" | "style" | "className" | "variant" | "onlyIcon" | "fullWidth" | "startIcon" | "endIcon" | "data-testid" | keyof {
10
+ }> & Omit<Omit<import("@koobiq/react-primitives").ButtonBaseProps, "slot">, "children" | "style" | "className" | "fullWidth" | "variant" | "onlyIcon" | "startIcon" | "endIcon" | "data-testid" | keyof {
11
11
  progress?: boolean;
12
12
  disabled?: boolean;
13
13
  }> & {
@@ -13,7 +13,6 @@ export type DialogBaseProps = {
13
13
  onClose?(): void;
14
14
  /**
15
15
  * If `true`, the close button isn't shown.
16
- * @default false
17
16
  */
18
17
  hideCloseButton?: boolean;
19
18
  /** The props used for each slot inside. */
@@ -8,8 +8,8 @@ const Divider = polymorphicForwardRef(
8
8
  const {
9
9
  as: Tag = "div",
10
10
  orientation = "horizontal",
11
- disablePaddings = false,
12
- flexItem = false,
11
+ disablePaddings,
12
+ flexItem,
13
13
  display,
14
14
  className,
15
15
  ...other
@@ -23,9 +23,10 @@ const Divider = polymorphicForwardRef(
23
23
  return /* @__PURE__ */ jsx(
24
24
  Tag,
25
25
  {
26
- "data-flex-item": flexItem,
26
+ "data-display": display,
27
27
  "data-orientation": orientation,
28
- "data-disable-paddings": disablePaddings,
28
+ "data-flex-item": flexItem || void 0,
29
+ "data-disable-paddings": disablePaddings || void 0,
29
30
  ...separatorProps,
30
31
  className: clsx(
31
32
  s.base,
@@ -11,12 +11,10 @@ export type DividerBaseProps = ExtendableProps<{
11
11
  * Indicates if the divider is a child of a flex container.
12
12
  * Mainly used for vertical layout.
13
13
  * Used when the block does not have a fixed height.
14
- * @default false
15
14
  */
16
15
  flexItem?: boolean;
17
16
  /**
18
17
  * If `true`, it disables the default paddings.
19
- * @default false
20
18
  */
21
19
  disablePaddings?: boolean;
22
20
  }, Omit<SeparatorProps, 'elementType'>>;
@@ -0,0 +1,4 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ import type { FieldBaseProps } from './types';
3
+ export declare const Field: import("@koobiq/react-core").PolyForwardComponent<"div", FieldBaseProps, ElementType>;
4
+ export type FieldProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof Field<As>>;