@koobiq/react-components 0.7.0 → 0.8.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 (75) hide show
  1. package/dist/components/Checkbox/Checkbox.d.ts +1 -1
  2. package/dist/components/DateInput/DateInput.js +14 -8
  3. package/dist/components/DateInput/types.d.ts +19 -3
  4. package/dist/components/DateInput/types.js +5 -0
  5. package/dist/components/DatePicker/DatePicker.js +5 -1
  6. package/dist/components/DatePicker/types.d.ts +13 -1
  7. package/dist/components/Dialog/components/DialogCloseButton.d.ts +2 -2
  8. package/dist/components/FieldComponents/Field/Field.d.ts +4 -0
  9. package/dist/components/FieldComponents/Field/Field.js +10 -0
  10. package/dist/components/FieldComponents/Field/Field.module.css.js +8 -0
  11. package/dist/components/FieldComponents/Field/index.d.ts +2 -0
  12. package/dist/components/FieldComponents/Field/types.d.ts +4 -0
  13. package/dist/components/FieldComponents/index.d.ts +1 -2
  14. package/dist/components/FormControl/FormControl.d.ts +4 -0
  15. package/dist/components/FormControl/FormControl.js +33 -0
  16. package/dist/components/FormControl/FormControl.module.css.js +17 -0
  17. package/dist/components/FormControl/index.d.ts +2 -0
  18. package/dist/components/FormControl/types.d.ts +19 -0
  19. package/dist/components/FormControl/types.js +6 -0
  20. package/dist/components/FormControlLabel/FormControlLabel.d.ts +4 -2
  21. package/dist/components/FormControlLabel/FormControlLabel.js +33 -0
  22. package/dist/components/FormControlLabel/FormControlLabel.module.css.js +14 -0
  23. package/dist/components/FormControlLabel/types.d.ts +6 -31
  24. package/dist/components/Input/Input.d.ts +8 -4
  25. package/dist/components/Input/Input.js +14 -8
  26. package/dist/components/Input/types.d.ts +19 -3
  27. package/dist/components/Input/types.js +5 -0
  28. package/dist/components/InputNumber/InputNumber.d.ts +8 -4
  29. package/dist/components/InputNumber/InputNumber.js +14 -8
  30. package/dist/components/InputNumber/types.d.ts +19 -3
  31. package/dist/components/InputNumber/types.js +5 -0
  32. package/dist/components/List/components/ListSection/ListSection.js +1 -1
  33. package/dist/components/RadioGroup/RadioGroup.js +71 -18
  34. package/dist/components/RadioGroup/RadioGroup.module.css.js +8 -0
  35. package/dist/components/RadioGroup/components/Radio/Radio.d.ts +1 -1
  36. package/dist/components/RadioGroup/components/index.d.ts +0 -2
  37. package/dist/components/RadioGroup/types.d.ts +40 -5
  38. package/dist/components/RadioGroup/types.js +5 -0
  39. package/dist/components/SearchInput/SearchInput.d.ts +8 -4
  40. package/dist/components/SearchInput/SearchInput.js +14 -8
  41. package/dist/components/SearchInput/types.d.ts +19 -3
  42. package/dist/components/SearchInput/types.js +5 -0
  43. package/dist/components/Select/Select.js +20 -13
  44. package/dist/components/Select/Select.module.css.js +0 -6
  45. package/dist/components/Select/types.d.ts +18 -2
  46. package/dist/components/Select/types.js +5 -0
  47. package/dist/components/Textarea/Textarea.d.ts +5 -2
  48. package/dist/components/Textarea/Textarea.js +7 -4
  49. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +1 -1
  50. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +9 -9
  51. package/dist/components/Textarea/types.d.ts +21 -3
  52. package/dist/components/Textarea/types.js +5 -0
  53. package/dist/components/TimePicker/TimePicker.js +21 -15
  54. package/dist/components/TimePicker/types.d.ts +19 -3
  55. package/dist/components/TimePicker/types.js +7 -0
  56. package/dist/components/Toggle/Toggle.d.ts +1 -1
  57. package/dist/components/Tooltip/Tooltip.d.ts +1 -1
  58. package/dist/components/index.d.ts +2 -0
  59. package/dist/index.js +31 -11
  60. package/dist/style.css +96 -80
  61. package/package.json +5 -5
  62. package/dist/components/FieldComponents/FieldControl/FieldControl.d.ts +0 -8
  63. package/dist/components/FieldComponents/FieldControl/FieldControl.js +0 -17
  64. package/dist/components/FieldComponents/FieldControl/FieldControl.module.css.js +0 -11
  65. package/dist/components/FieldComponents/FieldControl/index.d.ts +0 -1
  66. package/dist/components/FieldComponents/FieldLabel/FieldLabel.d.ts +0 -9
  67. package/dist/components/FieldComponents/FieldLabel/FieldLabel.js +0 -24
  68. package/dist/components/FieldComponents/FieldLabel/FieldLabel.module.css.js +0 -14
  69. package/dist/components/FieldComponents/FieldLabel/index.d.ts +0 -1
  70. package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.d.ts +0 -7
  71. package/dist/components/RadioGroup/components/RadioGroupDescription/RadioGroupDescription.js +0 -21
  72. package/dist/components/RadioGroup/components/RadioGroupDescription/index.d.ts +0 -1
  73. package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.d.ts +0 -6
  74. package/dist/components/RadioGroup/components/RadioGroupLabel/RadioGroupLabel.js +0 -14
  75. package/dist/components/RadioGroup/components/RadioGroupLabel/index.d.ts +0 -1
