@phillips/seldon 1.42.1 → 1.44.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.
Files changed (26) hide show
  1. package/dist/assets/chevronDown.svg.js +5 -0
  2. package/dist/components/Dropdown/Dropdown.d.ts +32 -0
  3. package/dist/components/Dropdown/Dropdown.js +49 -0
  4. package/dist/components/Dropdown/index.d.ts +1 -0
  5. package/dist/components/Dropdown/types.d.ts +4 -0
  6. package/dist/components/ViewingsList/ViewingsListCard.js +38 -38
  7. package/dist/index.d.ts +1 -0
  8. package/dist/index.js +33 -31
  9. package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +521 -0
  10. package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +373 -0
  11. package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +203 -0
  12. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +128 -0
  13. package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +129 -0
  14. package/dist/node_modules/@radix-ui/number/dist/index.js +6 -0
  15. package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +24 -0
  16. package/dist/node_modules/@radix-ui/react-popper/dist/index.js +220 -0
  17. package/dist/node_modules/@radix-ui/react-select/dist/index.js +824 -0
  18. package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +8 -0
  19. package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +27 -0
  20. package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +30 -0
  21. package/dist/scss/_vars.scss +1 -1
  22. package/dist/scss/componentStyles.scss +1 -0
  23. package/dist/scss/components/Dropdown/_dropdown.scss +86 -0
  24. package/dist/utils/index.d.ts +1 -1
  25. package/dist/utils/index.js +9 -9
  26. package/package.json +2 -1
@@ -0,0 +1,5 @@
1
+ import * as e from "react";
2
+ const l = (t) => /* @__PURE__ */ e.createElement("svg", { width: 32, height: 32, viewBox: "0 0 32 32", fill: "none", xmlns: "http://www.w3.org/2000/svg", ...t }, /* @__PURE__ */ e.createElement("path", { fillRule: "evenodd", clipRule: "evenodd", d: "M16.1313 18.2525L24.4194 9.96438C24.7123 9.67148 25.4883 9.61908 25.9346 10.0654C26.3809 10.5117 26.3285 11.2877 26.0356 11.5806L16.8432 20.773C16.6948 20.9215 16.4222 21.0081 16.1313 20.9994C15.8404 21.0081 15.5678 20.9215 15.4194 20.773L6.227 11.5806C5.9341 11.2877 5.8817 10.5117 6.32801 10.0654C6.77432 9.61908 7.55035 9.67148 7.84324 9.96438L16.1313 18.2525Z", fill: "#323232" }));
3
+ export {
4
+ l as default
5
+ };
@@ -0,0 +1,32 @@
1
+ import React, { ComponentProps } from 'react';
2
+ import * as DropdownSelect from '@radix-ui/react-select';
3
+ import { DropdownItem } from './types';
4
+ export interface DropdownProps extends Omit<DropdownSelect.SelectProps, 'defaultValue' | 'dir'>, Omit<ComponentProps<'div'>, 'ref'> {
5
+ /**
6
+ * All options to be listed in the dropdown
7
+ */
8
+ options: DropdownItem[];
9
+ /**
10
+ * Current selected value
11
+ */
12
+ value: DropdownSelect.SelectProps['defaultValue'];
13
+ /**
14
+ * Pass a call back that triggers once a new value is selected
15
+ */
16
+ onValueChange: (value: string) => void;
17
+ /**
18
+ * Aria-label for specific dropdown use, e.g. Select your language
19
+ */
20
+ label: string;
21
+ }
22
+ /**
23
+ * ## Overview
24
+ *
25
+ * Overview of this component
26
+ *
27
+ * [Figma Link](https://www.figma.com/design/hMu9IWH5N3KamJy8tLFdyV/EASEL-Compendium%3A-Tokens%2C-Components-%26-Patterns?node-id=10570-6295&t=EnYSS6Hk58EiWaVg-4)
28
+ *
29
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-dropdown--overview)
30
+ */
31
+ declare const Dropdown: React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<HTMLButtonElement>>;
32
+ export default Dropdown;
@@ -0,0 +1,49 @@
1
+ import { jsx as e, jsxs as n } from "react/jsx-runtime";
2
+ import d, { useState as g } from "react";
3
+ import { getCommonProps as C } from "../../utils/index.js";
4
+ import i from "../../node_modules/classnames/index.js";
5
+ import { Root as D, Trigger as $, Value as b, Icon as v, Portal as I, Content as S, ScrollUpButton as x, Viewport as R, ScrollDownButton as O, Item as P, ItemText as V } from "../../node_modules/@radix-ui/react-select/dist/index.js";
6
+ import c from "../../assets/chevronDown.svg.js";
7
+ const j = d.forwardRef(
8
+ ({ options: l, value: a, onValueChange: s, label: t, className: _, id: m, ...h }, f) => {
9
+ const { className: o, ...u } = C({ id: m }, "Dropdown"), [N, w] = g(!1);
10
+ return /* @__PURE__ */ e("div", { className: i(o, _), id: m, ...u, ...h, children: /* @__PURE__ */ n(
11
+ D,
12
+ {
13
+ value: a,
14
+ onValueChange: (r) => {
15
+ s(r);
16
+ },
17
+ onOpenChange: w,
18
+ children: [
19
+ /* @__PURE__ */ n($, { className: `${o}__trigger`, "aria-label": t, ref: f, children: [
20
+ /* @__PURE__ */ e(b, { placeholder: a }),
21
+ /* @__PURE__ */ e(v, { children: /* @__PURE__ */ e(c, { className: i({ [`${o}__trigger-icon-expanded`]: N }) }) })
22
+ ] }),
23
+ /* @__PURE__ */ e(I, { children: /* @__PURE__ */ n(S, { className: `${o}__content`, position: "popper", children: [
24
+ /* @__PURE__ */ e(x, { className: `${o}__scroll-button__up`, children: /* @__PURE__ */ e(c, {}) }),
25
+ /* @__PURE__ */ e(R, { className: `${o}__viewport`, children: l.map((r) => /* @__PURE__ */ e(
26
+ p,
27
+ {
28
+ value: r.value,
29
+ disabled: r.value === a,
30
+ className: o,
31
+ children: r.label
32
+ },
33
+ r.value
34
+ )) }),
35
+ /* @__PURE__ */ e(O, { className: `${o}__scroll-button`, children: /* @__PURE__ */ e(c, {}) })
36
+ ] }) })
37
+ ]
38
+ }
39
+ ) });
40
+ }
41
+ );
42
+ j.displayName = "Dropdown";
43
+ const p = d.forwardRef(
44
+ ({ children: l, className: a, ...s }, t) => /* @__PURE__ */ e(P, { className: `${a}__item`, ...s, ref: t, children: /* @__PURE__ */ e(V, { children: l }) })
45
+ );
46
+ p.displayName = "DropdownSelectItem";
47
+ export {
48
+ j as default
49
+ };
@@ -0,0 +1 @@
1
+ export { default as Dropdown, type DropdownProps } from './Dropdown';
@@ -0,0 +1,4 @@
1
+ export interface DropdownItem {
2
+ label: string;
3
+ value: string;
4
+ }
@@ -1,13 +1,13 @@
1
- import { jsxs as u, jsx as t, Fragment as E } from "react/jsx-runtime";
1
+ import { jsxs as m, jsx as t, Fragment as $ } from "react/jsx-runtime";
2
2
  import * as a from "react";
