@guardian/stand 0.0.53 → 0.0.55

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.
Files changed (61) hide show
  1. package/dist/TagPicker.cjs +1 -1
  2. package/dist/TagPicker.d.cts +1 -1
  3. package/dist/TagPicker.d.ts +1 -1
  4. package/dist/TagPicker.js +1 -1
  5. package/dist/components/TagPicker/Autocomplete.cjs +3 -3
  6. package/dist/components/TagPicker/Autocomplete.js +3 -3
  7. package/dist/components/TagPicker/TagPicker.cjs +15 -10
  8. package/dist/components/TagPicker/TagPicker.d.cts +21 -5
  9. package/dist/components/TagPicker/TagPicker.d.ts +21 -5
  10. package/dist/components/TagPicker/TagPicker.js +15 -10
  11. package/dist/components/TagPicker/TagSearchWithFilters.cjs +6 -3
  12. package/dist/components/TagPicker/TagSearchWithFilters.js +6 -3
  13. package/dist/components/TagPicker/styles.cjs +18 -142
  14. package/dist/components/TagPicker/styles.js +19 -135
  15. package/dist/components/{TagPicker → TagTable}/TagTable.cjs +25 -7
  16. package/dist/components/{TagPicker → TagTable}/TagTable.d.cts +18 -4
  17. package/dist/components/{TagPicker → TagTable}/TagTable.d.ts +18 -4
  18. package/dist/components/{TagPicker → TagTable}/TagTable.js +26 -8
  19. package/dist/components/TagTable/styles.cjs +170 -0
  20. package/dist/components/TagTable/styles.js +160 -0
  21. package/dist/styleD/build/css/base/colors.css +1 -1
  22. package/dist/styleD/build/css/component/autocomplete.css +13 -6
  23. package/dist/styleD/build/css/component/avatar.css +1 -1
  24. package/dist/styleD/build/css/component/datePicker.css +2 -2
  25. package/dist/styleD/build/css/component/tagPicker.css +1 -0
  26. package/dist/styleD/build/css/component/tagTable.css +9 -5
  27. package/dist/styleD/build/css/semantic/colors.css +6 -1
  28. package/dist/styleD/build/css/semantic/sizing.css +1 -0
  29. package/dist/styleD/build/typescript/base/colors.cjs +1 -1
  30. package/dist/styleD/build/typescript/base/colors.d.cts +1 -1
  31. package/dist/styleD/build/typescript/base/colors.d.ts +1 -1
  32. package/dist/styleD/build/typescript/base/colors.js +1 -1
  33. package/dist/styleD/build/typescript/component/autocomplete.cjs +17 -6
  34. package/dist/styleD/build/typescript/component/autocomplete.d.cts +14 -1
  35. package/dist/styleD/build/typescript/component/autocomplete.d.ts +14 -1
  36. package/dist/styleD/build/typescript/component/autocomplete.js +17 -6
  37. package/dist/styleD/build/typescript/component/avatar.cjs +1 -1
  38. package/dist/styleD/build/typescript/component/avatar.js +1 -1
  39. package/dist/styleD/build/typescript/component/datePicker.cjs +2 -2
  40. package/dist/styleD/build/typescript/component/datePicker.js +2 -2
  41. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.cjs +1 -4
  42. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.cts +0 -1
  43. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.d.ts +0 -1
  44. package/dist/styleD/build/typescript/component/intendedAudienceSignifier.js +1 -4
  45. package/dist/styleD/build/typescript/component/tagPicker.cjs +1 -0
  46. package/dist/styleD/build/typescript/component/tagPicker.d.cts +3 -0
  47. package/dist/styleD/build/typescript/component/tagPicker.d.ts +3 -0
  48. package/dist/styleD/build/typescript/component/tagPicker.js +1 -0
  49. package/dist/styleD/build/typescript/component/tagTable.cjs +11 -3
  50. package/dist/styleD/build/typescript/component/tagTable.d.cts +10 -2
  51. package/dist/styleD/build/typescript/component/tagTable.d.ts +10 -2
  52. package/dist/styleD/build/typescript/component/tagTable.js +11 -3
  53. package/dist/styleD/build/typescript/semantic/colors.cjs +6 -1
  54. package/dist/styleD/build/typescript/semantic/colors.d.cts +5 -0
  55. package/dist/styleD/build/typescript/semantic/colors.d.ts +5 -0
  56. package/dist/styleD/build/typescript/semantic/colors.js +6 -1
  57. package/dist/styleD/build/typescript/semantic/sizing.cjs +2 -1
  58. package/dist/styleD/build/typescript/semantic/sizing.d.cts +3 -0
  59. package/dist/styleD/build/typescript/semantic/sizing.d.ts +3 -0
  60. package/dist/styleD/build/typescript/semantic/sizing.js +2 -1
  61. package/package.json +1 -1
