playbook_ui 14.19.0.pre.rc.1 → 14.19.0.pre.rc.2

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: e1bfa3c16e7e1f49e5b76698d4613e2b06b27e00830bb48899a405eae61ba1a3
4
- data.tar.gz: a21c3c47af80c388f1a56bb6177ee8195b2f214e9d8f8b83edfbb932f8e66260
3
+ metadata.gz: 6b97c57dd1473a621a18df79ce32d0de3421c907507c77600e234a85f54f960e
4
+ data.tar.gz: e6151ec14ea1dfe2940cf287a126681179f1ad90ca8e15379edbcb15107775a5
5
5
  SHA512:
6
- metadata.gz: 04bcff4ed98257d0c7249b6fb48550839d4d0a6dbead693604ebe75ca0febad6d0e9641a1e77ee46819b4d861c82c56d1c416e89ffe6fce73b506ce4bff5b04a
7
- data.tar.gz: 63de6ea020d1ccaa76279f5a157e78549e9fad3569653880f8df9250e08026db361866a66a8b3369a6e614e29a062faaf94cfa6b0c5d3c62525bc8b9fddef43f
6
+ metadata.gz: fb30f58048bfaaf950a43b1b44626d409508d9cfec3b24f6112d985c7bb46d0dfb7dcd3d088ccd62fb60ad220b4c26a455d705bf6e0dcaa0e3a367df185d4e81
7
+ data.tar.gz: 7827ea415a317d635ed96bc6fbbe338dcb19d5122fbeb27de5f9c40c30ec6c87925584f9c57407a30c43ec957e587b6f3aab0c7245b7b39efdb36aa0eb683fce
@@ -12,10 +12,9 @@ examples:
12
12
  - advanced_table_custom_cell_rails: Custom Components for Cells
13
13
  - advanced_table_column_headers: Multi-Header Columns
14
14
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
15
+ - advanced_table_column_border_color_rails: Column Group Border Color
15
16
  # - advanced_table_selectable_rows: Selectable Rows
16
17
  # - advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
17
- - advanced_table_column_border_color_rails: Column Group Border Color
18
-
19
18
 
20
19
  react:
21
20
  - advanced_table_default: Default (Required Props)
@@ -40,6 +39,7 @@ examples:
40
39
  - advanced_table_column_headers: Multi-Header Columns
41
40
  - advanced_table_column_headers_multiple: Multi-Header Columns (Multiple Levels)
42
41
  - advanced_table_column_headers_custom_cell: Multi-Header Columns with Custom Cells
42
+ - advanced_table_column_border_color: Column Group Border Color
43
43
  # - advanced_table_no_subrows: Table with No Subrows
44
44
  - advanced_table_selectable_rows: Selectable Rows
45
45
  - advanced_table_selectable_rows_no_subrows: Selectable Rows (No Subrows)
@@ -47,4 +47,3 @@ examples:
47
47
  - advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
48
48
  - advanced_table_inline_editing: Inline Cell Editing
49
49
  - advanced_table_fullscreen: Fullscreen
50
- - advanced_table_column_border_color: Column Group Border Color
@@ -23,35 +23,39 @@
23
23
  @mixin error-state-right-side-select-kit {
24
24
  &:has(.pb_text_input_kit:not(.error)):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error),
25
25
  &:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper) {
26
- align-items: flex-start;
27
-
28
- .pb_select_kit_wrapper {
29
- padding-top: $space_md;
30
- margin-top: 2px;
26
+ &:not(:has(.pb_phone_number_input)) {
27
+ align-items: flex-start;
31
28
 
32
- .pb_select_kit_caret {
29
+ .pb_select_kit_wrapper {
33
30
  padding-top: $space_md;
31
+ margin-top: 2px;
32
+
33
+ .pb_select_kit_caret {
34
+ padding-top: $space_md;
35
+ }
34
36
  }
35
- }
36
37
 
37
- .pb_select_kit_wrapper.error {
38
- padding-top: $space_md;
39
- margin-top: 2px;
38
+ .pb_select_kit_wrapper.error {
39
+ padding-top: $space_md;
40
+ margin-top: 2px;
40
41
 
41
- .pb_select_kit_caret {
42
- padding-top: $space_xl;
42
+ .pb_select_kit_caret {
43
+ padding-top: $space_xl;
44
+ }
43
45
  }
44
46
  }
45
47
  }
46
48
  }
47
49
 
48
50
  @mixin error-state-left-side-select-kit {
49
- &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_phone_number_input):has(.pb_text_input_kit.error) {
50
- align-items: flex-start;
51
+ &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_text_input_kit.error) {
52
+ &:not(:has(.pb_phone_number_input)) {
53
+ align-items: flex-start;
51
54
 
52
- .pb_text_input_kit.error {
53
- padding-top: $space_md;
54
- margin-top: 2px;
55
+ .pb_text_input_kit.error {
56
+ padding-top: $space_md;
57
+ margin-top: 2px;
58
+ }
55
59
  }
56
60
  }
57
- }
61
+ }
@@ -39,6 +39,9 @@ $flag-min-resolution: 192dpi;
39
39
  color: $charcoal;
40
40
  }
41
41
 
42
+ .iti__country-list {
43
+ min-width: $dropdown-min-width;
44
+ }
42
45
  // iti-spacer-horizontal's default is 8px, or $space_xs
