@phillips/seldon 1.188.1 → 1.190.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.
@@ -35,6 +35,10 @@ export interface CarouselProps extends ComponentProps<'div'> {
35
35
  * The threshold for slides to be considered in view. A value of 0.1 means that 10% of the slide must be in view for it to be considered in view.
36
36
  */
37
37
  inViewThreshold?: number;
38
+ /**
39
+ * The number of slides to scroll at once.
40
+ */
41
+ slidesToScroll?: number;
38
42
  }
39
43
  type CarouselContextProps = {
40
44
  carouselRef: ReturnType<typeof useEmblaCarousel>[0];
@@ -1,11 +1,11 @@
1
1
  import { jsx as c } from "react/jsx-runtime";
2
- import { createContext as P, forwardRef as g, useEffect as n, useCallback as f } from "react";
3
- import { getCommonProps as I } from "../../utils/index.js";
4
- import y from "../../node_modules/classnames/index.js";
5
- import V from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
- import A from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
- import { WheelGesturesPlugin as R } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
- const S = P(null), E = g(
2
+ import { createContext as g, forwardRef as I, useEffect as n, useCallback as f } from "react";
3
+ import { getCommonProps as y } from "../../utils/index.js";
4
+ import V from "../../node_modules/classnames/index.js";
5
+ import A from "../../node_modules/embla-carousel-class-names/esm/embla-carousel-class-names.esm.js";
6
+ import R from "../../node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js";
7
+ import { WheelGesturesPlugin as S } from "../../node_modules/embla-carousel-wheel-gestures/dist/embla-carousel-wheel-gestures.esm.js";
8
+ const E = g(null), K = I(
9
9
  ({
10
10
  loop: m = !1,
11
11
  startIndex: u = 0,
@@ -17,9 +17,10 @@ const S = P(null), E = g(
17
17
  disableDrag: o = !1,
18
18
  disableNavigationDrag: h = null,
19
19
  inViewThreshold: N = 0.99,
20
+ slidesToScroll: k = 1,
20
21
  ...t
21
- }, k) => {
22
- const { className: v, ...C } = I(t, "Carousel");
22
+ }, v) => {
23
+ const { className: C, ...b } = y(t, "Carousel");
23
24
  let s = {};
24
25
  switch (h) {
25
26
  case "mobile":
@@ -34,20 +35,21 @@ const S = P(null), E = g(
34
35
  default:
35
36
  s = {};
36
37
  }
37
- const [b, e] = A(
38
+ const [D, e] = R(
38
39
  {
39
40
  loop: m,
40
41
  startIndex: u,
41
42
  inViewThreshold: N,
42
- ...s
43
+ ...s,
44
+ slidesToScroll: k
43
45
  },
44
46
  [
45
47
  ...x ? [
46
- R({
48
+ S({
47
49
  forceWheelAxis: "x"
48
50
  })
49
51
  ] : [],
50
- V({
52
+ A({
51
53
  snapped: "carousel-item-in-view"
52
54
  })
53
55
  ]
@@ -59,7 +61,7 @@ const S = P(null), E = g(
59
61
  watchDrag: () => !0
60
62
  });
61
63
  }, [o, e]);
62
- const D = f(
64
+ const P = f(
63
65
  (r) => {
64
66
  r.key === "ArrowLeft" ? (r.preventDefault(), e?.scrollPrev()) : r.key === "ArrowRight" && (r.preventDefault(), e?.scrollNext());
65
67
  },
@@ -79,10 +81,10 @@ const S = P(null), E = g(
79
81
  e.off("slidesInView", l);
80
82
  };
81
83
  }, [e, l]), /* @__PURE__ */ c(
82
- S.Provider,
84
+ E.Provider,
83
85
  {
84
86
  value: {
85
- carouselRef: b,
87
+ carouselRef: D,
86
88
  api: e,
87
89
  scrollPrev: () => e?.scrollPrev(),
88
90
  scrollNext: () => e?.scrollNext(),
@@ -94,13 +96,13 @@ const S = P(null), E = g(
94
96
  children: /* @__PURE__ */ c(
95
97
  "div",
96
98
  {
97
- ref: k,
98
- onKeyDownCapture: D,
99
- className: y(v, p),
99
+ ref: v,
100
+ onKeyDownCapture: P,
101
+ className: V(C, p),
100
102
  role: "region",
101
103
  "aria-roledescription": "carousel",
102
104
  ...t,
103
- ...C,
105
+ ...b,
104
106
  children: d
105
107
  }
106
108
  )
@@ -108,8 +110,8 @@ const S = P(null), E = g(
108
110
  );
109
111
  }
110
112
  );
111
- E.displayName = "Carousel";
113
+ K.displayName = "Carousel";
112
114
  export {
113
- S as CarouselContext,
114
- E as default
115
+ E as CarouselContext,
116
+ K as default
115
117
  };
@@ -45,3 +45,18 @@ export declare const CarouselWithDotsOverflow: {
45
45
  argTypes: {};
46
46
  };
47
47
  export declare const ControlledCarousel: (props: CarouselProps & CarouselDotsProps) => import("react/jsx-runtime").JSX.Element;
48
+ export declare const CarouselWithMultipleItems: {
49
+ (props: CarouselProps): import("react/jsx-runtime").JSX.Element;
50
+ args: {
51
+ disableNavigationDrag: "desktop";
52
+ slidesToScroll: number;
53
+ };
54
+ argTypes: {
55
+ slidesToScroll: {
56
+ control: {
57
+ type: string;
58
+ };
59
+ defaultValue: number;
60
+ };
61
+ };
62
+ };
package/dist/index.d.ts CHANGED
@@ -98,3 +98,4 @@ export * from './patterns/CountryPicker';
98
98
  export * from './components/DescriptiveRadioButton';
99
99
  export * from './components/DescriptiveRadioButtonGroup';
100
100
  export * from './patterns/TextBanner';
101
+ export * from './patterns/PhoneNumberInput';
package/dist/index.js CHANGED
@@ -2,11 +2,11 @@ import { PaddingTokens as a, SpacingTokens as f, defaultYear as s, emailValidati
2
2
  import { default as C } from "./pages/Page.js";
3
3
  import { SSRMediaQuery as B, ssrMediaQueryStyle as P } from "./providers/SeldonProvider/utils.js";
4
4
  import { usePendingState as A } from "./utils/hooks.js";
5
- import { AuctionStatus as V, LotStatus as b, SupportedLanguages as y } from "./types/commonTypes.js";
6
- import { default as v } from "./components/Button/Button.js";
5
+ import { AuctionStatus as b, LotStatus as V, SupportedLanguages as y } from "./types/commonTypes.js";
6
+ import { default as k } from "./components/Button/Button.js";
7
7
  import { ButtonVariants as w } from "./components/Button/types.js";
8
8
  import { default as F } from "./components/IconButton/IconButton.js";
9
- import { default as M } from "./components/Accordion/Accordion.js";
9
+ import { default as H } from "./components/Accordion/Accordion.js";
10
10
  import { default as E } from "./components/Accordion/AccordionItem.js";
11
11
  import { AccordionItemVariant as R, AccordionVariants as U } from "./components/Accordion/types.js";
12
12
  import { default as Q } from "./components/Breadcrumb/Breadcrumb.js";
@@ -30,12 +30,12 @@ import { default as Ce } from "./components/ErrorBoundary/ErrorBoundary.js";
30
30
  import { default as Be } from "./components/Grid/Grid.js";
31
31
  import { default as Ie } from "./components/GridItem/GridItem.js";
32
32
  import { GridItemAlign as Le } from "./components/GridItem/types.js";
33
- import { default as be } from "./components/Input/Input.js";
34
- import { default as ke } from "./components/Link/Link.js";
35
- import { LinkVariants as he } from "./components/Link/types.js";
33
+ import { default as Ve } from "./components/Input/Input.js";
34
+ import { default as he } from "./components/Link/Link.js";
35
+ import { LinkVariants as ve } from "./components/Link/types.js";
36
36
  import { default as De } from "./components/LinkBlock/LinkBlock.js";
37
- import { default as He } from "./components/LinkList/LinkList.js";
38
- import { default as Ne } from "./components/Modal/Modal.js";
37
+ import { default as Ne } from "./components/LinkList/LinkList.js";
38
+ import { default as Me } from "./components/Modal/Modal.js";
39
39
  import { default as Ge } from "./components/Navigation/Navigation.js";
40
40
  import { default as Ue } from "./components/Navigation/NavigationItem/NavigationItem.js";
41
41
  import { default as Qe } from "./components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js";
@@ -56,12 +56,12 @@ import { default as Ct } from "./components/Text/Text.js";
56
56
  import { TextSymbolVariants as Bt } from "./components/TextSymbol/types.js";
57
57
  import { default as It } from "./components/TextSymbol/TextSymbol.js";
58
58
  import { default as Lt } from "./components/Video/Video.js";
59
- import { default as bt } from "./patterns/DetailList/DetailList.js";
60
- import { DetailListAlignment as kt } from "./patterns/DetailList/types.js";
61
- import { default as ht } from "./patterns/FavoritesCollectionTile/FavoritesCollectionTile.js";
59
+ import { default as Vt } from "./patterns/DetailList/DetailList.js";
60
+ import { DetailListAlignment as ht } from "./patterns/DetailList/types.js";
61
+ import { default as vt } from "./patterns/FavoritesCollectionTile/FavoritesCollectionTile.js";
62
62
  import { default as Dt } from "./patterns/HeroBanner/HeroBanner.js";
63
- import { default as Ht } from "./patterns/TextBanner/TextBanner.js";
64
- import { default as Nt } from "./patterns/LanguageSelector/LanguageSelector.js";
63
+ import { default as Nt } from "./patterns/TextBanner/TextBanner.js";
64
+ import { default as Mt } from "./patterns/LanguageSelector/LanguageSelector.js";
65
65
  import { default as Gt } from "./patterns/SaleHeaderBanner/SaleHeaderBanner.js";
66
66
  import { default as Ut } from "./patterns/SaleHeaderBanner/SaleHeaderBrowseAuctions.js";
67
67
  import { default as Qt } from "./patterns/Social/Social.js";
@@ -82,12 +82,12 @@ import { default as So } from "./patterns/FiltersInline/FiltersInline.js";
82
82
  import { FilterButtonIconType as To, FilterButtonType as Bo } from "./patterns/FiltersInline/types.js";
83
83
  import { default as Io } from "./patterns/SaleCard/SaleCard.js";
84
84
  import { SaleCardActions as Lo } from "./patterns/SaleCard/SaleCardActions.js";
85
- import { SaleCardVariants as bo } from "./patterns/SaleCard/types.js";
86
- import { default as ko } from "./patterns/ViewingDetails/ViewingDetails.js";
87
- import { default as ho } from "./components/ProgressIndicator/ProgressIndicator.js";
85
+ import { SaleCardVariants as Vo } from "./patterns/SaleCard/types.js";
86
+ import { default as ho } from "./patterns/ViewingDetails/ViewingDetails.js";
87
+ import { default as vo } from "./components/ProgressIndicator/ProgressIndicator.js";
88
88
  import { default as Do } from "./site-furniture/Footer/Footer.js";
89
- import { default as Ho } from "./site-furniture/Header/Header.js";
90
- import { default as No } from "./components/AddToCalendar/AddToCalendar.js";
89
+ import { default as No } from "./site-furniture/Header/Header.js";
90
+ import { default as Mo } from "./components/AddToCalendar/AddToCalendar.js";
91
91
  import { default as Go } from "./components/Article/Article.js";
92
92
  import { default as Uo } from "./components/Countdown/Countdown.js";
93
93
  import { CountdownVariants as Qo } from "./components/Countdown/types.js";
@@ -108,25 +108,26 @@ import { default as gr } from "./patterns/AccountPageHeader/AccountPageHeader.js
108
108
  import { default as Cr } from "./patterns/BidSnapshot/BidSnapshot.js";
109
109
  import { default as Br } from "./patterns/BidSnapshot/BidMessage.js";
110
110
  import { BidMessageVariants as Ir, BidStatusEnum as Ar } from "./patterns/BidSnapshot/types.js";
111
- import { default as Vr } from "./patterns/FilterMenu/FilterMenu.js";
111
+ import { default as br } from "./patterns/FilterMenu/FilterMenu.js";
112
112
  import { default as yr } from "./patterns/ObjectTile/ObjectTile.js";
113
- import { default as vr } from "./patterns/CountryPicker/CountryPicker.js";
113
+ import { default as kr } from "./patterns/CountryPicker/CountryPicker.js";
114
+ import { default as wr } from "./patterns/PhoneNumberInput/PhoneNumberInput.js";
114
115
  export {
115
- M as Accordion,
116
+ H as Accordion,
116
117
  E as AccordionItem,
117
118
  R as AccordionItemVariant,
118
119
  U as AccordionVariants,
119
120
  gr as AccountPageHeader,
120
- No as AddToCalendar,
121
+ Mo as AddToCalendar,
121
122
  Go as Article,
122
- V as AuctionStatus,
123
+ b as AuctionStatus,
123
124
  qt as AuthState,
124
125
  Br as BidMessage,
125
126
  Ir as BidMessageVariants,
126
127
  Cr as BidSnapshot,
127
128
  Ar as BidStatusEnum,
128
129
  Q as Breadcrumb,
129
- v as Button,
130
+ k as Button,
130
131
  w as ButtonVariants,
131
132
  Y as Carousel,
132
133
  q as CarouselArrows,
@@ -142,43 +143,43 @@ export {
142
143
  pe as ContentPeekHeightUnits,
143
144
  Uo as Countdown,
144
145
  Qo as CountdownVariants,
145
- vr as CountryPicker,
146
+ kr as CountryPicker,
146
147
  zo as DescriptiveRadioButton,
147
148
  Yo as DescriptiveRadioButtonGroup,
148
149
  ie as Detail,
149
- bt as DetailList,
150
- kt as DetailListAlignment,
150
+ Vt as DetailList,
151
+ ht as DetailListAlignment,
151
152
  qo as Divider,
152
153
  ne as Drawer,
153
154
  ge as Dropdown,
154
155
  Ce as ErrorBoundary,
155
156
  mo as ExitGateCard,
156
- ht as FavoritesCollectionTile,
157
+ vt as FavoritesCollectionTile,
157
158
  Ko as FavoritingTileButton,
158
159
  _o as Filter,
159
160
  To as FilterButtonIconType,
160
161
  Bo as FilterButtonType,
161
162
  or as FilterHeader,
162
163
  er as FilterInput,
163
- Vr as FilterMenu,
164
+ br as FilterMenu,
164
165
  So as FiltersInline,
165
166
  Do as Footer,
166
167
  Be as Grid,
167
168
  Ie as GridItem,
168
169
  Le as GridItemAlign,
169
- Ho as Header,
170
+ No as Header,
170
171
  Dt as HeroBanner,
171
172
  z as Icon,
172
173
  F as IconButton,
173
- be as Input,
174
- Nt as LanguageSelector,
175
- ke as Link,
174
+ Ve as Input,
175
+ Mt as LanguageSelector,
176
+ he as Link,
176
177
  De as LinkBlock,
177
- He as LinkList,
178
- he as LinkVariants,
178
+ Ne as LinkList,
179
+ ve as LinkVariants,
179
180
  uo as Loader,
180
- b as LotStatus,
181
- Ne as Modal,
181
+ V as LotStatus,
182
+ Me as Modal,
182
183
  Ge as Navigation,
183
184
  Ue as NavigationItem,
184
185
  Qe as NavigationItemTrigger,
@@ -189,15 +190,16 @@ export {
189
190
  C as Page,
190
191
  xo as PageContentWrapper,
191
192
  Ye as Pagination,
193
+ wr as PhoneNumberInput,
192
194
  co as PhoneNumberPicker,
193
195
  sr as Pictogram,
194
196
  qe as PinchZoom,
195
- ho as ProgressIndicator,
197
+ vo as ProgressIndicator,
196
198
  Ke as Row,
197
199
  B as SSRMediaQuery,
198
200
  Io as SaleCard,
199
201
  Lo as SaleCardActions,
200
- bo as SaleCardVariants,
202
+ Vo as SaleCardVariants,
201
203
  Gt as SaleHeaderBanner,
202
204
  Ut as SaleHeaderBrowseAuctions,
203
205
  _e as Search,
@@ -219,7 +221,7 @@ export {
219
221
  Ct as Text,
220
222
  ct as TextAlignments,
221
223
  dr as TextArea,
222
- Ht as TextBanner,
224
+ Nt as TextBanner,
223
225
  Bt as TextSymbolVariants,
224
226
  It as TextSymbols,
225
227
  gt as TextVariants,
@@ -227,7 +229,7 @@ export {
227
229
  ir as ToastProvider,
228
230
  Kt as UserManagement,
229
231
  Lt as Video,
230
- ko as ViewingDetails,
232
+ ho as ViewingDetails,
231
233
  eo as ViewingsList,
232
234
  s as defaultYear,
233
235
  l as emailValidation,
@@ -1,22 +1,22 @@
1
- import { jsx as o, jsxs as y } from "react/jsx-runtime";
1
+ import { jsx as o, jsxs as k } from "react/jsx-runtime";
2
2
  import { forwardRef as j, useState as S, useEffect as H, useRef as V, useMemo as f } from "react";
3
- import N from "../../components/Button/Button.js";
4
- import U from "../../components/Input/Input.js";
5
- import G from "../../components/Modal/Modal.js";
6
- import K from "../../components/Text/Text.js";
7
- import { TextVariants as L } from "../../components/Text/types.js";
3
+ import L from "../../components/Button/Button.js";
4
+ import N from "../../components/Input/Input.js";
5
+ import U from "../../components/Modal/Modal.js";
6
+ import A from "../../components/Text/Text.js";
7
+ import { TextVariants as G } from "../../components/Text/types.js";
8
8
  import { countries as v } from "./constants.js";
9
- import { getSafeCountryCallingCode as O } from "./utils.js";
10
- import { ButtonVariants as Z } from "../../components/Button/types.js";
11
- import q from "../../components/Icon/Icon.js";
12
- import { CountryPickerCountryList as A } from "./CountryPickerCountryList.js";
9
+ import { getSafeCountryCallingCode as K } from "./utils.js";
10
+ import { ButtonVariants as O } from "../../components/Button/types.js";
11
+ import Z from "../../components/Icon/Icon.js";
12
+ import { CountryPickerCountryList as q } from "./CountryPickerCountryList.js";
13
13
  const w = ["US", "GB", "HK", "CH"], z = (n, l) => {
14
14
  if (!l) return n;
15
15
  const d = l.replace(/[.*?^${}()|[\]\\]/g, "\\$&").replace(/\+/g, "");
16
16
  if (!d) return n;
17
17
  const i = new RegExp(d, "gi");
18
18
  return n.filter((u) => {
19
- const h = u.name, t = u.code, p = O(t).replace(/\+/g, "");
19
+ const h = u.name, t = u.code, p = K(t).replace(/\+/g, "");
20
20
  return i.test(h) || i.test(t) || i.test(p) || i.test("+" + p);
21
21
  });
22
22
  }, J = j(
@@ -31,56 +31,55 @@ const w = ["US", "GB", "HK", "CH"], z = (n, l) => {
31
31
  baseClassName: t,
32
32
  variantConfig: _
33
33
  }, p) => {
34
- const { value: g, onChange: C, isPhone: E } = _, [c, I] = S(g), x = (e) => v.some((a) => a.code === e);
34
+ const { value: g, onChange: y, isPhone: E } = _, [c, I] = S(g), C = (e) => v.some((a) => a.code === e);
35
35
  H(() => {
36
36
  I(g);
37
37
  }, [n, g]);
38
- const [s, B] = S(""), D = V(null), F = V(null), [P, R] = f(() => {
38
+ const [s, B] = S(""), D = V(null), F = V(null), [x, P] = f(() => {
39
39
  const e = w.map((r) => v.filter(($) => $.code === r)).flat(), a = v.filter((r) => !w.includes(r.code));
40
40
  return [
41
41
  e,
42
42
  // keep original order for prioritized
43
43
  a.sort((r, $) => r.name.localeCompare($.name))
44
44
  ];
45
- }, []), M = f(() => z(P, s), [P, s]), k = f(() => z(R, s), [R, s]), T = f(() => {
45
+ }, []), M = f(() => z(x, s), [x, s]), R = f(() => z(P, s), [P, s]), T = f(() => {
46
46
  const e = {};
47
- return k.forEach((a) => {
47
+ return R.forEach((a) => {
48
48
  const r = a.name[0].toUpperCase();
49
49
  e[r] || (e[r] = []), e[r].push(a);
50
50
  }), e;
51
- }, [k]);
51
+ }, [R]);
52
52
  return /* @__PURE__ */ o(
53
- G,
53
+ U,
54
54
  {
55
55
  isOpen: n,
56
56
  onClose: l,
57
57
  "data-testid": "country-picker-modal",
58
58
  className: `${t}__modal`,
59
59
  ref: p,
60
- children: /* @__PURE__ */ y("div", { className: `${t}__wrapper`, children: [
61
- /* @__PURE__ */ y("div", { className: `${t}__header`, children: [
62
- /* @__PURE__ */ o(K, { variant: L.heading3, className: `${t}__header-text`, children: m }),
63
- /* @__PURE__ */ y("div", { className: `${t}__input-wrapper`, children: [
64
- /* @__PURE__ */ o("span", { className: `${t}__input-icon`, "aria-hidden": "true", children: /* @__PURE__ */ o(q, { icon: "Search", width: 16, height: 16, color: "currentColor" }) }),
65
- /* @__PURE__ */ o(
66
- U,
67
- {
68
- id: "countrySearch",
69
- type: "search",
70
- labelText: d,
71
- placeholder: i,
72
- value: s,
73
- onChange: (e) => {
74
- B(e.target.value);
75
- },
76
- autoFocus: !0,
77
- className: `${t}__input`
78
- }
79
- )
80
- ] })
60
+ children: /* @__PURE__ */ k("div", { className: `${t}__wrapper`, children: [
61
+ /* @__PURE__ */ k("div", { className: `${t}__header`, children: [
62
+ /* @__PURE__ */ o(A, { variant: G.heading3, className: `${t}__header-text`, children: m }),
63
+ /* @__PURE__ */ o("div", { className: `${t}__input-wrapper`, children: /* @__PURE__ */ o(
64
+ N,
65
+ {
66
+ id: "countrySearch",
67
+ type: "search",
68
+ labelText: d,
69
+ hideLabel: !0,
70
+ placeholder: i,
71
+ value: s,
72
+ onChange: (e) => {
73
+ B(e.target.value);
74
+ },
75
+ autoFocus: !0,
76
+ className: `${t}__input`,
77
+ inputAdornment: /* @__PURE__ */ o("span", { "aria-hidden": "true", children: /* @__PURE__ */ o(Z, { icon: "Search", width: 16, height: 16, color: "$cta-inactive" }) })
78
+ }
79
+ ) })
81
80
  ] }),
82
81
  /* @__PURE__ */ o(
83
- A,
82
+ q,
84
83
  {
85
84
  filteredPrioritized: M,
86
85
  groupedCountries: T,
@@ -92,16 +91,16 @@ const w = ["US", "GB", "HK", "CH"], z = (n, l) => {
92
91
  }
93
92
  ),
94
93
  /* @__PURE__ */ o("div", { className: `${t}__button-container`, children: /* @__PURE__ */ o(
95
- N,
94
+ L,
96
95
  {
97
96
  onClick: () => {
98
- c && (E ? x(c) && C(c) : x(c) || C(c), l?.());
97
+ c && (E ? C(c) && y(c) : C(c) || y(c), l?.());
99
98
  },
100
99
  className: `${t}__button`,
101
100
  "data-testid": "country-picker-modal-select-button",
102
101
  ref: D,
103
102
  type: "button",
104
- variant: Z.secondary,
103
+ variant: O.secondary,
105
104
  isDisabled: !c,
106
105
  children: u
107
106
  }
@@ -1,20 +1,20 @@
1
1
  import { jsxs as a, jsx as t } from "react/jsx-runtime";
2
2
  import x from "../../components/Icon/Icon.js";
3
3
  import { TextVariants as m } from "../../components/Text/types.js";
4
- import p from "../../components/Text/Text.js";
4
+ import f from "../../components/Text/Text.js";
5
5
  import i from "../../node_modules/classnames/index.js";
6
6
  import { countries as y } from "./constants.js";
7
7
  import { forwardRef as k } from "react";
8
8
  const w = k(
9
- ({ labelText: c, displayValue: f, onClick: $, hasError: e = !1, errorMsg: o, id: n, className: h, baseClassName: r, variantConfig: u }, v) => {
10
- const { isPhone: l, value: g } = u, d = o ? `${r}__trigger-error-msg` : void 0, _ = l ? g : y.filter((s) => s.name === g)?.[0]?.code;
9
+ ({ labelText: c, displayValue: p, onClick: $, hasError: o = !1, errorMsg: e, id: n, className: h, baseClassName: r, variantConfig: u }, v) => {
10
+ const { isPhone: l, value: g } = u, d = e ? `${r}__trigger-error-msg` : void 0, _ = l ? g : y.filter((s) => s.name === g)?.[0]?.code;
11
11
  return /* @__PURE__ */ a("div", { className: i(`${r}__trigger`, h), children: [
12
12
  /* @__PURE__ */ t(
13
- p,
13
+ f,
14
14
  {
15
15
  variant: m.string2,
16
16
  className: i(`${r}__trigger-label`, {
17
- [`${r}__trigger-label--error`]: e
17
+ [`${r}__trigger-label--error`]: o
18
18
  }),
19
19
  id: n ? `${n}-label` : void 0,
20
20
  children: c
@@ -26,10 +26,10 @@ const w = k(
26
26
  ref: v,
27
27
  type: "button",
28
28
  "aria-label": c,
29
- "aria-invalid": e,
29
+ "aria-invalid": o,
30
30
  "aria-describedby": d,
31
31
  className: i(`${r}__trigger-btn`, {
32
- [`${r}__trigger-btn--error`]: e,
32
+ [`${r}__trigger-btn--error`]: o,
33
33
  [`${r}__trigger-btn--is-phone`]: l
34
34
  }),
35
35
  onClick: $,
@@ -44,20 +44,12 @@ const w = k(
44
44
  className: `${r}__trigger-flag`
45
45
  }
46
46
  ),
47
- /* @__PURE__ */ t("span", { className: i(`${r}__trigger-text`), children: f }),
48
- /* @__PURE__ */ t("span", { className: i(`${r}__trigger-icon`), children: /* @__PURE__ */ t(x, { icon: "ChevronDown", color: "$pure-black", width: 16, height: 16 }) })
47
+ /* @__PURE__ */ t("span", { className: i(`${r}__trigger-text`), children: p }),
48
+ /* @__PURE__ */ t("span", { className: i(`${r}__trigger-icon`), children: /* @__PURE__ */ t(x, { icon: "ChevronDown", color: "black-100", width: 16, height: 16 }) })
49
49
  ]
50
50
  }
51
51
  ),
52
- e && o && /* @__PURE__ */ t(
53
- p,
54
- {
55
- variant: m.string2,
56
- className: i(`${r}__trigger-error-msg`),
57
- id: d,
58
- children: o
59
- }
60
- )
52
+ o && e && /* @__PURE__ */ t(f, { variant: m.string2, className: `${r}__trigger-error-msg`, id: d, children: e })
61
53
  ] });
62
54
  }
63
55
  );
@@ -0,0 +1,51 @@
1
+ import { default as React, ComponentProps } from 'react';
2
+ import { CountryCode } from './types';
3
+ export interface PhoneNumberInputProps extends Omit<ComponentProps<'div'>, 'onChange'> {
4
+ /**
5
+ * The current phone number value.
6
+ * This represents the phone number entered by the user without country code.
7
+ */
8
+ value?: string;
9
+ /**
10
+ * The country code associated with the phone number.
11
+ */
12
+ countryCode?: CountryCode;
13
+ /**
14
+ * Callback function triggered when the phone number or country code changes.
15
+ * @param value - The updated phone number value.
16
+ * @param countryCode - The updated country code.
17
+ */
18
+ handleValueChange?: (rawValue: string, countryCode: CountryCode) => void;
19
+ /**
20
+ * The label for the combined fields.
21
+ */
22
+ label?: string;
23
+ /**
24
+ * Indicates whether the input field is required.
25
+ * If true, the field will be marked as required.
26
+ */
27
+ required?: boolean;
28
+ /**
29
+ * Indicates whether there is an error in the input field.
30
+ */
31
+ error?: boolean;
32
+ /**
33
+ * The error message to display when there is an error.
34
+ */
35
+ errorText?: string;
36
+ /**
37
+ * Indicates whether the input field is disabled.
38
+ */
39
+ disabled?: boolean;
40
+ }
41
+ /**
42
+ * ## Overview
43
+ *
44
+ * A component for entering phone numbers with country code selection.
45
+ *
46
+ * [Figma Link](https://www.figma.com/design/kSxOhnqIhilZ9hIJd3bPgP/RW-Registration?node-id=6101-43645&m=dev)
47
+ *
48
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/patterns-PhoneNumberInput--overview)
49
+ */
50
+ declare const PhoneNumberInput: React.ForwardRefExoticComponent<Omit<PhoneNumberInputProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
51
+ export default PhoneNumberInput;
@@ -0,0 +1,79 @@
1
+ import { jsxs as i, jsx as r } from "react/jsx-runtime";
2
+ import v, { forwardRef as P } from "react";
3
+ import { getCommonProps as $ } from "../../utils/index.js";
4
+ import I from "../../node_modules/classnames/index.js";
5
+ import x from "../CountryPicker/CountryPicker.js";
6
+ import S from "../../components/Input/Input.js";
7
+ import { getSafeCountryCallingCode as L } from "../CountryPicker/utils.js";
8
+ import { countries as T } from "../CountryPicker/constants.js";
9
+ import l from "../../components/Text/Text.js";
10
+ const j = P(
11
+ ({
12
+ className: m,
13
+ value: d = "",
14
+ countryCode: u = "",
15
+ handleValueChange: p,
16
+ label: h = "Phone",
17
+ required: f = !1,
18
+ error: s,
19
+ errorText: t,
20
+ disabled: y = !1,
21
+ ...b
22
+ }, g) => {
23
+ const { className: e, ...N } = $(b, "PhoneNumberInput"), [o, _] = v.useState(u || void 0), n = T.find((a) => a.code === o), C = (a) => {
24
+ p?.(a.target.value, o || "");
25
+ }, c = t ? `${e}-error-text` : void 0;
26
+ return /* @__PURE__ */ i("div", { ref: g, className: I(`${e}`, m), ...N, children: [
27
+ /* @__PURE__ */ i("div", { className: `${e}__wrapper`, children: [
28
+ /* @__PURE__ */ i("div", { className: `${e}__country-picker`, children: [
29
+ /* @__PURE__ */ r("input", { type: "hidden", name: "phoneNumber", value: d, "data-testid": "phone-number-hidden-input" }),
30
+ /* @__PURE__ */ r(
31
+ "input",
32
+ {
33
+ type: "hidden",
34
+ name: "phoneCountryCode",
35
+ value: o || "",
36
+ "data-testid": "phone-country-code-hidden-input"
37
+ }
38
+ ),
39
+ /* @__PURE__ */ r(
40
+ x,
41
+ {
42
+ triggerLabelText: "Phone Number",
43
+ triggerDisplayValue: n ? `+${L(n.code)}` : "",
44
+ hasTriggerError: !!s,
45
+ modalTitle: "Country code",
46
+ searchInputLabel: "Search country",
47
+ searchInputPlaceholder: "Search country",
48
+ selectButtonLabel: "Select",
49
+ isPhone: !0,
50
+ value: n?.code,
51
+ onChange: _
52
+ }
53
+ )
54
+ ] }),
55
+ /* @__PURE__ */ r("div", { className: `${e}__input`, children: /* @__PURE__ */ r(
56
+ S,
57
+ {
58
+ id: "phone-input",
59
+ type: "tel",
60
+ labelText: h,
61
+ hideLabel: !0,
62
+ value: d,
63
+ onChange: C,
64
+ required: f,
65
+ invalid: !!s,
66
+ disabled: y,
67
+ invalidText: "",
68
+ "aria-describedby": c
69
+ }
70
+ ) })
71
+ ] }),
72
+ t ? /* @__PURE__ */ r(l, { className: `${e}__error ${e}__error-msg`, id: c, children: t }) : /* @__PURE__ */ r(l, { className: `${e}__error`, children: " " })
73
+ ] });
74
+ }
75
+ );
76
+ j.displayName = "PhoneNumberInput";
77
+ export {
78
+ j as default
79
+ };
@@ -0,0 +1,49 @@
1
+ import { PhoneNumberInputProps } from './PhoneNumberInput';
2
+ declare const meta: {
3
+ title: string;
4
+ component: import('react').ForwardRefExoticComponent<Omit<PhoneNumberInputProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
5
+ };
6
+ export default meta;
7
+ export declare const Playground: {
8
+ (props: Partial<PhoneNumberInputProps>): import("react/jsx-runtime").JSX.Element;
9
+ args: {
10
+ value: string;
11
+ countryCode: string;
12
+ label: string;
13
+ required: boolean;
14
+ disabled: boolean;
15
+ error: boolean;
16
+ errorText: string;
17
+ };
18
+ argTypes: {
19
+ value: {
20
+ control: string;
21
+ description: string;
22
+ };
23
+ countryCode: {
24
+ control: string;
25
+ description: string;
26
+ };
27
+ label: {
28
+ control: string;
29
+ description: string;
30
+ };
31
+ required: {
32
+ control: string;
33
+ description: string;
34
+ };
35
+ disabled: {
36
+ control: string;
37
+ description: string;
38
+ };
39
+ error: {
40
+ control: string;
41
+ description: string;
42
+ };
43
+ errorText: {
44
+ control: string;
45
+ description: string;
46
+ };
47
+ };
48
+ };
49
+ export declare const InDrawerWithControllerAndValidation: () => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1 @@
1
+ export { default as PhoneNumberInput, type PhoneNumberInputProps } from './PhoneNumberInput';
@@ -0,0 +1,2 @@
1
+ import { countries } from '../CountryPicker/constants';
2
+ export type CountryCode = (typeof countries)[number]['code'];
@@ -86,7 +86,7 @@ $off-white: $grey-25;
86
86
 
87
87
  // --- Legacy Notification color palette ---
88
88
  $error-red: $highlight-red;
89
- $error-pink: $highlight-purple;
89
+ $error-pink: $highlight-red;
90
90
  $warn-yellow: $highlight-yellow;
91
91
  $post-sale-pink: $highlight-purple;
92
92
  $cta-blue: $highlight-blue;
@@ -86,7 +86,7 @@ $off-white: $grey-25;
86
86
 
87
87
  // --- Legacy Notification color palette ---
88
88
  $error-red: $highlight-red;
89
- $error-pink: $highlight-purple;
89
+ $error-pink: $highlight-red;
90
90
  $warn-yellow: $highlight-yellow;
91
91
  $post-sale-pink: $highlight-purple;
92
92
  $cta-blue: $highlight-blue;
@@ -90,3 +90,4 @@
90
90
  @use 'components/AddToCalendar/addToCalendar';
91
91
  @use 'components/NotificationBanner/notificationBanner';
92
92
  @use 'patterns/TextBanner/textBanner';
93
+ @use 'patterns/PhoneNumberInput/phoneNumberInput';
@@ -83,18 +83,6 @@
83
83
  }
84
84
  }
85
85
 
86
- &__input-icon {
87
- align-items: center;
88
- color: $dark-gray;
89
- display: flex;
90
- left: $spacing-xsm;
91
- pointer-events: none;
92
- position: absolute;
93
- top: 50%;
94
- transform: translateY(-50%);
95
- z-index: 2;
96
- }
97
-
98
86
  .#{$px}-country-picker__input-wrapper .seldon-input__label {
99
87
  border: 0;
100
88
  height: 1px;
@@ -7,9 +7,11 @@
7
7
  width: 100%;
8
8
 
9
9
  &-label {
10
- color: $soft-black;
10
+ @include text($string2);
11
+
12
+ color: $pure-black;
11
13
  font-variation-settings: 'wght' 600;
12
- margin-bottom: $spacing-micro;
14
+ margin-bottom: $spacing-xsm;
13
15
 
14
16
  &--error {
15
17
  color: $error-red;
@@ -17,11 +19,13 @@
17
19
  }
18
20
 
19
21
  &-btn {
22
+ @include text($string2);
23
+
20
24
  align-items: center;
21
25
  appearance: none;
22
- background: $white-100;
23
- border: 1px solid $light-gray;
24
- border-radius: 6px;
26
+ background: $white;
27
+ border: 1px solid $black-100;
28
+ border-radius: 0.1875rem;
25
29
  box-sizing: border-box;
26
30
  cursor: pointer;
27
31
  display: flex;
@@ -29,9 +33,6 @@
29
33
  font-variation-settings: 'wght' 600;
30
34
  justify-content: space-between;
31
35
  padding: $spacing-xsm;
32
- transition:
33
- border-color 0.2s,
34
- box-shadow 0.2s;
35
36
  width: 100%;
36
37
 
37
38
  &:focus-visible {
@@ -42,11 +43,12 @@
42
43
 
43
44
  &--error {
44
45
  border-color: $error-red;
46
+ box-shadow: inset 0 0 3px 3px $error-pink;
45
47
  }
46
48
  }
47
49
 
48
50
  &-text {
49
- color: $soft-black;
51
+ color: $pure-black;
50
52
  flex: 1;
51
53
  overflow: hidden;
52
54
  text-align: left;
@@ -58,11 +60,29 @@
58
60
  align-items: center;
59
61
  display: flex;
60
62
  margin-left: $spacing-sm;
63
+
64
+ @media (min-width: $breakpoint-md) {
65
+ height: 1.25rem;
66
+ width: 1.25rem;
67
+ }
68
+
69
+ @media (min-width: $breakpoint-xl) {
70
+ height: 1.5rem;
71
+ width: 1.5rem;
72
+ }
61
73
  }
62
74
 
63
75
  &-error-msg {
64
- color: $error-red;
76
+ animation: reveal 0.45s linear forwards;
65
77
  margin-top: $spacing-micro;
78
+
79
+ // Reveal animation (match Input)
80
+ max-height: 2em;
81
+ opacity: 1;
82
+ transition: opacity 0.2s;
83
+ visibility: visible;
84
+ white-space: nowrap;
85
+ will-change: opacity, max-height;
66
86
  }
67
87
 
68
88
  &-flag {
@@ -0,0 +1,68 @@
1
+ @use '../../allPartials' as *;
2
+
3
+ .#{$px}-phone-number-input {
4
+ display: flex;
5
+ flex-direction: column;
6
+ position: relative;
7
+ width: 100%;
8
+
9
+ &__wrapper {
10
+ display: flex;
11
+ flex-direction: row;
12
+ gap: $spacing-xsm;
13
+ width: 100%;
14
+ }
15
+
16
+ &__error {
17
+ -webkit-box-orient: vertical;
18
+ display: -webkit-box;
19
+ -webkit-line-clamp: 2;
20
+ line-height: $spacing-md;
21
+
22
+ &-msg {
23
+ animation: reveal 0.45s linear forwards;
24
+
25
+ // Reveal animation (match Input)
26
+ max-height: 2em;
27
+ opacity: 1;
28
+ overflow: hidden;
29
+ transition: opacity 0.2s;
30
+ visibility: visible;
31
+ will-change: opacity, max-height;
32
+ }
33
+ }
34
+
35
+ // Hide the validation from the Input component
36
+ .#{$px}-input__validation {
37
+ display: none;
38
+ }
39
+
40
+ &__country-picker {
41
+ flex: 0 0 25%;
42
+ margin-right: $spacing-xsm;
43
+ min-width: 150px; // just big enough for flag and 3 digit code
44
+ }
45
+
46
+ &__input {
47
+ flex: 1 1 75%;
48
+ flex-grow: 1;
49
+ margin-top: calc(var(--string-line-height-size2) + 0.5rem);
50
+ }
51
+
52
+ @media screen and (min-width: $breakpoint-xl) {
53
+ &__wrapper {
54
+ align-items: center;
55
+ }
56
+
57
+ &__country-picker {
58
+ flex: 0 0 40%;
59
+ min-width: 0;
60
+ }
61
+
62
+ &__input {
63
+ flex: 1 1 60%;
64
+ margin-top: calc(var(--string-line-height-size2) + 1rem);
65
+ min-width: 0;
66
+ }
67
+ }
68
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.188.1",
3
+ "version": "1.190.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"
@@ -124,6 +124,7 @@
124
124
  "react": "^18.3.1",
125
125
  "react-docgen-typescript": "^2.2.2",
126
126
  "react-dom": "^18.2.0",
127
+ "react-hook-form": "^7.62.0",
127
128
  "rimraf": "^6.0.1",
128
129
  "rollup-plugin-copy": "^3.5.0",
129
130
  "rollup-plugin-peer-deps-external": "^2.2.4",