@@ -3,7 +3,7 @@ const require_autocomplete = require("./styleD/build/typescript/component/autoco
3
3
  const require_tagTable = require("./styleD/build/typescript/component/tagTable.cjs");
4
4
  const require_tagPicker = require("./styleD/build/typescript/component/tagPicker.cjs");
5
5
  const require_Autocomplete = require("./components/TagPicker/Autocomplete.cjs");
6
- const require_TagTable = require("./components/TagPicker/TagTable.cjs");
6
+ const require_TagTable = require("./components/TagTable/TagTable.cjs");
7
7
  const require_TagPicker = require("./components/TagPicker/TagPicker.cjs");
8
8
  exports.Autocomplete = require_Autocomplete.Autocomplete;
9
9
  exports.TagPicker = require_TagPicker.TagPicker;
@@ -1,7 +1,7 @@
1
1
  import { ComponentAutocomplete, componentAutocomplete } from "./styleD/build/typescript/component/autocomplete.cjs";
2
2
  import { Autocomplete } from "./components/TagPicker/Autocomplete.cjs";
3
3
  import { ComponentTagTable, componentTagTable } from "./styleD/build/typescript/component/tagTable.cjs";
4
- import { TagTable } from "./components/TagPicker/TagTable.cjs";
4
+ import { TagTable } from "./components/TagTable/TagTable.cjs";
5
5
  import { ComponentTagPicker, componentTagPicker } from "./styleD/build/typescript/component/tagPicker.cjs";
6
6
  import { TagPicker } from "./components/TagPicker/TagPicker.cjs";
7
7
  export { Autocomplete, type ComponentAutocomplete, type ComponentTagPicker, type ComponentTagTable, TagPicker, TagTable, componentAutocomplete, componentTagPicker, componentTagTable };
@@ -1,7 +1,7 @@
1
1
  import { ComponentAutocomplete, componentAutocomplete } from "./styleD/build/typescript/component/autocomplete.js";
2
2
  import { Autocomplete } from "./components/TagPicker/Autocomplete.js";
3
3
  import { ComponentTagTable, componentTagTable } from "./styleD/build/typescript/component/tagTable.js";
4
- import { TagTable } from "./components/TagPicker/TagTable.js";
4
+ import { TagTable } from "./components/TagTable/TagTable.js";
5
5
  import { ComponentTagPicker, componentTagPicker } from "./styleD/build/typescript/component/tagPicker.js";
6
6
  import { TagPicker } from "./components/TagPicker/TagPicker.js";
7
7
  export { Autocomplete, type ComponentAutocomplete, type ComponentTagPicker, type ComponentTagTable, TagPicker, TagTable, componentAutocomplete, componentTagPicker, componentTagTable };
package/dist/TagPicker.js CHANGED
@@ -2,6 +2,6 @@ import { componentAutocomplete } from "./styleD/build/typescript/component/autoc
2
2
  import { componentTagTable } from "./styleD/build/typescript/component/tagTable.js";
3
3
  import { componentTagPicker } from "./styleD/build/typescript/component/tagPicker.js";
4
4
  import { Autocomplete } from "./components/TagPicker/Autocomplete.js";
5
- import { TagTable } from "./components/TagPicker/TagTable.js";
5
+ import { TagTable } from "./components/TagTable/TagTable.js";
6
6
  import { TagPicker } from "./components/TagPicker/TagPicker.js";
7
7
  export { Autocomplete, TagPicker, TagTable, componentAutocomplete, componentTagPicker, componentTagTable };
@@ -111,9 +111,9 @@ function Autocomplete({ addSelection, loading, onTextInputChange, options, label
111
111
  onTextInputChange(value);
112
112
  },
113
113
  onChange: (key) => {
114
- const tag = options.find((t) => t.id === key);
115
- if (tag) {
116
- addSelection(tag);
114
+ const option = options.find((t) => t.id === key);
115
+ if (option) {
116
+ addSelection(option);
117
117
  onTextInputChange("");
118
118
  }
119
119
  },
@@ -111,9 +111,9 @@ function Autocomplete({ addSelection, loading, onTextInputChange, options, label
111
111
  onTextInputChange(value);
112
112
  },
113
113
  onChange: (key) => {
114
- const tag = options.find((t) => t.id === key);
115
- if (tag) {
116
- addSelection(tag);
114
+ const option = options.find((t) => t.id === key);
115
+ if (option) {
116
+ addSelection(option);
117
117
  onTextInputChange("");
118
118
  }
119
119
  },
@@ -1,7 +1,7 @@
1
1
  const require_Button = require("../Button/Button.cjs");
2
2
  const require_InlineMessage = require("../InlineMessage/InlineMessage.cjs");
3
3
  const require_styles = require("./styles.cjs");
4
- const require_TagTable = require("./TagTable.cjs");
4
+ const require_TagTable = require("../TagTable/TagTable.cjs");
5
5
  const require_TagSearchWithFilters = require("./TagSearchWithFilters.cjs");
6
6
  let _emotion_react = require("@emotion/react");
7
7
  let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
@@ -25,14 +25,15 @@ let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
25
25
  *
26
26
  * This is currently still in testing phase, so a production implementation is not yet available.
27
27
  */
28
- function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, options, proposedTags, readOnly = false, removeTag, retryConnection, tags, canRemove, filterRows, filterOptions, offlineBackupTags, highlightLeadingTag, searchPlaceholder = "Search for tags", searchLabel = "Search for tags", removeIcon, searchIcon, showTagType, showTagSectionName, theme, tagTableTheme, proposedTagTableTheme, autoCompleteTheme, selectTheme, cssOverrides }) {
28
+ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, options, proposedTags, readOnly = false, removeTag, retryConnection, tags, canRemove, filterRows, filterOptions, offlineBackupTags, highlightLeadingTag, searchPlaceholder = "Search for tags", searchLabel = "Search for tags", removeIcon, searchIcon, loadingIcon, showTagType, showTagSectionName, proposedTagsHeading, proposedTagsSubHeading, gripIcon, theme, tagTableTheme, proposedTagTableTheme, autoCompleteTheme, selectTheme, cssOverrides, testId = "tag-picker" }) {
29
29
  const selectedTagIds = tags.map(({ id }) => id);
30
- const proposedTagsWithoutSelected = proposedTags.filter(({ id }) => !selectedTagIds.includes(id));
30
+ const proposedTagsWithoutSelected = proposedTags?.filter(({ id }) => !selectedTagIds.includes(id)) ?? [];
31
31
  const backupTagsWithoutSelected = offlineBackupTags?.filter(({ id }) => !selectedTagIds.includes(id)) ?? [];
32
32
  const showBackupListWhenOffline = !readOnly && offlineBackupTags && backupTagsWithoutSelected.length > 0;
33
33
  const optionsWithoutSelected = options.filter(({ id }) => !selectedTagIds.includes(id));
34
34
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
35
35
  css: [require_styles.tagPickerStyles(theme), cssOverrides],
36
+ "data-testid": testId,
36
37
  children: [
37
38
  /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_TagSearchWithFilters.TagSearchWithFilters, {
38
39
  icon: searchIcon,
@@ -44,14 +45,16 @@ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, opti
44
45
  disabled: readOnly || offline,
45
46
  label: searchLabel,
46
47
  placeholder: searchPlaceholder,
47
- "data-testid": "tag-picker-search-input",
48
+ testIdPrefix: testId,
48
49
  symbol: "search",
49
50
  theme,
50
51
  autoCompleteTheme,
51
- selectTheme
52
+ selectTheme,
53
+ loadingIcon
52
54
  }),
53
55
  offline && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
54
56
  css: require_styles.offlineSectionStyles(theme),
57
+ "data-testid": `${testId}-offline`,
55
58
  children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)(require_InlineMessage.InlineMessage, {
56
59
  level: "error",
57
60
  children: [
@@ -81,22 +84,24 @@ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, opti
81
84
  removeAction: readOnly ? void 0 : removeTag,
82
85
  filterRows,
83
86
  onReorder: readOnly ? void 0 : onReorder,
84
- "data-testid": "selected-tags-table",
87
+ "data-testid": `${testId}-selected-tags-table`,
85
88
  highlightFirstRow: highlightLeadingTag,
86
89
  showTagType,
87
90
  showTagSectionName,
88
91
  removeIcon,
89
- theme: tagTableTheme
92
+ theme: tagTableTheme,
93
+ gripIcon
90
94
  }),
91
- !readOnly && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_TagTable.TagTable, {
92
- heading: "Proposed Tags",
95
+ !!proposedTags && !readOnly && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_TagTable.TagTable, {
96
+ heading: proposedTagsHeading ?? "Proposed Tags",
97
+ subHeading: proposedTagsSubHeading,
93
98
  theme: proposedTagTableTheme,
94
99
  filterRows,
95
100
  showTagType,
96
101
  showTagSectionName,
97
102
  rows: proposedTagsWithoutSelected,
98
103
  addAction: addTag,
99
- "data-testid": "proposed-tags-table"
104
+ "data-testid": `${testId}-proposed-tags-table`
100
105
  })
101
106
  ]
102
107
  });
