playbook_ui 14.9.0.pre.alpha.play1703errorstatealignment4991 → 14.9.0.pre.alpha.play1742globalheightfixes4766

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 (74) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/table_header.html.erb +3 -5
  3. data/app/pb_kits/playbook/pb_avatar/_avatar.scss +2 -0
  4. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom.jsx +49 -53
  5. data/app/pb_kits/playbook/pb_bar_graph/docs/_bar_graph_custom_rails.html.erb +36 -29
  6. data/app/pb_kits/playbook/pb_body/_body.scss +13 -14
  7. data/app/pb_kits/playbook/pb_body/_body_mixins.scss +16 -22
  8. data/app/pb_kits/playbook/pb_bread_crumbs/docs/_bread_crumbs_default.jsx +0 -6
  9. data/app/pb_kits/playbook/pb_caption/_caption_mixin.scss +1 -2
  10. data/app/pb_kits/playbook/pb_card/_card_mixin.scss +1 -1
  11. data/app/pb_kits/playbook/pb_collapsible/_collapsible.tsx +4 -9
  12. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleContent.tsx +2 -2
  13. data/app/pb_kits/playbook/pb_collapsible/child_kits/CollapsibleMain.tsx +2 -2
  14. data/app/pb_kits/playbook/pb_drawer/_drawer.tsx +2 -2
  15. data/app/pb_kits/playbook/pb_file_upload/_file_upload.scss +0 -5
  16. data/app/pb_kits/playbook/pb_file_upload/_file_upload.tsx +2 -7
  17. data/app/pb_kits/playbook/pb_file_upload/file_upload.html.erb +2 -8
  18. data/app/pb_kits/playbook/pb_form_group/_form_group.scss +2 -48
  19. data/app/pb_kits/playbook/pb_layout/_layout.tsx +30 -11
  20. data/app/pb_kits/playbook/pb_link/_link.scss +3 -3
  21. data/app/pb_kits/playbook/pb_nav/_bold_mixin.scss +1 -11
  22. data/app/pb_kits/playbook/pb_nav/_collapsible_nav.scss +2 -16
  23. data/app/pb_kits/playbook/pb_nav/_vertical_nav.scss +1 -1
  24. data/app/pb_kits/playbook/pb_selectable_card/_selectable_card.scss +4 -4
  25. data/app/pb_kits/playbook/pb_selectable_card/selectable_card.html.erb +1 -1
  26. data/app/pb_kits/playbook/pb_stat_change/_stat_change.tsx +36 -44
  27. data/app/pb_kits/playbook/pb_stat_change/stat_change.html.erb +4 -4
  28. data/app/pb_kits/playbook/pb_table/docs/example.yml +0 -5
  29. data/app/pb_kits/playbook/pb_table/docs/index.js +0 -5
  30. data/app/pb_kits/playbook/pb_table/index.ts +26 -100
  31. data/app/pb_kits/playbook/pb_table/styles/_all.scss +1 -2
  32. data/app/pb_kits/playbook/pb_table/subcomponents/_table_row.tsx +1 -106
  33. data/app/pb_kits/playbook/pb_table/table.html.erb +1 -1
  34. data/app/pb_kits/playbook/pb_table/table.rb +2 -17
  35. data/app/pb_kits/playbook/pb_text_input/_text_input.tsx +3 -35
  36. data/app/pb_kits/playbook/pb_text_input/docs/example.yml +0 -1
  37. data/app/pb_kits/playbook/pb_text_input/docs/index.js +0 -1
  38. data/app/pb_kits/playbook/pb_text_input/text_input.test.js +2 -139
  39. data/app/pb_kits/playbook/pb_title/_title.scss +5 -6
  40. data/app/pb_kits/playbook/pb_title/_title_mixin.scss +0 -13
  41. data/app/pb_kits/playbook/tokens/_titles.scss +8 -0
  42. data/app/pb_kits/playbook/utilities/_hover.scss +2 -11
  43. data/app/pb_kits/playbook/utilities/globalProps.ts +0 -2
  44. data/app/pb_kits/playbook/utilities/test/globalProps/hover.test.js +0 -15
  45. data/dist/chunks/_typeahead-B8fkIeXA.js +22 -0
  46. data/dist/chunks/_weekday_stacked-DjRTXEi-.js +45 -0
  47. data/dist/chunks/{lib-CuCy3_xO.js → lib-SyD3buPZ.js} +3 -3
  48. data/dist/chunks/{pb_form_validation-D37k10a0.js → pb_form_validation-Dt8UJgrJ.js} +1 -1
  49. data/dist/chunks/vendor.js +1 -1
  50. data/dist/menu.yml +1 -1
  51. data/dist/playbook-doc.js +1 -1
  52. data/dist/playbook-rails-react-bindings.js +1 -1
  53. data/dist/playbook-rails.js +1 -1
  54. data/dist/playbook.css +1 -1
  55. data/lib/playbook/hover.rb +1 -7
  56. data/lib/playbook/version.rb +1 -1
  57. metadata +6 -21
  58. data/app/pb_kits/playbook/pb_form_group/_error_state_mixin.scss +0 -49
  59. data/app/pb_kits/playbook/pb_table/docs/_table_sticky_left_columns.html.erb +0 -95
  60. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.jsx +0 -75
  61. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible.md +0 -1
  62. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.jsx +0 -108
  63. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_click.md +0 -2
  64. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.jsx +0 -94
  65. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_custom_content.md +0 -0
  66. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.jsx +0 -83
  67. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_rows.md +0 -3
  68. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.jsx +0 -120
  69. data/app/pb_kits/playbook/pb_table/docs/_table_with_collapsible_with_nested_table.md +0 -1
  70. data/app/pb_kits/playbook/pb_table/styles/_collapsible.scss +0 -35
  71. data/app/pb_kits/playbook/pb_text_input/docs/_text_input_mask.jsx +0 -88
  72. data/app/pb_kits/playbook/pb_text_input/inputMask.ts +0 -64
  73. data/dist/chunks/_typeahead-l1kq1p9m.js +0 -22
  74. data/dist/chunks/_weekday_stacked-B28kYXl9.js +0 -45
