playbook_ui 14.14.0 → 14.15.0.pre.alpha.PBNTR617addgriddisplayglobalprop6700

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 (188) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +127 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableActionBar.tsx +55 -0
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/TablePagination.tsx +33 -0
  5. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +275 -0
  6. data/app/pb_kits/playbook/pb_advanced_table/Context/AdvancedTableContext.tsx +143 -3
  7. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +66 -0
  8. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +195 -0
  9. data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableBody.tsx +45 -99
  10. data/app/pb_kits/playbook/pb_advanced_table/Utilities/CellRendererUtils.tsx +73 -0
  11. data/app/pb_kits/playbook/pb_advanced_table/Utilities/RowUtils.ts +52 -0
  12. data/app/pb_kits/playbook/pb_advanced_table/Utilities/TableContainerStyles.ts +80 -0
  13. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +130 -7
  14. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +153 -299
  15. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_infinite_scroll.jsx +50 -0
  16. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.jsx +102 -0
  17. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_editing.md +4 -0
  18. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_mock_data_infinite_scroll.json +152002 -0
  19. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +2 -1
  20. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +2 -1
  21. data/app/pb_kits/playbook/pb_card/_card.tsx +2 -1
  22. data/app/pb_kits/playbook/pb_currency/_currency.tsx +46 -31
  23. data/app/pb_kits/playbook/pb_currency/currency.html.erb +15 -8
  24. data/app/pb_kits/playbook/pb_currency/currency.rb +17 -2
  25. data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.html.erb +22 -0
  26. data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display.jsx +34 -0
  27. data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_rails.md +1 -0
  28. data/app/pb_kits/playbook/pb_currency/docs/_currency_null_display_react.md +1 -0
  29. data/app/pb_kits/playbook/pb_currency/docs/example.yml +2 -0
  30. data/app/pb_kits/playbook/pb_currency/docs/index.js +2 -1
  31. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +4 -1
  32. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +2 -0
  33. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_hooks.md +3 -1
  34. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_change.html.erb +39 -0
  35. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_on_close.html.erb +39 -0
  36. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +2 -0
  37. data/app/pb_kits/playbook/pb_date_picker/index.ts +38 -0
  38. data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +5 -6
  39. data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +2 -0
  40. data/app/pb_kits/playbook/pb_dialog/index.js +75 -0
  41. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +43 -3
  42. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_behavior.html.erb +8 -0
  43. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.html.erb +33 -0
  44. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_borders.jsx +3 -3
  45. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.html.erb +0 -0
  46. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_breakpoints.jsx +20 -37
  47. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_default.html.erb +20 -1
  48. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.html.erb +24 -0
  49. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +6 -6
  50. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.html.erb +21 -0
  51. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.jsx +1 -0
  52. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_overlay.md +1 -0
  53. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_sizes.html.erb +49 -0
  54. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +6 -0
  55. data/app/pb_kits/playbook/pb_drawer/drawer.html.erb +20 -12
  56. data/app/pb_kits/playbook/pb_drawer/drawer.rb +49 -1
  57. data/app/pb_kits/playbook/pb_drawer/index.js +257 -0
  58. data/app/pb_kits/playbook/pb_filter/Filter/CurrentFilters.tsx +5 -4
  59. data/app/pb_kits/playbook/pb_filter/Filter/FilterSingle.tsx +2 -2
  60. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -1
  61. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +4 -3
  62. data/app/pb_kits/playbook/pb_form_pill/_form_pill.scss +9 -2
  63. data/app/pb_kits/playbook/pb_form_pill/_form_pill.tsx +4 -0
  64. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.html.erb +40 -0
  65. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.jsx +50 -0
  66. data/app/pb_kits/playbook/pb_form_pill/docs/_form_pill_wrapped.md +3 -0
  67. data/app/pb_kits/playbook/pb_form_pill/docs/example.yml +2 -0
  68. data/app/pb_kits/playbook/pb_form_pill/docs/index.js +1 -0
  69. data/app/pb_kits/playbook/pb_form_pill/form_pill.rb +7 -1
  70. data/app/pb_kits/playbook/pb_icon_button/_icon_button.tsx +71 -0
  71. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_default.jsx +17 -0
  72. data/app/pb_kits/playbook/pb_icon_button/docs/_icon_button_sizes.jsx +61 -0
  73. data/app/pb_kits/playbook/pb_icon_button/docs/example.yml +4 -0
  74. data/app/pb_kits/playbook/pb_icon_button/docs/index.js +2 -0
  75. data/app/pb_kits/playbook/pb_icon_button/icon_button.html.erb +1 -1
  76. data/app/pb_kits/playbook/pb_icon_button/icon_button.test.jsx +39 -0
  77. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.scss +7 -0
  78. data/app/pb_kits/playbook/pb_multi_level_select/_multi_level_select.tsx +45 -8
  79. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.html.erb +72 -0
  80. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_disabled.jsx +91 -0
  81. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.jsx +91 -0
  82. data/app/pb_kits/playbook/pb_multi_level_select/docs/_multi_level_select_react_hook.md +1 -0
  83. data/app/pb_kits/playbook/pb_multi_level_select/docs/example.yml +3 -1
  84. data/app/pb_kits/playbook/pb_multi_level_select/docs/index.js +2 -0
  85. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.rb +7 -1
  86. data/app/pb_kits/playbook/pb_overlay/_overlay.scss +13 -0
  87. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +7 -1
  88. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.html.erb +11 -0
  89. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar.jsx +37 -0
  90. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_rails.md +1 -0
  91. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_hide_scroll_bar_react.md +1 -0
  92. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.html.erb +11 -0
  93. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.md +1 -0
  94. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +3 -0
  95. data/app/pb_kits/playbook/pb_overlay/docs/index.js +1 -0
  96. data/app/pb_kits/playbook/pb_overlay/index.js +61 -0
  97. data/app/pb_kits/playbook/pb_overlay/overlay.html.erb +5 -3
  98. data/app/pb_kits/playbook/pb_overlay/overlay.rb +16 -1
  99. data/app/pb_kits/playbook/pb_overlay/overlay.test.jsx +12 -0
  100. data/app/pb_kits/playbook/pb_phone_number_input/_phone_number_input.tsx +6 -0
  101. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_default.html.erb +1 -1
  102. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.html.erb +5 -0
  103. data/app/pb_kits/playbook/pb_phone_number_input/docs/_phone_number_input_hidden_inputs.md +1 -0
  104. data/app/pb_kits/playbook/pb_phone_number_input/docs/example.yml +3 -1
  105. data/app/pb_kits/playbook/pb_phone_number_input/phone_number_input.rb +3 -0
  106. data/app/pb_kits/playbook/pb_popover/_popover.tsx +2 -2
  107. data/app/pb_kits/playbook/pb_popover/popover.test.js +1 -1
  108. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +2 -2
  109. data/app/pb_kits/playbook/pb_radio/_radio.tsx +85 -74
  110. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +60 -0
  111. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +1 -0
  112. data/app/pb_kits/playbook/pb_radio/docs/example.yml +2 -1
  113. data/app/pb_kits/playbook/pb_radio/docs/index.js +1 -0
  114. data/app/pb_kits/playbook/pb_radio/radio.test.js +16 -0
  115. data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.jsx +58 -0
  116. data/app/pb_kits/playbook/pb_select/docs/_select_react_hook.md +1 -0
  117. data/app/pb_kits/playbook/pb_select/docs/example.yml +1 -0
  118. data/app/pb_kits/playbook/pb_select/docs/index.js +1 -0
  119. data/app/pb_kits/playbook/pb_select/index.js +38 -0
  120. data/app/pb_kits/playbook/pb_select/select.html.erb +3 -5
  121. data/app/pb_kits/playbook/pb_select/select.rb +8 -0
  122. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -5
  123. data/app/pb_kits/playbook/pb_selectable_card_icon/selectable_card_icon.html.erb +1 -4
  124. data/app/pb_kits/playbook/pb_selectable_icon/selectable_icon.html.erb +1 -5
  125. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +2 -3
  126. data/app/pb_kits/playbook/pb_timeline/_timeline.scss +2 -2
  127. data/app/pb_kits/playbook/pb_title/_title.scss +32 -0
  128. data/app/pb_kits/playbook/pb_title/_title.tsx +10 -1
  129. data/app/pb_kits/playbook/pb_title/docs/_title_default.html.erb +1 -2
  130. data/app/pb_kits/playbook/pb_title/docs/_title_default.jsx +1 -1
  131. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.html.erb +7 -0
  132. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.jsx +54 -0
  133. data/app/pb_kits/playbook/pb_title/docs/_title_display_size.md +1 -0
  134. data/app/pb_kits/playbook/pb_title/docs/example.yml +2 -0
  135. data/app/pb_kits/playbook/pb_title/docs/index.js +1 -0
  136. data/app/pb_kits/playbook/pb_title/title.rb +10 -1
  137. data/app/pb_kits/playbook/pb_tooltip/_tooltip.scss +0 -3
  138. data/app/pb_kits/playbook/pb_tooltip/_tooltip.tsx +25 -0
  139. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.html.erb +39 -0
  140. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_delay_rails.md +3 -0
  141. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon_rails.html.erb +22 -0
  142. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_interaction.html.erb +26 -0
  143. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.jsx +69 -0
  144. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_sizing.md +3 -0
  145. data/app/pb_kits/playbook/pb_tooltip/docs/example.yml +4 -1
  146. data/app/pb_kits/playbook/pb_tooltip/docs/index.js +1 -0
  147. data/app/pb_kits/playbook/pb_tooltip/floating_ui.js +282 -0
  148. data/app/pb_kits/playbook/pb_tooltip/index.js +2 -2
  149. data/app/pb_kits/playbook/pb_tooltip/tooltip.rb +10 -2
  150. data/app/pb_kits/playbook/pb_typeahead/_typeahead.tsx +51 -5
  151. data/app/pb_kits/playbook/pb_typeahead/components/MultiValue.tsx +5 -1
  152. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.html.erb +45 -0
  153. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options.md +5 -0
  154. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.html.erb +33 -0
  155. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_dynamic_options_pure_rails.md +3 -0
  156. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.jsx +66 -0
  157. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_react_hook.md +1 -0
  158. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_custom_options.jsx +1 -1
  159. data/app/pb_kits/playbook/pb_typeahead/docs/_typeahead_with_pills_async_users.jsx +1 -1
  160. data/app/pb_kits/playbook/pb_typeahead/docs/example.yml +3 -0
  161. data/app/pb_kits/playbook/pb_typeahead/docs/index.js +1 -0
  162. data/app/pb_kits/playbook/pb_typeahead/index.ts +61 -8
  163. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +17 -2
  164. data/app/pb_kits/playbook/tokens/_display.scss +3 -1
  165. data/app/pb_kits/playbook/utilities/_display.scss +6 -1
  166. data/app/pb_kits/playbook/utilities/object.test.js +99 -0
  167. data/app/pb_kits/playbook/utilities/object.ts +29 -1
  168. data/app/pb_kits/playbook/utilities/test/globalProps/display.test.js +1 -1
  169. data/dist/chunks/_typeahead-B8f4HM8I.js +36 -0
  170. data/dist/chunks/_weekday_stacked-BVO5G6au.js +45 -0
  171. data/dist/chunks/lazysizes-B7xYodB-.js +1 -0
  172. data/dist/chunks/{lib-D3us1bGD.js → lib-5OzNgeeu.js} +2 -2
  173. data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-DGhKbZtO.js} +1 -1
  174. data/dist/chunks/vendor.js +1 -1
  175. data/dist/menu.yml +4 -4
  176. data/dist/playbook-doc.js +1 -1
  177. data/dist/playbook-rails-react-bindings.js +1 -1
  178. data/dist/playbook-rails.js +1 -1
  179. data/dist/playbook.css +1 -1
  180. data/lib/playbook/display.rb +2 -2
  181. data/lib/playbook/forms/builder/time_zone_select_field.rb +19 -0
  182. data/lib/playbook/forms/builder.rb +1 -0
  183. data/lib/playbook/version.rb +2 -2
  184. metadata +80 -8
  185. data/app/pb_kits/playbook/pb_tooltip/docs/_tooltip_icon.erb +0 -10
  186. data/dist/chunks/_typeahead-PqkcDf1H.js +0 -36
  187. data/dist/chunks/_weekday_stacked-B_pw5Znc.js +0 -45
  188. data/dist/chunks/lazysizes-DHz07jlL.js +0 -1
