@phillips/seldon 1.18.0 → 1.19.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.
package/README.md CHANGED
@@ -6,6 +6,8 @@
6
6
 
7
7
  Seldon is the source for design guidelines, component documentation, and resources for building apps with the Phillips.com Design System.
8
8
 
9
+ We use Storybook to document the components. Our storybook is hosted in Netlify at [here](https://phillips-seldon.netlify.app/?path=/docs/welcome--overview).
10
+
9
11
  ## Installation
10
12
 
11
13
  ```
@@ -16,38 +18,6 @@ npm install @phillips/seldon
16
18
  yarn add @phillips/seldon
17
19
  ```
18
20
 
19
- ## What's included
20
-
21
- ```
22
- @phillips/seldon/
23
- ├── components
24
- │ └── HeroBanner
25
- │ └── HeroBanner.d.ts
26
- │ └── HeroBanner.js
27
- │ └── ...
28
- ├── Pages
29
- │ └── HomePage
30
- │ └── HomePage.d.ts
31
- │ └── HomePage.js
32
- │ └── ...
33
- ├── scss
34
- │ └── components
35
- │ └── HeroBanner
36
- │ └── _HeroBanner.scss
37
- │ └── ...
38
- │ └── Pages
39
- │ └── HomePage
40
- │ └── _HomePage.scss
41
- │ └── ...
42
- │ └── _reset.scss
43
- │ └── _typography_.scss
44
- │ └── _vars.scss
45
- │ └── styles.scss (sass entrypoint)
46
- ├── utils
47
- ├── index.d.ts
48
- ├── index.js
49
- ```
50
-
51
21
  ### Styling
52
22
 
53
23
  The project contains a `scss` folder. Here you will find the main export of our sass styles. This will include all the styles bundled with this package, including resets and typography styles.
@@ -0,0 +1,44 @@
1
+ import React, { HTMLAttributes } from 'react';
2
+ export declare const LinkVariants: {
3
+ /** Default variant, used */
4
+ readonly standalone: "standalone";
5
+ /** link rendering emailto: */
6
+ readonly email: "email";
7
+ /** these links are being rendered in a list */
8
+ readonly list: "list";
9
+ /** link is being rendered within body copy */
10
+ readonly inline: "inline";
11
+ };
12
+ export interface LinkProps extends HTMLAttributes<HTMLAnchorElement> {
13
+ /**
14
+ * Describes where the link is used. It controls the styling of the link so we apply consistent styles. Defaults to `standalone`. See the documentation [here](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?type=design&node-id=5731-12815) to see where each variant is used.
15
+ *
16
+ * @default standalone
17
+ * @see LinkVariants
18
+ */
19
+ variant?: keyof typeof LinkVariants;
20
+ /**
21
+ * The text of the link
22
+ */
23
+ children: React.ReactNode;
24
+ /**
25
+ * URL to navigate to when clicked
26
+ */
27
+ href: string;
28
+ /**
29
+ * Can be used to render alternative link components like the prefetching `Link` from `@remix-run/react`.
30
+ * This component should handle the `children`, `data-testid`, `id`, `className`, and `href` props.
31
+ */
32
+ element?: React.ElementType<LinkProps & {
33
+ 'data-testid': string;
34
+ }>;
35
+ }
36
+ /**
37
+ * ## Overview
38
+ *
39
+ * A component that can be used to navigate to different pages or external websites. Renders a standard anchor tag by default.
40
+ *
41
+ * [Figma Link](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?node-id=5736%3A13364&mode=dev)
42
+ */
43
+ declare const Link: ({ children, id, className, element: Element, variant, href, ...props }: LinkProps) => import("react/jsx-runtime").JSX.Element;
44
+ export default Link;
@@ -0,0 +1,40 @@
1
+ import { jsx as c } from "react/jsx-runtime";
2
+ import k from "../../node_modules/classnames/index.js";
3
+ import { px as p } from "../../utils/index.js";
4
+ import { getLinkVariantClassName as d, isLinkExternal as f } from "./utils.js";
5
+ const x = {
6
+ /** Default variant, used */
7
+ standalone: "standalone",
8
+ /** link rendering emailto: */
9
+ email: "email",
10
+ /** these links are being rendered in a list */
11
+ list: "list",
12
+ /** link is being rendered within body copy */
13
+ inline: "inline"
14
+ }, V = ({
15
+ children: s,
16
+ id: a,
17
+ className: e,
18
+ element: n = "a",
19
+ variant: i = x.standalone,
20
+ href: t,
21
+ ...l
22
+ }) => {
23
+ const r = k(`${p}-link`, d(i), e), o = a ? `link-${a}` : "link", m = f(t);
24
+ return /* @__PURE__ */ c(
25
+ n,
26
+ {
27
+ ...l,
28
+ href: t,
29
+ "data-testid": o,
30
+ id: a,
31
+ className: r,
32
+ ...m && n === "a" ? { rel: "noopener noreferrer", target: "_blank" } : {},
33
+ children: s
34
+ }
35
+ );
36
+ };
37
+ export {
38
+ x as LinkVariants,
39
+ V as default
40
+ };
@@ -0,0 +1,3 @@
1
+ import { LinkVariants } from './Link';
2
+ export declare const getLinkVariantClassName: (variant: keyof typeof LinkVariants) => string;
3
+ export declare const isLinkExternal: (href: string) => boolean;
@@ -0,0 +1,8 @@
1
+ import { px as a } from "../../utils/index.js";
2
+ const n = (t) => `${a}-link--${t}`, s = (t) => !!t.match(
3
+ /(http[s]?:\/\/)(?!.*phillips\.com)([a-zA-Z0-9\-.]+)(:[0-9]{1,4})?([a-zA-Z0-9/\-._~:?#[\]@!$&'()*+,;=]*)/g
4
+ );
5
+ export {
6
+ n as getLinkVariantClassName,
7
+ s as isLinkExternal
8
+ };
@@ -0,0 +1,17 @@
1
+ import { LinkProps } from '../Link/Link';
2
+ export interface LinkBlockProps extends React.HTMLAttributes<HTMLDivElement> {
3
+ /** Props for the Link component */
4
+ linkProps: Omit<LinkProps, 'variant'>;
5
+ /** Renders description under link */
6
+ description: string;
7
+ }
8
+ /**
9
+ * ## Overview
10
+ *
11
+ * The LinkBlock component is used to render a link with a description underneath it. Usually this is used in a list of links.
12
+ *
13
+ * [Figma Link](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?type=design&node-id=5709-8035&mode=design&t=CTNssP89Nrnt6Jkw-0)
14
+ *
15
+ */
16
+ declare const LinkBlock: ({ linkProps, description, className: classNameProp, id, ...props }: LinkBlockProps) => import("react/jsx-runtime").JSX.Element;
17
+ export default LinkBlock;
@@ -0,0 +1,14 @@
1
+ import { jsxs as r, jsx as o } from "react/jsx-runtime";
2
+ import k from "../../node_modules/classnames/index.js";
3
+ import { px as d } from "../../utils/index.js";
4
+ import p, { LinkVariants as f } from "../Link/Link.js";
5
+ const $ = ({ linkProps: t, description: e, className: i, id: s, ...l }) => {
6
+ const a = `${d}-link-block`, c = k(a, i), m = t.element ?? p, n = s ? `link-block-${s}` : "link-block";
7
+ return /* @__PURE__ */ r("div", { ...l, className: c, id: s, "data-testid": n, children: [
8
+ /* @__PURE__ */ o(m, { ...t, "data-testid": `${n}-link`, variant: f.list }),
9
+ /* @__PURE__ */ o("p", { className: `${a}__description`, children: e })
10
+ ] });
11
+ };
12
+ export {
13
+ $ as default
14
+ };
@@ -0,0 +1,15 @@
1
+ import LinkBlock, { type LinkBlockProps } from '../LinkBlock/LinkBlock';
2
+ import React from 'react';
3
+ export interface LinkListProps extends React.HTMLAttributes<HTMLUListElement> {
4
+ /** These children should be an array of LinkBlock components */
5
+ children: React.ReactElement<LinkBlockProps, typeof LinkBlock>[];
6
+ }
7
+ /**
8
+ * ## Overview
9
+ *
10
+ * The LinkList component is used to display a list of LinkBlocks in a 3 column list on some breakpoints and 1 column list on others. Because of the 3 column design, the set of LinkBlocks should be divisible by 3.
11
+ *
12
+ * [Figma Link](https://www.figma.com/file/xMuOXOAKVt5HC7hgYjF3ot/Components-v2.0?type=design&node-id=5709-8035&mode=design&t=jOnrmrqnE8lCQvGR-4)
13
+ */
14
+ declare const LinkList: ({ children, id, ...props }: LinkListProps) => import("react/jsx-runtime").JSX.Element;
15
+ export default LinkList;
@@ -0,0 +1,15 @@
1
+ import { jsx as i } from "react/jsx-runtime";
2
+ import f from "../LinkBlock/LinkBlock.js";
3
+ import c from "react";
4
+ import { px as u } from "../../utils/index.js";
5
+ import { Grid as p } from "../Grid/Grid.js";
6
+ const y = ({ children: a, id: s, ...m }) => {
7
+ const d = s ? `link-list-${s}` : "link-list", t = `${u}-link-list`;
8
+ return /* @__PURE__ */ i(p, { ...m, "data-testid": d, id: s, className: t, element: "ul", role: "list", children: a.map((r) => {
9
+ var l, e;
10
+ return c.isValidElement(r) && r.type !== f ? (console.warn("LinkList only accepts LinkBlock children"), null) : /* @__PURE__ */ i("li", { className: `${t}--item`, children: r }, (e = (l = r == null ? void 0 : r.props) == null ? void 0 : l.linkProps) == null ? void 0 : e.href);
11
+ }) });
12
+ };
13
+ export {
14
+ y as default
15
+ };
package/dist/index.d.ts CHANGED
@@ -5,6 +5,9 @@ export { default as Grid, type GridProps } from './components/Grid/Grid';
5
5
  export { default as Header, type HeaderProps } from './components/Header/Header';
6
6
  export { default as HeroBanner, type HeroBannerProps } from './components/HeroBanner/HeroBanner';
7
7
  export { default as Input, type InputProps } from './components/Input/Input';
8
+ export { default as Link, type LinkProps } from './components/Link/Link';
9
+ export { default as LinkBlock, type LinkBlockProps } from './components/LinkBlock/LinkBlock';
10
+ export { default as LinkList, type LinkListProps } from './components/LinkList/LinkList';
8
11
  export { default as Select, type SelectProps } from './components/Select/Select';
9
12
  export { default as SplitPanel, type SplitPanelProps } from './components/SplitPanel/SplitPanel';
10
13
  export { default as Subscribe, type SubscribeProps } from './components/Subscribe/Subscribe';
package/dist/index.js CHANGED
@@ -5,13 +5,16 @@ import { Grid as u } from "./components/Grid/Grid.js";
5
5
  import { default as p } from "./components/Header/Header.js";
6
6
  import { default as x } from "./components/HeroBanner/HeroBanner.js";
7
7
  import { default as n } from "./components/Input/Input.js";
8
- import { default as c } from "./components/Select/Select.js";
9
- import { default as B } from "./components/SplitPanel/SplitPanel.js";
10
- import { default as w } from "./components/Subscribe/Subscribe.js";
11
- import { default as L } from "./components/Social/Social.js";
12
- import { default as V } from "./components/ViewingsList/ViewingsList.js";
13
- import { default as E } from "./components/ViewingsList/StatefulViewingsList.js";
14
- import { default as G } from "./pages/Page.js";
8
+ import { default as S } from "./components/Link/Link.js";
9
+ import { default as k } from "./components/LinkBlock/LinkBlock.js";
10
+ import { default as g } from "./components/LinkList/LinkList.js";
11
+ import { default as w } from "./components/Select/Select.js";
12
+ import { default as P } from "./components/SplitPanel/SplitPanel.js";
13
+ import { default as y } from "./components/Subscribe/Subscribe.js";
14
+ import { default as F } from "./components/Social/Social.js";
15
+ import { default as I } from "./components/ViewingsList/ViewingsList.js";
16
+ import { default as j } from "./components/ViewingsList/StatefulViewingsList.js";
17
+ import { default as v } from "./pages/Page.js";
15
18
  export {
16
19
  t as Button,
17
20
  a as ErrorBoundary,
@@ -20,11 +23,14 @@ export {
20
23
  p as Header,
21
24
  x as HeroBanner,
22
25
  n as Input,
23
- G as Page,
24
- c as Select,
25
- L as Social,
26
- B as SplitPanel,
27
- E as StatefulViewingsList,
28
- w as Subscribe,
29
- V as ViewingsList
26
+ S as Link,
27
+ k as LinkBlock,
28
+ g as LinkList,
29
+ v as Page,
30
+ w as Select,
31
+ F as Social,
32
+ P as SplitPanel,
33
+ j as StatefulViewingsList,
34
+ y as Subscribe,
35
+ I as ViewingsList
30
36
  };
@@ -39,6 +39,20 @@ h6 {
39
39
  overflow-wrap: break-word;
40
40
  }
41
41
 
42
+ a {
43
+ color: inherit;
44
+ text-decoration: none;
45
+ }
46
+
47
+ ul {
48
+ list-style: none;
49
+ padding: 0;
50
+ }
51
+
52
+ li {
53
+ list-style: none;
54
+ }
55
+
42
56
  #root {
43
57
  isolation: isolate;
44
58
  }
@@ -1,5 +1,10 @@
1
1
  @import './vars';
2
2
 
3
+ @mixin underline($padding: 0, $width: 0.0625rem, $color: $cta-blue) {
4
+ border-bottom: $width solid $color;
5
+ padding-bottom: $padding;
6
+ }
7
+
3
8
  @mixin hText($size: $heading-size1, $color: $primary-black, $transform-style: capitalize) {
4
9
  color: $color;
5
10
  font-family: DistinctDisplay, sans-serif;
@@ -1,5 +1,8 @@
1
1
  @import './vars';
2
2
 
3
+ // Design wants this replaced in the future with a local version of Montserrat
4
+ @import 'https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,200;0,400;0,500;0,600;0,700;1,400&display=swap';
5
+
3
6
  html,
4
7
  body {
5
8
  font-family:
@@ -39,10 +39,26 @@
39
39
  width: 2rem;
40
40
  }
41
41
 
42
- @mixin grid($columns: 2) {
42
+ @mixin gridMargins {
43
+ margin: 0 $spacing-medium;
44
+
45
+ @media (min-width: $breakpoint3) {
46
+ margin: 0 $spacing-large;
47
+ }
48
+
49
+ @media (min-width: $breakpoint4) {
50
+ margin: 0 $spacing-xl;
51
+ }
52
+ }
53
+
54
+ @mixin grid($columns: 2, $margins-on: true) {
43
55
  display: grid;
44
56
  gap: $spacing-medium;
45
57
  grid-template-columns: repeat($columns, 1fr);
58
+
59
+ @if $margins-on {
60
+ @include gridMargins;
61
+ }
46
62
  }
47
63
 
48
64
  @mixin gridContainer($margins-on: true) {
@@ -50,45 +66,35 @@
50
66
  gap: $spacing-medium;
51
67
  grid-template-columns: repeat(2, 1fr);
52
68
 
53
- @if $margins-on {
54
- margin: 0 $spacing-medium;
55
- }
56
-
57
69
  @media (min-width: $breakpoint2) {
58
70
  grid-template-columns: repeat(4, 1fr);
59
71
  }
60
72
 
61
73
  @media (min-width: $breakpoint3) {
62
74
  grid-template-columns: repeat(12, 1fr);
63
-
64
- @if $margins-on {
65
- margin: 0 $spacing-large;
66
- }
67
75
  }
68
76
 
69
- @media (min-width: $breakpoint4) {
70
- @if $margins-on {
71
- margin: 0 $spacing-xl;
72
- }
77
+ @if $margins-on {
78
+ @include gridMargins;
73
79
  }
74
80
  }
75
81
 
76
82
  @mixin media($breakpoint) {
77
- @if $breakpoint == $sm {
83
+ @if $breakpoint == $breakpoint-sm {
78
84
  // $breakpoint2: 961px;
79
85
  @media (min-width: $breakpoint2) {
80
86
  @content;
81
87
  }
82
88
  }
83
89
 
84
- @if $breakpoint == $md {
90
+ @if $breakpoint == $breakpoint-md {
85
91
  // $breakpoint3: 1401px;
86
92
  @media (min-width: $breakpoint3) {
87
93
  @content;
88
94
  }
89
95
  }
90
96
 
91
- @if $breakpoint == $lg {
97
+ @if $breakpoint == $breakpoint-lg {
92
98
  // $breakpoint4: 1801px;
93
99
  @media (min-width: $breakpoint4) {
94
100
  @content;
@@ -229,6 +229,6 @@ $max-site-width: 1560px;
229
229
  /// Media breakpoint tokens:
230
230
  ///////////////////////////
231
231
 
232
- $sm: 'sm';
233
- $md: 'md';
234
- $lg: 'lg';
232
+ $breakpoint-sm: 'sm';
233
+ $breakpoint-md: 'md';
234
+ $breakpoint-lg: 'lg';
@@ -18,11 +18,11 @@
18
18
  padding: $spacing-medium $spacing-medium $spacing-small;
19
19
  text-align: right;
20
20
 
21
- @include media('md') {
21
+ @include media($breakpoint-md) {
22
22
  padding: $spacing-medium $spacing-large $spacing-small;
23
23
  }
24
24
 
25
- @include media('lg') {
25
+ @include media($breakpoint-lg) {
26
26
  padding: $spacing-medium $spacing-xl $spacing-small;
27
27
  }
28
28
 
@@ -50,17 +50,17 @@
50
50
  flex-direction: column;
51
51
  padding: $spacing-large $spacing-medium 0;
52
52
 
53
- @include media('sm') {
53
+ @include media($breakpoint-sm) {
54
54
  align-items: flex-start;
55
55
  flex-direction: row;
56
56
  justify-content: space-between;
57
57
  }
58
58
 
59
- @include media('md') {
59
+ @include media($breakpoint-md) {
60
60
  padding: 3.75rem $spacing-large;
61
61
  }
62
62
 
63
- @include media('lg') {
63
+ @include media($breakpoint-lg) {
64
64
  padding: 3.75rem $spacing-xl;
65
65
  }
66
66
  }
@@ -68,7 +68,7 @@
68
68
  &__content-split-panel__left {
69
69
  margin-bottom: $spacing-medium;
70
70
 
71
- @include media('sm') {
71
+ @include media($breakpoint-sm) {
72
72
  margin-bottom: 0;
73
73
  }
74
74
  }
@@ -76,7 +76,7 @@
76
76
  &__content-split-panel__right {
77
77
  display: flex;
78
78
 
79
- @include media('sm') {
79
+ @include media($breakpoint-sm) {
80
80
  justify-content: flex-end;
81
81
  }
82
82
  }
@@ -0,0 +1,34 @@
1
+ @import '../../type';
2
+
3
+ .#{$px}-link {
4
+ @include text($cta-sm);
5
+
6
+ color: $cta-blue;
7
+ text-decoration: none;
8
+ white-space: nowrap;
9
+
10
+ &:hover:not(&--list),
11
+ &:focus:not(&--list) {
12
+ @include underline;
13
+ }
14
+
15
+ &:hover,
16
+ &:focus {
17
+ color: $cta-blue;
18
+ outline: unset;
19
+ }
20
+
21
+ &--inline {
22
+ font-size: inherit;
23
+ letter-spacing: inherit;
24
+ line-height: inherit;
25
+ }
26
+
27
+ &--list {
28
+ color: $soft-black;
29
+ }
30
+
31
+ &--email {
32
+ @include text($email);
33
+ }
34
+ }
@@ -0,0 +1,14 @@
1
+ @import '../../type';
2
+ @import '../../vars';
3
+
4
+ .#{$px}-link-block {
5
+ align-items: center;
6
+ display: flex;
7
+ flex-direction: column;
8
+ gap: $spacing-xsm;
9
+ text-align: center;
10
+
11
+ &__description {
12
+ @include text($body2);
13
+ }
14
+ }
@@ -0,0 +1,11 @@
1
+ @import '../../_utils';
2
+
3
+ .#{$px}-link-list {
4
+ &--item {
5
+ grid-column: span 4;
6
+
7
+ @include media($breakpoint-lg) {
8
+ grid-column: span 2;
9
+ }
10
+ }
11
+ }
@@ -7,7 +7,7 @@
7
7
  display: inline-flex;
8
8
  flex-direction: column;
9
9
 
10
- @include media('sm') {
10
+ @include media($breakpoint-sm) {
11
11
  align-items: flex-end;
12
12
  }
13
13
 
@@ -25,7 +25,7 @@
25
25
  margin: 0 0 $spacing-medium;
26
26
  padding: 0;
27
27
 
28
- @include media('sm') {
28
+ @include media($breakpoint-sm) {
29
29
  gap: 0 1rem;
30
30
  }
31
31
 
@@ -15,7 +15,7 @@
15
15
  flex: 1 1 0px;
16
16
  }
17
17
 
18
- @include media('sm') {
18
+ @include media($breakpoint-sm) {
19
19
  align-items: stretch;
20
20
  flex-direction: row;
21
21
 
@@ -19,7 +19,7 @@
19
19
  text-align: center;
20
20
  }
21
21
 
22
- @include media('sm') {
22
+ @include media($breakpoint-sm) {
23
23
  &__title,
24
24
  &__blurb {
25
25
  text-align: left;
@@ -20,6 +20,9 @@
20
20
  @import 'components/Subscribe/subscribe';
21
21
  @import 'components/Toggle/toggle';
22
22
  @import 'components/ViewingsList/viewingsList';
23
+ @import 'components/Link/link';
24
+ @import 'components/LinkBlock/linkBlock';
25
+ @import 'components/LinkList/linkList';
23
26
 
24
27
  // 📑 Pages
25
28
  @import 'pages/page';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.18.0",
3
+ "version": "1.19.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"
@@ -24,9 +24,8 @@
24
24
  "dist/**"
25
25
  ],
26
26
  "scripts": {
27
- "dev": "vite",
28
- "test": "jest",
29
27
  "start": "storybook dev -p 6006",
28
+ "test": "jest",
30
29
  "build": "npm run clean && tsc && vite build",
31
30
  "build:storybook": "storybook build",
32
31
  "preview": "npx http-server storybook-static",
@@ -39,13 +38,12 @@
39
38
  },
40
39
  "dependencies": {
41
40
  "classnames": "^2.5.1",
42
- "flatpickr": "^4.6.13",
43
- "react": "^18.3.1",
44
- "react-dom": "^18.2.0"
41
+ "flatpickr": "^4.6.13"
45
42
  },
46
43
  "devDependencies": {
47
44
  "@commitlint/cli": "^19.3.0",
48
45
  "@commitlint/config-conventional": "^19.2.2",
46
+ "@figma/code-connect": "^0.1.1",
49
47
  "@semantic-release/changelog": "^6.0.3",
50
48
  "@semantic-release/git": "^10.0.1",
51
49
  "@semantic-release/github": "^10.0.3",
@@ -75,7 +73,9 @@
75
73
  "jest": "^29.6.1",
76
74
  "jest-environment-jsdom": "^29.6.1",
77
75
  "prettier": "3.0.3",
78
- "prop-types": "^15.8.1",
76
+ "react-docgen-typescript": "^2.2.2",
77
+ "react": "^18.3.1",
78
+ "react-dom": "^18.2.0",
79
79
  "rimraf": "^5.0.5",
80
80
  "rollup-plugin-copy": "^3.5.0",
81
81
  "rollup-plugin-peer-deps-external": "^2.2.4",
@@ -88,7 +88,6 @@
88
88
  "stylelint-order": "^6.0.4",
89
89
  "stylelint-scss": "^6.2.1",
90
90
  "ts-jest": "^29.1.2",
91
- "ts-node": "^10.9.2",
92
91
  "typescript": "^5.0.2",
93
92
  "vite": "^4.5.3",
94
93
  "vite-plugin-dts": "^2.3.0",