playbook_ui_docs 16.1.0.pre.alpha.HFH3979Applydepwarningfixtoplaybook13820 → 16.1.0.pre.alpha.PLAY2684iconbuttonvariant14251

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 (84) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.jsx +71 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_background_custom.md +4 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_sort.md +1 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +1 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  7. data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.html.erb +21 -0
  8. data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant.jsx +180 -0
  9. data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_rails.md +1 -0
  10. data/app/pb_kits/playbook/pb_button/docs/_button_icon_variant_react.md +1 -0
  11. data/app/pb_kits/playbook/pb_button/docs/example.yml +2 -0
  12. data/app/pb_kits/playbook/pb_button/docs/index.js +1 -0
  13. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.html.erb +6 -0
  14. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.jsx +17 -0
  15. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_required_indicator.md +3 -0
  16. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +2 -0
  17. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +1 -0
  18. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_default.md +1 -0
  19. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_rails.md +3 -0
  20. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_blank_selection_react.md +3 -0
  21. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.html.erb +52 -0
  22. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.jsx +72 -0
  23. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_clearable.md +5 -0
  24. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height.jsx +33 -0
  25. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.html.erb +20 -0
  26. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_rails.md +8 -0
  27. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_constrain_height_react.md +8 -0
  28. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_custom_display_rails.html.erb +1 -1
  29. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.html.erb +6 -3
  30. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.jsx +1 -0
  31. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_label.md +3 -1
  32. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.html.erb +9 -0
  33. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.jsx +33 -0
  34. data/app/pb_kits/playbook/pb_dropdown/docs/_dropdown_with_placeholder.md +3 -0
  35. data/app/pb_kits/playbook/pb_dropdown/docs/example.yml +6 -0
  36. data/app/pb_kits/playbook/pb_dropdown/docs/index.js +4 -1
  37. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.html.erb +2 -2
  38. data/app/pb_kits/playbook/pb_filter/docs/_filter_default.jsx +16 -9
  39. data/app/pb_kits/playbook/pb_form/docs/_form_with_required_indicator.html.erb +6 -2
  40. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.html.erb +5 -5
  41. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_truncated_text.jsx +4 -4
  42. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.html.erb +3 -3
  43. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.jsx +4 -7
  44. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_label.md +3 -0
  45. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.html.erb +24 -0
  46. data/app/pb_kits/playbook/pb_nav/docs/_collapsible_nav_disabled_item.jsx +87 -0
  47. data/app/pb_kits/playbook/pb_nav/docs/example.yml +2 -6
  48. data/app/pb_kits/playbook/pb_nav/docs/index.js +2 -1
  49. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_meter_settings.jsx +1 -0
  50. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.html.erb +7 -0
  51. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.jsx +24 -0
  52. data/app/pb_kits/playbook/pb_passphrase/docs/_passphrase_required_indicator.md +3 -0
  53. data/app/pb_kits/playbook/pb_passphrase/docs/example.yml +2 -0
  54. data/app/pb_kits/playbook/pb_passphrase/docs/index.js +1 -0
  55. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.html.erb +5 -0
  56. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.jsx +14 -0
  57. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_required_indicator.md +3 -0
  58. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +2 -0
  59. data/app/pb_kits/playbook/pb_phone_number_input/docs/index.js +1 -0
  60. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.jsx +44 -0
  61. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_label.md +1 -0
  62. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_advanced_required_indicator.jsx +1 -0
  63. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.jsx +28 -0
  64. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_label.md +1 -0
  65. data/app/pb_kits/playbook/pb_rich_text_editor/docs/_rich_text_editor_required_indicator.jsx +1 -0
  66. data/app/pb_kits/playbook/pb_rich_text_editor/docs/example.yml +2 -0
  67. data/app/pb_kits/playbook/pb_rich_text_editor/docs/index.js +2 -0
  68. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.html.erb +3 -3
  69. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.jsx +3 -0
  70. data/app/pb_kits/playbook/pb_textarea/docs/_textarea_default.md +1 -0
  71. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_on_handler.jsx +5 -2
  72. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.html.erb +6 -0
  73. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.jsx +16 -0
  74. data/app/pb_kits/playbook/pb_time_picker/docs/_time_picker_required_indicator.md +3 -0
  75. data/app/pb_kits/playbook/pb_time_picker/docs/example.yml +2 -0
  76. data/app/pb_kits/playbook/pb_time_picker/docs/index.js +1 -0
  77. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.html.erb +16 -0
  78. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.jsx +23 -0
  79. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_required_indicator.md +3 -0
  80. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.html.erb +1 -1
  81. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_truncated_text.jsx +1 -1
  82. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +2 -0
  83. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +22 -21
  84. metadata +44 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 10c65f629d144c2c8576891755fce49a77b111640acb0a4e04c88e795834f98b