@@ -36,4 +36,5 @@ 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)
39
+ - advanced_table_selectable_rows_header: Selectable Rows (No Actions Bar)
40
+ - advanced_table_inline_editing: Inline Cell Editing
@@ -20,4 +20,5 @@ 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'
23
+ export { default as AdvancedTableColumnHeadersCustomCell } from './_advanced_table_column_headers_custom_cell.jsx'
24
+ export { default as AdvancedTableInlineEditing } from './_advanced_table_inline_editing.jsx'
@@ -1,7 +1,8 @@
1
1
  /* eslint-disable react/no-multi-comp */
2
2
 
3
3
  import React from 'react'
4
- import { get } from 'lodash'
4
+ import { get } from '../utilities/object'
5
+
5
6
  import classnames from 'classnames'
6
7
 
7
8
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
@@ -21,6 +21,7 @@ type CurrencyProps = {
21
21
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
22
22
  id?: string,
23
23
  label?: string,
24
+ nullDisplay?: string,
24
25
  size?: 'sm' | 'md' | 'lg',
25
26
  symbol?: string,
26
27
  variant?: 'default' | 'light' | 'bold',
@@ -49,6 +50,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
49
50
  unit,
50
51
  className,
51
52
  label = '',
53
+ nullDisplay = '',
52
54
  size = 'sm',
53
55
  symbol = '$',
54
56
  variant = 'default',
@@ -118,44 +120,57 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
118
120
  id={id}
119
121
  >
120
122
  <Caption dark={dark}>{label}</Caption>
121
-
122
123
  <div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
123
124
  {unstyled ? (
124
- <>
125
- <div>{handleNegative}{symbol}</div>
126
- <div>{getAmount}</div>
127
- <div>
128
- {getAbbreviation}
129
- {unit ? unit : getDecimalValue}
130
- </div>
131
- </>
125
+ nullDisplay && !amount ? (
126
+ <div>{nullDisplay}</div>
127
+ ) : (
128
+ <>
129
+ <div>{handleNegative}{symbol}</div>
130
+ <div>{getAmount}</div>
131
+ <div>
132
+ {getAbbreviation}
133
+ {unit ? unit : getDecimalValue}
134
+ </div>
135
+ </>
136
+ )
132
137
  ) : (
133
- <>
134
- <Body
135
- className="dollar_sign"
136
- color="light"
137
- dark={dark}
138
- >
139
- {handleNegative}{symbol}
140
- </Body>
141
-
138
+ nullDisplay && !amount ? (
142
139
  <Title
143
140
  className="pb_currency_value"
144
141
  dark={dark}
145
142
  size={sizes[size]}
146
- >
147
- {getAmount}
148
- </Title>
149
-
150
- <Body
151
- className="unit"
152
- color="light"
153
- dark={dark}
154
- >
155
- {getAbbreviation}
156
- {unit ? unit : getDecimalValue}
157
- </Body>
158
- </>
143
+ >
144
+ {nullDisplay}
145
+ </Title>
146
+ ) : (
147
+ <>
148
+ <Body
149
+ className="dollar_sign"
150
+ color="light"
151
+ dark={dark}
152
+ >
153
+ {handleNegative}{symbol}
154
+ </Body>
155
+
156
+ <Title
157
+ className="pb_currency_value"
158
+ dark={dark}
159
+ size={sizes[size]}
160
+ >
161
+ {getAmount}
162
+ </Title>
163
+
164
+ <Body
165
+ className="unit"
166
+ color="light"
167
+ dark={dark}
168
+ >
169
+ {getAbbreviation}
170
+ {unit ? unit : getDecimalValue}
171
+ </Body>
172
+ </>
173
+ )
159
174
  )}
160
175
  </div>
161
176
  </div>
@@ -1,17 +1,24 @@
1
1
  <%= pb_content_tag do %>
2
2
  <%= pb_rails("caption", props: object.caption_props) %>
3
-
4
3
  <div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
5
4
  <% if object.unstyled %>
6
- <div><%= object.negative_sign %><%= object.symbol %></div>
7
- <div><%= object.title_props[:text] %></div>
8
- <div><%= object.body_props[:text] %></div>
5
+ <% if object.null_display && object.amount.blank? %>
6
+ <div><%= object.null_display %></div>
7
+ <% else %>
8
+ <div><%= object.negative_sign %><%= object.symbol %></div>
9
+ <div><%= object.title_props[:text] %></div>
10
+ <div><%= object.body_props[:text] %></div>
11
+ <% end %>
9
12
  <% else %>
10
- <%= pb_rails("body", props: object.currency_wrapper_props) do %>
11
- <%= object.negative_sign %><%= object.symbol %>
13
+ <% if object.null_display && object.amount.blank? %>
14
+ <%= pb_rails("title", props: object.title_props) %>
15
+ <% else %>
16
+ <%= pb_rails("body", props: object.currency_wrapper_props) do %>
17
+ <%= object.negative_sign %><%= object.symbol %>
18
+ <% end %>
19
+ <%= pb_rails("title", props: object.title_props) %>
20
+ <%= pb_rails("body", props: object.body_props) %>
12
21
  <% end %>
13
- <%= pb_rails("title", props: object.title_props) %>
14
- <%= pb_rails("body", props: object.body_props) %>
15
22
  <% end %>
16
23
  </div>
17
24
  <% end %>
@@ -46,6 +46,9 @@ module Playbook
46
46
  prop :comma_separator, type: Playbook::Props::Boolean,
47
47
  default: false
48
48
 
49
+ prop :null_display, type: Playbook::Props::String,
50
+ required: false
51
+
49
52
  def classname
50
53
  generate_classname("pb_currency_kit", align, size, dark_class)
51
54
  end
@@ -65,10 +68,20 @@ module Playbook
65
68
  }
