playbook_ui 14.9.0.pre.alpha.play17004992 → 14.9.0.pre.rc.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (152) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +0 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +17 -61
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_beta_sort.html.erb +1 -1
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -3
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
  8. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +3 -5
  9. data/app/pb_kits/playbook/pb_advanced_table/table_row.html.erb +1 -3
  10. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -15
  11. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -0
  12. data/app/pb_kits/playbook/pb_background/_background.tsx +2 -8
  13. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +49 -53
  14. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +36 -29
  15. data/app/pb_kits/playbook/pb_body/_body.scss +13 -14
  16. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +16 -22
  17. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +0 -6
  18. data/app/pb_kits/playbook/pb_button/_button.scss +0 -6
  19. data/app/pb_kits/playbook/pb_button/_button.tsx +3 -1
  20. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +0 -15
  21. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  22. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +0 -1
  23. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +0 -8
  24. data/app/pb_kits/playbook/pb_button/docs/_button_default.md +1 -1
  25. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -2
  26. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
  27. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +2 -2
  28. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +4 -0
  29. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +7 -84
  30. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +4 -11
  31. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +2 -2
  32. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +2 -2
  33. data/app/pb_kits/playbook/pb_currency/_currency.tsx +3 -7
  34. data/app/pb_kits/playbook/pb_currency/currency.html.erb +2 -2
  35. data/app/pb_kits/playbook/pb_currency/currency.rb +1 -17
  36. data/app/pb_kits/playbook/pb_currency/currency.test.js +3 -40
  37. data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -2
  38. data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
  39. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +0 -1
  40. data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +45 -159
  41. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -1
  42. data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
  43. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -1
  44. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -0
  45. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +4 -0
  46. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +2 -13
  47. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +0 -5
  48. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +2 -7
  49. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +2 -8
  50. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -2
  51. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  52. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +12 -63
  53. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -3
  54. data/app/pb_kits/playbook/pb_layout/_layout.tsx +3 -6
  55. data/app/pb_kits/playbook/pb_link/_link.scss +3 -3
  56. data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +1 -11
  57. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +2 -16
  58. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  59. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -3
  60. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
  61. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +3 -5
  62. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +2 -3
  63. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +0 -5
  64. data/app/pb_kits/playbook/pb_section_separator/_section_separator.scss +1 -4
  65. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -3
  66. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
  67. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.html.erb +1 -2
  68. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  69. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +36 -44
  70. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
  71. data/app/pb_kits/playbook/pb_table/_table.tsx +25 -109
  72. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -5
  73. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -6
  74. data/app/pb_kits/playbook/pb_table/index.ts +26 -100
  75. data/app/pb_kits/playbook/pb_table/styles/_all.scss +0 -3
  76. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -106
  77. data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
  78. data/app/pb_kits/playbook/pb_table/table.rb +2 -17
  79. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -35
  80. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -1
  81. data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
  82. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +2 -139
  83. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -47
  84. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -59
  85. data/app/pb_kits/playbook/pb_title/_title.scss +5 -6
  86. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -13
  87. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -3
  88. data/app/pb_kits/playbook/pb_typeahead/index.ts +3 -29
  89. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  90. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
  91. data/app/pb_kits/playbook/tokens/_titles.scss +8 -0
  92. data/app/pb_kits/playbook/utilities/_hover.scss +2 -11
  93. data/app/pb_kits/playbook/utilities/_max_width.scss +9 -29
  94. data/app/pb_kits/playbook/utilities/_min_width.scss +2 -6
  95. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -1
  96. data/app/pb_kits/playbook/utilities/globalProps.ts +4 -39
  97. data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -15
  98. data/dist/chunks/_typeahead-D0PihN_3.js +22 -0
  99. data/dist/chunks/_weekday_stacked-uMIX8f-A.js +45 -0
  100. data/dist/chunks/{lib-CuCy3_xO.js → lib-BC6ESsxG.js} +3 -3
  101. data/dist/chunks/{pb_form_validation-D37k10a0.js → pb_form_validation-B_Z9rEbg.js} +1 -1
  102. data/dist/chunks/vendor.js +1 -1
  103. data/dist/menu.yml +1 -322
  104. data/dist/playbook-doc.js +1 -1
  105. data/dist/playbook-rails-react-bindings.js +1 -1
  106. data/dist/playbook-rails.js +1 -1
  107. data/dist/playbook.css +1 -1
  108. data/lib/playbook/classnames.rb +0 -4
  109. data/lib/playbook/forms/builder/typeahead_field.rb +0 -13
  110. data/lib/playbook/hover.rb +1 -7
  111. data/lib/playbook/kit_base.rb +1 -16
  112. data/lib/playbook/spacing.rb +0 -21
  113. data/lib/playbook/version.rb +2 -2
  114. metadata +6 -42
  115. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.html.erb +0 -53
  116. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.md +0 -5
  117. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -50
  118. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +0 -1
  119. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -57
  120. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +0 -5
  121. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +0 -5600
  122. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +0 -4
  123. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +0 -16
  124. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +0 -31
  125. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +0 -6
  126. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +0 -95
  127. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +0 -87
  128. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +0 -2
  129. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +0 -75
  130. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.md +0 -1
  131. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +0 -108
  132. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md +0 -2
  133. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +0 -94
  134. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md +0 -0
  135. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx +0 -83
  136. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +0 -3
  137. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx +0 -120
  138. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +0 -1
  139. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -35
  140. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +0 -4
  141. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +0 -18
  142. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +0 -88
  143. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +0 -64
  144. data/app/pb_kits/playbook/tokens/_height.scss +0 -19
  145. data/app/pb_kits/playbook/tokens/exports/_height.module.scss +0 -37
  146. data/app/pb_kits/playbook/utilities/_height.scss +0 -33
  147. data/app/pb_kits/playbook/utilities/_width.scss +0 -45
  148. data/dist/chunks/_typeahead-l1kq1p9m.js +0 -22
  149. data/dist/chunks/_weekday_stacked-B28kYXl9.js +0 -45
  150. data/lib/playbook/height.rb +0 -29
  151. data/lib/playbook/max_height.rb +0 -29
  152. data/lib/playbook/min_height.rb +0 -29