43
46
  .iti__country-list .iti__flag, .iti__country-name {
44
47
  margin-right: $space_xs;
@@ -227,6 +230,16 @@ $flag-min-resolution: 192dpi;
227
230
  .iti__dropdown-content {
228
231
  border-radius: $space_xs;
229
232
  border: 1px solid $border_dark !important;
233
+ .iti__search-input {
234
+ background-color: $bg_dark_card;
235
+ &:hover {
236
+ background-color: $bg_dark_card;
237
+ }
238
+ &:active,
239
+ &:focus {
240
+ background-color: $card_dark;
241
+ }
242
+ }
230
243
  }
231
244
 
232
245
  .iti__divider {
@@ -37,6 +37,7 @@ type PhoneNumberInputProps = {
37
37
  required?: boolean,
38
38
  value?: string,
39
39
  formatAsYouType?: boolean,
40
+ countrySearch?: boolean,
40
41
  }
41
42
 
42
43
  enum ValidationError {
@@ -91,6 +92,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
91
92
  preferredCountries = [],
92
93
  value = "",
93
94
  formatAsYouType = false,
95
+ countrySearch = false,
94
96
  } = props
95
97
 
96
98
  const ariaProps = buildAriaProps(aria)
@@ -242,7 +244,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
242
244
  autoInsertDialCode: false,
243
245
  initialCountry: initialCountry || fallbackCountry,
244
246
  onlyCountries,
245
- countrySearch: false,
247
+ countrySearch: countrySearch,
246
248
  fixDropdownWidth: false,
247
249
  formatAsYouType: formatAsYouType,
248
250
  hiddenInput: hiddenInputs ? () => ({
@@ -0,0 +1,10 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ country_search: true,
3
+ id: "country-search",
4
+ }) %>
5
+
6
+ <%= pb_rails("phone_number_input", props: {
7
+ country_search: true,
8
+ id: "country-search-limited",
9
+ only_countries: ["br", "us", "ph", "gb"],
10
+ }) %>
@@ -0,0 +1,20 @@
1
+ import React from 'react'
2
+ import PhoneNumberInput from '../_phone_number_input'
3
+
4
+ const PhoneNumberInputCountrySearch = (props) => (
5
+ <>
6
+ <PhoneNumberInput
7
+ countrySearch
8
+ id='country-search'
9
+ {...props}
10
+ />
11
+ <PhoneNumberInput
12
+ countrySearch
13
+ id='country-search-limited'
14
+ onlyCountries={["br", "us", "ph", "gb"]}
15
+ {...props}
16
+ />
17
+ </>
18
+ )
19
+
20
+ export default PhoneNumberInputCountrySearch
@@ -0,0 +1 @@
1
+ Set `country_search` / `countrySearch` to true to allow users to search for a specific Country within the dropdown. If the range of countries has been limited, only the selected countries will be searchable.
@@ -9,6 +9,7 @@ examples:
9
9
  - phone_number_input_clear_field: Clearing the Input Field
10
10
  - phone_number_input_access_input_element: Accessing the Input Element
11
11
  - phone_number_input_format: Format as You Type
12
+ - phone_number_input_country_search: Country Search
12
13
 
13
14
  rails:
14
15
  - phone_number_input_default: Default
@@ -18,4 +19,5 @@ examples:
18
19
  - phone_number_input_validation: Form Validation
19
20
  - phone_number_input_format: Format as You Type
20
21
  - phone_number_input_hidden_inputs: Hidden Inputs
22
+ - phone_number_input_country_search: Country Search
21
23
 
@@ -6,3 +6,4 @@ export { default as PhoneNumberInputValidation } from './_phone_number_input_val
6
6
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
7
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
8
8
  export { default as PhoneNumberInputFormat } from './_phone_number_input_format'
9
+ export { default as PhoneNumberInputCountrySearch } from './_phone_number_input_country_search'
@@ -25,6 +25,8 @@ module Playbook
25
25
  default: false
26
26
  prop :hidden_inputs, type: Playbook::Props::Boolean,
27
27
  default: false
28
+ prop :country_search, type: Playbook::Props::Boolean,
29
+ default: false
28
30
 
29
31
  def classname
30
32
  generate_classname("pb_phone_number_input")
@@ -45,6 +47,7 @@ module Playbook
45
47
  preferredCountries: preferred_countries,
46
48
  required: required,
47
49
  value: value,
50
+ countrySearch: country_search,
48
51
  }
49
52
  end
50
53
  end
@@ -139,3 +139,22 @@ test("should format phone number as '555-555-5555' with formatAsYouType and 'us'
139
139
 
140
140
  expect(input.value).toBe("555-555-5555");
141
141
  });
142
+
143
+ test("should pass countrySearch prop to component", () => {
144
+ window.intlTelInput = jest.fn(() => ({
145
+ getSelectedCountryData: jest.fn(() => ({})),
146
+ isValidNumber: jest.fn(() => true),
147
+ getValidationError: jest.fn(() => 0),
148
+ }));
149
+
150
+ const props = {
151
+ id: testId,
152
+ countrySearch: true,
153
+ data: { testid: 'phone-input-with-search' }
154
+ };
155
+
156
+ render(<PhoneNumberInput {...props} />);
157
+
158
+ const wrapper = screen.getByTestId('phone-input-with-search');
159
+ expect(wrapper).toBeInTheDocument();
160
+ });