@sproutsocial/racine 8.5.1 → 8.6.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/__flow__/Collapsible/index.js +40 -11
  3. package/__flow__/Collapsible/index.stories.js +77 -0
  4. package/__flow__/Collapsible/styles.js +28 -2
  5. package/__flow__/Listbox/__snapshots__/index.test.js.snap +84 -42
  6. package/__flow__/Listbox/index.stories.js +33 -0
  7. package/__flow__/Listbox/index.test.js +52 -2
  8. package/__flow__/Menu/__snapshots__/index.test.js.snap +4 -0
  9. package/__flow__/Menu/hooks.js +8 -3
  10. package/__flow__/Menu/index.flow.js +1 -0
  11. package/__flow__/Menu/index.js +31 -4
  12. package/__flow__/Menu/index.stories.js +20 -0
  13. package/__flow__/Menu/styles.js +4 -0
  14. package/__flow__/dataviz/dataviz.stories.js +12 -0
  15. package/__flow__/dataviz/index.js +13 -0
  16. package/__flow__/themes/dark/dataviz-palette.js +50 -0
  17. package/__flow__/themes/dark/theme.js +2 -0
  18. package/__flow__/themes/default/dataviz-palette.js +50 -0
  19. package/__flow__/themes/default/theme.js +2 -0
  20. package/commonjs/Collapsible/index.js +28 -11
  21. package/commonjs/Collapsible/styles.js +8 -1
  22. package/commonjs/Menu/hooks.js +12 -3
  23. package/commonjs/Menu/index.js +26 -6
  24. package/commonjs/Menu/styles.js +4 -2
  25. package/commonjs/dataviz/index.js +24 -0
  26. package/commonjs/themes/dark/dataviz-palette.js +35 -0
  27. package/commonjs/themes/dark/theme.js +3 -1
  28. package/commonjs/themes/default/dataviz-palette.js +35 -0
  29. package/commonjs/themes/default/theme.js +3 -1
  30. package/lib/Collapsible/index.js +28 -11
  31. package/lib/Collapsible/styles.js +8 -1
  32. package/lib/Menu/hooks.js +12 -3
  33. package/lib/Menu/index.js +26 -6
  34. package/lib/Menu/styles.js +4 -2
  35. package/lib/dataviz/index.js +13 -0
  36. package/lib/themes/dark/dataviz-palette.js +26 -0
  37. package/lib/themes/dark/theme.js +2 -1
  38. package/lib/themes/default/dataviz-palette.js +26 -0
  39. package/lib/themes/default/theme.js +2 -1
  40. package/package.json +3 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.6.1
4
+
5
+ ### Patch Changes
6
+
7
+ - c46c79d: Pressing space on a filter input in listbox triggers a submit, preventing users from entering text with spaces. This fix changes the behavior such that if the input is in focus, the space won't trigger a select.
8
+ - b34b463: Invert the icon colors in menu items to mirror the text behavior.
9
+
10
+ ## 8.6.0
11
+
12
+ ### Minor Changes
13
+
14
+ - d1c8003: Adds data-viz color rotation to the theme file to support data-viz across dark mode and future themes.
15
+
16
+ ## 8.5.2
17
+
18
+ ### Patch Changes
19
+
20
+ - 41b0717: Adds openHeight and collapsedHeight props to Collapsible component for more flexible collapse usage
21
+
3
22
  ## 8.5.1
4
23
 
5
24
  ### Patch Changes
@@ -11,6 +11,8 @@ type TypeCollapsibleContext = $Shape<{
11
11
  isOpen: boolean,
12
12
  id: string,
13
13
  offset: number,
14
+ openHeight: number,
15
+ collapsedHeight: number,
14
16
  }>;
15
17
 
16
18
  const CollapsibleContext = React.createContext<TypeCollapsibleContext>({});