@@ -1,6 +1,3 @@
1
- @import "../tokens/spacing";
2
- @import "./error_state_mixin";
3
-
4
1
  [class^=pb_form_group_kit] {
5
2
  display: inline-flex;
6
3
  flex-direction: row;
@@ -15,49 +12,6 @@
15
12
  }
16
13
  }
17
14
 
18
- @include error-state-flex-start-selectors;
19
- @include error-state-center-selectors;
20
- @include error-state-flex-end-selectors;
21
- @include error-state-left-side-select-kit;
22
- @include error-state-right-side-select-kit;
23
-
24
- // &:has(.pb_text_input_kit.error):has(.pb_text_input_kit),
25
- // &:has(.pb_text_input_kit):has(.pb_date_picker_kit.error),
26
- // &:has(.pb_text_input_kit):has(.pb_select_kit_wrapper.error),
27
- // &:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error) {
28
- // align-items: flex-start;
29
- // }
30
-
31
- // &:has(.pb_text_input_kit:not(.error)):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper.error),
32
- // &:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has(.pb_select_kit_wrapper) {
33
- // align-items: flex-start;
34
- // .pb_select_kit_wrapper,
35
- // .pb_select_kit_wrapper.error {
36
- // padding-top: $space_md;
37
- // margin-top: 2px;
38
- // .pb_select_kit_caret {
39
- // padding-top: $space_xl;
40
- // }
41
- // }
42
- // }
43
-
44
- // &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper.error):has(.pb_phone_number_input),
45
- // &:has(.pb_text_input_kit.error):has(.pb_text_input_kit_label):has([class^=pb_button_kit]) {
46
- // align-items: center;
47
- // }
48
-
49
- // &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper.error):has(.pb_phone_number_input):has(.pb_text_input_kit.error) {
50
- // align-items: flex-end;
51
- // }
52
-
53
- // &:has(.pb_select_kit_label):has(.pb_select_kit_wrapper):has(.pb_phone_number_input):has(.pb_text_input_kit.error) {
54
- // align-items: flex-start;
55
- // .pb_text_input_kit.error {
56
- // padding-top: $space_md;
57
- // margin-top: 2px;
58
- // }
59
- // }
60
-
61
15
  & [class^=pb_text_input_kit] .text_input_wrapper,
