playbook_ui 14.9.0.pre.alpha.play1742globalheightfixes4766 → 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 (100) 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_row.html.erb +1 -3
  9. data/app/pb_kits/playbook/pb_advanced_table/table_row.rb +0 -15
  10. data/app/pb_kits/playbook/pb_background/_background.tsx +2 -8
  11. data/app/pb_kits/playbook/pb_button/_button.scss +0 -6
  12. data/app/pb_kits/playbook/pb_button/_button.tsx +3 -1
  13. data/app/pb_kits/playbook/pb_button/_button_mixins.scss +0 -15
  14. data/app/pb_kits/playbook/pb_button/button.rb +1 -1
  15. data/app/pb_kits/playbook/pb_button/docs/_button_default.html.erb +0 -1
  16. data/app/pb_kits/playbook/pb_button/docs/_button_default.jsx +0 -8
  17. data/app/pb_kits/playbook/pb_button/docs/_button_default.md +1 -1
  18. data/app/pb_kits/playbook/pb_checkbox/checkbox.html.erb +2 -2
  19. data/app/pb_kits/playbook/pb_checkbox/checkbox.rb +4 -0
  20. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_indeterminate.html.erb +7 -84
  21. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +1 -3
  22. data/app/pb_kits/playbook/pb_currency/_currency.tsx +3 -7
  23. data/app/pb_kits/playbook/pb_currency/currency.html.erb +2 -2
  24. data/app/pb_kits/playbook/pb_currency/currency.rb +1 -17
  25. data/app/pb_kits/playbook/pb_currency/currency.test.js +3 -40
  26. data/app/pb_kits/playbook/pb_currency/docs/example.yml +0 -2
  27. data/app/pb_kits/playbook/pb_currency/docs/index.js +0 -1
  28. data/app/pb_kits/playbook/pb_drawer/_drawer.scss +0 -1
  29. data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +45 -159
  30. data/app/pb_kits/playbook/pb_drawer/docs/example.yml +1 -1
  31. data/app/pb_kits/playbook/pb_drawer/docs/index.js +0 -1
  32. data/app/pb_kits/playbook/pb_dropdown/_dropdown.scss +0 -1
  33. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.html.erb +1 -0
  34. data/app/pb_kits/playbook/pb_dropdown/dropdown_container.rb +4 -0
  35. data/app/pb_kits/playbook/pb_dropdown/utilities/subComponentHelper.tsx +2 -13
  36. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -2
  37. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
  38. data/app/pb_kits/playbook/pb_form/docs/_form_form_with_validate.html.erb +12 -63
  39. data/app/pb_kits/playbook/pb_image/_image.tsx +1 -3
  40. data/app/pb_kits/playbook/pb_layout/_layout.tsx +14 -36
  41. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +1 -3
  42. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
  43. data/app/pb_kits/playbook/pb_progress_simple/_progress_simple.tsx +3 -5
  44. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +2 -3
  45. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.rb +0 -5
  46. data/app/pb_kits/playbook/pb_section_separator/_section_separator.tsx +1 -3
  47. data/app/pb_kits/playbook/pb_selectable_card/docs/_selectable_card_default.html.erb +1 -2
  48. data/app/pb_kits/playbook/pb_table/_table.tsx +25 -109
  49. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -1
  50. data/app/pb_kits/playbook/pb_table/styles/_all.scss +0 -2
  51. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.html.erb +0 -47
  52. data/app/pb_kits/playbook/pb_timeline/docs/_timeline_with_children.jsx +0 -59
  53. data/app/pb_kits/playbook/pb_typeahead/_typeahead.scss +0 -3
  54. data/app/pb_kits/playbook/pb_typeahead/index.ts +3 -29
  55. data/app/pb_kits/playbook/pb_typeahead/typeahead.html.erb +2 -5
  56. data/app/pb_kits/playbook/pb_typeahead/typeahead.rb +0 -4
  57. data/app/pb_kits/playbook/utilities/_max_width.scss +9 -29
  58. data/app/pb_kits/playbook/utilities/_min_width.scss +2 -6
  59. data/app/pb_kits/playbook/utilities/globalPropNames.mjs +1 -1
  60. data/app/pb_kits/playbook/utilities/globalProps.ts +4 -37
  61. data/dist/chunks/_typeahead-D0PihN_3.js +22 -0
  62. data/dist/chunks/_weekday_stacked-uMIX8f-A.js +45 -0
  63. data/dist/chunks/{lib-SyD3buPZ.js → lib-BC6ESsxG.js} +1 -1
  64. data/dist/chunks/{pb_form_validation-Dt8UJgrJ.js → pb_form_validation-B_Z9rEbg.js} +1 -1
  65. data/dist/chunks/vendor.js +1 -1
  66. data/dist/menu.yml +0 -321
  67. data/dist/playbook-doc.js +1 -1
  68. data/dist/playbook-rails-react-bindings.js +1 -1
  69. data/dist/playbook-rails.js +1 -1
  70. data/dist/playbook.css +1 -1
  71. data/lib/playbook/classnames.rb +0 -4
  72. data/lib/playbook/forms/builder/typeahead_field.rb +0 -13
  73. data/lib/playbook/kit_base.rb +1 -16
  74. data/lib/playbook/spacing.rb +0 -21
  75. data/lib/playbook/version.rb +2 -2
  76. metadata +6 -28
  77. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.html.erb +0 -53
  78. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_custom_cell_rails.md +0 -5
  79. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -50
  80. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +0 -1
  81. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -57
  82. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +0 -5
  83. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +0 -5600
  84. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.html.erb +0 -4
  85. data/app/pb_kits/playbook/pb_currency/docs/_currency_negative.jsx +0 -16
  86. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.jsx +0 -31
  87. data/app/pb_kits/playbook/pb_drawer/docs/_drawer_menu.md +0 -6
  88. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.jsx +0 -87
  89. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns_react.md +0 -2
  90. data/app/pb_kits/playbook/pb_table/styles/_scroll.scss +0 -4
  91. data/app/pb_kits/playbook/pb_table/styles/_sticky_columns.scss +0 -18
  92. data/app/pb_kits/playbook/tokens/_height.scss +0 -19
  93. data/app/pb_kits/playbook/tokens/exports/_height.module.scss +0 -37
  94. data/app/pb_kits/playbook/utilities/_height.scss +0 -33
  95. data/app/pb_kits/playbook/utilities/_width.scss +0 -45
  96. data/dist/chunks/_typeahead-B8fkIeXA.js +0 -22
  97. data/dist/chunks/_weekday_stacked-DjRTXEi-.js +0 -45
  98. data/lib/playbook/height.rb +0 -29
  99. data/lib/playbook/max_height.rb +0 -29
  100. data/lib/playbook/min_height.rb +0 -29
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b11194d151b3e24db52c214a1e3dcad53c2a70fa66202a339f52208baea87636
4
- data.tar.gz: bc9bcfd9149d3501e2ad32a85e5f20c49d0b9a24366a3432cbd1af254a32a8f4
3
+ metadata.gz: 47520ce9398f8aa52de58407b61451e364bb6ea6c79ef2f69b0489568423ba48
4
+ data.tar.gz: eef14ed7518ad125404d5e12def9432bf114f68d6aebf28441b3bb0be0289e9b
5
5
  SHA512:
