@phillips/seldon 1.279.0 → 1.279.2

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
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),E=require("react"),R=require("../../_virtual/index2.cjs"),V=require("../../utils/index.cjs"),A=require("../../components/Input/Input.cjs"),B=require("../../components/Button/Button.cjs"),a=require("./types.cjs"),C=require("../../components/Button/types.cjs"),l=require("../../components/Text/Text.cjs"),p=require("../../components/Text/types.cjs");function I(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const L=I(E),g=L.forwardRef(({autoFocus:e=!0,blurb:t,buttonText:n="Sign Up",buttonProps:s,className:u,element:S="form",inputLabelText:b="Enter Your Email Address To Sign Up*",inputPlaceholder:x="example@email.com",title:y="Never Miss A Moment",loadingText:j="Loading...",invalidText:v="",errorText:q="An error occurred. Please try again.",successText:_,privacyText:d="By signing up, you agree to receive email communications from Phillips.",subscriptionState:r=a.SubscriptionState.Default,id:c,...m},h)=>{const{className:o,...N}=V.getCommonProps({id:c,...m},"Subscribe"),T=r===a.SubscriptionState.Invalid,$=r===a.SubscriptionState.Loading,P=r===a.SubscriptionState.Success,M=r===a.SubscriptionState.Error,O={invalid:v,success:_,loading:j,error:q},f=r!==a.SubscriptionState.Default?O[r]:"",w=P||$,D=T||M;return i.jsxs(S,{id:c,...N,className:R.default(o,u),noValidate:!0,ref:h,...m,children:[i.jsx(l.default,{variant:p.TextVariants.headingSmall,className:`${o}__title`,children:y}),t?i.jsx(l.default,{variant:p.TextVariants.bodyMedium,children:t}):null,i.jsx(A.default,{autoFocus:e,className:`${o}__input`,type:"email",name:"email",placeholder:x,labelText:b,invalid:D,invalidText:f,warn:w,warnText:f,required:!0,id:`${c}-input`}),i.jsx(B.default,{className:`${o}__button ${u}`,variant:C.ButtonVariants.secondary,type:"submit",...s,children:n}),d?i.jsx(l.default,{element:"p",children:d}):null]})});g.displayName="Subscribe";exports.default=g;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const i=require("react/jsx-runtime"),R=require("react"),V=require("../../_virtual/index2.cjs"),A=require("../../utils/index.cjs"),B=require("../../components/Input/Input.cjs"),C=require("../../components/Button/Button.cjs"),a=require("./types.cjs"),I=require("../../components/Button/types.cjs"),l=require("../../components/Text/Text.cjs"),p=require("../../components/Text/types.cjs");function L(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const s=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,s.get?s:{enumerable:!0,get:()=>e[n]})}}return t.default=e,Object.freeze(t)}const U=L(R),g=U.forwardRef(({autoFocus:e=!0,blurb:t,buttonText:n="Sign Up",buttonProps:s,className:u,element:S="form",inputLabelText:b="Enter Your Email Address To Sign Up*",inputPlaceholder:x="example@email.com",inputProps:y,title:j="Never Miss A Moment",loadingText:v="Loading...",invalidText:q="",errorText:_="An error occurred. Please try again.",successText:h,privacyText:d="By signing up, you agree to receive email communications from Phillips.",subscriptionState:r=a.SubscriptionState.Default,id:c,...m},N)=>{const{className:o,...T}=A.getCommonProps({id:c,...m},"Subscribe"),$=r===a.SubscriptionState.Invalid,P=r===a.SubscriptionState.Loading,M=r===a.SubscriptionState.Success,O=r===a.SubscriptionState.Error,w={invalid:q,success:h,loading:v,error:_},f=r!==a.SubscriptionState.Default?w[r]:"",D=M||P,E=$||O;return i.jsxs(S,{id:c,...T,className:V.default(o,u),noValidate:!0,ref:N,...m,children:[i.jsx(l.default,{variant:p.TextVariants.headingSmall,className:`${o}__title`,children:j}),t?i.jsx(l.default,{variant:p.TextVariants.bodyMedium,children:t}):null,i.jsx(B.default,{autoFocus:e,className:`${o}__input`,type:"email",name:"email",placeholder:x,labelText:b,invalid:E,invalidText:f,warn:D,warnText:f,required:!0,id:`${c}-input`,...y}),i.jsx(C.default,{className:`${o}__button ${u}`,variant:I.ButtonVariants.secondary,type:"submit",...s,children:n}),d?i.jsx(l.default,{element:"p",children:d}):null]})});g.displayName="Subscribe";exports.default=g;
@@ -1,3 +1,4 @@
1
+ import { InputProps } from '../../components/Input/Input';
1
2
  import { ButtonProps } from '../../components/Button/Button';
2
3
  import { SubscriptionState } from './types';
3
4
  import * as React from 'react';
@@ -15,9 +16,9 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
15
16
  */
16
17
  buttonText?: string;
17
18
  /**
18
- * Optional element to render in place of a form e.g. Remix Form, etc
19
+ * Optional element to render in place of a form, e.g. Remix or react-router `Form`.
19
20
  */
20
- element?: React.ElementType<React.ComponentProps<'form'>>;
21
+ element?: React.ElementType;
21
22
  /**
22
23
  * A unique `id` for the `<Subscribe>`
23
24
  */
