playbook_ui 14.13.0.pre.alpha.play1852reacthookformsupportradio6213 → 14.13.0.pre.alpha.play1884progresspill6064

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 (114) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/_playbook.scss +1 -0
  3. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.scss +0 -3
  4. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +5 -6
  5. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.rb +1 -8
  6. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props.html.erb +1 -1
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_rails.md +1 -3
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_react.md +1 -1
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +1 -2
  11. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.scss +66 -0
  12. data/app/pb_kits/playbook/pb_avatar_action_button/_avatar_action_button.tsx +98 -0
  13. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.html.erb +28 -0
  14. data/app/pb_kits/playbook/pb_avatar_action_button/avatar_action_button.rb +42 -0
  15. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.html.erb +19 -0
  16. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_actions.jsx +26 -0
  17. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.html.erb +10 -0
  18. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_default.jsx +17 -0
  19. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_on_click.jsx +19 -0
  20. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_onclick.html.erb +16 -0
  21. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.html.erb +35 -0
  22. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_placement.jsx +42 -0
  23. data/app/pb_kits/playbook/pb_avatar_action_button/docs/_avatar_action_button_tooltip.html.erb +13 -0
  24. data/app/pb_kits/playbook/pb_avatar_action_button/docs/example.yml +15 -0
  25. data/app/pb_kits/playbook/pb_avatar_action_button/docs/index.js +4 -0
  26. data/app/pb_kits/playbook/pb_avatar_action_button/pb_avatar_action_button.test.js +31 -0
  27. data/app/pb_kits/playbook/pb_bar_graph/docs/example.yml +0 -1
  28. data/app/pb_kits/playbook/pb_bar_graph/docs/index.js +0 -1
  29. data/app/pb_kits/playbook/pb_checkbox/_checkbox.tsx +8 -17
  30. data/app/pb_kits/playbook/pb_checkbox/checkbox.test.js +0 -16
  31. data/app/pb_kits/playbook/pb_checkbox/docs/example.yml +1 -2
  32. data/app/pb_kits/playbook/pb_checkbox/docs/index.js +0 -1
  33. data/app/pb_kits/playbook/pb_date_picker/_date_picker.tsx +1 -3
  34. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.html.erb +2 -2
  35. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table.md +1 -4
  36. data/app/pb_kits/playbook/pb_draggable/docs/example.yml +0 -2
  37. data/app/pb_kits/playbook/pb_draggable/docs/index.js +1 -2
  38. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableContainer.tsx +4 -7
  39. data/app/pb_kits/playbook/pb_draggable/subcomponents/DraggableItem.tsx +3 -6
  40. data/app/pb_kits/playbook/pb_multi_level_select/multi_level_select.html.erb +6 -1
  41. data/app/pb_kits/playbook/pb_nav/item.html.erb +19 -7
  42. data/app/pb_kits/playbook/pb_nav/nav.html.erb +8 -3
  43. data/app/pb_kits/playbook/pb_online_status/online_status.html.erb +6 -1
  44. data/app/pb_kits/playbook/pb_overlay/_overlay.tsx +0 -4
  45. data/app/pb_kits/playbook/pb_overlay/docs/example.yml +0 -1
  46. data/app/pb_kits/playbook/pb_overlay/docs/index.js +0 -1
  47. data/app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx +10 -48
  48. data/app/pb_kits/playbook/pb_popover/popover.html.erb +6 -1
  49. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.scss +0 -4
  50. data/app/pb_kits/playbook/pb_progress_pills/_progress_pills.tsx +5 -7
  51. data/app/pb_kits/playbook/pb_progress_pills/docs/example.yml +0 -2
  52. data/app/pb_kits/playbook/pb_progress_pills/docs/index.js +0 -1
  53. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.html.erb +7 -2
  54. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.rb +0 -6
  55. data/app/pb_kits/playbook/pb_progress_pills/progress_pills.test.js +1 -26
  56. data/app/pb_kits/playbook/pb_progress_simple/progress_simple.html.erb +5 -1
  57. data/app/pb_kits/playbook/pb_progress_step/progress_step.html.erb +5 -1
  58. data/app/pb_kits/playbook/pb_progress_step/progress_step_item.html.erb +5 -1
  59. data/app/pb_kits/playbook/pb_radio/_radio.tsx +73 -85
  60. data/app/pb_kits/playbook/pb_radio/docs/example.yml +1 -2
  61. data/app/pb_kits/playbook/pb_radio/docs/index.js +0 -1
  62. data/app/pb_kits/playbook/pb_radio/radio.html.erb +11 -6
  63. data/app/pb_kits/playbook/pb_radio/radio.test.js +0 -16
  64. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +1 -1
  65. data/app/pb_kits/playbook/pb_table/docs/example.yml +1 -4
  66. data/app/pb_kits/playbook/pb_table/docs/index.js +1 -2
  67. data/app/pb_kits/playbook/pb_table/index.ts +9 -41
  68. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -4
  69. data/app/pb_kits/playbook/pb_table/subcomponents/_table_body.tsx +2 -29
  70. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +3 -31
  71. data/app/pb_kits/playbook/pb_table/table_body.html.erb +7 -13
  72. data/app/pb_kits/playbook/pb_table/table_body.rb +0 -2
  73. data/app/pb_kits/playbook/pb_table/table_row.html.erb +7 -14
  74. data/app/pb_kits/playbook/pb_table/table_row.rb +1 -14
  75. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.html.erb +0 -14
  76. data/app/pb_kits/playbook/pb_text_input/index.js +0 -9
  77. data/app/pb_kits/playbook/pb_text_input/text_input.rb +2 -5
  78. data/dist/chunks/_typeahead-btjo1UN5.js +36 -0
  79. data/dist/chunks/{_weekday_stacked-Dze0K01W.js → _weekday_stacked-TIh9nTmZ.js} +3 -3
  80. data/dist/chunks/{lib-D3us1bGD.js → lib-DjpLC8uO.js} +2 -2
  81. data/dist/chunks/{pb_form_validation-BpihMSOQ.js → pb_form_validation-S56UaHZl.js} +1 -1
  82. data/dist/chunks/vendor.js +1 -1
  83. data/dist/menu.yml +7 -0
  84. data/dist/playbook-doc.js +1 -1
  85. data/dist/playbook-rails-react-bindings.js +1 -1
  86. data/dist/playbook-rails.js +1 -1
  87. data/dist/playbook.css +1 -1
  88. data/lib/playbook/version.rb +1 -1
  89. metadata +23 -30
  90. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_headers_custom_cell.jsx +0 -75
  91. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header.html.erb +0 -33
  92. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_table_props_sticky_header_rails.md +0 -3
  93. data/app/pb_kits/playbook/pb_bar_graph/BarGraphStyles.scss +0 -58
  94. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.jsx +0 -64
  95. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_pb_styles.md +0 -1
  96. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.jsx +0 -69
  97. data/app/pb_kits/playbook/pb_checkbox/docs/_checkbox_react_hook.md +0 -1
  98. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.jsx +0 -90
  99. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_table_react.md +0 -5
  100. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional.jsx +0 -37
  101. data/app/pb_kits/playbook/pb_overlay/docs/_overlay_vertical_dynamic_multi_directional_react.md +0 -1
  102. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.html.erb +0 -1
  103. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width.jsx +0 -18
  104. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_rails.md +0 -1
  105. data/app/pb_kits/playbook/pb_progress_pills/docs/_progress_pills_full_width_react.md +0 -1
  106. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.jsx +0 -60
  107. data/app/pb_kits/playbook/pb_radio/docs/_radio_react_hook.md +0 -1
  108. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.html.erb +0 -51
  109. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click_rails.md +0 -2
  110. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.html.erb +0 -96
  111. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.jsx +0 -101
  112. data/app/pb_kits/playbook/pb_table/docs/_table_with_selectable_rows.md +0 -1
  113. data/dist/chunks/_typeahead-BdE70xxu.js +0 -36
  114. /data/app/pb_kits/playbook/pb_table/docs/{_table_with_collapsible_with_custom_click_react.md → _table_with_collapsible_with_custom_click.md} +0 -0