66
69
  end
67
70
 
71
+ def title_text
72
+ if null_display
73
+ null_display
74
+ elsif swap_negative
75
+ absolute_amount(abbr_or_format_amount)
76
+ else
77
+ abbr_or_format_amount
78
+ end
79
+ end
80
+
68
81
  def title_props
69
82
  {
70
83
  size: size_value,
71
- text: swap_negative ? absolute_amount(abbr_or_format_amount) : abbr_or_format_amount,
84
+ text: title_text,
72
85
  classname: "pb_currency_value",
73
86
  dark: dark,
74
87
  }
@@ -145,8 +158,10 @@ module Playbook
145
158
  1
146
159
  when "md"
147
160
  3
148
- else
161
+ when "sm"
149
162
  4
163
+ else
164
+ 3
150
165
  end
151
166
  end
152
167
 
@@ -0,0 +1,22 @@
1
+ <%= pb_rails("currency", props: {
2
+ amount: "",
3
+ label: "Nil",
4
+ margin_bottom: "md",
5
+ null_display: "--",
6
+ size: "sm"
7
+ }) %>
8
+
9
+ <%= pb_rails("currency", props: {
10
+ amount: "",
11
+ label: "Nil",
12
+ margin_bottom: "md",
13
+ null_display: "$0.00",
14
+ size: "sm"
15
+ }) %>
16
+
17
+ <%= pb_rails("currency", props: {
18
+ amount: "",
19
+ label: "Nil",
20
+ null_display: " ",
21
+ size: "sm"
22
+ }) %>
@@ -0,0 +1,34 @@
1
+ import React from 'react'
2
+ import { Currency } from 'playbook-ui'
3
+
4
+ const CurrencyNullDisplay = (props) => {
5
+ return (
6
+ <>
7
+ <Currency
8
+ amount=""
9
+ label="Null"
10
+ marginBottom="md"
11
+ nullDisplay="--"
12
+ {...props}
13
+ />
14
+
15
+ <Currency
16
+ amount=""
17
+ label="Null"
18
+ marginBottom="md"
19
+ nullDisplay="$0.00"
20
+ {...props}
21
+ />
22
+
23
+ <Currency
24
+ amount=""
25
+ label="Null"
26
+ marginBottom="md"
27
+ nullDisplay=" "
28
+ {...props}
29
+ />
30
+ </>
31
+ )
32
+ }
33
+
34
+ export default CurrencyNullDisplay
@@ -0,0 +1 @@
1
+ To customize how the `amount` field appears when it is empty, use the `null_display` prop and set it to the desired value you want to display.
@@ -0,0 +1 @@
1
+ To customize how the `amount` field appears when it is empty, use the `nullDisplay` prop and set it to the desired value you want to display.
@@ -10,6 +10,7 @@ examples:
10
10
  - currency_unstyled: Unstyled
