playbook_ui 16.1.0.pre.alpha.play2771passphraseaccessibility14033 → 16.1.0.pre.alpha.play264213817
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_card/docs/_card_light.html.erb +35 -3
- data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +5 -14
- data/app/pb_kits/playbook/pb_dialog/_dialog.scss +6 -8
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -6
- data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +2 -37
- data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +0 -6
- data/app/pb_kits/playbook/pb_dropdown/docs/index.js +1 -4
- data/app/pb_kits/playbook/pb_dropdown/dropdown.html.erb +2 -2
- data/app/pb_kits/playbook/pb_dropdown/dropdown.rb +0 -6
- data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +0 -94
- data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +1 -5
- data/app/pb_kits/playbook/pb_dropdown/index.js +4 -59
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownContainer.tsx +0 -3
- data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownTrigger.tsx +1 -2
- data/app/pb_kits/playbook/pb_filter/Filter/SortMenu.tsx +1 -1
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
- data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +9 -16
- data/app/pb_kits/playbook/pb_filter/filter.rb +2 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +0 -2
- data/app/pb_kits/playbook/pb_form/pb_form_validation.js +2 -9
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
- data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
- data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +0 -4
- data/app/pb_kits/playbook/pb_passphrase/_passphrase.tsx +7 -40
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +0 -1
- data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_passphrase/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_passphrase/passphrase.rb +0 -2
- data/app/pb_kits/playbook/pb_passphrase/passphrase.test.jsx +1 -30
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.test.js +3 -34
- data/app/pb_kits/playbook/pb_textarea/_textarea.tsx +0 -10
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +0 -3
- data/app/pb_kits/playbook/pb_textarea/textarea.html.erb +9 -25
- data/app/pb_kits/playbook/pb_textarea/textarea.rb +1 -7
- data/app/pb_kits/playbook/pb_time_picker/_time_picker.tsx +11 -97
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +2 -5
- data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_time_picker/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_time_picker/time_picker.rb +0 -3
- data/app/pb_kits/playbook/pb_time_picker/time_picker.test.jsx +1 -47
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.test.jsx +1 -24
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +1 -2
- data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +1 -4
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
- data/dist/chunks/_typeahead-B9a6ZsEP.js +1 -0
- data/dist/chunks/vendor.js +3 -3
- data/dist/menu.yml +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/forms/builder/phone_number_field.rb +0 -9
- data/lib/playbook/truncate.rb +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +3 -26
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +0 -1
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +0 -3
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +0 -52
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +0 -72
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +0 -5
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +0 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +0 -20
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +0 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +0 -8
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +0 -9
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +0 -33
- data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +0 -3
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +0 -7
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +0 -24
- data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +0 -5
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +0 -14
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +0 -3
- data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +0 -1
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +0 -6
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +0 -16
- data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +0 -3
- data/dist/chunks/_typeahead-D-8xZ__X.js +0 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 60b41dbbb195e70b9104ae56ec68ad19fb488444096838262600e95bbe239642
|
|
4
|
+
data.tar.gz: 6d634ec91b1f185be3d7e47e6c88eeab8e545831336742e5661f5066a628e274
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: dd16edcd3a1830e2736636eb7f254099c46fe7130e6ef42fd0bb35a17a1e6967f84be79ec23761183e615bdbe0c242b890d30670ef993a3382dbf62c349cc864
|
|
7
|
+
data.tar.gz: 377d852a602c33c7067b566a1fc838a61836516add1396a720269dd31e28aa370aa8ca400b913b6905c50443a45bf0e6cc9d84951480f09cf7b469e09d04f86c
|
|
@@ -1,4 +1,36 @@
|
|
|
1
|
-
<%= pb_rails("
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
<%= pb_rails("flex", props: {
|
|
2
|
+
gap: "md",
|
|
3
|
+
orientation: "column"
|
|
4
|
+
}) do %>
|
|
5
|
+
|
|
6
|
+
<%= pb_rails("caption", props: { text: "flex direction responsive: row on md + xl, column as default" }) %>
|
|
7
|
+
<%= pb_rails("card", props: {
|
|
8
|
+
flex_direction: { default: "column", md: "row", xl:"row" }
|
|
9
|
+
}) do %>
|
|
10
|
+
<%= pb_rails("body", props: { text: "Item 1", color: "default" }) %>
|
|
11
|
+
<%= pb_rails("body", props: { text: "Item 2", color: "default" }) %>
|
|
12
|
+
<%= pb_rails("body", props: { text: "Item 3", color: "default" }) %>
|
|
13
|
+
<% end %>
|
|
14
|
+
|
|
15
|
+
<%= pb_rails("caption", props: { text: "align items responsive: start on default, center on md, end on lg" }) %>
|
|
16
|
+
<%= pb_rails("card", props: {
|
|
17
|
+
display: "flex",
|
|
18
|
+
flex_direction: "row",
|
|
19
|
+
align_items: { default: "start", md: "center", lg: "end" },
|
|
20
|
+
}) do %>
|
|
21
|
+
<%= pb_rails("card", props: {height:"xs" }) do %> Card 1 <% end %>
|
|
22
|
+
<%= pb_rails("card", props: { height:"sm" }) do %> Card 2 <% end %>
|
|
23
|
+
<%= pb_rails("card", props: { height:"xs" }) do %> Card 3 <% end %>
|
|
24
|
+
<% end %>
|
|
25
|
+
|
|
26
|
+
<%= pb_rails("caption", props: { text: "Text Align responsive: left on default, center on md, right on lg" }) %>
|
|
27
|
+
<%= pb_rails("card", props: {
|
|
28
|
+
text_align: { default: "left", md: "center", lg: "right" },
|
|
29
|
+
width: "100%"
|
|
30
|
+
}) do %>
|
|
31
|
+
<%= pb_rails("body", props: { }) do %> text 1 <% end %>
|
|
32
|
+
<%= pb_rails("body", props: { }) do %> text 2 <% end %>
|
|
33
|
+
<%= pb_rails("body", props: { }) do %> text 3 <% end %>
|
|
34
|
+
<% end %>
|
|
4
35
|
<% end %>
|
|
36
|
+
|
|
@@ -40,7 +40,7 @@ type DatePickerProps = {
|
|
|
40
40
|
maxDate: string,
|
|
41
41
|
minDate: string,
|
|
42
42
|
name: string,
|
|
43
|
-
pickerId
|
|
43
|
+
pickerId?: string,
|
|
44
44
|
placeholder?: string,
|
|
45
45
|
positionElement?: HTMLElement | null,
|
|
46
46
|
scrollContainer?: string,
|
|
@@ -196,8 +196,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
|
196
196
|
|
|
197
197
|
const angleDown = getAllIcons()["angleDown"].icon as unknown as { [key: string]: SVGElement }
|
|
198
198
|
|
|
199
|
-
const errorId = error ? `${pickerId}-error` : undefined
|
|
200
|
-
|
|
201
199
|
return (
|
|
202
200
|
<div
|
|
203
201
|
{...ariaProps}
|
|
@@ -213,18 +211,14 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
|
213
211
|
>
|
|
214
212
|
|
|
215
213
|
{!hideLabel && (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
/>
|
|
221
|
-
</label>
|
|
214
|
+
<Caption
|
|
215
|
+
className="pb_date_picker_kit_label"
|
|
216
|
+
text={label}
|
|
217
|
+
/>
|
|
222
218
|
)}
|
|
223
219
|
<>
|
|
224
220
|
<div className="date_picker_input_wrapper">
|
|
225
221
|
<input
|
|
226
|
-
aria-describedby={errorId}
|
|
227
|
-
aria-invalid={!!error}
|
|
228
222
|
autoComplete="off"
|
|
229
223
|
className="date_picker_input"
|
|
230
224
|
disabled={disableInput}
|
|
@@ -238,9 +232,6 @@ const DatePicker = (props: DatePickerProps): React.ReactElement => {
|
|
|
238
232
|
|
|
239
233
|
{error &&
|
|
240
234
|
<Body
|
|
241
|
-
aria={{ atomic: "true", live: "polite" }}
|
|
242
|
-
htmlOptions={{ role: "alert" }}
|
|
243
|
-
id={errorId}
|
|
244
235
|
status="negative"
|
|
245
236
|
text={error}
|
|
246
237
|
variant={null}
|
|
@@ -135,8 +135,6 @@
|
|
|
135
135
|
position: sticky;
|
|
136
136
|
top: 0;
|
|
137
137
|
background-color: $white;
|
|
138
|
-
border-top-left-radius: $border_radius_md;
|
|
139
|
-
border-top-right-radius: $border_radius_md;
|
|
140
138
|
z-index: $z_8;
|
|
141
139
|
}
|
|
142
140
|
|
|
@@ -258,7 +256,7 @@
|
|
|
258
256
|
}
|
|
259
257
|
&.full_height_left {
|
|
260
258
|
justify-content: flex-start;
|
|
261
|
-
|
|
259
|
+
|
|
262
260
|
.pb_dialog {
|
|
263
261
|
border-radius: 0;
|
|
264
262
|
height: 100%;
|
|
@@ -304,7 +302,7 @@
|
|
|
304
302
|
|
|
305
303
|
&.full_height_center {
|
|
306
304
|
justify-content: center;
|
|
307
|
-
|
|
305
|
+
|
|
308
306
|
.pb_dialog {
|
|
309
307
|
border-radius: 0;
|
|
310
308
|
height: 100%;
|
|
@@ -348,7 +346,7 @@
|
|
|
348
346
|
|
|
349
347
|
&.full_height_right {
|
|
350
348
|
justify-content: flex-end;
|
|
351
|
-
|
|
349
|
+
|
|
352
350
|
.pb_dialog {
|
|
353
351
|
border-radius: 0;
|
|
354
352
|
height: 100%;
|
|
@@ -419,7 +417,7 @@
|
|
|
419
417
|
margin: unset !important;
|
|
420
418
|
margin-right: auto !important;
|
|
421
419
|
}
|
|
422
|
-
|
|
420
|
+
|
|
423
421
|
.pb_dialog {
|
|
424
422
|
border-radius: 0;
|
|
425
423
|
height: 100% !important;
|
|
@@ -465,7 +463,7 @@
|
|
|
465
463
|
|
|
466
464
|
&.full_height_center {
|
|
467
465
|
justify-content: center;
|
|
468
|
-
|
|
466
|
+
|
|
469
467
|
.pb_dialog {
|
|
470
468
|
border-radius: 0;
|
|
471
469
|
height: 100% !important;
|
|
@@ -512,7 +510,7 @@
|
|
|
512
510
|
margin: unset !important;
|
|
513
511
|
margin-left: auto !important;
|
|
514
512
|
}
|
|
515
|
-
|
|
513
|
+
|
|
516
514
|
.pb_dialog {
|
|
517
515
|
border-radius: 0;
|
|
518
516
|
height: 100% !important;
|
|
@@ -36,8 +36,6 @@ type DropdownProps = {
|
|
|
36
36
|
blankSelection?: string;
|
|
37
37
|
children?: React.ReactChild[] | React.ReactChild | React.ReactElement[];
|
|
38
38
|
className?: string;
|
|
39
|
-
clearable?: boolean;
|
|
40
|
-
constrainHeight?: boolean;
|
|
41
39
|
customQuickPickDates?: CustomQuickPickDates;
|
|
42
40
|
formPillProps?: GenericObject;
|
|
43
41
|
dark?: boolean;
|
|
@@ -51,7 +49,6 @@ type DropdownProps = {
|
|
|
51
49
|
multiSelect?: boolean;
|
|
52
50
|
onSelect?: (arg: GenericObject) => null;
|
|
53
51
|
options?: GenericObject;
|
|
54
|
-
placeholder?: string;
|
|
55
52
|
separators?: boolean;
|
|
56
53
|
variant?: "default" | "subtle" | "quickpick";
|
|
57
54
|
rangeEndsToday?: boolean;
|
|
@@ -77,8 +74,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
77
74
|
blankSelection = '',
|
|
78
75
|
children,
|
|
79
76
|
className,
|
|
80
|
-
clearable = true,
|
|
81
|
-
constrainHeight = false,
|
|
82
77
|
customQuickPickDates,
|
|
83
78
|
dark = false,
|
|
84
79
|
data = {},
|
|
@@ -92,7 +87,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
92
87
|
formPillProps,
|
|
93
88
|
onSelect,
|
|
94
89
|
options,
|
|
95
|
-
placeholder,
|
|
96
90
|
rangeEndsToday = false,
|
|
97
91
|
controlsStartId,
|
|
98
92
|
controlsEndId,
|
|
@@ -217,34 +211,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
217
211
|
}
|
|
218
212
|
}, [isDropDownClosed]);
|
|
219
213
|
|
|
220
|
-
// Auto-position dropdown above/below based on available space
|
|
221
|
-
useEffect(() => {
|
|
222
|
-
if (!isDropDownClosed && dropdownContainerRef.current) {
|
|
223
|
-
const container = dropdownContainerRef.current;
|
|
224
|
-
const wrapper = container.closest('.dropdown_wrapper') as HTMLElement;
|
|
225
|
-
if (!wrapper) return;
|
|
226
|
-
|
|
227
|
-
const wrapperRect = wrapper.getBoundingClientRect();
|
|
228
|
-
const h = container.getBoundingClientRect().height || container.scrollHeight;
|
|
229
|
-
const spaceBelow = window.innerHeight - wrapperRect.bottom;
|
|
230
|
-
const spaceAbove = wrapperRect.top;
|
|
231
|
-
|
|
232
|
-
// If not enough space below but enough space above, position above
|
|
233
|
-
if (spaceBelow < h + 10 && spaceAbove >= h + 10) {
|
|
234
|
-
container.style.top = "auto";
|
|
235
|
-
container.style.bottom = "calc(100% + 5px)";
|
|
236
|
-
container.style.marginTop = "0";
|
|
237
|
-
container.style.marginBottom = "0";
|
|
238
|
-
} else {
|
|
239
|
-
// Default: position below
|
|
240
|
-
container.style.top = "";
|
|
241
|
-
container.style.bottom = "";
|
|
242
|
-
container.style.marginTop = "";
|
|
243
|
-
container.style.marginBottom = "";
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
}, [isDropDownClosed, dropdownContainerRef]);
|
|
247
|
-
|
|
248
214
|
|
|
249
215
|
const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
|
|
250
216
|
setFilterItem(e.target.value);
|
|
@@ -409,7 +375,6 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
409
375
|
value={{
|
|
410
376
|
activeStyle,
|
|
411
377
|
autocomplete,
|
|
412
|
-
clearable,
|
|
413
378
|
dropdownContainerRef,
|
|
414
379
|
filteredOptions,
|
|
415
380
|
filterItem,
|
|
@@ -461,8 +426,8 @@ let Dropdown = (props: DropdownProps, ref: any): React.ReactElement | null => {
|
|
|
461
426
|
</>
|
|
462
427
|
) : (
|
|
463
428
|
<>
|
|
464
|
-
<DropdownTrigger
|
|
465
|
-
<DropdownContainer
|
|
429
|
+
<DropdownTrigger />
|
|
430
|
+
<DropdownContainer>
|
|
466
431
|
{optionsWithBlankSelection &&
|
|
467
432
|
optionsWithBlankSelection?.map((option: GenericObject) => (
|
|
468
433
|
<DropdownOption key={option.id}
|
|
@@ -21,10 +21,7 @@ examples:
|
|
|
21
21
|
- dropdown_default_value: Default Value
|
|
22
22
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
|
23
23
|
- dropdown_blank_selection: Blank Selection
|
|
24
|
-
- dropdown_with_placeholder: Placeholder
|
|
25
24
|
- dropdown_separators_hidden: Separators Hidden
|
|
26
|
-
- dropdown_with_clearable: Clearable
|
|
27
|
-
- dropdown_with_constrain_height_rails: Constrain Height
|
|
28
25
|
- dropdown_quickpick_rails: Quick Pick Variant
|
|
29
26
|
- dropdown_quickpick_range_end_rails: Quick Pick Variant (Range Ends Today)
|
|
30
27
|
- dropdown_quickpick_default_dates: Quick Pick Variant (Default Dates)
|
|
@@ -55,10 +52,7 @@ examples:
|
|
|
55
52
|
- dropdown_default_value: Default Value
|
|
56
53
|
- dropdown_multi_select_with_default: Multi Select Default Value
|
|
57
54
|
- dropdown_blank_selection: Blank Selection
|
|
58
|
-
- dropdown_with_placeholder: Placeholder
|
|
59
55
|
- dropdown_clear_selection: Clear Selection
|
|
60
|
-
- dropdown_with_clearable: Clearable
|
|
61
|
-
- dropdown_with_constrain_height: Constrain Height
|
|
62
56
|
- dropdown_separators_hidden: Separators Hidden
|
|
63
57
|
- dropdown_with_external_control: useDropdown Hook
|
|
64
58
|
- dropdown_quickpick: Quick Pick Variant
|
|
@@ -11,7 +11,6 @@ export { default as DropdownSubcomponentStructure } from './_dropdown_subcompone
|
|
|
11
11
|
export { default as DropdownError } from './_dropdown_error.jsx'
|
|
12
12
|
export { default as DropdownDefaultValue } from './_dropdown_default_value.jsx'
|
|
13
13
|
export { default as DropdownBlankSelection } from './_dropdown_blank_selection.jsx'
|
|
14
|
-
export { default as DropdownWithPlaceholder } from './_dropdown_with_placeholder.jsx'
|
|
15
14
|
export { default as DropdownClearSelection } from './_dropdown_clear_selection.jsx'
|
|
16
15
|
export { default as DropdownSubtleVariant } from './_dropdown_subtle_variant.jsx'
|
|
17
16
|
export { default as DropdownSeparatorsHidden } from './_dropdown_separators_hidden.jsx'
|
|
@@ -28,6 +27,4 @@ export { default as DropdownQuickpick } from './_dropdown_quickpick.jsx'
|
|
|
28
27
|
export { default as DropdownQuickpickRangeEnd } from './_dropdown_quickpick_range_end.jsx'
|
|
29
28
|
export { default as DropdownQuickpickDefaultDates } from './_dropdown_quickpick_default_dates.jsx'
|
|
30
29
|
export { default as DropdownQuickpickWithDatePickers } from './_dropdown_quickpick_with_date_pickers.jsx'
|
|
31
|
-
export { default as DropdownQuickpickCustom } from './_dropdown_quickpick_custom.jsx'
|
|
32
|
-
export { default as DropdownWithClearable } from './_dropdown_with_clearable.jsx'
|
|
33
|
-
export { default as DropdownWithConstrainHeight } from './_dropdown_with_constrain_height.jsx'
|
|
30
|
+
export { default as DropdownQuickpickCustom } from './_dropdown_quickpick_custom.jsx'
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
<%= content.presence %>
|
|
19
19
|
<%= pb_rails("body", props: { status: "negative", text: object.error }) %>
|
|
20
20
|
<% else %>
|
|
21
|
-
<%= pb_rails("dropdown/dropdown_trigger", props:{ autocomplete: object.autocomplete, multi_select:object.multi_select
|
|
22
|
-
<%= pb_rails("dropdown/dropdown_container", props: { searchbar: object.searchbar
|
|
21
|
+
<%= pb_rails("dropdown/dropdown_trigger", props:{ autocomplete: object.autocomplete, multi_select:object.multi_select }) %>
|
|
22
|
+
<%= pb_rails("dropdown/dropdown_container", props: { searchbar: object.searchbar }) do %>
|
|
23
23
|
<% if options_with_blank.present? %>
|
|
24
24
|
<% options_with_blank.each do |option| %>
|
|
25
25
|
<%= pb_rails("dropdown/dropdown_option", props: {option: option}) %>
|
|
@@ -36,8 +36,6 @@ module Playbook
|
|
|
36
36
|
default: ""
|
|
37
37
|
prop :controls_start_id, type: Playbook::Props::String,
|
|
38
38
|
default: ""
|
|
39
|
-
prop :clearable, type: Playbook::Props::Boolean,
|
|
40
|
-
default: true
|
|
41
39
|
prop :start_date_id, type: Playbook::Props::String,
|
|
42
40
|
default: "start_date_id"
|
|
43
41
|
prop :start_date_name, type: Playbook::Props::String,
|
|
@@ -46,16 +44,12 @@ module Playbook
|
|
|
46
44
|
default: "end_date_id"
|
|
47
45
|
prop :end_date_name, type: Playbook::Props::String,
|
|
48
46
|
default: "end_date_name"
|
|
49
|
-
prop :placeholder, type: Playbook::Props::String
|
|
50
|
-
prop :constrain_height, type: Playbook::Props::Boolean,
|
|
51
|
-
default: false
|
|
52
47
|
|
|
53
48
|
def data
|
|
54
49
|
Hash(prop(:data)).merge(
|
|
55
50
|
pb_dropdown: true,
|
|
56
51
|
pb_dropdown_multi_select: multi_select,
|
|
57
52
|
pb_dropdown_variant: variant,
|
|
58
|
-
pb_dropdown_clearable: clearable,
|
|
59
53
|
form_pill_props: form_pill_props.to_json,
|
|
60
54
|
start_date_id: variant == "quickpick" ? start_date_id : nil,
|
|
61
55
|
end_date_id: variant == "quickpick" ? end_date_id : nil,
|
|
@@ -122,80 +122,6 @@ test('generated placeholder prop', () => {
|
|
|
122
122
|
|
|
123
123
|
})
|
|
124
124
|
|
|
125
|
-
test('placeholder prop passed directly to Dropdown', () => {
|
|
126
|
-
render(
|
|
127
|
-
<Dropdown
|
|
128
|
-
data={{ testid: testId }}
|
|
129
|
-
options={options}
|
|
130
|
-
placeholder="Choose a country"
|
|
131
|
-
/>
|
|
132
|
-
)
|
|
133
|
-
|
|
134
|
-
const kit = screen.getByTestId(testId)
|
|
135
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
136
|
-
expect(trigger).toHaveTextContent('Choose a country')
|
|
137
|
-
})
|
|
138
|
-
|
|
139
|
-
test('placeholder works with default variant', () => {
|
|
140
|
-
render(
|
|
141
|
-
<Dropdown
|
|
142
|
-
data={{ testid: testId }}
|
|
143
|
-
options={options}
|
|
144
|
-
placeholder="Select an option"
|
|
145
|
-
variant="default"
|
|
146
|
-
/>
|
|
147
|
-
)
|
|
148
|
-
|
|
149
|
-
const kit = screen.getByTestId(testId)
|
|
150
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
151
|
-
expect(trigger).toHaveTextContent('Select an option')
|
|
152
|
-
})
|
|
153
|
-
|
|
154
|
-
test('placeholder works with subtle variant', () => {
|
|
155
|
-
render(
|
|
156
|
-
<Dropdown
|
|
157
|
-
data={{ testid: testId }}
|
|
158
|
-
options={options}
|
|
159
|
-
placeholder="Pick an option"
|
|
160
|
-
separators={false}
|
|
161
|
-
variant="subtle"
|
|
162
|
-
/>
|
|
163
|
-
)
|
|
164
|
-
|
|
165
|
-
const kit = screen.getByTestId(testId)
|
|
166
|
-
expect(kit).toHaveClass('pb_dropdown_subtle_separators_hidden')
|
|
167
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
168
|
-
expect(trigger).toHaveTextContent('Pick an option')
|
|
169
|
-
})
|
|
170
|
-
|
|
171
|
-
test('placeholder works with quickpick variant', () => {
|
|
172
|
-
render(
|
|
173
|
-
<Dropdown
|
|
174
|
-
data={{ testid: testId }}
|
|
175
|
-
placeholder="Select a date range"
|
|
176
|
-
variant="quickpick"
|
|
177
|
-
/>
|
|
178
|
-
)
|
|
179
|
-
|
|
180
|
-
const kit = screen.getByTestId(testId)
|
|
181
|
-
expect(kit).toHaveClass('pb_dropdown_quickpick')
|
|
182
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
183
|
-
expect(trigger).toHaveTextContent('Select a date range')
|
|
184
|
-
})
|
|
185
|
-
|
|
186
|
-
test('placeholder shows default "Select..." when not provided', () => {
|
|
187
|
-
render(
|
|
188
|
-
<Dropdown
|
|
189
|
-
data={{ testid: testId }}
|
|
190
|
-
options={options}
|
|
191
|
-
/>
|
|
192
|
-
)
|
|
193
|
-
|
|
194
|
-
const kit = screen.getByTestId(testId)
|
|
195
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
196
|
-
expect(trigger).toHaveTextContent('Select...')
|
|
197
|
-
})
|
|
198
|
-
|
|
199
125
|
test('generated label prop', () => {
|
|
200
126
|
render (
|
|
201
127
|
<Dropdown
|
|
@@ -540,27 +466,7 @@ test("quickpick clears selection when clicking X icon", () => {
|
|
|
540
466
|
expect(trigger).toHaveTextContent("Select...")
|
|
541
467
|
})
|
|
542
468
|
|
|
543
|
-
test("quickpick hides clear icon when clearable is false", () => {
|
|
544
|
-
render(
|
|
545
|
-
<Dropdown
|
|
546
|
-
clearable={false}
|
|
547
|
-
data={{ testid: testId }}
|
|
548
|
-
defaultValue="This Week"
|
|
549
|
-
variant="quickpick"
|
|
550
|
-
/>
|
|
551
|
-
)
|
|
552
|
-
|
|
553
|
-
const kit = screen.getByTestId(testId)
|
|
554
|
-
const trigger = kit.querySelector('.pb_dropdown_trigger')
|
|
555
|
-
|
|
556
|
-
expect(trigger).toHaveTextContent("This Week")
|
|
557
|
-
|
|
558
|
-
const clearIcon = kit.querySelector('[aria-label="times icon"]')
|
|
559
|
-
expect(clearIcon).not.toBeInTheDocument()
|
|
560
|
-
})
|
|
561
|
-
|
|
562
469
|
test("quickpick returns date array values when option selected", () => {
|
|
563
|
-
// eslint-disable-next-line react/no-multi-comp
|
|
564
470
|
const TestComponent = () => {
|
|
565
471
|
const [selected, setSelected] = useState(null)
|
|
566
472
|
return (
|
|
@@ -5,13 +5,9 @@ module Playbook
|
|
|
5
5
|
class DropdownContainer < Playbook::KitBase
|
|
6
6
|
prop :searchbar, type: Playbook::Props::Boolean,
|
|
7
7
|
default: false
|
|
8
|
-
prop :constrain_height, type: Playbook::Props::Boolean,
|
|
9
|
-
default: false
|
|
10
8
|
|
|
11
9
|
def classname
|
|
12
|
-
|
|
13
|
-
classes << "constrain_height" if constrain_height
|
|
14
|
-
generate_classname(*classes, separator: " ")
|
|
10
|
+
generate_classname("pb_dropdown_container", "close", separator: " ")
|
|
15
11
|
end
|
|
16
12
|
|
|
17
13
|
def data
|
|
@@ -48,7 +48,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
48
48
|
this.updatePills();
|
|
49
49
|
|
|
50
50
|
this.clearBtn = this.element.querySelector(CLEAR_ICON_SELECTOR);
|
|
51
|
-
this.isClearable = this.element.dataset.pbDropdownClearable !== "false";
|
|
52
51
|
if (this.clearBtn) {
|
|
53
52
|
this.clearBtn.style.display = "none";
|
|
54
53
|
this.clearBtn.addEventListener("click", (e) => {
|
|
@@ -61,10 +60,6 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
61
60
|
|
|
62
61
|
updateClearButton() {
|
|
63
62
|
if (!this.clearBtn) return;
|
|
64
|
-
if (!this.isClearable) {
|
|
65
|
-
this.clearBtn.style.display = "none";
|
|
66
|
-
return;
|
|
67
|
-
}
|
|
68
63
|
const hasSelection = this.isMultiSelect
|
|
69
64
|
? this.selectedOptions.size > 0
|
|
70
65
|
: Boolean(this.element.querySelector(DROPDOWN_INPUT).value);
|
|
@@ -114,51 +109,15 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
114
109
|
adjustDropdownHeight() {
|
|
115
110
|
if (this.target.classList.contains("open")) {
|
|
116
111
|
const el = this.target;
|
|
117
|
-
const shouldConstrain = el.classList.contains("constrain_height");
|
|
118
112
|
el.style.height = "auto";
|
|
119
113
|
requestAnimationFrame(() => {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
const maxHeight = fontSize * 18;
|
|
124
|
-
const scrollHeight = el.scrollHeight;
|
|
125
|
-
const newHeight = Math.min(scrollHeight, maxHeight);
|
|
126
|
-
el.offsetHeight; // force reflow
|
|
127
|
-
el.style.height = newHeight + "px";
|
|
128
|
-
} else {
|
|
129
|
-
el.offsetHeight; // force reflow
|
|
130
|
-
el.style.height = el.scrollHeight + "px";
|
|
131
|
-
}
|
|
114
|
+
const newHeight = el.scrollHeight + "px";
|
|
115
|
+
el.offsetHeight; // force reflow
|
|
116
|
+
el.style.height = newHeight;
|
|
132
117
|
});
|
|
133
118
|
}
|
|
134
119
|
}
|
|
135
120
|
|
|
136
|
-
adjustDropdownPosition(container) {
|
|
137
|
-
if (!container) return;
|
|
138
|
-
|
|
139
|
-
const wrapper = this.element.querySelector(".dropdown_wrapper");
|
|
140
|
-
if (!wrapper) return;
|
|
141
|
-
|
|
142
|
-
const wrapperRect = wrapper.getBoundingClientRect();
|
|
143
|
-
const h = container.getBoundingClientRect().height || container.scrollHeight;
|
|
144
|
-
const spaceBelow = window.innerHeight - wrapperRect.bottom;
|
|
145
|
-
const spaceAbove = wrapperRect.top;
|
|
146
|
-
|
|
147
|
-
// If not enough space below but enough space above, position above
|
|
148
|
-
if (spaceBelow < h + 10 && spaceAbove >= h + 10) {
|
|
149
|
-
container.style.top = "auto";
|
|
150
|
-
container.style.bottom = "calc(100% + 5px)";
|
|
151
|
-
container.style.marginTop = "0";
|
|
152
|
-
container.style.marginBottom = "0";
|
|
153
|
-
} else {
|
|
154
|
-
// Default: position below
|
|
155
|
-
container.style.top = "";
|
|
156
|
-
container.style.bottom = "";
|
|
157
|
-
container.style.marginTop = "";
|
|
158
|
-
container.style.marginBottom = "";
|
|
159
|
-
}
|
|
160
|
-
}
|
|
161
|
-
|
|
162
121
|
handleSearch(term = "") {
|
|
163
122
|
const lcTerm = term.toLowerCase();
|
|
164
123
|
let hasMatch = false
|
|
@@ -406,21 +365,7 @@ export default class PbDropdown extends PbEnhancedElement {
|
|
|
406
365
|
showElement(elem) {
|
|
407
366
|
elem.classList.remove("close");
|
|
408
367
|
elem.classList.add("open");
|
|
409
|
-
|
|
410
|
-
const shouldConstrain = elem.classList.contains("constrain_height");
|
|
411
|
-
if (shouldConstrain) {
|
|
412
|
-
// Calculate height respecting max-height constraint (18em)
|
|
413
|
-
const fontSize = parseFloat(getComputedStyle(elem).fontSize) || 16;
|
|
414
|
-
const maxHeight = fontSize * 18; // matches SCSS max-height: 18em
|
|
415
|
-
const scrollHeight = elem.scrollHeight;
|
|
416
|
-
const height = Math.min(scrollHeight, maxHeight);
|
|
417
|
-
elem.style.height = height + "px";
|
|
418
|
-
} else {
|
|
419
|
-
elem.style.height = elem.scrollHeight + "px";
|
|
420
|
-
}
|
|
421
|
-
|
|
422
|
-
// Auto-position dropdown above if not enough space below
|
|
423
|
-
this.adjustDropdownPosition(elem);
|
|
368
|
+
elem.style.height = elem.scrollHeight + "px";
|
|
424
369
|
}
|
|
425
370
|
|
|
426
371
|
hideElement(elem) {
|
|
@@ -19,7 +19,6 @@ type DropdownContainerProps = {
|
|
|
19
19
|
aria?: { [key: string]: string };
|
|
20
20
|
children?: React.ReactChild[] | React.ReactChild;
|
|
21
21
|
className?: string;
|
|
22
|
-
constrainHeight?: boolean;
|
|
23
22
|
dark?: boolean;
|
|
24
23
|
data?: { [key: string]: string };
|
|
25
24
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
|
@@ -32,7 +31,6 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
|
32
31
|
aria = {},
|
|
33
32
|
children,
|
|
34
33
|
className,
|
|
35
|
-
constrainHeight = false,
|
|
36
34
|
dark = false,
|
|
37
35
|
data = {},
|
|
38
36
|
htmlOptions = {},
|
|
@@ -56,7 +54,6 @@ const DropdownContainer = (props: DropdownContainerProps) => {
|
|
|
56
54
|
const classes = classnames(
|
|
57
55
|
buildCss("pb_dropdown_container"),
|
|
58
56
|
`${isDropDownClosed ? "close" : "open"}`,
|
|
59
|
-
constrainHeight && "constrain_height",
|
|
60
57
|
globalProps(props),
|
|
61
58
|
className
|
|
62
59
|
);
|
|
@@ -44,7 +44,6 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
44
44
|
|
|
45
45
|
const {
|
|
46
46
|
autocomplete,
|
|
47
|
-
clearable,
|
|
48
47
|
filterItem,
|
|
49
48
|
handleBackspace,
|
|
50
49
|
handleChange,
|
|
@@ -226,7 +225,7 @@ const DropdownTrigger = (props: DropdownTriggerProps) => {
|
|
|
226
225
|
key={`${isDropDownClosed ? "chevron-down" : "chevron-up"}`}
|
|
227
226
|
>
|
|
228
227
|
{
|
|
229
|
-
|
|
228
|
+
selectedArray.length > 0 && (
|
|
230
229
|
<div onClick={(e)=>{e.stopPropagation();handleBackspace()}}>
|
|
231
230
|
<Icon
|
|
232
231
|
cursor="pointer"
|
|
@@ -21,7 +21,7 @@ const nextValue = (value: SortValue[], name: string): SortValue => {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
const directionIcon = (dir: Direction) => (
|
|
24
|
-
dir == 'asc' ? '
|
|
24
|
+
dir == 'asc' ? 'sort-amount-up' : 'sort-amount-down'
|
|
25
25
|
)
|
|
26
26
|
|
|
27
27
|
const renderOptions = (options: SortOptions, value: SortValue[], handleChange: (arg0: SortValue) => void) => (
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<%=
|
|
2
2
|
pb_rails("filter", props: {
|
|
3
3
|
min_width: "360px",
|
|
4
|
-
id: "
|
|
4
|
+
id: "1",
|
|
5
5
|
margin_bottom: "xl",
|
|
6
6
|
filters: [
|
|
7
7
|
{ name: "name", value: "John Wick" },
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
<%=
|
|
45
45
|
pb_rails("filter", props: {
|
|
46
46
|
min_width: "360px",
|
|
47
|
-
id: "
|
|
47
|
+
id: "def2",
|
|
48
48
|
sort_menu: [
|
|
49
49
|
{ item: "Popularity", link: "?q[sorts]=managers_popularity+asc", active: true, direction: "desc" },
|
|
50
50
|
{ item: "Mananger's Title", link: "?q[sorts]=managers_title+asc", active: false },
|