@pushwoosh/dumb-components 2.9.4 → 2.9.6

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.
package/Badge/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Ref, ReactNode } from 'react';
1
+ import type { JSX, Ref, ReactNode } from 'react';
2
2
  /** Color of a {@link Badge}. */
3
3
  export type BadgeColor = 'gray' | 'green' | 'orange' | 'red' | 'purple' | 'sky' | 'locked' | 'black';
4
4
  /** Props of {@link Badge} — all `<div>` attributes plus the badge-specific ones. */
@@ -18,7 +18,7 @@ export const CalendarRangePicker = ({
18
18
  firstDayOfWeek,
19
19
  initialVisibleMonth
20
20
  }) => {
21
- const startMonthRef = useRef();
21
+ const startMonthRef = useRef(undefined);
22
22
  if (!startMonthRef.current) {
23
23
  const d = new Date();
24
24
  startMonthRef.current = initialVisibleMonth ?? value[0] ?? {
@@ -28,7 +28,7 @@ export function Drawer({
28
28
  withoutLockScreen = false,
29
29
  closeOnClickOutside = true
30
30
  }) {
31
- const ref = useRef();
31
+ const ref = useRef(undefined);
32
32
  const [element] = useState(createDivElement);
33
33
  const {
34
34
  zIndex: resolvedZIndex
package/Link/Link.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { type ReactElement } from 'react';
1
+ import { type JSX, type ReactElement } from 'react';
2
2
  import type { LinkPropsWithoutAs, LinkPropsWithAsTag, LinkPropsWithAsComponent } from './types';
3
3
  /**
4
4
  * Styled hyperlink. Renders a native `<a>` by default.
package/Link/types.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import type { Ref, ReactNode, ComponentType } from 'react';
1
+ import type { JSX, Ref, ReactNode, ComponentType } from 'react';
2
2
  /** Default {@link Link} props — renders a styled `<a>` (requires `title` and `href`). */
3
3
  export type LinkPropsWithoutAs = Omit<JSX.IntrinsicElements['a'], 'ref'> & {
4
4
  /** Ref to the `<a>` element. */
@@ -26,7 +26,7 @@ export function Modal(props) {
26
26
  onClose,
27
27
  children
28
28
  } = props;
29
- const ref = useRef();
29
+ const ref = useRef(undefined);
30
30
  const [element] = useState(createDivElement);
31
31
  const {
32
32
  zIndex: resolvedZIndex
@@ -155,7 +155,9 @@ export function NotificationInbox({
155
155
  children: notification.title
156
156
  }), notification.description && _jsx(NotificationDescription, {
157
157
  as: "div",
158
- ref: element => descriptionRefs.current[notification.id] = element || null,
158
+ ref: element => {
159
+ descriptionRefs.current[notification.id] = element || null;
160
+ },
159
161
  "$variant": "standard",
160
162
  "$color": Color.MAIN,
161
163
  "$visibleLines": VISIBLE_LINES,
@@ -1,4 +1,4 @@
1
- import type { Ref } from 'react';
1
+ import type { JSX, Ref } from 'react';
2
2
  /** Props of {@link Pagination} — all `<div>` attributes plus the pagination-specific ones. */
3
3
  export type PaginationProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & {
4
4
  /** Ref to the container `<div>`. */
@@ -1,4 +1,4 @@
1
- import type { Ref } from 'react';
1
+ import type { JSX, Ref } from 'react';
2
2
  /** Current sort order of a column: ascending, descending, or unsorted (`null`). */
3
3
  export type SortButtonOrder = 'asc' | 'desc' | null;
4
4
  /** Arrow icon state shown by a {@link SortButton}. */
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { JSX, ReactNode } from 'react';
2
2
  import type { TabCode } from '../../types';
3
3
  /** Props of {@link Tab} — all `<div>` attributes plus the tab-specific ones. */
4
4
  export type TabProps = Omit<JSX.IntrinsicElements['div'], 'ref' | 'onClick'> & Readonly<{
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { JSX, ReactNode } from 'react';
2
2
  /** How a {@link TabBar} lays out its tabs. */
3
3
  export type TabBarLayout =
4
4
  /** Tabs take their content width; overflowing tabs scroll behind arrows. */
@@ -1 +1,2 @@
1
+ import type { JSX } from 'react';
1
2
  export type TabsListSlideFrameProps = Omit<JSX.IntrinsicElements['div'], 'ref'>;
@@ -1,4 +1,4 @@
1
- import type { ReactNode } from 'react';
1
+ import type { JSX, ReactNode } from 'react';
2
2
  export type TabBaseProps = Omit<JSX.IntrinsicElements['div'], 'ref'> & Readonly<{
3
3
  isActive?: boolean;
4
4
  isDisabled?: boolean;
@@ -8,5 +8,5 @@ type ElementWidth = number | null;
8
8
  * @returns a tuple of the current width (`null` before first measure) and a
9
9
  * `forceUpdate` callback to re-measure on demand
10
10
  */
11
- export declare function useElementWidth(ref: RefObject<HTMLElement>): [ElementWidth, ForceUpdate];
11
+ export declare function useElementWidth(ref: RefObject<HTMLElement | null>): [ElementWidth, ForceUpdate];
12
12
  export {};
@@ -3,4 +3,4 @@ import { type ThemeName } from '@pushwoosh/kit-constants';
3
3
  /** Current theme as a value, for widgets that cannot read `var(--pw-color-*)` — canvas, shadow DOM.
4
4
  * @param ref - element inside the theme scope, so a light island wins over the document theme
5
5
  * @param isEnabled - pass `false` when the caller already knows the theme and needs no observer */
6
- export declare function useThemeName(ref?: RefObject<Element>, isEnabled?: boolean): ThemeName;
6
+ export declare function useThemeName(ref?: RefObject<Element | null>, isEnabled?: boolean): ThemeName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pushwoosh/dumb-components",
3
- "version": "2.9.4",
3
+ "version": "2.9.6",
4
4
  "description": "React components to build Pushwoosh products",
5
5
  "main": "index.js",
6
6
  "module": "index.js",
@@ -43,7 +43,7 @@
43
43
  "@pushwoosh/kit-constants": "^2.1.0",
44
44
  "@pushwoosh/kit-helpers": "^4.12.7",
45
45
  "@pushwoosh/kit-icons": "^2.3.3",
46
- "@pushwoosh/kit-typography": "^1.8.6",
46
+ "@pushwoosh/kit-typography": "^1.8.7",
47
47
  "@tippyjs/react": "^4.2.6",
48
48
  "@uiw/codemirror-themes": "^4.23.8",
49
49
  "@uiw/react-codemirror": "^4.23.8",
@@ -10,5 +10,5 @@ export declare function defaultLabelFilter<T>(item: T, query: string, getLabel:
10
10
  * Mousedown handler for the field shell: refocuses the input and opens the dropdown,
11
11
  * while letting clicks on the input itself or on inner buttons through.
12
12
  */
13
- export declare function useShellMouseDown(inputRef: RefObject<HTMLInputElement>, isOpen: boolean, open: () => void): (event: MouseEvent<HTMLDivElement>) => void;
14
- export declare function useToggleOpen(inputRef: RefObject<HTMLInputElement>, isOpen: boolean, open: () => void, close: () => void): () => void;
13
+ export declare function useShellMouseDown(inputRef: RefObject<HTMLInputElement | null>, isOpen: boolean, open: () => void): (event: MouseEvent<HTMLDivElement>) => void;
14
+ export declare function useToggleOpen(inputRef: RefObject<HTMLInputElement | null>, isOpen: boolean, open: () => void, close: () => void): () => void;
@@ -5,7 +5,7 @@ type Args = {
5
5
  onClose?: () => void;
6
6
  autoFocus?: boolean;
7
7
  disabled?: boolean;
8
- inputRef: RefObject<HTMLInputElement>;
8
+ inputRef: RefObject<HTMLInputElement | null>;
9
9
  };
10
10
  /**
11
11
  * Side effects tied to a Combobox field's open state: optional autofocus on mount