@phillips/seldon 1.279.0 → 1.279.1

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 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),t=require("../../../utils/index.cjs"),m=require("../../../_virtual/index2.cjs"),q=require("../../Link/Link.cjs"),p=require("../../Link/types.cjs"),k=require("react"),l=require("../../../node_modules/@radix-ui/react-navigation-menu/dist/index.cjs"),o=k.forwardRef(({badge:d,className:x="",href:v,isViewAllLink:_=!1,label:i,navGroup:$,navType:c,onClick:u,element:h=q.default,isMobile:j,asRadixSubmenuLink:N,...a},s)=>{const n=m.default(`${t.px}-nav__item`,`${t.px}-nav__item--${$}`,x),r=e.jsxs(h,{className:m.default({[`${t.px}-nav__item--view-all`]:_}),href:v,variant:c||p.LinkVariants.linkStylised,onClick:u,children:[e.jsx("span",{className:`${t.px}-nav__item--label`,children:i}),d?e.jsx("span",{className:`${t.px}-nav__item--badge `,children:` • ${d}`}):null]});if(j===!1){const{value:g,...f}=a;return e.jsx(l.Item,{ref:s,"data-testid":`nav-item-${i}`,className:n,...f,children:e.jsx(l.Link,{asChild:!0,children:r})})}return N?e.jsx("li",{...a,"data-testid":`nav-item-${i}`,className:n,ref:s,children:e.jsx(l.Link,{asChild:!0,children:r})}):e.jsx("li",{...a,onClick:u,"data-testid":`nav-item-${i}`,className:n,ref:s,children:r})});o.displayName="NavigationItem";exports.default=o;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),a=require("../../../utils/index.cjs"),_=require("../../../_virtual/index2.cjs"),g=require("../../Link/Link.cjs"),p=require("../../Link/types.cjs"),$=require("react"),c=require("../../../node_modules/@radix-ui/react-navigation-menu/dist/index.cjs"),K=require("../../../site-furniture/Header/Header.cjs"),f=$.forwardRef(({badge:d,className:h="",href:u,isViewAllLink:v=!1,label:i,navGroup:j,navType:o,onClick:m,element:N=g.default,isMobile:q,asRadixSubmenuLink:k,...s},n)=>{const{closeMenu:y}=$.useContext(K.HeaderContext),l=_.default(`${a.px}-nav__item`,`${a.px}-nav__item--${j}`,h),C=e=>{m?.(e),u&&!e.defaultPrevented&&e.button===0&&!(e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)&&y?.()},r=t.jsxs(N,{className:_.default({[`${a.px}-nav__item--view-all`]:v}),href:u,variant:o||p.LinkVariants.linkStylised,onClick:C,children:[t.jsx("span",{className:`${a.px}-nav__item--label`,children:i}),d?t.jsx("span",{className:`${a.px}-nav__item--badge `,children:` • ${d}`}):null]});if(q===!1){const{value:e,...x}=s;return t.jsx(c.Item,{ref:n,"data-testid":`nav-item-${i}`,className:l,...x,children:t.jsx(c.Link,{asChild:!0,children:r})})}return k?t.jsx("li",{...s,"data-testid":`nav-item-${i}`,className:l,ref:n,children:t.jsx(c.Link,{asChild:!0,children:r})}):t.jsx("li",{...s,onClick:m,"data-testid":`nav-item-${i}`,className:l,ref:n,children:r})});f.displayName="NavigationItem";exports.default=f;
@@ -1,7 +1,11 @@
1
1
  import { LinkProps } from '../../Link/Link';
2
2
  import { LinkVariants } from '../../Link/types';