6
- metadata.gz: 05141da61222882833c06a7e264cab818552acf7ee1624a77196a3103c8942ae867d353d012680db35d702676c933cb125f91e51c7db966fec51b96d8b84a723
7
- data.tar.gz: be4d849aaac1e5ae95a43d1714b7cde01235d586f9eaf871e55d399fda9291bc26b45c4a590460147364001d872e0835dc9e3518e1a18ace66bbd97d9e0cd242
6
+ metadata.gz: 3152f44d47e293ce8b18149179592c917a13d4053512cc035155444b7a4f3d9548393cdda692bd79578a4bf41a8d54361d287e36a0e05a4e960025ab00cb7875
7
+ data.tar.gz: bb56a8669a4faa58aa4749294711c92b28facf23439af23f628d13720d01484f2e7fc9bcf399d266b9a7d50377b04f87cd0b9be026bd0b9de7928d76d3c8bbc1
@@ -111,7 +111,6 @@
111
111
  @import 'utilities/mixins';
112
112
  @import 'utilities/spacing';
113
113
  @import 'utilities/cursor';
114
- @import 'utilities/width';
115
114
  @import 'utilities/min_width';
116
115
  @import 'utilities/max_width';
117
116
  @import 'utilities/positioning';
@@ -127,4 +126,3 @@
127
126
  @import 'utilities/overflow';