4
- data.tar.gz: 3ab2eae1566e2063d744d49fe96d9017024323648bd42f180c1c4fceddc30916
3
+ metadata.gz: e18f62273ec925c94ff02108912de2c0ecfa5e8b4b76e44b6896cad278150d34
4
+ data.tar.gz: f5888f9e954ee60ac3046594b4c9e52999522a89a7c6e0b78dbb09b9b748c10a
5
5
  SHA512:
6
- metadata.gz: ff0f8f212da5d0d153ba3dae38df1f05bfc0f0ba0c422dc95a0c24095d25f67be7ec6bf2c31deb2e9fc8bb2589e9ff6ba4c86c420acc791223ab59dfce860c29
7
- data.tar.gz: 404c22a547b8eba71ef9fbd4be170d34380089eec4b9e52d0bda8a135d9728f0cc98d7ef8a0ef6bc51a7c5c8a51d0cf56ffc3bd993b7b1349b7311f6fa4a3be5
6
+ metadata.gz: 0a3442931f98c002dc51540b8e1f39b3741670417d806f399c582e9a34011b6b43fdd9565b560503b3f52289f41586593eac4d686bcaa94c3f81583a30cabd0a
7
+ data.tar.gz: d27b7b8a40f4a07701970e69c517f99dbd296bb0cfc996e6a846d9e92a4842c68f3e5918971133afc385291adb1929bdb777bcf3a2b3171739c0f3be7eb316aa
@@ -0,0 +1,71 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../_advanced_table'
3
+ import colors from '../../tokens/exports/_colors.module.scss'
4
+ import MOCK_DATA from "./advanced_table_mock_data.json"
5
+ import Flex from '../../pb_flex/_flex'
6
+ import Title from '../../pb_title/_title'
7
+ import Body from '../../pb_body/_body'
8
+
9
+
10
+ const AdvancedTableColumnStylingBackgroundCustom = (props) => {
11
+ const columnDefinitions = [
12
+ {
13
+ accessor: "year",
14
+ label: "Year",
15
+ cellAccessors: ["quarter", "month", "day"],
16
+ customRenderer: (row, value) => (
17
+ <Flex flexDirection="column">
18
+ <Title size={4}
19
+ text={value}
20
+ />
21
+ <Body text="lorem ipsum" />
22
+ <Body text="lorem ipsum" />
23
+ </Flex>
24
+ ),
25
+ },
26
+ {
27
+ accessor: "newEnrollments",
28
+ label: "New Enrollments",
29
+ columnStyling:{
30
+ cellBackgroundColor: (row) => row.original.newEnrollments > 15 ? colors.success_subtle : colors.error_subtle,
31
+ fontColor: (row) => row.original.newEnrollments > 15 ? colors.success : colors.error,
32
+ },
33
+ },
34
+ {
35
+ accessor: "scheduledMeetings",
36
+ label: "Scheduled Meetings",
37
+ columnStyling:{
38
+ cellBackgroundColor: (row) => row.original.scheduledMeetings >= 15 ? colors.info_subtle : colors.warning_subtle
39
+ },
40
+ },
41
+ {
42
+ accessor: "attendanceRate",
43
+ label: "Attendance Rate",
44
+ columnStyling:{cellBackgroundColor: colors.info, headerBackgroundColor: colors.info, fontColor: colors.white, headerFontColor: colors.white},
45
+ },
46
+ {
47
+ accessor: "completedClasses",
48
+ label: "Completed Classes",
49
+ },
50
+ {
51
+ accessor: "classCompletionRate",
52
+ label: "Class Completion Rate",
53
+ },
54
+ {
55
+ accessor: "graduatedStudents",
56
+ label: "Graduated Students",
57
+ },
58
+ ]
59
+
60
+ return (
61
+ <div>
62
+ <AdvancedTable
63
+ columnDefinitions={columnDefinitions}
64
+ tableData={MOCK_DATA}
65
+ {...props}
66
+ />
67
+ </div>
68
+ )
69
+ }
70
+
71
+ export default AdvancedTableColumnStylingBackgroundCustom
@@ -0,0 +1,4 @@
1
+ `cellBackgroundColor` and `fontColor` can also accept functions for conditional styling based on row data. The function receives the row object and returns a color value.
2
+
3
+ See the code snippet below for more details.
4
+
@@ -2,4 +2,4 @@ the `enableSorting` prop is a boolean prop set to false by default. If true, the
2
2
 