3
- import { ComponentProps, ElementType, ReactNode } from 'react';
3
+ import { ComponentProps, ElementType, MouseEventHandler, ReactNode } from 'react';
4
4
  export interface NavigationItemProps extends ComponentProps<'li'> {
5
+ /**
6
+ * Widened from the `li` handler because it is also attached to the rendered link element
7
+ */
8
+ onClick?: MouseEventHandler<HTMLElement>;
5
9
  /**
6
10
  * Optional badge for navigation item. Used currently for location of auctions
7
11
  */
@@ -1,48 +1,51 @@
1
- import { jsxs as k, jsx as a } from "react/jsx-runtime";
2
- import { px as t } from "../../../utils/index.js";
3
- import d from "../../../_virtual/index2.js";
4
- import x from "../../Link/Link.js";
5
- import { LinkVariants as L } from "../../Link/types.js";
6
- import { forwardRef as C } from "react";
7
- import { Item as I, Link as c } from "../../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
8
- const g = C(
1
+ import { jsxs as y, jsx as a } from "react/jsx-runtime";
2
+ import { px as i } from "../../../utils/index.js";
3
+ import u from "../../../_virtual/index2.js";
4
+ import g from "../../Link/Link.js";
5
+ import { LinkVariants as K } from "../../Link/types.js";
6
+ import { forwardRef as L, useContext as I } from "react";
7
+ import { Item as j, Link as h } from "../../../node_modules/@radix-ui/react-navigation-menu/dist/index.js";
8
+ import { HeaderContext as w } from "../../../site-furniture/Header/Header.js";
9
+ const P = L(
9
10
  ({
10
- badge: r,
11
- className: f = "",
12
- href: v,
13
- isViewAllLink: _ = !1,
14
- label: i,
15
- navGroup: $,
16
- navType: l,
17
- onClick: o,
18
- element: h = x,
19
- isMobile: N,
20
- asRadixSubmenuLink: u,
21
- ...e
11
+ badge: l,
12
+ className: _ = "",
13
+ href: o,
14
+ isViewAllLink: $ = !1,
15
+ label: e,
16
+ navGroup: N,
17
+ navType: c,
18
+ onClick: d,
19
+ element: p = g,
20
+ isMobile: v,
21
+ asRadixSubmenuLink: k,
22
+ ...s
22
23
  }, n) => {
23
- const s = d(`${t}-nav__item`, `${t}-nav__item--${$}`, f), m = /* @__PURE__ */ k(
24
- h,
24
+ const { closeMenu: C } = I(w), m = u(`${i}-nav__item`, `${i}-nav__item--${N}`, _), x = (t) => {
25
+ d?.(t), o && !t.defaultPrevented && t.button === 0 && !(t.metaKey || t.ctrlKey || t.shiftKey || t.altKey) && C?.();
26
+ }, r = /* @__PURE__ */ y(
27
+ p,
25
28
  {
26
- className: d({
27
- [`${t}-nav__item--view-all`]: _
29
+ className: u({
30
+ [`${i}-nav__item--view-all`]: $
28
31
  }),
29
- href: v,
30
- variant: l || L.linkStylised,
31
- onClick: o,
32
+ href: o,
33
+ variant: c || K.linkStylised,
34
+ onClick: x,
32
35
  children: [
33
- /* @__PURE__ */ a("span", { className: `${t}-nav__item--label`, children: i }),
34
- r ? /* @__PURE__ */ a("span", { className: `${t}-nav__item--badge `, children: ` • ${r}` }) : null
36
+ /* @__PURE__ */ a("span", { className: `${i}-nav__item--label`, children: e }),
37
+ l ? /* @__PURE__ */ a("span", { className: `${i}-nav__item--badge `, children: ` • ${l}` }) : null
35
38
  ]
36
39
  }
37
40
  );
38
- if (N === !1) {
39
- const { value: j, ...p } = e;
40
- return /* @__PURE__ */ a(I, { ref: n, "data-testid": `nav-item-${i}`, className: s, ...p, children: /* @__PURE__ */ a(c, { asChild: !0, children: m }) });
41
+ if (v === !1) {
42
+ const { value: t, ...f } = s;
43
+ return /* @__PURE__ */ a(j, { ref: n, "data-testid": `nav-item-${e}`, className: m, ...f, children: /* @__PURE__ */ a(h, { asChild: !0, children: r }) });
41
44
  }
42
- return u ? /* @__PURE__ */ a("li", { ...e, "data-testid": `nav-item-${i}`, className: s, ref: n, children: /* @__PURE__ */ a(c, { asChild: !0, children: m }) }) : /* @__PURE__ */ a("li", { ...e, onClick: o, "data-testid": `nav-item-${i}`, className: s, ref: n, children: m });
45
+ return k ? /* @__PURE__ */ a("li", { ...s, "data-testid": `nav-item-${e}`, className: m, ref: n, children: /* @__PURE__ */ a(h, { asChild: !0, children: r }) }) : /* @__PURE__ */ a("li", { ...s, onClick: d, "data-testid": `nav-item-${e}`, className: m, ref: n, children: r });
43
46
  }
44
47
  );
45
- g.displayName = "NavigationItem";
48
+ P.displayName = "NavigationItem";
46
49
  export {
47
- g as default
50
+ P as default
48
51
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.279.0",
3
+ "version": "1.279.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"