@@ -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;
@@ -7,8 +7,9 @@ import { useDateFieldState, removeDataAttributes, useDateField } from "@koobiq/r
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";
@@ -22,6 +23,8 @@ function DateInputRender(props, ref) {
22
23
  startAddon,
23
24
  endAddon,
24
25
  isLabelHidden,
26
+ labelPlacement,
27
+ labelAlign,
25
28
  label,
26
29
  className,
27
30
  style,
@@ -47,11 +50,12 @@ function DateInputRender(props, ref) {
47
50
  {
48
51
  style,
49
52
  fullWidth,
53
+ labelPlacement,
54
+ labelAlign,
50
55
  "data-testid": testId,
51
56
  "data-variant": variant,
52
57
  "data-invalid": isInvalid,
53
58
  "data-disabled": isDisabled,
54
- "data-fullwidth": fullWidth,
55
59
  "data-required": isRequired,
56
60
  "data-readonly": isReadOnly,
57
61
  className: clsx(s.base, className)
@@ -92,11 +96,13 @@ function DateInputRender(props, ref) {
92
96
  slotProps?.inputDate,
93
97
  fieldProps
94
98
  );
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 })
99
+ return /* @__PURE__ */ jsxs(FormControl, { ...rootProps, children: [
100
+ /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
101
+ /* @__PURE__ */ jsxs(Field, { children: [
102
+ /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInputDate, { ...controlProps, children: state.segments.map((segment, i) => /* @__PURE__ */ jsx(DateSegment, { segment, state }, i)) }) }),
103
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
104
+ /* @__PURE__ */ jsx(FieldError, { ...errorProps })
105
+ ] })
100
106
  ] });
101
107
  }
102
108
  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;