@@ -20,18 +22,42 @@ type TypeProps = {
20
22
  children: React.Node,
21
23
  /** If the children of the collapsible panel have a top or bottom margin, it will throw off the calculations for the height of the content. The total amount of vertical margin (in pixels) can be supplied to this prop to correct this. */
22
24
  offset?: number,
25
+ collapsedHeight?: number,
26
+ openHeight?: number,
23
27
  };
24
28
 
25
- const Collapsible = ({ children, isOpen = false, offset = 0 }: TypeProps) => {
29
+ const Collapsible = ({
30
+ children,
31
+ isOpen = false,
32
+ offset = 0,
33
+ collapsedHeight = 0,
34
+ openHeight,
35
+ }: TypeProps) => {
26
36
  const [id] = useState(`Racine-collapsible-${idCounter++}`);
27
37
 
28
38
  return (
29
- <CollapsibleContext.Provider value={{ isOpen, id, offset }}>
39
+ <CollapsibleContext.Provider
40
+ value={{ isOpen, id, offset, collapsedHeight, openHeight }}
41
+ >
30
42
  {children}
31
43
  </CollapsibleContext.Provider>
32
44
  );
33
45
  };
34
46
 
47
+ const determineMaxHeight = (isHidden, openHeight, computedHeight) => {
48
+ // If isHidden is undefined this is the first render. Return undefined so the max-height prop is not added
49
+ // This is a hack to prevent css from animating if it begins in the open state
50
+ // css animates when attribute values change (IE from 0 to another number)
51
+ // css does not animate when simply adding an attribute to an HTML element
52
+ if (isHidden === undefined) return undefined;
53
+
54
+ // If the user has defined an explicit open height, return that as the max height
55
+ if (!!openHeight) return openHeight;
56
+
57
+ // Otherwise, fallback to the computed height
58
+ return computedHeight;
59
+ };
60
+
35
61
  const Trigger = ({ children, ...rest }) => {
36
62
  const { isOpen, id } = useContext(CollapsibleContext);
37
63
 
@@ -47,17 +73,18 @@ const Trigger = ({ children, ...rest }) => {
47
73
  };
48
74
 
49
75
  const Panel = ({ children, ...rest }) => {
50
- const { isOpen, id, offset } = useContext(CollapsibleContext);
76
+ const { isOpen, id, offset, collapsedHeight, openHeight } = useContext(
77
+ CollapsibleContext
78
+ );
51
79
  const ref = useRef();
52
80
  const measurement = useMeasure(ref);
53
81
  const [isHidden, setIsHidden] = useState(undefined);
54
82
 
55
- // If this is the initial render isHidden will be undefined
56
- // When that is the case, set maxHeight to undefined rather than the comptued 0
57
- // This prevents an initial expansion animation if a component starts out open
58
- // There is no animation because css is not changing the maxHeight property after mount
59
- const maxHeight =
60
- isHidden === undefined ? undefined : measurement.height + offset;
83
+ const maxHeight = determineMaxHeight(
84
+ isHidden,
85
+ openHeight,
86
+ measurement.height + offset
87
+ );
61
88
 
62
89
  /* We use the "hidden" attribute to remove the contents of the panel from the tab order of the page, but it fucks with the animation. This logic sets a slight timeout on setting the prop so that the animation has time to complete before the attribute is set. */
63
90
  useEffect(() => {
@@ -76,14 +103,16 @@ const Panel = ({ children, ...rest }) => {
76
103
 
77
104
  return (
78
105
  <CollapsingBox
79
- maxHeight={isOpen ? maxHeight : "0"}
106
+ scrollable={isOpen}
107
+ maxHeight={isOpen ? maxHeight : collapsedHeight}
108
+ minHeight={collapsedHeight}
80
109
  data-qa-collapsible={""}
81
110
  data-qa-collapsible-isopen={isOpen === true}
82
111
  {...rest}
83
112
  >
84
113
  <Box
85
114
  width="100%"
86
- hidden={isHidden}
115
+ hidden={isHidden && collapsedHeight === 0}
87
116
  aria-hidden={!isOpen}
88
117
  id={id}
89
118
  ref={ref}
@@ -89,3 +89,80 @@ export const withTallContent = () => (
89
89
  withTallContent.story = {
90
90
  name: "With tall content",
91
91
  };
92
+
93
+ const StatefulCollapseWithMinHeight = ({
94
+ children,
95
+ offset = 0,
96
+ collapsedHeight = 0,
97
+ openHeight,
98
+ }) => {
99
+ const [open, setOpen] = useState(false);
100
+ const toggle = () => setOpen(!open);
101
+
102
+ return (
103
+ <Collapsible
104
+ id="test-id-1"
105
+ isOpen={open}
106
+ offset={offset}
107
+ openHeight={openHeight}
108
+ collapsedHeight={collapsedHeight}
109
+ >
110
+ <Collapsible.Panel>{children}</Collapsible.Panel>
111
+ <Collapsible.Trigger>
112
+ <Button onClick={toggle}>{open ? "Show Less" : "Show More"}</Button>
113
+ </Collapsible.Trigger>
114
+ </Collapsible>
115
+ );
116
+ };
117
+
118
+ export const withCollapsedHeight = () => {
119
+ return (
120
+ <StatefulCollapseWithMinHeight collapsedHeight={100} openHeight={300}>
121
+ <Box width="500px" p={400}>
122
+ Threepio! Come in, Threepio! Threepio! Get to the top! I can’t Where
123
+ could he be? Threepio! Threepio, will you come in? They aren’t here!
124
+ Something must have happened to them. See if they’ve been captured.
125
+ Hurry! One thing’s for sure. We’re all going to be a lot thinner! Get on
126
+ top of it! I’m trying! Thank goodness, they haven’t found them! Where
127
+ could they be? Use the comlink? Oh, my! I forgot I turned it off! Are
128
+ you there, sir? Threepio! We’ve had some problems… Will you shut up and
129
+ listen to me? Shut down all garbage mashers on the detention level, will
130
+ you? Do you copy? Shut down all the garbage mashers on the detention
131
+ level. Shut down all the garbage mashers on the detention level. No.
132
+ Shut them all down! Hurry! Listen to them! They’re dying, Artoo! Curse
133
+ my metal body! I wasn’t fast enough. It’s all my fault! My poor master!
134
+ Threepio, we’re all right! We’re all right. You did great. Threepio!
135
+ Come in, Threepio! Threepio! Get to the top! I can’t Where could he be?
136
+ Threepio! Threepio, will you come in? They aren’t here! Something must
137
+ have happened to them. See if they’ve been captured. Hurry! One thing’s
138
+ for sure. We’re all going to be a lot thinner! Get on top of it! I’m
139
+ trying! Thank goodness, they haven’t found them! Where could they be?
140
+ Use the comlink? Oh, my! I forgot I turned it off! Are you there, sir?
141
+ Threepio! We’ve had some problems… Will you shut up and listen to me?
142
+ Shut down all garbage mashers on the detention level, will you? Do you
143
+ copy? Shut down all the garbage mashers on the detention level. Shut
144
+ down all the garbage mashers on the detention level. No. Shut them all
145
+ down! Hurry! Listen to them! They’re dying, Artoo! Curse my metal body!
146
+ I wasn’t fast enough. It’s all my fault! My poor master! Threepio, we’re
147
+ all right! We’re all right. You did great. Threepio! Come in, Threepio!
148
+ Threepio! Get to the top! I can’t Where could he be? Threepio! Threepio,
149
+ will you come in? They aren’t here! Something must have happened to
150
+ them. See if they’ve been captured. Hurry! One thing’s for sure. We’re
151
+ all going to be a lot thinner! Get on top of it! I’m trying! Thank
152
+ goodness, they haven’t found them! Where could they be? Use the comlink?
153
+ Oh, my! I forgot I turned it off! Are you there, sir? Threepio! We’ve
154
+ had some problems… Will you shut up and listen to me? Shut down all
155
+ garbage mashers on the detention level, will you? Do you copy? Shut down
156
+ all the garbage mashers on the detention level. Shut down all the
157
+ garbage mashers on the detention level. No. Shut them all down! Hurry!
158
+ Listen to them! They’re dying, Artoo! Curse my metal body! I wasn’t fast
159
+ enough. It’s all my fault! My poor master! Threepio, we’re all right!
160
+ We’re all right. You did great.
161
+ </Box>
162
+ </StatefulCollapseWithMinHeight>
163
+ );
164
+ };
165
+
166
+ withCollapsedHeight.story = {
167
+ name: "With collapsedHeight",
168
+ };
@@ -4,9 +4,35 @@ import Box from "../Box";
4
4
 
5
5
  import type { TypeTheme } from "../types/theme.flow";
6
6
 
7
- export const CollapsingBox = styled<typeof Box, TypeTheme>(Box)`
7
+ export const CollapsingBox = styled<typeof Box, TypeTheme, *>(Box)`
8
8
  transition: max-height ${(p) => p.theme.duration.medium}
9
9
  ${(p) => p.theme.easing.ease_inout};
10
10
  will-change: max-height;
11
- overflow: hidden;
11
+ position: relative;
12
+ overflow: auto;
13
+ background: /* Shadow covers */ linear-gradient(
14
+ ${(p) => p.theme.colors.neutral[100]} 30%,
15
+ rgba(255, 255, 255, 0)
16
+ ),
17
+ linear-gradient(
18
+ rgba(255, 255, 255, 0),
19
+ ${(p) => p.theme.colors.neutral[100]} 70%
20
+ )
21
+ 0 100%,
22
+ /* Shadows */
23
+ radial-gradient(
24
+ farthest-side at 50% 0,
25
+ rgb(39 51 51 / 5%),
26
+ rgba(0, 0, 0, 0)
27
+ ),
28
+ radial-gradient(
29
+ farthest-side at 50% 100%,
30
+ rgb(39 51 51 / 5%),
31
+ rgba(0, 0, 0, 0)
32
+ )
33
+ 0 100%;
34
+ background-repeat: no-repeat;
35
+ background-size: 100% 40px, 100% 40px, 100% 14px, 100% 14px;
36
+ background-attachment: local, local, scroll, scroll;
37
+ ${({ scrollable }) => (scrollable ? `overflow: auto` : `overflow: hidden`)};
12
38
  `;
@@ -142,7 +142,7 @@ html .c5 {
142
142
  class="c1 c2"
143
143
  data-qa-button=""
144
144
  data-qa-button-isdisabled="false"
145
- id="MenuButton-8"
145
+ id="MenuButton-20"
146
146
  type="button"
147
147
  >
148
148
  Select a fruit
@@ -436,6 +436,10 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
436
436
  background-color: #364141;
437
437
  }
438
438
 
439
+ .c4 .Icon-svg {
440
+ color: #FFFFFF;
441
+ }
442
+
439
443
  .c4:focus,
440
444
  .c4:hover {
441
445
  color: #364141;
@@ -535,7 +539,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
535
539
 
536
540
  <div>
537
541
  <ul
538
- aria-activedescendant="MenuItem-16"
542
+ aria-activedescendant="MenuItem-28"
539
543
  aria-multiselectable="true"
540
544
  class="c0 c1"
541
545
  overflow="hidden"
@@ -552,7 +556,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
552
556
  class="c2 c4"
553
557
  data-qa-menu-item="Apple"
554
558
  data-value="Apple"
555
- id="MenuItem-16"
559
+ id="MenuItem-28"
556
560
  role="menuitemcheckbox"
557
561
  tabindex="-1"
558
562
  value="Apple"
@@ -565,10 +569,10 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
565
569
  class="c5"
566
570
  >
567
571
  <input
568
- data-qa-checkbox="Checkbox-MenuItem-16"
572
+ data-qa-checkbox="Checkbox-MenuItem-28"
569
573
  data-qa-checkbox-ischecked="false"
570
574
  data-qa-checkbox-isdisabled="false"
571
- id="Checkbox-MenuItem-16"
575
+ id="Checkbox-MenuItem-28"
572
576
  tabindex="-1"
573
577
  type="checkbox"
574
578
  value=""
@@ -586,7 +590,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
586
590
  class="c2 c6"
587
591
  data-qa-menu-item="Banana"
588
592
  data-value="Banana"
589
- id="MenuItem-17"
593
+ id="MenuItem-29"
590
594
  role="menuitemcheckbox"
591
595
  tabindex="-1"
592
596
  value="Banana"
@@ -599,10 +603,10 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
599
603
  class="c5"
600
604
  >
601
605
  <input
602
- data-qa-checkbox="Checkbox-MenuItem-17"
606
+ data-qa-checkbox="Checkbox-MenuItem-29"
603
607
  data-qa-checkbox-ischecked="false"
604
608
  data-qa-checkbox-isdisabled="false"
605
- id="Checkbox-MenuItem-17"
609
+ id="Checkbox-MenuItem-29"
606
610
  tabindex="-1"
607
611
  type="checkbox"
608
612
  value=""
@@ -620,7 +624,7 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
620
624
  class="c2 c6"
621
625
  data-qa-menu-item="Orange"
622
626
  data-value="Orange"
623
- id="MenuItem-18"
627
+ id="MenuItem-30"
624
628
  role="menuitemcheckbox"
625
629
  tabindex="-1"
626
630
  value="Orange"
@@ -633,10 +637,10 @@ exports[`Listbox AsListbox with checkboxes should match snapshot 1`] = `
633
637
  class="c5"
634
638
  >
635
639
  <input
636
- data-qa-checkbox="Checkbox-MenuItem-18"
640
+ data-qa-checkbox="Checkbox-MenuItem-30"
637
641
  data-qa-checkbox-ischecked="false"
638
642
  data-qa-checkbox-isdisabled="false"
639
- id="Checkbox-MenuItem-18"
643
+ id="Checkbox-MenuItem-30"
640
644
  tabindex="-1"
641
645
  type="checkbox"
642
646
  value=""
@@ -717,6 +721,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
717
721
  background-color: #364141;
718
722
  }
719
723
 
724
+ .c5 .Icon-svg {
725
+ color: #FFFFFF;
726
+ }
727
+
720
728
  .c5:focus,
721
729
  .c5:hover {
722
730
  color: #364141;
@@ -873,7 +881,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
873
881
 
874
882
  <div>
875
883
  <ul
876
- aria-activedescendant="MenuItem-22"
884
+ aria-activedescendant="MenuItem-34"
877
885
  aria-multiselectable="true"
878
886
  class="c0 c1"
879
887
  overflow="hidden"
@@ -906,7 +914,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
906
914
  class="c2 c5"
907
915
  data-qa-menu-item="Apple"
908
916
  data-value="Apple"
909
- id="MenuItem-22"
917
+ id="MenuItem-34"
910
918
  role="menuitemcheckbox"
911
919
  tabindex="-1"
912
920
  value="Apple"
@@ -919,10 +927,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
919
927
  class="c6"
920
928
  >
921
929
  <input
922
- data-qa-checkbox="Checkbox-MenuItem-22"
930
+ data-qa-checkbox="Checkbox-MenuItem-34"
923
931
  data-qa-checkbox-ischecked="false"
924
932
  data-qa-checkbox-isdisabled="false"
925
- id="Checkbox-MenuItem-22"
933
+ id="Checkbox-MenuItem-34"
926
934
  tabindex="-1"
927
935
  type="checkbox"
928
936
  value=""
@@ -940,7 +948,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
940
948
  class="c2 c7"
941
949
  data-qa-menu-item="Banana"
942
950
  data-value="Banana"
943
- id="MenuItem-23"
951
+ id="MenuItem-35"
944
952
  role="menuitemcheckbox"
945
953
  tabindex="-1"
946
954
  value="Banana"
@@ -953,10 +961,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
953
961
  class="c6"
954
962
  >
955
963
  <input
956
- data-qa-checkbox="Checkbox-MenuItem-23"
964
+ data-qa-checkbox="Checkbox-MenuItem-35"
957
965
  data-qa-checkbox-ischecked="false"
958
966
  data-qa-checkbox-isdisabled="false"
959
- id="Checkbox-MenuItem-23"
967
+ id="Checkbox-MenuItem-35"
960
968
  tabindex="-1"
961
969
  type="checkbox"
962
970
  value=""
@@ -974,7 +982,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
974
982
  class="c2 c7"
975
983
  data-qa-menu-item="Orange"
976
984
  data-value="Orange"
977
- id="MenuItem-24"
985
+ id="MenuItem-36"
978
986
  role="menuitemcheckbox"
979
987
  tabindex="-1"
980
988
  value="Orange"
@@ -987,10 +995,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
987
995
  class="c6"
988
996
  >
989
997
  <input
990
- data-qa-checkbox="Checkbox-MenuItem-24"
998
+ data-qa-checkbox="Checkbox-MenuItem-36"
991
999
  data-qa-checkbox-ischecked="false"
992
1000
  data-qa-checkbox-isdisabled="false"
993
- id="Checkbox-MenuItem-24"
1001
+ id="Checkbox-MenuItem-36"
994
1002
  tabindex="-1"
995
1003
  type="checkbox"
996
1004
  value=""
@@ -1008,7 +1016,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1008
1016
  class="c2 c7"
1009
1017
  data-qa-menu-item="Tomato"
1010
1018
  data-value="Tomato"
1011
- id="MenuItem-25"
1019
+ id="MenuItem-37"
1012
1020
  role="menuitemcheckbox"
1013
1021
  tabindex="-1"
1014
1022
  value="Tomato"
@@ -1021,10 +1029,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1021
1029
  class="c6"
1022
1030
  >
1023
1031
  <input
1024
- data-qa-checkbox="Checkbox-MenuItem-25"
1032
+ data-qa-checkbox="Checkbox-MenuItem-37"
1025
1033
  data-qa-checkbox-ischecked="false"
1026
1034
  data-qa-checkbox-isdisabled="false"
1027
- id="Checkbox-MenuItem-25"
1035
+ id="Checkbox-MenuItem-37"
1028
1036
  tabindex="-1"
1029
1037
  type="checkbox"
1030
1038
  value=""
@@ -1042,7 +1050,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1042
1050
  class="c2 c7"
1043
1051
  data-qa-menu-item="Cucumber"
1044
1052
  data-value="Cucumber"
1045
- id="MenuItem-26"
1053
+ id="MenuItem-38"
1046
1054
  role="menuitemcheckbox"
1047
1055
  tabindex="-1"
1048
1056
  value="Cucumber"
@@ -1055,10 +1063,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1055
1063
  class="c6"
1056
1064
  >
1057
1065
  <input
1058
- data-qa-checkbox="Checkbox-MenuItem-26"
1066
+ data-qa-checkbox="Checkbox-MenuItem-38"
1059
1067
  data-qa-checkbox-ischecked="false"
1060
1068
  data-qa-checkbox-isdisabled="false"
1061
- id="Checkbox-MenuItem-26"
1069
+ id="Checkbox-MenuItem-38"
1062
1070
  tabindex="-1"
1063
1071
  type="checkbox"
1064
1072
  value=""
@@ -1076,7 +1084,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1076
1084
  class="c2 c7"
1077
1085
  data-qa-menu-item="Squash"
1078
1086
  data-value="Squash"
1079
- id="MenuItem-27"
1087
+ id="MenuItem-39"
1080
1088
  role="menuitemcheckbox"
1081
1089
  tabindex="-1"
1082
1090
  value="Squash"
@@ -1089,10 +1097,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1089
1097
  class="c6"
1090
1098
  >
1091
1099
  <input
1092
- data-qa-checkbox="Checkbox-MenuItem-27"
1100
+ data-qa-checkbox="Checkbox-MenuItem-39"
1093
1101
  data-qa-checkbox-ischecked="false"
1094
1102
  data-qa-checkbox-isdisabled="false"
1095
- id="Checkbox-MenuItem-27"
1103
+ id="Checkbox-MenuItem-39"
1096
1104
  tabindex="-1"
1097
1105
  type="checkbox"
1098
1106
  value=""
@@ -1110,7 +1118,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1110
1118
  class="c2 c7"
1111
1119
  data-qa-menu-item="Cantaloupe"
1112
1120
  data-value="Cantaloupe"
1113
- id="MenuItem-28"
1121
+ id="MenuItem-40"
1114
1122
  role="menuitemcheckbox"
1115
1123
  tabindex="-1"
1116
1124
  value="Cantaloupe"
@@ -1123,10 +1131,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1123
1131
  class="c6"
1124
1132
  >
1125
1133
  <input
1126
- data-qa-checkbox="Checkbox-MenuItem-28"
1134
+ data-qa-checkbox="Checkbox-MenuItem-40"
1127
1135
  data-qa-checkbox-ischecked="false"
1128
1136
  data-qa-checkbox-isdisabled="false"
1129
- id="Checkbox-MenuItem-28"
1137
+ id="Checkbox-MenuItem-40"
1130
1138
  tabindex="-1"
1131
1139
  type="checkbox"
1132
1140
  value=""
@@ -1144,7 +1152,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1144
1152
  class="c2 c7"
1145
1153
  data-qa-menu-item="Jackalope"
1146
1154
  data-value="Jackalope"
1147
- id="MenuItem-29"
1155
+ id="MenuItem-41"
1148
1156
  role="menuitemcheckbox"
1149
1157
  tabindex="-1"
1150
1158
  value="Jackalope"
@@ -1157,10 +1165,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1157
1165
  class="c6"
1158
1166
  >
1159
1167
  <input
1160
- data-qa-checkbox="Checkbox-MenuItem-29"
1168
+ data-qa-checkbox="Checkbox-MenuItem-41"
1161
1169
  data-qa-checkbox-ischecked="false"
1162
1170
  data-qa-checkbox-isdisabled="false"
1163
- id="Checkbox-MenuItem-29"
1171
+ id="Checkbox-MenuItem-41"
1164
1172
  tabindex="-1"
1165
1173
  type="checkbox"
1166
1174
  value=""
@@ -1178,7 +1186,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1178
1186
  class="c2 c7"
1179
1187
  data-qa-menu-item="Lingonberry"
1180
1188
  data-value="Lingonberry"
1181
- id="MenuItem-30"
1189
+ id="MenuItem-42"
1182
1190
  role="menuitemcheckbox"
1183
1191
  tabindex="-1"
1184
1192
  value="Lingonberry"
@@ -1191,10 +1199,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1191
1199
  class="c6"
1192
1200
  >
1193
1201
  <input
1194
- data-qa-checkbox="Checkbox-MenuItem-30"
1202
+ data-qa-checkbox="Checkbox-MenuItem-42"
1195
1203
  data-qa-checkbox-ischecked="false"
1196
1204
  data-qa-checkbox-isdisabled="false"
1197
- id="Checkbox-MenuItem-30"
1205
+ id="Checkbox-MenuItem-42"
1198
1206
  tabindex="-1"
1199
1207
  type="checkbox"
1200
1208
  value=""
@@ -1212,7 +1220,7 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1212
1220
  class="c2 c7"
1213
1221
  data-qa-menu-item="Dingleberry"
1214
1222
  data-value="Dingleberry"
1215
- id="MenuItem-31"
1223
+ id="MenuItem-43"
1216
1224
  role="menuitemcheckbox"
1217
1225
  tabindex="-1"
1218
1226
  value="Dingleberry"
@@ -1225,10 +1233,10 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1225
1233
  class="c6"
1226
1234
  >
1227
1235
  <input
1228
- data-qa-checkbox="Checkbox-MenuItem-31"
1236
+ data-qa-checkbox="Checkbox-MenuItem-43"
1229
1237
  data-qa-checkbox-ischecked="false"
1230
1238
  data-qa-checkbox-isdisabled="false"
1231
- id="Checkbox-MenuItem-31"
1239
+ id="Checkbox-MenuItem-43"
1232
1240
  tabindex="-1"
1233
1241
  type="checkbox"
1234
1242
  value=""
@@ -1241,6 +1249,40 @@ exports[`Listbox AsListbox with filter input should match snapshot 1`] = `
1241
1249
  </div>
1242
1250
  </div>
1243
1251
  </li>
1252
+ <li
1253
+ aria-checked="false"
1254
+ class="c2 c7"
1255
+ data-qa-menu-item="Kaffir Lime"
1256
+ data-value="Kaffir Lime"
1257
+ id="MenuItem-44"
1258
+ role="menuitemcheckbox"
1259
+ tabindex="-1"
1260
+ value="Kaffir Lime"
1261
+ >
1262
+ <div
1263
+ style="display: flex; align-items: center; justify-content: space-between;"
1264
+ >
1265
+ <span
1266
+ aria-hidden="true"
1267
+ class="c6"
1268
+ >
1269
+ <input
1270
+ data-qa-checkbox="Checkbox-MenuItem-44"
1271
+ data-qa-checkbox-ischecked="false"
1272
+ data-qa-checkbox-isdisabled="false"
1273
+ id="Checkbox-MenuItem-44"
1274
+ tabindex="-1"
1275
+ type="checkbox"
1276
+ value=""
1277
+ />
1278
+ </span>
1279
+ <div
1280
+ style="flex-grow: 1; word-break: break-word; min-width: 0;"
1281
+ >
1282
+ Kaffir Lime
1283
+ </div>
1284
+ </div>
1285
+ </li>
1244
1286
  </div>
1245
1287
  </ul>
1246
1288
  </div>
@@ -196,3 +196,36 @@ export const BigVirtualizedExample = () => {
196
196
  </Box>
197
197
  );
198
198
  };
199
+
200
+ const ListboxFilterInput = () => {
201
+ const { value, onChange } = useSelect({ initialValue: null });
202
+ const { inputValue } = useSelect({ initialValue: null });
203
+ return (
204
+ <>
205
+ <Text>{inputValue}</Text>
206
+ <ListboxButton
207
+ minWidth="200px"
208
+ aria-label="Favorite fruit"
209
+ content={
210
+ <Listbox onChange={onChange} value={value} width="200px">
211
+ <Listbox.Group>
212
+ <Listbox.FilterInput placeholder="Filter items" mb={300} />
213
+ <Listbox.Item value="Apple">Apple</Listbox.Item>
214
+ <Listbox.Item value="Orange">Orange</Listbox.Item>
215
+ <Listbox.Item value="Banana">Banana</Listbox.Item>
216
+ <Listbox.Item value="Kaffir Lime">Kaffir Lime</Listbox.Item>
217
+ </Listbox.Group>
218
+ </Listbox>
219
+ }
220
+ >
221
+ {value || "Select a fruit"}
222
+ </ListboxButton>
223
+ </>
224
+ );
225
+ };
226
+
227
+ export const FilterInput = () => <ListboxFilterInput />;
228
+
229
+ FilterInput.story = {
230
+ name: "FilterInput",
231
+ };