@koobiq/react-primitives 0.0.1-beta.12 → 0.0.1-beta.13

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.
@@ -2,7 +2,7 @@
2
2
  import { useFocusRing, useHover, mergeProps } from "@koobiq/react-core";
3
3
  import { useButton as useButton$1 } from "@react-aria/button";
4
4
  function useButton(props, ref) {
5
- const { onClick, onPress, disabled, ...otherProps } = props;
5
+ const { disabled, ...otherProps } = props;
6
6
  const {
7
7
  focusProps,
8
8
  isFocused: focused,
@@ -17,7 +17,6 @@ function useButton(props, ref) {
17
17
  const { buttonProps: commonButtonProps, isPressed: pressed } = useButton$1(
18
18
  {
19
19
  ...otherProps,
20
- onPress: onPress || onClick,
21
20
  isDisabled: disabled
22
21
  },
23
22
  ref
@@ -3,7 +3,6 @@ import type { ExtendableProps } from '@koobiq/react-core';
3
3
  import type { AriaLinkOptions } from '@react-aria/link';
4
4
  export type UseLinkProps = ExtendableProps<{
5
5
  disabled?: boolean;
6
- onClick?: AriaLinkOptions['onPress'];
7
6
  }, Omit<AriaLinkOptions, 'isDisabled'>>;
8
7
  export declare function useLink(props: UseLinkProps, ref: RefObject<HTMLElement | null>): {
9
8
  linkProps: import("@react-types/shared").DOMAttributes<import("@react-types/shared").FocusableElement>;
@@ -2,7 +2,7 @@
2
2
  import { useHover, useFocusRing, mergeProps } from "@koobiq/react-core";
3
3
  import { useLink as useLink$1 } from "@react-aria/link";
4
4
  function useLink(props, ref) {
5
- const { disabled, onClick, ...otherProps } = props;
5
+ const { disabled, ...otherProps } = props;
6
6
  const { hoverProps, isHovered } = useHover({
7
7
  ...otherProps,
8
8
  isDisabled: disabled
@@ -11,7 +11,6 @@ function useLink(props, ref) {
11
11
  const { linkProps: commonLinkProps, isPressed } = useLink$1(
12
12
  {
13
13
  ...otherProps,
14
- onPress: onClick,
15
14
  isDisabled: disabled
16
15
  },
17
16
  ref
@@ -26,7 +26,7 @@ const Button = polymorphicForwardRef(
26
26
  const { hovered, pressed, focused, focusVisible, buttonProps } = useButton(
27
27
  {
28
28
  ...commonProps,
29
- ...loading && {
29
+ ...(loading || disabled) && {
30
30
  onPress: void 0,
31
31
  onPressStart: void 0,
32
32
  onPressEnd: void 0,
@@ -5,9 +5,24 @@ import { useRenderProps } from "../../utils/index.js";
5
5
  import { useLink } from "../../behaviors/useLink.js";
6
6
  const Link = polymorphicForwardRef((props, ref) => {
7
7
  const { as: Tag = "a", ...commonProps } = props;
8
+ const { disabled } = commonProps;
8
9
  const domRef = useDOMRef(ref);
9
10
  const { hovered, pressed, focused, focusVisible, linkProps } = useLink(
10
- commonProps,
11
+ {
12
+ ...commonProps,
13
+ ...disabled && {
14
+ onPress: void 0,
15
+ onPressStart: void 0,
16
+ onPressEnd: void 0,
17
+ onPressChange: void 0,
18
+ onPressUp: void 0,
19
+ onKeyDown: void 0,
20
+ onKeyUp: void 0,
21
+ onClick: void 0,
22
+ href: void 0
23
+ },
24
+ disabled
25
+ },
11
26
  domRef
12
27
  );
13
28
  const renderValues = {
package/dist/index.d.ts CHANGED
@@ -10,8 +10,8 @@ import { useOverlayTriggerState, type OverlayTriggerState } from '@react-stately
10
10
  import { useSelectState } from '@react-stately/select';
11
11
  import type { TooltipTriggerProps } from '@react-stately/tooltip';
12
12
  import { useTooltipTriggerState } from '@react-stately/tooltip';
13
- import type { HoverEvent, Node, ItemProps, SectionProps, LinkDOMProps } from '@react-types/shared';
13
+ import type { Node, PressEvent, HoverEvent, ItemProps, SectionProps, LinkDOMProps, FocusableElement } from '@react-types/shared';
14
14
  export * from './behaviors/index.js';
15
15
  export * from './components/index.js';
16
- export { Item, Overlay, Section, useLocale, useDialog, useOption, useSelect, usePopover, useListBox, useTooltip, I18nProvider, useListState, HiddenSelect, useSelectState, useModalOverlay, useOverlayTrigger, useTooltipTrigger, useListBoxSection, useOverlayPosition, useOverlayTriggerState, useTooltipTriggerState, useLocalizedStringFormatter, type Node, type ItemProps, type ListState, type HoverEvent, type LinkDOMProps, type SectionProps, type AriaDialogProps, type I18nProviderProps, type AriaListBoxProps, type TooltipTriggerProps, type OverlayTriggerState, type AriaModalOverlayProps, };
16
+ export { Item, Overlay, Section, useLocale, useDialog, useOption, useSelect, usePopover, useListBox, useTooltip, I18nProvider, useListState, HiddenSelect, useSelectState, useModalOverlay, useOverlayTrigger, useTooltipTrigger, useListBoxSection, useOverlayPosition, useOverlayTriggerState, useTooltipTriggerState, useLocalizedStringFormatter, type Node, type ItemProps, type ListState, type PressEvent, type HoverEvent, type LinkDOMProps, type FocusableElement, type SectionProps, type AriaDialogProps, type I18nProviderProps, type AriaListBoxProps, type TooltipTriggerProps, type OverlayTriggerState, type AriaModalOverlayProps, };
17
17
  export * from './types';
package/dist/types.d.ts CHANGED
@@ -1,8 +1,11 @@
1
1
  import type { ElementType } from 'react';
2
2
  import type { AriaButtonOptions } from '@react-aria/button';
3
+ import type { AriaLinkOptions } from '@react-aria/link';
3
4
  export type ButtonOptions = Omit<AriaButtonOptions<ElementType>, 'isDisabled'> & {
4
5
  /** Whether the button is disabled. */
5
6
  disabled?: boolean;
6
- /** Handler that is called when the press is released over the target. */
7
- onClick?: AriaButtonOptions<ElementType>['onPress'];
7
+ };
8
+ export type LinkOptions = Omit<AriaLinkOptions, 'isDisabled'> & {
9
+ /** Whether the button is disabled. */
10
+ disabled?: boolean;
8
11
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@koobiq/react-primitives",
3
- "version": "0.0.1-beta.12",
3
+ "version": "0.0.1-beta.13",
4
4
  "main": "./dist/index.js",
5
5
  "types": "./dist/index.d.ts",
6
6
  "exports": {
@@ -45,8 +45,8 @@
45
45
  "@react-stately/radio": "^3.10.8",
46
46
  "@react-stately/select": "^3.6.11",
47
47
  "@react-stately/tooltip": "^3.4.13",
48
- "@koobiq/logger": "0.0.1-beta.12",
49
- "@koobiq/react-core": "0.0.1-beta.12"
48
+ "@koobiq/logger": "0.0.1-beta.13",
49
+ "@koobiq/react-core": "0.0.1-beta.13"
50
50
  },
51
51
  "peerDependencies": {
52
52
  "react": "18.x || 19.x",