@@ -24,8 +30,8 @@ export type DateInputProps<T extends DateValue> = {
24
30
  fullWidth?: boolean;
25
31
  /** The props used for each slot inside. */
26
32
  slotProps?: {
27
- root?: FieldControlProps;
28
- label?: FieldLabelProps;
33
+ root?: FormControlProps;
34
+ label?: FormControlLabelProps;
29
35
  group?: FieldContentGroupProps;
30
36
  caption?: FieldCaptionProps;
31
37
  inputDate?: FieldInputDateProps;
@@ -38,6 +44,16 @@ export type DateInputProps<T extends DateValue> = {
38
44
  * @default false
39
45
  */
40
46
  isLabelHidden?: boolean;
47
+ /**
48
+ * The label's overall position relative to the element it is labeling.
49
+ * @default 'top'
50
+ */
51
+ labelPlacement?: DateInputPropLabelPlacement;
52
+ /**
53
+ * The label's horizontal alignment relative to the element it is labeling.
54
+ * @default 'start'
55
+ */
56
+ labelAlign?: DateInputPropLabelAlign;
41
57
  /** Addon placed before the children. */
42
58
  startAddon?: ReactNode;
43
59
  /** Addon placed after the children. */
@@ -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,7 +1,8 @@
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
  /**
@@ -21,11 +22,22 @@ export type DatePickerProps<T extends DateValue> = {
21
22
  style?: CSSProperties;
22
23
  /** Unique identifier for testing purposes. */
23
24
  'data-testid'?: string | number;
25
+ /**
26
+ * The label's overall position relative to the element it is labeling.
27
+ * @default 'top'
28
+ */
29
+ labelPlacement?: DateInputPropLabelPlacement;
30
+ /**
31
+ * The label's horizontal alignment relative to the element it is labeling.
32
+ * @default 'start'
33
+ */
34
+ labelAlign?: DateInputPropLabelAlign;
24
35
  /** Ref to the DateInput. */
25
36
  ref?: Ref<DateInputRef>;
26
37
  /** The props used for each slot inside. */
27
38
  slotProps?: {
28
39
  root?: DateInputProps<T>;
40
+ label?: FormControlLabelProps;
29
41
  popover?: PopoverProps;
30
42
  calendar?: CalendarProps<T>;
31
43
  };
@@ -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
  }> & {
@@ -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>>;
@@ -0,0 +1,10 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
3
+ import s from "./Field.module.css.js";
4
+ const Field = polymorphicForwardRef(
5
+ ({ as: Tag = "div", className, ...other }, ref) => /* @__PURE__ */ jsx(Tag, { className: clsx(s.base, className), ...other, ref })
6
+ );
7
+ Field.displayName = "Field";
8
+ export {
9
+ Field
10
+ };
@@ -0,0 +1,8 @@
1
+ const base = "kbq-field-25e8f8";
2
+ const s = {
3
+ base
4
+ };
5
+ export {
6
+ base,
7
+ s as default
8
+ };
@@ -0,0 +1,2 @@
1
+ export * from './Field';
2
+ export * from './types';
@@ -0,0 +1,4 @@
1
+ import type { DataAttributeProps } from '@koobiq/react-core';
2
+ export type FieldBaseProps = {
3
+ className?: string;
4
+ } & DataAttributeProps;
@@ -1,7 +1,6 @@
1
- export * from './FieldControl';
1
+ export * from './Field';
2
2
  export * from './FieldInput';
3
3
  export * from './FieldSelect';
4
- export * from './FieldLabel';
5
4
  export * from './FieldAddon';
6
5
  export * from './FieldCaption';
7
6
  export * from './FieldError';
@@ -0,0 +1,4 @@
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ import type { FormControlBaseProps } from './types';
3
+ export declare const FormControl: import("@koobiq/react-core").PolyForwardComponent<"div", FormControlBaseProps, ElementType>;
4
+ export type FormControlProps<As extends ElementType = 'div'> = ComponentPropsWithRef<typeof FormControl<As>>;
@@ -0,0 +1,33 @@
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
3
+ import s from "./FormControl.module.css.js";
4
+ const FormControl = polymorphicForwardRef(
5
+ ({
6
+ labelPlacement = "top",
7
+ labelAlign = "start",
8
+ fullWidth = false,
9
+ as: Tag = "div",
10
+ className,
11
+ ...other
12
+ }, ref) => /* @__PURE__ */ jsx(
13
+ Tag,
14
+ {
15
+ className: clsx(
16
+ s.base,
17
+ className,
18
+ s[labelAlign],
19
+ s[labelPlacement],
20
+ fullWidth && s.fullWidth
21
+ ),
22
+ "data-fullwidth": fullWidth,
23
+ "data-label-align": labelAlign,
24
+ "data-label-placement": labelPlacement,
25
+ ...other,
26
+ ref
27
+ }
28
+ )
29
+ );
30
+ FormControl.displayName = "FormControl";
31
+ export {
32
+ FormControl
33
+ };
@@ -0,0 +1,17 @@
1
+ const base = "kbq-formcontrol-dbb0e4";
2
+ const fullWidth = "kbq-formcontrol-fullWidth-b3e32c";
3
+ const top = "kbq-formcontrol-top-17ba41";
4
+ const side = "kbq-formcontrol-side-3e528f";
5
+ const s = {
6
+ base,
7
+ fullWidth,
8
+ top,
9
+ side
10
+ };
11
+ export {
12
+ base,
13
+ s as default,
14
+ fullWidth,
15
+ side,
16
+ top
17
+ };
@@ -0,0 +1,2 @@
1
+ export * from './FormControl';
2
+ export * from './types';
@@ -0,0 +1,19 @@
1
+ import type { DataAttributeProps } from '@koobiq/react-core';
2
+ export declare const formControlPropLabelPlacement: readonly ["top", "side"];
3
+ export type FormControlPropLabelPlacement = (typeof formControlPropLabelPlacement)[number];
4
+ export declare const formControlPropLabelAlign: readonly ["start", "end"];
5
+ export type FormControlPropLabelAlign = (typeof formControlPropLabelAlign)[number];
6
+ export type FormControlBaseProps = {
7
+ fullWidth?: boolean;
8
+ className?: string;
9
+ /**
10
+ * The label's overall position relative to the element it is labeling.
11
+ * @default 'top'
12
+ */
13
+ labelPlacement?: FormControlPropLabelPlacement;
14
+ /**
15
+ * The label's horizontal alignment relative to the element it is labeling.
16
+ * @default 'start'
17
+ */
18
+ labelAlign?: FormControlPropLabelAlign;
19
+ } & DataAttributeProps;
@@ -0,0 +1,6 @@
1
+ const formControlPropLabelPlacement = ["top", "side"];
2
+ const formControlPropLabelAlign = ["start", "end"];
3
+ export {
4
+ formControlPropLabelAlign,
5
+ formControlPropLabelPlacement
6
+ };
@@ -1,2 +1,4 @@
1
- import type { FormControlLabelProps } from './index';
2
- export declare const FormControlLabel: import("react").ForwardRefExoticComponent<Omit<FormControlLabelProps, "ref"> & import("react").RefAttributes<HTMLLabelElement>>;
1
+ import type { ComponentPropsWithRef, ElementType } from 'react';
2
+ import type { FormControlLabelBaseProps } from './types';
3
+ export declare const FormControlLabel: import("@koobiq/react-core").PolyForwardComponent<"label", FormControlLabelBaseProps, ElementType>;
4
+ export type FormControlLabelProps<As extends ElementType = 'label'> = ComponentPropsWithRef<typeof FormControlLabel<As>>;
@@ -0,0 +1,33 @@
1
+ import { jsxs, Fragment, jsx } from "react/jsx-runtime";
2
+ import { polymorphicForwardRef, isNotNil, clsx } from "@koobiq/react-core";
3
+ import { Label } from "@koobiq/react-primitives";
4
+ import s from "./FormControlLabel.module.css.js";
5
+ const FormControlLabel = polymorphicForwardRef(
6
+ ({
7
+ children,
8
+ className,
9
+ isHidden = false,
10
+ isRequired = false,
11
+ as = "label",
12
+ ...other
13
+ }, ref) => isNotNil(children) ? /* @__PURE__ */ jsxs(
14
+ Label,
15
+ {
16
+ as,
17
+ className: clsx(s.base, isHidden && s.hidden, className),
18
+ ...other,
19
+ ref,
20
+ children: [
21
+ children,
22
+ isRequired && /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ " ",
24
+ /* @__PURE__ */ jsx("sup", { className: s.sup, children: "*" })
25
+ ] })
26
+ ]
27
+ }
28
+ ) : null
29
+ );
30
+ FormControlLabel.displayName = "FormControlLabel";
31
+ export {
32
+ FormControlLabel
33
+ };
@@ -0,0 +1,14 @@
1
+ const base = "kbq-formcontrollabel-f90f77";
2
+ const hidden = "kbq-formcontrollabel-hidden-b6c00b";
3
+ const sup = "kbq-formcontrollabel-sup-08dbc0";
4
+ const s = {
5
+ base,
6
+ hidden,
7
+ sup
8
+ };
9
+ export {
10
+ base,
11
+ s as default,
12
+ hidden,
13
+ sup
14
+ };
@@ -1,32 +1,7 @@
1
- import type { ComponentPropsWithRef, ReactNode } from 'react';
2
- import type { ExtendableComponentPropsWithRef } from '@koobiq/react-core';
3
- export declare const formControlLabelPropSize: readonly ["normal", "big"];
4
- export type FormControlLabelPropSize = (typeof formControlLabelPropSize)[number];
5
- export declare const formControlLabelPlacement: readonly ["start", "end"];
6
- export type FormControlLabelPropLabelPlacement = (typeof formControlLabelPlacement)[number];
7
- export type FormControlLabelProps = ExtendableComponentPropsWithRef<{
8
- /** The content to display as the label. */
9
- label?: ReactNode;
10
- /**
11
- * If `true`, the component is disabled.
12
- * @default false
13
- */
14
- disabled?: boolean;
15
- /** The helper text content. */
16
- caption?: ReactNode;
17
- /** The content of the component. */
1
+ import type { ReactNode } from 'react';
2
+ export type FormControlLabelBaseProps = {
3
+ isHidden?: boolean;
4
+ className?: string;
5
+ isRequired?: boolean;
18
6
  children?: ReactNode;
19
- /**
20
- * Size.
21
- * @default 'normal'
22
- */
23
- size?: FormControlLabelPropSize;
24
- /**
25
- * The position of the label.
26
- * @default 'end'
27
- */
28
- labelPlacement?: FormControlLabelPropLabelPlacement;
29
- slotProps?: {
30
- content?: ComponentPropsWithRef<'div'>;
31
- };
32
- }, 'label'>;
7
+ };
@@ -1,6 +1,8 @@
1
1
  import { TextField } from '@koobiq/react-primitives';