@@ -30,6 +31,10 @@ export interface SubscribeProps extends React.HTMLAttributes<HTMLFormElement> {
30
31
  * Subscribe input label
31
32
  */
32
33
  inputPlaceholder?: string;
34
+ /**
35
+ * Subscribe input extra props to spread (e.g. `autoComplete`)
36
+ */
37
+ inputProps?: Partial<InputProps>;
33
38
  /**
34
39
  * Subscribe title text
35
40
  */
@@ -1,14 +1,14 @@
1
- import { jsxs as I, jsx as o } from "react/jsx-runtime";
2
- import * as L from "react";
3
- import M from "../../_virtual/index2.js";
4
- import { getCommonProps as V } from "../../utils/index.js";
5
- import j from "../../components/Input/Input.js";
6
- import D from "../../components/Button/Button.js";
1
+ import { jsxs as L, jsx as o } from "react/jsx-runtime";
2
+ import * as M from "react";
3
+ import V from "../../_virtual/index2.js";
4
+ import { getCommonProps as j } from "../../utils/index.js";
5
+ import D from "../../components/Input/Input.js";
6
+ import R from "../../components/Button/Button.js";
7
7
  import { SubscriptionState as r } from "./types.js";
8
- import { ButtonVariants as R } from "../../components/Button/types.js";
8
+ import { ButtonVariants as U } from "../../components/Button/types.js";
9
9
  import i from "../../components/Text/Text.js";
10
10
  import { TextVariants as d } from "../../components/Text/types.js";
11
- const U = L.forwardRef(
11
+ const q = M.forwardRef(
12
12
  ({
13
13
  autoFocus: u = !0,
14
14
  blurb: t,
@@ -18,36 +18,37 @@ const U = L.forwardRef(
18
18
  element: g = "form",
19
19
  inputLabelText: x = "Enter Your Email Address To Sign Up*",
20
20
  inputPlaceholder: v = "example@email.com",
21
- title: h = "Never Miss A Moment",
22
- loadingText: y = "Loading...",
23
- invalidText: N = "",
24
- errorText: _ = "An error occurred. Please try again.",
25
- successText: b,
21
+ inputProps: h,
22
+ title: y = "Never Miss A Moment",
23
+ loadingText: N = "Loading...",
24
+ invalidText: _ = "",
25
+ errorText: b = "An error occurred. Please try again.",
26
+ successText: S,
26
27
  privacyText: s = "By signing up, you agree to receive email communications from Phillips.",
27
28
  subscriptionState: e = r.Default,
28
29
  id: n,
29
30
  ...l
30
- }, S) => {
31
- const { className: a, ...T } = V({ id: n, ...l }, "Subscribe"), $ = e === r.Invalid, E = e === r.Loading, P = e === r.Success, w = e === r.Error, A = {
32
- invalid: N,
33
- success: b,
34
- loading: y,
35
- error: _
36
- }, c = e !== r.Default ? A[e] : "", B = P || E, C = $ || w;
37
- return /* @__PURE__ */ I(
31
+ }, T) => {
32
+ const { className: a, ...$ } = j({ id: n, ...l }, "Subscribe"), E = e === r.Invalid, P = e === r.Loading, w = e === r.Success, A = e === r.Error, B = {
33
+ invalid: _,
34
+ success: S,
35
+ loading: N,
36
+ error: b
37
+ }, c = e !== r.Default ? B[e] : "", C = w || P, I = E || A;
38
+ return /* @__PURE__ */ L(
38
39
  g,
39
40
  {
40
41
  id: n,
41
- ...T,
42
- className: M(a, m),
42
+ ...$,
43
+ className: V(a, m),
43
44
  noValidate: !0,
44
- ref: S,
45
+ ref: T,
45
46
  ...l,
46
47
  children: [
47
- /* @__PURE__ */ o(i, { variant: d.headingSmall, className: `${a}__title`, children: h }),
48
+ /* @__PURE__ */ o(i, { variant: d.headingSmall, className: `${a}__title`, children: y }),
48
49
  t ? /* @__PURE__ */ o(i, { variant: d.bodyMedium, children: t }) : null,
49
50
  /* @__PURE__ */ o(
50
- j,
51
+ D,
51
52
  {
52
53
  autoFocus: u,
53
54
  className: `${a}__input`,
@@ -55,19 +56,20 @@ const U = L.forwardRef(
55
56
  name: "email",
56
57
  placeholder: v,
57
58
  labelText: x,
58
- invalid: C,
59
+ invalid: I,
59
60
  invalidText: c,
60
- warn: B,
61
+ warn: C,
61
62
  warnText: c,
62
63
  required: !0,
63
- id: `${n}-input`
64
+ id: `${n}-input`,
65
+ ...h
64
66
  }
65
67
  ),
66
68
  /* @__PURE__ */ o(
67
- D,
69
+ R,
68
70
  {
69
71
  className: `${a}__button ${m}`,
70
- variant: R.secondary,
72
+ variant: U.secondary,
71
73
  type: "submit",
72
74
  ...f,
73
75
  children: p
@@ -79,7 +81,7 @@ const U = L.forwardRef(
79
81
  );
80
82
  }
81
83
  );
82
- U.displayName = "Subscribe";
84
+ q.displayName = "Subscribe";
83
85
  export {
84
- U as default
86
+ q as default
85
87
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.279.0",
3
+ "version": "1.279.2",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"