@@ -1,3 +1,7 @@
1
- <%= pb_content_tag(:ul) do %>
1
+ <%= content_tag(:ul,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <%= content.presence %>
3
7
  <% end %>
@@ -1,4 +1,8 @@
1
- <%= pb_content_tag(:li) do %>
1
+ <%= content_tag(:li,
2
+ id: object.id,
3
+ data: object.data,
4
+ class: object.classname,
5
+ **combined_html_options) do %>
2
6
  <div class="box" style="max-width: min-content;" id="<%= object.tooltip_trigger_class %>">
3
7
  <div class="circle">
4
8
  <%= pb_rails("icon", props: { icon: object.icon, size: "xs" }) if object.icon.present? %>
@@ -1,4 +1,6 @@
1
- import React, { useRef, forwardRef } from 'react'
1
+ /*eslint-disable react/no-multi-comp */
2
+
3
+ import React, { forwardRef, useRef } from 'react'
2
4
  import Body from '../pb_body/_body'
3
5
  import Flex from '../pb_flex/_flex'
4
6
  import classnames from 'classnames'
@@ -22,10 +24,10 @@ type RadioProps = {
22
24
  name?: string,
23
25
  value?: string,
24
26
  text?: string,
25
- onChange?: (event: React.FormEvent<HTMLInputElement> | null) => void,
27
+ onChange: (event: React.FormEvent<HTMLInputElement> | null) => void,
26
28
  } & GlobalProps
27
29
 
28
- const Radio = forwardRef<HTMLInputElement, RadioProps>(({
30
+ const Radio = ({
29
31
  aria = {},
30
32
  alignment,
31
33
  children,
@@ -41,124 +43,110 @@ const Radio = forwardRef<HTMLInputElement, RadioProps>(({
41
43
  name = 'radio_name',
42
44
  text = 'Radio Text',
43
45
  value = 'radio_text',
44
- checked = false,
45
46
  onChange = () => { void 0 },
46
47
  ...props
47
- }, ref) => {
48
- const internalRef = useRef<HTMLInputElement>(null)
49
- const setRefs = (el: HTMLInputElement) => {
50
- internalRef.current = el
51
- if (typeof ref === 'function') {
52
- ref(el)
53
- } else if (ref) {
54
- (ref as React.MutableRefObject<HTMLInputElement | null>).current = el
55
- }
56
- }
57
-
58
- // Since we're using defaultChecked for uncontrolled input,
59
- // we no longer need to sync the checked state with useEffect.
60
-
61
- const ariaProps = buildAriaProps(aria)
62
- const dataProps = buildDataProps(data)
63
- const htmlProps = buildHtmlProps(htmlOptions)
48
+ }: RadioProps, ref: any) => {
49
+ const radioRef = useRef(null);
64
50
 
51
+ const ariaProps = buildAriaProps(aria);
52
+ const dataProps = buildDataProps(data);
53
+ const htmlProps = buildHtmlProps(htmlOptions);
65
54
  const classes = classnames(
66
55
  buildCss('pb_radio_kit', alignment),
67
56
  dark ? 'dark' : null,
68
57
  error ? 'error' : null,
69
58
  globalProps(props),
70
59
  className
71
- )
60
+ );
72
61
 
73
62
  const classesCustom = classnames(
74
63
  dark ? 'dark' : null,
75
64
  error ? 'error' : null,
76
65
  globalProps(props),
77
66
  className
78
- )
67
+ );
79
68
 
80
- const displayRadio = (inputProps: any) => {
81
- if (children && customChildren === false)
82
- return children
69
+ const displayRadio = (props: RadioProps & any) => {
70
+ if (children && customChildren == false)
71
+ return (children)
83
72
  else
84
- return (
85
- <input
86
- defaultChecked={checked}
87
- disabled={disabled}
88
- id={id}
89
- name={name}
90
- onChange={onChange}
91
- ref={setRefs}
92
- type="radio"
93
- value={value}
94
- {...inputProps}
95
- />
96
- )
97
- }
73
+ return (
74
+ <input
75
+ disabled={disabled}
76
+ id={id}
77
+ name={name}
78
+ onChange={onChange}
79
+ ref={ref}
80
+ text={text}
81
+ type="radio"
82
+ value={value}
83
+ {...props}
84
+ />
85
+ )}
98
86
 
99
87
  const handleContainerClick = (event: React.MouseEvent<HTMLDivElement, MouseEvent> | undefined) => {
100
88
  if (event) {
101
- const target = event.target as HTMLElement
89
+ const target = event.target as HTMLElement;
102
90
  if (
103
91
  target.id === 'pb-radio-children-wrapper' ||
104
92
  target.closest('#pb-radio-children-wrapper')
105
93
  ) {
106
- internalRef.current?.click()
94
+ radioRef.current?.click();
107
95
  }
108
96
  }
109
- }
97
+ };
110
98
 
111
- return customChildren ? (
112
- <Flex
113
- {...ariaProps}
114
- {...dataProps}
115
- {...htmlProps}
116
- align="center"
117
- className={classesCustom}
118
- cursor="pointer"
119
- htmlFor={id}
120
- htmlOptions={{
121
- onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
122
- handleContainerClick(event)
123
- }) as unknown as () => void
124
- }}
125
- id="radio-container"
126
- >
127
- <label className={buildCss('pb_radio_kit', alignment)}>
99
+ return (
100
+ customChildren ? (
101
+ <Flex
102
+ {...ariaProps}
103
+ {...dataProps}
104
+ {...htmlProps}
105
+ align='center'
106
+ className={classesCustom}
107
+ cursor='pointer'
108
+ htmlFor={id}
109
+ htmlOptions={{
110
+ onClick: ((event: React.MouseEvent<HTMLDivElement, MouseEvent>) => {
111
+ handleContainerClick(event);
112
+ }) as unknown as () => void
113
+ }}
114
+ id="radio-container"
115
+ >
116
+ <label className={buildCss('pb_radio_kit', alignment)}>
128
117
  <input
129
- defaultChecked={checked}
130
118
  disabled={disabled}
131
119
  id={id}
132
120
  name={name}
133
121
  onChange={onChange}
134
- ref={setRefs}
122
+ ref={radioRef}
135
123
  type="radio"
136
124
  value={value}
137
125
  {...props}
138
126
  />
127
+ <span className="pb_radio_button" />
128
+ </label>
129
+ <div id="pb-radio-children-wrapper"> {children} </div>
130
+ </Flex>
131
+ ) : (
132
+ <label
133
+ {...ariaProps}
134
+ {...dataProps}
135
+ {...htmlProps}
136
+ className={classes}
137
+ htmlFor={id}
138
+ >
139
+ <>{displayRadio(props)}</>
139
140
  <span className="pb_radio_button" />
141
+ <Body
142
+ dark={dark}
143
+ status={error ? 'negative' : null}
144
+ text={label}
145
+ variant={null}
146
+ />
140
147
  </label>
141
- <div id="pb-radio-children-wrapper"> {children} </div>
142
- </Flex>
143
- ) : (
144
- <label
145
- {...ariaProps}
146
- {...dataProps}
147
- {...htmlProps}
148
- className={classes}
149
- htmlFor={id}
150
- >
151
- {displayRadio(props)}
152
- <span className="pb_radio_button" />
153
- <Body
154
- dark={dark}
155
- status={error ? 'negative' : null}
156
- text={label}
157
- variant={null}
158
- />
159
- </label>
160
- )
161
- })
148
+ )
149
+ );
150
+ };
162
151
 