2
- import { type FieldLabelProps, type FieldContentGroupProps, type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldControlProps } from '../FieldComponents';
3
- export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "style" | "className" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
2
+ import { type FieldContentGroupProps, type FieldCaptionProps, type FieldErrorProps, type FieldInputProps } from '../FieldComponents';
3
+ import { type FormControlProps } from '../FormControl';
4
+ import { type FormControlLabelProps } from '../FormControlLabel';
5
+ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLInputElement>, "children" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "style" | "className" | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
4
6
  disabled?: boolean;
5
7
  error?: boolean;
6
8
  required?: boolean;
@@ -14,12 +16,14 @@ export declare const Input: import("react").ForwardRefExoticComponent<Omit<Omit<
14
16
  errorMessage?: import("react").ReactNode;
15
17
  fullWidth?: boolean;
16
18
  isLabelHidden?: boolean;
19
+ labelPlacement?: import("./types").InputPropLabelPlacement;
20
+ labelAlign?: import("./types").InputPropLabelAlign;
17
21
  caption?: import("react").ReactNode;
18
22
  style?: import("react").CSSProperties;
19
23
  'data-testid'?: string | number;
20
24
  slotProps?: {
21
- root?: FieldControlProps<typeof TextField<HTMLInputElement>>;
22
- label?: FieldLabelProps;
25
+ root?: FormControlProps<typeof TextField<HTMLInputElement>>;
26
+ label?: FormControlLabelProps;
23
27
  caption?: FieldCaptionProps;
24
28
  group?: FieldContentGroupProps;
25
29
  errorMessage?: FieldErrorProps;
@@ -4,8 +4,9 @@ import { forwardRef } from "react";
4
4
  import { deprecate } from "@koobiq/logger";
5
5
  import { useDOMRef, mergeProps } from "@koobiq/react-core";
6
6
  import { TextField } from "@koobiq/react-primitives";
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 { FieldInput } from "../FieldComponents/FieldInput/FieldInput.js";
11
12
  import { FieldCaption } from "../FieldComponents/FieldCaption/FieldCaption.js";
@@ -24,6 +25,8 @@ const Input = forwardRef((props, ref) => {
24
25
  isRequired: isRequiredProp,
25
26
  readonly,
26
27
  isReadOnly: isReadOnlyProp,
28
+ labelPlacement,
29
+ labelAlign,
27
30
  label,
28
31
  startAddon,
29
32
  endAddon,
@@ -72,13 +75,14 @@ const Input = forwardRef((props, ref) => {
72
75
  isReadOnly,
73
76
  isInvalid,
74
77
  errorMessage,
78
+ labelPlacement,
79
+ labelAlign,
75
80
  "data-variant": variant,
76
- "data-fullwidth": fullWidth,
77
81
  ...other
78
82
  },
79
83
  slotProps?.root
80
84
  );
81
- return /* @__PURE__ */ jsx(FieldControl, { as: TextField, inputElementType: "input", ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
85
+ return /* @__PURE__ */ jsx(FormControl, { as: TextField, inputElementType: "input", ...rootProps, children: ({ isInvalid: isInvalid2, isRequired: isRequired2, isDisabled: isDisabled2 }) => {
82
86
  const labelProps = mergeProps(
83
87
  { isHidden: isLabelHidden, isRequired: isRequired2, children: label },
84
88
  slotProps?.label
@@ -105,10 +109,12 @@ const Input = forwardRef((props, ref) => {
105
109
  const captionProps = mergeProps({ children: caption }, slotProps?.caption);
106
110
  const errorProps = mergeProps({ isInvalid: isInvalid2, children: errorMessage }, slotProps?.errorMessage);
107
111
  return /* @__PURE__ */ jsxs(Fragment, { children: [
108
- /* @__PURE__ */ jsx(FieldLabel, { ...labelProps }),
109
- /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
110
- /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
111
- /* @__PURE__ */ jsx(FieldError, { ...errorProps })
112
+ /* @__PURE__ */ jsx(FormControlLabel, { ...labelProps }),
113
+ /* @__PURE__ */ jsxs(Field, { children: [
114
+ /* @__PURE__ */ jsx(FieldContentGroup, { ...groupProps, children: /* @__PURE__ */ jsx(FieldInput, { ...inputProps }) }),
115
+ /* @__PURE__ */ jsx(FieldCaption, { ...captionProps }),
116
+ /* @__PURE__ */ jsx(FieldError, { ...errorProps })
117
+ ] })
112
118
  ] });
113
119
  } });
114
120
  });
@@ -1,9 +1,15 @@
1
1
  import type { ComponentRef, CSSProperties, ReactNode } from 'react';
2
2
  import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { TextField, TextFieldProps } from '@koobiq/react-primitives';
4
- import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldLabelProps, type FieldContentGroupProps, type FieldControlProps, type FieldContentGroupPropVariant } from '../FieldComponents';
4
+ import { type FieldCaptionProps, type FieldErrorProps, type FieldInputProps, type FieldContentGroupProps, type FieldContentGroupPropVariant } from '../FieldComponents';
5
+ import { type FormControlProps, type FormControlPropLabelAlign, type FormControlPropLabelPlacement } from '../FormControl';
6
+ import type { FormControlLabelProps } from '../FormControlLabel';
5
7
  export declare const inputPropVariant: readonly ["filled", "transparent"];
8
+ export declare const inputPropLabelPlacement: readonly ["top", "side"];
6
9
  export type InputPropVariant = FieldContentGroupPropVariant;
10
+ export type InputPropLabelPlacement = FormControlPropLabelPlacement;
11
+ export declare const inputPropLabelAlign: readonly ["start", "end"];
12
+ export type InputPropLabelAlign = FormControlPropLabelAlign;
7
13
  type InputDeprecatedProps = {
8
14
  /**
9
15
  * If `true`, the component is disabled.
@@ -65,6 +71,16 @@ export type InputProps = ExtendableProps<{
65
71
  * @default false
66
72
  */
67
73
  isLabelHidden?: boolean;
74
+ /**
75
+ * The label's overall position relative to the element it is labeling.
76
+ * @default 'top'
77
+ */
78
+ labelPlacement?: InputPropLabelPlacement;
79
+ /**
80
+ * The label's horizontal alignment relative to the element it is labeling.
81
+ * @default 'start'
82
+ */
83
+ labelAlign?: InputPropLabelAlign;
68
84
  /** The helper text content. */
69
85
  caption?: ReactNode;
70
86
  /** Inline styles. */
@@ -73,8 +89,8 @@ export type InputProps = ExtendableProps<{
73
89
  'data-testid'?: string | number;
74
90
  /** The props used for each slot inside. */
75
91
  slotProps?: {
76
- root?: FieldControlProps<typeof TextField<HTMLInputElement>>;
77
- label?: FieldLabelProps;
92
+ root?: FormControlProps<typeof TextField<HTMLInputElement>>;
93
+ label?: FormControlLabelProps;
78
94
  caption?: FieldCaptionProps;
79
95
  group?: FieldContentGroupProps;
80
96
  errorMessage?: FieldErrorProps;
@@ -1,5 +1,10 @@
1
1
  import { fieldContentGroupPropVariant } from "../FieldComponents/FieldContentGroup/types.js";
2
+ import { formControlPropLabelPlacement, formControlPropLabelAlign } from "../FormControl/types.js";
2
3
  const inputPropVariant = fieldContentGroupPropVariant;
4
+ const inputPropLabelPlacement = formControlPropLabelPlacement;
5
+ const inputPropLabelAlign = formControlPropLabelAlign;
3
6
  export {
7
+ inputPropLabelAlign,
8
+ inputPropLabelPlacement,
4
9
  inputPropVariant
5
10
  };
@@ -1,6 +1,8 @@
1
1
  import { NumberField } from '@koobiq/react-primitives';
2
- import { type FieldControlProps, type FieldLabelProps, type FieldCaptionProps, type FieldErrorProps, type FieldContentGroupProps, type FieldInputProps } from '../FieldComponents';
3
- export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").NumberFieldProps, "children" | "validationState" | "description" | "inputElementType">, "caption" | "style" | "className" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
2
+ import { type FieldCaptionProps, type FieldErrorProps, type FieldContentGroupProps, type FieldInputProps } from '../FieldComponents';
3
+ import { type FormControlProps } from '../FormControl';
4
+ import { type FormControlLabelProps } from '../FormControlLabel';
5
+ export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").NumberFieldProps, "children" | "validationState" | "description" | "inputElementType">, "caption" | "style" | "className" | "labelPlacement" | "labelAlign" | "fullWidth" | "variant" | "slotProps" | "data-testid" | "startAddon" | "endAddon" | "errorMessage" | "isLabelHidden" | keyof {
4
6
  disabled?: boolean;
5
7
  error?: boolean;
6
8
  required?: boolean;
@@ -14,12 +16,14 @@ export declare const InputNumber: import("react").ForwardRefExoticComponent<Omit
14
16
  variant?: import("./types").InputNumberPropVariant;
15
17
  fullWidth?: boolean;
16
18
  isLabelHidden?: boolean;
19
+ labelPlacement?: import("./types").InputNumberPropLabelPlacement;
20
+ labelAlign?: import("./types").InputNumberPropLabelAlign;
17
21
  caption?: import("react").ReactNode;
18
22
  style?: import("react").CSSProperties;
19
23
  'data-testid'?: string | number;
20
24
  slotProps?: {
21
- root?: FieldControlProps<typeof NumberField>;
22
- label?: FieldLabelProps;
25
+ root?: FormControlProps<typeof NumberField>;
26
+ label?: FormControlLabelProps;
23
27
  input?: FieldInputProps;
24
28
  caption?: FieldCaptionProps;
25
29
  group?: FieldContentGroupProps;