11
11
  - currency_comma_separator: Comma Separator
12
12
  - currency_negative: Negative
13
+ - currency_null_display: Null Display
13
14
 
14
15
  react:
15
16
  - currency_variants: Variants
@@ -21,6 +22,7 @@ examples:
21
22
  - currency_unstyled: Unstyled
22
23
  - currency_comma_separator: Comma Separator
23
24
  - currency_negative: Negative
25
+ - currency_null_display: Null Display
24
26
 
25
27
  swift:
26
28
  - currency_size_swift: Size
@@ -6,4 +6,5 @@ export { default as CurrencyAbbreviated } from './_currency_abbreviated.jsx'
6
6
  export { default as CurrencyMatchingDecimals } from './_currency_matching_decimals.jsx'
7
7
  export { default as CurrencyUnstyled } from './_currency_unstyled.jsx'
8
8
  export { default as CurrencyCommaSeparator } from './_currency_comma_separator.jsx'
9
- export { default as CurrencyNegative } from './_currency_negative.jsx'
9
+ export { default as CurrencyNegative } from './_currency_negative.jsx'
10
+ export { default as CurrencyNullDisplay } from './_currency_null_display.jsx'
@@ -1,5 +1,8 @@
1
1
  <%= pb_content_tag(:div,
2
- class: object.classname + object.error_class) do %>
2
+ class: object.classname + object.error_class,
3
+ 'data-pb-date-picker' => true,
4
+ 'data-validation-message' => object.validation_message,
5
+ ) do %>
3
6
  <div class="input_wrapper">
