@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
|
|
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
|
|
2
|
-
import { px as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { LinkVariants as
|
|
6
|
-
import { forwardRef as
|
|
7
|
-
import { Item as
|
|
8
|
-
|
|
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:
|
|
11
|
-
className:
|
|
12
|
-
href:
|
|
13
|
-
isViewAllLink:
|
|
14
|
-
label:
|
|
15
|
-
navGroup:
|
|
16
|
-
navType:
|
|
17
|
-
onClick:
|
|
18
|
-
element:
|
|
19
|
-
isMobile:
|
|
20
|
-
asRadixSubmenuLink:
|
|
21
|
-
...
|
|
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
|
|
24
|
-
|
|
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:
|
|
27
|
-
[`${
|
|
29
|
+
className: u({
|
|
30
|
+
[`${i}-nav__item--view-all`]: $
|
|
28
31
|
}),
|
|
29
|
-
href:
|
|
30
|
-
variant:
|
|
31
|
-
onClick:
|
|
32
|
+
href: o,
|
|
33
|
+
variant: c || K.linkStylised,
|
|
34
|
+
onClick: x,
|
|
32
35
|
children: [
|
|
33
|
-
/* @__PURE__ */ a("span", { className: `${
|
|
34
|
-
|
|
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 (
|
|
39
|
-
const { value:
|
|
40
|
-
return /* @__PURE__ */ a(
|
|
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
|
|
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
|
-
|
|
48
|
+
P.displayName = "NavigationItem";
|
|
46
49
|
export {
|
|
47
|
-
|
|
50
|
+
P as default
|
|
48
51
|
};
|