@@ -77,12 +77,6 @@ $pb_button_sizes: (
77
77
  &[class*=_loading] {
78
78
  @include pb_button_loading(true);
79
79
  }
80
-
81
- // Danger ===================
82
- &[class*=_danger] {
83
- @include pb_button_danger;
84
- }
85
-
86
80
  // Dark Variants =============
87
81
  &.dark {
88
82
  &[class*=_primary] {
@@ -37,7 +37,7 @@ type ButtonPropTypes = {
37
37
  type?: 'inline' | null,
38
38
  htmlType?: 'submit' | 'reset' | 'button' | undefined,
39
39
  value?: string | null,
40
- variant?: 'primary' | 'secondary' | 'link'| 'danger' | 'reaction',
40
+ variant?: 'primary' | 'secondary' | 'link'| 'reaction',
41
41
  wrapperClass?: string,
42
42
  } & GlobalProps
43
43
 
@@ -206,6 +206,8 @@ const Button = (props: ButtonPropTypes): React.ReactElement => {
206
206
  <Icon icon={icon ? icon : "face-smile-plus"} />
207
207
  )
208
208
  }
209
+
210
+
209
211
  </button>
210
212
  );
211
213
  } else {
@@ -167,21 +167,6 @@ $pb_button_border_width: 0px;
167
167
  }
168
168
  }
169
169
 
170
- // Danger ======================
171
- @mixin pb_button_danger {
172
- @include pb_button_variant($error, $text_dk_default, transparent);
173
-
174
- @media (hover:hover) {
175
- &:hover {
176
- @include pb_button_hover($bg: darken($error, $pb_button_hover_darken));
177
- }
178
- &:active {
179
- transition: none;
180
- @include pb_button_variant($error);
181
- }
182
- }
183
- }
184
-
185
170
  // Dark Primary =================
