@phillips/seldon 1.42.0 → 1.42.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.
@@ -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
  };
@@ -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;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.42.0",
3
+ "version": "1.42.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"