3
3
  import mt from "../../node_modules/classnames/index.js";
4
- import { px as d } from "../../utils/index.js";
4
+ import { px as u } from "../../utils/index.js";
5
5
  import y from "../Input/Input.js";
6
6
  import c from "../Button/Button.js";
7
7
  import { ButtonVariants as l } from "../Button/types.js";
8
8
  import ft from "./ViewingsListCardForm.js";
9
- const i = `${d}-viewings-list-card`, $t = ({
10
- address1: $,
9
+ const i = `${u}-viewings-list-card`, dt = ({
10
+ address1: d,
11
11
  address1Label: C,
12
12
  addressUrl: O,
13
13
  addressUrlLabel: w,
@@ -19,8 +19,8 @@ const i = `${d}-viewings-list-card`, $t = ({
19
19
  cardTitle: T = "Add New Viewing",
20
20
  deleteBtnLabel: V = "DELETE",
21
21
  editBtnLabel: _ = "EDIT",
22
- isEditState: s,
23
- enableOnSite: m = "false",
22
+ isEditState: o,
23
+ enableOnSite: f = "false",
24
24
  enableOnSiteToggleLabel: k = "Enabled on website",
25
25
  email: I,
26
26
  emailLabel: N = "Email",
@@ -32,10 +32,10 @@ const i = `${d}-viewings-list-card`, $t = ({
32
32
  invalidFields: n,
33
33
  location: R,
34
34
  locationLabel: q = "Location",
35
- onCancel: f,
36
- onEdit: p,
37
- onDelete: h,
38
- onSave: b,
35
+ onCancel: p,
36
+ onEdit: h,
37
+ onDelete: b,
38
+ onSave: g,
39
39
  previewDates: G,
40
40
  previewDatesLabel: H,
41
41
  previewHours1: J,
@@ -52,37 +52,37 @@ const i = `${d}-viewings-list-card`, $t = ({
52
52
  viewingDates: tt,
53
53
  viewingDatesLabel: et,
54
54
  viewingHours1: nt,
55
- viewingHours1Label: st,
56
- viewingHours2: ot,
57
- viewingHours2Label: rt
55
+ viewingHours1Label: ot,
56
+ viewingHours2: rt,
57
+ viewingHours2Label: st
58
58
  }) => {
59
- const [at, ct] = a.useState(m === "true"), r = a.useRef(null);
59
+ const [at, ct] = a.useState(f === "true"), s = a.useRef(null);
60
60
  a.useEffect(() => {
61
- s && r.current && r.current.focus();
62
- }, [s]), a.useEffect(() => {
63
- var o, g;
64
- n && r.current && ((g = (o = r.current.closest(".phillips-viewings-list-card")) == null ? void 0 : o.querySelector(".phillips-input--invalid input")) == null || g.focus());
61
+ o && s.current && s.current.focus();
62
+ }, [o]), a.useEffect(() => {
63
+ var r, E;
64
+ n && s.current && ((E = (r = s.current.closest(`.${u}-viewings-list-card`)) == null ? void 0 : r.querySelector(`.${u}-input--invalid input`)) == null || E.focus());
65
65
  }, [n]);
66
66
  const lt = () => {
67
- typeof f == "function" && f();
68
- }, it = () => {
69
67
  typeof p == "function" && p();
70
- }, ut = (o) => {
71
- typeof b == "function" && b(o);
68
+ }, it = () => {
69
+ typeof h == "function" && h();
70
+ }, ut = (r) => {
71
+ typeof g == "function" && g(r);
72
72
  };
73
- return /* @__PURE__ */ u(
73
+ return /* @__PURE__ */ m(
74
74
  "section",
75
75
  {
76
76
  "data-testid": `viewings-list-card-${e}`,
77
77
  id: e,
78
- className: mt(`${i}`, { [`${i}--edit-state`]: s }),
78
+ className: mt(`${i}`, { [`${i}--edit-state`]: o }),
79
79
  children: [
80
80
  /* @__PURE__ */ t("h3", { className: `${i}__title`, children: T }),
81
81
  /* @__PURE__ */ t("input", { type: "hidden", name: "id", value: e }),
82
82
  /* @__PURE__ */ t(
83
83
  y,
84
84
  {
85
- ref: r,
85
+ ref: s,
86
86
  id: `location-${e}`,
87
87
  defaultValue: R,
88
88
  labelText: q,
@@ -90,13 +90,13 @@ const i = `${d}-viewings-list-card`, $t = ({
90
90
  name: "location",
91
91
  invalid: n == null ? void 0 : n.location,
92
92
  invalidText: n == null ? void 0 : n.location,
93
- readOnly: !s
93
+ readOnly: !o
94
94
  }
95
95
  ),
96
- s ? /* @__PURE__ */ t(
96
+ o ? /* @__PURE__ */ t(
97
97
  ft,
98
98
  {
99
- address1: $,
99
+ address1: d,
100
100
  address1Label: C,
101
101
  addressUrl: O,
102
102
  addressUrlLabel: w,
@@ -127,9 +127,9 @@ const i = `${d}-viewings-list-card`, $t = ({
127
127
  viewingDates: tt,
128
128
  viewingDatesLabel: et,
129
129
  viewingHours1: nt,
130
- viewingHours1Label: st,
131
- viewingHours2: ot,
132
- viewingHours2Label: rt
130
+ viewingHours1Label: ot,
131
+ viewingHours2: rt,
132
+ viewingHours2Label: st
133
133
  }
134
134
  ) : null,
135
135
  /* @__PURE__ */ t(
@@ -137,19 +137,19 @@ const i = `${d}-viewings-list-card`, $t = ({
137
137
  {
138
138
  id: `enableOnSite-${e}`,
139
139
  type: "toggle",
140
- defaultChecked: m === "true",
140
+ defaultChecked: f === "true",
141
141
  labelText: k,
142
142
  size: "md",
143
143
  inline: !0,
144
144
  value: "true",
145
145
  name: "enableOnSite",
146
- onChange: () => ct((o) => !o),
147
- readOnly: !s
146
+ onChange: () => ct((r) => !r),
147
+ readOnly: !o
148
148
  }
149
149
  ),
150
150
  at ? null : /* @__PURE__ */ t("input", { type: "hidden", name: "enableOnSite", value: "false" }),
151
151
  /* @__PURE__ */ t("hr", {}),
152
- /* @__PURE__ */ t("div", { className: `${i}__btn-group ${d}-button__group`, children: s ? /* @__PURE__ */ u(E, { children: [
152
+ /* @__PURE__ */ t("div", { className: `${i}__btn-group ${u}-button__group`, children: o ? /* @__PURE__ */ m($, { children: [
153
153
  /* @__PURE__ */ t(
154
154
  c,
155
155
  {
@@ -172,7 +172,7 @@ const i = `${d}-viewings-list-card`, $t = ({
172
172
  children: L
173
173
  }
174
174
  )
175
- ] }) : /* @__PURE__ */ u(E, { children: [
175
+ ] }) : /* @__PURE__ */ m($, { children: [
176
176
  /* @__PURE__ */ t(
177
177
  c,
178
178
  {
@@ -191,7 +191,7 @@ const i = `${d}-viewings-list-card`, $t = ({
191
191
  variant: l.ghost,
192
192
  type: "button",
193
193
  size: "sm",
194
- onClick: () => typeof h == "function" && h(e),
194
+ onClick: () => typeof b == "function" && b(e),
195
195
  children: V
196
196
  }
197
197
  )
@@ -201,5 +201,5 @@ const i = `${d}-viewings-list-card`, $t = ({
201
201
  );
202
202
  };
203
203
  export {
204
- $t as default
204
+ dt as default
205
205
  };
package/dist/index.d.ts CHANGED
@@ -36,4 +36,5 @@ export { default as UserManagement, type UserManagementProps } from './component
36
36
  export { AuthState } from './components/UserManagement/types';
37
37
  export * from './types/commonTypes';
38
38
  export { Breadcrumb, type BreadcrumbProps } from './components/Breadcrumb';
39
+ export * from './components/Dropdown';
39
40
  export { default as Video, type VideoProps } from './components/Video/Video';
package/dist/index.js CHANGED
@@ -1,17 +1,17 @@
1
- import { PaddingTokens as a, defaultYear as f, emailValidation as m, encodeURLSearchParams as p, findChildrenOfType as d, generatePaddingClassName as s, getCommonProps as u, noOp as i, px as l, useNormalizedInputProps as x } from "./utils/index.js";
1
+ import { PaddingTokens as a, defaultYear as f, emailValidation as m, encodeURLSearchParams as p, findChildrenOfType as d, generatePaddingClassName as s, getCommonProps as u, noOp as l, px as i, useNormalizedInputProps as x } from "./utils/index.js";
2
2
  import { default as g } from "./pages/Page.js";
3
3
  import { default as S } from "./components/Button/Button.js";
4
4
  import { ButtonVariants as I } from "./components/Button/types.js";
5
5
  import { default as P } from "./components/IconButton/IconButton.js";
6
6
  import { default as k } from "./components/ErrorBoundary/ErrorBoundary.js";
7
- import { default as T } from "./components/Footer/Footer.js";
8
- import { Grid as h } from "./components/Grid/Grid.js";
9
- import { default as w } from "./components/Header/Header.js";
7
+ import { default as w } from "./components/Footer/Footer.js";
8
+ import { Grid as b } from "./components/Grid/Grid.js";
9
+ import { default as v } from "./components/Header/Header.js";
10
10
  import { default as C } from "./components/Navigation/Navigation.js";
11
11
  import { default as y } from "./components/Navigation/NavigationItem/NavigationItem.js";
12
- import { default as M } from "./components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js";
13
- import { default as R } from "./components/Navigation/NavigationList/NavigationList.js";
14
- import { default as z } from "./components/HeroBanner/HeroBanner.js";
12
+ import { default as H } from "./components/Navigation/NavigationItemTrigger/NavigationItemTrigger.js";
13
+ import { default as O } from "./components/Navigation/NavigationList/NavigationList.js";
14
+ import { default as U } from "./components/HeroBanner/HeroBanner.js";
15
15
  import { default as E } from "./components/Input/Input.js";
16
16
  import { default as Y } from "./components/Link/Link.js";
17
17
  import { LinkVariants as q } from "./components/Link/types.js";
@@ -20,42 +20,44 @@ import { default as W } from "./components/LinkList/LinkList.js";
20
20
  import { default as Z } from "./components/Row/Row.js";
21
21
  import { default as $ } from "./components/GridItem/GridItem.js";
22
22
  import { GridItemAlign as re } from "./components/GridItem/types.js";
23
- import { default as oe } from "./components/Search/Search.js";
23
+ import { default as te } from "./components/Search/Search.js";
24
24
  import { default as fe } from "./components/Select/Select.js";
25
25
  import { default as pe } from "./components/SplitPanel/SplitPanel.js";
26
26
  import { default as se } from "./components/Subscribe/Subscribe.js";
27
- import { SubscriptionState as ie } from "./components/Subscribe/types.js";
27
+ import { SubscriptionState as le } from "./components/Subscribe/types.js";
28
28
  import { default as xe } from "./components/Social/Social.js";
29
29
  import { default as ge } from "./components/ViewingsList/ViewingsList.js";
30
30
  import { default as Se } from "./components/Modal/Modal.js";
31
31
  import { default as Ie } from "./components/Drawer/Drawer.js";
32
32
  import { default as Pe } from "./components/ViewingsList/StatefulViewingsList.js";
33
33
  import { TextVariants as ke } from "./components/Text/types.js";
34
- import { default as Te } from "./components/Text/Text.js";
35
- import { default as he } from "./components/Accordion/Accordion.js";
36
- import { default as we } from "./components/Accordion/AccordionItem.js";
34
+ import { default as we } from "./components/Text/Text.js";
35
+ import { default as be } from "./components/Accordion/Accordion.js";
36
+ import { default as ve } from "./components/Accordion/AccordionItem.js";
37
37
  import { default as Ce } from "./components/UserManagement/UserManagement.js";
38
38
  import { AuthState as ye } from "./components/UserManagement/types.js";
39
- import { SupportedLanguages as Me } from "./types/commonTypes.js";
40
- import { default as Re } from "./components/Breadcrumb/Breadcrumb.js";
39
+ import { SupportedLanguages as He } from "./types/commonTypes.js";
40
+ import { default as Oe } from "./components/Breadcrumb/Breadcrumb.js";
41
41
  import "react/jsx-runtime";
42
42
  import "./node_modules/classnames/index.js";
43
- import { default as ze } from "./components/Video/Video.js";
43
+ import { default as Ue } from "./components/Dropdown/Dropdown.js";
44
+ import { default as Ee } from "./components/Video/Video.js";
44
45
  export {
45
- he as Accordion,
46
- we as AccordionItem,
46
+ be as Accordion,
47
+ ve as AccordionItem,
47
48
  ye as AuthState,
48
- Re as Breadcrumb,
49
+ Oe as Breadcrumb,
49
50
  S as Button,
50
51
  I as ButtonVariants,
51
52
  Ie as Drawer,
53
+ Ue as Dropdown,
52
54
  k as ErrorBoundary,
53
- T as Footer,
54
- h as Grid,
55
+ w as Footer,
56
+ b as Grid,
55
57
  $ as GridItem,
56
58
  re as GridItemAlign,
57
- w as Header,
58
- z as HeroBanner,
59
+ v as Header,
60
+ U as HeroBanner,
59
61
  P as IconButton,
60
62
  E as Input,
61
63
  Y as Link,
@@ -65,23 +67,23 @@ export {
65
67
  Se as Modal,
66
68
  C as Navigation,
67
69
  y as NavigationItem,
68
- M as NavigationItemTrigger,
69
- R as NavigationList,
70
+ H as NavigationItemTrigger,
71
+ O as NavigationList,
70
72
  a as PaddingTokens,
71
73
  g as Page,
72
74
  Z as Row,
73
- oe as Search,
75
+ te as Search,
74
76
  fe as Select,
75
77
  xe as Social,
76
78
  pe as SplitPanel,
77
79
  Pe as StatefulViewingsList,
78
80
  se as Subscribe,
79
- ie as SubscriptionState,
80
- Me as SupportedLanguages,
81
- Te as Text,
81
+ le as SubscriptionState,
82
+ He as SupportedLanguages,
83
+ we as Text,
82
84
  ke as TextVariants,
83
85
  Ce as UserManagement,
84
- ze as Video,
86
+ Ee as Video,
85
87
  ge as ViewingsList,
86
88
  f as defaultYear,
87
89
  m as emailValidation,
@@ -89,7 +91,7 @@ export {
89
91
  d as findChildrenOfType,
90
92
  s as generatePaddingClassName,
91
93
  u as getCommonProps,
92
- i as noOp,
93
- l as px,
94
+ l as noOp,
95
+ i as px,
94
96
  x as useNormalizedInputProps
95
97
  };