@koobiq/react-components 0.0.1-beta.36 → 0.0.1-beta.37

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.
@@ -67,6 +67,7 @@ function DateInputRender(props, ref) {
67
67
  {
68
68
  endAddon,
69
69
  isInvalid,
70
+ isDisabled,
70
71
  startAddon
71
72
  },
72
73
  slotProps?.group
@@ -11,7 +11,7 @@ export type DateInputProps<T extends DateValue> = {
11
11
  /** Unique identifier for testing purposes. */
12
12
  'data-testid'?: string | number;
13
13
  /** The helper text content. */
14
- caption?: string | number;
14
+ caption?: ReactNode;
15
15
  /**
16
16
  * The variant to use.
17
17
  * @default filled
@@ -4,6 +4,7 @@ export declare const fieldAddonPropPlacement: readonly ["start", "end"];
4
4
  export type FieldAddonPlacement = (typeof fieldAddonPropPlacement)[number];
5
5
  export type FieldAddonProps = ExtendableComponentPropsWithRef<{
6
6
  isInvalid?: boolean;
7
+ isDisabled?: boolean;
7
8
  children?: ReactNode;
8
9
  placement?: FieldAddonPlacement;
9
10
  }, 'div'>;
@@ -3,15 +3,27 @@ import { forwardRef } from "react";
3
3
  import { isNotNil, clsx } from "@koobiq/react-core";
4
4
  import s from "./FieldAddon.module.css.js";
5
5
  const FieldAddon = forwardRef(
6
- ({ placement = "start", isInvalid = false, className, children, ...other }, ref) => isNotNil(children) ? /* @__PURE__ */ jsx(
6
+ ({
7
+ placement = "start",
8
+ isInvalid = false,
9
+ isDisabled = false,
10
+ className,
11
+ children,
12
+ ...other
13
+ }, ref) => isNotNil(children) ? /* @__PURE__ */ jsx(
7
14
  "div",
8
15
  {
9
16
  className: clsx(
10
17
  s.base,
11
18
  s[placement],
12
19
  isInvalid && s.invalid,
20
+ isDisabled && s.disabled,
13
21
  className
14
22
  ),
23
+ "data-placement": placement,
24
+ "data-invalid": isInvalid,
25
+ "data-disabled": isDisabled,
26
+ "data-testid": `field-addon-${placement}`,
15
27
  ...other,
16
28
  ref,
17
29
  children
@@ -2,15 +2,18 @@ const base = "kbq-fieldaddon-3388d3";
2
2
  const start = "kbq-fieldaddon-start-83aa84";
3
3
  const end = "kbq-fieldaddon-end-f314bf";
4
4
  const invalid = "kbq-fieldaddon-invalid-08b1fe";
5
+ const disabled = "kbq-fieldaddon-disabled-c170bf";
5
6
  const s = {
6
7
  base,
7
8
  start,
8
9
  end,
9
- invalid
10
+ invalid,
11
+ disabled
10
12
  };
11
13
  export {
12
14
  base,
13
15
  s as default,
16
+ disabled,
14
17
  end,
15
18
  invalid,
16
19
  start
@@ -5,62 +5,60 @@ import { useInputContext, Group } from "@koobiq/react-primitives";
5
5
  import s from "./FieldInputGroup.module.css.js";
6
6
  import { FieldInputGroupContext } from "./FieldInputGroupContext.js";
7
7
  import { FieldAddon } from "../FieldAddon/FieldAddon.js";
8
- const FieldInputGroup = forwardRef(
9
- ({
10
- children,
11
- className,
12
- startAddon,
13
- endAddon,
14
- isInvalid,
15
- slotProps,
16
- ...other
17
- }, ref) => {
18
- const { value } = useInputContext();
19
- const hasStartAddon = !!startAddon;
20
- const hasEndAddon = !!endAddon;
21
- const hasValue = isNotNil(value);
22
- return /* @__PURE__ */ jsx(
23
- Group,
24
- {
25
- className: clsx(
26
- s.base,
27
- hasStartAddon && s.hasStartAddon,
28
- hasEndAddon && s.hasEndAddon,
29
- className
30
- ),
31
- ...other,
32
- ref,
33
- children: ({ isHovered, isFocusWithin, isDisabled }) => /* @__PURE__ */ jsxs(
34
- FieldInputGroupContext.Provider,
35
- {
36
- value: { isDisabled, isHovered, hasValue, isFocusWithin },
37
- children: [
38
- /* @__PURE__ */ jsx(
39
- FieldAddon,
40
- {
41
- placement: "start",
42
- isInvalid,
43
- ...slotProps?.start,
44
- children: startAddon
45
- }
46
- ),
47
- children,
48
- /* @__PURE__ */ jsx(
49
- FieldAddon,
50
- {
51
- placement: "end",
52
- isInvalid,
53
- ...slotProps?.end,
54
- children: endAddon
55
- }
56
- )
57
- ]
58
- }
59
- )
60
- }
61
- );
62
- }
63
- );
8
+ const FieldInputGroup = forwardRef(({ children, className, startAddon, endAddon, slotProps, ...other }, ref) => {
9
+ const { value } = useInputContext();
10
+ const hasStartAddon = !!startAddon;
11
+ const hasEndAddon = !!endAddon;
12
+ const hasValue = isNotNil(value);
13
+ return /* @__PURE__ */ jsx(
14
+ Group,
15
+ {
16
+ className: clsx(
17
+ s.base,
18
+ hasStartAddon && s.hasStartAddon,
19
+ hasEndAddon && s.hasEndAddon,
20
+ className
21
+ ),
22
+ ...other,
23
+ ref,
24
+ children: ({ isHovered, isFocusWithin, isDisabled, isInvalid }) => /* @__PURE__ */ jsxs(
25
+ FieldInputGroupContext.Provider,
26
+ {
27
+ value: {
28
+ isDisabled,
29
+ isHovered,
30
+ hasValue,
31
+ isFocusWithin,
32
+ isInvalid
33
+ },
34
+ children: [
35
+ /* @__PURE__ */ jsx(
36
+ FieldAddon,
37
+ {
38
+ placement: "start",
39
+ isInvalid,
40
+ isDisabled,
41
+ ...slotProps?.start,
42
+ children: startAddon
43
+ }
44
+ ),
45
+ children,
46
+ /* @__PURE__ */ jsx(
47
+ FieldAddon,
48
+ {
49
+ placement: "end",
50
+ isInvalid,
51
+ isDisabled,
52
+ ...slotProps?.end,
53
+ children: endAddon
54
+ }
55
+ )
56
+ ]
57
+ }
58
+ )
59
+ }
60
+ );
61
+ });
64
62
  FieldInputGroup.displayName = "FieldInputGroup";
65
63
  export {
66
64
  FieldInputGroup
@@ -3,6 +3,7 @@ export type FieldInputGroupContextProps = {
3
3
  hasValue?: boolean;
4
4
  isHovered?: boolean;
5
5
  isFocusWithin?: boolean;
6
+ isInvalid?: boolean;
6
7
  };
7
8
  export declare const FieldInputGroupContext: import("react").Context<FieldInputGroupContextProps>;
8
9
  export declare const useFieldInputGroup: () => FieldInputGroupContextProps;
@@ -96,6 +96,7 @@ const Input = forwardRef((props, ref) => {
96
96
  {
97
97
  endAddon,
98
98
  isInvalid: isInvalid2,
99
+ isDisabled: isDisabled2,
99
100
  startAddon
100
101
  },
101
102
  slotProps?.group
@@ -1,33 +1,33 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { clsx } from "@koobiq/react-core";
3
- import { IconChevronUp16, IconChevronDown16 } from "@koobiq/react-icons";
3
+ import { IconChevronUpS16, IconChevronDownS16 } from "@koobiq/react-icons";
4
4
  import s from "./InputNumberCounterControls.module.css.js";
5
5
  import { useFieldInputGroup } from "../../FieldComponents/FieldInputGroup/FieldInputGroupContext.js";
6
6
  import { IconButton } from "../../IconButton/IconButton.js";
7
7
  const InputNumberCounterControls = () => {
8
- const { isHovered, hasValue, isFocusWithin } = useFieldInputGroup();
9
- const visible = (isHovered || isFocusWithin) && hasValue;
10
- return /* @__PURE__ */ jsxs("div", { className: clsx(s.base, visible && s.visible), children: [
8
+ const { isInvalid } = useFieldInputGroup();
9
+ const variant = isInvalid ? "error" : "fade-contrast";
10
+ return /* @__PURE__ */ jsxs("div", { className: s.base, children: [
11
11
  /* @__PURE__ */ jsx(
12
12
  IconButton,
13
13
  {
14
- className: s.counter,
14
+ className: clsx(s.counter, s.increment),
15
15
  slot: "increment",
16
- variant: "fade-contrast",
16
+ variant,
17
17
  size: "l",
18
18
  isCompact: true,
19
- children: /* @__PURE__ */ jsx(IconChevronUp16, {})
19
+ children: /* @__PURE__ */ jsx(IconChevronUpS16, {})
20
20
  }
21
21
  ),
22
22
  /* @__PURE__ */ jsx(
23
23
  IconButton,
24
24
  {
25
- className: s.counter,
25
+ className: clsx(s.counter, s.decrement),
26
26
  slot: "decrement",
27
- variant: "fade-contrast",
27
+ variant,
28
28
  size: "l",
29
29
  isCompact: true,
30
- children: /* @__PURE__ */ jsx(IconChevronDown16, {})
30
+ children: /* @__PURE__ */ jsx(IconChevronDownS16, {})
31
31
  }
32
32
  )
33
33
  ] });
@@ -1,14 +1,17 @@
1
1
  const base = "kbq-inputnumbercountercontrols-77ed13";
2
- const visible = "kbq-inputnumbercountercontrols-visible-5885f8";
3
2
  const counter = "kbq-inputnumbercountercontrols-counter-1126db";
3
+ const increment = "kbq-inputnumbercountercontrols-increment-d89a95";
4
+ const decrement = "kbq-inputnumbercountercontrols-decrement-fbd37a";
4
5
  const s = {
5
6
  base,
6
- visible,
7
- counter
7
+ counter,
8
+ increment,
9
+ decrement
8
10
  };
9
11
  export {
10
12
  base,
11
13
  counter,
14
+ decrement,
12
15
  s as default,
13
- visible
16
+ increment
14
17
  };
@@ -1,7 +1,6 @@
1
1
  export declare const Radio: import("react").ForwardRefExoticComponent<Omit<Omit<import("@react-types/radio").AriaRadioProps, "isDisabled">, "disabled"> & {
2
2
  disabled?: boolean;
3
3
  } & {
4
- caption?: string;
5
4
  size?: import("./types").RadioPropSize;
6
5
  labelPlacement?: import("./types").RadioPropLabelPlacement;
7
6
  className?: string;
@@ -5,8 +5,6 @@ export type RadioPropSize = (typeof radioPropSize)[number];
5
5
  export declare const radioPropLabelPlacement: readonly ["start", "end"];
6
6
  export type RadioPropLabelPlacement = (typeof radioPropLabelPlacement)[number];
7
7
  export type RadioProps = UseRadioProps & {
8
- /** The helper text content. */
9
- caption?: string;
10
8
  /**
11
9
  * Size.
12
10
  * @default normal
@@ -131,6 +131,7 @@ function SelectRender(props, ref) {
131
131
  /* @__PURE__ */ jsx(IconChevronDownS16, {})
132
132
  ] }),
133
133
  isInvalid,
134
+ isDisabled,
134
135
  ref: containerRef
135
136
  },
136
137
  slotProps?.group
package/dist/style.css CHANGED
@@ -1979,9 +1979,10 @@
1979
1979
  --field-control-end-addon-inline-size: 36px;
1980
1980
  }
1981
1981
  .kbq-fieldaddon-3388d3 {
1982
+ --field-addon-color: var(--kbq-icon-contrast-fade);
1982
1983
  z-index: 1;
1983
1984
  block-size: 100%;
1984
- color: var(--kbq-icon-contrast-fade);
1985
+ color: var(--field-addon-color);
1985
1986
  transition: color var(--kbq-transition-default);
1986
1987
  justify-content: center;
1987
1988
  align-items: center;
@@ -1999,7 +2000,11 @@
1999
2000
  }
2000
2001
 
2001
2002
  .kbq-fieldaddon-invalid-08b1fe {
2002
- color: var(--kbq-icon-error);
2003
+ --field-addon-color: var(--kbq-icon-error);
2004
+ }
2005
+
2006
+ .kbq-fieldaddon-disabled-c170bf {
2007
+ --field-addon-color: var(--kbq-states-icon-disabled);
2003
2008
  }
2004
2009
  .kbq-fieldinput-77b90b {
2005
2010
  --field-input-color: ;
@@ -2138,22 +2143,22 @@
2138
2143
  overflow: auto;
2139
2144
  }
2140
2145
  .kbq-inputnumbercountercontrols-77ed13 {
2141
- opacity: 0;
2142
- visibility: hidden;
2143
- transition: opacity var(--kbq-transition-default);
2144
2146
  flex-direction: column;
2145
- margin-inline-end: -8px;
2147
+ margin-inline-end: calc(-1 * var(--kbq-size-s));
2146
2148
  display: flex;
2147
2149
  }
2148
2150
 
2149
- .kbq-inputnumbercountercontrols-visible-5885f8 {
2150
- visibility: visible;
2151
- opacity: 1;
2152
- }
2153
-
2154
2151
  .kbq-inputnumbercountercontrols-counter-1126db {
2155
2152
  inline-size: var(--kbq-size-3xl);
2156
2153
  }
2154
+
2155
+ .kbq-inputnumbercountercontrols-increment-d89a95 > svg {
2156
+ margin-block-end: calc(-1 * var(--kbq-size-3xs));
2157
+ }
2158
+
2159
+ .kbq-inputnumbercountercontrols-decrement-fbd37a > svg {
2160
+ margin-block-start: calc(-1 * var(--kbq-size-3xs));
2161
+ }
2157
2162
  .kbq-radio-c3ed31 {
2158
2163
  --radio-size: ;
2159
2164
  --radio-opacity: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koobiq/react-components",
3
- "version": "0.0.1-beta.36",
3
+ "version": "0.0.1-beta.37",
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.36",
31
- "@koobiq/react-core": "0.0.1-beta.36",
32
- "@koobiq/react-primitives": "0.0.1-beta.36",
33
- "@koobiq/react-icons": "0.0.1-beta.36"
30
+ "@koobiq/logger": "0.0.1-beta.37",
31
+ "@koobiq/react-core": "0.0.1-beta.37",
32
+ "@koobiq/react-primitives": "0.0.1-beta.37",
33
+ "@koobiq/react-icons": "0.0.1-beta.37"
34
34
  },
35
35
  "peerDependencies": {
36
36
  "@koobiq/design-tokens": "^3.11.2",