playbook_ui 13.27.0.pre.alpha.PLAY1342DRYcontenttagRailssimplekits2896 → 13.27.0.pre.alpha.PLAY1349checkboxzindexsticky2936

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.
Files changed (77) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +1 -0
  3. data/app/pb_kits/playbook/pb_checkbox/_checkbox.scss +0 -2
  4. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +21 -10
  5. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleIcon.tsx +92 -0
  6. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +3 -75
  7. data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.html.erb +15 -0
  8. data/app/pb_kits/playbook/pb_collapsible/collapsible_icon.rb +37 -0
  9. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.jsx +72 -0
  10. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main.md +3 -0
  11. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.html.erb +19 -0
  12. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_rails.md +3 -0
  13. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.jsx +73 -0
  14. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon.md +3 -0
  15. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.html.erb +20 -0
  16. data/app/pb_kits/playbook/pb_collapsible/docs/_collapsible_custom_main_with_icon_rails.md +3 -0
  17. data/app/pb_kits/playbook/pb_collapsible/docs/example.yml +7 -0
  18. data/app/pb_kits/playbook/pb_collapsible/docs/index.js +3 -1
  19. data/app/pb_kits/playbook/pb_collapsible/index.js +16 -6
  20. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_default_swift.md +61 -0
  21. data/app/pb_kits/playbook/pb_date_range_inline/docs/_date_range_inline_props_swift.md +11 -0
  22. data/app/pb_kits/playbook/pb_date_range_inline/docs/example.yml +4 -1
  23. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_bold_swift.md +32 -0
  24. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_default_swift.md +17 -0
  25. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_not_current_year_swift.md +19 -0
  26. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_props_swift.md +10 -0
  27. data/app/pb_kits/playbook/pb_date_stacked/docs/_date_stacked_reversed_swift.md +17 -0
  28. data/app/pb_kits/playbook/pb_date_stacked/docs/example.yml +7 -0
  29. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_alignment_swift.md +39 -0
  30. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_default_swift.md +39 -0
  31. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_props_swift.md +15 -0
  32. data/app/pb_kits/playbook/pb_date_time/docs/_date_time_size_swift.md +78 -0
  33. data/app/pb_kits/playbook/pb_date_time/docs/example.yml +6 -0
  34. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +4 -0
  35. data/app/pb_kits/playbook/pb_dropdown/_dropdown.tsx +1 -4
  36. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_default.md +1 -1
  37. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure.md +5 -6
  38. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_subcomponent_structure_rails.md +6 -0
  39. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.jsx +6 -3
  40. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display.md +3 -3
  41. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_display.html.erb → _dropdown_with_custom_display_rails.html.erb} +11 -6
  42. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.md +5 -0
  43. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.jsx +5 -2
  44. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options.md +1 -1
  45. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_options.html.erb → _dropdown_with_custom_options_rails.html.erb} +13 -8
  46. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_options_rails.md +1 -0
  47. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_padding.md +1 -1
  48. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.jsx +5 -2
  49. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger.md +1 -1
  50. data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_with_custom_trigger.html.erb → _dropdown_with_custom_trigger_rails.html.erb} +13 -8
  51. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_trigger_rails.md +1 -0
  52. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +1 -1
  53. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -6
  54. data/app/pb_kits/playbook/pb_dropdown/dropdown.test.jsx +1 -1
  55. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.html.erb +2 -8
  56. data/app/pb_kits/playbook/pb_dropdown/dropdown_option.rb +2 -6
  57. data/app/pb_kits/playbook/pb_dropdown/subcomponents/DropdownOption.tsx +2 -12
  58. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_children_swift.md +23 -0
  59. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_close_swift.md +7 -0
  60. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_default_swift.md +9 -0
  61. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_dismiss_with_timer_swift.md +22 -0
  62. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_multi_line_swift.md +9 -0
  63. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_positions_swift.md +62 -0
  64. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/_fixed_confirmation_toast_props_swift.md +8 -0
  65. data/app/pb_kits/playbook/pb_fixed_confirmation_toast/docs/example.yml +9 -0
  66. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +1 -1
  67. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +1 -1
  68. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +1 -1
  69. data/app/pb_kits/playbook/pb_select/_select.scss +8 -0
  70. data/app/pb_kits/playbook/pb_text_input/_text_input.scss +19 -0
  71. data/dist/menu.yml +2 -2
  72. data/dist/playbook-rails.js +5 -5
  73. data/lib/playbook/forms/builder/phone_number_field.rb +12 -0
  74. data/lib/playbook/forms/builder.rb +1 -0
  75. data/lib/playbook/version.rb +1 -1
  76. metadata +40 -6
  77. /data/app/pb_kits/playbook/pb_dropdown/docs/{_dropdown_subcomponent_structure.html.erb → _dropdown_subcomponent_structure_rails.html.erb} +0 -0