3
3
  ### sortIcon
4
4
 
5
- An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-short-wide", "arrow-down-short-wide"]`. All strings must be valid FA icons.
5
+ An optional prop, `sortIcon` allows you to customize your icon sets by passing it an array of any comma-separated pair of icon values. The first icon value will replace the kit's default icon when sort direction is desc, and the second value will replace the default icon when sort direction is asc. `sortIcon` also allows you to pass it a single icon as a string, in which case the icon will not toggle with the sort state. Default for this prop is `["arrow-up-wide-short", "arrow-down-short-wide"]`. All strings must be valid FA icons.
@@ -78,6 +78,7 @@ examples:
78
78
  - advanced_table_column_styling: Column Styling
79
79
  - advanced_table_column_styling_column_headers: Column Styling with Multiple Headers
80
80
  - advanced_table_column_styling_background: Column Styling Background Color
81
+ - advanced_table_column_styling_background_custom: Column Styling Background Color (Custom)
81
82
  - advanced_table_column_styling_background_multi: Column Styling Background Color with Multiple Headers
82
83
  - advanced_table_padding_control: Padding Control using Column Styling
83
84
  - advanced_table_column_border_color: Column Group Border Color
@@ -47,4 +47,5 @@ export { default as AdvancedTableSortPerColumnForMultiColumn } from './_advanced
47
47
  export { default as AdvancedTablePaddingControl } from './_advanced_table_padding_control.jsx'
48
48
  export { default as AdvancedTablePaddingControlPerRow } from './_advanced_table_padding_control_per_row.jsx'
49
49
  export { default as AdvancedTableColumnStylingBackground } from './_advanced_table_column_styling_background.jsx'
