braid-design-system 33.12.4 → 33.13.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/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # braid-design-system
2
2
 
3
+ ## 33.13.0
4
+
5
+ ### Minor Changes
6
+
7
+ - **Autosuggest:** Add support for data attributes on individual suggestions ([#1938](https://github.com/seek-oss/braid-design-system/pull/1938))
8
+
9
+ The data attributes are applied to each rendered list item.
10
+
11
+ **EXAMPLE USAGE:**
12
+
13
+ ```jsx
14
+ <Autosuggest
15
+ suggestions={[
16
+ {
17
+ text: 'Apples',
18
+ data: { testid: 'suggestion-apples' },
19
+ },
20
+ ]}
21
+ />
22
+ ```
23
+
24
+ ### Patch Changes
25
+
26
+ - **ButtonIcon, TooltipRenderer:** Close tooltips after clicking the trigger on desktop devices ([#1932](https://github.com/seek-oss/braid-design-system/pull/1932))
27
+
3
28
  ## 33.12.4
4
29
 
5
30
  ### Patch Changes
package/dist/index.d.mts CHANGED
@@ -3034,6 +3034,7 @@ interface Suggestion<Value = any> extends AutosuggestValue<Value> {
3034
3034
  highlights?: SuggestionMatch;
3035
3035
  onClear?: (value: AutosuggestValue<Value>) => void;
3036
3036
  clearLabel?: string;
3037
+ data?: DataAttributeMap;
3037
3038
  }
3038
3039
  interface GroupedSuggestions<Value> {
3039
3040
  label: string;
package/dist/index.d.ts CHANGED
@@ -3034,6 +3034,7 @@ interface Suggestion<Value = any> extends AutosuggestValue<Value> {
3034
3034
  highlights?: SuggestionMatch;
3035
3035
  onClear?: (value: AutosuggestValue<Value>) => void;
3036
3036
  clearLabel?: string;
3037
+ data?: DataAttributeMap;
3037
3038
  }
3038
3039
  interface GroupedSuggestions<Value> {
3039
3040
  label: string;
@@ -17,6 +17,7 @@ const lib_components_private_Announcement_Announcement_cjs = require("../private
17
17
  const lib_components_private_Field_ClearField_cjs = require("../private/Field/ClearField.cjs");
18
18
  const lib_components_private_Field_Field_cjs = require("../private/Field/Field.cjs");
19
19
  const lib_components_private_Popover_Popover_cjs = require("../private/Popover/Popover.cjs");
20
+ const lib_components_private_buildDataAttributes_cjs = require("../private/buildDataAttributes.cjs");
20
21
  const lib_components_private_getNextIndex_cjs = require("../private/getNextIndex.cjs");
21
22
  const lib_components_private_normalizeKey_cjs = require("../private/normalizeKey.cjs");
22
23
  const lib_components_private_smoothScroll_cjs = require("../private/smoothScroll.cjs");
@@ -48,7 +49,7 @@ function SuggestionItem({
48
49
  id,
49
50
  ...restProps
50
51
  }) {
51
- const { highlights = [], onClear, clearLabel } = suggestion;
52
+ const { highlights = [], onClear, clearLabel, data } = suggestion;
52
53
  const label = suggestion.label ?? suggestion.text;
53
54
  const suggestionParts = parseHighlights__default.default(
54
55
  label,
@@ -65,6 +66,7 @@ function SuggestionItem({
65
66
  onMouseMove: onHover,
66
67
  onTouchStart: onHover,
67
68
  id,
69
+ ...lib_components_private_buildDataAttributes_cjs.buildDataAttributes({ data, validateRestProps: false }),
68
70
  ...restProps,
69
71
  children: /* @__PURE__ */ jsxRuntime.jsxs(
70
72
  lib_components_Box_Box_cjs.Box,
@@ -16,6 +16,7 @@ import { Announcement } from "../private/Announcement/Announcement.mjs";
16
16
  import { ClearField } from "../private/Field/ClearField.mjs";
17
17
  import { Field } from "../private/Field/Field.mjs";
18
18
  import { Popover } from "../private/Popover/Popover.mjs";
19
+ import { buildDataAttributes } from "../private/buildDataAttributes.mjs";
19
20
  import { getNextIndex } from "../private/getNextIndex.mjs";
20
21
  import { normalizeKey } from "../private/normalizeKey.mjs";
21
22
  import { smoothScroll } from "../private/smoothScroll.mjs";
@@ -43,7 +44,7 @@ function SuggestionItem({
43
44
  id,
44
45
  ...restProps
45
46
  }) {
46
- const { highlights = [], onClear, clearLabel } = suggestion;
47
+ const { highlights = [], onClear, clearLabel, data } = suggestion;
47
48
  const label = suggestion.label ?? suggestion.text;
48
49
  const suggestionParts = parseHighlights(
49
50
  label,
@@ -60,6 +61,7 @@ function SuggestionItem({
60
61
  onMouseMove: onHover,
61
62
  onTouchStart: onHover,
62
63
  id,
64
+ ...buildDataAttributes({ data, validateRestProps: false }),
63
65
  ...restProps,
64
66
  children: /* @__PURE__ */ jsxs(
65
67
  Box,
@@ -139,6 +139,7 @@ const TooltipRenderer = ({
139
139
  triggerRef.current.addEventListener("focus", openTooltip);
140
140
  triggerRef.current.addEventListener("mouseenter", openTooltip);
141
141
  triggerRef.current.addEventListener("mouseleave", closeTooltip);
142
+ triggerRef.current.addEventListener("click", closeTooltip);
142
143
  }
143
144
  }
144
145
  return () => {
@@ -150,6 +151,7 @@ const TooltipRenderer = ({
150
151
  triggerRef.current.removeEventListener("focus", openTooltip);
151
152
  triggerRef.current.removeEventListener("mouseenter", openTooltip);
152
153
  triggerRef.current.removeEventListener("mouseleave", closeTooltip);
154
+ triggerRef.current.removeEventListener("click", closeTooltip);
153
155
  }
154
156
  }
155
157
  };
@@ -136,6 +136,7 @@ const TooltipRenderer = ({
136
136
  triggerRef.current.addEventListener("focus", openTooltip);
137
137
  triggerRef.current.addEventListener("mouseenter", openTooltip);
138
138
  triggerRef.current.addEventListener("mouseleave", closeTooltip);
139
+ triggerRef.current.addEventListener("click", closeTooltip);
139
140
  }
140
141
  }
141
142
  return () => {
@@ -147,6 +148,7 @@ const TooltipRenderer = ({
147
148
  triggerRef.current.removeEventListener("focus", openTooltip);
148
149
  triggerRef.current.removeEventListener("mouseenter", openTooltip);
149
150
  triggerRef.current.removeEventListener("mouseleave", closeTooltip);
151
+ triggerRef.current.removeEventListener("click", closeTooltip);
150
152
  }
151
153
  }
152
154
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "braid-design-system",
3
- "version": "33.12.4",
3
+ "version": "33.13.0",
4
4
  "description": "Themeable design system for the SEEK Group",
5
5
  "homepage": "https://seek-oss.github.io/braid-design-system/",
6
6
  "bugs": {