@@ -0,0 +1,11 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **date** | `Date` | Sets the date | `Date()` | |
5
+ | **size** | `PBFont` | Sets the font size | `.body` | `.body` `.caption` `.subcaption` |
6
+ | **iconSize** | `PBIcon.IconSize` | Sets the icon size | `.xSmall` | `xSmall` `small` `large` `x1` |
7
+ | **startDate** | `String` | Takes a string value to set the starting date range value | | |
8
+ | **endDate** | `String` | Takes a string value to set the ending date range value | | |
9
+ | **startVariant** | `PBDate.Variant` | Changes the style of the starting date | `.standard` | `.short(showIcon: false)` `.dayDate` `.standard` `.withIcon(isStandard: true)` `withIcon(isStandard: false)` |
10
+ | **endVariant** | `PBDate.Variant` | Changes the style of the ending date | `.standard` | `.short(showIcon: false)` `.dayDate` `.standard` `.withIcon(isStandard: true)` `withIcon(isStandard: false)` |
11
+ | **isArrowIconBold** | `Bool` | Determines if the date range arrow is bold | `false` | `true` `false` |
@@ -6,4 +6,7 @@ examples:
6
6
 
7
7
  react:
8
8
  - date_range_inline_default: Default
9
-
9
+
10
+ swift:
11
+ - date_range_inline_default_swift: Default
12
+ - date_range_inline_props_swift: ""
@@ -0,0 +1,32 @@
1
+ ![Date-Stacked-Bold](https://github.com/powerhome/playbook-swift/assets/54749071/e241e4b8-efce-4872-99f9-aefb1e3007d2)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.small) {
4
+ PBDateStacked(
5
+ alignment: .leading,
6
+ date: Date(),
7
+ variant: .short(showIcon: false),
8
+ dateSize: .title4,
9
+ isMonthStacked: true,
10
+ isMonthBold: true
11
+ )
12
+ PBDateStacked(
13
+ alignment: .center,
14
+ date: Date().makeDate(year: 2018, month: 3, day: 20),
15
+ variant: .standard,
16
+ dateSize: .title4,
17
+ isStandardStacked: true,
18
+ isYearBold: true,
19
+ isMonthBold: true
20
+ )
21
+ .frame(maxWidth: .infinity, alignment: .center)
22
+ PBDateStacked(
23
+ alignment: .trailing,
24
+ date: Date(),
25
+ variant: .short(showIcon: false),
26
+ dateSize: .title4,
27
+ isMonthStacked: true,
28
+ isMonthBold: true
29
+ )
30
+ .frame(maxWidth: .infinity, alignment: .trailing)
31
+ }
32
+ ```
@@ -0,0 +1,17 @@
1
+ ![Date-Stacked-Default](https://github.com/powerhome/playbook-swift/assets/54749071/5185a6b6-534a-43c0-8c87-abecf770b8f5)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.small) {
4
+ PBDateStacked(
5
+ date: Date(),
6
+ variant: .short(showIcon: false),
7
+ dateSize: .title4,
8
+ isMonthStacked: true
9
+ )
10
+ PBDateStacked(
11
+ date: Date(),
12
+ variant: .short(showIcon: false),
13
+ dateSize: .title3,
14
+ isMonthStacked: true
15
+ )
16
+ }
17
+ ```
@@ -0,0 +1,19 @@
1
+ ![Date-Stacked-Not-Current-Year](https://github.com/powerhome/playbook-swift/assets/54749071/f778f10f-21c3-42b9-b660-9def6c75ecf3)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.small) {
4
+ PBDateStacked(
5
+ alignment: .leading,
6
+ date: Date().makeDate(year: 2018, month: 3, day: 20),
7
+ variant: .standard,
8
+ dateSize: .title4,
9
+ isStandardStacked: true
10
+ )
11
+ PBDateStacked(
12
+ alignment: .leading,
13
+ date: Date().makeDate(year: 2018, month: 3, day: 20),
14
+ variant: .standard,
15
+ dateSize: .title3,
16
+ isStandardStacked: true
17
+ )
18
+ }
19
+ ```
@@ -0,0 +1,10 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **alignment** | `HorizontalAlignment` | Changes the alignment of the date | `.leading` | `.leading` `.trailing` |
5
+ | **dateSize** | `PBFont` |Sets the size of the date | `.body` | `.subcaption` `.caption` `.body` |
6
+ | **isReversed** | `Bool` | Boolean value that determines whether or not the month and date are reversed. | `false` | `true` `false` |
7
+ | **isMonthStacked** | `Bool` | Boolean value that determines whether or not the month is stacked | `false` | `true` `false` |
8
+ | **isStandardStacked** | `Bool` | Boolean value that determines whether or not the standard date variant is stacked. | `false` | `true` `false` |
9
+ | **isYearBold** | `Bool` | Boolean value that determines whether or not the the year is bold | `false` | `true` `false` |
10
+ | **isMonthBold** | `Bool` | Boolean value that determines whether or not the month is bold. | `false` | `true` `false` |
@@ -0,0 +1,17 @@
1
+ ![Date-Stacked-Reversed](https://github.com/powerhome/playbook-swift/assets/54749071/4dc3ff84-3a0d-4d9b-a363-5d649a3bdae6)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.small) {
4
+ PBDateStacked(
5
+ date: Date(),
6
+ variant: .short(showIcon: false),
7
+ dateSize: .title4,
8
+ isReversed: true
9
+ )
10
+ PBDateStacked(
11
+ date: Date(),
12
+ variant: .short(showIcon: false),
13
+ dateSize: .title3,
14
+ isReversed: true
15
+ )
16
+ }
17
+ ```
@@ -15,3 +15,10 @@ examples:
15
15
  - date_stacked_reverse: Day & Month Reverse