@@ -5,7 +5,7 @@ import { ComponentTagTable } from "../../styleD/build/typescript/component/tagTa
5
5
  import { FilterOption, TagRow } from "./types.cjs";
6
6
  import { ComponentTagPicker } from "../../styleD/build/typescript/component/tagPicker.cjs";
7
7
  import { SerializedStyles } from "@emotion/react";
8
- import { ReactElement } from "react";
8
+ import { ReactElement, ReactNode } from "react";
9
9
 
10
10
  //#region src/components/TagPicker/TagPicker.d.ts
11
11
  type TagPickerProps<T extends TagRow = TagRow> = {
@@ -15,7 +15,7 @@ type TagPickerProps<T extends TagRow = TagRow> = {
15
15
  onReorder?: (tags: T[]) => void; /** `onReorder - Function called the user enters a query or selects a filter value */
16
16
  onSearch: (queryText: string, filterValue?: string) => void; /** `options` - The list of options shown in the dropdown */
17
17
  options: T[]; /** `proposedTags` - A list of "proposed tags" that the user can add */
18
- proposedTags: T[]; /** `readOnly` - Whether the interactions modifying the list of tags should be disabled */
18
+ proposedTags?: T[]; /** `readOnly` - Whether the interactions modifying the list of tags should be disabled */
19
19
  readOnly?: boolean; /** `addTag` - Function called when a tag is removed from selected tags list */
20
20
  removeTag: (tag: T) => void; /** `retryConnection - Function called to check if the service to fetch tag options is available again */
21
21
  retryConnection?: () => void; /** `tags` - The list of selected tags */
@@ -23,14 +23,25 @@ type TagPickerProps<T extends TagRow = TagRow> = {
23
23
  canRemove?: (tag: T) => boolean; /** `filterRows - A filter function that determines if the tag should be excluded from the selected and proposed tag tables */
24
24
  filterRows?: (tag: T) => boolean; /** `filterOptions` - the list of options for setting the filter value (second argument of `onSearch`). If omitted, or has only one member, the Select input is not rendered. */
25
25
  filterOptions?: FilterOption[]; /** `offlineBackupTags` - A list of tags that the user can select if the service is offline */
26
- offlineBackupTags?: T[];
26
+ offlineBackupTags?: T[]; /** `gripIcon` - Icon to indicate that a row can be dragged, used in the accessible drag button */
27
+ gripIcon?: ReactElement;
28
+ /** `testid` - the test id for the Tag picker, defaults to "tag-picker". Is used as a prefix for test id's on the sub components eg:
29
+ * - "tag-picker-search-input"
30
+ * - "tag-picker-filter-select"
31
+ * - "tag-picker-offline"
32
+ * - "tag-picker-selected-tags-table"
33
+ * - "tag-picker-proposed-tags-table" */
34
+ testId?: string;
27
35
  highlightLeadingTag?: boolean;
28
36
  searchPlaceholder?: string;
29
37
  searchLabel?: string;
30
38
  removeIcon?: ReactElement;
31
39
  searchIcon?: ReactElement;
40
+ loadingIcon?: ReactElement;
32
41
  showTagType?: boolean;
33
- showTagSectionName?: boolean; /** `theme` - Used to customise the look and feel of the TagPicker component */
42
+ showTagSectionName?: boolean;
43
+ proposedTagsHeading?: ReactNode;
44
+ proposedTagsSubHeading?: string; /** `theme` - Used to customise the look and feel of the TagPicker component */
34
45
  theme?: DeepPartial<ComponentTagPicker>;
35
46
  tagTableTheme?: DeepPartial<ComponentTagTable>;
36
47
  proposedTagTableTheme?: DeepPartial<ComponentTagTable>;
@@ -78,14 +89,19 @@ declare function TagPicker<T extends TagRow = TagRow>({
78
89
  searchLabel,
79
90
  removeIcon,
80
91
  searchIcon,
92
+ loadingIcon,
81
93
  showTagType,
82
94
  showTagSectionName,
95
+ proposedTagsHeading,
96
+ proposedTagsSubHeading,
97
+ gripIcon,
83
98
  theme,
84
99
  tagTableTheme,
85
100
  proposedTagTableTheme,
86
101
  autoCompleteTheme,
87
102
  selectTheme,
88
- cssOverrides
103
+ cssOverrides,
104
+ testId
89
105
  }: TagPickerProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
90
106
  //#endregion
91
107
  export { TagPicker };
@@ -4,7 +4,7 @@ import { ComponentAutocomplete } from "../../styleD/build/typescript/component/a
4
4
  import { ComponentTagTable } from "../../styleD/build/typescript/component/tagTable.js";
5
5
  import { FilterOption, TagRow } from "./types.js";
6
6
  import { ComponentTagPicker } from "../../styleD/build/typescript/component/tagPicker.js";
7
- import { ReactElement } from "react";
7
+ import { ReactElement, ReactNode } from "react";
8
8
  import { SerializedStyles } from "@emotion/react";
9
9
 
10
10
  //#region src/components/TagPicker/TagPicker.d.ts
@@ -15,7 +15,7 @@ type TagPickerProps<T extends TagRow = TagRow> = {
15
15
  onReorder?: (tags: T[]) => void; /** `onReorder - Function called the user enters a query or selects a filter value */
16
16
  onSearch: (queryText: string, filterValue?: string) => void; /** `options` - The list of options shown in the dropdown */
17
17
  options: T[]; /** `proposedTags` - A list of "proposed tags" that the user can add */
18
- proposedTags: T[]; /** `readOnly` - Whether the interactions modifying the list of tags should be disabled */
18
+ proposedTags?: T[]; /** `readOnly` - Whether the interactions modifying the list of tags should be disabled */
19
19
  readOnly?: boolean; /** `addTag` - Function called when a tag is removed from selected tags list */
20
20
  removeTag: (tag: T) => void; /** `retryConnection - Function called to check if the service to fetch tag options is available again */
21
21
  retryConnection?: () => void; /** `tags` - The list of selected tags */
@@ -23,14 +23,25 @@ type TagPickerProps<T extends TagRow = TagRow> = {
23
23
  canRemove?: (tag: T) => boolean; /** `filterRows - A filter function that determines if the tag should be excluded from the selected and proposed tag tables */
24
24
  filterRows?: (tag: T) => boolean; /** `filterOptions` - the list of options for setting the filter value (second argument of `onSearch`). If omitted, or has only one member, the Select input is not rendered. */
25
25
  filterOptions?: FilterOption[]; /** `offlineBackupTags` - A list of tags that the user can select if the service is offline */
26
- offlineBackupTags?: T[];
26
+ offlineBackupTags?: T[]; /** `gripIcon` - Icon to indicate that a row can be dragged, used in the accessible drag button */
27
+ gripIcon?: ReactElement;
28
+ /** `testid` - the test id for the Tag picker, defaults to "tag-picker". Is used as a prefix for test id's on the sub components eg:
29
+ * - "tag-picker-search-input"
30
+ * - "tag-picker-filter-select"
31
+ * - "tag-picker-offline"
32
+ * - "tag-picker-selected-tags-table"
33
+ * - "tag-picker-proposed-tags-table" */
34
+ testId?: string;
27
35
  highlightLeadingTag?: boolean;
28
36
  searchPlaceholder?: string;
29
37
  searchLabel?: string;
30
38
  removeIcon?: ReactElement;
31
39
  searchIcon?: ReactElement;
40
+ loadingIcon?: ReactElement;
32
41
  showTagType?: boolean;
33
- showTagSectionName?: boolean; /** `theme` - Used to customise the look and feel of the TagPicker component */
42
+ showTagSectionName?: boolean;
43
+ proposedTagsHeading?: ReactNode;
44
+ proposedTagsSubHeading?: string; /** `theme` - Used to customise the look and feel of the TagPicker component */
34
45
  theme?: DeepPartial<ComponentTagPicker>;
35
46
  tagTableTheme?: DeepPartial<ComponentTagTable>;
36
47
  proposedTagTableTheme?: DeepPartial<ComponentTagTable>;
@@ -78,14 +89,19 @@ declare function TagPicker<T extends TagRow = TagRow>({
78
89
  searchLabel,
79
90
  removeIcon,
80
91
  searchIcon,
92
+ loadingIcon,
81
93
  showTagType,
82
94
  showTagSectionName,
95
+ proposedTagsHeading,
96
+ proposedTagsSubHeading,
97
+ gripIcon,
83
98
  theme,
84
99
  tagTableTheme,
85
100
  proposedTagTableTheme,
86
101
  autoCompleteTheme,
87
102
  selectTheme,
88
- cssOverrides
103
+ cssOverrides,
104
+ testId
89
105
  }: TagPickerProps<T>): import("@emotion/react/jsx-runtime").JSX.Element;
90
106
  //#endregion
91
107
  export { TagPicker };
@@ -1,7 +1,7 @@
1
1
  import { Button } from "../Button/Button.js";
2
2
  import { InlineMessage } from "../InlineMessage/InlineMessage.js";
3
3
  import { offlineSectionStyles, tagPickerStyles } from "./styles.js";
4
- import { TagTable } from "./TagTable.js";
4
+ import { TagTable } from "../TagTable/TagTable.js";
5
5
  import { TagSearchWithFilters } from "./TagSearchWithFilters.js";
6
6
  import { css } from "@emotion/react";
7
7
  import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";
@@ -25,14 +25,15 @@ import { Fragment, jsx, jsxs } from "@emotion/react/jsx-runtime";
25
25
  *
26
26
  * This is currently still in testing phase, so a production implementation is not yet available.
27
27
  */
28
- function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, options, proposedTags, readOnly = false, removeTag, retryConnection, tags, canRemove, filterRows, filterOptions, offlineBackupTags, highlightLeadingTag, searchPlaceholder = "Search for tags", searchLabel = "Search for tags", removeIcon, searchIcon, showTagType, showTagSectionName, theme, tagTableTheme, proposedTagTableTheme, autoCompleteTheme, selectTheme, cssOverrides }) {
28
+ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, options, proposedTags, readOnly = false, removeTag, retryConnection, tags, canRemove, filterRows, filterOptions, offlineBackupTags, highlightLeadingTag, searchPlaceholder = "Search for tags", searchLabel = "Search for tags", removeIcon, searchIcon, loadingIcon, showTagType, showTagSectionName, proposedTagsHeading, proposedTagsSubHeading, gripIcon, theme, tagTableTheme, proposedTagTableTheme, autoCompleteTheme, selectTheme, cssOverrides, testId = "tag-picker" }) {
29
29
  const selectedTagIds = tags.map(({ id }) => id);
30
- const proposedTagsWithoutSelected = proposedTags.filter(({ id }) => !selectedTagIds.includes(id));
30
+ const proposedTagsWithoutSelected = proposedTags?.filter(({ id }) => !selectedTagIds.includes(id)) ?? [];
31
31
  const backupTagsWithoutSelected = offlineBackupTags?.filter(({ id }) => !selectedTagIds.includes(id)) ?? [];
32
32
  const showBackupListWhenOffline = !readOnly && offlineBackupTags && backupTagsWithoutSelected.length > 0;
33
33
  const optionsWithoutSelected = options.filter(({ id }) => !selectedTagIds.includes(id));
34
34
  return /* @__PURE__ */ jsxs("div", {
35
35
  css: [tagPickerStyles(theme), cssOverrides],
36
+ "data-testid": testId,
36
37
  children: [
37
38
  /* @__PURE__ */ jsx(TagSearchWithFilters, {
38
39
  icon: searchIcon,
@@ -44,14 +45,16 @@ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, opti
44
45
  disabled: readOnly || offline,
45
46
  label: searchLabel,
46
47
  placeholder: searchPlaceholder,
47
- "data-testid": "tag-picker-search-input",
48
+ testIdPrefix: testId,
48
49
  symbol: "search",
49
50
  theme,
50
51
  autoCompleteTheme,
51
- selectTheme
52
+ selectTheme,
53
+ loadingIcon
52
54
  }),
53
55
  offline && /* @__PURE__ */ jsxs("div", {
54
56
  css: offlineSectionStyles(theme),
57
+ "data-testid": `${testId}-offline`,
55
58
  children: [/* @__PURE__ */ jsxs(InlineMessage, {
56
59
  level: "error",
57
60
  children: [
@@ -81,22 +84,24 @@ function TagPicker({ addTag, loading, offline = false, onReorder, onSearch, opti
81
84
  removeAction: readOnly ? void 0 : removeTag,
82
85
  filterRows,
83
86
  onReorder: readOnly ? void 0 : onReorder,
84
- "data-testid": "selected-tags-table",
87
+ "data-testid": `${testId}-selected-tags-table`,
85
88
  highlightFirstRow: highlightLeadingTag,
86
89
  showTagType,
87
90
  showTagSectionName,
88
91
  removeIcon,
89
- theme: tagTableTheme
92
+ theme: tagTableTheme,
93
+ gripIcon
90
94
  }),
91
- !readOnly && /* @__PURE__ */ jsx(TagTable, {
92
- heading: "Proposed Tags",
95
+ !!proposedTags && !readOnly && /* @__PURE__ */ jsx(TagTable, {
96
+ heading: proposedTagsHeading ?? "Proposed Tags",
97
+ subHeading: proposedTagsSubHeading,
93
98
  theme: proposedTagTableTheme,
94
99
  filterRows,
95
100
  showTagType,
96
101
  showTagSectionName,
97
102
  rows: proposedTagsWithoutSelected,
98
103
  addAction: addTag,
99
- "data-testid": "proposed-tags-table"
104
+ "data-testid": `${testId}-proposed-tags-table`
100
105
  })
101
106
  ]
102
107
  });
@@ -5,7 +5,7 @@ let react = require("react");
5
5
  let _emotion_react = require("@emotion/react");
6
6
  let _emotion_react_jsx_runtime = require("@emotion/react/jsx-runtime");
7
7
  //#region src/components/TagPicker/TagSearchWithFilters.tsx
8
- function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled, theme, autoCompleteTheme, selectTheme = {}, ...tagAutocompleteProps }) {
8
+ function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled, theme, autoCompleteTheme, selectTheme = {}, testIdPrefix = "tag-search", ...tagAutocompleteProps }) {
9
9
  const [queryText, setQueryText] = (0, react.useState)("");
10
10
  const [filterValue, setFilterValue] = (0, react.useState)(filterOptions?.[0]?.filter);
11
11
  const onSearchRef = (0, react.useRef)(onSearch);
@@ -13,30 +13,33 @@ function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled,
13
13
  onSearchRef.current = onSearch;
14
14
  }, [onSearch]);
15
15
  (0, react.useEffect)(() => {
16
- if (queryText && queryText.length > 0) onSearchRef.current(queryText, filterValue && filterValue.length > 0 ? filterValue : void 0);
16
+ onSearchRef.current(queryText, filterValue && filterValue.length > 0 ? filterValue : void 0);
17
17
  }, [filterValue, queryText]);
18
18
  const shouldRenderSelect = filterOptions && filterOptions.length > 1;
19
19
  return /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsxs)("div", {
20
20
  css: require_styles.tagSearchWithFilterStyles(theme),
21
21
  children: [/* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Autocomplete.Autocomplete, {
22
+ ...tagAutocompleteProps,
22
23
  cssOverrides: (0, _emotion_react.css)({ flex: 1 }),
23
24
  onTextInputChange: setQueryText,
24
25
  addSelection: (tag) => {
25
26
  addSelection(tag);
26
27
  setQueryText("");
27
28
  },
29
+ "data-testid": `${testIdPrefix}-search-input`,
28
30
  value: queryText,
29
- ...tagAutocompleteProps,
30
31
  disabled,
31
32
  theme: autoCompleteTheme,
32
33
  addFirstOnEnter: true
33
34
  }), shouldRenderSelect && /* @__PURE__ */ (0, _emotion_react_jsx_runtime.jsx)(require_Select.Select, {
35
+ "aria-label": "tag filter options",
34
36
  theme: require_styles.modifyFilterSelectTheme(selectTheme),
35
37
  cssOverrides: require_styles.filterSelectCssOverrides(theme),
36
38
  isDisabled: disabled,
37
39
  value: filterValue,
38
40
  placement: "bottom right",
39
41
  shouldFlip: false,
42
+ "data-testid": `${testIdPrefix}-filter-select`,
40
43
  onChange: (selection) => {
41
44
  if (Array.isArray(selection) || selection === null) return;
42
45
  setFilterValue(selection.toString());
@@ -5,7 +5,7 @@ import { useEffect, useRef, useState } from "react";
5
5
  import { css } from "@emotion/react";
6
6
  import { jsx, jsxs } from "@emotion/react/jsx-runtime";
7
7
  //#region src/components/TagPicker/TagSearchWithFilters.tsx
8
- function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled, theme, autoCompleteTheme, selectTheme = {}, ...tagAutocompleteProps }) {
8
+ function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled, theme, autoCompleteTheme, selectTheme = {}, testIdPrefix = "tag-search", ...tagAutocompleteProps }) {
9
9
  const [queryText, setQueryText] = useState("");
10
10
  const [filterValue, setFilterValue] = useState(filterOptions?.[0]?.filter);
11
11
  const onSearchRef = useRef(onSearch);
@@ -13,30 +13,33 @@ function TagSearchWithFilters({ addSelection, onSearch, filterOptions, disabled,
13
13
  onSearchRef.current = onSearch;
14
14
  }, [onSearch]);
15
15
  useEffect(() => {
16
- if (queryText && queryText.length > 0) onSearchRef.current(queryText, filterValue && filterValue.length > 0 ? filterValue : void 0);
16
+ onSearchRef.current(queryText, filterValue && filterValue.length > 0 ? filterValue : void 0);
17
17
  }, [filterValue, queryText]);
18
18
  const shouldRenderSelect = filterOptions && filterOptions.length > 1;
19
19
  return /* @__PURE__ */ jsxs("div", {
20
20
  css: tagSearchWithFilterStyles(theme),
21
21
  children: [/* @__PURE__ */ jsx(Autocomplete, {
22
+ ...tagAutocompleteProps,
22
23
  cssOverrides: css({ flex: 1 }),
23
24
  onTextInputChange: setQueryText,
24
25
  addSelection: (tag) => {
25
26
  addSelection(tag);
26
27
  setQueryText("");
27
28
  },
29
+ "data-testid": `${testIdPrefix}-search-input`,
28
30
  value: queryText,
29
- ...tagAutocompleteProps,
30
31
  disabled,
31
32
  theme: autoCompleteTheme,
32
33
  addFirstOnEnter: true
33
34
  }), shouldRenderSelect && /* @__PURE__ */ jsx(Select, {
35
+ "aria-label": "tag filter options",
34
36
  theme: modifyFilterSelectTheme(selectTheme),
35
37
  cssOverrides: filterSelectCssOverrides(theme),
36
38
  isDisabled: disabled,
37
39
  value: filterValue,
38
40
  placement: "bottom right",
39
41
  shouldFlip: false,
42
+ "data-testid": `${testIdPrefix}-filter-select`,
40
43
  onChange: (selection) => {
41
44
  if (Array.isArray(selection) || selection === null) return;
42
45
  setFilterValue(selection.toString());
@@ -1,6 +1,5 @@
1
1
  const require_mergeDeep = require("../../util/mergeDeep.cjs");
2
2
  const require_autocomplete = require("../../styleD/build/typescript/component/autocomplete.cjs");
3
- const require_tagTable = require("../../styleD/build/typescript/component/tagTable.cjs");
4
3
  const require_tagPicker = require("../../styleD/build/typescript/component/tagPicker.cjs");
5
4
  let _emotion_react = require("@emotion/react");
6
5
  //#region src/components/TagPicker/styles.ts
@@ -15,13 +14,27 @@ const autocompleteInputStyles = (hasIcon, partialTheme = {}) => {
15
14
  border-color: ${theme.input.borderColor};
16
15
  border-width: ${theme.input.borderWidth};
17
16
  border-style: ${theme.input.borderStyle};
17
+ border-radius: ${theme.input.borderRadius};
18
+
18
19
  ${hasIcon && `
19
20
  padding-right: calc(${theme.icon.paddingX} + ${theme.icon.size} + ${theme.icon.paddingX});
20
21
  min-height: calc(${theme.icon.size});
21
22
  `}
22
23
 
24
+ &[data-hovered] {
25
+ background-color: ${theme.input.hover.backgroundColor};
26
+ }
27
+
28
+ &[data-focus-visible] {
29
+ outline: ${theme.input.focused.outline};
30
+ outline-offset: ${theme.input.focused.outlineOffset};
31
+ }
32
+
23
33
  &[data-disabled] {
24
- background-color: ${theme.input.disabledBackgroundColor};
34
+ cursor: ${theme.input.disabled.cursor};
35
+ background-color: ${theme.input.disabled.backgroundColor};
36
+ color: ${theme.input.disabled.color};
37
+ border: ${theme.input.disabled.border};
25
38
  }
26
39
  `;
27
40
  };
@@ -59,137 +72,6 @@ const listboxInfoStyles = (partialTheme = {}) => {
59
72
  padding: ${theme.listbox.item.paddingY} ${theme.listbox.item.paddingX};
60
73
  `;
61
74
  };
62
- const tagTableHeadingStyles = (partialTheme = {}) => {
63
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
64
- return _emotion_react.css`
65
- background-color: ${theme.heading.backgroundColor};
66
- font-weight: ${theme.heading.fontWeight};
67
- padding: ${theme.heading.paddingTop} ${theme.heading.paddingRight}
68
- ${theme.heading.paddingBottom} ${theme.heading.paddingLeft};
69
- `;
70
- };
71
- const tagTableCellStyles = (partialTheme = {}) => {
72
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
73
- return _emotion_react.css`
74
- padding: ${theme.cell.paddingY} ${theme.cell.paddingX};
75
- vertical-align: middle;
76
-
77
- :first-of-type {
78
- padding-left: ${theme.cell.firstCellPaddingLeft};
79
- }
80
-
81
- :not(:last-child) {
82
- border-right-width: ${theme.cell.borderBetweenCells.borderWidth};
83
- border-right-style: ${theme.cell.borderBetweenCells.borderStyle};
84
- border-right-color: ${theme.cell.borderBetweenCells.borderColor};
85
- }
86
- `;
87
- };
88
- const tagTableRowStyles = (canDrag, highlightFirstRow, partialTheme = {}) => {
89
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
90
- return _emotion_react.css`
91
- background-color: ${theme.row.backgroundColor};
92
- height: ${theme.row.height};
93
- &:not(:last-child) {
94
- border-bottom-color: ${theme.row.borderBottom.borderColor};
95
- border-bottom-style: ${theme.row.borderBottom.borderStyle};
96
- border-bottom-width: ${theme.row.borderBottom.borderWidth};
97
- }
98
-
99
- :hover {
100
- background-color: ${theme.row.backgroundHoverColor};
101
- ${canDrag ? "cursor: grab;" : null}
102
- button[slot='drag'] {
103
- opacity: 1;
104
- }
105
- }
106
- ${highlightFirstRow && `:first-of-type {
107
- background-color: ${theme.row.firstRowBackgroundColor};
108
-
109
- :hover {
110
- background-color: ${theme.row.firstRowBackgroundHoverColor};
111
- }
112
- }`}
113
- `;
114
- };
115
- const tagTableStyles = (canRemoveTag, partialTheme = {}) => {
116
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
117
- return _emotion_react.css`
118
- width: 100%;
119
- border-collapse: collapse;
120
-
121
- .react-aria-DropIndicator[data-drop-target] {
122
- height: ${theme.row.height};
123
-
124
- ${canRemoveTag ? `&:first-child {
125
- background-color: ${theme.row.firstRowBackgroundColor};
126
- }` : ""}
127
- }
128
- `;
129
- };
130
- const tagTableRemoveButtonStyles = _emotion_react.css`
131
- background: none;
132
- border: none;
133
- padding: 0;
134
- :hover {
135
- cursor: pointer;
136
- }
137
- `;
138
- const tagTableAddButtonStyles = (partialTheme = {}) => {
139
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
140
- return _emotion_react.css`
141
- :hover {
142
- cursor: pointer;
143
- background-color: ${theme.addButton.backgroundHoverColor};
144
- }
145
-
146
- color: ${theme.addButton.color};
147
- -webkit-text-decoration: none;
148
- text-decoration: none;
149
- padding: ${theme.addButton.paddingY} ${theme.addButton.paddingX};
150
- position: relative;
151
- border: 0;
152
- border-radius: 0;
153
- cursor: pointer;
154
- justify-content: center;
155
- align-items: center;
156
- font-weight: ${theme.addButton.fontWeight};
157
- font-size: ${theme.addButton.fontSize};
158
- height: 24px;
159
- width: fit-content;
160
- line-height: 1;
161
- flex-direction: row;
162
- gap: 8px;
163
- background-color: ${theme.addButton.backgroundColor};
164
- display: inline-flex;
165
- `;
166
- };
167
- const tagTableDragButtonStyles = _emotion_react.css`
168
- background: none;
169
- border: none;
170
- padding: 0;
171
- padding-left: 5px;
172
- margin: 0;
173
- display: flex;
174
- align-items: center;
175
- opacity: 0;
176
-
177
- &:focus {
178
- opacity: 1;
179
- }
180
- `;
181
- const tagTableTypeBadgeStyles = (partialTheme = {}) => {
182
- const theme = require_mergeDeep.mergeDeep(require_tagTable.componentTagTable, partialTheme);
183
- return _emotion_react.css`
184
- white-space: nowrap;
185
- text-transform: uppercase;
186
- color: ${theme.typeBadge.color};
187
- background-color: ${theme.typeBadge.backgroundColor};
188
- padding: ${theme.typeBadge.paddingY} ${theme.typeBadge.paddingX};
189
- font-size: ${theme.typeBadge.fontSize};
190
- font-weight: ${theme.typeBadge.fontWeight};
191
- `;
192
- };
193
75
  const iconStyles = (partialTheme = {}) => {
194
76
  const theme = require_mergeDeep.mergeDeep(require_autocomplete.componentAutocomplete, partialTheme);
195
77
  return _emotion_react.css`
@@ -219,9 +101,11 @@ const offlineSectionStyles = (partialTheme = {}) => {
219
101
  `;
220
102
  };
221
103
  const tagSearchWithFilterStyles = (partialTheme = {}) => {
104
+ const theme = require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme);
222
105
  return _emotion_react.css`
106
+ width: ${theme.search.width};
223
107
  display: flex;
224
- gap: ${require_mergeDeep.mergeDeep(require_tagPicker.componentTagPicker, partialTheme).shared.gap};
108
+ gap: ${theme.shared.gap};
225
109
  `;
226
110
  };
227
111
  const filterSelectCssOverrides = (partialTheme = {}) => {
@@ -250,11 +134,3 @@ exports.modifyFilterSelectTheme = modifyFilterSelectTheme;
250
134
  exports.offlineSectionStyles = offlineSectionStyles;
251
135
  exports.tagPickerStyles = tagPickerStyles;
252
136
  exports.tagSearchWithFilterStyles = tagSearchWithFilterStyles;
253
- exports.tagTableAddButtonStyles = tagTableAddButtonStyles;
254
- exports.tagTableCellStyles = tagTableCellStyles;
255
- exports.tagTableDragButtonStyles = tagTableDragButtonStyles;
256
- exports.tagTableHeadingStyles = tagTableHeadingStyles;
257
- exports.tagTableRemoveButtonStyles = tagTableRemoveButtonStyles;
258
- exports.tagTableRowStyles = tagTableRowStyles;
259
- exports.tagTableStyles = tagTableStyles;
260
- exports.tagTableTypeBadgeStyles = tagTableTypeBadgeStyles;