playbook_ui 14.15.0.pre.alpha.PBNTR617addgriddisplayglobalprop6700 → 14.15.0.pre.alpha.PBNTR900phonenumberinputhidden6593
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_advanced_table/_advanced_table.scss +0 -7
- data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.md +1 -3
- data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +0 -2
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
- data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +1 -1
- data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
- data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +5 -32
- data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +0 -1
- data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +2 -4
- data/app/pb_kits/playbook/pb_phone_number_input/docs/{_phone_number_input_default.html.erb → _phone_number_input_default_rails.html.erb} +1 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default_rails.md +2 -0
- data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -4
- data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +0 -3
- data/app/pb_kits/playbook/pb_popover/_popover.tsx +1 -1
- data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
- data/app/pb_kits/playbook/pb_text_input/inputMask.ts +3 -2
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +10 -0
- data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +4 -16
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +0 -1
- data/app/pb_kits/playbook/pb_typeahead/docs/index.js +0 -1
- data/app/pb_kits/playbook/tokens/_display.scss +1 -3
- data/app/pb_kits/playbook/utilities/_display.scss +1 -6
- data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +1 -1
- data/dist/chunks/_typeahead-Cu4WtFsC.js +36 -0
- data/dist/chunks/{_weekday_stacked-BVO5G6au.js → _weekday_stacked-iCkVKLxW.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/menu.yml +1 -1
- data/dist/playbook-doc.js +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/display.rb +2 -2
- data/lib/playbook/version.rb +1 -1
- metadata +7 -16
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +0 -102
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.md +0 -4
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.html.erb +0 -39
- data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.html.erb +0 -39
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +0 -91
- data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.md +0 -1
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.html.erb +0 -5
- data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.md +0 -1
- data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +0 -22
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +0 -66
- data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +0 -1
- data/dist/chunks/_typeahead-B8f4HM8I.js +0 -36
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b49818abae486db8f2278f8a55d56ad134fe281991fed0df1f146e350c180f48
|
4
|
+
data.tar.gz: '00328c8493c5262b03db8289724c3fd9526aed880cb51dde183e98ab8861f40d'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 12405e9d91640cf2c7385513d16baea2318a576422c68d0f6cea79ee7e25c19e6ac062e62b20303156931cfe78bc19edf526d602f52536da7262a8c071dbb258
|
7
|
+
data.tar.gz: ef9eb9aa455db56e0fdf58ceaefe8100b8ea3124617e5c86fee0871b11ebd6f659b5e8e6f35617593fbb962d0d6e141975ffa696e8b1b4be3fc8bbec543f8778
|
@@ -36,5 +36,4 @@ examples:
|
|
36
36
|
- advanced_table_selectable_rows: Selectable Rows
|
37
37
|
- advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
|
38
38
|
- advanced_table_selectable_rows_actions: Selectable Rows (With Actions)
|
39
|
-
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
40
|
-
- advanced_table_inline_editing: Inline Cell Editing
|
39
|
+
- advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
|
@@ -20,5 +20,4 @@ export { default as AdvancedTableNoSubrows } from './_advanced_table_no_subrows.
|
|
20
20
|
export { default as AdvancedTableSelectableRowsHeader } from './_advanced_table_selectable_rows_header.jsx'
|
21
21
|
export { default as AdvancedTableSelectableRowsActions } from './_advanced_table_selectable_rows_actions.jsx'
|
22
22
|
export { default as AdvancedTableTablePropsStickyHeader } from './_advanced_table_table_props_sticky_header.jsx'
|
23
|
-
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
24
|
-
export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
|
23
|
+
export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
|
@@ -1,3 +1 @@
|
|
1
|
-
You can find a full list of flatpickr events and hooks in their [documentation](https://flatpickr.js.org/events/).
|
2
|
-
|
3
|
-
Use `window.addEventListener("DOMContentLoaded", () => {})`, not `document.addEventListener("DOMContentLoaded", () => {})`.
|
1
|
+
You can find a full list of flatpickr events and hooks in their [documentation](https://flatpickr.js.org/events/).
|
@@ -7,8 +7,6 @@ examples:
|
|
7
7
|
- date_picker_allow_input: Allow Input
|
8
8
|
- date_picker_input: Input Field
|
9
9
|
- date_picker_label: Label
|
10
|
-
- date_picker_on_change: onChange
|
11
|
-
- date_picker_on_close: onClose
|
12
10
|
# - date_picker_range: Range
|
13
11
|
- date_picker_quick_pick_rails: Range (Quick Pick)
|
14
12
|
- date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
|
@@ -25,7 +25,7 @@
|
|
25
25
|
<%= pb_form_with(scope: :example, url: "", method: :get) do |form| %>
|
26
26
|
<%= form.typeahead :example_typeahead, props: { data: { typeahead_example1: true, user: {} }, label: true, placeholder: "Search for a user" } %>
|
27
27
|
<%= form.text_field :example_text_field, props: { label: true } %>
|
28
|
-
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field"
|
28
|
+
<%= form.phone_number_field :example_phone_number_field, props: { label: "Example phone field" } %>
|
29
29
|
<%= form.email_field :example_email_field, props: { label: true } %>
|
30
30
|
<%= form.number_field :example_number_field, props: { label: true } %>
|
31
31
|
<%= form.search_field :example_search_field, props: { label: true } %>
|
@@ -24,7 +24,7 @@
|
|
24
24
|
<%= pb_form_with(scope: :example, method: :get, url: "", validate: true) do |form| %>
|
25
25
|
<%= form.typeahead :example_typeahead_validation, props: { data: { typeahead_example2: true, user: {} }, label: true, placeholder: "Search for a user", required: true, validation: { message: "Please select a user." } } %>
|
26
26
|
<%= form.text_field :example_text_field_validation, props: { label: true, required: true } %>
|
27
|
-
<%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field"
|
27
|
+
<%= form.phone_number_field :example_phone_number_field_validation, props: { label: "Example phone field" } %>
|
28
28
|
<%= form.email_field :example_email_field_validation, props: { label: true, required: true } %>
|
29
29
|
<%= form.number_field :example_number_field_validation, props: { label: true, required: true } %>
|
30
30
|
<%= form.search_field :example_project_number_validation, props: { label: true, required: true, validation: { pattern: "[0-9]{2}-[0-9]{5}", message: "Please enter a valid project number (example: 33-12345)." } } %>
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useEffect, useRef
|
1
|
+
import React, { useState, useEffect, useRef } from "react";
|
2
2
|
import classnames from "classnames";
|
3
3
|
import { globalProps, GlobalProps } from "../utilities/globalProps";
|
4
4
|
import {
|
@@ -23,13 +23,6 @@ import {
|
|
23
23
|
getExpandedItems,
|
24
24
|
} from "./_helper_functions";
|
25
25
|
|
26
|
-
interface MultiLevelSelectComponent
|
27
|
-
extends React.ForwardRefExoticComponent<
|
28
|
-
MultiLevelSelectProps & React.RefAttributes<HTMLInputElement>
|
29
|
-
> {
|
30
|
-
Options: typeof MultiLevelSelectOptions;
|
31
|
-
}
|
32
|
-
|
33
26
|
type MultiLevelSelectProps = {
|
34
27
|
aria?: { [key: string]: string }
|
35
28
|
className?: string
|
@@ -42,7 +35,6 @@ type MultiLevelSelectProps = {
|
|
42
35
|
name?: string
|
43
36
|
returnAllSelected?: boolean
|
44
37
|
treeData?: { [key: string]: string; }[] | any
|
45
|
-
onChange?: (event: { target: { name?: string; value: any } }) => void
|
46
38
|
onSelect?: (prop: { [key: string]: any }) => void
|
47
39
|
selectedIds?: string[] | any
|
48
40
|
variant?: "multi" | "single"
|
@@ -50,7 +42,7 @@ type MultiLevelSelectProps = {
|
|
50
42
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
51
43
|
} & GlobalProps
|
52
44
|
|
53
|
-
const MultiLevelSelect =
|
45
|
+
const MultiLevelSelect = (props: MultiLevelSelectProps) => {
|
54
46
|
const {
|
55
47
|
aria = {},
|
56
48
|
className,
|
@@ -63,7 +55,6 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
63
55
|
name,
|
64
56
|
returnAllSelected = false,
|
65
57
|
treeData,
|
66
|
-
onChange = () => null,
|
67
58
|
onSelect = () => null,
|
68
59
|
selectedIds,
|
69
60
|
variant = "multi",
|
@@ -296,10 +287,8 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
296
287
|
// Logic for removing items from returnArray or defaultReturn when pills clicked
|
297
288
|
if (returnAllSelected) {
|
298
289
|
onSelect(getCheckedItems(updatedTree));
|
299
|
-
onChange({ target: { name, value: getCheckedItems(updatedTree) } });
|
300
290
|
} else {
|
301
291
|
onSelect(getDefaultCheckedItems(updatedTree));
|
302
|
-
onChange({ target: { name, value: getDefaultCheckedItems(updatedTree) } });
|
303
292
|
}
|
304
293
|
};
|
305
294
|
|
@@ -325,10 +314,8 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
325
314
|
const updatedTree = changeItem(filtered[0], check);
|
326
315
|
if (returnAllSelected) {
|
327
316
|
onSelect(getCheckedItems(updatedTree));
|
328
|
-
onChange({ target: { name, value: getCheckedItems(updatedTree) } });
|
329
317
|
} else {
|
330
318
|
onSelect(getDefaultCheckedItems(updatedTree));
|
331
|
-
onChange({ target: { name, value: getDefaultCheckedItems(updatedTree) } });
|
332
319
|
}
|
333
320
|
};
|
334
321
|
|
@@ -361,7 +348,6 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
361
348
|
setIsDropdownClosed(true);
|
362
349
|
|
363
350
|
onSelect(selectedItem);
|
364
|
-
onChange({ target: { name, value: selectedItem } });
|
365
351
|
};
|
366
352
|
|
367
353
|
// Single select: reset the tree state upon typing
|
@@ -403,12 +389,12 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
403
389
|
// Rendering formattedData to UI based on typeahead
|
404
390
|
const renderNestedOptions = (items: { [key: string]: string; }[] | any ) => {
|
405
391
|
const hasOptionsChild = React.Children.toArray(props.children).some(
|
406
|
-
(child) =>
|
392
|
+
(child: any) => child.type === MultiLevelSelect.Options
|
407
393
|
);
|
408
394
|
|
409
395
|
if (hasOptionsChild) {
|
410
396
|
return React.Children.map(props.children, (child) => {
|
411
|
-
if (
|
397
|
+
if (child.type === MultiLevelSelect.Options) {
|
412
398
|
return React.cloneElement(child, { items });
|
413
399
|
}
|
414
400
|
return null;
|
@@ -473,18 +459,6 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
473
459
|
))
|
474
460
|
: null}
|
475
461
|
|
476
|
-
{!returnAllSelected
|
477
|
-
? defaultReturn.map((item) => (
|
478
|
-
<input
|
479
|
-
disabled={disabled}
|
480
|
-
key={item.id}
|
481
|
-
name={`${name}[]`}
|
482
|
-
type="hidden"
|
483
|
-
value={item.id}
|
484
|
-
/>
|
485
|
-
))
|
486
|
-
: null}
|
487
|
-
|
488
462
|
{returnAllSelected &&
|
489
463
|
returnedArray.length !== 0 &&
|
490
464
|
inputDisplay === "pills"
|
@@ -573,9 +547,8 @@ const MultiLevelSelect = forwardRef<HTMLInputElement, MultiLevelSelectProps>((pr
|
|
573
547
|
</MultiLevelSelectContext.Provider>
|
574
548
|
</div>
|
575
549
|
);
|
576
|
-
}
|
550
|
+
};
|
577
551
|
|
578
|
-
MultiLevelSelect.displayName = "MultiLevelSelect";
|
579
552
|
MultiLevelSelect.Options = MultiLevelSelectOptions;
|
580
553
|
|
581
554
|
export default MultiLevelSelect;
|
@@ -12,7 +12,6 @@ examples:
|
|
12
12
|
|
13
13
|
react:
|
14
14
|
- multi_level_select_default: Default
|
15
|
-
- multi_level_select_react_hook: React Hook
|
16
15
|
- multi_level_select_single: Single Select
|
17
16
|
- multi_level_select_single_children_only: Single Select w/ Hidden Radios
|
18
17
|
- multi_level_select_return_all_selected: Return All Selected
|
@@ -7,4 +7,3 @@ export { default as MultiLevelSelectColor } from './_multi_level_select_color.js
|
|
7
7
|
export { default as MultiLevelSelectWithChildren } from './_multi_level_select_with_children.jsx'
|
8
8
|
export { default as MultiLevelSelectWithChildrenWithRadios } from './_multi_level_select_with_children_with_radios.jsx'
|
9
9
|
export { default as MultiLevelSelectDisabled } from './_multi_level_select_disabled.jsx'
|
10
|
-
export { default as MultiLevelSelectReactHook } from './_multi_level_select_react_hook.jsx'
|
@@ -23,7 +23,6 @@ type PhoneNumberInputProps = {
|
|
23
23
|
data?: { [key: string]: string },
|
24
24
|
disabled?: boolean,
|
25
25
|
error?: string,
|
26
|
-
hiddenInputs?: boolean,
|
27
26
|
htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
|
28
27
|
id?: string,
|
29
28
|
initialCountry?: string,
|
@@ -73,7 +72,6 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
73
72
|
dark = false,
|
74
73
|
data = {},
|
75
74
|
disabled = false,
|
76
|
-
hiddenInputs = false,
|
77
75
|
htmlOptions = {},
|
78
76
|
id = "",
|
79
77
|
initialCountry = "",
|
@@ -245,10 +243,10 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
|
|
245
243
|
countrySearch: false,
|
246
244
|
fixDropdownWidth: false,
|
247
245
|
formatAsYouType: formatAsYouType,
|
248
|
-
hiddenInput:
|
246
|
+
hiddenInput: () => ({
|
249
247
|
phone: `${name}_full`,
|
250
248
|
country: `${name}_country_code`,
|
251
|
-
})
|
249
|
+
}),
|
252
250
|
})
|
253
251
|
|
254
252
|
itiRef.current = telInputInit;
|
@@ -0,0 +1,2 @@
|
|
1
|
+
NOTE: Error state is handled by default, validating length (too long or too short) relative to the selected country’s phone format and enforcing numeric-only values for all countries.
|
2
|
+
The Phone Number Input kit has two hidden input fields, `{field_name}_full` and `{field_name}_country_code`. The value passed when the form is submitted contains the full phone number including the country code. Read the [intl-tel-input](https://intl-tel-input.com/examples/hidden-input.html) docs for more information.
|
@@ -11,11 +11,9 @@ examples:
|
|
11
11
|
- phone_number_input_format: Format as You Type
|
12
12
|
|
13
13
|
rails:
|
14
|
-
-
|
14
|
+
- phone_number_input_default_rails: Default
|
15
15
|
- phone_number_input_preferred_countries: Preferred Countries
|
16
16
|
- phone_number_input_initial_country: Initial Country
|
17
17
|
- phone_number_input_only_countries: Limited Countries
|
18
18
|
- phone_number_input_validation: Form Validation
|
19
|
-
- phone_number_input_format: Format as You Type
|
20
|
-
- phone_number_input_hidden_inputs: Hidden Inputs
|
21
|
-
|
19
|
+
- phone_number_input_format: Format as You Type
|
@@ -23,8 +23,6 @@ module Playbook
|
|
23
23
|
default: ""
|
24
24
|
prop :format_as_you_type, type: Playbook::Props::Boolean,
|
25
25
|
default: false
|
26
|
-
prop :hidden_inputs, type: Playbook::Props::Boolean,
|
27
|
-
default: false
|
28
26
|
|
29
27
|
def classname
|
30
28
|
generate_classname("pb_phone_number_input")
|
@@ -37,7 +35,6 @@ module Playbook
|
|
37
35
|
disabled: disabled,
|
38
36
|
error: error,
|
39
37
|
formatAsYouType: format_as_you_type,
|
40
|
-
hiddenInputs: hidden_inputs,
|
41
38
|
initialCountry: initial_country,
|
42
39
|
label: label,
|
43
40
|
name: name,
|
@@ -84,7 +84,7 @@ const Popover = (props: PbPopoverProps) => {
|
|
84
84
|
} = props;
|
85
85
|
|
86
86
|
const items = globalProps(props).split(' ')
|
87
|
-
const filteredItems = items.filter(item => !item.includes('
|
87
|
+
const filteredItems = items.filter(item => !item.includes('min_width'))
|
88
88
|
const filteredGlobalProps = filteredItems.join(' ')
|
89
89
|
const popoverSpacing =
|
90
90
|
filteredGlobalProps.includes("dark") || !filteredGlobalProps
|
@@ -181,7 +181,7 @@ const PopoverTestClicktoClose3 = () => {
|
|
181
181
|
const btn = screen.getByText(/click me/i)
|
182
182
|
fireEvent.click(btn);
|
183
183
|
const kit = screen.getByText("Click Anywhere");
|
184
|
-
expect(kit).toHaveClass("pb_popover_body
|
184
|
+
expect(kit).toHaveClass("pb_popover_body max_width_240px overflow_handling");
|
185
185
|
});
|
186
186
|
|
187
187
|
test("closes Popover on click anywhere", async () => {
|
@@ -17,7 +17,7 @@ const formatCurrencyDefaultValue = (value: string): string => {
|
|
17
17
|
|
18
18
|
// Parse the numeric value as a float to handle decimals
|
19
19
|
const dollars = parseFloat(numericValue)
|
20
|
-
if (isNaN(dollars)) return ''
|
20
|
+
if (isNaN(dollars) || dollars === 0) return ''
|
21
21
|
|
22
22
|
// Format as currency
|
23
23
|
return new Intl.NumberFormat('en-US', {
|
@@ -30,9 +30,10 @@ const formatCurrencyDefaultValue = (value: string): string => {
|
|
30
30
|
const formatCurrency = (value: string): string => {
|
31
31
|
const numericValue = value.replace(/[^0-9]/g, '').slice(0, 15)
|
32
32
|
|
33
|
-
if (!numericValue
|
33
|
+
if (!numericValue) return ''
|
34
34
|
|
35
35
|
const dollars = parseFloat((parseInt(numericValue) / 100).toFixed(2))
|
36
|
+
if (dollars === 0) return ''
|
36
37
|
|
37
38
|
return new Intl.NumberFormat('en-US', {
|
38
39
|
style: 'currency',
|
@@ -0,0 +1,10 @@
|
|
1
|
+
<%= pb_rails("icon_circle", props: { icon: "paper-plane", id: "result-1-sample-email-link" }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("tooltip", props: {
|
4
|
+
trigger_element_id: "result-1-sample-email-link",
|
5
|
+
tooltip_id: "sample-email-tooltip-result-1",
|
6
|
+
position: "top",
|
7
|
+
dark: true
|
8
|
+
}) do %>
|
9
|
+
Send Email
|
10
|
+
<% end %>
|
@@ -4,7 +4,6 @@ examples:
|
|
4
4
|
- tooltip_default: Default
|
5
5
|
- tooltip_interaction: Content Interaction
|
6
6
|
- tooltip_selectors: Using Common Selectors
|
7
|
-
- tooltip_icon_rails: Tooltip with Icon
|
8
7
|
- tooltip_with_icon_circle: Icon Circle Tooltip
|
9
8
|
- tooltip_delay_rails: Delay
|
10
9
|
- tooltip_show_tooltip: Show Tooltip
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import React, { useState, useEffect
|
1
|
+
import React, { useState, useEffect} from 'react'
|
2
2
|
import Select from 'react-select'
|
3
3
|
import AsyncSelect from 'react-select/async'
|
4
4
|
import CreateableSelect from 'react-select/creatable'
|
@@ -49,7 +49,6 @@ type TypeaheadProps = {
|
|
49
49
|
options?: Array<{ label: string; value?: string }>,
|
50
50
|
marginBottom?: "none" | "xxs" | "xs" | "sm" | "md" | "lg" | "xl",
|
51
51
|
pillColor?: "primary" | "neutral" | "success" | "warning" | "error" | "info" | "data_1" | "data_2" | "data_3" | "data_4" | "data_5" | "data_6" | "data_7" | "data_8" | "windows" | "siding" | "roofing" | "doors" | "gutters" | "solar" | "insulation" | "accessories",
|
52
|
-
onChange?: any,
|
53
52
|
optionsByContext?: Record<string, Array<{ label: string; value?: string }>>
|
54
53
|
searchContextSelector?: string,
|
55
54
|
clearOnContextChange?: boolean,
|
@@ -72,7 +71,8 @@ type TagOnChangeValues = {
|
|
72
71
|
* @constant {React.ReactComponent} Typeahead
|
73
72
|
* @param {TypeaheadProps} props - props as described at https://react-select.com/props
|
74
73
|
*/
|
75
|
-
|
74
|
+
|
75
|
+
const Typeahead = ({
|
76
76
|
async,
|
77
77
|
className,
|
78
78
|
components = {},
|
@@ -83,11 +83,9 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
83
83
|
getOptionValue,
|
84
84
|
htmlOptions = {},
|
85
85
|
id,
|
86
|
-
name,
|
87
86
|
loadOptions = noop,
|
88
87
|
marginBottom = "sm",
|
89
88
|
pillColor,
|
90
|
-
onChange,
|
91
89
|
optionsByContext = {},
|
92
90
|
searchContextSelector,
|
93
91
|
clearOnContextChange = false,
|
@@ -158,15 +156,6 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
158
156
|
)
|
159
157
|
|
160
158
|
const handleOnChange = (_data: SelectValueType, { action, option, removedValue }: TagOnChangeValues) => {
|
161
|
-
if (onChange) {
|
162
|
-
const isReactHookForm = onChange.toString().includes("target")
|
163
|
-
if (isReactHookForm) {
|
164
|
-
onChange({ target: { name, value: _data } })
|
165
|
-
} else {
|
166
|
-
onChange(_data)
|
167
|
-
}
|
168
|
-
}
|
169
|
-
|
170
159
|
if (action === 'select-option') {
|
171
160
|
if (selectProps.onMultiValueClick) selectProps.onMultiValueClick(option)
|
172
161
|
const multiValueClearEvent = new CustomEvent(`pb-typeahead-kit-${selectProps.id}-result-option-select`, { detail: option ? option : _data })
|
@@ -210,11 +199,10 @@ const Typeahead = forwardRef<HTMLInputElement, TypeaheadProps>(({
|
|
210
199
|
/>
|
211
200
|
</div>
|
212
201
|
)
|
213
|
-
}
|
202
|
+
}
|
214
203
|
|
215
204
|
Object.keys(kitComponents).forEach((k) => {
|
216
205
|
(Typeahead as GenericObject)[k] = (kitComponents as {[key: string]: unknown})[k]
|
217
206
|
})
|
218
207
|
|
219
|
-
Typeahead.displayName = 'Typeahead'
|
220
208
|
export default Typeahead
|
@@ -49,7 +49,7 @@ const TypeaheadWithPillsAsyncCustomOptions = (props) => {
|
|
49
49
|
* @summary - for doc example purposes only
|
50
50
|
*/
|
51
51
|
const handleOnMultiValueClick = (value) => {
|
52
|
-
alert(`You
|
52
|
+
alert(`You removed the user: "${value.label}"`)
|
53
53
|
}
|
54
54
|
|
55
55
|
return (
|
@@ -56,7 +56,7 @@ const TypeaheadWithPillsAsyncUsers = (props) => {
|
|
56
56
|
* @summary - for doc example purposes only
|
57
57
|
*/
|
58
58
|
const handleOnMultiValueClick = (value) => {
|
59
|
-
alert(`You
|
59
|
+
alert(`You removed the user: "${value.label}"`)
|
60
60
|
}
|
61
61
|
|
62
62
|
return (
|
@@ -13,4 +13,3 @@ export { default as TypeaheadCustomMenuList } from './_typeahead_custom_menu_lis
|
|
13
13
|
export { default as TypeaheadMarginBottom } from './_typeahead_margin_bottom.jsx'
|
14
14
|
export { default as TypeaheadWithPillsColor } from './_typeahead_with_pills_color.jsx'
|
15
15
|
export { default as TypeaheadTruncatedText } from './_typeahead_truncated_text.jsx'
|
16
|
-
export { default as TypeaheadReactHook } from './_typeahead_react_hook.jsx'
|
@@ -4,12 +4,10 @@ $display_inline_block: inline-block !default;
|
|
4
4
|
$display_flex: flex !default;
|
5
5
|
$display_none: none !default;
|
6
6
|
$display_inline_flex: inline-flex !default;
|
7
|
-
$display_grid: grid !default;
|
8
7
|
$displays: (
|
9
8
|
display_none: $display_none,
|
10
9
|
display_flex: $display_flex,
|
11
10
|
display_inline: $display_inline,
|
12
11
|
display_inline_block: $display_inline_block,
|
13
|
-
display_block: $display_block
|
14
|
-
display_grid: $display_grid
|
12
|
+
display_block: $display_block
|
15
13
|
);
|
@@ -24,18 +24,13 @@
|
|
24
24
|
display: none;
|
25
25
|
}
|
26
26
|
|
27
|
-
.display_grid {
|
28
|
-
display: grid;
|
29
|
-
}
|
30
|
-
|
31
27
|
$display_values: (
|
32
28
|
none: $display_none,
|
33
29
|
flex: $display_flex,
|
34
30
|
inline: $display_inline,
|
35
31
|
inline_block: $display_inline_block,
|
36
32
|
inline_flex: $display_inline_flex,
|
37
|
-
block: $display_block
|
38
|
-
grid: $display_grid
|
33
|
+
block: $display_block
|
39
34
|
);
|
40
35
|
|
41
36
|
// using a grid here
|
@@ -9,7 +9,7 @@ const testSubject = 'body'
|
|
9
9
|
|
10
10
|
// %w[block inline_block inline flex inline_flex none]
|
11
11
|
test('Global Props: returns proper class name', () => {
|
12
|
-
const propValues = ["block", "inline", "inline_block", "flex", "inline_flex", "none"
|
12
|
+
const propValues = ["block", "inline", "inline_block", "flex", "inline_flex", "none"]
|
13
13
|
for(let x = 0, y = propValues.length; x < y; ++x) {
|
14
14
|
const testId = `${testSubject}-${propValues[x]}`
|
15
15
|
render(
|