50
- export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
50
+ export { default as AdvancedTableColumnStylingBackgroundMulti } from './_advanced_table_column_styling_background_multi.jsx'
51
+ export { default as AdvancedTableColumnStylingBackgroundCustom } from './_advanced_table_column_styling_background_custom.jsx'
@@ -0,0 +1,21 @@
1
+ <%= pb_rails("caption", props: { margin_y: "md", text: "Small Size (sm)" }) %>
2
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", margin_right: "lg" }) %>
3
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "secondary", margin_right: "lg" }) %>
4
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "link", margin_right: "lg" }) %>
5
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", variant: "danger", margin_right: "lg" }) %>
6
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", disabled: true, margin_right: "lg" }) %>
7
+ <%= pb_rails("button", props: { icon: "plus", size: "sm", loading: true, margin_right: "lg" }) %>
8
+ <%= pb_rails("caption", props: { margin_y: "md", text: "Medium Size (md)" }) %>
9
+ <%= pb_rails("button", props: { icon: "plus", size: "md", margin_right: "lg" }) %>
10
+ <%= pb_rails("button", props: { icon: "plus", size: "md", variant: "secondary", margin_right: "lg" }) %>
11
+ <%= pb_rails("button", props: { icon: "plus", size: "md", variant: "link", margin_right: "lg" }) %>
12
+ <%= pb_rails("button", props: { icon: "plus", size: "md", variant: "danger", margin_right: "lg" }) %>
13
+ <%= pb_rails("button", props: { icon: "plus", size: "md", disabled: true, margin_right: "lg" }) %>
14
+ <%= pb_rails("button", props: { icon: "plus", size: "md", loading: true, margin_right: "lg" }) %>
15
+ <%= pb_rails("caption", props: { margin_y: "md", text: "Large Size (lg)" }) %>
16
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", margin_right: "lg" }) %>
17
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "secondary", margin_right: "lg" }) %>
18
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "link", margin_right: "lg" }) %>
19
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", variant: "danger", margin_right: "lg" }) %>
20
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", disabled: true, margin_right: "lg" }) %>
21
+ <%= pb_rails("button", props: { icon: "plus", size: "lg", loading: true, margin_right: "lg" }) %>
@@ -0,0 +1,180 @@
1
+ import React from 'react'
2
+ import Button from "../../pb_button/_button"
3
+ import Caption from "../../pb_caption/_caption"
4
+
5
+ const ButtonIconVariant = (props) => (
6
+ <div>
7
+ <Caption
8
+ marginY="md"
9
+ text="Small Size (sm)"
10
+ />
11
+ <Button
12
+ icon="plus"
13
+ marginRight='lg'
14
+ size="sm"
15
+ tabIndex={0}
16
+ {...props}
17
+ />
18
+ {' '}
19
+ <Button
20
+ icon="plus"
21
+ marginRight='lg'
22
+ size="sm"
23
+ tabIndex={0}
24
+ variant="secondary"
25
+ {...props}
26
+ />
27
+ {' '}
28
+ <Button
29
+ icon="plus"
30
+ marginRight='lg'
31
+ size="sm"
32
+ tabIndex={0}
33
+ variant="link"
34
+ {...props}
35
+ />
36
+ {' '}
37
+ <Button
38
+ icon="plus"
39
+ marginRight='lg'
40
+ size="sm"
41
+ tabIndex={0}
42
+ variant="danger"
43
+ {...props}
44
+ />
45
+ {' '}
46
+ <Button
47
+ disabled
48
+ icon="plus"
49
+ marginRight='lg'
50
+ size="sm"
51
+ tabIndex={0}
52
+ {...props}
53
+ />
54
+ {' '}
55
+ <Button
56
+ icon="plus"
57
+ loading
58
+ marginRight='lg'
59
+ size="sm"
60
+ tabIndex={0}
61
+ {...props}
62
+ />
63
+ <br/>
64
+ <Caption
65
+ marginY="md"
66
+ text="Medium Size (md)"
67
+ />
68
+ <Button
69
+ icon="plus"
70
+ marginRight='lg'
71
+ size="md"
72
+ tabIndex={0}
73
+ {...props}
74
+ />
75
+ {' '}
76
+ <Button
77
+ icon="plus"
78
+ marginRight='lg'
79
+ size="md"
80
+ tabIndex={0}
81
+ variant="secondary"
82
+ {...props}
83
+ />
84
+ {' '}
85
+ <Button
86
+ icon="plus"
87
+ marginRight='lg'
88
+ size="md"
89
+ tabIndex={0}
90
+ variant="link"
91
+ {...props}
92
+ />
93
+ {' '}
94
+ <Button
95
+ icon="plus"
96
+ marginRight='lg'
97
+ size="md"
98
+ tabIndex={0}
99
+ variant="danger"
100
+ {...props}
101
+ />
102
+ {' '}
103
+ <Button
104
+ disabled
105
+ icon="plus"
106
+ marginRight='lg'
107
+ size="md"
108
+ tabIndex={0}
109
+ {...props}
110
+ />
111
+ {' '}
112
+ <Button
113
+ icon="plus"
114
+ loading
115
+ marginRight='lg'
116
+ size="md"
117
+ tabIndex={0}
118
+ {...props}
119
+ />
120
+ <br/>
121
+ <Caption
122
+ marginY="md"
123
+ text="Large Size (lg)"
124
+ />
125
+ <Button
126
+ icon="plus"
127
+ marginRight='lg'
128
+ size="lg"
129
+ tabIndex={0}
130
+ {...props}
131
+ />
132
+ {' '}
133
+ <Button
134
+ icon="plus"
135
+ marginRight='lg'
136
+ size="lg"
137
+ tabIndex={0}
138
+ variant="secondary"
139
+ {...props}
140
+ />
141
+ {' '}
142
+ <Button
143
+ icon="plus"
144
+ marginRight='lg'
145
+ size="lg"
146
+ tabIndex={0}
147
+ variant="link"
148
+ {...props}
149
+ />
150
+ {' '}
151
+ <Button
152
+ icon="plus"
153
+ marginRight='lg'
154
+ size="lg"
155
+ tabIndex={0}
156
+ variant="danger"
157
+ {...props}
158
+ />
159
+ {' '}
160
+ <Button
161
+ disabled
162
+ icon="plus"
163
+ marginRight='lg'
164
+ size="lg"
165
+ tabIndex={0}
166
+ {...props}
167
+ />
168
+ {' '}
169
+ <Button
170
+ icon="plus"
171
+ loading
172
+ marginRight='lg'
173
+ size="lg"
174
+ tabIndex={0}
175
+ {...props}
176
+ />
177
+ </div>
178
+ )
179
+
180
+ export default ButtonIconVariant
@@ -0,0 +1 @@
1
+ The icon button variant automatically renders when you provide an `icon` prop without a corresponding `text` prop. The button will only display an icon (no text) and will be wrapped with the icon button styling. This works with all button variants including "link", "primary", "secondary", etc. Simply use `<%= pb_rails("button", props: { icon: "plus", variant: "secondary" }) %>` to get an icon button.
@@ -0,0 +1 @@
1
+ The icon button variant automatically renders when you provide an `icon` prop without a corresponding `text` prop. The button will only display an icon (no text) and will be wrapped with the icon button styling. This works with all button variants including "link", "primary", "secondary", etc. Simply use `<Button icon="rocket" variant="primary" />` to get an icon button.
@@ -13,6 +13,7 @@ examples:
13
13
  - button_form: Button Form Attribute