128
127
  @import 'utilities/truncate';
129
128
  @import 'utilities/vertical_align';
130
- @import 'utilities/height';
@@ -7,7 +7,6 @@ import {
7
7
  createColumnHelper,
8
8
  getCoreRowModel,
9
9
  getExpandedRowModel,
10
- getPaginationRowModel,
11
10
  getSortedRowModel,
12
11
  Row,
13
12
  useReactTable,
@@ -26,7 +25,6 @@ import { updateExpandAndCollapseState } from "./Utilities/ExpansionControlHelper
26
25
  import { CustomCell } from "./Components/CustomCell"
27
26
  import { TableHeader } from "./SubKits/TableHeader"
28
27
  import { TableBody } from "./SubKits/TableBody"
29
- import Pagination from "../pb_pagination/_pagination"
30
28
 
31
29
  type AdvancedTableProps = {
32
30
  aria?: { [key: string]: string }
@@ -44,8 +42,6 @@ type AdvancedTableProps = {
44
42
  loading?: boolean | string
45
43
  onRowToggleClick?: (arg: Row<GenericObject>) => void
46
44
  onToggleExpansionClick?: (arg: Row<GenericObject>) => void
47
- pagination?: boolean,
48
- paginationProps?: GenericObject
49
45
  responsive?: "scroll" | "none",
50
46
  sortControl?: GenericObject
51
47
  tableData: GenericObject[]
@@ -71,8 +67,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
71
67
  loading,
72
68
  onRowToggleClick,
73
69
  onToggleExpansionClick,
74
- pagination = false,
75
- paginationProps,
76
70
  responsive = "scroll",
77
71
  sortControl,
78
72
  tableData,
@@ -183,17 +177,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
183
177
  }
184
178
  }
185
179
 
186
- const paginationInitializer = pagination ? {
187
- getPaginationRowModel: getPaginationRowModel(),
188
- paginateExpandedRows: false,
189
- initialState: {
190
- pagination: {
191
- pageIndex: paginationProps?.pageIndex ?? 0,
192
- pageSize: paginationProps?.pageSize ?? 20,
193
- },
194
- },
195
- } : {}
196
-
197
180
  //initialize table
198
181
  const table = useReactTable({
199
182
  data: loading ? Array(loadingStateRowCount).fill({}) : tableData,
@@ -206,7 +189,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
206
189
  enableSortingRemoval: false,
207
190
  sortDescFirst: true,
208
191
  ...expandAndSortState(),
209
- ... paginationInitializer,
210
192
  ...tableOptions,
211
193
  })
212
194
 
@@ -245,10 +227,6 @@ const AdvancedTable = (props: AdvancedTableProps) => {
245
227
  className
246
228
  )
247
229
 
248
- const onPageChange = (page: number) => {
249
- table.setPageIndex(page - 1)
250
- }
251
-
252
230
  return (
253
231
  <div {...ariaProps}
254
232
  {...dataProps}
@@ -272,45 +250,23 @@ const AdvancedTable = (props: AdvancedTableProps) => {
272
250
  toggleExpansionIcon,
273
251
  }}
274
252
  >
275
- <>
276
- {pagination &&
277
- <Pagination
278
- current={table.getState().pagination.pageIndex + 1}
279
- key={`pagination-top-${table.getState().pagination.pageIndex + 1}`}
280
- marginBottom="xs"
281
- onChange={onPageChange}
282
- range={paginationProps?.range ? paginationProps?.range : 5}
283
- total={table.getPageCount()}
284
- />
285
- }
286
- <Table
287
- className={`${loading ? "content-loading" : ""}`}
288
- dark={dark}
289
- dataTable
290
- numberSpacing="tabular"
291
- responsive="none"
292
- {...tableProps}
293
- >
294
- {children ? (
295
- children
296
- ) : (
297
- <>
298
- <TableHeader />
299
- <TableBody />
300
- </>
301
- )}
302
- </Table>
303
- {pagination &&
304
- <Pagination
305
- current={table.getState().pagination.pageIndex + 1}
306
- key={`pagination-bottom-${table.getState().pagination.pageIndex + 1}`}
307
- marginTop="xs"
308
- onChange={onPageChange}
309
- range={paginationProps?.range ? paginationProps?.range : 5}
310
- total={table.getPageCount()}
311
- />
312
- }
313
- </>
253
+ <Table
254
+ className={`${loading ? "content-loading" : ""}`}
255
+ dark={dark}
256
+ dataTable
257
+ numberSpacing="tabular"
258
+ responsive="none"
259
+ {...tableProps}
260
+ >
261
+ {children ? (
262
+ children
263
+ ) : (
264
+ <>
265
+ <TableHeader />
266
+ <TableBody />
267
+ </>
268
+ )}
269
+ </Table>
314
270
  </AdvancedTableContext.Provider>
315
271
  </div>
316
272
  )
