playbook_ui 14.5.0.pre.alpha.PBNTR568dropdowncleaning4044 → 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 +4 -4
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +4 -20
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +1 -1
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +2 -2
- data/app/pb_kits/playbook/pb_filter/Filter/ResultsCount.tsx +4 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +1 -1
- data/dist/chunks/{_weekday_stacked-BTS5z219.js → _weekday_stacked-BFqyoTft.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +2 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_clear_selection.jsx +0 -45
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1315703b951ec18c52f143275d8fcce5219cd6cab284b284be92584ffe64adb5
|
4
|
+
data.tar.gz: a8ec02f07ec4a6e857e855b712f659c539410232cb4d8515ae99566e3c1d39f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 947391921569c72c01d30a6819ab580140bea82df5bc6f83a8e3426ea1561a07e6178574a8c3df62c820818eb98f792aa7eb0cab223ec837f420f44ec1adb29e
|
7
|
+
data.tar.gz: c33a5d61b41a9fb8c57538234484a37e3bc08c8dbc161f727ec8fa9ba5fcbc0f1e9615bb4c53f844561c89e1ce03a4d64064a6d9e00fb54ba72138dadfc507d8
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useRef, useEffect
|
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
|
-
|
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
|
-
}
|
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'
|
@@ -73,7 +73,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
73
73
|
!autocomplete && "select_only"
|
74
74
|
);
|
75
75
|
|
76
|
-
const customDisplayPlaceholder = selected
|
76
|
+
const customDisplayPlaceholder = selected.label ? (
|
77
77
|
<b>{selected.label}</b>
|
78
78
|
) : autocomplete ? (
|
79
79
|
""
|
@@ -83,7 +83,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
83
83
|
"Select..."
|
84
84
|
);
|
85
85
|
|
86
|
-
const defaultDisplayPlaceholder = selected
|
86
|
+
const defaultDisplayPlaceholder = selected.label
|
87
87
|
? selected.label
|
88
88
|
: autocomplete
|
89
89
|
? ""
|
@@ -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()}
|