4
7
  <% if content.present? %>
5
8
  <%= content %>
@@ -75,6 +75,8 @@ module Playbook
75
75
  default: [1900, 2100]
76
76
  prop :custom_event_type, type: Playbook::Props::String,
77
77
  default: ""
78
+ prop :validation_message, type: Playbook::Props::String,
79
+ default: ""
78
80
 
79
81
  def classname
80
82
  default_margin_bottom = margin_bottom.present? ? "" : " mb_sm"
@@ -1 +1,3 @@
1
- You can find a full list of flatpickr events and hooks in their [documentation](https://flatpickr.js.org/events/).
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", () => {})`.
@@ -0,0 +1,39 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ label: "Date Picker",
3
+ picker_id: "date-picker-onchange",
4
+ margin_bottom: "lg"
5
+ }) %>
6
+ <%= pb_rails("caption", props: { text: "Date Object" }) %>
7
+ <%= pb_rails("body", props: {
8
+ label: "Date Object",
9
+ text: "Select Date",
10
+ margin_bottom: "lg",
11
+ id: "date-picker-onchange-object",
12
+ }) %>
13
+ <%= pb_rails("caption", props: { text: "Date String" }) %>
14
+ <%= pb_rails("body", props: {
15
+ label: "Date String",
16
+ text: "Select Date",
17
+ margin_bottom: "lg",
18
+ id: "date-picker-onchange-string",
19
+ }) %>
20
+
21
+
22
+ <%= javascript_tag do %>
23
+ window.addEventListener("DOMContentLoaded", () => {
24
+ <%# Access flatpickr instance with picker id and assign it a variable %>
25
+ const fp = document.querySelector("#date-picker-onchange")._flatpickr
26
+
27
+ <%# Define Hook %>
28
+ const changeHook = (selectedDates, dateStr) => {
29
+ const object = document.querySelector('#date-picker-onchange-object')
30
+ object.textContent = selectedDates[0] ? selectedDates[0].toString() : ''
31
+
32
+ const string = document.querySelector('#date-picker-onchange-string')
33
+ string.textContent = dateStr
34
+ }
35
+
36
+ <%# Push one or more hooks to onChange config array %>
37
+ fp.config.onChange.push(changeHook)
38
+ })
39
+ <% end %>
@@ -0,0 +1,39 @@
1
+ <%= pb_rails("date_picker", props: {
2
+ label: "Date Picker",
3
+ picker_id: "date-picker-onclose",
4
+ margin_bottom: "lg"
5
+ }) %>
6
+ <%= pb_rails("caption", props: { text: "Date Object" }) %>
7
+ <%= pb_rails("body", props: {
8
+ label: "Date Object",
9
+ text: "Select Date",
10
+ margin_bottom: "lg",
11
+ id: "date-picker-onclose-object",
12
+ }) %>
13
+ <%= pb_rails("caption", props: { text: "Date String" }) %>
14
+ <%= pb_rails("body", props: {
15
+ label: "Date String",
16
+ text: "Select Date",
17
+ margin_bottom: "lg",
18
+ id: "date-picker-onclose-string",
19
+ }) %>
20
+
21
+
22
+ <%= javascript_tag do %>
23
+ window.addEventListener("DOMContentLoaded", () => {
24
+ <%# Access flatpickr instance with picker id and assign it a variable %>
25
+ const fp = document.querySelector("#date-picker-onclose")._flatpickr
26
+
27
+ <%# Define Hook %>
28
+ const closeHook = (selectedDates, dateStr) => {
29
+ const object = document.querySelector('#date-picker-onclose-object')
30
+ object.textContent = selectedDates[0] ? selectedDates[0].toString() : ''
31
+
32
+ const string = document.querySelector('#date-picker-onclose-string')
33
+ string.textContent = dateStr
34
+ }
35
+
36
+ <%# Push one or more hooks to onClose config array %>
37
+ fp.config.onClose.push(closeHook)
38
+ })
39
+ <% end %>
@@ -7,6 +7,8 @@ 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
10
12
  # - date_picker_range: Range
