playbook_ui 14.5.0.pre.alpha.PBNTR568dropdowncleaning4041 → 14.5.0.pre.alpha.PBNTR600reactfilterdisplayzeroresults4068

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7276cf8a18d6ba899d40091f3a8cee38bc28a154cecf9f7390da283daac0e44a
4
- data.tar.gz: f99c6b2f4ad8580b33b64b91888f20dafdd7df7603cd44a26c6803f6f2bf505a
3
+ metadata.gz: 1315703b951ec18c52f143275d8fcce5219cd6cab284b284be92584ffe64adb5
4
+ data.tar.gz: a8ec02f07ec4a6e857e855b712f659c539410232cb4d8515ae99566e3c1d39f3
5
5
  SHA512:
6
- metadata.gz: a5dcbd59b747abf89a5959410e6fe2cf8feab4032ef31cff0b19a46c3ceaf27bb4fbec97882ed421ddf4069bbcaeeb668a56b343b635372d70bf07376d4d473f
7
- data.tar.gz: 44bf8232614c890c34d265cd1bee21eed7967aadaede86121c594ad3d7531dd29647c2c6c72c6bc67d743fb5c9b8f613c6f38185883c0c5fb3c8f6e0e1607928
6
+ metadata.gz: 947391921569c72c01d30a6819ab580140bea82df5bc6f83a8e3426ea1561a07e6178574a8c3df62c820818eb98f792aa7eb0cab223ec837f420f44ec1adb29e
7
+ data.tar.gz: c33a5d61b41a9fb8c57538234484a37e3bc08c8dbc161f727ec8fa9ba5fcbc0f1e9615bb4c53f844561c89e1ce03a4d64064a6d9e00fb54ba72138dadfc507d8
@@ -1,4 +1,4 @@
1
- import React, { useState, useRef, useEffect, forwardRef, useImperativeHandle } from "react";
1
+ import React, { useState, useRef, useEffect } from "react";
2
2
  import classnames from "classnames";
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../utilities/props";
4
4
  import { globalProps } from "../utilities/globalProps";
@@ -38,14 +38,7 @@ type DropdownProps = {
38
38
  triggerRef?: any;
39
39
  };
40
40
 
41
- interface DropdownComponent
42
- extends React.ForwardRefExoticComponent<DropdownProps & React.RefAttributes<unknown>> {
43
- Option: typeof DropdownOption;
44
- Trigger: typeof DropdownTrigger;
45
- Container: typeof DropdownContainer;
46
- }
47
-
48
- const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
41
+ const Dropdown = (props: DropdownProps) => {
49
42
  const {
50
43
  aria = {},
51
44
  autocomplete = false,
@@ -132,7 +125,7 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
132
125
  const filteredOptions = optionsWithBlankSelection?.filter((option: GenericObject) => {
133
126
  const label = typeof option.label === 'string' ? option.label.toLowerCase() : option.label;
134
127
  return String(label).toLowerCase().includes(filterItem.toLowerCase());
135
- });
128
+ });
136
129
 
137
130
  // For keyboard accessibility: Set focus within dropdown to selected item if it exists
138
131
  useEffect(() => {
@@ -182,14 +175,6 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
182
175
  dark
183
176
  });
184
177
 
185
- useImperativeHandle(ref, () => ({
186
- clearSelected: () => {
187
- setSelected({});
188
- setFilterItem("");
189
- setIsDropDownClosed(true);
190
- onSelect && onSelect(null);
191
- },
192
- }));
193
178
 
194
179
  return (
195
180
  <div {...ariaProps}
@@ -273,9 +258,8 @@ const Dropdown = forwardRef((props: DropdownProps, ref: any) => {
273
258
  </DropdownContext.Provider>
274
259
  </div>
275
260
  )
276
- }) as DropdownComponent
261
+ };
277
262
 
278
- Dropdown.displayName = "Dropdown";
279
263
  Dropdown.Option = DropdownOption;
280
264
  Dropdown.Trigger = DropdownTrigger;
281
265
  Dropdown.Container = DropdownContainer;
@@ -22,7 +22,6 @@ examples:
22
22
  - dropdown_error: Dropdown with Error
23
23
  - dropdown_default_value: Default Value
24
24
  - dropdown_blank_selection: Blank Selection
25
- - dropdown_clear_selection: Clear Selection
26
25
  # - dropdown_with_autocomplete: Autocomplete
27
26
  # - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
28
27
  # - dropdown_with_external_control: useDropdown Hook
@@ -12,4 +12,3 @@ export { default as DropdownSubcomponentStructure } from './_dropdown_subcompone
12
12
  export { default as DropdownError } from './_dropdown_error.jsx'
13
13
  export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
14
14
  export { default as DropdownBlankSelection } from './_dropdown_blank_selection.jsx'
15
- export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
@@ -13,6 +13,7 @@ type ResultsCountProps = {
13
13
  const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactElement => {
14
14
 
15
15
  const resultTitle = () => {
16
+ if (results == null) return null
16
17
  return (
17
18
  <TitleCount
18
19
  align="center"
@@ -24,6 +25,7 @@ const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactE
24
25
  }
25
26
 
26
27
  const justResults = () => {
28
+ if (results == null) return null
27
29
  return (
28
30
  <Caption
29
31
  className="filter-results"
@@ -35,13 +37,13 @@ const ResultsCount = ({ dark, results, title }: ResultsCountProps): React.ReactE
35
37
  }
36
38
 
37
39
  const displayResultsCount = () => {
38
- if (results && title) {
40
+ if (results != null && results >=0 && title) {
39
41
  return (
40
42
  <>
41
43
  {resultTitle()}
42
44
  </>
43
45
  )
44
- } else if (results) {
46
+ } else if (results !=null && results >=0 ) {
45
47
  return (
46
48
  <>
47
49
  {justResults()}
@@ -78,7 +78,7 @@ const FilterDefault = (props) => {
78
78
  double
79
79
  minWidth="375px"
80
80
  onSortChange={SortingChangeCallback}
81
- results={1}
81
+ results={0}
82
82
  sortOptions={{
83
83
  popularity: 'Popularity',
84
84
  // eslint-disable-next-line