186
171
  @mixin pb_button_primary_dark{
187
172
  @include pb_button_variant($primary_action);
@@ -16,7 +16,7 @@ module Playbook
16
16
  prop :new_window, type: Playbook::Props::Boolean,
17
17
  default: false
18
18
  prop :variant, type: Playbook::Props::Enum,
19
- values: %w[primary secondary link danger reaction],
19
+ values: %w[primary secondary link reaction],
20
20
  default: "primary"
21
21
  prop :count, type: Playbook::Props::Number
22
22
  prop :highlight, type: Playbook::Props::Boolean,
@@ -2,5 +2,4 @@
2
2
  <%= pb_rails("button", props: { text: "Button Secondary", variant: "secondary", margin_right: "lg" }) %>
3
3
  <%= pb_rails("button", props: { text: "Button Link", variant: "link", margin_right: "lg" }) %>
4
4
  <%= pb_rails("button", props: { text: "Button Disabled", disabled: true, margin_right: "lg" }) %>
5
- <%= pb_rails("button", props: { text: "Button Danger", variant: "danger", margin_right: "lg" }) %>
6
5
 
@@ -34,14 +34,6 @@ const ButtonDefault = (props) => (
34
34
  text='Button Disabled'
35
35
  {...props}
36
36
  />
37
- <Button
38
- marginRight='lg'
39
- onClick={() => alert("button clicked!")}
40
- tabIndex={0}
41
- text='Button Danger'
42
- variant='danger'
43
- {...props}
44
- />
45
37
  </div>
46
38
  )
47
39
 
@@ -1 +1 @@
1
- The primary button is used for the most important button on the page. Secondary buttons can be used for actions that are less important. Button links can be helpful for buttons that do not need a lot of attention drawn to them. Disabled buttons are used when you don't want the user to click the button. Danger buttons are used to indicate destructive actions such as deleting.
1
+ The primary button is used for the most important button on the page. Secondary buttons can be used for actions that are less important. Button links can be helpful for buttons that do not need a lot of attention drawn to them. Disabled buttons are used when you don't want the user to click the button.
@@ -13,10 +13,9 @@ $pb_caption_colors: (
13
13
  $pb_dark_caption_colors: (
14
14
  default: $text_dk_default,
15
15
  light: $text_dk_light,
16
- lighter: $text_dk_lighter,
17
16
  link: $active_dark,
18
17
  success: $text_dk_success_sm,
19
- error: $error_dark,
18
+ error: $error,
20
19
  );
21
20
 
22
21
 
@@ -32,7 +32,7 @@ $pb_card_header_colors: map-merge(map-merge($product_colors, $additional_colors)
32
32
  }
33
33
 
34
34
  @mixin pb_card_selected_dark {
35
- @include pb_card_selected($primary_action_dark);
35
+ @include pb_card_selected($primary_action);
36
36
  }
37
37
 
38
38
  @mixin pb_card($background: $card_light, $border_color: $border_light) {
@@ -6,12 +6,12 @@
6
6
  ) do %>
7
7
  <%= content.presence || object.input %>
8
8
  <% if object.indeterminate %>
9
- <span data-pb-checkbox-icon-span="true" class="pb_checkbox_indeterminate">
9
+ <span class="pb_checkbox_indeterminate">
10
10
  <%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon", fixed_width: true}) %>
11
11
  <%= pb_rails("icon", props: { icon: "check", classname: "check_icon hidden", fixed_width: true}) %>
12
12
  </span>
13
13
  <% else %>
14
- <span data-pb-checkbox-icon-span="true" class="pb_checkbox_checkmark">
14
+ <span class="pb_checkbox_checkmark">
15
15
  <%= pb_rails("icon", props: { icon: "check", classname: "check_icon", fixed_width: true}) %>
16
16
  <%= pb_rails("icon", props: { icon: "minus", classname: "indeterminate_icon hidden", fixed_width: true}) %>
17
17
  </span>
@@ -18,6 +18,10 @@ module Playbook
18
18
  prop :form_spacing, type: Playbook::Props::Boolean,
19
19
  default: false
20
20
 
21
+ def checked_html
22
+ checked ? "checked='true'" : nil
23
+ end
24
+
21
25
  def classname
22
26
  generate_classname("pb_checkbox_kit", checked_class) + indeterminate_class + error_class
23
27
  end
@@ -1,84 +1,7 @@
1
- <% checkboxes = [
2
- { name: 'Coffee', id: 'coffee', checked: false },
3
- { name: 'Ice Cream', id: 'ice-cream', checked: false },
4
- { name: 'Chocolate', id: 'chocolate', checked: true }
5
- ] %>
6
-
7
- <%= pb_rails("table", props: { container: false, size: "md" }) do %>
8
- <thead>
9
- <tr>
10
- <th>
11
- <%= pb_rails("checkbox", props: {
12
- checked: true,
13
- text: "Uncheck All",
14
- value: "checkbox-value",
15
- name: "main-checkbox",
16
- indeterminate: true,
17
- id: "indeterminate-checkbox"
18
- }) %>
19
- </th>
20
- </tr>
21
- </thead>
22
-
23
- <tbody>
24
- <% checkboxes.each do |checkbox| %>
25
- <tr>
26
- <td>
27
- <%= pb_rails("checkbox", props: {
28
- checked: checkbox[:checked],
29
- text: checkbox[:name],
30
- value: checkbox[:id],
31
- name: "#{checkbox[:id]}-indeterminate-checkbox",
32
- id: "#{checkbox[:id]}-indeterminate-checkbox",
33
- }) %>
34
- </td>
35
- </tr>
36
- <% end %>
37
- </tbody>
38
- <% end %>
39
-
40
- <script>
41
- document.addEventListener('DOMContentLoaded', function() {
42
- const mainCheckboxWrapper = document.getElementById('indeterminate-checkbox');
43
- const mainCheckbox = document.getElementsByName("main-checkbox")[0];
44
- const childCheckboxes = document.querySelectorAll('input[type="checkbox"][id$="indeterminate-checkbox"]');
45
-
46
- const updateMainCheckbox = () => {
47
- // Count the number of checked child checkboxes
48
- const checkedCount = Array.from(childCheckboxes).filter(cb => cb.checked).length;
49
- // Determine if the main checkbox should be in an indeterminate state
50
- const indeterminate = checkedCount > 0 && checkedCount < childCheckboxes.length;
51
-
52
- // Set the main checkbox states
53
- mainCheckbox.indeterminate = indeterminate;
54
- mainCheckbox.checked = checkedCount > 0;
55
-
56
- // Determine the main checkbox label based on the number of checked checkboxes
57
- const text = checkedCount === 0 ? 'Check All' : 'Uncheck All';
58
-
59
- // Determine the icon class to add and remove based on the number of checked checkboxes
60
- const iconClassToAdd = checkedCount === 0 ? 'pb_checkbox_checkmark' : 'pb_checkbox_indeterminate';
61
- const iconClassToRemove = checkedCount === 0 ? 'pb_checkbox_indeterminate' : 'pb_checkbox_checkmark';
62
-
63
- // Update main checkbox label
64
- mainCheckboxWrapper.getElementsByClassName('pb_body_kit')[0].textContent = text;
65
-
66
- // Add and remove the icon class to the main checkbox wrapper
67
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.add(iconClassToAdd);
68
- mainCheckboxWrapper.querySelector('[data-pb-checkbox-icon-span]').classList.remove(iconClassToRemove);
69
-
70
- // Toggle the visibility of the checkbox icon based on the indeterminate state
71
- mainCheckboxWrapper.getElementsByClassName("indeterminate_icon")[0].classList.toggle('hidden', !indeterminate);
72
- mainCheckboxWrapper.getElementsByClassName("check_icon")[0].classList.toggle('hidden', indeterminate);
73
- };
74
-
75
- mainCheckbox.addEventListener('change', function() {
76
- childCheckboxes.forEach(cb => cb.checked = this.checked);
77
- updateMainCheckbox();
78
- });
79
-
80
- childCheckboxes.forEach(cb => {
81
- cb.addEventListener('change', updateMainCheckbox);
82
- });
83
- });
84
- </script>
1
+ <%= pb_rails("checkbox" , props: {
2
+ text: "Select ",
3
+ value: "checkbox-value",
4
+ name: "main",
5
+ indeterminate: true,
6
+ id: "test-indeterminate-js"
7
+ }) %>
@@ -2,7 +2,7 @@ import React, { useEffect, ReactElement } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import useCollapsible from './useCollapsible'
4
4
 
5
- import { globalProps, globalInlineProps, GlobalProps } from '../utilities/globalProps'
5
+ import { globalProps } from '../utilities/globalProps'
6
6
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
7
7
 
8
8
  import CollapsibleContent from './child_kits/CollapsibleContent'
@@ -32,7 +32,6 @@ type CollapsibleProps = {
32
32
  onClick?: ()=> void,
33
33
  htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
34
34
  id?: string,
35
- tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'span' | 'div' | 'tr' | 'th' | 'td' | 'thead' | 'col',
36
35
  }
37
36
 
38
37
  const Collapsible = ({
@@ -48,9 +47,8 @@ const Collapsible = ({
48
47
  onIconClick,
49
48
  onClick,
50
49
  id,
51
- tag = 'div',
52
50
  ...props
53
- }: CollapsibleProps & GlobalProps): React.ReactElement => {
51
+ }: CollapsibleProps): React.ReactElement => {
54
52
  const [isCollapsed, toggle, setIsCollapsed] = useCollapsible(collapsed)
55
53
 
56
54
  useEffect(()=> {
@@ -77,19 +75,14 @@ const Collapsible = ({
77
75
  globalProps(props),
78
76
  className
79
77
  )
80
- const dynamicInlineProps = globalInlineProps(props)
81
-
82
- const Tag: React.ReactElement | any = `${tag}`;
83
-
84
78
  return (
85
79
  <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick }}>
86
- <Tag
80
+ <div
87
81
  {...ariaProps}
88
82
  {...dataProps}
89
83
  {...htmlProps}
90
84
  className={classes}
91
85
  id={id}
92
- style={dynamicInlineProps}
93
86
  >
94
87
  {Main ? (
95
88
  <CollapsibleMain {...mainProps}>
@@ -101,7 +94,7 @@ const Collapsible = ({
101
94
  <CollapsibleContent {...contentProps}>
102
95
  {contentChildren}
103
96
  </CollapsibleContent>
104
- </Tag>
97
+ </div>
105
98
  </CollapsibleContext.Provider>
106
99
  )
107
100
  }
@@ -1,7 +1,7 @@
1
1
  import classnames from 'classnames'
2
2
  import React, { useContext, useRef, useEffect } from 'react'
3
3
  import { buildCss } from '../../utilities/props'
4
- import { globalProps, GlobalProps } from '../../utilities/globalProps'
4
+ import { globalProps } from '../../utilities/globalProps'
5
5
  import { hideElement, showElement } from '../_helper_functions'
6
6
 
7
7
  import CollapsibleContext from '../context'
@@ -15,7 +15,7 @@ const CollapsibleContent = ({
15
15
  children,
16
16
  className,
17
17
  ...props
18
- }: CollapsibleContentProps & GlobalProps): React.ReactElement => {
18
+ }: CollapsibleContentProps): React.ReactElement => {
19
19
  const context: {[key: string]: boolean | string} = useContext(CollapsibleContext)
20
20
  const contentCSS = buildCss('pb_collapsible_content_kit')
21
21
  const contentSpacing = globalProps(props)
@@ -3,7 +3,7 @@
3
3
  import classnames from 'classnames'
4
4
  import React, { useContext } from 'react'
5
5
  import { buildCss } from '../../utilities/props'
6
- import { globalProps, GlobalProps } from '../../utilities/globalProps'
6
+ import { globalProps } from '../../utilities/globalProps'
7
7
 
8
8
  import Flex from '../../pb_flex/_flex'
9
9
  import FlexItem from '../../pb_flex/_flex_item'
@@ -25,7 +25,7 @@ const CollapsibleMain = ({
25
25
  className,
26
26
  cursor = 'pointer',
27
27
  ...props
28
- }: CollapsibleMainProps & GlobalProps): React.ReactElement=> {
28
+ }: CollapsibleMainProps): React.ReactElement=> {
29
29
  const {collapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick}: any = useContext(CollapsibleContext)
30
30
  const mainCSS = buildCss('pb_collapsible_main_kit')
31
31
  const mainSpacing = globalProps(props, { cursor })
@@ -101,11 +101,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
101
101
  return decimalPart ? `${formattedWhole}.${decimalPart}` : formattedWhole;
102
102
  }
103
103
 
104
- const swapNegative = size === "sm" && symbol !== ""
105
- const handleNegative = amount.startsWith("-") && swapNegative ? "-" : ""
106
- const getAbsoluteAmount = (amountString: string) => amountString.replace(/^-/,'')
107
- const getAbbrOrFormatAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
108
- const getAmount = swapNegative ? getAbsoluteAmount(getAbbrOrFormatAmount) : getAbbrOrFormatAmount
104
+ const getAmount = abbreviate ? getAbbreviatedValue('amount') : formatAmount(getMatchingDecimalAmount)
109
105
  const getAbbreviation = abbreviate ? getAbbreviatedValue('unit') : null
110
106
  const getDecimalValue = abbreviate ? '' : getMatchingDecimalValue
111
107
 
@@ -122,7 +118,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
122
118
  <div className={`pb_currency_wrapper${variantClass || emphasizedClass}`}>
123
119
  {unstyled ? (
124
120
  <>
125
- <div>{handleNegative}{symbol}</div>
121
+ <div>{symbol}</div>
126
122
  <div>{getAmount}</div>
127
123
  <div>
128
124
  {getAbbreviation}
@@ -136,7 +132,7 @@ const Currency = (props: CurrencyProps): React.ReactElement => {
136
132
  color="light"
137
133
  dark={dark}
138
134
  >
139
- {handleNegative}{symbol}
135
+ {symbol}
140
136
  </Body>
141
137
 
142
138
  <Title
@@ -3,12 +3,12 @@
3
3
 
4
4
  <div class=<%= "pb_currency_wrapper#{object.variant_class || object.emphasized_class}" %>>
5
5
  <% if object.unstyled %>
6
- <div><%= object.negative_sign %><%= object.symbol %></div>
6
+ <div><%= object.symbol %></div>
7
7
  <div><%= object.title_props[:text] %></div>
8
8
  <div><%= object.body_props[:text] %></div>
9
9
  <% else %>
10
10
  <%= pb_rails("body", props: object.currency_wrapper_props) do %>
11
- <%= object.negative_sign %><%= object.symbol %>
11
+ <%= object.symbol %>
12
12
  <% end %>
13
13
  <%= pb_rails("title", props: object.title_props) %>
14
14
  <%= pb_rails("body", props: object.body_props) %>
@@ -68,20 +68,12 @@ module Playbook
68
68
  def title_props
69
69
  {
70
70
  size: size_value,
71
- text: swap_negative ? absolute_amount(abbr_or_format_amount) : abbr_or_format_amount,
71
+ text: abbreviate ? abbreviated_value : formatted_amount,
72
72
  classname: "pb_currency_value",
73
73
  dark: dark,
74
74
  }
75
75
  end
76
76
 
77
- def abbr_or_format_amount
78
- abbreviate ? abbreviated_value : formatted_amount
79
- end
80
-
81
- def negative_sign
82
- amount.starts_with?("-") && swap_negative ? "-" : ""
83
- end
84
-
85
77
  def body_props
86
78
  {
87
79
  text: units_element,
@@ -167,14 +159,6 @@ module Playbook
167
159
  whole_value
168
160
  end
169
161
  end
170
-
171
- def absolute_amount(amount_string)
172
- amount_string.sub(/^-/, "")
173
- end
174
-
175
- def swap_negative
176
- size == "sm" && symbol != ""
177
- end
178
162
  end
179
163
  end
180
164
  end
@@ -65,7 +65,7 @@ test('decimals default prop returns decimals as body text', () => {
65
65
 
66
66
  test('commaSeparator prop returns comma separated amount', () => {
67
67
  render(
68
- <Currency
68
+ <Currency
69
69
  amount="1234567890"
70
70
  commaSeparator
71
71
  data={{ testid: 'comma-test' }}
@@ -76,7 +76,7 @@ test('commaSeparator prop returns comma separated amount', () => {
76
76
 
77
77
  test('commaSeparator prop returns comma separated amount with decimals', () => {
78
78
  render(
79
- <Currency
79
+ <Currency
80
80
  amount="1234567890.12"
81
81
  commaSeparator
82
82
  data={{ testid: 'comma-test-decimals' }}
@@ -87,7 +87,7 @@ test('commaSeparator prop returns comma separated amount with decimals', () => {
87
87
 
88
88
  test('commaSeparator prop returns comma separated amount with decimals="matching"', () => {
89
89
  render(
90
- <Currency
90
+ <Currency
91
91
  amount="1234567890.12"
92
92
  commaSeparator
93
93
  data={{ testid: 'comma-test-decimals-matching' }}
@@ -96,40 +96,3 @@ test('commaSeparator prop returns comma separated amount with decimals="matching
96
96
  )
97
97
  expect(screen.getByTestId('comma-test-decimals-matching')).toHaveTextContent('1,234,567,890.12')
98
98
  })
99
-
100
- test('handles negative amounts correctly', () => {
101
- render(
102
- <>
103
- <Currency
104
- amount="-320"
105
- data={{ testid: 'test-negative-default' }}
106
- />
107
- <Currency
108
- abbreviate
109
- amount="-3200000"
110
- data={{ testid: 'test-negative-millions' }}
111
- />
112
- <Currency
113
- amount="-123456.78"
114
- commaSeparator
115
- data={{ testid: 'test-negative-comma-decimals' }}
116
- />
117
- <Currency
118
- amount="-400.50"
119
- data={{ testid: 'test-negative-no-symbol' }}
120
- symbol=""
121
- />
122
- <Currency
123
- amount="-500.55"
124
- data={{ testid: 'test-negative-medium-size' }}
125
- size="md"
126
- />
127
- </>
128
- )
129
-
130
- expect(screen.getByTestId('test-negative-default')).toHaveTextContent('-$320')
131
- expect(screen.getByTestId('test-negative-millions')).toHaveTextContent('-$3.2M')
132
- expect(screen.getByTestId('test-negative-comma-decimals')).toHaveTextContent('-$123,456.78')
133
- expect(screen.getByTestId('test-negative-no-symbol')).toHaveTextContent('-400.50')
134
- expect(screen.getByTestId('test-negative-medium-size')).toHaveTextContent('$-500.55')
135
- })
@@ -9,7 +9,6 @@ examples:
9
9
  - currency_matching_decimals: Matching Decimals
10
10
  - currency_unstyled: Unstyled
11
11
  - currency_comma_separator: Comma Separator
12
- - currency_negative: Negative
13
12
 
14
13
  react:
15
14
  - currency_variants: Variants
@@ -20,7 +19,6 @@ examples:
20
19
  - currency_matching_decimals: Matching Decimals
21
20
  - currency_unstyled: Unstyled
22
21
  - currency_comma_separator: Comma Separator
23
- - currency_negative: Negative
24
22
 
25
23
  swift:
26
24
  - currency_size_swift: Size
@@ -6,4 +6,3 @@ 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'
@@ -88,7 +88,6 @@ body.PBDrawer__Body--close {
88
88
  }
89
89
 
90
90
  .pb_drawer.pb_drawer_after_open {
91
- pointer-events: auto;
92
91
  transform: translate3d(0, 0, 0);
93
92
  }
94
93