11
13
  - date_picker_quick_pick_rails: Range (Quick Pick)
12
14
  - date_picker_quick_pick_range_limit: Range (Quick Pick w/ “This” Range limit)
@@ -0,0 +1,38 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element";
2
+
3
+ const DATE_PICKER_WRAPPER_SELECTOR = '[data-pb-date-picker]';
4
+ const SELECT_VALIDATION_MESSAGE_CLASS = '.pb_body_kit_negative';
5
+
6
+ export default class PbDatePicker extends PbEnhancedElement {
7
+ static get selector() {
8
+ return DATE_PICKER_WRAPPER_SELECTOR;
9
+ }
10
+
11
+ connect() {
12
+ this.setValidationMessage();
13
+ }
14
+
15
+ setValidationMessage() {
16
+ const validationMessage = this.element.dataset?.validationMessage;
17
+ const inputElement = this.element.querySelector("input");
18
+
19
+ if (validationMessage) {
20
+ const setErrorTextContent = (text, timeout) => {
21
+ setTimeout(() => {
22
+ const errorMessageElement = this.element.querySelector(SELECT_VALIDATION_MESSAGE_CLASS);
23
+ if (errorMessageElement) {
24
+ errorMessageElement.textContent = text;
25
+ } else {
26
+ setErrorTextContent(text, 100);
27
+ }
28
+ }, timeout);
29
+ };
30
+
31
+ inputElement.addEventListener("change", (e) => {
32
+ if (!e.target.checkValidity()) {
33
+ setErrorTextContent(validationMessage, 300);
34
+ }
35
+ });
36
+ }
37
+ }
38
+ }
@@ -1,4 +1,8 @@
1
- <div class="pb_dialog_wrapper_rails <%= object.full_height_style %>" data-overlay-click= <%= object.overlay_close %> >
1
+ <div
2
+ class="pb_dialog_wrapper_rails <%= object.full_height_style %>"
3
+ data-pb-dialog-wrapper="true"
4
+ data-overlay-click= <%= object.overlay_close %>
5
+ >
2
6
  <%= pb_content_tag(:dialog) do %>
