playbook_ui 14.20.0.pre.alpha.play2168firstcolumnborderbug7950 → 14.20.0.pre.alpha.play2212tablekitstickycolumnswithresponsivenone7979

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: fcf6c9b4cc1f09fe9f4ad71387108d0a83305a79498d68a455660c8a1d877d9a
4
- data.tar.gz: c95645d5f485724ecc9af73bdfd15701be9aac3b11e3626dead28ce4767ec149
3
+ metadata.gz: b4e9f81a39e99264f7447b0889451c36c4676c33f5f8c836d785432d0e9b4496
4
+ data.tar.gz: c870628692d424816911bdaa0c05517e26c05731a5d01e12e1de2b5a80720a87
5
5
  SHA512:
6
- metadata.gz: a46969b38f920b5c13d33d8f2287a56942f8f20f833734a1c282c36cd8328f693ee134a4af557d03d60cd91be39c099c816c088a070f4041cad0ee4a95d16f15
7
- data.tar.gz: 05fae68a0a62be4ec28dec7c2d46b8e16f8998309da8064566003b8b7bc9471cef8f36605dbd475627fcadd1c1988d41acd513f356278d0941ab5da354dfafe9
6
+ metadata.gz: 827b59f32cbf03452c6fe62dd227dced2681eaf6d38fe7c1832b338b6909886f613ca5e7d7743c43073474642bdf7c6ed7a688ec0dbe679358f330f646c9c037
7
+ data.tar.gz: fed471e895d0f88a489c629f74b6fd49b318ca7e063e200522264433aac2b3b4628265cde7884b75549bfd462498aa058f00af42fa32eaaab7ad15d02924da03
@@ -368,10 +368,6 @@
368
368
  box-shadow: 1px 0px 0px 0px var(--column-border-color) !important;
369
369
  }
370
370
 
371
- .pb_table_td:nth-child(2) {
372
- box-shadow: inset 1px 0px 0px 0px var(--column-border-color) !important;
373
- }
374
-
375
371
  // Color for collapsible trail
376
372
  .collapsible-trail {
377
373
  background-color: $border_light !important;
@@ -568,10 +564,6 @@
568
564
  box-shadow: $shadow_deep !important;
569
565
  }
570
566
 
571
- .pb_table_td:nth-child(2) {
572
- box-shadow: 0 0 0 0 !important;
573
- }
574
-
575
567
  .pb_advanced_table_header,
576
568
  .pb_advanced_table_body {
577
569
  th.sticky-left,
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { container: false }}) %>
33
+ <%= pb_rails("advanced_table", props: { id: "table_props_table", table_data: @table_data, column_definitions: column_definitions, table_props: { vertical_border: true, container: false }}) %>
@@ -1,5 +1,5 @@
1
1
  import React from "react"
2
- import { render, screen } from "../utilities/test-utils"
2
+ import { render, screen, fireEvent } from "../utilities/test-utils"
3
3
 
4
4
  import { Dropdown, Icon, IconCircle } from 'playbook-ui'
5
5
 