16
16
  - date_stacked_sizes: Sizes
17
17
  - date_stacked_bold: Bold
18
+
19
+ swift:
20
+ - date_stacked_default_swift: Default
21
+ - date_stacked_not_current_year_swift: Not Current Year
22
+ - date_stacked_reversed_swift: Day & Month Reverse
23
+ - date_stacked_bold_swift: Bold
24
+ - date_stacked_props_swift: ""
@@ -0,0 +1,39 @@
1
+ ![Date-Time-Alignment](https://github.com/powerhome/playbook-swift/assets/54749071/9d1e08ac-4906-406f-b81d-1edf0a09e2e3)
2
+
3
+ ```swift
4
+ VStack(spacing: Spacing.small) {
5
+ HStack {
6
+ PBDateTime(
7
+ dateVariant: .short(showIcon: false),
8
+ timeVariant: .iconTimeZone,
9
+ isLowercase: true,
10
+ isTimeBold: true,
11
+ zone: .utc,
12
+ showTimeZone: true,
13
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
14
+ )
15
+ }
16
+ .frame(maxWidth: .infinity, alignment: .leading)
17
+ PBDateTime(
18
+ dateVariant: .short(showIcon: false),
19
+ timeVariant: .iconTimeZone,
20
+ isLowercase: true,
21
+ isTimeBold: true,
22
+ zone: .utc,
23
+ showTimeZone: true,
24
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
25
+ )
26
+ HStack {
27
+ PBDateTime(
28
+ dateVariant: .short(showIcon: false),
29
+ timeVariant: .iconTimeZone,
30
+ isLowercase: true,
31
+ isTimeBold: true,
32
+ zone: .utc,
33
+ showTimeZone: true,
34
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
35
+ )
36
+ }
37
+ .frame(maxWidth: .infinity, alignment: .trailing)
38
+ }
39
+ ```
@@ -0,0 +1,39 @@
1
+ ![Date-Time-Default](https://github.com/powerhome/playbook-swift/assets/54749071/f9ea63f9-81bd-41a9-8171-8a213c55ccfe)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.small) {
4
+ PBDateTime(
5
+ dateVariant: .dayDate(showYear: true),
6
+ timeVariant: .iconTimeZone,
7
+ isLowercase: true,
8
+ isTimeBold: true,
9
+ timeZoneIdentifier: "EST"
10
+ )
11
+ PBDateTime(
12
+ dateVariant: .dayDate(showYear: false),
13
+ timeVariant: .iconTimeZone,
14
+ isLowercase: true,
15
+ isTimeBold: true,
16
+ zone: .utc,
17
+ showTimeZone: true,
18
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
19
+ )
20
+ PBDateTime(
21
+ dateVariant: .short(showIcon: false),
22
+ timeVariant: .iconTimeZone,
23
+ isLowercase: true,
24
+ isTimeBold: true,
25
+ zone: .utc,
26
+ showTimeZone: true,
27
+ timeZoneIdentifier: "2012-08-02T17:49:29Z",
28
+ showIcon: true
29
+ )
30
+ PBDateTime(
31
+ dateVariant: .standard,
32
+ timeVariant: .iconTimeZone,
33
+ isLowercase: true,
34
+ isTimeBold: true,
35
+ showTimeZone: true,
36
+ timeZoneIdentifier: "GMT+9"
37
+ )
38
+ }
39
+ ```
@@ -0,0 +1,15 @@
1
+ ### Props
2
+ | Name | Type | Description | Default | Values |
3
+ | --- | ----------- | --------- | --------- | --------- |
4
+ | **dateTime** | `Date` | Sets current date. | | |
5
+ | **iconSize** | `PBIcon.IconSize` | Allows user to change the size of the clock icon. | `.x3` | `.small` `.medium` `.large` |
6
+ | **dateVariant** | `PBDate.Variant` | Allows user to choose how they would like the date to be displayed | `.dayDate(showYear: false)` | `.short` `.dayDate(showYear: false)` `.standard` `.withIcon(isStandard: true)` `.withIcon(isStandard: false)` |
7
+ | **timeVariant** | `PBTime.Variant` | Allows user to choose how they would like the time to be displayed | `.time` | `.time` `.clockIcon` `.timeZone` `.iconTimeZone` `.withTimeZoneHeader` |
8
+ | **fontSize** | `PBFont` | Allows user to change the size of the text | `.caption` | `.subcaption` `.caption` `.body` |
9
+ | **isLowercase** | `Bool` | Determines whether or not am/pm is capitalized | `false` | `true` `false` |
10
+ | **isTimeBold** | `Bool` | Determines whether or not the time is bold | `false` | `true` `false` |
11
+ | **isTimeZoneBold** | `Bool` | Determines whether or not the time zone is bold | `false` | `true` `false` |
12
+ | **zone** | `PBTime.Zones` | Allows the user to set the time zone | `.east` | `.east` `.central` `.mountain` `.pacific` `.gmt` |
13
+ | **showTimeZone** | `Bool` | Determines whether or not the time zone is displayed | `false` | `true` `false` |
14
+ | **timeZoneIdentifier** | `String` | String that the time kit utilizes to calculate the current time and time zone | | |
15
+ | **showIcon** | `Bool` | Determines whether or not the clock icon is displayed | `false` | `true` `false` |
@@ -0,0 +1,78 @@
1
+ ![Date-Time-Sizes](https://github.com/powerhome/playbook-swift/assets/54749071/59b2394d-cf25-46b5-a634-ca0721a7b3b0)
2
+ ```swift
3
+ VStack(alignment: .leading, spacing: Spacing.xSmall) {
4
+ PBDateTime(
5
+ dateVariant: .dayDate(showYear: false),
6
+ timeVariant: .iconTimeZone,
7
+ fontSize: .caption,
8
+ zone: .utc,
9
+ showTimeZone: true,
10
+ timeZoneIdentifier: "2012-08-02T17:49:29Z",
11
+ showIcon: true
12
+ )
13
+ PBDateTime(
14
+ dateVariant: .dayDate(showYear: false),
15
+ timeVariant: .iconTimeZone,
16
+ fontSize: .caption,
17
+ zone: .utc,
18
+ showTimeZone: true,
19
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
20
+ )
21
+ PBDateTime(
22
+ dateVariant: .short(showIcon: false),
23
+ timeVariant: .iconTimeZone,
24
+ fontSize: .caption,
25
+ zone: .utc,
26
+ showTimeZone: true,
27
+ timeZoneIdentifier: "2012-08-02T17:49:29Z",
28
+ showIcon: true
29
+ )
30
+ PBDateTime(
31
+ dateVariant: .short(showIcon: false),
32
+ timeVariant: .iconTimeZone,
33
+ fontSize: .caption,
34
+ zone: .utc,
35
+ showTimeZone: true,
36
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
37
+ )
38
+ Spacer()
39
+ PBDateTime(
40
+ dateVariant: .dayDate(showYear: false),
41
+ timeVariant: .iconTimeZone,
42
+ isLowercase: true,
43
+ isTimeBold: true,
44
+ zone: .utc,
45
+ showTimeZone: true,
46
+ timeZoneIdentifier: "2012-08-02T17:49:29Z",
47
+ showIcon: true
48
+ )
49
+ PBDateTime(
50
+ dateVariant: .dayDate(showYear: false),
51
+ timeVariant: .iconTimeZone,
52
+ isLowercase: true,
53
+ isTimeBold: true,
54
+ zone: .utc,
55
+ showTimeZone: true,
56
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
57
+ )
58
+ PBDateTime(
59
+ dateVariant: .short(showIcon: false),
60
+ timeVariant: .iconTimeZone,
61
+ isLowercase: true,
62
+ isTimeBold: true,
63
+ zone: .utc,
64
+ showTimeZone: true,
65
+ timeZoneIdentifier: "2012-08-02T17:49:29Z",
66
+ showIcon: true
67
+ )
68
+ PBDateTime(
69
+ dateVariant: .short(showIcon: false),
70
+ timeVariant: .iconTimeZone,
71
+ isLowercase: true,
72
+ isTimeBold: true,
73
+ zone: .utc,
74
+ showTimeZone: true,
75
+ timeZoneIdentifier: "2012-08-02T17:49:29Z"
76
+ )
77
+ }
78
+ ```
@@ -9,3 +9,9 @@ examples:
9
9
  - date_time_default: Default
10
10
  - date_time_align: Alignment
11
11
  - date_time_size: Size
12
+
13
+ swift:
14
+ - date_time_default_swift: Default
15
+ - date_time_alignment_swift: Alignment
16
+ - date_time_size_swift: Size
17
+ - date_time_props_swift: ""
@@ -63,6 +63,10 @@
63
63
  width: 100%;
64
64
 
65
65
  [class*="pb_dropdown_option"] {
66
+ padding-left: $space_sm;
67
+ padding-right: $space_sm;
68
+ padding-top: $space_xs;
69
+ padding-bottom: $space_xs;
66
70
  cursor: pointer;
67
71
  &:hover {
68
72
  background-color: $border_light;
@@ -4,7 +4,6 @@ import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from "../uti
4
4
  import { globalProps } from "../utilities/globalProps";
5
5
  import { GenericObject } from "../types";
6
6
 
7
- import Body from "../pb_body/_body";
8
7
  import Caption from "../pb_caption/_caption";
9
8
 
10
9
  import DropdownContainer from "./subcomponents/DropdownContainer";
@@ -235,9 +234,7 @@ const Dropdown = (props: DropdownProps) => {
235
234
  options?.map((option: GenericObject) => (
236
235
  <Dropdown.Option key={option.id}
237
236
  option={option}
238
- >
239
- <Body text={option.label} />
240
- </Dropdown.Option>
237
+ />
241
238
  ))}
242
239
  </DropdownContainer>
243
240
  </>
@@ -1 +1 @@
1
- The Dropdown kit accepts an `options` array and renders each object from that array as a selectable option within a dropdown container. `options` is a required prop and must be an array of objects. Each object can contain as many key/value pairs as needed but MUST contain 'label' and 'value' as the only required items within each object.
1
+ This kit's `options` prop requires an array of objects, each of which will be used as the selectable options within the dropdown. Each option object can support any number of key-value pairs, but each must contain `label` and `value`.
@@ -1,7 +1,6 @@
1
- The dropdown comes with the following subcomponents that can be used to achieve various levels of customization:
1
+ The dropdown is built using all of the following subcomponents:
2
2
 
3
- `Dropdown. Trigger` / `dropdown/dropdown_trigger`
4
- `Dropdown.Container`/ `dropdown/dropdown_container`
5
- `Dropdown.Option` / `dropdown/dropdown_option`
6
-
7
- See the code snippet below for a visual on how to use the kit with subcomponents. Each subcomponent allows for GlobalProps in addition to any subcomponent specfic props.
3
+ `Dropdown.Trigger` is the UI component that users interact with to toggle the dropdown.
4
+ `Dropdown.Container` is the floating container that wraps the list of dropdown options.
5
+ `Dropdown.Option` renders options that are passed to the container.
6
+ Each of these subcomponents can be altered using global props and/or their respective props. See doc examples below for more information on each.
@@ -0,0 +1,6 @@
1
+ The dropdown is built using all of the following required subcomponents:
2
+
3
+ `dropdown/dropdown_trigger` is the UI component that users interact with to toggle the dropdown.
4
+ `dropdown/dropdown_container` is the floating container that wraps the list of dropdown options.
5
+ `dropdown/dropdown_option` renders options that are passed to the container.
6
+ Each of these subcomponents can be altered using global props and/or their respective props. See doc examples below for more information on each.
@@ -1,5 +1,5 @@
1
1
  import React, { useState } from 'react'
2
- import { Dropdown, User, FlexItem, Badge, Avatar } from '../../'
2
+ import { Dropdown, User, Flex, FlexItem, Badge, Avatar } from '../../'
3
3
 
4
4
  const DropdownWithCustomDisplay = (props) => {
5
5
  const [selectedOption, setSelectedOption] = useState();
@@ -69,7 +69,10 @@ const DropdownWithCustomDisplay = (props) => {
69
69
  <Dropdown.Option key={option.id}
70
70
  option={option}
71
71
  >
72
- <>
72
+ <Flex
73
+ align="center"
74
+ justify="between"
75
+ >
73
76
  <FlexItem>
74
77
  <User
75
78
  align="left"
@@ -93,7 +96,7 @@ const DropdownWithCustomDisplay = (props) => {
93
96
  }`}