14
14
  - button_managed_disabled: Button Toggle Disabled State
15
15
  - button_managed_disabled_helper: Button Toggle Disabled State Helper
16
+ - button_icon_variant: Icon Button Variant
16
17
 
17
18
  react:
18
19
  - button_default: Button Variants
@@ -27,6 +28,7 @@ examples:
27
28
  - button_size: Button Size
28
29
  - button_form: Button Form Attribute
29
30
  - button_hover: Button Hover
31
+ - button_icon_variant: Icon Button Variant
30
32
 
31
33
  swift:
32
34
  - button_default_swift: Button Variants
@@ -4,6 +4,7 @@ export { default as ButtonLink } from './_button_link.jsx'
4
4
  export { default as ButtonLoading } from './_button_loading.jsx'
5
5
  export { default as ButtonBlockContent } from './_button_block_content.jsx'
6
6
  export { default as ButtonIconOptions } from './_button_icon_options.jsx'
7
+ export { default as ButtonIconVariant } from './_button_icon_variant.jsx'
7
8
  export { default as ButtonAccessibility } from './_button_accessibility.jsx'
8
9
  export { default as ButtonOptions } from './_button_options.jsx'
9
10
  export { default as ButtonSize } from './_button_size.jsx'
@@ -0,0 +1,6 @@
1
+ <%= pb_rails("checkbox" , props: {
2
+ required_indicator: true,
3
+ text: "Checkbox Label",
4
+ value: "checkbox-value",
5
+ name: "checkbox-name"
6
+ }) %>
@@ -0,0 +1,17 @@
1
+ import React from 'react'
2
+ import Checkbox from '../_checkbox'
3
+
4
+ const CheckboxRequiredIndicator = () => {
5
+ return (
6
+ <div>
7
+ <Checkbox
8
+ name="checkbox-name"
9
+ requiredIndicator
10
+ text="Checkbox label"
11
+ value="check-box value"
12
+ />
13
+ </div>
14
+ )
15
+ }
16
+
17
+ export default CheckboxRequiredIndicator
@@ -0,0 +1,3 @@
1
+ The `requiredIndicator`/`required_indicator` prop displays a red asterisk (*) next to the label, visually indicating that the field is required. This is purely visual and does not enforce validation.
2
+
3
+ You can use `requiredIndicator`/`required_indicator` with any validation approach: HTML5 validation via the `required` prop, client-side validation, or backend validation. For this reason, it works independently and doesn't need to be paired with the `required` prop.
@@ -8,6 +8,7 @@ examples:
8
8
  - checkbox_indeterminate: Indeterminate Checkbox