163
- Radio.displayName = "Radio"
164
- export default Radio
152
+ export default forwardRef(Radio);
@@ -16,7 +16,6 @@ examples:
16
16
  - radio_alignment: Alignment
17
17
  - radio_disabled: Disabled
18
18
  - radio_custom_children: Custom Children
19
- - radio_react_hook: React Hook Form
20
19
 
21
20
  swift:
22
21
  - radio_default_swift: Default
@@ -27,4 +26,4 @@ examples:
27
26
  - radio_spacing_swift: Spacing
28
27
  - radio_padding_swift: Padding
29
28
  - radio_subtitle_swift: Subtitle
30
- - radio_props_swift: ""
29
+ - radio_props_swift: ""
@@ -4,4 +4,3 @@ export { default as RadioError } from './_radio_error.jsx'
4
4
  export { default as RadioAlignment } from './_radio_alignment.jsx'
5
5
  export { default as RadioDisabled } from './_radio_disabled.jsx'
6
6
  export { default as RadioCustomChildren } from './_radio_custom_children.jsx'
7
- export { default as RadioReactHook } from './_radio_react_hook.jsx'
@@ -7,21 +7,26 @@
7
7
  data: object.data,
8
8
  **combined_html_options
9
9
  }) do %>
10
- <%= pb_content_tag(:label,
10
+ <%= content_tag(:label,
11
11
  'data-pb-radio-children': 'true',
12
12
  checked: object.checked,
13
- value: object.value
14
- ) do %>
13
+ class: object.classname,
14
+ id: object.id,
15
+ value: object.value) do %>
15
16
  <%= input %>