3
7
  <% if object.status === "" && object.title %>
4
8
  <%= pb_rails("dialog/dialog_header", props: { title: object.title, id: object.id }) %>
@@ -33,8 +37,3 @@
33
37
  <%= content %>
34
38
  <% end %>
35
39
  </div>
36
-
37
- <%= javascript_tag do %>
38
- window.addEventListener("DOMContentLoaded", () => dialogHelper())
39
- window.addEventListener("turbo:frame-load", () => dialogHelper())
40
- <% end %>
@@ -1,3 +1,5 @@
1
+ // Three places in Nitro depend on this function inside the window scope.
2
+ // We will keep this file until we remove this dependency from Nitro.
1
3
  const dialogHelper = () => {
2
4
  const openTrigger = document.querySelectorAll("[data-open-dialog]");
3
5
  const closeTrigger = document.querySelectorAll("[data-close-dialog]");
@@ -0,0 +1,75 @@
1
+ import PbEnhancedElement from "../pb_enhanced_element";
2
+
3
+ const DIALOG_WRAPPER_SELECTOR = "[data-pb-dialog-wrapper]";
4
+
5
+ export default class PbDialog extends PbEnhancedElement {
6
+ static get selector() {
7
+ return DIALOG_WRAPPER_SELECTOR;
8
+ }
9
+
10
+ connect() {
11
+ window.addEventListener("DOMContentLoaded", () => this.setupDialog())
12
+ window.addEventListener("turbo:frame-load", () => this.setupDialog())
13
+ }
14
+
15
+ setupDialog() {
16
+ const openTrigger = document.querySelectorAll("[data-open-dialog]");
17
+ const closeTrigger = document.querySelectorAll("[data-close-dialog]");
18
+ const dialogs = document.querySelectorAll(".pb_dialog_rails")
19
+
20
+ const loadingButton = document.querySelector('[data-disable-with="Loading"]');
21
+ if (loadingButton) {
22
+ loadingButton.addEventListener("click", function () {
23
+ const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
24
+ const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
25
+ let currentClass = okayLoadingButton.className;
26
+ let cancelClass = cancelButton ? cancelButton.className : "";
27
+
28
+ let newClass = currentClass.replace("_enabled", "_disabled_loading");
29
+ let newCancelClass = cancelClass.replace("_enabled", "_disabled");
30
+
31
+ // Disable the buttons
32
+ okayLoadingButton.disabled = true;
33
+ if (cancelButton) cancelButton.disabled = true;
34
+
35
+ okayLoadingButton.className = newClass;
36
+ if (cancelButton) cancelButton.className = newCancelClass;
37
+ });
38
+ }
39
+
40
+ openTrigger.forEach((open) => {
41
+ open.addEventListener("click", () => {
42
+ var openTriggerData = open.dataset.openDialog;
43
+ var targetDialog = document.getElementById(openTriggerData)
44
+ if (targetDialog.open) return;
45
+ targetDialog.showModal();
46
+ });
47
+ });
48
+
49
+ closeTrigger.forEach((close) => {
50
+ close.addEventListener("click", () => {
51
+ var closeTriggerData = close.dataset.closeDialog;
52
+ document.getElementById(closeTriggerData).close();
53
+ });
54
+ });
55
+
56
+ // Close dialog box on outside click
57
+ dialogs.forEach((dialogElement) => {
58
+ dialogElement.addEventListener("mousedown", (event) => {
59
+ const dialogParentDataset = dialogElement.parentElement.dataset
60
+ if (dialogParentDataset.overlayClick === "overlay_close") return
61
+
62
+ const dialogModal = event.target.getBoundingClientRect()
63
+ const clickedOutsideDialogModal = event.clientX < dialogModal.left ||
64
+ event.clientX > dialogModal.right ||
65
+ event.clientY < dialogModal.top ||
66
+ event.clientY > dialogModal.bottom
67
+
68
+ if (clickedOutsideDialogModal) {
69
+ dialogElement.close()
70
+ event.stopPropagation()
71
+ }
72
+ })
73
+ })
74
+ }
75
+ }
@@ -134,11 +134,11 @@ body.PBDrawer__Body--close {
134
134
  transition: margin-left $animation-duration ease-out, margin-right $animation-duration ease-out;
135
135
  }
136
136
 
137
- .pb_drawer_lg_left.pb_drawer {
137
+ .pb_drawer_lg_left .pb_drawer {
138
138
  transform: translateX(-100%);
139
139
  }
140
140
 
141
- .pb_drawer_lg_right.pb_drawer {
141
+ .pb_drawer_lg_right .pb_drawer {
142
142
  transform: translateX(100%);
143
143
  }
144
144
 
@@ -157,6 +157,34 @@ body.PBDrawer__Body--close {
157
157
  animation-duration: $animation-duration;
158
158
  outline: none;
159
159
 
160
+ &.pb_drawer_within_element_rails {
161
+ position: relative;
162
+ width: 100%;
163
+ display: block;
164
+ background-color: $white;
165
+ overflow: hidden;
166
+
167
+ // Use max-height for a smooth accordion-like animation
168
+ max-height: 0;
169
+ transition: max-height $animation-duration ease-in-out;
170
+ z-index: 1;
171
+
172
+ &.open {
173
+ max-height: 1000px;
174
+ }
175
+
176
+ &::before {
177
+ content: '';
178
+ position: absolute;
179
+ top: 0;
180
+ left: 0;
181
+ right: 0;
182
+ bottom: 0;
183
+ background-color: inherit;
184
+ z-index: -1;
185
+ }
186
+ }
187
+
160
188
  &.pb_drawer_within_element {
161
189
  position: relative;
162
190
  width: 100%;
@@ -297,7 +325,6 @@ body.PBDrawer__Body--close {
297
325
  display: flex;
298
326
  background-color: rgba($bg_dark, $opacity_4);
299
327
  z-index: $z-index;
300
- opacity: 0;
301
328
  animation: overlayFade $animation-duration ease-in-out forwards;
302
329
 
303
330
  &[class*="_left"]{
@@ -325,10 +352,23 @@ body.PBDrawer__Body--close {
325
352
  left: 0;
326
353
  right: 0;
327
354
  bottom: 0;
355
+ display: flex;
328
356
  z-index: $z-index;
329
357
  opacity: 1;
330
358
  pointer-events: none;
331
359
 
360
+ &[class*="_right"]{
361
+ justify-content: flex-end;
362
+ }
363
+
364
+ &[class*="_left"]{
365
+ justify-content: flex-start;
366
+ }
367
+
368
+ &[class*="_center"]{
369
+ justify-content: center;
370
+ }
371
+
332
372
  &_before_close {
333
373
  height: 0;
334
374
  }
@@ -0,0 +1,8 @@
1
+ <%= pb_rails("button", props: { text: "Push Drawer", margin_right: "sm", data: {"open-drawer": "drawer-3"} }) %>
2
+
3
+ <%= pb_rails("drawer", props: {
4
+ id:"drawer-3",
5
+ behavior: "push"
6
+ }) do %>
7
+ Test me (Push Behavior)
8
+ <% end %>