@koobiq/react-components 0.0.1-beta.8 → 0.0.1-beta.9

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.
@@ -1,5 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { type ExtendableComponentPropsWithRef } from '@koobiq/react-core';
3
+ import { type FieldAddonProps } from '../FieldAddon';
3
4
  export type FieldInputGroupProps = ExtendableComponentPropsWithRef<{
4
5
  children?: ReactNode;
5
6
  startAddon?: ReactNode;
@@ -7,5 +8,10 @@ export type FieldInputGroupProps = ExtendableComponentPropsWithRef<{
7
8
  disabled?: boolean;
8
9
  className?: string;
9
10
  error?: boolean;
11
+ /** The props used for each slot inside. */
12
+ slotProps?: {
13
+ start?: FieldAddonProps;
14
+ end?: FieldAddonProps;
15
+ };
10
16
  }, 'div'>;
11
17
  export declare const FieldInputGroup: import("react").ForwardRefExoticComponent<Omit<FieldInputGroupProps, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
@@ -5,36 +5,38 @@ 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(({ children, className, startAddon, endAddon, error, ...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: ({ hovered, focusWithin, disabled }) => /* @__PURE__ */ jsxs(
25
- FieldInputGroupContext.Provider,
26
- {
27
- value: { disabled, hovered, hasValue, focusWithin },
28
- children: [
29
- /* @__PURE__ */ jsx(FieldAddon, { placement: "start", error, children: startAddon }),
30
- children,
31
- /* @__PURE__ */ jsx(FieldAddon, { placement: "end", error, children: endAddon })
32
- ]
33
- }
34
- )
35
- }
36
- );
37
- });
8
+ const FieldInputGroup = forwardRef(
9
+ ({ children, className, startAddon, endAddon, error, slotProps, ...other }, ref) => {
10
+ const { value } = useInputContext();
11
+ const hasStartAddon = !!startAddon;
12
+ const hasEndAddon = !!endAddon;
13
+ const hasValue = isNotNil(value);
14
+ return /* @__PURE__ */ jsx(
15
+ Group,
16
+ {
17
+ className: clsx(
18
+ s.base,
19
+ hasStartAddon && s.hasStartAddon,
20
+ hasEndAddon && s.hasEndAddon,
21
+ className
22
+ ),
23
+ ...other,
24
+ ref,
25
+ children: ({ hovered, focusWithin, disabled }) => /* @__PURE__ */ jsxs(
26
+ FieldInputGroupContext.Provider,
27
+ {
28
+ value: { disabled, hovered, hasValue, focusWithin },
29
+ children: [
30
+ /* @__PURE__ */ jsx(FieldAddon, { placement: "start", error, ...slotProps?.start, children: startAddon }),
31
+ children,
32
+ /* @__PURE__ */ jsx(FieldAddon, { placement: "end", error, ...slotProps?.end, children: endAddon })
33
+ ]
34
+ }
35
+ )
36
+ }
37
+ );
38
+ }
39
+ );
38
40
  FieldInputGroup.displayName = "FieldInputGroup";
