@phillips/seldon 1.38.4 → 1.38.6

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,13 +1,30 @@
1
+ import { AccordionVariantKey } from './types';
1
2
  import React from 'react';
2
3
  export interface AccordionProps extends React.HTMLAttributes<HTMLDivElement> {
3
4
  /**
4
5
  * Unique id for component testing
5
6
  */
6
7
  id?: string;
8
+ /**
9
+ * Determines the Accordion variant to use. `multiple` allows multiple elements to be opened at the same time.
10
+ * The `single` variants only allow one element opened at a time.
11
+ * `singleCollapsible` allows users to close an open element by clicking on it, while `singleNonCollapsible` does not.
12
+ * Defaults to `multiple`.
13
+ */
14
+ variant?: AccordionVariantKey;
7
15
  /**
8
16
  * Child element pass in to display as item content.
9
17
  */
10
18
  children?: React.ReactNode;
11
19
  }
20
+ /**
21
+ * ## Overview
22
+ *
23
+ * Overview of this component
24
+ *
25
+ * [Figma Link](https://www.figma.com/design/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?node-id=4433-163013&t=lhB2YjBptvQ97UWF-0)
26
+ *
27
+ * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-accordion--overview)
28
+ */
12
29
  declare const AccordionComponent: ({ className, children, ...props }: AccordionProps) => import("react/jsx-runtime").JSX.Element;
13
30
  export default AccordionComponent;