94
97
  />
95
98
  </FlexItem>
96
- </>
99
+ </Flex>
97
100
  </Dropdown.Option>
98
101
  ))}
99
102
  </Dropdown>
@@ -1,5 +1,5 @@
1
- The `customDisplay` prop can be used to customize the display of the selected item by allowing devs to pass in a component that will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
1
+ Optionally utilize `customDisplay` on the `Dropdown.Trigger` subcomponent to customize its content after an option is selected. The component passed to customDisplay will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
2
2
 
3
- The `placeholder` prop can also be used to customize the placeholder text for the default Trigger.
3
+ The `placeholder` prop can also be used to customize the placeholder text for the default `Dropdown.Trigger`.
4
4
 
5
- The `onSelect` prop is a function that gives the dev one argument: the selected option. In this example we are using the `onSelect` to set a state with the selected option and using it to customize the `customDisplay`.
5
+ The `onSelect` prop returns the selected option as an object to be utilized by the dev. In this example we are using the `onSelect` to set a state with the selected option and using it to customize the `customDisplay`.
@@ -48,12 +48,17 @@
48
48
  <%= pb_rails("dropdown/dropdown_container") do %>
49
49
  <% options.each do |option| %>
50
50
  <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
51
- <%= pb_rails("flex/flex_item") do %>
52
- <%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
53
- <% end %>
54
- <%= pb_rails("flex/flex_item") do %>
55
- <%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
56
- <% end %>
51
+ <%= pb_rails("flex", props: {
52
+ align: "center",
53
+ justify: "between",
54
+ }) do %>
55
+ <%= pb_rails("flex/flex_item") do %>
56
+ <%= pb_rails("user", props: {name: option[:label], align:"left", avatar: true, orientation:"horizontal", territory:option[:territory], title: option[:title]}) %>
57
+ <% end %>
58
+ <%= pb_rails("flex/flex_item") do %>
59
+ <%= pb_rails("badge", props: {rounded: true, dark: true, text: option[:status], variant: option[:status] == "Offline" ? "neutral" : option[:status] == "Online" ? "success" : "warning" }) %>
60
+ <% end %>
61
+ <% end %>
57
62
  <% end %>
