@koobiq/react-components 0.0.1-beta.30 → 0.0.1-beta.31

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 (40) hide show
  1. package/dist/components/FieldComponents/FieldAddon/FieldAddon.d.ts +1 -1
  2. package/dist/components/FieldComponents/FieldAddon/FieldAddon.js +7 -2
  3. package/dist/components/FieldComponents/FieldAddon/FieldAddon.module.css.js +3 -3
  4. package/dist/components/FieldComponents/FieldCaption/FieldCaption.d.ts +4 -6
  5. package/dist/components/FieldComponents/FieldCaption/FieldCaption.js +1 -1
  6. package/dist/components/FieldComponents/FieldControl/FieldControl.d.ts +2 -1
  7. package/dist/components/FieldComponents/FieldError/FieldError.d.ts +1 -1
  8. package/dist/components/FieldComponents/FieldError/FieldError.js +1 -1
  9. package/dist/components/FieldComponents/FieldInput/FieldInput.d.ts +2 -2
  10. package/dist/components/FieldComponents/FieldInput/FieldInput.js +4 -4
  11. package/dist/components/FieldComponents/FieldInput/FieldInput.module.css.js +3 -3
  12. package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.d.ts +2 -2
  13. package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroup.js +29 -5
  14. package/dist/components/FieldComponents/FieldInputGroup/FieldInputGroupContext.d.ts +3 -3
  15. package/dist/components/FieldComponents/FieldLabel/FieldLabel.d.ts +2 -2
  16. package/dist/components/FieldComponents/FieldLabel/FieldLabel.js +3 -3
  17. package/dist/components/FieldComponents/FieldSelect/FieldSelect.d.ts +5 -4
  18. package/dist/components/FieldComponents/FieldSelect/FieldSelect.js +5 -5
  19. package/dist/components/FieldComponents/FieldSelect/FieldSelect.module.css.js +4 -4
  20. package/dist/components/Input/Input.d.ts +30 -10
  21. package/dist/components/Input/Input.js +58 -13
  22. package/dist/components/Input/types.d.ts +66 -9
  23. package/dist/components/InputNumber/InputNumber.d.ts +25 -9
  24. package/dist/components/InputNumber/InputNumber.js +75 -25
  25. package/dist/components/InputNumber/components/InputNumberCounterControls.js +2 -2
  26. package/dist/components/InputNumber/types.d.ts +52 -7
  27. package/dist/components/Provider/Provider.d.ts +1 -1
  28. package/dist/components/Provider/Provider.js +8 -4
  29. package/dist/components/Provider/types.d.ts +3 -1
  30. package/dist/components/Select/Select.js +80 -65
  31. package/dist/components/Select/types.d.ts +48 -6
  32. package/dist/components/Textarea/Textarea.d.ts +14 -6
  33. package/dist/components/Textarea/Textarea.js +46 -2
  34. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.d.ts +4 -4
  35. package/dist/components/Textarea/components/TextareaContextConsumer/TextareaContextConsumer.js +15 -9
  36. package/dist/components/Textarea/types.d.ts +57 -7
  37. package/dist/components/Textarea/utils/useTextareaAutosize.d.ts +1 -1
  38. package/dist/components/Textarea/utils/useTextareaAutosize.js +2 -2
  39. package/dist/style.css +4 -4
  40. package/package.json +5 -5
