@phillips/seldon 1.112.0 → 1.112.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.
@@ -1,7 +1,8 @@
1
+ import { default as React, ComponentProps } from 'react';
1
2
  export interface I18nObject {
2
3
  clearAllLabel?: string;
3
4
  }
4
- export interface TagsListProps {
5
+ export interface TagsListProps extends ComponentProps<'ul'> {
5
6
  /**
6
7
  * Unique id for component testing
7
8
  */
@@ -40,8 +41,12 @@ export interface TagProps {
40
41
  * Tag item label.
41
42
  */
42
43
  label: string;
44
+ /**
45
+ * Tag button aria-label
46
+ */
47
+ removeText?: string;
43
48
  }
44
- export declare const Tag: ({ id, className, onRemove, label }: TagProps) => import("react/jsx-runtime").JSX.Element;
49
+ export declare const Tag: ({ id, className, onRemove, label, removeText }: TagProps) => import("react/jsx-runtime").JSX.Element;
45
50
  /**
46
51
  * ## Overview
47
52
  *
@@ -51,5 +56,5 @@ export declare const Tag: ({ id, className, onRemove, label }: TagProps) => impo
51
56
  *
52
57
  * [Storybook Link](https://phillips-seldon.netlify.app/?path=/docs/components-tags--overview)
53
58
  */
54
- declare const TagsList: import('react').ForwardRefExoticComponent<TagsListProps & import('react').RefAttributes<HTMLDivElement>>;
59
+ declare const TagsList: React.ForwardRefExoticComponent<Omit<TagsListProps, "ref"> & React.RefAttributes<HTMLUListElement>>;
55
60
  export default TagsList;
@@ -1,49 +1,58 @@
1
- import { jsxs as m, jsx as t } from "react/jsx-runtime";
2
- import { forwardRef as f } from "react";
3
- import c from "../../node_modules/classnames/index.js";
4
- import { getCommonProps as p, px as a } from "../../utils/index.js";
5
- import u from "../Button/Button.js";
6
- import N from "../IconButton/IconButton.js";
7
- import v from "../../assets/chevronRight.svg.js";
8
- import { ButtonVariants as h } from "../Button/types.js";
1
+ import { jsxs as l, jsx as t } from "react/jsx-runtime";
2
+ import v, { forwardRef as N } from "react";
3
+ import d from "../../node_modules/classnames/index.js";
4
+ import { getCommonProps as y, px as r } from "../../utils/index.js";
5
+ import $ from "../Button/Button.js";
6
+ import { ButtonVariants as p } from "../Button/types.js";
9
7
  import b from "../../assets/close.svg.js";
10
- const P = ({ id: e, className: s, onRemove: o, label: r }) => /* @__PURE__ */ m("div", { className: c(`${a}-tag`, `${a}-button`, s), "aria-label": "Close Tag", children: [
11
- /* @__PURE__ */ t("div", { className: `${a}-tag__label`, children: r }),
12
- /* @__PURE__ */ t("div", { onClick: () => o(r), className: `${a}-tag__button`, "data-testid": `${e}-item-close-button`, children: /* @__PURE__ */ t(N, { className: `${a}-tag__button--close`, children: /* @__PURE__ */ t(b, {}) }) })
13
- ] }), C = f(
14
- ({ className: e, children: s, clearAllLabel: o = "Clear All", onClear: r, ...i }, d) => {
15
- const l = "tags-list", { className: g, ...$ } = p(i, "TagsList"), { id: n } = i;
16
- return /* @__PURE__ */ m(
17
- "div",
8
+ import C from "../../assets/arrowPrev.svg.js";
9
+ const w = ({ id: i, className: a, onRemove: o, label: s, removeText: e = "Remove" }) => /* @__PURE__ */ l(
10
+ $,
11
+ {
12
+ className: d(`${r}-tag`, `${r}-button`, a),
13
+ "aria-label": `${e} ${s}`,
14
+ onClick: () => o(s),
15
+ variant: p.tertiary,
16
+ children: [
17
+ /* @__PURE__ */ t("div", { className: `${r}-tag__label`, children: s }),
18
+ /* @__PURE__ */ t("div", { className: `${r}-tag__button`, "data-testid": `${i}-item-close-button`, children: /* @__PURE__ */ t(b, {}) })
19
+ ]
20
+ }
21
+ ), _ = N(
22
+ ({ className: i, children: a, clearAllLabel: o = "Clear All", onClear: s, ...e }, f) => {
23
+ const m = "tags-list", { className: g, ...u } = y(e, "TagsList"), { id: n } = e;
24
+ return /* @__PURE__ */ l(
25
+ "ul",
18
26
  {
19
- className: c(`${a}-${l}`, g, e),
20
- ...$,
21
- ...i,
22
- "data-testid": `${l}-${n}`,
23
- ref: d,
27
+ className: d(`${r}-${m}`, g, i),
28
+ ...u,
29
+ ...e,
30
+ tabIndex: 0,
31
+ "data-testid": `${m}-${n}`,
32
+ ref: f,
24
33
  children: [
25
- s,
26
- Array.isArray(s) && s.length > 0 && /* @__PURE__ */ m(
27
- u,
34
+ Array.isArray(a) ? v.Children.map(a, (c) => /* @__PURE__ */ t("li", { children: c }, c.props.id)) : a,
35
+ Array.isArray(a) && a.length > 0 && /* @__PURE__ */ t("li", { children: /* @__PURE__ */ l(
36
+ $,
28
37
  {
29
- onClick: r,
38
+ onClick: s,
30
39
  "data-testid": `${n}-clear-all-button`,
31
- className: `${a}-${l}--clear`,
40
+ className: `${r}-${m}--clear`,
32
41
  "aria-label": o,
33
- variant: h.tertiary,
42
+ variant: p.tertiary,
34
43
  children: [
35
- /* @__PURE__ */ t("div", { className: `${a}-left-arrow`, children: /* @__PURE__ */ t(v, {}) }),
36
- /* @__PURE__ */ t("div", { className: `${a}-label`, children: o })
44
+ /* @__PURE__ */ t(C, {}),
45
+ /* @__PURE__ */ t("div", { className: `${r}-label`, children: o })
37
46
  ]
38
47
  }
39
- )
48
+ ) })
40
49
  ]
41
50
  }
42
51
  );
43
52
  }
44
53
  );
45
- C.displayName = "Tags";
54
+ _.displayName = "Tags";
46
55
  export {
47
- P as Tag,
48
- C as default
56
+ w as Tag,
57
+ _ as default
49
58
  };
@@ -1,7 +1,7 @@
1
1
  import { TagsListProps } from './Tags';
2
2
  declare const meta: {
3
3
  title: string;
4
- component: import('react').ForwardRefExoticComponent<TagsListProps & import('react').RefAttributes<HTMLDivElement>>;
4
+ component: import('react').ForwardRefExoticComponent<Omit<TagsListProps, "ref"> & import('react').RefAttributes<HTMLUListElement>>;
5
5
  };
6
6
  export default meta;
7
7
  interface StoryProps extends TagsListProps {
@@ -6,132 +6,102 @@
6
6
  flex-flow: row wrap;
7
7
  gap: $spacing-sm;
8
8
 
9
+ &:focus-visible {
10
+ border: unset;
11
+ outline: 1px solid $button-hover;
12
+ outline-offset: 1px;
13
+ }
14
+
9
15
  .#{$px}-tag {
10
- align-items: center;
11
- background-color: $pure-white;
12
16
  border: 1px solid $button-hover;
13
17
  border-radius: 6.25rem;
14
- cursor: default;
15
- display: flex;
16
- gap: 0;
17
- height: $button-tertiary-height;
18
- justify-content: center;
19
- padding: 0 $spacing-xsm 0 $spacing-sm;
18
+ gap: $spacing-micro;
19
+ padding: $spacing-micro $spacing-xsm $spacing-micro $spacing-sm;
20
20
 
21
21
  &__label {
22
22
  color: $button-hover;
23
- font-size: 0.75rem;
23
+ font-size: $body-size3;
24
24
  font-variation-settings: 'wght' 600;
25
25
  text-align: center;
26
+
27
+ &:hover {
28
+ color: $pure-black;
29
+ }
26
30
  }
27
31
 
28
- &__button {
29
- align-items: center;
30
- display: flex;
31
- gap: $spacing-micro;
32
- height: $button-tertiary-height;
33
- justify-content: center;
34
- padding: 0;
35
-
36
- &--close {
37
- height: 1.25rem;
38
- width: 1.25rem;
39
-
40
- svg {
41
- height: 1rem;
42
- width: 1rem;
43
-
44
- path {
45
- fill: $button-hover;
46
- }
47
-
48
- &:focus {
49
- fill: $pure-black;
50
- }
51
- }
32
+ svg {
33
+ fill: $button-hover;
52
34
 
53
- &:hover {
54
- background-color: $pure-white;
35
+ path {
36
+ fill: $button-hover;
37
+ }
38
+ }
55
39
 
56
- svg {
57
- path {
58
- fill: $pure-black;
59
- }
60
- }
61
- }
40
+ &:hover {
41
+ color: $pure-black;
42
+
43
+ svg {
44
+ fill: $pure-black;
62
45
 
63
- &:focus {
64
- svg {
65
- path {
66
- fill: $pure-black;
67
- }
68
- }
46
+ path {
47
+ fill: $pure-black;
69
48
  }
70
49
  }
71
50
  }
72
51
  }
73
52
 
74
53
  &--clear {
54
+ @include text($body3);
55
+
75
56
  align-items: center;
76
57
  border-color: $pure-white;
58
+ border-style: solid;
59
+ border-width: 1px;
60
+ color: $button-hover;
77
61
  display: flex;
78
- gap: 0;
62
+ gap: $spacing-micro;
79
63
  height: 2rem;
64
+ padding: 0 $spacing-sm;
80
65
 
81
- &:hover {
82
- cursor: pointer;
66
+ @include media($breakpoint-xl) {
67
+ padding: $spacing-sm;
68
+ }
83
69
 
84
- .#{$px}-left-arrow {
85
- svg {
86
- fill: $pure-black;
70
+ svg {
71
+ fill: $button-hover;
72
+ height: 1rem;
73
+ width: 1rem;
87
74
 
88
- path {
89
- fill: $pure-black;
90
- }
91
- }
75
+ path {
76
+ fill: $button-hover;
92
77
  }
93
78
  }
94
79
 
95
- &:focus-visible {
96
- border-color: $button-hover;
97
- border-radius: 6.25rem;
98
- gap: 0;
99
- outline-offset: 0;
100
- padding: 0;
101
- }
102
-
103
- .#{$px}-left-arrow {
104
- transform: rotateX(-1);
80
+ &:hover {
81
+ color: $pure-black;
82
+ cursor: pointer;
105
83
 
106
84
  svg {
107
- height: 1rem;
108
- width: 1rem;
109
- }
110
-
111
- &:hover {
112
- background: $pure-white;
85
+ fill: $pure-black;
113
86
 
114
- svg {
87
+ path {
115
88
  fill: $pure-black;
116
-
117
- path {
118
- fill: $pure-black;
119
- }
120
- }
121
- }
122
-
123
- &:focus-visible {
124
- &:focus-visible {
125
- outline: none;
126
- outline-offset: none;
127
89
  }
128
90
  }
129
91
  }
130
92
 
131
- .#{$px}-label {
132
- color: $pure-black;
133
- font-size: 0.875rem;
134
- font-variation-settings: 'wght' 600;
93
+ &:focus-visible {
94
+ border-color: $button-hover;
95
+ border-radius: 6.25rem;
96
+ border-style: solid;
97
+ border-width: 1px;
98
+ outline-color: transparent;
99
+ outline-offset: unset;
100
+ padding: 0 $spacing-sm;
101
+
102
+ @include media($breakpoint-xl) {
103
+ padding: $spacing-sm;
104
+ }
135
105
  }
136
106
  }
137
107
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phillips/seldon",
3
- "version": "1.112.0",
3
+ "version": "1.112.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "https://github.com/PhillipsAuctionHouse/seldon"