16
17
  <span class="pb_radio_button"></span>
17
18
  <% end %>
18
19
  <div data-pb-radio-children-wrapper="true"> <%= content %> </div>
19
20
  <% end %>
20
21
  <% else %>
21
- <%= pb_content_tag(:label,
22
+ <%= content_tag(:label,
23
+ aria: object.aria,
22
24
  checked: object.checked,
25
+ class: object.classname,
26
+ data: object.data,
27
+ id: object.id,
23
28
  value: object.value,
24
- ) do %>
29
+ **combined_html_options) do %>
25
30
 
26
31
  <% if content.present? %>
27
32
  <%= content %>
@@ -32,4 +37,4 @@
32
37
  <span class="pb_radio_button"></span>
33
38
  <%= pb_rails("body", props: { status: object.body_status, text: object.text, dark: object.dark }) %>
34
39
  <% end %>
35
- <% end %>
40
+ <% end %>
@@ -86,19 +86,3 @@ test('has disabled attribute', () => {
86
86
  expect(input).toHaveAttribute('disabled')
87
87
  })
88
88
 
89
-
90
- test('has ref in the input element', () => {
91
- const ref = React.createRef()
92
- render(
93
- <Radio
94
- data={{ testid: testId }}
95
- name="Radio-name"
96
- ref={ref}
97
- text="Radio"
98
- value="radio value"
99
- />
100
- )
101
-
102
- expect(ref.current).not.toBeNull()
103
- expect(ref.current?.tagName).toBe('INPUT')
104
- })
@@ -16,7 +16,7 @@ const TableWithCollapsible = (props) => {
16
16
  );
