@phillips/seldon 1.42.0 → 1.43.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.
@@ -24,10 +24,6 @@ export interface AccordionItemProps extends React.HTMLAttributes<HTMLDivElement>
24
24
  * When true applied the transition keyframe animation on item expand. Default as false.
25
25
  */
26
26
  hasTransition?: boolean;
27
- /**
28
- * When true, isCollapsed won't be toggled.
29
- */
30
- isControlled?: boolean;
31
27
  }
32
- declare const AccordionItem: ({ isLocked, variation, label, isLastItem, hasTransition, children, isControlled, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
28
+ declare const AccordionItem: ({ isLocked, variation, label, isLastItem, hasTransition, children, ...props }: AccordionItemProps) => import("react/jsx-runtime").JSX.Element;
33
29
  export default AccordionItem;
@@ -1,101 +1,111 @@
1
- import { jsxs as I, jsx as e, Fragment as _ } from "react/jsx-runtime";
2
- import { useState as f } from "react";
3
- import { getCommonProps as h, noOp as C } from "../../utils/index.js";
4
- import p from "../../assets/plus.svg.js";
5
- import x from "../../assets/minus.svg.js";
6
- import v from "../../assets/lock.svg.js";
1
+ import { jsxs as g, jsx as o, Fragment as I } from "react/jsx-runtime";
2
+ import { getCommonProps as $ } from "../../utils/index.js";
3
+ import f from "../../assets/plus.svg.js";
4
+ import h from "../../assets/minus.svg.js";
5
+ import _ from "../../assets/lock.svg.js";
7
6
  import d from "../../node_modules/classnames/index.js";
8
- import { Item as A, Trigger as N, Content as T } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
9
- const j = ({
10
- children: o,
11
- className: r,
7
+ import { Item as p, Trigger as C, Content as v } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
8
+ import { getIconClasses as u } from "./utils.js";
9
+ const x = ({
10
+ children: n,
11
+ className: m,
12
12
  baseClassName: t,
13
- disable: n,
14
- isCollapsed: i,
15
- setIsCollapsed: a,
16
- isLargeVariation: s,
17
- id: c
13
+ disable: s,
14
+ isLargeVariation: c,
15
+ id: e
18
16
  }) => {
19
- const m = () => !n && a((l) => !l), g = n ? v : i ? p : x, $ = `${c}-` + (n ? "lockedIcon" : i ? "plusIcon" : "minusIcon");
20
- return /* @__PURE__ */ e(
21
- N,
17
+ const r = s, l = /* @__PURE__ */ o(
18
+ "img",
22
19
  {
23
- "data-disabled": n,
20
+ className: u(t, c, "lock"),
21
+ src: _,
22
+ "data-testid": `${e}-lockedIcon`,
23
+ "aria-hidden": !0
24
+ }
25
+ ), a = /* @__PURE__ */ o(
26
+ "img",
27
+ {
28
+ className: u(t, c, "plus"),
29
+ src: f,
30
+ "data-testid": `${e}-plusIcon`,
31
+ "aria-hidden": !0
32
+ }
33
+ ), i = /* @__PURE__ */ o(
34
+ "img",
35
+ {
36
+ className: u(t, c, "minus"),
37
+ src: h,
38
+ "data-testid": `${e}-minusIcon`,
39
+ "aria-hidden": !0
40
+ }
41
+ );
42
+ return /* @__PURE__ */ o(
43
+ C,
44
+ {
45
+ "data-disabled": s,
24
46
  asChild: !0,
25
- className: d(t, { [`${t}--hoverable`]: !n }, r),
26
- children: /* @__PURE__ */ I("div", { onClick: m, "data-testid": `${c}-trigger`, children: [
27
- /* @__PURE__ */ e("div", { className: d(`${t}__text`, { [`${t}__text--lg`]: s }), children: o }),
28
- /* @__PURE__ */ e(
29
- "img",
30
- {
31
- className: d(`${t}__icon`, { [`${t}__icon--lg`]: s }),
32
- src: g,
33
- "data-testid": $,
34
- "aria-hidden": !0
35
- }
36
- )
47
+ className: d(t, { [`${t}--hoverable`]: !s }, m),
48
+ children: /* @__PURE__ */ g("div", { "data-testid": `${e}-trigger`, children: [
49
+ /* @__PURE__ */ o("div", { className: d(`${t}__text`, { [`${t}__text--lg`]: c }), children: n }),
50
+ r && l,
51
+ !r && a,
52
+ !r && i
37
53
  ] })
38
54
  }
39
55
  );
40
- }, k = ({
41
- children: o,
42
- baseClassName: r,
56
+ }, N = ({
57
+ children: n,
58
+ baseClassName: m,
43
59
  disable: t,
44
- hasTransition: n,
45
- isLargeVariation: i,
46
- isCollapsed: a,
47
- className: s
48
- }) => /* @__PURE__ */ e(_, { children: t && o ? /* @__PURE__ */ e("div", { children: o }) : /* @__PURE__ */ e(
49
- T,
60
+ hasTransition: s,
61
+ isLargeVariation: c,
62
+ className: e
63
+ }) => /* @__PURE__ */ o(I, { children: t && n ? /* @__PURE__ */ o("div", { children: n }) : /* @__PURE__ */ o(
64
+ v,
50
65
  {
51
66
  asChild: !0,
52
67
  className: d(
53
- { [`${r}__content--lg`]: i },
54
- { [`${r}--transition`]: n },
55
- { [`${r}--expanded`]: !a },
56
- s
68
+ { [`${m}__content--lg`]: c },
69
+ { [`${m}--transition`]: s },
70
+ e
57
71
  ),
58
- children: o
72
+ children: n
59
73
  }
60
- ) }), z = ({
61
- isLocked: o,
62
- variation: r,
74
+ ) }), P = ({
75
+ isLocked: n,
76
+ variation: m,
63
77
  label: t,
64
- isLastItem: n,
65
- hasTransition: i = !1,
66
- children: a,
67
- isControlled: s = !0,
68
- ...c
78
+ isLastItem: s,
79
+ hasTransition: c = !1,
80
+ children: e,
81
+ ...r
69
82
  }) => {
70
- const [m, g] = f(!0), { className: $ } = h(c, "Accordion"), l = r === "lg", u = `${$}-item`;
71
- return /* @__PURE__ */ I(
72
- A,
83
+ const { className: l } = $(r, "Accordion"), a = m === "lg", i = `${l}-item`;
84
+ return /* @__PURE__ */ g(
85
+ p,
73
86
  {
74
- disabled: o,
87
+ disabled: n,
75
88
  value: t,
76
- className: d(u, { [`${u}__border-bottom`]: !n }),
89
+ className: d(i, { [`${i}__border-bottom`]: !s }),
77
90
  children: [
78
- /* @__PURE__ */ e(
79
- j,
91
+ /* @__PURE__ */ o(
92
+ x,
80
93
  {
81
- disable: o,
82
- isLargeVariation: l,
83
- isCollapsed: m,
84
- setIsCollapsed: s ? g : C,
85
- id: c == null ? void 0 : c.id,
86
- baseClassName: `${u}-label`,
94
+ disable: n,
95
+ isLargeVariation: a,
96
+ id: r == null ? void 0 : r.id,
97
+ baseClassName: `${i}-label`,
87
98
  children: t
88
99
  }
89
100
  ),
90
- /* @__PURE__ */ e(
91
- k,
101
+ /* @__PURE__ */ o(
102
+ N,
92
103
  {
93
- disable: o,
94
- hasTransition: i,
95
- isLargeVariation: l,
96
- isCollapsed: m,
97
- baseClassName: u,
98
- children: a
104
+ disable: n,
105
+ hasTransition: c,
106
+ isLargeVariation: a,
107
+ baseClassName: i,
108
+ children: e
99
109
  }
100
110
  )
101
111
  ]
@@ -103,5 +113,5 @@ const j = ({
103
113
  );
104
114
  };
105
115
  export {
106
- z as default
116
+ P as default
107
117
  };
@@ -12,8 +12,6 @@ export interface AccordionHeaderType {
12
12
  */
13
13
  baseClassName: string;
14
14
  disable: boolean;
15
- isCollapsed: boolean;
16
- setIsCollapsed: React.Dispatch<React.SetStateAction<boolean>>;
17
15
  isLargeVariation: boolean;
18
16
  /**
19
17
  * Unique id for icon component testing
@@ -39,7 +37,6 @@ export interface AccordionContentType {
39
37
  */
40
38
  hasTransition?: boolean;
41
39
  isLargeVariation: boolean;
42
- isCollapsed: boolean;
43
40
  }
44
41
  export declare enum AccordionVariants {
45
42
  multiple = "multiple",
@@ -15,3 +15,11 @@ export interface AccordionVariantProps {
15
15
  * The collapsible prop should only be passed when the variant is single
16
16
  */
17
17
  export declare const getAccordionVariantProps: (variant?: AccordionVariantKey) => AccordionVariantProps;
18
+ /**
19
+ * A helper for getting the classes of the Accordion icons
20
+ * @param className - The className of the component
21
+ * @param isLargeVariation - Determines whether the variation on text style is large or small.
22
+ * @param iconName - The name of the icon to be displayed
23
+ * @returns the classes that should be applied for the icon
24
+ */
25
+ export declare const getIconClasses: (className: string, isLargeVariation: boolean, iconName: string) => string;
@@ -1,8 +1,12 @@
1
- import { AccordionVariants as i } from "./types.js";
2
- const s = (e) => {
3
- const l = { type: "multiple" };
4
- return e === i.singleCollapsible && (l.type = "single", l.collapsible = !0), e === i.singleNonCollapsible && (l.type = "single", l.collapsible = !1), l;
5
- };
1
+ import n from "../../node_modules/classnames/index.js";
2
+ import { AccordionVariants as l } from "./types.js";
3
+ const r = (i) => {
4
+ const o = { type: "multiple" };
5
+ return i === l.singleCollapsible && (o.type = "single", o.collapsible = !0), i === l.singleNonCollapsible && (o.type = "single", o.collapsible = !1), o;
6
+ }, p = (i, o, e) => n(`${i}__icon`, `${i}-${e}__icon`, {
7
+ [`${i}__icon--lg`]: o
8
+ });
6
9
  export {
7
- s as getAccordionVariantProps
10
+ r as getAccordionVariantProps,
11
+ p as getIconClasses
8
12
  };
@@ -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
  };
@@ -1,5 +1,5 @@
1
1
  // prefix
2
- $px: phillips;
2
+ $px: seldon;
3
3
 
4
4
  ////////////////////////
5
5
  /// COlORS:
@@ -14,7 +14,7 @@
14
14
  border-bottom: 1px solid $keyline-gray;
15
15
  }
16
16
 
17
- &--expanded {
17
+ &[data-state='open'] {
18
18
  display: block;
19
19
  font-weight: 400;
20
20
  height: auto;
@@ -39,6 +39,26 @@
39
39
  animation: slide-up 250ms end;
40
40
  }
41
41
 
42
+ &[data-state='open'] {
43
+ .phillips-accordion-item-label-plus__icon {
44
+ display: none;
45
+ }
46
+
47
+ .phillips-accordion-item-label-minus__icon {
48
+ display: block;
49
+ }
50
+ }
51
+
52
+ &[data-state='closed'] {
53
+ .phillips-accordion-item-label-plus__icon {
54
+ display: block;
55
+ }
56
+
57
+ .phillips-accordion-item-label-minus__icon {
58
+ display: none;
59
+ }
60
+ }
61
+
42
62
  @keyframes slide-down {
43
63
  from {
44
64
  height: 0;
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- export declare const px = "phillips";
2
+ export declare const px = "seldon";
3
3
  /**
4
4
  * Returns standard props values incorporating the component name into the class name and data-testid
5
5
  */
@@ -1,15 +1,15 @@
1
1
  import { jsx as m } from "react/jsx-runtime";
2
2
  import { kebabCase as d } from "../node_modules/change-case/dist/index.js";
3
3
  import * as u from "react";
4
- const i = "phillips", x = ({ id: e, ...n }, a) => {
4
+ const s = "seldon", x = ({ id: e, ...n }, a) => {
5
5
  const t = d(a);
6
6
  return {
7
7
  ...n,
8
8
  "data-testid": e ? `${t}-${e}` : `${t}`,
9
- className: `${i}-${t}`
9
+ className: `${s}-${t}`
10
10
  };
11
11
  };
12
- var p = /* @__PURE__ */ ((e) => (e.xs = "xs", e.sm = "sm", e.md = "md", e.lg = "lg", e.xl = "xl", e.xxl = "xxl", e))(p || {});
12
+ var $ = /* @__PURE__ */ ((e) => (e.xs = "xs", e.sm = "sm", e.md = "md", e.lg = "lg", e.xl = "xl", e.xxl = "xxl", e))($ || {});
13
13
  const v = () => {
14
14
  };
15
15
  function g({
@@ -18,7 +18,7 @@ function g({
18
18
  invalid: a = !1,
19
19
  invalidText: t = "invalid",
20
20
  readOnly: r = !1,
21
- type: s,
21
+ type: i,
22
22
  warn: l = !1,
23
23
  warnText: c
24
24
  }) {
@@ -26,14 +26,14 @@ function g({
26
26
  disabled: !r && e,
27
27
  invalid: !r && !e && a,
28
28
  invalidId: `${n}-error-msg`,
29
- type: s === "toggle" ? "checkbox" : s,
29
+ type: i === "toggle" ? "checkbox" : i,
30
30
  warn: !r && !e && !a && l,
31
31
  warnId: `${n}-warn-msg`,
32
32
  validation: null
33
33
  };
34
- return o.invalid && (o.validation = /* @__PURE__ */ m("div", { className: `${i}-input__validation ${i}-${s}-input--invalid`, id: o.invalidId, children: t })), o.warn && (o.validation = /* @__PURE__ */ m("div", { className: `${i}-input__validation ${i}-${s}-input--warn`, id: o.warnId, children: c })), o;
34
+ return o.invalid && (o.validation = /* @__PURE__ */ m("div", { className: `${s}-input__validation ${s}-${i}-input--invalid`, id: o.invalidId, children: t })), o.warn && (o.validation = /* @__PURE__ */ m("div", { className: `${s}-input__validation ${s}-${i}-input--warn`, id: o.warnId, children: c })), o;
35
35
  }
36
- const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "vertical") => `${i}-padding-${a}-${e}-${n}`, h = (e) => /(.+)@(.+){2,}\.(.+){2,}/i.test(e), I = function(e, n, a = !1) {
36
+ const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "vertical") => `${s}-padding-${a}-${e}-${n}`, h = (e) => /(.+)@(.+){2,}\.(.+){2,}/i.test(e), I = function(e, n, a = !1) {
37
37
  const t = u.Children.toArray(e).filter((r) => r && r.type === n && !a ? r : r && r.type !== n && a);
38
38
  return t.length > 0 ? t : null;
39
39
  }, N = (e) => {
@@ -41,7 +41,7 @@ const C = (/* @__PURE__ */ new Date()).getFullYear(), w = (e, n = "end", a = "ve
41
41
  return `${n[0]}?${r}`;
42
42
  };
43
43
  export {
44
- p as PaddingTokens,
44
+ $ as PaddingTokens,
45
45
  C as defaultYear,
46
46
  h as emailValidation,
47
47
  N as encodeURLSearchParams,
@@ -49,6 +49,6 @@ export {
49
49
  w as generatePaddingClassName,
50
50
  x as getCommonProps,
51
51
  v as noOp,
52
- i as px,
52
+ s as px,
53
53
  g as useNormalizedInputProps
54
54
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.42.0",
3
+ "version": "1.43.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"