@@ -1,21 +1,29 @@
1
- export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<Omit<import("@koobiq/react-primitives").UseTextFieldProps, "inputElementType">, "caption" | "label" | "className" | "disabled" | "required" | "cols" | "rows" | "error" | "variant" | "slotProps" | "fullWidth" | "errorMessage" | "hiddenLabel" | "expand"> & {
1
+ export declare const Textarea: import("react").ForwardRefExoticComponent<Omit<{
2
+ disabled?: boolean;
3
+ error?: boolean;
4
+ required?: boolean;
5
+ hiddenLabel?: boolean;
6
+ readonly?: boolean;
7
+ } & Omit<import("@koobiq/react-primitives").TextFieldProps<HTMLTextAreaElement>, "children" | "style" | "className" | "validationBehavior" | "validate" | "description" | "inputElementType">, "caption" | "label" | "className" | "cols" | "rows" | "isDisabled" | "variant" | "slotProps" | "fullWidth" | "data-testid" | "isInvalid" | "isReadOnly" | "isRequired" | "errorMessage" | "isLabelHidden" | "expand"> & {
2
8
  label?: import("react").ReactNode;
3
9
  className?: string;
4
10
  variant?: import("./types").TextareaPropVariant;
5
- error?: boolean;
11
+ isInvalid?: boolean;
12
+ isReadOnly?: boolean;
6
13
  errorMessage?: string | number;
7
14
  fullWidth?: boolean;
8
- disabled?: boolean;
9
- hiddenLabel?: boolean;
15
+ isDisabled?: boolean;
16
+ isLabelHidden?: boolean;
10
17
  caption?: string | number;
11
- required?: boolean;
18
+ isRequired?: boolean;
12
19
  rows?: number;
13
20
  cols?: number;
14
21
  expand?: import("./types").TextareaPropExpand;
22
+ 'data-testid'?: string | number;
15
23
  slotProps?: {
16
24
  label?: import("../FieldComponents").FieldLabelProps;
17
25
  caption?: import("../FieldComponents").FieldCaptionProps;
18
- textarea?: import("../FieldComponents").FieldInputProps;
26
+ textarea?: import("../FieldComponents").FieldInputProps<"textarea">;
19
27
  errorMessage?: import("../FieldComponents").FieldErrorProps;
20
28
  };
21
29
  } & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -1,6 +1,7 @@
1
1
  "use client";
2
2
  import { jsx } from "react/jsx-runtime";
3
3
  import { forwardRef } from "react";
4
+ import { deprecate } from "@koobiq/logger";
4
5
  import { mergeProps } from "@koobiq/react-core";
5
6
  import { TextField } from "@koobiq/react-primitives";
6
7
  import { TextareaContextConsumer } from "./components/TextareaContextConsumer/TextareaContextConsumer.js";
@@ -9,7 +10,16 @@ const Textarea = forwardRef((props, ref) => {
9
10
  const {
10
11
  variant = "filled",
11
12
  fullWidth = false,
12
- hiddenLabel = false,
13
+ hiddenLabel,
14
+ isLabelHidden: isLabelHiddenProp,
15
+ disabled,
16
+ isDisabled: isDisabledProp,
17
+ error,
18
+ isInvalid: isInvalidProp,
19
+ required,
20
+ isRequired: isRequiredProp,
21
+ readonly,
22
+ isReadOnly: isReadOnlyProp,
13
23
  rows,
14
24
  cols,
15
25
  expand,
@@ -19,10 +29,44 @@ const Textarea = forwardRef((props, ref) => {
19
29
  label,
20
30
  ...other
21
31
  } = 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;
37
+ if (process.env.NODE_ENV !== "production" && "disabled" in props) {
38
+ deprecate(
39
+ 'Textarea: the "disabled" prop is deprecated. Use "isDisabled" prop to replace it.'
40
+ );
41
+ }
42
+ if (process.env.NODE_ENV !== "production" && "required" in props) {
43
+ deprecate(
44
+ 'Textarea: the "required" prop is deprecated. Use "isRequired" prop to replace it.'
45
+ );
46
+ }
47
+ if (process.env.NODE_ENV !== "production" && "error" in props) {
48
+ deprecate(
49
+ 'Textarea: the "error" prop is deprecated. Use "isInvalid" prop to replace it.'
50
+ );
51
+ }
52
+ if (process.env.NODE_ENV !== "production" && "readonly" in props) {
53
+ deprecate(
54
+ 'Textarea: the "readonly" prop is deprecated. Use "isReadOnly" prop to replace it.'
55
+ );
56
+ }
57
+ if (process.env.NODE_ENV !== "production" && "hiddenLabel" in props) {
58
+ deprecate(
59
+ 'Textarea: the "hiddenLabel" prop is deprecated. Use "isLabelHidden" prop to replace it.'
60
+ );
61
+ }
22
62
  const rootProps = mergeProps(
23
63
  {
24
64
  label,
25
65
  fullWidth,
66
+ isDisabled,
67
+ isRequired,
68
+ isReadOnly,
69
+ isInvalid,
26
70
  errorMessage,
27
71
  "data-variant": variant,
28
72
  "data-fullwidth": fullWidth
@@ -40,7 +84,7 @@ const Textarea = forwardRef((props, ref) => {
40
84
  variant,
41
85
  caption,
42
86
  slotProps,
43
- hiddenLabel,
87
+ isLabelHidden,
44
88
  errorMessage,
45
89
  ref
46
90
  }
@@ -1,6 +1,6 @@
1
1
  import type { TextareaProps } from '../../types';
2
2
  export declare const TextareaContextConsumer: import("react").ForwardRefExoticComponent<{
3
- required?: boolean;
4
- error?: boolean;
5
- disabled?: boolean;
6
- } & Pick<TextareaProps, "caption" | "label" | "cols" | "rows" | "variant" | "slotProps" | "errorMessage" | "hiddenLabel" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;
3
+ isRequired?: boolean;
4
+ isInvalid?: boolean;
5
+ isDisabled?: boolean;
6
+ } & Pick<TextareaProps, "caption" | "label" | "cols" | "rows" | "variant" | "slotProps" | "errorMessage" | "isLabelHidden" | "expand"> & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -13,14 +13,14 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
13
13
  rows,
14
14
  cols,
15
15
  label,
16
- error,
16
+ isInvalid,
17
17
  expand,
18
18
  caption,
19
19
  variant,
20
- disabled,
21
- required,
20
+ isDisabled,
21
+ isRequired,
22
22
  slotProps,
23
- hiddenLabel,
23
+ isLabelHidden,
24
24
  errorMessage
25
25
  } = props;
26
26
  const { value } = useTextareaContext();
@@ -28,21 +28,27 @@ const TextareaContextConsumer = forwardRef((props, ref) => {
28
28
  useTextareaAutosize(domRef, value, expand === "auto-size");
29
29
  const textareaProps = mergeProps(
30
30
  {
31
- error,
31
+ isInvalid,
32
32
  rows,
33
33
  cols,
34
34
  variant,
35
35
  value,
36
- disabled,
36
+ isDisabled,
37
37
  ...expand && { className: s[expand] },
38
38
  ref: domRef
39
39
  },
40
40
  slotProps?.textarea
41
41
  );
42
- const captionProps = slotProps?.caption;
43
- const errorProps = mergeProps({ error }, slotProps?.errorMessage);
42
+ const captionProps = mergeProps(
43
+ { isInvalid },
44
+ slotProps?.caption
45
+ );
46
+ const errorProps = mergeProps(
47
+ { isInvalid },
48
+ slotProps?.errorMessage
49
+ );
44
50
  const labelProps = mergeProps(
45
- { hidden: hiddenLabel, required },
51
+ { isHidden: isLabelHidden, isRequired },
46
52
  slotProps?.label
47
53
  );
48
54
  return /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -1,11 +1,53 @@
1
1
  import type { ComponentRef, ReactNode } from 'react';
2
2
  import type { ExtendableProps } from '@koobiq/react-core';
3
- import type { UseTextFieldProps } from '@koobiq/react-primitives';
3
+ import type { TextFieldProps } from '@koobiq/react-primitives';
4
4
  import type { FieldCaptionProps, FieldErrorProps, FieldInputProps, FieldLabelProps } from '../FieldComponents';
5
5
  export declare const textareaPropVariant: readonly ["filled", "transparent"];
6
6
  export type TextareaPropVariant = (typeof textareaPropVariant)[number];
7
7
  export declare const textareaPropExpand: readonly ["auto-size", "vertical-resize"];
8
8
  export type TextareaPropExpand = (typeof textareaPropExpand)[number];
9
+ type TextareaDeprecatedProps = {
10
+ /**
11
+ * If `true`, the component is disabled.
12
+ * @default false
13
+ *
14
+ * @deprecated
15
+ * The "disabled" prop is deprecated. Use "isDisabled" prop to replace it.
16
+ */
17
+ disabled?: boolean;
18
+ /**
19
+ * If `true`, the input will indicate an error.
20
+ * @default false
21
+ *
22
+ * @deprecated
23
+ * The "error" prop is deprecated. Use "isInvalid" prop to replace it.
24
+ */
25
+ error?: boolean;
26
+ /**
27
+ * If `true`, the label is displayed as required and the input element is required.
28
+ * @default false
29
+ *
30
+ * @deprecated
31
+ * The "required" prop is deprecated. Use "isRequired" prop to replace it.
32
+ */
33
+ required?: boolean;
34
+ /**
35
+ * If `true`, the label is hidden. Be sure to add aria-label to the input element.
36
+ * @default false
37
+ *
38
+ * @deprecated
39
+ * The "hiddenLabel" prop is deprecated. Use "isLabelHidden" prop to replace it.
40
+ */
41
+ hiddenLabel?: boolean;
42
+ /**
43
+ * If `true`, the input can be selected but not changed by the user.
44
+ * @default false
45
+ *
46
+ * @deprecated
47
+ * The "readonly" prop is deprecated. Use "isReadOnly" prop to replace it.
48
+ */
49
+ readonly?: boolean;
50
+ };
9
51
  export type TextareaProps = ExtendableProps<{
10
52
  /** The content to display as the label. */
11
53
  label?: ReactNode;
@@ -20,7 +62,12 @@ export type TextareaProps = ExtendableProps<{
20
62
  * If `true`, the input will indicate an error.
21
63
  * @default false
22
64
  */
23
- error?: boolean;
65
+ isInvalid?: boolean;
66
+ /**
67
+ * If `true`, the input can be selected but not changed by the user.
68
+ * @default false
69
+ */
70
+ isReadOnly?: boolean;
24
71
  /** Message for the error state */
25
72
  errorMessage?: string | number;
26
73
  /**
@@ -32,19 +79,19 @@ export type TextareaProps = ExtendableProps<{
32
79
  * If `true`, the component is disabled.
33
80
  * @default false
34
81
  */
35
- disabled?: boolean;
82
+ isDisabled?: boolean;
36
83
  /**
37
84
  * If `true`, the label is hidden. Be sure to add aria-label to the input element.
38
85
  * @default false
39
86
  */
40
- hiddenLabel?: boolean;
87
+ isLabelHidden?: boolean;
41
88
  /** The helper text content. */
42
89
  caption?: string | number;
43
90
  /**
44
91
  * If `true`, the label is displayed as required and the input element is required.
45
92
  * @default false
46
93
  */
47
- required?: boolean;
94
+ isRequired?: boolean;
48
95
  /** The rows property specifies the visible height of a text area, in lines. */
49
96
  rows?: number;
50
97
  /** The cols property specifies the visible width of a text area. */
@@ -56,12 +103,15 @@ export type TextareaProps = ExtendableProps<{
56
103
  * `verticalResize` — the ability to stretch the field vertically.
57
104
  */
58
105
  expand?: TextareaPropExpand;
106
+ /** Unique identifier for testing purposes. */
107
+ 'data-testid'?: string | number;
59
108
  /** The props used for each slot inside. */
60
109
  slotProps?: {
61
110
  label?: FieldLabelProps;
62
111
  caption?: FieldCaptionProps;
63
- textarea?: FieldInputProps;
112
+ textarea?: FieldInputProps<'textarea'>;
64
113
  errorMessage?: FieldErrorProps;
65
114
  };
66
- }, Omit<UseTextFieldProps, 'inputElementType'>>;
115
+ }, TextareaDeprecatedProps & Omit<TextFieldProps<HTMLTextAreaElement>, 'description' | 'validationBehavior' | 'validate' | 'children' | 'style' | 'className' | 'inputElementType'>>;
67
116
  export type TextareaRef = ComponentRef<'textarea'>;
117
+ export {};
@@ -1,2 +1,2 @@
1
1
  import { type MutableRefObject } from 'react';
2
- export declare function useTextareaAutosize(ref: MutableRefObject<HTMLTextAreaElement | null>, value: string | readonly string[] | number | undefined, active?: boolean): void;
2
+ export declare function useTextareaAutosize(ref: MutableRefObject<HTMLTextAreaElement | null>, value: string | readonly string[] | number | undefined, isActive?: boolean): void;
@@ -1,7 +1,7 @@
1
1
  import { useEffect } from "react";
2
- function useTextareaAutosize(ref, value, active) {
2
+ function useTextareaAutosize(ref, value, isActive) {
3
3
  useEffect(() => {
4
- if (!active) return;
4
+ if (!isActive) return;
5
5
  if (ref.current) {
6
6
  const textareaEl = ref.current;
7
7
  textareaEl.style.blockSize = "0px";
package/dist/style.css CHANGED
@@ -1998,7 +1998,7 @@
1998
1998
  inset-inline-end: 0;
1999
1999
  }
2000
2000
 
2001
- .kbq-fieldaddon-error-278697 {
2001
+ .kbq-fieldaddon-invalid-08b1fe {
2002
2002
  color: var(--kbq-icon-error);
2003
2003
  }
2004
2004
  .kbq-fieldinput-77b90b {
@@ -2068,7 +2068,7 @@
2068
2068
  --field-input-placeholder-color: var(--kbq-foreground-contrast-tertiary);
2069
2069
  }
2070
2070
 
2071
- .kbq-fieldinput-filled-abb632:where(.kbq-fieldinput-error-00c0a4) {
2071
+ .kbq-fieldinput-filled-abb632:where(.kbq-fieldinput-invalid-2af82b) {
2072
2072
  --field-input-color: var(--kbq-foreground-error);
2073
2073
  --field-input-border-color: var(--kbq-line-error);
2074
2074
  --field-input-outline-color: var(--kbq-states-line-focus-error);
@@ -2076,7 +2076,7 @@
2076
2076
  --field-input-placeholder-color: var(--kbq-foreground-error-tertiary);
2077
2077
  }
2078
2078
 
2079
- .kbq-fieldinput-transparent-ed7263:where(.kbq-fieldinput-error-00c0a4) {
2079
+ .kbq-fieldinput-transparent-ed7263:where(.kbq-fieldinput-invalid-2af82b) {
2080
2080
  --field-input-color: var(--kbq-foreground-error);
2081
2081
  --field-input-border-color: transparent;
2082
2082
  --field-input-outline-color: transparent;
@@ -3104,7 +3104,7 @@
3104
3104
  overflow: hidden;
3105
3105
  }
3106
3106
 
3107
- .kbq-fieldselect-error-0cac4a {
3107
+ .kbq-fieldselect-invalid-db8152 {
3108
3108
  --field-input-color: var(--kbq-foreground-error);
3109
3109
  --field-input-border-color: var(--kbq-line-error);
3110
3110
  --field-input-outline-color: var(--kbq-states-line-focus-error);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koobiq/react-components",
3
- "version": "0.0.1-beta.30",
3
+ "version": "0.0.1-beta.31",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -27,10 +27,10 @@
27
27
  "@koobiq/design-tokens": "^3.12.1",
28
28
  "@types/react-transition-group": "^4.4.12",
29
29
  "react-transition-group": "^4.4.5",
30
- "@koobiq/logger": "0.0.1-beta.30",
31
- "@koobiq/react-core": "0.0.1-beta.30",
32
- "@koobiq/react-primitives": "0.0.1-beta.30",
33
- "@koobiq/react-icons": "0.0.1-beta.30"
30
+ "@koobiq/logger": "0.0.1-beta.31",
31
+ "@koobiq/react-core": "0.0.1-beta.31",
32
+ "@koobiq/react-icons": "0.0.1-beta.31",
33
+ "@koobiq/react-primitives": "0.0.1-beta.31"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@koobiq/design-tokens": "^3.11.2",