17
17
  };
18
18
 
19
- return (
19
+ return (
20
20
  <Table
21
21
  size="sm"
22
22
  {...props}
@@ -31,12 +31,10 @@ examples:
31
31
  - table_with_subcomponents_as_divs: Table with Sub Components (Divs)
32
32
  - table_outer_padding: Outer Padding
33
33
  - table_with_collapsible: Table with Collapsible
34
- - table_with_collapsible_with_custom_click: Table with Collapsible with Custom Click
35
34
  - table_with_collapsible_with_custom_content_rails: Table with Collapsible with Custom Content
36
35
  - table_with_collapsible_with_nested_rows_rails: Table with Collapsible with Nested Rows
37
36
  - table_with_collapsible_with_nested_table_rails: Table with Collapsible with Nested Table
38
37
  - table_with_clickable_rows: Table with Clickable Rows
39
- - table_with_selectable_rows: Table with Selectable Rows
40
38
 
41
39
  react:
42
40
  - table_sm: Small
@@ -73,5 +71,4 @@ examples:
73
71
  - table_with_collapsible_with_custom_content: Table with Collapsible with Custom Content
74
72
  - table_with_collapsible_with_nested_rows: Table with Collapsible with Nested Rows
75
73
  - table_with_collapsible_with_nested_table: Table with Collapsible with Nested Table
76
- - table_with_clickable_rows: Table with Clickable Rows
77
- - table_with_selectable_rows: Table with Selectable Rows
74
+ - table_with_clickable_rows: Table with Clickable Rows
@@ -33,5 +33,4 @@ export { default as TableWithCollapsibleWithCustomContent } from './_table_with_
33
33
  export { default as TableWithCollapsibleWithNestedTable } from './_table_with_collapsible_with_nested_table.jsx'
34
34
  export { default as TableWithCollapsibleWithNestedRows } from './_table_with_collapsible_with_nested_rows.jsx'
35
35
  export { default as TableWithCollapsibleWithCustomClick } from './_table_with_collapsible_with_custom_click.jsx'
36
- export { default as TableWithSelectableRows } from './_table_with_selectable_rows.jsx'
37
- export { default as TableWithClickableRows } from './_table_with_clickable_rows.jsx'
36
+ export { default as TableWithClickableRows } from './_table_with_clickable_rows.jsx'
@@ -2,7 +2,6 @@ import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  const TABLE_WRAPPER_SELECTOR = "[data-pb-table-wrapper]";
4
4
  const TABLE_COLLAPSIBLE_WRAPPER_SELECTOR = "[data-pb-table-collapsible-wrapper]";
5
- const TABLE_COLLAPSIBLE_CELL_SELECTOR = "[data-pb-table-collapsible-cell-id]";
6
5
 
7
6
  export default class PbTable extends PbEnhancedElement {
8
7
  stickyLeftColumns: string[] = [];
@@ -159,49 +158,18 @@ export default class PbTable extends PbEnhancedElement {
159
158
  }
160
159
 
161
160
  handleCollapsibleClick() {
162
- const cells = this.element.querySelectorAll(TABLE_COLLAPSIBLE_CELL_SELECTOR);
163
161
  const collapsibleElements = this.element.querySelectorAll(TABLE_COLLAPSIBLE_WRAPPER_SELECTOR);
164
-
165
- if (cells.length > 0) {
166
- cells.forEach((cell) => {
167
- const cellId = (cell as HTMLElement).dataset.pbTableCollapsibleCellId;
168
-
169
- Array.from(cell.children).forEach((child) => {
170
- if (child.id === cellId) {
171
- Array.from(child.children).forEach((svgChild) => {
172
- svgChild.id = cellId; // Assign cellId to SVG child
173
- Array.from(svgChild.children).forEach((pathChild) => {
174
- pathChild.id = cellId; // Assign cellId to path child
175
- });
176
- });
177
- }
178
- });
179
- cell.addEventListener('click', (event) => {
180
- if ((event.target as HTMLElement).id) {
181
- document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`));
182
-
183
- const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
184
- toggleElements.forEach((element) => {
185
- element.classList.toggle('no-border');
186
- element.classList.toggle('border-active');
187
- });
188
- }
162
+ collapsibleElements.forEach((collapsibleElement) => {
163
+ collapsibleElement.addEventListener('click', (event) => {
164
+ document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`))
165
+
166
+ const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
167
+ toggleElements.forEach(element => {
168
+ element.classList.toggle('no-border');
169
+ element.classList.toggle('border-active');
189
170
  });
190
- });
191
-
192
- } else {
193
- collapsibleElements.forEach((collapsibleElement) => {
194
- collapsibleElement.addEventListener('click', (event) => {
195
- document.dispatchEvent(new CustomEvent(`collapsed-toggle${(event.currentTarget as HTMLElement).id}`))
196
-
197
- const toggleElements = this.element.querySelectorAll(`.collapsible_border_toggle${(event.currentTarget as HTMLElement).id}`);
198
- toggleElements.forEach(element => {
199
- element.classList.toggle('no-border');
200
- element.classList.toggle('border-active');
201
- });
202
- })
203
171
  })
204
- }
172
+ })
205
173
  }
206
174
 
207
175
  handleCollapsibleRow() {
@@ -37,10 +37,6 @@
37
37
  cursor: pointer;
38
38
  }
39
39
 
40
- .collapsible_cell {
41
- cursor: default;
42
- }
43
-
44
40
  .no-border {
45
41
  border-bottom: none !important;
46
42
  }
@@ -7,14 +7,11 @@ import {
7
7
  } from "../../utilities/props";
8
8
  import { globalProps } from "../../utilities/globalProps";
9
9
 
10
- import Draggable from "../../pb_draggable/_draggable"
11
-
12
10
  type TableBodyPropTypes = {
13
11
  aria?: { [key: string]: string };
14
12
  children: React.ReactNode[] | React.ReactNode;
15
13
  className: string;
16
14
  data?: { [key: string]: string };
17
- draggableContainer?: boolean;
18
15
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
19
16
  id?: string;
20
17
  tag?: "table" | "div";
@@ -26,7 +23,6 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
26
23
  children,
27
24
  className,
28
25
  data = {},
29
- draggableContainer = false,
30
26
  htmlOptions = {},
31
27
  id,
32
28
  tag = "table",
@@ -41,30 +37,7 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
41
37
  return (
42
38
  <>
43
39
  {isTableTag ? (
44
- draggableContainer ? (
45
- <Draggable.Container
46
- {...ariaProps}
47
- {...dataProps}
48
- {...htmlProps}
49
- className={classes}
50
- id={id}
51
- tag="tbody"
52
- >
53
- {children}
54
- </Draggable.Container>
55
- ) : (
56
- <tbody
57
- {...ariaProps}
58
- {...dataProps}
59
- {...htmlProps}
60
- className={classes}
61
- id={id}
62
- >
63
- {children}
64
- </tbody>
65
- )
66
- ) : draggableContainer ? (
67
- <Draggable.Container
40
+ <tbody
68
41
  {...ariaProps}
69
42
  {...dataProps}
70
43
  {...htmlProps}
@@ -72,7 +45,7 @@ const TableBody = (props: TableBodyPropTypes): React.ReactElement => {
72
45
  id={id}
73
46
  >
74
47
  {children}
75
- </Draggable.Container>
48
+ </tbody>
76
49
  ) : (
77
50
  <div
78
51
  {...ariaProps}
@@ -9,7 +9,6 @@ import {
9
9
  import { globalProps } from "../../utilities/globalProps";
10
10
  import Collapsible from "../../pb_collapsible/_collapsible";
11
11
  import useCollapsible from "../../pb_collapsible/useCollapsible";
12
- import Draggable from "../../pb_draggable/_draggable";
13
12
 
14
13
  type TableRowPropTypes = {
15
14
  aria?: { [key: string]: string };
@@ -20,8 +19,6 @@ type TableRowPropTypes = {
20
19
  collapsibleSideHighlight?: boolean;
21
20
  data?: { [key: string]: string };
22
21
  dark?: boolean;
23
- dragId?: string;
24
- draggableItem?: boolean;
25
22
  htmlOptions?: { [key: string]: string | number | boolean | (() => void) };
26
23
  id?: string;
27
24
  toggleCellId?: string;
@@ -39,8 +36,6 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
39
36
  className,
40
37
  data = {},
41
38
  dark = false,
42
- dragId,
43
- draggableItem = false,
44
39
  htmlOptions = {},
45
40
  id,
46
41
  toggleCellId,
@@ -157,38 +152,15 @@ const TableRow = (props: TableRowPropTypes): React.ReactElement => {
157
152
  </>
158
153
  )
159
154
  ) : isTableTag ? (
160
- draggableItem ? (
161
- <Draggable.Item
162
- {...ariaProps}
163
- {...dataProps}
164
- {...htmlProps}
165
- className={classes}
166
- dragId={dragId}
167
- tag="tr"
168
- >
169
- {children}
170
- </Draggable.Item>
171
- ) : (
172
- <tr
173
- {...ariaProps}
174
- {...dataProps}
175
- {...htmlProps}
176
- className={classes}
177
- id={id}
178
- >
179
- {children}
180
- </tr>
181
- )
182
- ) : draggableItem ? (
183
- <Draggable.Item
155
+ <tr
184
156
  {...ariaProps}
185
157
  {...dataProps}
186
158
  {...htmlProps}
187
159
  className={classes}
188
- dragId={dragId}
160
+ id={id}
189
161
  >
190
162
  {children}
191
- </Draggable.Item>
163
+ </tr>
192
164
  ) : (
193
165
  <div
194
166
  {...ariaProps}
@@ -1,17 +1,11 @@
1
1
  <% if object.tag == "table" %>
2
- <% if object.draggable_container %>
3
- <%= pb_rails("draggable/draggable_container", props: { tag: "tbody", classname: object.classname, data: object.data }) do %>
4
- <%= content.presence %>
5
- <% end %>
6
- <% else %>
7
- <%= content_tag(:tbody,
8
- aria: object.aria,
9
- class: object.classname,
10
- data: object.data,
11
- id: object.id,
12
- **combined_html_options) do %>
13
- <%= content.presence %>
14
- <% end %>
2
+ <%= content_tag(:tbody,
3
+ aria: object.aria,
4
+ class: object.classname,
5
+ data: object.data,
6
+ id: object.id,
7
+ **combined_html_options) do %>
8
+ <%= content.presence %>
15
9
  <% end %>
16
10
  <% else %>
17
11
  <%= content_tag(:div,
@@ -6,8 +6,6 @@ module Playbook
6
6
  prop :tag, type: Playbook::Props::Enum,
7
7
  values: %w[table div],
8
8
  default: "table"
9
- prop :draggable_container, type: Playbook::Props::Boolean,
10
- default: false
11
9
 
12
10
  def classname
13
11
  generate_classname("pb_table_tbody")
@@ -5,7 +5,6 @@
5
5
  data: object.data.merge(id: object.id),
6
6
  id: object.id,
7
7
  'data-pb-table-collapsible-wrapper' => true,
8
- 'data-pb-table-collapsible-cell-id' => object.toggle_cell_id,
9
8
  **combined_html_options) do %>
10
9
  <%= content.presence %>
11
10
  <% end %>
@@ -19,19 +18,13 @@
19
18
  <% end %>
20
19
  </tr>
21
20
  <% elsif object.tag == "table" %>
22
- <% if object.draggable_item %>
23
- <%= pb_rails("draggable/draggable_item", props:{ drag_id: object.drag_id, tag: "tr", classname: object.classname, data: object.data }) do %>
24
- <%= content.presence %>
25
- <% end %>
26
- <% else %>
27
- <%= content_tag(:tr,
28
- aria: object.aria,
29
- class: object.classname,
30
- data: object.data,
31
- id: object.id,
32
- **combined_html_options) do %>
33
- <%= content.presence %>
34
- <% end %>
21
+ <%= content_tag(:tr,
22
+ aria: object.aria,
23
+ class: object.classname,
24
+ data: object.data,
25
+ id: object.id,
26
+ **combined_html_options) do %>
27
+ <%= content.presence %>
35
28
  <% end %>
36
29
  <% else %>
37
30
  <%= content_tag(:div,
@@ -13,14 +13,9 @@ module Playbook
13
13
  prop :collapsible_content
14
14
  prop :collapsible_side_highlight, type: Playbook::Props::Boolean,
15
15
  default: true
16
- prop :toggle_cell_id, type: Playbook::Props::String
17
- prop :draggable_item, type: Playbook::Props::Boolean,
18
- default: false
19
- prop :drag_id, type: Playbook::Props::String,
20
- default: nil
21
16
 
22
17
  def classname
23
- generate_classname("pb_table_row_kit", side_highlight_class) + tag_class + collapsible_cell_class
18
+ generate_classname("pb_table_row_kit", side_highlight_class) + tag_class
24
19
  end
25
20
 
26
21
  def side_highlight_class
@@ -30,14 +25,6 @@ module Playbook
30
25
  def tag_class
31
26
  " pb_table_tr"
32
27
  end
33
-
34
- def collapsible_cell_class
35
- if toggle_cell_id
36
- " collapsible_cell"
37
- else
38
- ""
39
- end
40
- end
41
28
  end
42
29
  end
43
30
  end