39
41
  export {
40
42
  FieldInputGroup
@@ -21,7 +21,7 @@ const Input = forwardRef((props, ref) => {
21
21
  caption,
22
22
  ...other
23
23
  } = props;
24
- const domRef = useDOMRef(ref);
24
+ const inputRef = useDOMRef(ref);
25
25
  const rootProps = mergeProps(
26
26
  {
27
27
  label,
@@ -42,7 +42,7 @@ const Input = forwardRef((props, ref) => {
42
42
  error,
43
43
  variant,
44
44
  disabled,
45
- ref: domRef
45
+ ref: inputRef
46
46
  },
47
47
  slotProps?.input
48
48
  );
@@ -1,33 +1,31 @@
1
1
  "use client";
2
2
  import { jsxs } from "react/jsx-runtime";
3
- import { polymorphicForwardRef, useDOMRef, clsx } from "@koobiq/react-core";
4
- import { useLink } from "@koobiq/react-primitives";
3
+ import { polymorphicForwardRef, clsx } from "@koobiq/react-core";
4
+ import { Link as Link$1 } from "@koobiq/react-primitives";
5
5
  import s from "./Link.module.css.js";
6
6
  const Link = polymorphicForwardRef((props, ref) => {
7
7
  const {
8
8
  variant = "text-normal",
9
9
  visitable = false,
10
10
  pseudo = false,
11
+ disabled,
11
12
  as = "a",
12
13
  startIcon,
13
14
  endIcon,
14
15
  children,
15
16
  className,
16
- style
17
+ ...other
17
18
  } = props;
18
- const Tag = as;
19
- const domRef = useDOMRef(ref);
20
- const elementType = as !== "a" && as !== "button" ? `${as}` : void 0;
21
- const { linkProps, hovered, pressed, focusVisible } = useLink(
22
- { ...props, elementType },
23
- domRef
24
- );
25
19
  const hasIcon = Boolean(startIcon || endIcon);
20
+ const elementType = as !== "a" && as !== "button" ? `${as}` : void 0;
26
21
  return /* @__PURE__ */ jsxs(
27
- Tag,
22
+ Link$1,
28
23
  {
29
- ...linkProps,
30
- className: clsx(
24
+ as,
25
+ disabled,
26
+ elementType,
27
+ ...disabled && { tabIndex: -1 },
28
+ className: ({ hovered, pressed, focusVisible }) => clsx(
31
29
  s.base,
32
30
  s[variant],
33
31
  pseudo && s.pseudo,
@@ -38,8 +36,8 @@ const Link = polymorphicForwardRef((props, ref) => {
38
36
  focusVisible && s.focusVisible,
39
37
  className
40
38
  ),
41
- style,
42
- ref: domRef,
39
+ ...other,
40
+ ref,
43
41
  children: [
44
42
  startIcon,
45
43
  children,
@@ -40,6 +40,8 @@ export type ListBaseProps<T extends object> = {
40
40
  onAction?: ListPropOnAction<T>;
41
41
  /** How multiple selection should behave in the collection. */
42
42
  selectionBehavior?: ListPropSelectionBehavior<T>;
43
+ /** Whether to autofocus the list or an option. */
44
+ autoFocus?: boolean | 'first' | 'last';
43
45
  /** The props used for each slot inside. */
44
46
  slotProps?: {
45
47
  label?: TypographyProps;
@@ -68,7 +68,7 @@ const Popover = forwardRef(
68
68
  triggerRef: anchorRef || controlRef,
69
69
  isKeyboardDismissDisabled: disableExitOnEscapeKeyDown
70
70
  },
71
- { ...state, isOpen: opened }
71
+ { ...state, isOpen: openState || opened }
72
72
  );
73
73
  const resolvedChildren = () => {
74
74
  if (typeof children === "function")
@@ -1,6 +1,7 @@
1
1
  import { jsxs, jsx } from "react/jsx-runtime";
2
2
  import { forwardRef } from "react";
3
3
  import { mergeProps, isNotNil, clsx } from "@koobiq/react-core";
4
+ import { IconCircleXs16 } from "@koobiq/react-icons";
4
5
  import { Radio as Radio$1 } from "@koobiq/react-primitives";
5
6
  import s from "./Radio.module.css.js";
6
7
  import { useRadioGroupState } from "../../RadioContext.js";
@@ -33,7 +34,7 @@ const Radio = forwardRef(
33
34
  const circleProps = mergeProps({ className: s.circle }, slotProps?.circle);
34
35
  const labelProps = slotProps?.label;
35
36
  return /* @__PURE__ */ jsxs(Radio$1, { ...commonProps, ref, children: [
36
- /* @__PURE__ */ jsx("span", { ...circleProps }),
37
+ /* @__PURE__ */ jsx("span", { ...circleProps, children: /* @__PURE__ */ jsx(IconCircleXs16, { className: s.icon }) }),
37
38
  isNotNil(children) && /* @__PURE__ */ jsx("span", { ...labelProps, children })
38
39
  ] });
39
40
  }
@@ -1,5 +1,6 @@
1
1
  const base = "kbq-radio-c3ed31";
2
2
  const circle = "kbq-radio-circle-a0903b";
3
+ const icon = "kbq-radio-icon-148a68";
3
4
  const normal = "kbq-radio-normal-81ed3e";
4
5
  const big = "kbq-radio-big-06db10";
5
6
  const hovered = "kbq-radio-hovered-3999f1";
@@ -12,6 +13,7 @@ const end = "kbq-radio-end-8689f9";
12
13
  const s = {
13
14
  base,
14
15
  circle,
16
+ icon,
15
17
  normal,
16
18
  big,
17
19
  hovered,
@@ -33,6 +35,7 @@ export {
33
35
  error,
34
36
  focusVisible,
35
37
  hovered,
38
+ icon,
36
39
  normal,
37
40
  start
38
41
  };
package/dist/style.css CHANGED
@@ -1542,14 +1542,15 @@
1542
1542
  --link-outline-width: var(--kbq-size-3xs);
1543
1543
  cursor: pointer;
1544
1544
  color: var(--kbq-foreground-theme);
1545
+ outline: var(--link-outline-width) solid;
1545
1546
  text-decoration: underline;
1546
1547
  -webkit-text-decoration-color: var(--kbq-line-theme-less);
1547
1548
  text-decoration-color: var(--kbq-line-theme-less);
1549
+ transition: color var(--kbq-transition-default), outline var(--kbq-transition-default), text-decoration-color var(--kbq-transition-default);
1548
1550
  background: none;
1549
1551
  border: none;
1550
- outline: none;
1552
+ outline-color: #0000;
1551
1553
  padding: 0;
1552
- transition: color;
1553
1554
  }
1554
1555
 
1555
1556
  .kbq-link-093ccd[aria-disabled="true"] {
@@ -1558,6 +1559,7 @@
1558
1559
  text-decoration: none;
1559
1560
  -webkit-text-decoration-color: var(--kbq-states-line-disabled);
1560
1561
  text-decoration-color: var(--kbq-states-line-disabled);
1562
+ outline-color: #0000;
1561
1563
  }
1562
1564
 
1563
1565
  .kbq-link-hovered-1916bc {
@@ -1574,6 +1576,7 @@
1574
1576
 
1575
1577
  .kbq-link-focusVisible-a98307 {
1576
1578
  color: var(--kbq-foreground-theme);
1579
+ outline-color: var(--kbq-states-line-focus-theme);
1577
1580
  -webkit-text-decoration-color: var(--kbq-line-theme-less);
1578
1581
  text-decoration-color: var(--kbq-line-theme-less);
1579
1582
  }
@@ -1596,13 +1599,8 @@
1596
1599
  text-decoration-color: var(--kbq-line-visited);
1597
1600
  }
1598
1601
 
1599
- .kbq-link-pseudo-5f21eb:where(:not(.kbq-link-pressed-0b493d, .kbq-link-hovered-1916bc)) {
1600
- text-decoration: none;
1601
- }
1602
-
1603
- .kbq-link-pseudo-5f21eb:where(.kbq-link-focusVisible-a98307) {
1604
- outline: var(--link-outline-width) solid var(--kbq-states-line-focus-theme);
1605
- outline-offset: -1px;
1602
+ .kbq-link-pseudo-5f21eb:where(:not(.kbq-link-pressed-0b493d, .kbq-link-hovered-1916bc)), .kbq-link-pseudo-5f21eb[aria-disabled="true"] {
1603
+ text-decoration-color: #0000;
1606
1604
  }
1607
1605
 
1608
1606
  .kbq-link-hasIcon-ea84d7 {
@@ -2016,6 +2014,10 @@
2016
2014
  --field-input-placeholder-color: var(--kbq-foreground-error-tertiary);
2017
2015
  }
2018
2016
 
2017
+ .kbq-fieldinput-disabled-59285a {
2018
+ cursor: not-allowed;
2019
+ }
2020
+
2019
2021
  .kbq-fieldinput-filled-abb632:where(.kbq-fieldinput-disabled-59285a) {
2020
2022
  --field-input-color: var(--kbq-states-foreground-disabled);
2021
2023
  --field-input-border-color: var(--kbq-states-line-disabled);
@@ -2102,10 +2104,10 @@
2102
2104
  --radio-border-radius: 50%;
2103
2105
  --radio-icon-color: transparent;
2104
2106
  --radio-outline-color: transparent;
2105
- --radio-color: var(--kbq-foreground-contrast);
2106
2107
  --radio-icon-size: var(--kbq-size-xs);
2107
2108
  --radio-outline-width: var(--kbq-size-3xs);
2108
2109
  --radio-bg-color: var(--kbq-background-bg);
2110
+ --radio-color: var(--kbq-foreground-contrast);
2109
2111
  --radio-border-width: var(--kbq-size-border-width);
2110
2112
  --radio-border-color: var(--kbq-line-contrast-fade);
2111
2113
  cursor: pointer;
@@ -2125,24 +2127,19 @@
2125
2127
  margin-block: var(--radio-margin-block);
2126
2128
  border-radius: var(--radio-border-radius);
2127
2129
  border: var(--radio-border-width) solid var(--radio-border-color);
2128
- transition: background-color var(--kbq-transition-default), border var(--kbq-transition-default), outline-color var(--kbq-transition-default), color var(--kbq-transition-default);
2130
+ transition: background-color var(--kbq-transition-default), border var(--kbq-transition-default), outline-color var(--kbq-transition-default);
2129
2131
  outline-offset: calc(-1 * var(--radio-outline-width) / 2);
2130
2132
  outline: var(--radio-outline-width) solid var(--radio-outline-color);
2131
- position: relative;
2133
+ justify-content: center;
2134
+ align-items: center;
2135
+ display: flex;
2132
2136
  }
2133
2137
 
2134
- .kbq-radio-circle-a0903b:before {
2135
- content: "";
2136
- opacity: var(--radio-opacity);
2137
- block-size: var(--radio-icon-size);
2138
- inline-size: var(--radio-icon-size);
2139
- transition: opacity var(--kbq-transition-default);
2140
- background-color: currentColor;
2141
- border-radius: 50%;
2142
- position: absolute;
2143
- inset-block-start: 50%;
2144
- inset-inline-start: 50%;
2145
- transform: translate(-50%, -50%);
2138
+ .kbq-radio-icon-148a68 {
2139
+ opacity: 0;
2140
+ transition: transform var(--kbq-transition-slow), opacity var(--kbq-transition-slow);
2141
+ flex-shrink: 0;
2142
+ transform: scale(.1);
2146
2143
  }
2147
2144
 
2148
2145
  .kbq-radio-normal-81ed3e {
@@ -2185,6 +2182,11 @@
2185
2182
  --radio-opacity: 1;
2186
2183
  }
2187
2184
 
2185
+ .kbq-radio-checked-a71e68 .kbq-radio-icon-148a68 {
2186
+ opacity: 1;
2187
+ transform: scale(1);
2188
+ }
2189
+
2188
2190
  .kbq-radio-checked-a71e68:where(.kbq-radio-hovered-3999f1) {
2189
2191
  --radio-icon-color: var(--kbq-white-default);
2190
2192
  --radio-bg-color: var(--kbq-states-background-theme-hover);
@@ -2945,6 +2947,7 @@
2945
2947
  transform: var(--popover-transform);
2946
2948
  }
2947
2949
  .kbq-list-928929 {
2950
+ outline: none;
2948
2951
  margin: 0;
2949
2952
  padding: 0;
2950
2953
  list-style: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koobiq/react-components",
3
- "version": "0.0.1-beta.8",
3
+ "version": "0.0.1-beta.9",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -22,10 +22,10 @@
22
22
  "@koobiq/design-tokens": "^3.12.1",
23
23
  "@types/react-transition-group": "^4.4.12",
24
24
  "react-transition-group": "^4.4.5",
25
- "@koobiq/logger": "0.0.1-beta.8",
26
- "@koobiq/react-core": "0.0.1-beta.8",
27
- "@koobiq/react-icons": "0.0.1-beta.8",
28
- "@koobiq/react-primitives": "0.0.1-beta.8"
25
+ "@koobiq/logger": "0.0.1-beta.9",
26
+ "@koobiq/react-core": "0.0.1-beta.9",
27
+ "@koobiq/react-primitives": "0.0.1-beta.9",
28
+ "@koobiq/react-icons": "0.0.1-beta.9"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@koobiq/design-tokens": "^3.11.2",