@@ -30,4 +30,4 @@
30
30
  }
31
31
  ] %>
32
32
 
33
- <%= pb_rails("advanced_table", props: { id: "beta_table", table_data: @table_data, column_definitions: column_definitions }) %>
33
+ <%= pb_rails("advanced_table", props: {table_data: @table_data, column_definitions: column_definitions}) %>
@@ -55,5 +55,5 @@
55
55
 
56
56
  <%= pb_rails("advanced_table", props: { table_data: @table_data, column_definitions: column_definitions }) do %>
57
57
  <%= pb_rails("advanced_table/table_header", props: { column_definitions: column_definitions }) %>
58
- <%= pb_rails("advanced_table/table_body", props: { id: "beta_sort", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
58
+ <%= pb_rails("advanced_table/table_body", props: { id: "subrow_headers", table_data: @table_data, column_definitions: column_definitions, subrow_headers: subrow_headers, enable_toggle_expansion: "all" }) %>
59
59
  <% end %>
@@ -3,7 +3,6 @@ examples:
3
3
  - advanced_table_beta: Default (Required Props)
4
4
  - advanced_table_beta_subrow_headers: SubRow Headers
5
5
  - advanced_table_beta_sort: Enable Sorting
6
- - advanced_table_custom_cell_rails: Custom Components for Cells
7
6
 
8
7
  react:
9
8
  - advanced_table_default: Default (Required Props)
@@ -18,5 +17,3 @@ examples:
18
17
  - advanced_table_inline_row_loading: Inline Row Loading
19
18
  - advanced_table_responsive: Responsive Tables
20
19
  - advanced_table_custom_cell: Custom Components for Cells
21
- - advanced_table_pagination: Pagination
22
- - advanced_table_pagination_with_props: Pagination Props
@@ -10,5 +10,3 @@ export { default as AdvancedTableTableProps } from './_advanced_table_table_prop
10
10
  export { default as AdvancedTableInlineRowLoading } from './_advanced_table_inline_row_loading.jsx'
11
11
  export { default as AdvancedTableResponsive } from './_advanced_table_responsive.jsx'
12
12
  export { default as AdvancedTableCustomCell } from './_advanced_table_custom_cell.jsx'
13
- export { default as AdvancedTablePagination } from './_advanced_table_pagination.jsx'
14
- export { default as AdvancedTablePaginationWithProps } from './_advanced_table_pagination_with_props.jsx'
@@ -11,9 +11,7 @@
11
11
  </button>
12
12
  <% end %>
13
13
  <%= pb_rails("flex/flex_item", props:{padding_left: index.zero? && object.row[:children].present? ? "none" : "xs"}) do %>
14
- <% if column[:custom_renderer].present? %>
15
- <%= raw(column[:custom_renderer].call(object.row, custom_renderer_value(column, index))) %>
16
- <% elsif index.zero? %>
14
+ <% if index.zero? %>
17
15
  <% if object.depth.zero? %>
18
16
  <%= object.row[column[:accessor].to_sym] %>
19
17
  <% else %>
@@ -26,21 +26,6 @@ module Playbook
26
26
 
27
27
  private
28
28
 
29
- def custom_renderer_value(column, index)
30
- if index.zero?
31
- if depth.zero?
32
- row[column[:accessor].to_sym]
33
- else
34
- depth_accessors.each_with_index do |item, accessor_index|
35
- key = item.to_sym
36
- return row[key] if depth - 1 == accessor_index
37
- end
38
- end
39
- else
40
- row[column[:accessor].to_sym]
41
- end
42
- end
43
-
44
29
  def subrow_depth_classname
45
30
  depth.positive? ? "depth-sub-row-#{depth}" : ""
46
31
  end
@@ -1,7 +1,7 @@
1
1
  import React, { useEffect, useState } from 'react'
2
2
  import classnames from 'classnames'
3
3
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
4
- import { GlobalProps, globalProps, globalInlineProps } from '../utilities/globalProps'
4
+ import { GlobalProps, globalProps } from '../utilities/globalProps'
5
5
 
6
6
  type BackgroundColors = 'gradient' |
7
7
  'dark' |'light' | 'white' | 'success' | 'warning' | 'error' | 'info' | 'neutral' | 'primary' | 'shadow' |
@@ -145,12 +145,6 @@ const Background = (props: BackgroundProps): React.ReactElement => {
145
145
  } : {})
146
146
  };