58
63
  <% end %>
59
64
  <% end %>
@@ -0,0 +1,5 @@
1
+ Optionally utilize `custom_display` on the `dropdown/dropdown_trigger` subcomponent to customize its content after an option is selected. The component passed to custom_display will be rendered to the left of the default text-based display. In this example the Avatar kit is being used.
2
+
3
+ The `placeholder` prop can also be used to customize the placeholder text for the default `dropdown/dropdown_trigger`.
4
+
5
+ The dropdown follows the typical rails pattern of utilizing hidden inputs for form submission. The hidden input value is the selected options' id.
@@ -38,7 +38,10 @@ const DropdownWithCustomOptions = (props) => {
38
38
  <Dropdown.Option key={option.id}
39
39
  option={option}
40
40
  >
41
- <>
41
+ <Flex
42
+ align="center"
43
+ justify="between"
44
+ >
42
45
  <FlexItem>
43
46
  <Flex>
44
47
  <Icon icon={option.icon}
@@ -52,7 +55,7 @@ const DropdownWithCustomOptions = (props) => {
52
55
  text={option.areaCode}
53
56
  />
54
57
  </FlexItem>
55
- </>
58
+ </Flex>
56
59
  </Dropdown.Option>
57
60
  ))}
58
61
  </Dropdown>