@@ -263,4 +263,110 @@ test("searchbar prop to render TextInput in container", () => {
263
263
  const kit = screen.getByTestId(testId)
264
264
  const searchbar = kit.querySelector('.pb_text_input_kit')
265
265
  expect(searchbar).toBeInTheDocument()
266
- })
266
+ })
267
+
268
+ test("MultiSelect prop to allow multiple selections + add correct Form Pills", () => {
269
+ render(
270
+ <Dropdown
271
+ data={{ testid: testId }}
272
+ multiSelect
273
+ options={options}
274
+ />
275
+ );
276
+
277
+ const kit = screen.getByTestId(testId);
278
+ const option = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
279
+ fireEvent.click(option[0]); // Select first option
280
+ fireEvent.click(option[1]); // Select second option
281
+ const formPills = kit.querySelectorAll(".pb_form_pill_kit_primary");
282
+ expect(formPills.length).toBe(2);
283
+ expect(formPills[0]).toHaveTextContent("United States");
284
+ expect(formPills[1]).toHaveTextContent("Canada");
285
+ });
286
+
287
+ test("hides each selected option from the dropdown", () => {
288
+
289
+ render(
290
+ <Dropdown
291
+ data={{ testid: testId }}
292
+ multiSelect
293
+ options={options}
294
+ />
295
+ );
296
+
297
+ const kit = screen.getByTestId(testId);
298
+ const option = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
299
+ const firstOpt = options[0].label
300
+ fireEvent.click(option[0]);
301
+ const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
302
+ expect(option2[0]).not.toHaveTextContent(firstOpt)
303
+ })
304
+
305
+ test("renders form pills inside trigger", () => {
306
+ render(
307
+ <Dropdown
308
+ data={{ testid: testId }}
309
+ multiSelect
310
+ options={options}
311
+ />
312
+ );
313
+
314
+ const kit = screen.getByTestId(testId)
315
+ const option = kit.querySelector('.pb_dropdown_option_list')
316
+ fireEvent.click(option)
317
+ const formPill = kit.querySelector(".pb_form_pill_kit_primary")
318
+ expect(formPill).toBeInTheDocument()
319
+ })
320
+
321
+ test("multiSelect and autocomplete to work together", () => {
322
+ render (
323
+ <Dropdown
324
+ autocomplete
325
+ data={{ testid: testId }}
326
+ multiSelect
327
+ options={options}
328
+ />
329
+ )
330
+
331
+ const kit = screen.getByTestId(testId)
332
+ const input = kit.querySelector('.dropdown_input')
333
+ expect(input).toBeInTheDocument()
334
+ const option = kit.querySelector('.pb_dropdown_option_list')
335
+ fireEvent.click(option)
336
+ const formPill = kit.querySelector(".pb_form_pill_kit_primary")
337
+ expect(formPill).toBeInTheDocument()
338
+ })
339
+
340
+ test("renders form pills with size and color", () => {
341
+ render(
342
+ <Dropdown
343
+ data={{ testid: testId }}
344
+ formPillProps={{ size: "small", color: "neutral" }}
345
+ multiSelect
346
+ options={options}
347
+ />
348
+ );
349
+
350
+ const kit = screen.getByTestId(testId)
351
+ const option = kit.querySelector('.pb_dropdown_option_list')
352
+ fireEvent.click(option)
353
+ const formPill = kit.querySelector(".pb_form_pill_kit_neutral")
354
+ expect(formPill).toBeInTheDocument()
355
+ expect(formPill).toHaveClass("small")
356
+ })
357
+
358
+ test("defaultValue works with multiSelect", () => {
359
+ render(
360
+ <Dropdown
361
+ data={{ testid: testId }}
362
+ defaultValue={[options[0], options[2]]}
363
+ multiSelect
364
+ options={options}
365
+ />
366
+ )
367
+ const kit = screen.getByTestId(testId)
368
+ expect(kit.querySelectorAll(".pb_form_pill_kit_primary")).toHaveLength(2)
369
+ const option2 = Array.from(kit.querySelectorAll(".pb_dropdown_option_list"));
370
+ const firstOpt = options[0].label
371
+ expect(option2[0]).not.toHaveTextContent(firstOpt)
372
+ })
@@ -33,6 +33,7 @@ type PhoneNumberInputProps = {
33
33
  onChange?: (e: React.FormEvent<HTMLInputElement>) => void,
34
34
  onValidate?: Callback<boolean, void>,
35
35
  onlyCountries: string[],
36
+ excludeCountries: string[],
36
37
  preferredCountries?: string[],
37
38
  required?: boolean,
38
39
  value?: string,
@@ -88,6 +89,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
88
89
  },
89
90
  onValidate = () => null,
90
91
  onlyCountries = [],
92
+ excludeCountries = [],
91
93
  required = false,
92
94
  preferredCountries = [],
93
95
  value = "",
@@ -234,6 +236,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
234
236
  const fallbackCountry =
235
237
  preferredCountries.length > 0 ? preferredCountries[0] :
236
238
  onlyCountries.length > 0 ? onlyCountries.sort()[0] :
239
+ excludeCountries.length > 0 ? excludeCountries.sort()[0] :
237
240
  "af";
238
241
 