62
16
  & [class^=pb_date_picker_kit] .input_wrapper,
63
17
  & [class^=pb_select] {
@@ -73,7 +27,7 @@
73
27
  border-bottom-right-radius: 0;
74
28
  border-top-right-radius: 0;
75
29
  border-right-width: 0;
76
-
30
+
77
31
  &:focus {
78
32
  outline: $primary solid 1px;
79
33
  outline-offset: -1px;
@@ -196,7 +150,7 @@
196
150
  & > [class^=pb_selectable_card_kit] input[type="checkbox"]:not(:checked) ~ label, [class^=pb_selectable_card_kit] input[type="radio"]:not(:checked) ~ label {
197
151
  &:hover {
198
152
  border-right-color: $slate;
199
- }
153
+ }
200
154
  }
201
155
 
202
156
  & > [class^=pb_selectable_card_kit]:not(:first-child) label {
@@ -24,34 +24,37 @@ type LayoutPropTypes = {
24
24
  type LayoutSideProps = {
25
25
  children: React.ReactNode[] | React.ReactNode,
26
26
  className?: string,
27
- }
27
+ } & GlobalProps
28
28
 
29
29
  type LayoutBodyProps = {
30
30
  children: React.ReactNode[] | React.ReactNode,
31
31
  className?: string,
32
- }
32
+ } & GlobalProps
33
33
 
34
34
  type LayoutItemProps = {
35
35
  children: React.ReactNode[] | React.ReactNode,
36
36
  className?: string,
37
37
  size?: "sm" | "md" | "lg"
38
- }
38
+ } & GlobalProps
39
39
 
40
40
  type LayoutHeaderProps = {
41
41
  children: React.ReactNode[] | React.ReactNode,
42
42
  className?: string,
43
- }
43
+ } & GlobalProps
44
44
 
45
45
  type LayoutFooterProps = {
46
46
  children: React.ReactNode[] | React.ReactNode,
47
47
  className?: string,
48
- }
48
+ } & GlobalProps
49
49
 
