haze-ui 1.9.0 → 1.10.0

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,22 +1,25 @@
1
1
  import { classnames as e } from "../../utils/classnames.js";
2
2
  /* empty css */
3
3
  import { jsx as t } from "react/jsx-runtime";
4
+ import { forwardRef as n } from "react";
4
5
  //#region src/lib/components/NavigationBar/NavLink.tsx
5
- var n = "haze-NavLink__link", r = "haze-NavLink__activeLink";
6
- function i({ href: i = "#", active: a, children: o, onClick: s, className: c }) {
6
+ var r = "haze-NavLink__link", i = "haze-NavLink__activeLink", a = n(function({ href: n = "#", active: a, children: o, onClick: s, className: c, "aria-current": l, ...u }, d) {
7
+ let f = a ?? l === "page";
7
8
  return /* @__PURE__ */ t("a", {
8
- href: i,
9
+ ref: d,
10
+ href: n,
11
+ "aria-current": f ? "page" : l,
9
12
  onClick: (e) => {
10
- s && (e.preventDefault(), s());
13
+ n === "#" && e.preventDefault(), s?.(e);
11
14
  },
12
- "aria-current": a ? "page" : void 0,
15
+ ...u,
13
16
  className: e([
14
- n,
15
- a && r,
17
+ r,
18
+ f && i,
16
19
  c
17
20
  ]),
18
21
  children: o
19
22
  });
20
- }
23
+ });
21
24
  //#endregion
22
- export { i as default };
25
+ export { a as default };
@@ -1,10 +1,42 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ComponentPropsWithoutRef, MouseEvent, ReactNode } from 'react';
2
+ /**
3
+ * Extends the native `<a>` attributes. Everything not listed below is spread
4
+ * onto the rendered anchor, so callers (and routers composing NavLink via
5
+ * their `as` prop) can inject `target`, `rel`, `aria-*`, and friends.
6
+ */
2
7
  type NavLinkProps = {
3
8
  href?: string;
9
+ /**
10
+ * Explicit active state. Falls back to `aria-current="page"` when omitted,
11
+ * letting routers drive highlighting through the standard aria attribute.
12
+ */
4
13
  active?: boolean;
5
14
  children: ReactNode;
6
- onClick?: () => void;
15
+ /**
16
+ * Native click handler: receives the underlying mouse event. Whether to
17
+ * call `event.preventDefault()` is up to the caller (an SPA router Link
18
+ * does so itself), except for placeholder hrefs where NavLink keeps
19
+ * button semantics (see the onClick handler below).
20
+ */
21
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
7
22
  className?: string;
8
- };
9
- export default function NavLink({ href, active, children, onClick, className }: NavLinkProps): import("react").JSX.Element;
23
+ } & Omit<ComponentPropsWithoutRef<'a'>, 'href' | 'children' | 'onClick' | 'className'>;
24
+ declare const _default: import("react").ForwardRefExoticComponent<{
25
+ href?: string;
26
+ /**
27
+ * Explicit active state. Falls back to `aria-current="page"` when omitted,
28
+ * letting routers drive highlighting through the standard aria attribute.
29
+ */
30
+ active?: boolean;
31
+ children: ReactNode;
32
+ /**
33
+ * Native click handler: receives the underlying mouse event. Whether to
34
+ * call `event.preventDefault()` is up to the caller (an SPA router Link
35
+ * does so itself), except for placeholder hrefs where NavLink keeps
36
+ * button semantics (see the onClick handler below).
37
+ */
38
+ onClick?: (event: MouseEvent<HTMLAnchorElement>) => void;
39
+ className?: string;
40
+ } & Omit<Omit<import("react").DetailedHTMLProps<import("react").AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, "ref">, "className" | "children" | "onClick" | "href"> & import("react").RefAttributes<HTMLAnchorElement>>;
41
+ export default _default;
10
42
  export type { NavLinkProps };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "haze-ui",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "type": "module",
5
5
  "description": "A React UI component library powered by react-use-control and Linaria",
6
6
  "main": "./dist/index.js",
@@ -55,7 +55,7 @@
55
55
  "react-f0rm": ">=0.3.0"
56
56
  },
57
57
  "dependencies": {
58
- "react-toolroom": "^0.7.0",
58
+ "react-toolroom": "^0.11.0",
59
59
  "react-use-control": "^1.3.2"
60
60
  },
61
61
  "devDependencies": {
@@ -65,26 +65,26 @@
65
65
  "@faker-js/faker": "^10.6.0",
66
66
  "@for-fun/event-emitter": "^1.0.1",
67
67
  "@linaria/core": "^8.2.0",
68
- "@native-router/core": "^1.5.0",
69
- "@native-router/react": "^1.3.0",
68
+ "@native-router/core": "^1.8.0",
69
+ "@native-router/react": "^1.6.1",
70
70
  "@testing-library/jest-dom": "^7.0.1",
71
71
  "@testing-library/react": "^16.3.2",
72
72
  "@testing-library/user-event": "^14.6.6",
73
73
  "@types/jest-axe": "^3.5.9",
74
- "@types/node": "^26.2.0",
74
+ "@types/node": "^26.3.0",
75
75
  "@types/ramda": "^0.32.0",
76
76
  "@types/react": "^19.2.18",
77
- "@types/react-dom": "^19.2.4",
77
+ "@types/react-dom": "^19.2.5",
78
78
  "@vitejs/plugin-react": "^6.1.0",
79
79
  "@vitest/coverage-v8": "4.1.11",
80
- "@wyw-in-js/babel-preset": "^2.4.2",
81
- "@wyw-in-js/vite": "^2.4.2",
80
+ "@wyw-in-js/babel-preset": "^2.4.3",
81
+ "@wyw-in-js/vite": "^2.4.3",
82
82
  "babel-plugin-transform-jsx-class": "^0.1.3",
83
83
  "babel-plugin-transform-jsx-condition": "^0.1.3",
84
84
  "commitizen": "^4.3.2",
85
85
  "core-js": "^3.50.0",
86
86
  "date-fns": "^4.4.0",
87
- "eslint": "^10.9.0",
87
+ "eslint": "^10.9.1",
88
88
  "eslint-plugin-compat": "^7.0.2",
89
89
  "gh-pages": "^6.3.0",
90
90
  "husky": "^9.1.7",
@@ -92,7 +92,7 @@
92
92
  "jsdom": "^30.0.1",
93
93
  "json-schema-faker": "^0.6.3",
94
94
  "lint-staged": "^17.3.0",
95
- "lucide-react": "^1.33.0",
95
+ "lucide-react": "^1.34.0",
96
96
  "prettier": "^3.9.6",
97
97
  "qss": "^3.0.0",
98
98
  "ramda": "^0.32.0",
@@ -102,7 +102,7 @@
102
102
  "react-icons": "^5.7.0",
103
103
  "rollup-plugin-type-as-json-schema": "^0.2.6",
104
104
  "semantic-release": "^25.0.9",
105
- "terser": "^5.50.0",
105
+ "terser": "^5.51.0",
106
106
  "tools-config": "^0.3.0",
107
107
  "tsc-alias": "^1.9.2",
108
108
  "typescript": "^6.0.3",