239
242
  useEffect(() => {
@@ -244,6 +247,7 @@ const PhoneNumberInput = (props: PhoneNumberInputProps, ref?: React.MutableRefOb
244
247
  autoInsertDialCode: false,
245
248
  initialCountry: initialCountry || fallbackCountry,
246
249
  onlyCountries,
250
+ excludeCountries,
247
251
  countrySearch: countrySearch,
248
252
  fixDropdownWidth: false,
249
253
  formatAsYouType: formatAsYouType,
@@ -0,0 +1,4 @@
1
+ <%= pb_rails("phone_number_input", props: {
2
+ initial_country: 'gb',
3
+ exclude_countries: ['us', 'br']
4
+ }) %>
@@ -0,0 +1,15 @@
1
+ import React from 'react'
2
+ import PhoneNumberInput from '../../pb_phone_number_input/_phone_number_input'
3
+
4
+ const PhoneNumberInputExcludeCountries = (props) => (
5
+ <>
6
+ <PhoneNumberInput
7
+ excludeCountries={['us', 'br']}
8
+ id='exclude'
9
+ initialCountry='gb'
10
+ {...props}
11
+ />
12
+ </>
13
+ )
14
+
15
+ export default PhoneNumberInputExcludeCountries
@@ -0,0 +1 @@
1
+ Excluding countries removes the selected countries from the dropdown.
@@ -6,7 +6,7 @@ const PhoneNumberInputOnlyCountries = (props) => (
6
6
  <PhoneNumberInput
7
7
  id='only'
8
8
  onlyCountries={['us', 'br']}
9
- {...props}
9
+ {...props}
10
10
  />
11
11
  </>
12
12
  )
@@ -4,7 +4,8 @@ examples:
4
4
  - phone_number_input_default: Default
5
5
  - phone_number_input_preferred_countries: Preferred Countries
6
6
  - phone_number_input_initial_country: Initial Country
7
- - phone_number_input_only_countries: Limited Countries
7
+ - phone_number_input_only_countries: Only Countries
8
+ - phone_number_input_exclude_countries: Exclude Countries
8
9
  - phone_number_input_validation: Form Validation
9
10
  - phone_number_input_clear_field: Clearing the Input Field
10
11
  - phone_number_input_access_input_element: Accessing the Input Element
@@ -15,9 +16,9 @@ examples:
15
16
  - phone_number_input_default: Default
16
17
  - phone_number_input_preferred_countries: Preferred Countries
17
18
  - phone_number_input_initial_country: Initial Country
18
- - phone_number_input_only_countries: Limited Countries
19
+ - phone_number_input_only_countries: Only Countries
20
+ - phone_number_input_exclude_countries: Exclude Countries
19
21
  - phone_number_input_validation: Form Validation
20
22
  - phone_number_input_format: Format as You Type
21
23
  - phone_number_input_hidden_inputs: Hidden Inputs
22
24
  - phone_number_input_country_search: Country Search
23
-
@@ -2,6 +2,7 @@ export { default as PhoneNumberInputDefault } from './_phone_number_input_defaul
2
2
  export { default as PhoneNumberInputPreferredCountries } from './_phone_number_input_preferred_countries'
3
3
  export { default as PhoneNumberInputInitialCountry } from './_phone_number_input_initial_country'
4
4
  export { default as PhoneNumberInputOnlyCountries } from './_phone_number_input_only_countries'
5
+ export { default as PhoneNumberInputExcludeCountries } from './_phone_number_input_exclude_countries'
5
6
  export { default as PhoneNumberInputValidation } from './_phone_number_input_validation'
6
7
  export { default as PhoneNumberInputClearField } from './_phone_number_input_clear_field'
7
8
  export { default as PhoneNumberInputAccessInputElement } from './_phone_number_input_access_input_element'
@@ -15,6 +15,8 @@ module Playbook
15
15
  default: ""
16
16
  prop :only_countries, type: Playbook::Props::Array,
17
17
  default: []
18
+ prop :exclude_countries, type: Playbook::Props::Array,
19
+ default: []
18
20
  prop :preferred_countries, type: Playbook::Props::Array,
19
21
  default: []
20
22
  prop :error, type: Playbook::Props::String,
@@ -44,6 +46,7 @@ module Playbook
44
46
  label: label,
45
47
  name: name,
46
48
  onlyCountries: only_countries,
49
+ excludeCountries: exclude_countries,
47
50
  preferredCountries: preferred_countries,
48
51
  required: required,
49
52
  value: value,
@@ -3,7 +3,7 @@
3
3
  @import "../../pb_caption/caption_mixin";
4
4
 
5
5
  @media only screen and (max-width: $screen-xs-max) {
6
- [class^=pb_table] {
6
+ [class^=pb_table]:not(.table-responsive-scroll) {
7
7
  &.table-sm.table-collapse-sm,
8
8
  &.table-md.table-collapse-sm,
9
9
  &.table-lg.table-collapse-sm {