50
- // Side component
51
50
  const Side = (props: LayoutSideProps) => {
52
51
  const { children, className } = props
52
+ const dynamicInlineProps = globalInlineProps(props)
53
53
  return (
54
- <div className={classnames('layout_sidebar', globalProps(props), className)}>
54
+ <div
55
+ className={classnames('layout_sidebar', globalProps(props), className)}
56
+ style={dynamicInlineProps}
57
+ >
55
58
  {children}
56
59
  </div>
57
60
  )
@@ -60,8 +63,12 @@ const Side = (props: LayoutSideProps) => {
60
63
  // Body component
61
64
  const Body = (props: LayoutBodyProps) => {
62
65
  const { children, className } = props
66
+ const dynamicInlineProps = globalInlineProps(props)
63
67
  return (
64
- <div className={classnames('layout_body', globalProps(props), className)}>
68
+ <div
69
+ className={classnames('layout_body', globalProps(props), className)}
70
+ style={dynamicInlineProps}
71
+ >
65
72
  {children}
66
73
  </div>
67
74
  )
@@ -71,8 +78,12 @@ const Body = (props: LayoutBodyProps) => {
71
78
  const Item = (props: LayoutItemProps) => {
72
79
  const { children, className, size = 'sm' } = props
73
80
  const sizeClass = `size_${size}`
81
+ const dynamicInlineProps = globalInlineProps(props)
74
82
  return (
75
- <div className={classnames('layout_item', sizeClass, globalProps(props), className)}>
83
+ <div
84
+ className={classnames('layout_item', sizeClass, globalProps(props), className)}
85
+ style={dynamicInlineProps}
86
+ >
76
87
  {children}
77
88
  </div>
78
89
  )
@@ -81,8 +92,12 @@ const Item = (props: LayoutItemProps) => {
81
92
  // Header component
82
93
  const Header = (props: LayoutHeaderProps) => {
83
94
  const { children, className } = props
95
+ const dynamicInlineProps = globalInlineProps(props)
84
96
  return (
85
- <div className={classnames('layout_header', globalProps(props), className)}>
97
+ <div
98
+ className={classnames('layout_header', globalProps(props), className)}
99
+ style={dynamicInlineProps}
100
+ >
86
101
  {children}
87
102
  </div>
88
103
  )
@@ -91,8 +106,12 @@ const Header = (props: LayoutHeaderProps) => {
91
106
  // Footer component
92
107
  const Footer = (props: LayoutFooterProps) => {
93
108
  const { children, className } = props
109
+ const dynamicInlineProps = globalInlineProps(props)
94
110
  return (
95
- <div className={classnames('layout_footer', globalProps(props), className)}>
111
+ <div
112
+ className={classnames('layout_footer', globalProps(props), className)}
113
+ style={dynamicInlineProps}
114
+ >
96
115
  {children}
97
116
  </div>
98
117
  )
@@ -17,7 +17,7 @@
17
17
  outline-offset: 2px;
18
18
  }
19
19
  &:visited {
20
- color: darken($primary_action, 10%);
20
+ color: $data_3;
21
21
  }
22
22
  &.dark {
23
23
  @include pb_link($active_dark);
@@ -34,7 +34,7 @@
34
34
  }
35
35
 
36
36
  &:visited {
37
- color: darken($primary_action, 10%);
37
+ color: $data_3;
38
38
  }
39
39
  }
40
40
  }
@@ -48,7 +48,7 @@
48
48
  }
49
49
 
50
50
  &:visited {
51
- color: darken($primary_action, 10%);
51
+ color: $data_3;
52
52
  }
53
53
  }
54
54
  }
@@ -19,16 +19,6 @@
19
19
  font-weight: $bolder;
20
20
  }
21
21
  }
22
- }
23
- }
24
-
25
- .dark & {
26
- [class*=pb_nav_list_kit_item][class*=pb_nav_list_item] {
27
- &[class*=_link] {
28
- &[class*=_active] {
29
- box-shadow: 0 2px 10px 0 $shadow_dark;
30
- }
31
- }
32
- }
22
+ }
33
23
  }
34
24
  }
@@ -223,7 +223,6 @@
223
223
  }
224
224
  }
225
225
  [class*="pb_collapsible_nav_item"][class*="pb_nav_list_item_link_collapsible"][class*="pb_nav_list_kit_item"] {
226
- box-shadow: unset !important;
227
226
  .pb_nav_list_item_text_collapsible {
228
227
  color: $white !important;
229
228
  }
@@ -241,17 +240,11 @@
241
240
 
242
241
  .pb_collapsible_main_kit:hover {
243
242
  background-color: mix($white, $card_dark, 20%);
244
- .pb_nav_list_item_text_collapsible {
245
- color: $white !important;
246
- }
247
- }
248
-
249
- .pb_collapsible_main_kit {
243
+ .pb_nav_list_item_text_collapsible,
250
244
  svg {
251
- color: $text_dk_default !important;
245
+ color: $white !important;
252
246
  }
253
247
  }
254
-
255
248
  .icon_wrapper:hover {
256
249
  background-color: mix($white, $card_dark, 40%);
257
250
  }
@@ -263,13 +256,6 @@
263
256
  }
264
257
  }
265
258
  }
266
-
267
- &[class*="_active"] {
268
- > .pb_collapsible_main_kit {
269
- background-color: $primary;
270
- box-shadow: 0 2px 10px 0 $shadow_dark;
271
- }
272
- }
273
259
  }
274
260
  }
275
261
  }
@@ -115,7 +115,7 @@ $selector: ".pb_nav_list";
115
115
  }
116
116
  [class*="_item_text"],
117
117
  [class*="_item_icon"] {
118
- color: $text_dk_light !important;
118
+ color: $text_dk_lighter !important;
119
119
  }