@@ -1 +1 @@
1
- The Dropdown also allows for custom options that can be passed in as children to the `Dropdown.Option` subcomponent. If no children are passed to `Dropdown.Option`, the kit will render each option as text within a Body kit by default.
1
+ `Dropdown.Option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
@@ -30,14 +30,19 @@
30
30
  <%= pb_rails("dropdown/dropdown_container") do %>
31
31
  <% options.each do |option| %>
32
32
  <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
33
- <%= pb_rails("flex/flex_item") do %>
34
- <%= pb_rails("flex") do %>
35
- <%= pb_rails("icon", props: {icon: option[:icon]}) %>
36
- <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
37
- <% end %>
38
- <% end %>
39
- <%= pb_rails("flex/flex_item") do %>
40
- <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
33
+ <%= pb_rails("flex", props: {
34
+ align: "center",
35
+ justify: "between",
36
+ }) do %>
37
+ <%= pb_rails("flex/flex_item") do %>
38
+ <%= pb_rails("flex") do %>
39
+ <%= pb_rails("icon", props: {icon: option[:icon]}) %>
40
+ <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
41
+ <% end %>
42
+ <% end %>
43
+ <%= pb_rails("flex/flex_item") do %>
44
+ <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
45
+ <% end %>
41
46
  <% end %>
42
47
  <% end %>
43
48
  <% end %>
@@ -0,0 +1 @@
1
+ `dropdown/dropdown_option` subcomponent accepts any child components to customize the options' contents and display. By default, options are Body kit text that is set by the `label` value from the `option` object.
@@ -1 +1 @@
1
- By default, the padding on each option in the dropdown is set to `xs`. The `padding` Global Props however can be used to override this default. In this example, we are setting padding to `sm`.
1
+ By default, dropdown option paddingX is set to `sm` and paddingY is set to `xs`, but this padding can be overridden using our global padding props. In this example we are setting the option padding to `sm` all around.
@@ -51,7 +51,10 @@ const [selectedOption, setSelectedOption] = useState();
51
51
  <Dropdown.Option key={option.id}
52
52
  option={option}
53
53
  >
54
- <>
54
+ <Flex
55
+ align="center"
56
+ justify="between"
57
+ >
55
58
  <FlexItem>
56
59
  <Flex>
57
60
  <Icon icon={option.icon}
@@ -65,7 +68,7 @@ const [selectedOption, setSelectedOption] = useState();
65
68
  text={option.areaCode}
66
69
  />
67
70
  </FlexItem>
68
- </>
71
+ </Flex>
69
72
  </Dropdown.Option>
70
73
  ))}
71
74
  </Dropdown.Container>
@@ -1 +1 @@
1
- The Dropdown can also be given a custom Trigger by passing children to the `Dropdown.Trigger` subcomponent as shown in this example. Here we are using the IconCircle kit.
1
+ Optionally replace the default trigger's select element by passing child components directly to the `Dropdown.Trigger`.
@@ -32,15 +32,20 @@
32
32
  <%= pb_rails("dropdown/dropdown_container", props:{max_width:"xs"}) do %>
33
33
  <% options.each do |option| %>
34
34
  <%= pb_rails("dropdown/dropdown_option", props: {option: option}) do %>
35
+ <%= pb_rails("flex", props: {
36
+ align: "center",
37
+ justify: "between",
38
+ }) do %>
35
39
  <%= pb_rails("flex/flex_item") do %>
36
- <%= pb_rails("flex") do %>
37
- <%= pb_rails("icon", props: {icon: option[:icon]}) %>
38
- <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
39
- <% end %>
40
- <% end %>
41
- <%= pb_rails("flex/flex_item") do %>
42
- <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
43
- <% end %>
40
+ <%= pb_rails("flex") do %>
41
+ <%= pb_rails("icon", props: {icon: option[:icon]}) %>
42
+ <%= pb_rails("body", props: {text: option[:label], padding_left:"xs"}) %>
43
+ <% end %>
44
+ <% end %>
45
+ <%= pb_rails("flex/flex_item") do %>
46
+ <%= pb_rails("body", props: {color:"light", text: option[:areaCode]}) %>
47
+ <% end %>
48
+ <% end %>
44
49
  <% end %>
45
50
  <% end %>
46
51
  <% end %>
@@ -0,0 +1 @@
1
+ Optionally replace the default trigger's select element by passing child components directly to the `dropdown/dropdown_trigger`.
@@ -1 +1 @@
1
- The optional `label` prop takes a string value that if present will render that string as the label for the Dropdown.
1
+ The top-level Dropdown component optionally accepts any string through a `label` prop to produce a label above your trigger element.
@@ -1,12 +1,12 @@
1
1
  examples:
2
2
  rails:
3
3
  - dropdown_default: Default
4
- - dropdown_subcomponent_structure: Subcomponent Structure
4
+ - dropdown_subcomponent_structure_rails: Subcomponent Structure
5
5
  - dropdown_with_label: With Label
6
- - dropdown_with_custom_options: Custom Options
7
- - dropdown_with_custom_display: Custom Display
8
- - dropdown_with_custom_trigger: Custom Trigger
9
- - dropdown_with_custom_padding: Custom Padding for Dropdown Options
6
+ - dropdown_with_custom_options_rails: Custom Options
7
+ - dropdown_with_custom_display_rails: Custom Display
8
+ - dropdown_with_custom_trigger_rails: Custom Trigger
9
+ - dropdown_with_custom_padding: Custom Option Padding
10
10
 
11
11
  react:
12
12
  - dropdown_default: Default
@@ -15,7 +15,7 @@ examples:
15
15
  - dropdown_with_custom_options: Custom Options
16
16
  - dropdown_with_custom_display: Custom Display
17
17
  - dropdown_with_custom_trigger: Custom Trigger
18
- - dropdown_with_custom_padding: Custom Padding for Dropdown Options
18
+ - dropdown_with_custom_padding: Custom Option Padding
19
19
  # - dropdown_with_autocomplete: Autocomplete
20
20
  # - dropdown_with_autocomplete_and_custom_display: Autocomplete with Custom Display
21
21
  # - dropdown_with_external_control: useDropdown Hook
@@ -203,5 +203,5 @@ test('selected option on click', () => {
203
203
  const kit = screen.getByTestId(testId)
204
204
  const option = kit.querySelector('.pb_dropdown_option_list')
205
205
  option.click()
206
- expect(option).toHaveClass('pb_dropdown_option_selected p_xs')
206
+ expect(option).toHaveClass('pb_dropdown_option_selected')
207
207
  })