@@ -1,20 +1,21 @@
1
- import { jsx as e } from "react/jsx-runtime";
2
- import s from "../../node_modules/classnames/index.js";
3
- import { getCommonProps as n } from "../../utils/index.js";
4
- import { Root as r } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
5
- const i = "multiple", C = ({ className: m, children: t, ...o }) => {
6
- const { className: a, ...c } = n(o, "Accordion");
7
- return /* @__PURE__ */ e(
8
- r,
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import c from "../../node_modules/classnames/index.js";
3
+ import { getCommonProps as i } from "../../utils/index.js";
4
+ import { Root as e } from "../../node_modules/@radix-ui/react-accordion/dist/index.js";
5
+ import { getAccordionVariantProps as d } from "./utils.js";
6
+ const N = ({ className: m, children: t, ...o }) => {
7
+ const { className: a, ...r } = i(o, "Accordion"), n = d(o.variant);
8
+ return /* @__PURE__ */ s(
9
+ e,
9
10
  {
10
- className: s(`${a}`, m),
11
- type: i,
12
- ...c,
11
+ className: c(`${a}`, m),
12
+ ...r,
13
+ ...n,
13
14
  id: o == null ? void 0 : o.id,
14
15
  children: t
15
16
  }
16
17
  );
17
18
  };
18
19
  export {
19
- C as default
20
+ N as default
20
21
  };
@@ -41,3 +41,9 @@ export interface AccordionContentType {
41
41
  isLargeVariation: boolean;
42
42
  isCollapsed: boolean;
43
43
  }
44
+ export declare enum AccordionVariants {
45
+ multiple = "multiple",
46
+ singleCollapsible = "singleCollapsible",
47
+ singleNonCollapsible = "singleNonCollapsible"
48
+ }
49
+ export type AccordionVariantKey = keyof typeof AccordionVariants;
@@ -0,0 +1,4 @@
1
+ var e = /* @__PURE__ */ ((l) => (l.multiple = "multiple", l.singleCollapsible = "singleCollapsible", l.singleNonCollapsible = "singleNonCollapsible", l))(e || {});
2
+ export {
3
+ e as AccordionVariants
4
+ };
@@ -0,0 +1,17 @@
1
+ import { AccordionVariantKey } from './types';
2
+ export interface AccordionVariantProps {
3
+ /**
4
+ * Determines whether multiple elements can be opened at the same time or not.
5
+ */
6
+ type: 'single' | 'multiple';
7
+ /**
8
+ * Determines if an open element can be closed by clicking on it.
9
+ * Only applicable to the `single` variants.
10
+ */
11
+ collapsible?: boolean;
12
+ }
13
+ /**
14
+ * Sets the type and collapsible props based on the variant prop
15
+ * The collapsible prop should only be passed when the variant is single
16
+ */
17
+ export declare const getAccordionVariantProps: (variant?: AccordionVariantKey) => AccordionVariantProps;
@@ -0,0 +1,8 @@
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
+ };
6
+ export {
7
+ s as getAccordionVariantProps
8
+ };
@@ -1,4 +1,5 @@
1
1
  import * as React from 'react';
2
+ import { LinkProps } from '../../Link/Link';
2
3
  import { LinkVariants } from '../../Link/utils';
3
4
  export interface NavigationItemProps extends Omit<React.HTMLAttributes<HTMLLIElement>, 'onClick'> {
4
5
  /**
@@ -25,6 +26,10 @@ export interface NavigationItemProps extends Omit<React.HTMLAttributes<HTMLLIEle
25
26
  * Optional type for navigation item
26
27
  */
27
28
  navType?: LinkVariants;
29
+ /**
30
+ * Element to render within the navigation item, renders <Link> by default
31
+ */
32
+ element?: React.ElementType<LinkProps>;
28
33
  }
29
- declare const NavigationItem: ({ badge, className, href, label, navGroup, navType, onClick, ...props }: React.PropsWithChildren<NavigationItemProps>) => import("react/jsx-runtime").JSX.Element;
34
+ declare const NavigationItem: ({ badge, className, href, label, navGroup, navType, onClick, element: Component, ...props }: React.PropsWithChildren<NavigationItemProps>) => import("react/jsx-runtime").JSX.Element;
30
35
  export default NavigationItem;
@@ -1,35 +1,36 @@
1
- import { jsx as a, jsxs as d } from "react/jsx-runtime";
2
- import * as p from "react";
3
- import { px as t } from "../../../utils/index.js";
4
- import f from "../../../node_modules/classnames/index.js";
5
- import x from "../../Link/Link.js";
6
- import { LinkVariants as v } from "../../Link/utils.js";
7
- import { HeaderContext as _ } from "../../Header/Header.js";
8
- const k = ({
1
+ import { jsx as t, jsxs as p } from "react/jsx-runtime";
2
+ import * as f from "react";
3
+ import { px as a } from "../../../utils/index.js";
4
+ import x from "../../../node_modules/classnames/index.js";
5
+ import v from "../../Link/Link.js";
6
+ import { LinkVariants as _ } from "../../Link/utils.js";
7
+ import { HeaderContext as h } from "../../Header/Header.js";
8
+ const C = ({
9
9
  badge: e,
10
- className: m = "",
10
+ className: i = "",
11
11
  href: r,
12
12
  label: n,
13
13
  navGroup: s,
14
- navType: i,
14
+ navType: m,
15
15
  onClick: o,
16
- ...l
16
+ element: l = v,
17
+ ...c
17
18
  }) => {
18
- const { expandedItem: c } = p.useContext(_);
19
- return /* @__PURE__ */ a(
19
+ const { expandedItem: d } = f.useContext(h);
20
+ return /* @__PURE__ */ t(
20
21
  "li",
21
22
  {
22
- ...l,
23
+ ...c,
23
24
  onClick: o,
24
25
  "data-testid": `nav-item-${n}`,
25
- className: f(`${t}-nav__item`, s, m),
26
- children: /* @__PURE__ */ d(x, { href: r, variant: i || v.navMain, tabIndex: c === "" ? 0 : -1, children: [
27
- /* @__PURE__ */ a("span", { className: `${t}-nav__item--label`, children: n }),
28
- e ? /* @__PURE__ */ a("span", { className: `${t}-nav__item--badge `, children: e }) : null
26
+ className: x(`${a}-nav__item`, s, i),
27
+ children: /* @__PURE__ */ p(l, { href: r, variant: m || _.navMain, tabIndex: d === "" ? 0 : -1, children: [
28
+ /* @__PURE__ */ t("span", { className: `${a}-nav__item--label`, children: n }),
29
+ e ? /* @__PURE__ */ t("span", { className: `${a}-nav__item--badge `, children: e }) : null
29
30
  ] })
30
31
  }
31
32
  );
32
33
  };
33
34
  export {
34
- k as default
35
+ C as default
35
36
  };
@@ -56,6 +56,7 @@
56
56
  display: grid;
57
57
  gap: $spacing-md;
58
58
  grid-template-columns: repeat($columns, 1fr);
59
+ row-gap: $spacing-lg;
59
60
 
60
61
  @if $margins-on {
61
62
  @include gridMargins;
@@ -66,6 +67,7 @@
66
67
  display: grid;
67
68
  gap: $spacing-md;
68
69
  grid-template-columns: repeat(2, 1fr);
70
+ row-gap: $spacing-lg;
69
71
 
70
72
  @media (min-width: $breakpoint-md) {
71
73
  grid-template-columns: repeat(4, 1fr);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.38.4",
3
+ "version": "1.38.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"