120
120
  &[class*="_link"] {
121
121
  &:hover {
@@ -151,7 +151,7 @@ $pb_selectable_paddings: (
151
151
  input[type="radio"] {
152
152
  &:checked ~ label {
153
153
  border-width: $pb_card_border_width;
154
- outline: 1px solid $primary_action_dark;
154
+ outline: 1px solid $primary;
155
155
  }
156
156
  }
157
157
  }
@@ -161,11 +161,11 @@ $pb_selectable_paddings: (
161
161
  color: $white;
162
162
  > label {
163
163
  @include pb_card_dark;
164
- background: $bg_dark_card;
164
+ background: transparent;
165
165
 
166
166
  .pb_selectable_card_circle {
167
167
  border-color: $bg_dark;
168
- background: $primary_action_dark;
168
+ background: $primary-action;
169
169
  }
170
170
  }
171
171
 
@@ -173,7 +173,7 @@ $pb_selectable_paddings: (
173
173
  input[type="radio"] {
174
174
  &:checked ~ label {
175
175
  @include pb_card_selected_dark;
176
- background: $bg_dark_card;
176
+ background: transparent;
177
177
  }
178
178
  }
179
179
 
@@ -35,7 +35,7 @@
35
35
  <% end %>
36
36
  <% else %>
37
37
  <% if content.nil? %>
38
- <%= pb_rails("body", props: { text: object.text, dark: object.dark }) %>
38
+ <%= pb_rails("body", props: { text: object.text }) %>
39
39
  <% else %>
40
40
  <%= content %>
41
41
  <% end %>
@@ -1,46 +1,40 @@
1
- import React from "react"
2
- import classnames from "classnames"
1
+ import React from 'react'
2
+ import classnames from 'classnames'
3
3
 
4
- import { buildCss, buildHtmlProps } from "../utilities/props"
5
- import { globalProps } from "../utilities/globalProps"
4
+ import { buildCss, buildHtmlProps } from '../utilities/props'
5
+ import { globalProps } from '../utilities/globalProps'
6
6
 
7
- import Body from "../pb_body/_body"
8
- import Icon from "../pb_icon/_icon"
7
+ import Body from '../pb_body/_body'
8
+ import Icon from '../pb_icon/_icon'
9
9
 
10
- const statusMap: {
11
- neutral: "neutral"
12
- decrease: "negative"
13
- increase: "positive"
14
- } = {
15
- increase: "positive",
16
- decrease: "negative",
17
- neutral: "neutral",
10
+ const statusMap: {neutral: 'neutral', decrease: 'negative' ,increase: 'positive'} = {
11
+ increase: 'positive',
12
+ decrease: 'negative',
13
+ neutral: 'neutral',
18
14
  }
19
15
 
20
16
  const iconMap = {
21
- increase: "arrow-up",
22
- decrease: "arrow-down",
17
+ increase: 'arrow-up',
18
+ decrease: 'arrow-down',
23
19
  }
24
20
 
25
21
  type StatChangeProps = {
26
- change?: "increase" | "decrease" | "neutral"
27
- className?: string
28
- dark?: boolean
29
- icon?: string
30
- id?: string
31
- htmlOptions?: { [key: string]: string | number | boolean | (() => void) }
32
- value?: string | number
22
+ change?: 'increase' | 'decrease' | 'neutral',
23
+ className?: string,
24
+ icon?: string,
25
+ htmlOptions?: {[key: string]: string | number | boolean | (() => void)},
26
+ id?: string,
27
+ value?: string | number,
33
28
  }
34
29
 
35
30
  const StatChange = (props: StatChangeProps): React.ReactElement => {
36
- const {
37
- change = "neutral",
38
- className,
39
- dark = false,
31
+ const {
32
+ change = 'neutral',
33
+ className,
40
34
  htmlOptions = {},
41
- icon,
42
- id,
43
- value,
35
+ icon,
36
+ id,
37
+ value
44
38
  } = props
45
39
 
46
40
  const status = statusMap[change as keyof typeof statusMap]
@@ -53,32 +47,30 @@ const StatChange = (props: StatChangeProps): React.ReactElement => {
53
47
 
54
48
  return (
55
49
  <>
56
- {value && (
50
+ {value &&
57
51
  <div
58
52
  className={classnames(
59
- buildCss("pb_stat_change_kit", status),
60
- globalProps(props),
61
- className
62
- )}
53
+ buildCss('pb_stat_change_kit', status),
54
+ globalProps(props),
55
+ className
56
+ )}
63
57
  id={id}
64
58
  {...htmlProps}
65
59
  >
66
- <Body dark={dark}
67
- status={status}
68
- >
69
- {" "}
70
- {returnedIcon && (
60
+ <Body status={status}>
61
+ {returnedIcon &&
71
62
  <>
72
- <Icon dark={dark}
63
+ <Icon
73
64
  fixed_width
74
65
  icon={returnedIcon}
75
- />{" "}
66
+ />
67
+ {' '}
76
68
  </>
77
- )}
69
+ }
78
70
  {`${value}%`}
79
71
  </Body>
80
72
  </div>
81
- )}
73
+ }
82
74
  </>
83
75
  )
84
76
  }
@@ -1,6 +1,6 @@
1
1
  <%= pb_content_tag do %>
2
- <%= pb_rails("body", props: { status: object.status, dark: object.dark }) do %>
3
- <%= pb_rails("icon", props: { fixed_width: true, icon: object.returned_icon, dark: object.dark }) if object.returned_icon %>
4
- <%= "#{object.value}%" if object.value %>
5
- <% end %>
2
+ <%= pb_rails("body", props: { status: object.status }) do %>
3
+ <%= pb_rails("icon", props: { fixed_width: true, icon: object.returned_icon }) if object.returned_icon %>
4
+ <%= "#{object.value}%" if object.value %>
5
+ <% end %>
6
6
  <% end %>
@@ -55,8 +55,3 @@ examples:
55
55
  - table_with_subcomponents: Table with Sub Components (Table Elements)
56
56
  - table_with_subcomponents_as_divs: Table with Sub Components (Divs)
57
57
  - table_outer_padding: Outer Padding
58
- - table_with_collapsible: Table with Collapsible
59
- - table_with_collapsible_with_custom_click: Table with Collapsible with Custom Click
60
- - table_with_collapsible_with_custom_content: Table with Collapsible with Custom Content
61
- - table_with_collapsible_with_nested_rows: Table with Collapsible with Nested Rows
62
- - table_with_collapsible_with_nested_table: Table with Collapsible with Nested Table
@@ -26,8 +26,3 @@ export { default as TableWithSubcomponents } from './_table_with_subcomponents.j
26
26
  export { default as TableWithSubcomponentsAsDivs } from './_table_with_subcomponents_as_divs.jsx'
27
27
  export { default as TableOuterPadding } from './_table_outer_padding.jsx'
28
28
  export { default as TableStickyLeftColumns } from './_table_sticky_left_columns.jsx'
29
- export { default as TableWithCollapsible } from './_table_with_collapsible.jsx'
30
- export { default as TableWithCollapsibleWithCustomContent } from './_table_with_collapsible_with_custom_content.jsx'
31
- export { default as TableWithCollapsibleWithNestedTable } from './_table_with_collapsible_with_nested_table.jsx'
32
- export { default as TableWithCollapsibleWithNestedRows } from './_table_with_collapsible_with_nested_rows.jsx'
33
- export { default as TableWithCollapsibleWithCustomClick } from './_table_with_collapsible_with_custom_click.jsx'
@@ -1,106 +1,32 @@
1
1
  import PbEnhancedElement from '../pb_enhanced_element'
2
2
 
3
3
  export default class PbTable extends PbEnhancedElement {
4
- private stickyLeftColumns: string[] = [];
5
- private handleStickyColumnsRef: () => void;
6
-
7
- static get selector(): string {
8
- return '.table-responsive-collapse'
9
- }
10
-
11
- connect(): void {
12
- const tables = document.querySelectorAll('.table-responsive-collapse');
13
- // Each Table
14
- [].forEach.call(tables, (table: HTMLTableElement) => {
15
- // Header Titles
16
- const headers: string[] = [];
17
- [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
18
- const colSpan = header.colSpan
19
- for (let i = 0; i < colSpan; i++) {
20
- headers.push(header.textContent.replace(/\r?\n|\r/, ''));
21
- }
22
- });
23
- // for each row in tbody
24
- [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
25
- // for each cell
26
- [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
27
- // apply the attribute
28
- cell.setAttribute('data-title', headers[headerIndex])
29
- })
30
- })
31
- });
32
-
33
- // New sticky columns logic
34
- this.initStickyColumns();
35
- }
36
-
37
- private initStickyColumns(): void {
38
- // Find tables with sticky-left-column class
39
- const tables = document.querySelectorAll('.sticky-left-column');
40
-
41
- tables.forEach((table) => {
42
- // Extract sticky left column IDs by looking at the component's class
43
- const classList = Array.from(table.classList);
44
-
45
- // Look for classes in the format sticky-left-column-{ids}
46
- const stickyColumnClass = classList.find(cls => cls.startsWith('sticky-columns-'));
47
- if (stickyColumnClass) {
48
- // Extract the IDs from the class name
49
- this.stickyLeftColumns = stickyColumnClass
50
- .replace('sticky-columns-', '')
51
- .split('-');
52
-
53
- if (this.stickyLeftColumns.length > 0) {
54
- this.handleStickyColumnsRef = this.handleStickyColumns.bind(this);
55
- this.handleStickyColumns();
56
- window.addEventListener('resize', this.handleStickyColumnsRef);
57
- }
4
+ static get selector(): string {
5
+ return '.table-responsive-collapse'
6
+ }
7
+
8
+ connect(): void {
9
+ const tables = document.querySelectorAll('.table-responsive-collapse');
10
+
11
+ // Each Table
12
+ [].forEach.call(tables, (table: HTMLTableElement) => {
13
+ // Header Titles
14
+ const headers: string[] = [];
15
+ [].forEach.call(table.querySelectorAll('th'), (header: HTMLTableCellElement) => {
16
+ const colSpan = header.colSpan
17
+ for (let i = 0; i < colSpan; i++) {
18
+ headers.push(header.textContent.replace(/\r?\n|\r/, ''));
58
19
  }
59
20
  });
60
- }
61
-
62
- private handleStickyColumns(): void {
63
- let accumulatedWidth = 0;
64
21
 
65
- this.stickyLeftColumns.forEach((colId, index) => {
66
- const isLastColumn = index === this.stickyLeftColumns.length - 1;
67
- const header = document.querySelector(`th[id="${colId}"]`);
68
- const cells = document.querySelectorAll(`td[id="${colId}"]`);
69
-
70
- if (header) {
71
- header.classList.add('sticky');
72
- (header as HTMLElement).style.left = `${accumulatedWidth}px`;
73
-
74
- if (!isLastColumn) {
75
- header.classList.add('with-border');
76
- header.classList.remove('sticky-shadow');
77
- } else {
78
- header.classList.remove('with-border');
79
- header.classList.add('sticky-shadow');
80
- }
81
-
82
- accumulatedWidth += (header as HTMLElement).offsetWidth;
83
- }
84
-
85
- cells.forEach((cell) => {
86
- cell.classList.add('sticky');
87
- (cell as HTMLElement).style.left = `${accumulatedWidth - (header as HTMLElement).offsetWidth}px`;
88
-
89
- if (!isLastColumn) {
90
- cell.classList.add('with-border');
91
- cell.classList.remove('sticky-shadow');
92
- } else {
93
- cell.classList.remove('with-border');
94
- cell.classList.add('sticky-shadow');
95
- }
96
- });
97
- });
98
- }
99
-
100
- // Cleanup method to remove event listener
101
- disconnect(): void {
102
- if (this.handleStickyColumnsRef) {
103
- window.removeEventListener('resize', this.handleStickyColumnsRef);
104
- }
105
- }
106
- }
22
+ // for each row in tbody
23
+ [].forEach.call(table.querySelectorAll('tbody tr'), (row: HTMLTableRowElement) => {
24
+ // for each cell
25
+ [].forEach.call(row.cells, (cell: HTMLTableCellElement, headerIndex: number) => {
26
+ // apply the attribute
27
+ cell.setAttribute('data-title', headers[headerIndex])
28
+ })
29
+ })
30
+ })
31
+ }
32
+ }
@@ -21,5 +21,4 @@
21
21
  @import "striped";
22
22
  @import "outer_padding";
23
23
  @import "sticky_columns";
24
- @import "scroll";
25
- @import "collapsible";
24
+ @import "scroll";