9
9
  - checkbox_disabled: Disabled Checkbox
10
10
  - checkbox_form: Form and Hidden Input
11
+ # - checkbox_required_indicator: Required Indicator
11
12
 
12
13
  react:
13
14
  - checkbox_default: Default
@@ -17,6 +18,7 @@ examples:
17
18
  - checkbox_error: Default w/ Error
18
19
  - checkbox_indeterminate: Indeterminate Checkbox
19
20
  - checkbox_disabled: Disabled Checkbox
21
+ # - checkbox_required_indicator: Required Indicator
20
22
 
21
23
  swift:
22
24
  - checkbox_default_swift: Default
@@ -5,3 +5,4 @@ export { default as CheckboxError } from './_checkbox_error.jsx'
5
5
  export { default as CheckboxChecked } from './_checkbox_checked.jsx'
6
6
  export { default as CheckboxIndeterminate } from './_checkbox_indeterminate.jsx'
7
7
  export { default as CheckboxDisabled } from './_checkbox_disabled.jsx'
8
+ export { default as CheckboxRequiredIndicator } from './_checkbox_required_indicator.jsx'
@@ -0,0 +1 @@
1
+ `pickerId`/`picker_id` is a **required prop** to instantiate the Date Picker. The presence of `pickerId`/`picker_id` in your Date Picker also associates the label with the input, providing the ability to focus the Date Picker by clicking the label.
@@ -0,0 +1,3 @@
1
+ The `blank_selection` prop adds a blank option at the top of the dropdown options list. This allows users to explicitly clear their selection by choosing the blank option.
2
+
3
+ The blank selection option appears as the first item in the dropdown and has an empty value (`id: ""`, `value: ""`). When selected, it effectively clears the dropdown selection.
@@ -0,0 +1,3 @@
1
+ The `blankSelection` prop adds a blank option at the top of the dropdown options list. This allows users to explicitly clear their selection by choosing the blank option.
2
+
3
+ The blank selection option appears as the first item in the dropdown and has an empty value (`id: ""`, `value: ""`). When selected, it effectively clears the dropdown selection.
@@ -0,0 +1,52 @@
1
+ <%
2
+ options = [
3
+ { label: 'United States', value: 'unitedStates', id: 'us' },
4
+ { label: 'Canada', value: 'canada', id: 'ca' },
5
+ { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
+ ]
7
+ %>
8
+
9
+ <%= pb_rails("dropdown", props: {
10
+ id: "date-range-quickpick-reset-closeable",
11
+ label: "Quick Pick",
12
+ variant: "quickpick",
13
+ clearable: false
14
+ }) %>
15
+
16
+ <%= pb_rails("button", props: {
17
+ margin_y: "md",
18
+ text: "Reset",
19
+ html_options: {
20
+ onclick: "handleReset()"
21
+ }
22
+ }) %>
23
+
24
+ <%= pb_rails("dropdown", props: {
25
+ id: "closeable-default",
26
+ options: options,
27
+ clearable: false,
28
+ default_value: options.last,
29
+ margin_bottom: "md",
30
+ label: "Default"
31
+ }) %>
32
+
33
+ <%= pb_rails("dropdown", props: {
34
+ id: "closeable-subtle",
35
+ options: options,
36
+ clearable: false,
37
+ default_value: options.second,
38
+ variant: "subtle",
39
+ separators: false,
40
+ label: "Subtle"
41
+ }) %>
42
+
43
+ <script>
44
+ function handleReset() {
45
+ const dropdown = document.querySelector("#date-range-quickpick-reset-closeable[data-pb-dropdown]");
46
+ const instance = dropdown?._pbDropdownInstance;
47
+
48
+ if (instance) {
49
+ instance.clearSelection();
50
+ }
51
+ }
52
+ </script>
@@ -0,0 +1,72 @@
1
+ import React, { useRef } from 'react'
2
+
3
+ import Button from '../../pb_button/_button'
4
+ import Dropdown from '../../pb_dropdown/_dropdown'
5
+
6
+ const DropdownWithClearable = (props) => {
7
+ const dropdownRef = useRef(null)
8
+
9
+ const options = [
10
+ {
11
+ label: "United States",
12
+ value: "unitedStates",
13
+ id: "us"
14
+ },
15
+ {
16
+ label: "Canada",
17
+ value: "canada",
18
+ id: "ca"
19
+ },
20
+ {
21
+ label: "Pakistan",
22
+ value: "pakistan",
23
+ id: "pk"
24
+ }
25
+ ]
26
+
27
+ const handleReset = () => {
28
+ if (dropdownRef.current) {
29
+ dropdownRef.current.clearSelected()
30
+ }
31
+ }
32
+
33
+ return (
34
+ <>
35
+ <Dropdown
36
+ clearable={false}
37
+ label="Quick Pick"
38
+ onSelect={() => {}}
39
+ ref={dropdownRef}
40
+ variant="quickpick"
41
+ {...props}
42
+ />
43
+ <Button
44
+ marginY="md"
45
+ onClick={handleReset}
46
+ text="Reset"
47
+ />
48
+
49
+ <Dropdown
50
+ clearable={false}
51
+ defaultValue={options[options.length - 1]}
52
+ label="Default"
53
+ marginBottom="md"
54
+ options={options}
55
+ variant="default"
56
+ {...props}
57
+ />
58
+
59
+ <Dropdown
60
+ clearable={false}
61
+ defaultValue={options[1]}
62
+ label="Subtle"
63
+ options={options}
64
+ separators={false}
65
+ variant="subtle"
66
+ {...props}
67
+ />
68
+ </>
69
+ )
70
+ }
71
+
72
+ export default DropdownWithClearable
@@ -0,0 +1,5 @@
1
+ The `clearable` prop controls whether the clear (X) button appears in the dropdown. When set to `false`, the clear button is hidden.
2
+
3
+ This is useful in two scenarios:
4
+ 1. When you have a separate "Reset" or "Defaults" button that handles clearing the selection (as shown in the Quick Pick example)
5
+ 2. When you don't want to provide any way to clear the selection (as shown in the Default and Subtle examples)
@@ -0,0 +1,33 @@
1
+ import React from 'react'
2
+ import Dropdown from '../../pb_dropdown/_dropdown'
3
+
4
+ const DropdownWithConstrainHeight = (props) => {
5
+ // Create a long list of options to demonstrate height constraint
6
+ const options = Array.from({ length: 30 }, (_, i) => ({
7
+ label: `Option ${i + 1}`,
8
+ value: `option_${i + 1}`,
9
+ id: `opt_${i + 1}`
10
+ }))
11
+
12
+ return (
13
+ <>
14
+ <Dropdown
15
+ data={{ testid: "dropdown-no-constrain" }}
16
+ label="Without Constrain Height (Default)"
17
+ marginBottom="md"
18
+ options={options}
19
+ {...props}
20
+ />
21
+
22
+ <Dropdown
23
+ constrainHeight
24
+ data={{ testid: "dropdown-constrain" }}
25
+ label="With Constrain Height"
26
+ options={options}
27
+ {...props}
28
+ />
29
+ </>
30
+ )
31
+ }
32
+
33
+ export default DropdownWithConstrainHeight
@@ -0,0 +1,20 @@
1
+ <%
2
+ # Create a long list of options to demonstrate height constraint
3
+ options = (1..30).map do |i|
4
+ { label: "Option #{i}", value: "option_#{i}", id: "opt_#{i}" }
5
+ end
6
+ %>
7
+
8
+ <%= pb_rails("dropdown", props: {
9
+ id: "dropdown-no-constrain",
10
+ options: options,
11
+ label: "Without Constrain Height (Default)",
12
+ margin_bottom: "md"
13
+ }) %>
14
+
15
+ <%= pb_rails("dropdown", props: {
16
+ id: "dropdown-constrain",
17
+ options: options,
18
+ constrain_height: true,
19
+ label: "With Constrain Height"
20
+ }) %>
@@ -0,0 +1,8 @@
1
+ The `constrain_height` prop limits the dropdown container height to 18em and enables vertical scrolling when the content exceeds this height. This prevents long dropdown lists from rendering off-screen.
2
+
3
+ When `constrain_height` is `true`, the dropdown will:
4
+ - Have a maximum height of 18em
5
+ - Show a scrollbar when content exceeds the max height
6
+ - Prevent the dropdown from extending beyond the viewport
7
+
8
+ This is particularly useful for dropdowns with many options, such as long lists or quickpick variants with many date range options.
@@ -0,0 +1,8 @@
1
+ The `constrainHeight` prop limits the dropdown container height to 18em and enables vertical scrolling when the content exceeds this height. This prevents long dropdown lists from rendering off-screen.
2
+
3
+ When `constrainHeight` is `true`, the dropdown will:
4
+ - Have a maximum height of 18em
5
+ - Show a scrollbar when content exceeds the max height
6
+ - Prevent the dropdown from extending beyond the viewport
7
+
8
+ This is particularly useful for dropdowns with many options, such as long lists or quickpick variants with many date range options.
@@ -76,7 +76,7 @@
76
76
  const option = e.detail;
77
77
  const dropdown = e.target;
78
78
 
79
- const display = dropdown.querySelector("#dropdown_trigger_custom_display");
79
+ const display = dropdown.querySelector("[data-dropdown-trigger-custom-display]");
80
80
  if (!display) return;
81
81
 
82
82
  const nameEl = display.querySelector("#dropdown-avatar-name");
@@ -1,10 +1,13 @@
1
- <%
1
+ <%
2
2
  options = [
3
3
  { label: 'United States', value: 'unitedStates', id: 'us' },
4
4
  { label: 'Canada', value: 'canada', id: 'ca' },
5
5
  { label: 'Pakistan', value: 'pakistan', id: 'pk' },
6
6
  ]
7
-
8
7
  %>
9
8
 
10
- <%= pb_rails("dropdown", props: {options: options, label: "Select a Country"}) %>
9
+ <%= pb_rails("dropdown", props: {
10
+ id: "select_a_country",
11
+ label: "Select a Country",
12
+ options: options
13
+ }) %>
@@ -25,6 +25,7 @@ const DropdownDefault = (props) => {
25
25
  return (
26
26
  <div>
27
27
  <Dropdown
28
+ id="select_a_country"
28
29
  label="Select a Country"
29
30
  options={options}
30
31
  {...props}