147
147
 
148
- const dynamicInlineProps = globalInlineProps(props);
149
- const combinedStyles = {
150
- ...backgroundStyle,
151
- ...dynamicInlineProps
152
- };
153
-
154
148
  const Tag: React.ReactElement | any = `${tag}`;
155
149
  const ariaProps = buildAriaProps(aria);
156
150
  const dataProps = buildDataProps(data);
@@ -164,7 +158,7 @@ const Background = (props: BackgroundProps): React.ReactElement => {
164
158
  alt={alt}
165
159
  className={classes}
166
160
  id={id}
167
- style={combinedStyles}
161
+ style={backgroundStyle}
168
162
  >
169
163
  {children}
170
164
  </Tag>
@@ -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.
@@ -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 } 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'
@@ -75,7 +75,6 @@ const Collapsible = ({
75
75
  globalProps(props),
76
76
  className
77
77
  )
78
- const dynamicInlineProps = globalInlineProps(props)
79
78
  return (
80
79
  <CollapsibleContext.Provider value={{ collapsed: isCollapsed, toggle, icon, iconSize, iconColor, onIconClick, onClick }}>
81
80
  <div
@@ -84,7 +83,6 @@ const Collapsible = ({
84
83
  {...htmlProps}
85
84
  className={classes}
86
85
  id={id}
87
- style={dynamicInlineProps}
88
86
  >
89
87
  {Main ? (
90
88
  <CollapsibleMain {...mainProps}>
@@ -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
- })